Ejemplo n.º 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]);
        }
Ejemplo n.º 2
0
 public void DoesPrintHelp()
 {
     Type   type     = typeof(OperationWithBaseClass2);
     string helpText = HelpTextBuilder.BuildHelpText(type.Assembly);
 }
Ejemplo n.º 3
0
 public void DoesPrintHelp()
 {
     Type   type     = typeof(OperationWithSimpleProps);
     string helpText = HelpTextBuilder.BuildHelpText(type.Assembly);
 }