Example #1
0
 public void Add(string name,
                 char flag,
                 string helpText,
                 string defaultValue,
                 Arg.Type type)
 {
     Add(name,
         flag,
         helpText,
         defaultValue,
         type,
         Validator.AcceptAll,
         new string[] { },
         new string[] { });
 }
Example #2
0
 public void Add(string name,
                 char flag,
                 string helpText,
                 string defaultValue,
                 Arg.Type type,
                 Arg.ValidatorDelegate validator)
 {
     Add(name,
         flag,
         helpText,
         defaultValue,
         type,
         validator,
         new string[] { },
         new string[] { });
 }
Example #3
0
        public void Add(string name,
                        char flag,
                        string helpText,
                        string defaultValue,
                        Arg.Type type,
                        Arg.ValidatorDelegate validator,
                        string[] conflicts,
                        string[] overrides)
        {
            if (reservedVariablesAreLocked)
            {
                if (name == "help")
                {
                    throw new ParseException($"Argument name 'help' is reserved for the help text.");
                }
                else if (flag == 'h')
                {
                    throw new ParseException($"Argument flag 'h' is reserved for the help text.");
                }
                else if (name == "version")
                {
                    throw new ParseException($"Argument name 'version' is reserved for the program version.");
                }
                else if (flag == 'v')
                {
                    throw new ParseException($"Argument flag 'v' is reserved for the program version.");
                }
            }

            optionalArgs.Add(new OptionalArg(name,
                                             flag,
                                             helpText,
                                             defaultValue,
                                             type,
                                             validator,
                                             conflicts,
                                             overrides));
        }