From b93b0f2bcd23e02946b7a9691053d18734a2b370 Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Fri, 16 Aug 2024 11:40:05 -0500 Subject: [PATCH] Show `uv generate-shell-completion` in CLI documentation reference (#6146) We need to follow this with: 1) Hide a bunch of global arguments for this command 2) Add an about section for the command --- crates/uv-dev/src/generate_cli_reference.rs | 4 +- docs/reference/cli.md | 85 +++++++++++++++++++++ 2 files changed, 88 insertions(+), 1 deletion(-) diff --git a/crates/uv-dev/src/generate_cli_reference.rs b/crates/uv-dev/src/generate_cli_reference.rs index 8388ad191..04a688472 100644 --- a/crates/uv-dev/src/generate_cli_reference.rs +++ b/crates/uv-dev/src/generate_cli_reference.rs @@ -22,6 +22,8 @@ const REPLACEMENTS: &[(&str, &str)] = &[ ), ]; +const SHOW_HIDDEN_COMMANDS: &[&str] = &["generate-shell-completion"]; + #[derive(clap::Args)] pub(crate) struct Args { /// Write the generated output to stdout (rather than to `settings.md`). @@ -101,7 +103,7 @@ fn generate() -> String { } fn generate_command<'a>(output: &mut String, command: &'a Command, parents: &mut Vec<&'a Command>) { - if command.is_hide_set() { + if command.is_hide_set() && !SHOW_HIDDEN_COMMANDS.contains(&command.get_name()) { return; } diff --git a/docs/reference/cli.md b/docs/reference/cli.md index 5474f3a1f..90cf40aae 100644 --- a/docs/reference/cli.md +++ b/docs/reference/cli.md @@ -5694,6 +5694,91 @@ uv version [OPTIONS] +## uv generate-shell-completion + +Generate shell completion + +

Usage

+ +``` +uv generate-shell-completion [OPTIONS] +``` + +

Arguments

+ +
SHELL
+ +

Options

+ +
--cache-dir cache-dir

Path to the cache directory.

+ +

Defaults to $HOME/Library/Caches/uv on macOS, $XDG_CACHE_HOME/uv or $HOME/.cache/uv on Linux, and {FOLDERID_LocalAppData}\uv\cache on Windows.

+ +
--color color-choice

Control colors in output

+ +

[default: auto]

+

Possible values:

+ +
    +
  • auto: Enables colored output only when the output is going to a terminal or TTY with support
  • + +
  • always: Enables colored output regardless of the detected environment
  • + +
  • never: Disables colored output
  • +
+
--config-file config-file

The path to a uv.toml file to use for configuration.

+ +

While uv configuration can be included in a pyproject.toml file, it is not allowed in this context.

+ +
--help, -h

Display the concise help for this command

+ +
--native-tls

Whether to load TLS certificates from the platform’s native certificate store.

+ +

By default, uv loads certificates from the bundled webpki-roots crate. The webpki-roots are a reliable set of trust roots from Mozilla, and including them in uv improves portability and performance (especially on macOS).

+ +

However, in some cases, you may want to use the platform’s native certificate store, especially if you’re relying on a corporate trust root (e.g., for a mandatory proxy) that’s included in your system’s certificate store.

+ +
--no-cache, -n

Avoid reading from or writing to the cache, instead using a temporary directory for the duration of the operation

+ +
--no-config

Avoid discovering configuration files (pyproject.toml, uv.toml).

+ +

Normally, configuration files are discovered in the current directory, parent directories, or user configuration directories.

+ +
--no-progress

Hide all progress outputs.

+ +

For example, spinners or progress bars.

+ +
--no-python-downloads

Disable automatic downloads of Python

+ +
--offline

Disable network access.

+ +

When disabled, uv will only use locally cached data and locally available files.

+ +
--python-preference python-preference

Whether to prefer uv-managed or system Python installations.

+ +

By default, uv prefers using Python versions it manages. However, it will use system Python installations if a uv-managed Python is not installed. This option allows prioritizing or ignoring system Python installations.

+ +

Possible values:

+ +
    +
  • only-managed: Only use managed Python installations; never use system Python installations
  • + +
  • managed: Prefer managed Python installations over system Python installations
  • + +
  • system: Prefer system Python installations over managed Python installations
  • + +
  • only-system: Only use system Python installations; never use managed Python installations
  • +
+
--quiet, -q

Do not print any output

+ +
--verbose, -v

Use verbose output.

+ +

You can configure fine-grained logging using the RUST_LOG environment variable. (<https://docs.rs/tracing-subscriber/latest/tracing_subscriber/filter/struct.EnvFilter.html#directives>)

+ +
--version, -V

Display the uv version

+ +
+ ## uv help Display documentation for a command