summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2021-04-10 09:16:30 +0300
committerLars Wirzenius <liw@liw.fi>2021-04-10 10:29:27 +0300
commit82eb02a0437ba8a7bf2025f5b61864b450ee68b2 (patch)
treeb27bda1c18e18e47aca7cb457caa4ee311ea7461 /src/bin
parent822a2f8c6c4d83d82d4543eb5fcf0ed01df21435 (diff)
downloadobnam2-82eb02a0437ba8a7bf2025f5b61864b450ee68b2.tar.gz
refactor: struct Backup subcommand
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/obnam.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/bin/obnam.rs b/src/bin/obnam.rs
index 4caa548..f639153 100644
--- a/src/bin/obnam.rs
+++ b/src/bin/obnam.rs
@@ -2,8 +2,9 @@ use directories_next::ProjectDirs;
use log::{debug, error, info, LevelFilter};
use log4rs::append::file::FileAppender;
use log4rs::config::{Appender, Config, Logger, Root};
+use obnam::cmd::backup::Backup;
use obnam::cmd::init::Init;
-use obnam::cmd::{backup, get_chunk, list, list_files, restore, show_config, show_generation};
+use obnam::cmd::{get_chunk, list, list_files, restore, show_config, show_generation};
use obnam::config::ClientConfig;
use std::path::{Path, PathBuf};
use structopt::StructOpt;
@@ -28,7 +29,7 @@ fn main() -> anyhow::Result<()> {
let config = load_config_with_passwords(&opt)?;
match opt.cmd {
Command::Init(_) => panic!("this cannot happen"),
- Command::Backup => backup(&config),
+ Command::Backup(x) => x.run(&config),
Command::List => list(&config),
Command::ShowGeneration { gen_id } => show_generation(&config, &gen_id),
Command::ListFiles { gen_id } => list_files(&config, &gen_id),
@@ -96,7 +97,7 @@ struct Opt {
#[derive(Debug, StructOpt)]
enum Command {
Init(Init),
- Backup,
+ Backup(Backup),
List,
ListFiles {
#[structopt(default_value = "latest")]