Open xspager opened 8 years ago
You mean you want script.lua -h
to show not only top-level arguments, options and commands, but also arguments and options specific to these commands? That's currently not supported as this approach doesn't work well once there are a lot of command-specific options. You can get help for each specific command by using script.lua <command> --help
.
You can sort of do it by running cmd:help(cmd:get_help()); cmd:description(cmd:get_help().."\n")
for each command after it is registered. That sets description of each command to it's full help message. It won't look too good - lines get too long because of double padding:
Usage: sailor [-h] <command> ...
Sailor commands
Options:
-h, --help Show this help message and exit.
Commands:
c, create Usage: sailor create NAME [PATH]
Generates web application in a directory.
Arguments:
name The name of your application.
path The path to where you wish your app to be created. (default: .)
Options:
-h, --help Show this help message and exit.
Example: sailor create 'Hey Arnold' /var/www
This will create your web app under /var/www/hey_arnold.
t, test Usage: sailor test [--resty] -- [EXTRA_FLAGS]
Will run the tests specified for an application. Must be called from the base dir of the application.
Arguments:
EXTRA_FLAGS
Options:
--resty Run the tests using the resty bootstrap
-h, --help Show this help message and exit.
e, enable Usage: sailor enable NAME
Will install an extension to Sailor and copy necessary files to your app. Must be called from the base dir of the application.
Arguments:
name The name of the extension to be enabled.
Options:
-h, --help Show this help message and exit.
Decided to show only the commands available https://github.com/xspager/sailor/commit/4347e44e77d2718f7b114092ba7a76fe37fa9175, what you think?
@xspager sorry for not following up on this! I see that sailor has switched to argparse already, so this must have been resolved. The commit you've linked makes sailor show full help on misuse, which is a a valid option. Do you still want to be able to list all options in help, including option specific to each command? If so, we could keep this open as a feature request but I'm not sure how to layout help for options nested in commands.
It might be better to ask @Etiene about that 😕
I want to show a full help with all options, flags... Is this supported, if not is there a recommended way to do that?
Really nice lib btw :)