Exemplo n.º 1
0
        public override async Task <int> RunAsync(string[] args)
        {
            bool success;
            var  watch = System.Diagnostics.Stopwatch.StartNew();

            var client = new BlipHttpClientAsync(VALID_AUTHORIZATION);

            using (var spinner = CLI.Spinner("Sending..."))
            {
                success = await client.PingAsync(Node.Value);
            }

            watch.Stop();
            var elapsedMilli = watch.ElapsedMilliseconds;

            if (success)
            {
                Console.WriteLine($"Response from [{Node.Value}]: time={elapsedMilli}ms");
            }
            else
            {
                using (CLI.WithForeground(ConsoleColor.Red))
                {
                    Console.WriteLine($"Without response from [{Node.Value}]: time={elapsedMilli}ms");
                }
            }

            return(0);
        }