diff options
author | Lars Wirzenius <liw@liw.fi> | 2021-04-10 09:48:40 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2021-04-10 10:29:27 +0300 |
commit | 958839c264b3ef36ef1bc74a4794fc383cc39292 (patch) | |
tree | 3565e1e7d7672629fa1756d25445f9eab1b2a369 /src/cmd | |
parent | 20a5db2cc1b348087bca5e689ed38f98e1150955 (diff) | |
download | obnam2-958839c264b3ef36ef1bc74a4794fc383cc39292.tar.gz |
refactor: struct ShowConfig subcommand
Diffstat (limited to 'src/cmd')
-rw-r--r-- | src/cmd/mod.rs | 4 | ||||
-rw-r--r-- | src/cmd/show_config.rs | 12 |
2 files changed, 10 insertions, 6 deletions
diff --git a/src/cmd/mod.rs b/src/cmd/mod.rs index 02f4f01..890e176 100644 --- a/src/cmd/mod.rs +++ b/src/cmd/mod.rs @@ -4,7 +4,5 @@ pub mod init; pub mod list; pub mod list_files; pub mod restore; -pub mod show_gen; - pub mod show_config; -pub use show_config::show_config; +pub mod show_gen; diff --git a/src/cmd/show_config.rs b/src/cmd/show_config.rs index 88ee9ec..424e2ed 100644 --- a/src/cmd/show_config.rs +++ b/src/cmd/show_config.rs @@ -1,7 +1,13 @@ use crate::config::ClientConfig; use crate::error::ObnamError; +use structopt::StructOpt; -pub fn show_config(config: &ClientConfig) -> Result<(), ObnamError> { - println!("{}", serde_json::to_string_pretty(&config.config())?); - Ok(()) +#[derive(Debug, StructOpt)] +pub struct ShowConfig {} + +impl ShowConfig { + pub fn run(&self, config: &ClientConfig) -> Result<(), ObnamError> { + println!("{}", serde_json::to_string_pretty(&config.config())?); + Ok(()) + } } |