/// <summary> /// Initialize arguments. /// </summary> /// <param name="args">Raw arguments from command line.</param> /// <param name="prefix">Prefix used for named arguments. "-".</param> /// <param name="keyValueSeparator">Separator used for named arguments key/values. ":".</param> /// <param name="supported">Supported named/positional argument definitions.</param> /// <param name="named">Named arguments</param> /// <param name="positional">Positional arguments.</param> public Args(string[] args, string prefix, string keyValueSeparator, List <ArgAttribute> supported, Dictionary <string, string> named, List <string> positional) { Raw = args; Prefix = prefix; Separator = keyValueSeparator; Schema = new ArgsSchema(this); if (supported != null) { Schema.Items = supported; } if (named != null) { Named = named; } if (positional != null) { Positional = positional; } }
/// <summary> /// Initialize only the prefix / separator. /// </summary> public Args(string prefix, string separator) { Prefix = prefix; Separator = separator; Schema = new ArgsSchema(this); }
/// <summary> /// Build usage of the arguments using the schema /// </summary> /// <param name="argsList"></param> /// <returns></returns> public static string Build(ArgsSchema schema) { return(Build("app", schema.Items, "-", ":")); }