-
Notifications
You must be signed in to change notification settings - Fork 552
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
Get list of all commands of a class inheriting from Thor #731
Comments
I took a slightly different approach to auto complete using Related to #415 My code to fetch some of the data was:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm trying to get a list of all commands, subcommands and options of a class that inherits from Thor. For example, the module CLI below inherits from Thor and has two commands actor and service as shown below:
actor.rb
service.rb
I'm looking for a command
list_commands
that could list all commands and their methods and subcommands in a JSON like formatCurrently, kind of get what I what by putting
help
in front of each command/subcommand to get the next subcommand. My intention to use the output of the above command is to auto-generate a bash-completion script as new commands are added into theCommands
module that inherits fromCLI
which inherits fromThor
. Suggestions for any other approaches using some inbuilt mechanism in Thor are also welcome!PS: Also take a look at a similar SO question
The text was updated successfully, but these errors were encountered: