Interface CommandLine


public interface CommandLine
Represents the parsed command line options.
Since:
1.0
Author:
Graeme Rocher
  • Method Details

    • getRemainingArgs

      List<String> getRemainingArgs()
      Returns:
      The remaining arguments after the command name
    • getSystemProperties

      Properties getSystemProperties()
      Returns:
      The system properties specified
    • getOptions

      Map<Option,Object> getOptions()
      Returns:
      The declared option values
    • hasOption

      boolean hasOption(String name)
      Parameters:
      name - The name of the option
      Returns:
      Whether the given option is specified
    • optionValue

      Object optionValue(String name)
      The value of an option.
      Parameters:
      name - The option
      Returns:
      The value
    • lastOption

      Map.Entry<String,Object> lastOption()
      Returns:
      The last specified option
    • getRemainingArgsString

      String getRemainingArgsString()
      Returns:
      The remaining args as one big string
    • getRemainingArgsWithOptionsString

      String getRemainingArgsWithOptionsString()
      Returns:
      The remaining args as one big string without undeclared options
    • getUndeclaredOptions

      Map<String,Object> getUndeclaredOptions()
      Returns:
      Any undeclared options
    • parseNew

      CommandLine parseNew(String[] args)
      Parses a new CommandLine instance that combines this instance with the given arguments.
      Parameters:
      args - The arguments
      Returns:
      A new CommandLine instance
    • getRawArguments

      String[] getRawArguments()
      Returns:
      The raw unparsed arguments
    • build

      static CommandLine.Builder build()
      Build and parse a new command line.
      Returns:
      The builder
    • parse

      static CommandLine parse(String... args)
      Parse a new command line with the default options.
      Parameters:
      args - The arguments
      Returns:
      The command line