argparse icon indicating copy to clipboard operation
argparse copied to clipboard

Feature request: --help displays both general and command-specific options at once

Open hishamhm opened this issue 1 year ago • 0 comments

I've heard of people missing out on LuaRocks flags because they do luarocks install --help and only see the install-specific flags and never think of checking for general flags in luarocks --help.

Today the same thing happened to me when I missed that cyan has a --no-script flag because that's a general option and I've only checked cyan build --help.

I'd like to allow for command's --help to display both general and command-specific options, like so:

$ cyan build --help
Usage: cyan build <general options...> [-h] [-u] [-c] [-p]

Build a project based on tlconfig.lua

General options:
           -l <modulename>,
    --preload <modulename>
                          Execute the equivalent of require('modulename') before processing Teal files.
    --global-env-def <module-name>
                          Load <module-name> before typechecking. Use this to define types provided by your environment.
               -I <directory>,
    --include-dir <directory>
                          Prepend this directory to the module search path.
    --wdisable <warning>  Disable the given kind of warning. Use '--wdisable all' to disable all warnings
    --werror <warning>    Promote the given kind of warning to an error. Use '--werror all' to promote all warnings to errors
    --gen-compat [{off,optional,required}]
                          Generate compatibility code for targeting different Lua VM versions. (default: optional)
    --gen-target {5.1,5.3,5.4}
                          Minimum targeted Lua version for generated code.
    --no-script           Do not run any scripts.
    -q, --quiet           Do not print information messages to stdout. Errors may still be printed to stderr. (Same as --verbosity quiet).
             -v {quiet,normal,extra,debug},
    --verbosity {quiet,normal,extra,debug}
                          Set verbosity of logging.
              -s <source_dir>,
    --source-dir <source_dir>
                          Override the source directory.
             -b <build_dir>,
    --build-dir <build_dir>
                          Override the build directory.
    -h, --help            Show this help message and exit

Options specific to the "build" command:
   -u, --update-all      Force recompilation of every file in your project.
   -c, --check-only      Only type check files.
   -p, --prune           Remove any unexpected files in the build directory.

hishamhm avatar Sep 02 '24 17:09 hishamhm