public static Arguments Load(string[] args) { var optionsSet = new OptionsSet(); var arguments = new Arguments(optionsSet); optionsSet.AddOption("-a|--action=", Resources.ActionDescription, value => { var action = PackageIndexManagerAction.Unknown; if (!string.IsNullOrEmpty(value)) { Enum.TryParse(value, true, out action); } arguments.Action = action; }); optionsSet.AddOption("-t|--type=", Resources.TypeDescription, value => arguments.Type = value); optionsSet.AddOption("-p|--package=", Resources.PackageDescription, value => arguments.Package = value); optionsSet.AddOption("-n|--namespace=", Resources.TypeDescription, value => arguments.Namespace = value); optionsSet.AddOption("-e|--extension=", Resources.TypeDescription, value => arguments.Extension = value); optionsSet.AddOption("-df|--dumpfile=", Resources.TypeDescription, value => arguments.DumpFile = value); optionsSet.AddOption("-q|--quiet", Resources.QuietDescription, value => arguments.Quiet = (value != null)); optionsSet.AddOption("-v|--verbose", Resources.VerboseDescription, value => arguments.Verbose = (value != null)); optionsSet.AddOption("-f|--force", Resources.ForceDescription, value => arguments.Force = (value != null)); optionsSet.AddOption("-?|--help", Resources.HelpDescription, value => arguments.ShouldHelp = (value != null)); optionsSet.Parse(args); return arguments; }
public static Arguments Load(string[] args) { var optionsSet = new OptionsSet(); var arguments = new Arguments(optionsSet); optionsSet.AddOption("-a|--action=", Resources.ActionDescription, value => { var action = PackageIndexManagerAction.Unknown; if (!string.IsNullOrEmpty(value)) { Enum.TryParse(value, true, out action); } arguments.Action = action; }); optionsSet.AddOption("-t|--type=", Resources.TypeDescription, value => arguments.Type = value); optionsSet.AddOption("-p|--package=", Resources.PackageDescription, value => arguments.Package = value); optionsSet.AddOption("-n|--namespace=", Resources.TypeDescription, value => arguments.Namespace = value); optionsSet.AddOption("-e|--extension=", Resources.TypeDescription, value => arguments.Extension = value); optionsSet.AddOption("-df|--dumpfile=", Resources.TypeDescription, value => arguments.DumpFile = value); optionsSet.AddOption("-q|--quiet", Resources.QuietDescription, value => arguments.Quiet = (value != null)); optionsSet.AddOption("-v|--verbose", Resources.VerboseDescription, value => arguments.Verbose = (value != null)); optionsSet.AddOption("-f|--force", Resources.ForceDescription, value => arguments.Force = (value != null)); optionsSet.AddOption("-?|--help", Resources.HelpDescription, value => arguments.ShouldHelp = (value != null)); optionsSet.Parse(args); return(arguments); }
public Arguments(OptionsSet optionSet) { _optionSet = optionSet; }