Пример #1
0
 public CommandLineParser MustHaveSwitch(string swtch, Action <string> hasSwitchAction)
 {
     if (!HasSwitch(swtch))
     {
         throw ParameterException.MissingParameter(swtch, ParameterException.ParameterTypes.Switch);
     }
     hasSwitchAction(swtch);
     _switches[swtch] = true;
     return(this);
 }
Пример #2
0
 public CommandLineParser MustHaveNamedArg(string name, Action <string> hasNamedArgAction)
 {
     if (!HasNamedArg(name))
     {
         throw ParameterException.MissingParameter(name, ParameterException.ParameterTypes.NamedParameter);
     }
     hasNamedArgAction(name);
     if (!_namedArgs[name].Item1)
     {
         _namedArgs[name] = new Tuple <bool, Stack <string> >(true, _namedArgs[name].Item2);
     }
     return(this);
 }