Skip to content
Draft
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
17 changes: 10 additions & 7 deletions crates/uv/src/commands/publish.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ pub(crate) async fn publish(
let err: anyhow::Error = err.into();
write_error_chain(
err.as_ref(),
printer.stderr(),
printer.stderr_important(),
"error",
AnsiColors::Red,
)?;
Expand Down Expand Up @@ -281,7 +281,7 @@ pub(crate) async fn publish(
if dry_run {
write_error_chain(
err.as_ref(),
printer.stderr(),
printer.stderr_important(),
"error",
AnsiColors::Red,
)?;
Expand Down Expand Up @@ -323,7 +323,7 @@ pub(crate) async fn publish(
let err: anyhow::Error = err.into();
write_error_chain(
err.as_ref(),
printer.stderr(),
printer.stderr_important(),
"error",
AnsiColors::Red,
)?;
Expand Down Expand Up @@ -390,7 +390,7 @@ pub(crate) async fn publish(
let err: anyhow::Error = err.into();
write_error_chain(
err.as_ref(),
printer.stderr(),
printer.stderr_important(),
"error",
AnsiColors::Red,
)?;
Expand Down Expand Up @@ -427,7 +427,10 @@ pub(crate) async fn publish(
let error_count = error_count.load(Ordering::Relaxed);
if error_count > 0 {
let failed = if error_count == 1 { "file" } else { "files" };
writeln!(printer.stderr(), "Found issues with {error_count} {failed}")?;
writeln!(
printer.stderr_important(),
"Found issues with {error_count} {failed}"
)?;
return Ok(ExitStatus::Failure);
}

Expand Down Expand Up @@ -565,7 +568,7 @@ async fn gather_credentials(
// * The user forgot to forward the secrets as env vars (or used the wrong ones).
// * The trusted publishing configuration is wrong.
writeln!(
printer.stderr(),
printer.stderr_important(),
"Note: Neither credentials nor keyring are configured, and there was an error \
fetching the trusted publishing token. If you don't want to use trusted \
publishing, you can ignore this error, but you need to provide credentials."
Expand All @@ -576,7 +579,7 @@ async fn gather_credentials(
anyhow::Error::from(err)
.context("Trusted publishing failed")
.as_ref(),
printer.stderr(),
printer.stderr_important(),
"error",
AnsiColors::Red,
)?;
Expand Down
11 changes: 11 additions & 0 deletions crates/uv/src/printer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,17 @@ impl Printer {
}
}

/// Return the [`Stderr`] for this printer, including in quiet mode.
pub(crate) fn stderr_important(self) -> Stderr {
match self {
Self::Silent => Stderr::Disabled,
Self::Quiet => Stderr::Enabled,
Self::Default => Stderr::Enabled,
Self::Verbose => Stderr::Enabled,
Self::NoProgress => Stderr::Enabled,
}
}

/// Return the [`Stderr`] for this printer.
pub(crate) fn stderr(self) -> Stderr {
match self {
Expand Down
Loading