示例#1
0
文件: Program.cs 项目: 602p/nbfc
        private static void ParseArgs(string[] args)
        {
            var opt     = new Verbs();
            var helpGen = new HelpGenerator <Verbs>();

            helpGen.DescriptionDistance = 25;
            var parser = new CliParser <Verbs>(opt, ParserOptions.CaseInsensitive, helpGen);

            parser.StrictParse(args);

            if (opt.Start != null)
            {
                StartService(opt.Start.ReadOnly);
            }
            else if (opt.Stop != null)
            {
                StopService();
            }
            else if (opt.Set != null)
            {
                SetFanSpeed(opt.Set);
            }
            else if (opt.Config != null)
            {
                ConfigureService(opt.Config);
            }
            else if (opt.Status != null)
            {
                PrintStatus(opt.Status);
            }
            else
            {
                Console.WriteLine(helpGen.GetHelp(parser.Config));
            }
        }