private CommandAction GetCommand(MethodInfo methodInfo) { var wrapper = new MethodInfoWrapper(methodInfo); CommandAction commandAction = new CommandAction(wrapper.Name, wrapper.Description, wrapper.LinkedToMethod); return commandAction; }
public CommandLineParseResult Parse(CommandAction action, string[] args) { var options = new OptionSet(); var commandLineParameters = new List<CommandLineParameter>(); foreach (ParameterInfoWrapper parameter in action.Parameters) { ParameterInfoWrapper localParameter = parameter; options.Add( localParameter.GetOptionPrototype(), localParameter.Description, parameterValue => commandLineParameters.Add(new CommandLineParameter(localParameter.Name, parameterValue)) ); } try { var extra = options.Parse(args); return new CommandLineParseResult(action, commandLineParameters, extra.ToArray()); } catch (OptionException exception) { throw new CommandLineParseException(exception.Message, action); } }
public CommandLineParseResult(CommandAction commandAction, IEnumerable<CommandLineParameter> parsedParameters, string[] additionalParameters, string message) { CommandAction = commandAction; ParsedParameters = parsedParameters; AdditionalParameters = additionalParameters; Message = message; }
public CommandLineParseResult(CommandAction commandAction, IEnumerable<CommandLineParameter> parsedParameters, string[] additionalParameters) : this(commandAction, parsedParameters, additionalParameters, null) { }
public CommandLineParseResult(CommandAction commandAction, IEnumerable <CommandLineParameter> parsedParameters, string[] additionalParameters) : this(commandAction, parsedParameters, additionalParameters, null) { }