diff --git a/lib/Cargo.toml b/lib/Cargo.toml index dfee6a003..3e6493b42 100644 --- a/lib/Cargo.toml +++ b/lib/Cargo.toml @@ -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" diff --git a/lib/src/status.rs b/lib/src/status.rs index 29079bf7e..0296daab1 100644 --- a/lib/src/status.rs +++ b/lib/src/status.rs @@ -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. diff --git a/lib/src/utils.rs b/lib/src/utils.rs index 51a73c414..3c73e8f66 100644 --- a/lib/src/utils.rs +++ b/lib/src/utils.rs @@ -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.