zsh-completion-generator icon indicating copy to clipboard operation
zsh-completion-generator copied to clipboard

how to deal with subcommands?

Open ghost opened this issue 7 years ago • 1 comments

as title says

ghost avatar Jan 24 '18 10:01 ghost

Example from a program based on click (Python):

Usage: covimerage [OPTIONS] COMMAND [ARGS]...

Options:
  -V, --version                   Show the version and exit.
  -v, --verbose                   Increase verbosity.
  -q, --quiet                     Decrease verbosity.
  -l, --loglevel [error|warning|info|debug]
                                  Set logging level explicitly (overrides
                                  -v/-q).  [default: info]
  --rcfile PATH                   Configuration file.  [default: .coveragerc]
  -h, --help                      Show this message and exit.

Commands:
  report          A wrapper around `coverage report`.
  run             Run VIM wrapped with :profile instructions.
  write_coverage  Parse PROFILE_FILE (output from Vim's...
  xml             A wrapper around `coverage xml`.

I think a good approach would be to detect subcommands via the introducing Commands: and then call --help on the recursively.

In the completion it would generate a state (->sub_report or similar) for all of them.

blueyed avatar May 10 '18 14:05 blueyed