Allow to restore snapshots in a user-defined directory.

This commit is contained in:
Edu4rdSHL 2021-04-15 22:06:51 -05:00
parent dbd488240c
commit 28a754574c
No known key found for this signature in database
GPG key ID: 3A574A4009F553E5
2 changed files with 4 additions and 2 deletions

View file

@ -19,7 +19,7 @@ args:
multiple: false
- source-dir:
help: Directory from where snapshots should be created.
help: Directory from where snapshots should be created. It can also be used to specify the directory where a snapshot will be restored.
long: from
takes_value: true
multiple: false

View file

@ -45,7 +45,9 @@ pub fn manage_restoring(args: &mut Args) -> Result<()> {
let snapshot_data = database::return_snapshot_data(&connection, args)?;
if !snapshot_data.snap_id.is_empty() {
args.snapshot_name = snapshot_data.destination + &snapshot_data.name;
args.source_dir = snapshot_data.source;
if args.source_dir.is_empty() {
args.source_dir = snapshot_data.source;
}
} else {
eprintln!(
"Snapshot ID {} does not returned any data. Please double check the ID.",