internal CommandConfigurator RegisterParameterSeriesInstance <T>(ParameterSeries parameterSeries) { ValidateType <T>(parameterSeries); _paramSeries = parameterSeries; return(this); }
/// <summary> /// Register parameter series for the command /// </summary> /// <param name="name">Parameter name</param> /// <param name="description">Parameter description for help.</param> /// <returns>Self instance</returns> public CommandConfigurator RegisterParameterSeries <T>(string name, string description) { var parameterSeries = new ParameterSeries { Name = name, Description = description, ValueType = typeof(T) }; return(RegisterParameterSeriesInstance <T>(parameterSeries)); }
private bool ReadParamSeries(ParameterSeries parameterSeries, CommandArgs commandArgs, string arg) { if (parameterSeries == null) { return(false); } commandArgs.AddParameterToSeries(_valueConverter.ConvertValueToExpectedType(arg, parameterSeries.ValueType, parameterSeries.Converter)); return(true); }
/// <summary> /// Creates new instance of command configuration. /// </summary> /// <param name="name">Command name</param> /// <param name="printHelpOnExecute">If True command will print help instead of running execute method</param> /// <param name="parents">Command parents list</param> /// <param name="commands">List of registered commands</param> /// <param name="defaultCommand">Default command to run where subcommand is not defined in params</param> /// <param name="options">List of registered options</param> /// <param name="parameters">List of registered parameters</param> /// <param name="parameterSeries">Registered parameter series</param> /// <param name="execute">Function to execute when command is called</param> public CommandConfig( string name, bool printHelpOnExecute, List <string> parents, List <CommandConfigurator> commands, CommandConfigurator defaultCommand, List <PrefixedDefaultValueArgument> options, List <Parameter> parameters, ParameterSeries parameterSeries, Func <CommandArgs, IOutput, int> execute) { Name = name; Parents = parents; Options = options; Parameters = parameters; ParameterSeries = parameterSeries; Execute = execute; PrintHelpOnExecute = printHelpOnExecute; DefaultCommand = defaultCommand; Commands = commands; }