mirror of https://github.com/astral-sh/uv
Remove `--upgrade` and `--quiet` flags from generated output files (#1873)
## Summary Resolve #1814 I changed the behavior of `pip compile` to not display `--upgrade` (`-U`) and `--quiet` (`-q`) for compatibility
This commit is contained in:
parent
5a50a753bd
commit
0e2ea66b72
|
|
@ -347,7 +347,7 @@ pub(crate) async fn pip_compile(
|
|||
writeln!(
|
||||
writer,
|
||||
"{}",
|
||||
format!("# {}", cmd(include_index_url, include_find_links)).green()
|
||||
format!("# {}", cmd(include_index_url, include_find_links,)).green()
|
||||
)?;
|
||||
}
|
||||
|
||||
|
|
@ -412,6 +412,7 @@ pub(crate) async fn pip_compile(
|
|||
}
|
||||
|
||||
/// Format the `uv` command used to generate the output file.
|
||||
#[allow(clippy::fn_params_excessive_bools)]
|
||||
fn cmd(include_index_url: bool, include_find_links: bool) -> String {
|
||||
let args = env::args_os()
|
||||
.skip(1)
|
||||
|
|
@ -453,6 +454,24 @@ fn cmd(include_index_url: bool, include_find_links: bool) -> String {
|
|||
}
|
||||
}
|
||||
|
||||
// Always skip the `--upgrade` flag.
|
||||
if arg == "--upgrade" || arg == "-U" {
|
||||
*skip_next = None;
|
||||
return Some(None);
|
||||
}
|
||||
|
||||
// Always skip the `--quiet` flag.
|
||||
if arg == "--quiet" || arg == "-q" {
|
||||
*skip_next = None;
|
||||
return Some(None);
|
||||
}
|
||||
|
||||
// Always skip the `--verbose` flag.
|
||||
if arg == "--verbose" || arg == "-v" {
|
||||
*skip_next = None;
|
||||
return Some(None);
|
||||
}
|
||||
|
||||
// Return the argument.
|
||||
Some(Some(arg))
|
||||
})
|
||||
|
|
|
|||
|
|
@ -3045,7 +3045,7 @@ fn upgrade_all() -> Result<()> {
|
|||
exit_code: 0
|
||||
----- stdout -----
|
||||
# This file was autogenerated by uv via the following command:
|
||||
# uv pip compile --cache-dir [CACHE_DIR] --exclude-newer 2023-11-18T12:00:00Z requirements.in --output-file requirements.txt --upgrade
|
||||
# uv pip compile --cache-dir [CACHE_DIR] --exclude-newer 2023-11-18T12:00:00Z requirements.in --output-file requirements.txt
|
||||
black==23.10.1
|
||||
click==8.1.7
|
||||
# via black
|
||||
|
|
|
|||
Loading…
Reference in New Issue