mirror of https://github.com/astral-sh/uv
Emit JSON output with `--quiet` (#14810)
This commit is contained in:
parent
2677e85df9
commit
e49d61db1f
|
|
@ -273,7 +273,7 @@ pub(crate) async fn sync(
|
|||
dry_run: dry_run.enabled(),
|
||||
};
|
||||
if let Some(output) = report.format(output_format) {
|
||||
writeln!(printer.stdout(), "{output}")?;
|
||||
writeln!(printer.stdout_important(), "{output}")?;
|
||||
}
|
||||
return Ok(ExitStatus::Success);
|
||||
}
|
||||
|
|
@ -363,7 +363,7 @@ pub(crate) async fn sync(
|
|||
};
|
||||
|
||||
if let Some(output) = report.format(output_format) {
|
||||
writeln!(printer.stdout(), "{output}")?;
|
||||
writeln!(printer.stdout_important(), "{output}")?;
|
||||
}
|
||||
|
||||
// Identify the installation target.
|
||||
|
|
|
|||
|
|
@ -432,6 +432,46 @@ fn sync_json() -> Result<()> {
|
|||
The lockfile at `uv.lock` needs to be updated, but `--locked` was provided. To update the lockfile, run `uv lock`.
|
||||
");
|
||||
|
||||
// Test that JSON output is shown even with --quiet flag
|
||||
uv_snapshot!(context.filters(), context.sync()
|
||||
.arg("--quiet")
|
||||
.arg("--frozen")
|
||||
.arg("--output-format").arg("json"), @r#"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
{
|
||||
"schema": {
|
||||
"version": "preview"
|
||||
},
|
||||
"target": "project",
|
||||
"project": {
|
||||
"path": "[TEMP_DIR]/",
|
||||
"workspace": {
|
||||
"path": "[TEMP_DIR]/"
|
||||
}
|
||||
},
|
||||
"sync": {
|
||||
"environment": {
|
||||
"path": "[VENV]/",
|
||||
"python": {
|
||||
"path": "[VENV]/[BIN]/[PYTHON]",
|
||||
"version": "3.12.[X]",
|
||||
"implementation": "cpython"
|
||||
}
|
||||
},
|
||||
"action": "check"
|
||||
},
|
||||
"lock": {
|
||||
"path": "[TEMP_DIR]/uv.lock",
|
||||
"action": "use"
|
||||
},
|
||||
"dry_run": false
|
||||
}
|
||||
|
||||
----- stderr -----
|
||||
"#);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue