diff options
author | Lars Wirzenius <liw@liw.fi> | 2021-07-12 13:21:10 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2021-07-12 13:21:10 +0300 |
commit | 7fa564f500af542771bda7bfada85366a2f47f35 (patch) | |
tree | 034c33f574ea0fd707ac3c5784ba82fb4ead0113 /src/cmd | |
parent | 7d1836c4f9685bc67aeaf41ab6a7d2f43008288b (diff) | |
download | vmadm-7fa564f500af542771bda7bfada85366a2f47f35.tar.gz |
feat: add sub-command "config"
Sponsored-by: author
Diffstat (limited to 'src/cmd')
-rw-r--r-- | src/cmd/config.rs | 14 | ||||
-rw-r--r-- | src/cmd/mod.rs | 3 |
2 files changed, 17 insertions, 0 deletions
diff --git a/src/cmd/config.rs b/src/cmd/config.rs new file mode 100644 index 0000000..996439b --- /dev/null +++ b/src/cmd/config.rs @@ -0,0 +1,14 @@ +//! The `config` sub-command. + +use std::io::Write; + +use crate::config::Configuration; + +/// The `config` sub-command. +/// +/// Write the actual run-time configuration to stdout. +pub fn config(config: &Configuration) -> Result<(), std::io::Error> { + let config = serde_yaml::to_vec(&config).unwrap(); + std::io::stdout().write_all(&config)?; + Ok(()) +} diff --git a/src/cmd/mod.rs b/src/cmd/mod.rs index 8ae8f70..490cdc4 100644 --- a/src/cmd/mod.rs +++ b/src/cmd/mod.rs @@ -20,3 +20,6 @@ pub use shutdown::shutdown; pub mod cloud_init; pub use cloud_init::cloud_init; + +pub mod config; +pub use config::config; |