Skip to content

Commit

Permalink
status: Make warning message red
Browse files Browse the repository at this point in the history
To increase visibility.

Signed-off-by: Colin Walters <[email protected]>
  • Loading branch information
cgwalters committed Oct 24, 2023
1 parent 41a08bf commit b4ecba0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
2 changes: 2 additions & 0 deletions lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ rust-version = "1.64.0"
include = ["/src", "LICENSE-APACHE", "LICENSE-MIT"]

[dependencies]
anstream = "0.6.4"
anstyle = "1.0.4"
anyhow = "1.0"
camino = { version = "1.0.4", features = ["serde1"] }
ostree-ext = "0.12"
Expand Down
2 changes: 1 addition & 1 deletion lib/src/status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ pub(crate) async fn status(opts: super::cli::StatusOpts) -> Result<()> {
host
};

eprintln!("note: The format of this API is not yet stable");
crate::utils::warning("note: The format of this API is not yet stable");

// If we're in JSON mode, then convert the ostree data into Rust-native
// structures that can be serialized.
Expand Down
9 changes: 9 additions & 0 deletions lib/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,15 @@ pub(crate) fn spawn_editor(tmpf: &tempfile::NamedTempFile) -> Result<()> {
Ok(())
}

/// Output a warning message
pub(crate) fn warning(s: &str) {
anstream::eprintln!(
"{}{s}{}",
anstyle::AnsiColor::Red.render_fg(),
anstyle::Reset.render()
);
}

/// Given a possibly tagged image like quay.io/foo/bar:latest and a digest 0ab32..., return
/// the digested form quay.io/foo/bar:latest@sha256:0ab32...
/// If the image already has a digest, it will be replaced.
Expand Down

0 comments on commit b4ecba0

Please sign in to comment.