summaryrefslogtreecommitdiff
path: root/src/cmd/config.rs
blob: 2840fcb06fc4ef22a97f64414982f2d45b74039c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
//! The `config` sub-command.

use std::io::Write;

use crate::config::Configuration;
use crate::progress::Progress;

/// The `config` sub-command.
///
/// Write the actual run-time configuration to stdout as JSON. We
/// convert the config to JSON to make it clear we parse it the right
/// way.
pub fn config(config: &Configuration, progress: &Progress) -> Result<(), std::io::Error> {
    progress.chatty("showing runtime configuration");

    let config = serde_json::to_vec_pretty(&config).unwrap();
    std::io::stdout().write_all(&config)?;
    Ok(())
}