예제 #1
0
        private static void StartDemo()
        {
            var token = "clear";

            Console.WriteLine($"Write {token} to clear the buffer from this message, or exit to close");

            // Save current buffer position
            MemoriseBufferPosition("BATATAS");

            do   // read inputs until keyword is match

            {
                var res = Console.ReadLine();

                // if clear is found, replace buffer
                if (res == token)
                {
                    ClearBufferFrom("BATATAS");
                }
                if (res == "exit")
                {
                    if (ConsoleI.AskConfirmation("Are you sure you want to leave"))
                    {
                        return;
                    }
                }
            } while(true);
        }
예제 #2
0
        private static async Task CreateNewProfile()
        {
            var count   = (await JiraProfileService.GetAvailableProfiles()).Count();
            var profile = await ConsoleI.RenderForm <TerminalJiraProfile>();

            var isDefault = ConsoleI.AskConfirmation("Set as default profile");

            var service = await JiraProfileService.Create(profile, "");

            Console.WriteLine("Created profile " + profile.ProfileName);

            if (count == 0 || isDefault)
            {
                await service.SetAsDefault();

                Console.WriteLine("Profile set as default");
            }
        }
예제 #3
0
        protected override async Task <int> HandleCommand(HostCommandRemove o)
        {
            var _handler = GetInstance <IHostsHandlerService>();

            if (!_handler.HasHost(o.Name))
            {
                WriteLine($"Can't find host: {o.Name}".Error());
                return(1);
            }

            var message = $"Do you want to remove host {o.Name}".Warn();

            if (o.Force || ConsoleI.AskConfirmation(message))
            {
                await _handler.RemoveHost(o.Name);

                WriteLine("Host removed".Success());
            }
            return(0);
        }