Skip to content

Commit

Permalink
wip: human visible consumption
Browse files Browse the repository at this point in the history
  • Loading branch information
lukewarmtemp committed Jun 20, 2024
1 parent 1c5ad72 commit 320e7ec
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
8 changes: 7 additions & 1 deletion lib/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,11 @@ pub(crate) struct StatusOpts {
/// Only display status for the booted deployment.
#[clap(long)]
pub(crate) booted: bool,

/// Condense status into most important info, to reduce eye fatigue
#[clap(long)]
pub(crate) pretty: bool,

}

/// Options for internal testing
Expand Down Expand Up @@ -731,7 +736,8 @@ fn test_parse_opts() {
Opt::parse_including_static(["bootc", "status"]),
Opt::Status(StatusOpts {
json: false,
booted: false
booted: false,
pretty: false
})
));
}
Expand Down
11 changes: 10 additions & 1 deletion lib/src/status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,15 @@ pub(crate) async fn status(opts: super::cli::StatusOpts) -> Result<()> {
// Filter to just the serializable status structures.
let out = std::io::stdout();
let mut out = out.lock();
if opts.json {



if opts.pretty {

if let Some(&host.status.booted)

println!("Current deployment image: {:?}", &host.status.booted.unwrap().image.unwrap().image.image);
} else if opts.json {
serde_json::to_writer(&mut out, &host).context("Writing to stdout")?;
} else {
serde_yaml::to_writer(&mut out, &host).context("Writing to stdout")?;
Expand All @@ -326,6 +334,7 @@ pub(crate) async fn status(opts: super::cli::StatusOpts) -> Result<()> {
Ok(())
}


#[test]
fn test_convert_signatures() {
use std::str::FromStr;
Expand Down

0 comments on commit 320e7ec

Please sign in to comment.