Welcome to CmdLineParser!

CmdLineParser provides a command line option parsing API
that can be used inside Java(>=1.5) programs.
Right now, it supports following option formats:
  • --key01=value01 [key02=value02 ..]
  • -key01=value01 [-key02=value02 ..]
  • key01=value01 [key02=value02 ..]
  • --k=v [--t=w ..]
  • -k=v [-t=w ..]
  • k=v [t=w ..]
  • --key01 value01 [key02 value02 ..]
  • -key01 value01 [-key02 value02 ..]
  • key01 value01 [key02 value02 ..]
  • --k v [--t w ..]
  • -k v [-t w ..]
  • k v [t w ..]
  • --flag [--flag ..]
  • -flag [-flag ..]
  • flag [flag ..]
  • --f [--f ..]
  • -f [-f ..]
  • f [f ..]
CmdLineParser already provides a basic set on different Options
to parse the value from:
  • StringSingleOption:
    • provided: a_single_string
    • parsed: a_single_string
  • StringMultiOption:
    • provided stringA,stringB
    • parsed: List<String>{stringA, stringB}
  • BooleanSingleOption:
    • provided: true
    • parsed: Boolean.TRUE
    • provided: false_or_anything_else
    • parsed: Boolean_FALSE
  • VoidOption:
    • provides no value, but represents a flag that can be set or not. E.g. --help, -version ...
CmdLineParser also gives you the possibility to escape characters
like whitespaces using following escape characters:
  • Escape a sequence using '""':

    "this string contains whitespaces!"

  • Escape a single character using '\':

    this\ string\ contains\ whitespaces!

Last but not least, CmdLineParser has a build in option dependency and option clashing system! You can define options that require other options to be set and also you can define options that are only valid, if another option is not set. For more details, take a look at the examples to get started! Example of Usage