astral-sh / uv

An extremely fast Python package and project manager, written in Rust.
https://docs.astral.sh/uv
Apache License 2.0
25.89k stars 755 forks source link

Document generate-shell-completion subcommand #2191

Open danielhollas opened 8 months ago

danielhollas commented 8 months ago

The generate-shell-completion subcommand was added in #1675 but doesn't seem to be documented anywhere. It also doesn't appear in the help output (uv -h) --- I guess that's intended?

charliermarsh commented 8 months ago

There's some documentation on it here: https://docs.astral.sh/ruff/configuration/#shell-autocompletion

charliermarsh commented 8 months ago

Oh sorry, that's in Ruff, I didn't even realize where we were. (But it operates the same way.)

baggiponte commented 4 months ago

Oh sorry, that's in Ruff, I didn't even realize where we were. (But it operates the same way.)

Oh I did not know! I am using the latest ruff/uv. I think OP might be asking whether it would be the case to add it to the help menu you get when you run uv alone?

uv
The command line interface for the uv binary.

Usage: uv [OPTIONS] <COMMAND>

Commands:
  pip        Resolve and install Python packages
  tool       Run and manage executable Python packages
  toolchain  Manage Python installations
  venv       Create a virtual environment
  cache      Manage the cache
  self       Manage the `uv` executable
  version    Display uv's version
  help       Print this message or the help of the given subcommand(s)

Options:
  -q, --quiet                                        Do not print any output
  -v, --verbose...                                   Use verbose output
      --color <COLOR_CHOICE>                         Control colors in output [default: auto] [possible values: auto, always, never]
      --native-tls                                   Whether to load TLS certificates from the platform's native certificate store [env: UV_NATIVE_TLS=]
      --offline                                      Disable network access, relying only on locally cached data and locally available files
      --toolchain-preference <TOOLCHAIN_PREFERENCE>  Whether to use system or uv-managed Python toolchains [possible values: only-managed, prefer-installed-managed, prefer-managed, prefer-system, only-system]
  -n, --no-cache                                     Avoid reading from or writing to the cache [env: UV_NO_CACHE=]
      --cache-dir <CACHE_DIR>                        Path to the cache directory [env: UV_CACHE_DIR=]
      --config-file <CONFIG_FILE>                    The path to a `uv.toml` file to use for configuration [env: UV_CONFIG_FILE=]
  -h, --help                                         Print help (see more with '--help')
  -V, --version                                      Print version

Here you don't see generate-shell-completion among the option and the same goes for ruff.

EDIT: I am no rust dev but I think I could add those in the appropriate places if you would like a bit of help 😊 I am no expert in shell completions either but I guess you could also contribute those to zsh-completions plugin so anyone has them by default.

lucaspar commented 2 months ago

It seems uv --help and uv help should have the same effect.

Currently, only the latter has the generate-shell-completion entry.