cli: Add JSON output option for pull --check & compare#618
cli: Add JSON output option for pull --check & compare#618travier wants to merge 1 commit intoostreedev:mainfrom
Conversation
|
Draft as we probably want to use a JSON crate for this. |
01058c4 to
a131591
Compare
a131591 to
ac6acf2
Compare
|
c9s test is failing because it tries to build bootc and thus needs bootc-dev/bootc#472. Maybe I should not change the number of args of this function and add a new |
Right, we can't change public API without bumping the semantic version. (Which is OK to do, but then we'd need to turn off the reverse-dependency build checks temporarily) |
lib/src/container/mod.rs
Outdated
| println!("Added layers: {print_n_added:<4} Size: {print_added_size}"); | ||
| pub fn print(&self, json: bool) { | ||
| if json { | ||
| let out = json!({ |
There was a problem hiding this comment.
Instead of this we can add #[derive(Serialize)] for ManifestDiff and get these bits for free. We'll likely need to skip serializing the held references.
And as a bonus, that's a fully API compatible change that wouldn't require changing print.
|
Closing in favor of #619 |
This will make it easier for other higher level tools (Plasma Discover for example) to read the output of those commands.
ac6acf2 to
8d3db9c
Compare
| @@ -234,6 +239,10 @@ pub(crate) enum ContainerImageOpts { | |||
| /// the new manifest. | |||
| #[clap(long)] | |||
| check: Option<Utf8PathBuf>, | |||
There was a problem hiding this comment.
It looks like this Option is not respected by clap and always asked on the command line:
$ ostree container image pull --check check repo ostree-image-signed:registry:a.a/a:a
error: Opening directory at 'repo': No such file or directory (os error 2)
$ ostree container image pull --check repo ostree-image-signed:registry:a.a/a:a
error: the following required arguments were not provided:
<IMGREF>
Usage: ostree-container container image pull --check <CHECK> <REPO> <IMGREF>
For more information, try '--help'.
There was a problem hiding this comment.
Hum, OK, it's a little bit more complex than that for the pull --check option as it optionally writes to a file.
This will make it easier for other higher level tools (Plasma Discover
for example) to read the output of those commands.