mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-03 10:33:49 +00:00
Add --no-progress
global option to hide all progress animations (#5098)
## Summary Fixes #5082. Adds a new `Printer::NoProgress` that is identical to `Printer::Default` but doesn't draw any progress bar. ## Test Plan It seems to me that as of now it's not possible to use `insta-cmd` to get any progress bar in the comparable output of command. Best way to test this would be to run any command that usually shows progress indicators like `uv pip install` with and without `--no-progress` options.
This commit is contained in:
parent
e28d128388
commit
426736f7ed
6 changed files with 51 additions and 0 deletions
|
@ -155,6 +155,10 @@ pub struct GlobalArgs {
|
|||
/// Show the resolved settings for the current command.
|
||||
#[arg(global = true, long, hide = true)]
|
||||
pub show_settings: bool,
|
||||
|
||||
/// Hides all progress outputs when set
|
||||
#[arg(global = true, long)]
|
||||
pub no_progress: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone, clap::ValueEnum)]
|
||||
|
|
|
@ -109,6 +109,8 @@ async fn run(cli: Cli) -> Result<ExitStatus> {
|
|||
Printer::Quiet
|
||||
} else if globals.verbose > 0 {
|
||||
Printer::Verbose
|
||||
} else if globals.no_progress {
|
||||
Printer::NoProgress
|
||||
} else {
|
||||
Printer::Default
|
||||
};
|
||||
|
|
|
@ -9,6 +9,8 @@ pub(crate) enum Printer {
|
|||
Quiet,
|
||||
/// A printer that prints all output, including debug messages.
|
||||
Verbose,
|
||||
/// A printer that prints to standard streams, excluding all progress outputs
|
||||
NoProgress,
|
||||
}
|
||||
|
||||
impl Printer {
|
||||
|
@ -20,6 +22,7 @@ impl Printer {
|
|||
// Confusingly, hide the progress bar when in verbose mode.
|
||||
// Otherwise, it gets interleaved with debug messages.
|
||||
Self::Verbose => ProgressDrawTarget::hidden(),
|
||||
Self::NoProgress => ProgressDrawTarget::hidden(),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -29,6 +32,7 @@ impl Printer {
|
|||
Self::Default => Stdout::Enabled,
|
||||
Self::Quiet => Stdout::Disabled,
|
||||
Self::Verbose => Stdout::Enabled,
|
||||
Self::NoProgress => Stdout::Enabled,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -38,6 +42,7 @@ impl Printer {
|
|||
Self::Default => Stderr::Enabled,
|
||||
Self::Quiet => Stderr::Disabled,
|
||||
Self::Verbose => Stderr::Enabled,
|
||||
Self::NoProgress => Stderr::Enabled,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,6 +48,7 @@ pub(crate) struct GlobalSettings {
|
|||
pub(crate) preview: PreviewMode,
|
||||
pub(crate) python_preference: PythonPreference,
|
||||
pub(crate) python_fetch: PythonFetch,
|
||||
pub(crate) no_progress: bool,
|
||||
}
|
||||
|
||||
impl GlobalSettings {
|
||||
|
@ -118,6 +119,7 @@ impl GlobalSettings {
|
|||
.python_fetch
|
||||
.combine(workspace.and_then(|workspace| workspace.globals.python_fetch))
|
||||
.unwrap_or_default(),
|
||||
no_progress: args.no_progress,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,6 +46,8 @@ fn help() {
|
|||
--isolated
|
||||
Avoid discovering a `pyproject.toml` or `uv.toml` file in the current directory or any
|
||||
parent directories
|
||||
--no-progress
|
||||
Hides all progress outputs when set
|
||||
-n, --no-cache
|
||||
Avoid reading from or writing to the cache, instead using a temporary directory for the
|
||||
duration of the operation [env: UV_NO_CACHE=]
|
||||
|
@ -107,6 +109,8 @@ fn help_flag() {
|
|||
--isolated
|
||||
Avoid discovering a `pyproject.toml` or `uv.toml` file in the current directory or any
|
||||
parent directories
|
||||
--no-progress
|
||||
Hides all progress outputs when set
|
||||
-n, --no-cache
|
||||
Avoid reading from or writing to the cache, instead using a temporary directory for the
|
||||
duration of the operation [env: UV_NO_CACHE=]
|
||||
|
@ -167,6 +171,8 @@ fn help_short_flag() {
|
|||
--isolated
|
||||
Avoid discovering a `pyproject.toml` or `uv.toml` file in the current directory or any
|
||||
parent directories
|
||||
--no-progress
|
||||
Hides all progress outputs when set
|
||||
-n, --no-cache
|
||||
Avoid reading from or writing to the cache, instead using a temporary directory for the
|
||||
duration of the operation [env: UV_NO_CACHE=]
|
||||
|
@ -269,6 +275,9 @@ fn help_subcommand() {
|
|||
Avoid discovering a `pyproject.toml` or `uv.toml` file in the current directory or any
|
||||
parent directories
|
||||
|
||||
--no-progress
|
||||
Hides all progress outputs when set
|
||||
|
||||
-n, --no-cache
|
||||
Avoid reading from or writing to the cache, instead using a temporary directory for the
|
||||
duration of the operation
|
||||
|
@ -388,6 +397,9 @@ fn help_subsubcommand() {
|
|||
Avoid discovering a `pyproject.toml` or `uv.toml` file in the current directory or any
|
||||
parent directories
|
||||
|
||||
--no-progress
|
||||
Hides all progress outputs when set
|
||||
|
||||
-n, --no-cache
|
||||
Avoid reading from or writing to the cache, instead using a temporary directory for the
|
||||
duration of the operation
|
||||
|
@ -460,6 +472,8 @@ fn help_flag_subcommand() {
|
|||
--isolated
|
||||
Avoid discovering a `pyproject.toml` or `uv.toml` file in the current directory or any
|
||||
parent directories
|
||||
--no-progress
|
||||
Hides all progress outputs when set
|
||||
-n, --no-cache
|
||||
Avoid reading from or writing to the cache, instead using a temporary directory for the
|
||||
duration of the operation [env: UV_NO_CACHE=]
|
||||
|
@ -517,6 +531,8 @@ fn help_flag_subsubcommand() {
|
|||
--isolated
|
||||
Avoid discovering a `pyproject.toml` or `uv.toml` file in the current directory or any
|
||||
parent directories
|
||||
--no-progress
|
||||
Hides all progress outputs when set
|
||||
-n, --no-cache
|
||||
Avoid reading from or writing to the cache, instead using a temporary directory for the
|
||||
duration of the operation [env: UV_NO_CACHE=]
|
||||
|
@ -631,6 +647,8 @@ fn help_with_global_option() {
|
|||
--isolated
|
||||
Avoid discovering a `pyproject.toml` or `uv.toml` file in the current directory or any
|
||||
parent directories
|
||||
--no-progress
|
||||
Hides all progress outputs when set
|
||||
-n, --no-cache
|
||||
Avoid reading from or writing to the cache, instead using a temporary directory for the
|
||||
duration of the operation [env: UV_NO_CACHE=]
|
||||
|
@ -725,6 +743,8 @@ fn test_with_no_pager() {
|
|||
--isolated
|
||||
Avoid discovering a `pyproject.toml` or `uv.toml` file in the current directory or any
|
||||
parent directories
|
||||
--no-progress
|
||||
Hides all progress outputs when set
|
||||
-n, --no-cache
|
||||
Avoid reading from or writing to the cache, instead using a temporary directory for the
|
||||
duration of the operation [env: UV_NO_CACHE=]
|
||||
|
|
|
@ -59,6 +59,7 @@ fn resolve_uv_toml() -> anyhow::Result<()> {
|
|||
preview: Disabled,
|
||||
python_preference: OnlySystem,
|
||||
python_fetch: Automatic,
|
||||
no_progress: false,
|
||||
}
|
||||
CacheSettings {
|
||||
no_cache: false,
|
||||
|
@ -191,6 +192,7 @@ fn resolve_uv_toml() -> anyhow::Result<()> {
|
|||
preview: Disabled,
|
||||
python_preference: OnlySystem,
|
||||
python_fetch: Automatic,
|
||||
no_progress: false,
|
||||
}
|
||||
CacheSettings {
|
||||
no_cache: false,
|
||||
|
@ -324,6 +326,7 @@ fn resolve_uv_toml() -> anyhow::Result<()> {
|
|||
preview: Disabled,
|
||||
python_preference: OnlySystem,
|
||||
python_fetch: Automatic,
|
||||
no_progress: false,
|
||||
}
|
||||
CacheSettings {
|
||||
no_cache: false,
|
||||
|
@ -489,6 +492,7 @@ fn resolve_pyproject_toml() -> anyhow::Result<()> {
|
|||
preview: Disabled,
|
||||
python_preference: OnlySystem,
|
||||
python_fetch: Automatic,
|
||||
no_progress: false,
|
||||
}
|
||||
CacheSettings {
|
||||
no_cache: false,
|
||||
|
@ -623,6 +627,7 @@ fn resolve_pyproject_toml() -> anyhow::Result<()> {
|
|||
preview: Disabled,
|
||||
python_preference: OnlySystem,
|
||||
python_fetch: Automatic,
|
||||
no_progress: false,
|
||||
}
|
||||
CacheSettings {
|
||||
no_cache: false,
|
||||
|
@ -743,6 +748,7 @@ fn resolve_pyproject_toml() -> anyhow::Result<()> {
|
|||
preview: Disabled,
|
||||
python_preference: OnlySystem,
|
||||
python_fetch: Automatic,
|
||||
no_progress: false,
|
||||
}
|
||||
CacheSettings {
|
||||
no_cache: false,
|
||||
|
@ -900,6 +906,7 @@ fn resolve_index_url() -> anyhow::Result<()> {
|
|||
preview: Disabled,
|
||||
python_preference: OnlySystem,
|
||||
python_fetch: Automatic,
|
||||
no_progress: false,
|
||||
}
|
||||
CacheSettings {
|
||||
no_cache: false,
|
||||
|
@ -1057,6 +1064,7 @@ fn resolve_index_url() -> anyhow::Result<()> {
|
|||
preview: Disabled,
|
||||
python_preference: OnlySystem,
|
||||
python_fetch: Automatic,
|
||||
no_progress: false,
|
||||
}
|
||||
CacheSettings {
|
||||
no_cache: false,
|
||||
|
@ -1259,6 +1267,7 @@ fn resolve_find_links() -> anyhow::Result<()> {
|
|||
preview: Disabled,
|
||||
python_preference: OnlySystem,
|
||||
python_fetch: Automatic,
|
||||
no_progress: false,
|
||||
}
|
||||
CacheSettings {
|
||||
no_cache: false,
|
||||
|
@ -1415,6 +1424,7 @@ fn resolve_top_level() -> anyhow::Result<()> {
|
|||
preview: Disabled,
|
||||
python_preference: OnlySystem,
|
||||
python_fetch: Automatic,
|
||||
no_progress: false,
|
||||
}
|
||||
CacheSettings {
|
||||
no_cache: false,
|
||||
|
@ -1541,6 +1551,7 @@ fn resolve_top_level() -> anyhow::Result<()> {
|
|||
preview: Disabled,
|
||||
python_preference: OnlySystem,
|
||||
python_fetch: Automatic,
|
||||
no_progress: false,
|
||||
}
|
||||
CacheSettings {
|
||||
no_cache: false,
|
||||
|
@ -1695,6 +1706,7 @@ fn resolve_top_level() -> anyhow::Result<()> {
|
|||
preview: Disabled,
|
||||
python_preference: OnlySystem,
|
||||
python_fetch: Automatic,
|
||||
no_progress: false,
|
||||
}
|
||||
CacheSettings {
|
||||
no_cache: false,
|
||||
|
@ -1873,6 +1885,7 @@ fn resolve_user_configuration() -> anyhow::Result<()> {
|
|||
preview: Disabled,
|
||||
python_preference: OnlySystem,
|
||||
python_fetch: Automatic,
|
||||
no_progress: false,
|
||||
}
|
||||
CacheSettings {
|
||||
no_cache: false,
|
||||
|
@ -1989,6 +2002,7 @@ fn resolve_user_configuration() -> anyhow::Result<()> {
|
|||
preview: Disabled,
|
||||
python_preference: OnlySystem,
|
||||
python_fetch: Automatic,
|
||||
no_progress: false,
|
||||
}
|
||||
CacheSettings {
|
||||
no_cache: false,
|
||||
|
@ -2105,6 +2119,7 @@ fn resolve_user_configuration() -> anyhow::Result<()> {
|
|||
preview: Disabled,
|
||||
python_preference: OnlySystem,
|
||||
python_fetch: Automatic,
|
||||
no_progress: false,
|
||||
}
|
||||
CacheSettings {
|
||||
no_cache: false,
|
||||
|
@ -2223,6 +2238,7 @@ fn resolve_user_configuration() -> anyhow::Result<()> {
|
|||
preview: Disabled,
|
||||
python_preference: OnlySystem,
|
||||
python_fetch: Automatic,
|
||||
no_progress: false,
|
||||
}
|
||||
CacheSettings {
|
||||
no_cache: false,
|
||||
|
@ -2366,6 +2382,7 @@ fn resolve_poetry_toml() -> anyhow::Result<()> {
|
|||
preview: Disabled,
|
||||
python_preference: OnlySystem,
|
||||
python_fetch: Automatic,
|
||||
no_progress: false,
|
||||
}
|
||||
CacheSettings {
|
||||
no_cache: false,
|
||||
|
@ -2510,6 +2527,7 @@ fn resolve_both() -> anyhow::Result<()> {
|
|||
preview: Disabled,
|
||||
python_preference: OnlySystem,
|
||||
python_fetch: Automatic,
|
||||
no_progress: false,
|
||||
}
|
||||
CacheSettings {
|
||||
no_cache: false,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue