diff options
author | Lars Wirzenius <liw@liw.fi> | 2021-10-07 09:56:14 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2021-10-07 09:56:14 +0300 |
commit | fc89c31f80dbcb3333f711ab2feee616c0d51016 (patch) | |
tree | 144e15e8b413b11cc7ef72a6304055c0d0f04aef /src | |
parent | 4a31da1aea3305d8a452d87caf56ef48ef3122b0 (diff) | |
download | vmadm-fc89c31f80dbcb3333f711ab2feee616c0d51016.tar.gz |
feat: the `spec` and `config` subcommand now output pretty JSON
Sponsored-by: author
Diffstat (limited to 'src')
-rw-r--r-- | src/cmd/config.rs | 2 | ||||
-rw-r--r-- | src/cmd/spec.rs | 3 |
2 files changed, 3 insertions, 2 deletions
diff --git a/src/cmd/config.rs b/src/cmd/config.rs index e45f7c0..2840fcb 100644 --- a/src/cmd/config.rs +++ b/src/cmd/config.rs @@ -13,7 +13,7 @@ use crate::progress::Progress; pub fn config(config: &Configuration, progress: &Progress) -> Result<(), std::io::Error> { progress.chatty("showing runtime configuration"); - let config = serde_json::to_vec(&config).unwrap(); + let config = serde_json::to_vec_pretty(&config).unwrap(); std::io::stdout().write_all(&config)?; Ok(()) } diff --git a/src/cmd/spec.rs b/src/cmd/spec.rs index 4f1a764..44e522a 100644 --- a/src/cmd/spec.rs +++ b/src/cmd/spec.rs @@ -13,7 +13,8 @@ use crate::spec::Specification; pub fn spec(specs: &[Specification], progress: &Progress) -> Result<(), std::io::Error> { progress.chatty("showing specification for virtual machines"); - let spec = serde_json::to_vec(specs).unwrap(); + let spec = serde_json::to_vec_pretty(specs).unwrap(); std::io::stdout().write_all(&spec)?; + std::io::stdout().write_all("\n".as_bytes())?; Ok(()) } |