Skip to content
Snippets Groups Projects
Verified Commit 55a93355 authored by nfontrod's avatar nfontrod
Browse files

copy_file: add new command in copy_file function

parent 418bcf98
No related branches found
No related tags found
No related merge requests found
...@@ -451,13 +451,25 @@ pub(crate) fn split_path(url: &str) -> (String, PathBuf) { ...@@ -451,13 +451,25 @@ pub(crate) fn split_path(url: &str) -> (String, PathBuf) {
if res.len() == 1 { if res.len() == 1 {
return ( return (
String::from("file"), String::from("file"),
PathBuf::from(url).canonicalize().unwrap(), match PathBuf::from(url).canonicalize() {
Ok(path) => path,
Err(e) => {
eprintln!("{}: Problem with {}. {}", "error".red(), url, e);
exit(1);
}
},
); );
} else if res.len() == 2 { } else if res.len() == 2 {
if res[0].to_lowercase() == "file" { if res[0].to_lowercase() == "file" {
return ( return (
String::from("file"), String::from("file"),
PathBuf::from(res[1]).canonicalize().unwrap(), match PathBuf::from(res[1]).canonicalize() {
Ok(path) => path,
Err(e) => {
eprintln!("{}: Problem with {}. {}", "error".red(), &res[1], e);
exit(1);
}
},
); );
} }
return (res[0].to_owned(), PathBuf::from(res[1])); return (res[0].to_owned(), PathBuf::from(res[1]));
...@@ -518,7 +530,7 @@ pub(crate) fn copy_file( ...@@ -518,7 +530,7 @@ pub(crate) fn copy_file(
remote_dir.to_str().unwrap().to_string() remote_dir.to_str().unwrap().to_string()
}; };
let tmp = if cmd == "pull" { let tmp = if cmd == "pull" || cmd == "clone" {
format!("{}/", &remote_path) format!("{}/", &remote_path)
} else { } else {
format!("{}/", &borg_folder.display()) format!("{}/", &borg_folder.display())
...@@ -536,6 +548,17 @@ pub(crate) fn copy_file( ...@@ -536,6 +548,17 @@ pub(crate) fn copy_file(
&tmp, &tmp,
borg_folder.to_str().unwrap(), borg_folder.to_str().unwrap(),
] ]
} else if cmd == "clone" {
vec![
"-a",
"--info=progress2",
"--human-readable",
"--exclude=.gblkconfig",
"--exclude=archive_list",
"--exclude=archive_list_remote",
&tmp,
borg_folder.to_str().unwrap(),
]
} else { } else {
vec![ vec![
"-a", "-a",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment