Package picocli

Class CommandLine.NoOpParameterPreprocessor

java.lang.Object
picocli.CommandLine.NoOpParameterPreprocessor
All Implemented Interfaces:
CommandLine.IParameterPreprocessor
Enclosing class:
CommandLine

private static class CommandLine.NoOpParameterPreprocessor extends Object implements CommandLine.IParameterPreprocessor
  • Constructor Details

    • NoOpParameterPreprocessor

      private NoOpParameterPreprocessor()
  • Method Details

    • preprocess

      public boolean preprocess(Stack<String> args, CommandLine.Model.CommandSpec commandSpec, CommandLine.Model.ArgSpec argSpec, Map<String,Object> info)
      Description copied from interface: CommandLine.IParameterPreprocessor
      Called when either the command, option or positional parameter that has this preprocessor configured was recognized by the picocli parser.

      Implementors are free to modify one or more of the specified command line arguments before they are processed by the picocli parser (or by the option's parameter consumer, if one is specified).

      Implementors may optionally consume one or more of the specified command line arguments: a return value of true signals that the preprocessor consumed the parameter: picocli should skip further processing of this option or positional parameter, and the preprocessor implementation takes responsibility for assigning the option or positional parameter a value. A return value of false means that picocli should process the stack as usual for this option or positional parameter, and picocli is responsible for assigning this option or positional parameter a value.

      For a command, returning true signals that the preprocessor takes responsibility for parsing all options and positional parameters for this command, and takes responsibility for validating constraints like whether all required options and positional parameters were specified. A return value of false means that picocli should process the stack as usual for this command, and picocli is responsible for validation. Command preprocessors can signal back to the picocli parser when they detect that the user requested version information or usage help by putting a value of true in the specified info map for keys versionHelpRequested or usageHelpRequested, respectively.

      If the user input is invalid, implementations should throw a CommandLine.ParameterException with a message to display to the user.

      Specified by:
      preprocess in interface CommandLine.IParameterPreprocessor
      Parameters:
      args - the remaining command line arguments that follow the matched argument (the matched argument is not on the stack anymore)
      commandSpec - the command or subcommand that was matched (if the specified argSpec is null), or the command that the matched option or positional parameter belongs to
      argSpec - the option or positional parameter for which to pre-process command line arguments (may be null when this method is called for a subcommand that was matched)
      info - a map containing additional information on the current parser state, including whether the option parameter was attached to the option name with a `=` separator, whether quotes have already been stripped off the option, etc. Implementations may modify this map to communicate back to the picocli parser. Supported values:
      Supported values in the info Map
      keyvalid valuestype
      separator'' (empty string): attached without separator, ' ' (space): not attached, (any other string): option name was attached to option param with specified separator java.lang.String
      negated true: the option or positional parameter is a negated option/parameter, false: the option or positional parameter is not a negated option/parameter java.lang.Boolean
      unquoted true: quotes surrounding the value have already been stripped off, false: quotes surrounding the value have not yet been stripped off java.lang.Boolean
      versionHelpRequested true: version help was requested, false: version help was not requested java.lang.Boolean
      usageHelpRequested true: usage help was requested, false: usage help was not requested java.lang.Boolean
      Returns:
      true if the preprocessor consumed the parameter and picocli should skip further processing of the stack for this option or positional parameter; false if picocli should continue processing the stack for this option or positional parameter
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object