示例#1
0
        public void Show_1()
        {
            MockOutput output = new MockOutput();
            OutputHelp outputHelp = new OutputHelp(CliOptions.WindowsStyle, output);
            List<Description> descs = new List<Description>
                                      {
                                          new Description("width", "The width of the rectangle.", eROLE.NAMED,
                                              new ParamString(), eSCOPE.REQUIRED, eMULTIPLICITY.ONCE),
                                          new Description("filename", "The input file.", eROLE.PASSED, new ParamString(),
                                              eSCOPE.OPTIONAL, eMULTIPLICITY.ONCE)
                                      };
            outputHelp.Show(descs);

            string[] lines = output.getLines();

            CollectionAssert.AreEqual(
                new[]
                {
                    "Usage: GemsCLI [/options] [filename]",
                    "Where options include:",
                    "/width The width of the rectangle.",
                    "filename* The input file.",
                    "* shows optional parameters."
                },
                lines);
        }
示例#2
0
        /// <summary>
        /// The main entry point for the example.
        /// </summary>
        /// <param name="pArgs">The arguments from the command line.</param>
        private static void Main(string[] pArgs)
        {
            WriteGreeting();

            CliOptions options = CliOptions.WindowsStyle;

            List<Description> descs = DescriptionFactory.Create(
                options, new HelpResource(Help.ResourceManager),
                "/echo [/mode:string#] /address:string /database:string /username:string [/password:string] filename [output:string]"
                );

            ConsoleFactory consoleFactory = new ConsoleFactory();

            if (pArgs.Length == 0)
            {
                OutputHelp outputHelp = new OutputHelp(options, consoleFactory.Create());
                outputHelp.Show(descs);
                return;
            }

            Request request = RequestFactory.Create(options, pArgs, descs, consoleFactory);
        }
示例#3
0
 public void HelpOutput()
 {
     OutputHelp outputHelp = new OutputHelp(CliOptions.WindowsStyle, new MockOutput(), true);
 }