Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add environment variable to disable progress output #8600

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/uv-cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ pub struct GlobalArgs {
/// Hide all progress outputs.
///
/// For example, spinners or progress bars.
#[arg(global = true, long)]
#[arg(global = true, long, env = EnvVars::UV_NO_PROGRESS, value_parser = clap::builder::BoolishValueParser::new())]
pub no_progress: bool,

/// Change to the given directory prior to running the command.
Expand Down
3 changes: 3 additions & 0 deletions crates/uv-static/src/env_vars.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,9 @@ impl EnvVars {
/// Disables colored output (takes precedence over `FORCE_COLOR`).
pub const NO_COLOR: &'static str = "NO_COLOR";

/// Disables all progress output. For example, spinners and progress bars.
pub const UV_NO_PROGRESS: &'static str = "UV_NO_PROGRESS";

/// Forces colored output regardless of terminal support.
pub const FORCE_COLOR: &'static str = "FORCE_COLOR";

Expand Down
26 changes: 15 additions & 11 deletions crates/uv/tests/it/help.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ fn help() {
--native-tls Whether to load TLS certificates from the platform's native
certificate store [env: UV_NATIVE_TLS=]
--offline Disable network access
--no-progress Hide all progress outputs
--no-progress Hide all progress outputs [env: UV_NO_PROGRESS=]
--directory <DIRECTORY> Change to the given directory prior to running the command
--project <PROJECT> Run the command within the given project directory
--config-file <CONFIG_FILE> The path to a `uv.toml` file to use for configuration [env:
Expand Down Expand Up @@ -123,7 +123,7 @@ fn help_flag() {
--native-tls Whether to load TLS certificates from the platform's native
certificate store [env: UV_NATIVE_TLS=]
--offline Disable network access
--no-progress Hide all progress outputs
--no-progress Hide all progress outputs [env: UV_NO_PROGRESS=]
--directory <DIRECTORY> Change to the given directory prior to running the command
--project <PROJECT> Run the command within the given project directory
--config-file <CONFIG_FILE> The path to a `uv.toml` file to use for configuration [env:
Expand Down Expand Up @@ -191,7 +191,7 @@ fn help_short_flag() {
--native-tls Whether to load TLS certificates from the platform's native
certificate store [env: UV_NATIVE_TLS=]
--offline Disable network access
--no-progress Hide all progress outputs
--no-progress Hide all progress outputs [env: UV_NO_PROGRESS=]
--directory <DIRECTORY> Change to the given directory prior to running the command
--project <PROJECT> Run the command within the given project directory
--config-file <CONFIG_FILE> The path to a `uv.toml` file to use for configuration [env:
Expand All @@ -211,7 +211,7 @@ fn help_short_flag() {
fn help_subcommand() {
let context = TestContext::new_with_versions(&[]);

uv_snapshot!(context.filters(), context.help().arg("python"), @r##"
uv_snapshot!(context.filters(), context.help().arg("python"), @r###"
success: true
exit_code: 0
----- stdout -----
Expand Down Expand Up @@ -344,6 +344,8 @@ fn help_subcommand() {
Hide all progress outputs.

For example, spinners or progress bars.

[env: UV_NO_PROGRESS=]

--directory <DIRECTORY>
Change to the given directory prior to running the command.
Expand Down Expand Up @@ -392,14 +394,14 @@ fn help_subcommand() {


----- stderr -----
"##);
"###);
}

#[test]
fn help_subsubcommand() {
let context = TestContext::new_with_versions(&[]);

uv_snapshot!(context.filters(), context.help().arg("python").arg("install"), @r##"
uv_snapshot!(context.filters(), context.help().arg("python").arg("install"), @r###"
success: true
exit_code: 0
----- stdout -----
Expand Down Expand Up @@ -514,6 +516,8 @@ fn help_subsubcommand() {
Hide all progress outputs.

For example, spinners or progress bars.

[env: UV_NO_PROGRESS=]

--directory <DIRECTORY>
Change to the given directory prior to running the command.
Expand Down Expand Up @@ -560,7 +564,7 @@ fn help_subsubcommand() {


----- stderr -----
"##);
"###);
}

#[test]
Expand Down Expand Up @@ -603,7 +607,7 @@ fn help_flag_subcommand() {
--native-tls Whether to load TLS certificates from the platform's native
certificate store [env: UV_NATIVE_TLS=]
--offline Disable network access
--no-progress Hide all progress outputs
--no-progress Hide all progress outputs [env: UV_NO_PROGRESS=]
--directory <DIRECTORY> Change to the given directory prior to running the command
--project <PROJECT> Run the command within the given project directory
--config-file <CONFIG_FILE> The path to a `uv.toml` file to use for configuration [env:
Expand Down Expand Up @@ -657,7 +661,7 @@ fn help_flag_subsubcommand() {
--native-tls Whether to load TLS certificates from the platform's native
certificate store [env: UV_NATIVE_TLS=]
--offline Disable network access
--no-progress Hide all progress outputs
--no-progress Hide all progress outputs [env: UV_NO_PROGRESS=]
--directory <DIRECTORY> Change to the given directory prior to running the command
--project <PROJECT> Run the command within the given project directory
--config-file <CONFIG_FILE> The path to a `uv.toml` file to use for configuration [env:
Expand Down Expand Up @@ -803,7 +807,7 @@ fn help_with_global_option() {
--native-tls Whether to load TLS certificates from the platform's native
certificate store [env: UV_NATIVE_TLS=]
--offline Disable network access
--no-progress Hide all progress outputs
--no-progress Hide all progress outputs [env: UV_NO_PROGRESS=]
--directory <DIRECTORY> Change to the given directory prior to running the command
--project <PROJECT> Run the command within the given project directory
--config-file <CONFIG_FILE> The path to a `uv.toml` file to use for configuration [env:
Expand Down Expand Up @@ -908,7 +912,7 @@ fn help_with_no_pager() {
--native-tls Whether to load TLS certificates from the platform's native
certificate store [env: UV_NATIVE_TLS=]
--offline Disable network access
--no-progress Hide all progress outputs
--no-progress Hide all progress outputs [env: UV_NO_PROGRESS=]
--directory <DIRECTORY> Change to the given directory prior to running the command
--project <PROJECT> Run the command within the given project directory
--config-file <CONFIG_FILE> The path to a `uv.toml` file to use for configuration [env:
Expand Down
1 change: 1 addition & 0 deletions docs/configuration/environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,5 +151,6 @@ In addition, uv respects the following environment variables:
least-recent non-EOL macOS version at time of writing.
- `NO_COLOR`: Disable colors. Takes precedence over `FORCE_COLOR`. See
[no-color.org](https://no-color.org).
- `UV_NO_PROGRESS`: Disable progress indicators like spinners and progress bars.
- `FORCE_COLOR`: Enforce colors regardless of TTY support. See
[force-color.org](https://force-color.org).
Loading
Loading