Fork me on GitHub

JArgP

Under what license is JArgP available?

[top]


Something doesn't seem to be working right. What do I do?
  1. Have you read the documentation? If not, do that first.

  2. Take a look at the list of open bugs, maybe it is a known flaw.

  3. If you can't find an open bug, take a look at the list of closed ones. Maybe it's an old bug that has been solved. If it is, make sure you have the latest version of JArgP.

  4. If there is no reported bug at all, feel free to report it yourself.

  5. If you think you may be able to solve the bug, fork the GitHub repo, solve the bug and create a pull request.

    More information regarding forking and pulling is available at GitHub's help pages.

[top]

Command Line Parsing

What determines which options take a value?

All options take a value (the next command line argument), except for those whose field is a Boolean (or a subclass thereof).

[top]


How can I reverse the value of a boolean?

Set the opposite element to true, and each of the option's names will get a --no-… alias that, when used, sets the value of the field to false.

If this is not what you want, you can use a second (boolean) field with different names and/or patterns, and use its negated value in combination with the first field.

[top]


How can I define --<number> options? (E.g. --1, --2, etc.)

Use the pattern element like so: [0-9]+.

[top]


What happens when multiple options share a name? Or when patterns and names "overlap"?

Options are tried in the order returned by Java's reflection functionality, so the behaviour in cases of overlap is undefined.

Patterns are, however, always tried after names. Pattern overlap can often be solved with more specific regular expressions.

[top]