ruff icon indicating copy to clipboard operation
ruff copied to clipboard

`generate-shell-completion` is a valid `ruff` command, but is not listed in `ruff help`

Open tpgillam opened this issue 1 year ago • 5 comments

As-of ruff 0.4.10, I've observed that:

  • ruff generate-shell-completion is documented in the docs
  • ruff help generate-shell-completion generates some useful help
  • But, ruff help does not list generate-shell-completion in the "Commands" section

Personally I think it would aid discoverability to add it to the list in the top-level ruff help listing.

tpgillam avatar Jun 28 '24 13:06 tpgillam

I believe this is intentionally hidden, perhaps because it's only intended to be run once? I'm not sure.

zanieb avatar Jun 28 '24 15:06 zanieb

Not a very good reason but I think one reason is that generate-shell-completion kind of messes with the ruff --help layout. But we could solve this by shortening the command name to completion or shell-completion.

What's interesting is that gt also doesn't show the completion command when running gt --help. It only shows it when entering an invalid command.

MichaReiser avatar Jun 28 '24 16:06 MichaReiser

What's interesting is that gt also doesn't show the completion command when running gt --help. It only shows it when entering an invalid command.

Probably a silly question - what program is gt please? :) A web search isn't helping me much.

tpgillam avatar Jun 28 '24 16:06 tpgillam

Oh sorry. It's graphite CLI.

MichaReiser avatar Jun 28 '24 16:06 MichaReiser

Being somewhat pedantic, I did notice that docs/configuration.md says that ruff help gives the "full list" of top-level commands, so if deciding to hide this command then perhaps this should be modified to "gives a subset of the top-level commands"!

At least to my taste, I like the guarantee of the 'full list' though.

tpgillam avatar Jun 30 '24 09:06 tpgillam

I too was looking for generate-shell-completion command from ruff help if you don't want it to default, maybe add --full-list or similar option to show a full list of commands with --help or help command?

nngo avatar Jun 26 '25 05:06 nngo

btw, uv help does list out generate-shell-completion command (tested with uv 0.17.13) (noticed this from comment in https://github.com/astral-sh/uv/issues/2191)

$ uv help
An extremely fast Python package manager.

Usage: uv [OPTIONS] <COMMAND>

Commands:
  run                        Run a command or script
  init                       Create a new project
  ...
  self                       Manage the uv executable
  generate-shell-completion  Generate shell completion
  help                       Display documentation for a command

nngo avatar Jun 26 '25 05:06 nngo