summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2021-10-07 06:57:14 +0000
committerLars Wirzenius <liw@liw.fi>2021-10-07 06:57:14 +0000
commit21521cfe1b0870e8552d19b022ac0c3902eb356e (patch)
tree144e15e8b413b11cc7ef72a6304055c0d0f04aef
parent4a31da1aea3305d8a452d87caf56ef48ef3122b0 (diff)
parentfc89c31f80dbcb3333f711ab2feee616c0d51016 (diff)
downloadvmadm-21521cfe1b0870e8552d19b022ac0c3902eb356e.tar.gz
Merge branch 'pretty' into 'main'
feat: the `spec` and `config` subcommand now output pretty JSON Closes #27 See merge request larswirzenius/vmadm!46
-rw-r--r--src/cmd/config.rs2
-rw-r--r--src/cmd/spec.rs3
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(())
}