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.

Feature: allow --help for individual options

See original GitHub issue

Sometimes an option is more complex than the command itself. What if a command has a lot of (complex) options, how do you cover it all in the usage/help section for the command? What if you have only one command, but lots of options, wouldn’t you want to provide users the same help facility with options that is currently only possible with commands?

It might be useful to be able to provide help for individual options, so where the following triggers regular usage display:

command --help [--option 1 2 3]

The following might display the usage for a specific option:

command --option --help, or
command --option--help

The alternative is a 20 page usage display for that single command.

Thoughts?

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
remkopcommented, Aug 5, 2018

If --option--help or --option:help is acceptable, you can already accomplish this to some extend. First for each complex option (example: -xxx), define a companion help option (example: -xxx:help):

@Option(names = "--xxx:help", help = true)
boolean showHelpForXxx;

@Option(names = "--xxx")
String xxx;

Then, in the application, check if help for this option is requested and print its specialized help:

if (showHelpForXxx) {
  showUsageForOptionXxx(); 
  return;
}

The help = true attribute is like usageHelp = true in that it prevents a MissingParameterException being thrown for missing required options/positional parameters. It differs from usageHelp in that it won’t automatically print help for the command.

0reactions
bbottemacommented, Aug 12, 2018

It’s still a kind of hack having a shadow - - option–help for each - -option, but it works. I’d rather see it as 1st class API, but I don’t think this is in scope for picocli. Closing issue…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Use Features to Organize Options Unit - Trailhead - Salesforce
Features give structure to bundles by grouping similar options, which then appear in separate sections on the configuration page.
Read more >
Set up a Focus on iPhone - Apple Support
Focus is a feature that helps you reduce distractions and set boundaries. ... which people and apps to allow notifications from, an Options...
Read more >
Set up and manage access requests - Microsoft Support
The access request feature allows people to request access to content that they do not currently have permission to see. As a site...
Read more >
Manage hosted feature layers—ArcGIS Online Help
Click the Settings tab and scroll to the Feature Layer Settings section. Click Allow others to export to different formats and click Save....
Read more >
Apply settings for Android mobile devices - Google Support
Allows users to share data and files from their work profile to the personal space on their device. When you check the Allow...
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