Beispiel #1
0
        /// <summary>
        /// Helper for a yes/no prompt
        /// </summary>
        /// <param name="question">Question to ask</param>
        /// <returns>true of yes was typed</returns>
        private static bool YesNo(string question)
        {
            var prompt = new Prompt()
            {
                AllowEmpty      = false,
                Choices         = new string[] { "y", "n" },
                Default         = "n",
                Prefix          = question,
                ValidateChoices = true
            };

            return(prompt.DoPrompt() == "y");
        }
Beispiel #2
0
        protected static void DemoPrompt()
        {
            Prompt prompt = new Prompt()
            {
                AllowEmpty      = false,
                Prefix          = "Choose your choice",
                Default         = "okay",
                ValidateChoices = true,
                ChoicesText     = new Dictionary <string, string>()
                {
                    { "yes", "Yea, lets go" },
                    { "sure", "Sure, why not" },
                    { "okay", "Okay, go for it" },
                    { "yay", "Yay, kay, thx, bye" }
                }
            };

            CoEx.WriteTitleLarge("Welcome, lets get started with a basic prompt");
            CoEx.WriteLine();

            prompt.DoPrompt();
        }