question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Long boolean options with arity 0 still allow parameters.

See original GitHub issue

Given a option definition:

@CommandLine.Option(names = {"--no-global-labels"}, arity = "0")
public void setNoGlobalLabels(final boolean noGlobalLabels) {}

This still allows --no-global-labels=false.

For non-boolean long options arity = "0" probably doesn’t make sense. But for options like this it’d be nice to have picocli enforce the arity rather than have to check the boolean parameter and throw an exception if its false.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
zegelincommented, Oct 10, 2018

@remkop Thanks for the quick-fix. I can wait till 3.7 since I have interm a work-around (throw if value = false).

0reactions
remkopcommented, Oct 10, 2018

Fixed in master.

Is this a critical issue for you? (That is, do you need a 3.6.2 release for this, or can it wait a few weeks for the 3.7 release?)

Read more comments on GitHub >

github_iconTop Results From Across the Web

CommandLine.Option (picocli 4.7.0 API)
By default picocli allows boolean options (also called "flags" or "switches") to have an optional parameter, which must be either "true" or "false"...
Read more >
JCommander
When a Parameter annotation is found on a field of type boolean or Boolean , JCommander interprets it as an option with an...
Read more >
CliBuilder (groovy 2.5.8 API)
An option must have either a long name or a short name (or both). args, int or String, arity, args indicates the number...
Read more >
Command-line syntax overview for System.CommandLine
Options that have no value specified are typically Boolean parameters that default to true if the option is specified on the command line....
Read more >
CommandLine.Range (Apache Log4j Core 2.11.0 API)
Returns the default arity Range : for options this is 0 for booleans and 1 for other types, for parameters booleans have arity...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found