Esempio n. 1
0
        public void VerifyEmptyModelTestDoesNotBreak()
        {
            var definition = Configuration.Configure<EmptyHelpModelTest>();
            var help = new Help.HelpProvider().GenerateModelHelp(definition);

            var f = new ConsoleHelpFormatter(80, 1, 5);

            f.GetHelp(help).Should().Be.EqualTo("<command> \r\n\r\n\r\n");
        }
Esempio n. 2
0
        public void VerifyHelpOutput()
        {
            var definition = Configuration.Configure<HelpModelTest>();
            var help = new Help.HelpProvider().GenerateModelHelp(definition);

            var f = new ConsoleHelpFormatter(80, 1, 5);

            f.GetHelp(help).Should().Be.EqualTo(Properties.Resources.HelpOutput);
        }
Esempio n. 3
0
        /// <summary>
        /// Parses the command line arguments into 
        /// </summary>
        /// <param name="args">Array of command line arguments.</param>
        /// <returns>A set of options.</returns>
        private static Options ParseArguments(string[] args)
        {
            var optionModel = Args.Configuration.Configure<Options>();
            var options = optionModel.CreateAndBind(args);

            if (options.Help)
            {
                var help = new Args.Help.HelpProvider().GenerateModelHelp(optionModel);
                var formatter = new ConsoleHelpFormatter();

                Console.WriteLine(formatter.GetHelp(help));
            }

            return options;
        }
Esempio n. 4
0
 private static void ShowHelp(IModelBindingDefinition<Options> argsConfig)
 {
     var helpProvider = new HelpProvider();
     var help = helpProvider.GenerateModelHelp(argsConfig);
     var helpFormatter = new ConsoleHelpFormatter();
     Console.WriteLine(helpFormatter.GetHelp(help));
     Console.ReadKey();
 }
 public static void WriteHelp()
 {
     var help = new HelpProvider().GenerateModelHelp(Configuration.Configure<Arguments>());
     var f = new ConsoleHelpFormatter(Console.BufferWidth, 1, 5);
     Console.WriteLine(f.GetHelp(help));
 }
Esempio n. 6
0
        private static void OutputHelp(IModelBindingDefinition<ProgramOptions> configuration)
        {
            var help = new HelpProvider();
            var helpProvider = help.GenerateModelHelp(configuration);

            var consoleFormatter = new ConsoleHelpFormatter(80, 1, 5);
            Console.WriteLine(consoleFormatter.GetHelp(helpProvider));
        }
Esempio n. 7
0
 private static void ShowHelp(IModelBindingDefinition<ConversionOrder> argsDefinition)
 {
     var help = new Args.Help.HelpProvider().GenerateModelHelp(argsDefinition);
     var f = new ConsoleHelpFormatter(80, 1, 5);
     Console.WriteLine(f.GetHelp(help));
 }
Esempio n. 8
0
        private static void ShowHelp(IModelBindingDefinition<CmdLine> definition)
        {
            var help = new HelpProvider().GenerateModelHelp(definition);
            var helpFormatter = new ConsoleHelpFormatter(System.Console.WindowWidth, 1, 5);
            help.HelpText = Assembly.GetExecutingAssembly().FullName + Environment.NewLine;

            var helpString = helpFormatter.GetHelp(help);
            System.Console.Error.WriteLine(helpString);
        }