/// <summary> /// Adds an <see cref="Argument" />. /// </summary> /// <param name="argumentProcessor">The <see cref="ArgumentProcessor" /></param> /// <returns></returns> public static Argument AddArgument(this ArgumentProcessor argumentProcessor) { var argument = new Argument(argumentProcessor); argumentProcessor.Arguments.Add(argument); return(argument); }
/// <summary> /// Adds an <see cref="Argument" />. /// </summary> /// <param name="argumentProcessor">The <see cref="ArgumentProcessor" /></param> /// <param name="flags"></param> /// <returns></returns> public static Argument AddArgument(this ArgumentProcessor argumentProcessor, params string[] flags) { var argument = new Argument(argumentProcessor) { Flags = flags }; argumentProcessor.Arguments.Add(argument); return(argument); }
/// <summary> /// Adds an <see cref="Argument" />. /// </summary> /// <param name="argumentProcessor">The <see cref="ArgumentProcessor" /></param> /// <param name="action">The action.</param> /// <returns>Argument.</returns> public static Argument AddArgument(this ArgumentProcessor argumentProcessor, Action <string> action) { var argument = new Argument(argumentProcessor) { Action = (t, p) => action(p) }; argumentProcessor.Arguments.Add(argument); return(argument); }
/// <summary> /// Adds an <see cref="Argument" />. /// </summary> /// <typeparam name="TTarget">The type of the argument action target.</typeparam> /// <param name="argumentProcessor">The <see cref="ArgumentProcessor" /></param> /// <param name="action">The action.</param> /// <param name="target">The target.</param> /// <returns>Argument.</returns> public static Argument AddArgument <TTarget>(this ArgumentProcessor argumentProcessor, Action <TTarget, string> action, TTarget target) { var argument = new Argument(argumentProcessor) { Action = (t, p) => action(target, p), Target = target }; argumentProcessor.Arguments.Add(argument); return(argument); }
/// <summary> /// Initializes a new instance of the<see cref="Argument" /> class. /// </summary> /// <param name="arguments">The set of arguments from which the argument originated.</param> public Argument(ArgumentProcessor arguments) { Arguments = arguments; }
/// <summary> /// Uses the source parameters with the current <see cref="ArgumentProcessor" />. /// </summary> /// <param name="argumentProcessor">The <see cref="ArgumentProcessor" /></param> /// <param name="source">The source arguments.</param> /// <returns></returns> public static ArgumentProcessor UsingSource(this ArgumentProcessor argumentProcessor, params string[] source) { argumentProcessor.Source = source; return(argumentProcessor); }
/// <summary> /// Uses the parameter separator with the current <see cref="ArgumentProcessor" />. /// </summary> /// <param name="argumentProcessor">The <see cref="ArgumentProcessor" /></param> /// <param name="separator">The separator character.</param> /// <returns></returns> public static ArgumentProcessor UsingParameterSeparator(this ArgumentProcessor argumentProcessor, char separator) { argumentProcessor.ParameterSeparator = separator; return(argumentProcessor); }
/// <summary> /// Uses the argument separators with the current <see cref="ArgumentProcessor" />. /// </summary> /// <param name="argumentProcessor">The <see cref="ArgumentProcessor" /></param> /// <param name="separators">The argument separators.</param> /// <returns></returns> public static ArgumentProcessor UsingArgumentSeparators(this ArgumentProcessor argumentProcessor, params string[] separators) { argumentProcessor.ArgumentSeparators = separators; return(argumentProcessor); }