示例#1
0
        public static void ExecuteFromArgs(string[] args, Assembly opearationsAssembly, Options?options = null)
        {
            options = options ?? Options.Default;

            opearationsAssembly = opearationsAssembly ?? throw new ArgumentNullException(nameof(opearationsAssembly));
            args = args ?? throw new ArgumentNullException(nameof(args));

            IOperation[]? operations = null;
            try
            {
                operations = BuildOperations(args, opearationsAssembly, options);

                if (operations.Length == 0)
                {
                    throw new NoOperationsException();
                }
            }
            catch (Exception ex)
            {
                string helpText = HelpTextBuilder.BuildHelpText(opearationsAssembly, ex);
                throw new CommandParsingException(helpText, ex);
            }

            ExecuteOperations(operations ?? new IOperation[0]);
        }
示例#2
0
文件: Exploratory.cs 项目: kowgli/CCP
 public void DoesPrintHelp()
 {
     Type   type     = typeof(OperationWithBaseClass2);
     string helpText = HelpTextBuilder.BuildHelpText(type.Assembly);
 }
示例#3
0
 public void DoesPrintHelp()
 {
     Type   type     = typeof(OperationWithSimpleProps);
     string helpText = HelpTextBuilder.BuildHelpText(type.Assembly);
 }