blob: 44e522a028de79d1d95388d4b0bc77ba1f887323 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
//! The `spec` sub-command.
use std::io::Write;
use crate::progress::Progress;
use crate::spec::Specification;
/// The `spec` sub-command.
///
/// Write the actual VM specifications to stdout as JSON. We convert
/// the spec to JSON to make it more clear that we parse the config
/// and spec in the right way.
pub fn spec(specs: &[Specification], progress: &Progress) -> Result<(), std::io::Error> {
progress.chatty("showing specification for virtual machines");
let spec = serde_json::to_vec_pretty(specs).unwrap();
std::io::stdout().write_all(&spec)?;
std::io::stdout().write_all("\n".as_bytes())?;
Ok(())
}
|