Skip to content

Commit

Permalink
cli: Add --json support to --check
Browse files Browse the repository at this point in the history
This will let higher level tools (Plasma Discover for example) more
easily read the output of `bootc update --check --json`.
  • Loading branch information
travier committed Apr 16, 2024
1 parent b254f86 commit db73ad3
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ pub(crate) struct UpgradeOpts {
#[clap(long, conflicts_with = "apply")]
pub(crate) check: bool,

/// Output JSON
#[clap(long, conflicts_with = "apply", required_if_eq("check", "true"))]
pub(crate) json: bool,

/// Restart or reboot into the new target image.
///
/// Currently, this option always reboots. In the future this command
Expand Down Expand Up @@ -433,7 +437,7 @@ async fn upgrade(opts: UpgradeOpts) -> Result<()> {
if let Some(previous_image) = booted_image.as_ref() {
let diff =
ostree_container::ManifestDiff::new(&previous_image.manifest, &r.manifest);
diff.print();
diff.print(opts.json);
}
}
}
Expand Down Expand Up @@ -466,7 +470,7 @@ async fn upgrade(opts: UpgradeOpts) -> Result<()> {
if let Some(fetched_manifest) = fetched.get_manifest(repo)? {
let diff =
ostree_container::ManifestDiff::new(&prev.manifest, &fetched_manifest);
diff.print();
diff.print(opts.json);
}
}
}
Expand Down

0 comments on commit db73ad3

Please sign in to comment.