Replies: 1 comment
-
I added support for his in #547
Not built in, but you could subclass the help formatter to do that.
https://ajalt.github.io/clikt/commands/#running-parent-command-without-children |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a poc project where I am taking advantage of Sub Commands. There are a couple of parameters that are required by all the sub commands that I only want the user to enter once. There is also some initialization code I would like to run from the base class. In my project, I created a config class and used the following syntax to pass the items via the
context
in the sub commands:private val config by requireObject<Config>()
When running my tool with the
--help
flag specified for one of the sub commands, I get an error:Error: missing option --someflag
What I Expected:
That the help documentation was returned for the sub command without needing to specify any parameters other then the
--help
flag.Is it expected that you need to pass in parameters to the base class when trying to return the help documentation? This also tells me that any init code I have in the base class will also be executed even though I only want to return the help documentation which is unnecessary processing. Am I doing something wrong, are there settings I need to dig into further, or is there another pattern I should be using instead?
Just curious, Is there any way to return detailed help that includes documentation from the main class and all the sub commands in one CLI call?
Any guidance is greatly appreciated :)
Another bonus question, It looks like when I am using sub commands, that passing a sub command argument to the app is required. Is there a way to accept sub commands if passed, but execute code from the base class if no sub commands are passed?
Beta Was this translation helpful? Give feedback.
All reactions