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.

Idea: Allow root options to be passed to subcommands

See original GitHub issue

For user convenience, it might make sense to allow passing global options as if they were sub-command options. For example, instead of requiring the user to write

command --root-option subcommand --sub-option

clikt could allow to write

command subcommand --root-option --sub-option

This would work unless there is an option name clash between the global command and the sub-command, in which case the sub-command-specific option should take precedence.

AFAIK there’s currently no elegant way to achieve this in clikt, so maybe it makes sense to implement this as a core feature toggle on the context, like subcommandsInheritGlobalOptions or allowGlobalOptionsForSubcommands.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:4
  • Comments:17 (14 by maintainers)

github_iconTop GitHub Comments

0reactions
ajaltcommented, Oct 6, 2021

Ok, I think I’ll hold off on implementing this for now. Thanks for taking the time to discuss!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Clikt - Common Options With Subcommands
You can define your options on the root command and pass down the information via the context. With this design, you'll have to...
Read more >
Shell - Zephyr Project Documentation
Root command (level 0): Gathered and alphabetically sorted in a dedicated memory section. Static subcommand (level > 0): Number and syntax must ...
Read more >
CLI commands with google/subcommands - OSInet
We can perform this by adding instances of the commands to the subcommands.Register call besides commands , flags and help , in root.go...
Read more >
Commands and Groups — Click Documentation (5.x)
Passing Parameters​​ Click strictly separates parameters between commands and subcommands. What this means is that options and arguments for a specific command ...
Read more >
picocli - a mighty tiny command line interface
This allows a specific option or positional parameter to use a different converter ... Format argument values can be passed to the printVersionHelp...
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