summaryrefslogtreecommitdiff
path: root/src/cmd/restore.rs
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2020-12-23 09:44:31 +0200
committerLars Wirzenius <liw@liw.fi>2020-12-23 10:17:17 +0200
commit15ce048ca21ad517e27ab598d861ae07f817067d (patch)
tree01857ffa023c770164a9cc07d1024ed388150864 /src/cmd/restore.rs
parentd6584921d8bb77fd4de8b6997848599cb9d73e01 (diff)
downloadobnam2-15ce048ca21ad517e27ab598d861ae07f817067d.tar.gz
feat! add a global --config option
This breaks all invocations of the Obnam client, as the option needs to come before the subcommand name. The benefit of this breakage is simpler, less repetitive code.
Diffstat (limited to 'src/cmd/restore.rs')
-rw-r--r--src/cmd/restore.rs4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/cmd/restore.rs b/src/cmd/restore.rs
index 27f0ce3..791bebf 100644
--- a/src/cmd/restore.rs
+++ b/src/cmd/restore.rs
@@ -14,7 +14,7 @@ use std::path::{Path, PathBuf};
use structopt::StructOpt;
use tempfile::NamedTempFile;
-pub fn restore(config: &Path, gen_id: &str, to: &Path) -> anyhow::Result<()> {
+pub fn restore(config: &ClientConfig, gen_id: &str, to: &Path) -> anyhow::Result<()> {
// Create a named temporary file. We don't meed the open file
// handle, so we discard that.
let dbname = {
@@ -23,8 +23,6 @@ pub fn restore(config: &Path, gen_id: &str, to: &Path) -> anyhow::Result<()> {
dbname
};
- let config = ClientConfig::read_config(&config).unwrap();
-
let client = BackupClient::new(&config.server_url)?;
let gen_chunk = client.fetch_generation(&gen_id)?;
debug!("gen: {:?}", gen_chunk);