Exemplo n.º 1
0
        private static CommandArgumentHelp GetInvalidArgumentString(Type argumentType, CommandArgument argument)
        {
            var cmdLine = string.Join(" ", CommandLine.Args);
            var message = argument.IsParameter()
                              ? string.Format("Invalid argument \"{0}\" at parameter index {1} in command line \"{2}\"", argument.Token, argument.ParameterNumber, cmdLine)
                              : string.Format("Invalid command \"{0}\" at index {1} in command line \"{2}\"", argument.Token, cmdLine.IndexOf(argument.Token), cmdLine);

            return(new CommandArgumentHelp(argumentType, message));
        }
Exemplo n.º 2
0
 public CommandLineArgumentInvalidException(Type argumentType, CommandArgument argument)
     : base(GetInvalidArgumentString(argumentType, argument))
 {
 }
 /// <summary>
 ///   Returns a boolean value from a command switch
 /// </summary>
 /// <param name = "cmd">The command switch</param>
 /// <returns>A boolean value based on the switch and value</returns>
 private static bool GetBoolValue(CommandArgument cmd)
 {
     return(string.IsNullOrWhiteSpace(cmd.SwitchOption) || cmd.SwitchOption.Trim() == "+");
 }