Esempio n. 1
0
 /// <summary>
 /// Makes the specified name a valid command line argument.  Command line
 /// arguments are assumed to be in the format /&lt;name&gt;:&lt;value&gt;.
 /// </summary>
 /// <param name="name">The name of the command line argument.</param>
 /// <param name="allowNull">If true no value for the specified name is necessary.</param>
 /// <param name="addAcronym">Add another valid argument of the acronym of the specified name</param>
 public static void AddValidArgument(string name, bool allowNull, bool addAcronym = false, string description = null, string valueExample = null)
 {
     ValidArgumentInfo.Add(new ArgumentInfo(name, allowNull, description, valueExample));
     if (addAcronym)
     {
         ValidArgumentInfo.Add(new ArgumentInfo(name.CaseAcronym().ToLowerInvariant(), allowNull, $"{description}; same as {name}", valueExample));
     }
 }
Esempio n. 2
0
 protected static void ParseArgs(string[] args)
 {
     Arguments = new ParsedArguments(args, ValidArgumentInfo.ToArray());
     if (Arguments.Status == ArgumentParseStatus.Error || Arguments.Status == ArgumentParseStatus.Invalid)
     {
         ArgsParsedError?.Invoke(Arguments);
     }
     else if (Arguments.Status == ArgumentParseStatus.Success)
     {
         ArgsParsed?.Invoke(Arguments);
     }
 }
Esempio n. 3
0
 protected static void ParseArgs(string[] args)
 {
     Arguments  = new ParsedArguments(args, ValidArgumentInfo.ToArray());
     StackTrace = Arguments.Contains("stacktrace");
     if (Arguments.Status == ArgumentParseStatus.Error || Arguments.Status == ArgumentParseStatus.Invalid)
     {
         if (ArgsParsedError != null)
         {
             ArgsParsedError(Arguments);
         }
     }
     else if (Arguments.Status == ArgumentParseStatus.Success)
     {
         if (ArgsParsed != null)
         {
             ArgsParsed(Arguments);
         }
     }
 }
Esempio n. 4
0
 /// <summary>
 /// Makes the specified name a valid command line argument.  Command line
 /// arguments are assumed to be in the format /&lt;name&gt;:&lt;value&gt;.
 /// </summary>
 /// <param name="name">The name of the command line argument.</param>
 /// <param name="allowNull">If true no value for the specified name is necessary.</param>
 public static void AddValidArgument(string name, bool allowNull)
 {
     ValidArgumentInfo.Add(new ArgumentInfo(name, allowNull));
 }