public string PromptForLine(string message) { if(message.EndsWith(": ") == false) { message += ": "; } ConsoleString.Write(message, ConsoleColor.Yellow); var input = Reader.ReadLine().ToString(); return input; }
/// <summary> /// Prompts the user to enter a value for the given property in the case that the option was specified with no value /// </summary> /// <param name="context">the parser context</param> public override void BeforePopulateProperty(ArgHook.HookContext context) { if (context.ArgumentValue == string.Empty) { var cli = new CliHelper(); ITabCompletionHandler tabHandler; IHighlighterConfigurator highlighterConfigurator; if (TabCompletionHandlerType.TryCreate<ITabCompletionHandler>(out tabHandler)) { cli.Reader.TabHandler.TabCompletionHandlers.Add(tabHandler); } if (HighlighterConfiguratorType.TryCreate<IHighlighterConfigurator>(out highlighterConfigurator)) { cli.Reader.Highlighter = new SimpleSyntaxHighlighter(); highlighterConfigurator.Configure(cli.Reader.Highlighter); } context.ArgumentValue = cli.PromptForLine("Enter value for " + context.CurrentArgument.DefaultAlias); } }