Class CommandLineParser

java.lang.Object
org.apache.maven.wrapper.cli.CommandLineParser

public class CommandLineParser extends Object

A command-line parser which supports a command/sub-command style command-line interface. Supports the following syntax:

 <option>* (<sub-command> <sub-command-option>*)*
 
  • Short options are a '-' followed by a single character. For example: -a.
  • Long options are '--' followed by multiple characters. For example: --long-option.
  • Options can take arguments. The argument follows the option. For example: -a arg or --long arg.
  • Arguments can be attached to the option using '='. For example: -a=arg or --long=arg.
  • Arguments can be attached to short options. For example: -aarg.
  • Short options can be combined. For example -ab is equivalent to -a -b.
  • Anything else is treated as an extra argument. This includes a single - character.
  • '--' indicates the end of the options. Anything following is not parsed and is treated as extra arguments.
  • The parser is forgiving, and allows '--' to be used with short options and '-' to be used with long options.
  • The set of options must be known at parse time. Sub-commands and their options do not need to be known at parse time. Use ParsedCommandLine.getExtraArguments() to obtain the non-option command-line arguments.
  • Constructor Details

    • CommandLineParser

      public CommandLineParser()
    • CommandLineParser

      public CommandLineParser(Writer deprecationPrinter)
  • Method Details