Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hidden commands support #353

Closed
kfernald opened this issue May 26, 2022 · 2 comments · Fixed by #354
Closed

Hidden commands support #353

kfernald opened this issue May 26, 2022 · 2 comments · Fixed by #354

Comments

@kfernald
Copy link

kfernald commented May 26, 2022

Our Clikt-based tool has an extensive list of commands, some of which we'd like to "hide" from the help menus as we use them in certain internal scripts but they're not intended to be user-facing. As in: when the parent command shows its help menu, the sub-command doesn't appear in the list of available commands. However the subcommand could still print its own help-menu like normal.

We tried to implement this ourselves by extending CliktHelpFormatter and overriding StringBuilder.addCommands() to hide the commands, but since it's implemented as an extension-function there's not currently a way to have it call the super-class implementation (see https://youtrack.jetbrains.com/issue/KT-11488).

So we'd like to request either adding the feature to hide sub-commands from the parent's list with something like a "hidden" boolean property, or allowing the overriding of the addCommands() method and possibly others by not having them as extension functions.

Figured we'd ask to see if you think this would be a useful feature. If not we can always work around it with some slightly-nasty hacks by overriding the getFormattedHelp() function...

@ajalt
Copy link
Owner

ajalt commented May 26, 2022

Great suggestion, we should definitely add that feature.

@kfernald
Copy link
Author

Wow thanks for the quick turnaround on it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants