From 502753acf9ae02cfcd0e8a0dd6a79ba92c8b9ef1 Mon Sep 17 00:00:00 2001 From: Eduard Tolosa Date: Mon, 5 Feb 2024 02:47:48 -0500 Subject: [PATCH] Use args.dest_dir (--to) when restoring the snapshot --- src/controller.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/controller.rs b/src/controller.rs index 3704ba9..2809e91 100644 --- a/src/controller.rs +++ b/src/controller.rs @@ -43,21 +43,20 @@ pub fn manage_restoring(args: &mut Args, extra_args: &mut ExtraArgs) -> Result<( std::process::exit(1); } else { extra_args.snapshot_name = snapshot_data.destination + &snapshot_data.name; - if args.source_dir.is_empty() { - args.source_dir = snapshot_data.source; + if args.dest_dir.is_empty() { + // The current destination directory corresponds to the source directory + // at the moment of the snapshot creation. + args.dest_dir = snapshot_data.source; } } println!("Restoring the snapshot with ID {}", args.snapshot_id); println!("Name of the snapshot: {}", extra_args.snapshot_name); - println!("Source directory: {}", args.source_dir); + println!("Restoring snapshot to: {}", args.dest_dir); if !extra_args.snapshot_name.is_empty() && operations::restore_snapshot(args, &extra_args.snapshot_name) { - println!( - "The snapshot with ID {} was successfully restored to {}", - args.snapshot_id, args.source_dir - ); + println!("The snapshot was successfully restored"); } Ok(())