mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-29 12:07:46 +00:00
cp: Adapt to modified backup mode determination
This commit is contained in:
parent
9d94307880
commit
3a0164310a
1 changed files with 12 additions and 2 deletions
|
@ -98,6 +98,9 @@ quick_error! {
|
||||||
/// path, but those that are not implemented yet should return
|
/// path, but those that are not implemented yet should return
|
||||||
/// a NotImplemented error.
|
/// a NotImplemented error.
|
||||||
NotImplemented(opt: String) { display("Option '{}' not yet implemented.", opt) }
|
NotImplemented(opt: String) { display("Option '{}' not yet implemented.", opt) }
|
||||||
|
|
||||||
|
/// Invalid arguments to backup
|
||||||
|
Backup(description: String) { display("{}\nTry 'cp --help' for more information.", description) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -359,7 +362,6 @@ pub fn uu_app() -> App<'static, 'static> {
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.require_equals(true)
|
.require_equals(true)
|
||||||
.min_values(0)
|
.min_values(0)
|
||||||
.possible_values(backup_control::BACKUP_CONTROL_VALUES)
|
|
||||||
.value_name("CONTROL")
|
.value_name("CONTROL")
|
||||||
)
|
)
|
||||||
.arg(Arg::with_name(options::BACKUP_NO_ARG)
|
.arg(Arg::with_name(options::BACKUP_NO_ARG)
|
||||||
|
@ -604,9 +606,17 @@ impl Options {
|
||||||
|| matches.is_present(options::ARCHIVE);
|
|| matches.is_present(options::ARCHIVE);
|
||||||
|
|
||||||
let backup_mode = backup_control::determine_backup_mode(
|
let backup_mode = backup_control::determine_backup_mode(
|
||||||
matches.is_present(options::BACKUP_NO_ARG) || matches.is_present(options::BACKUP),
|
matches.is_present(options::BACKUP_NO_ARG),
|
||||||
|
matches.is_present(options::BACKUP),
|
||||||
matches.value_of(options::BACKUP),
|
matches.value_of(options::BACKUP),
|
||||||
);
|
);
|
||||||
|
let backup_mode = match backup_mode {
|
||||||
|
Err(err) => {
|
||||||
|
return Err(Error::Backup(err));
|
||||||
|
}
|
||||||
|
Ok(mode) => mode,
|
||||||
|
};
|
||||||
|
|
||||||
let backup_suffix =
|
let backup_suffix =
|
||||||
backup_control::determine_backup_suffix(matches.value_of(options::SUFFIX));
|
backup_control::determine_backup_suffix(matches.value_of(options::SUFFIX));
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue