1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-30 04:27:45 +00:00

install: Mark '-S', '-b' and '--backup' as implemented

Removes the "unimplemented" notice from the respective help texts. Stop
printing errors if the options are supplied via CLI.
This commit is contained in:
Andreas Hartmann 2021-06-23 16:33:52 +02:00
parent 5437985705
commit df41fed640

View file

@ -107,7 +107,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
.arg( .arg(
Arg::with_name(OPT_BACKUP) Arg::with_name(OPT_BACKUP)
.long(OPT_BACKUP) .long(OPT_BACKUP)
.help("(unimplemented) make a backup of each existing destination file") .help("make a backup of each existing destination file")
.takes_value(true) .takes_value(true)
.require_equals(true) .require_equals(true)
.min_values(0) .min_values(0)
@ -117,7 +117,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
// TODO implement flag // TODO implement flag
Arg::with_name(OPT_BACKUP_NO_ARG) Arg::with_name(OPT_BACKUP_NO_ARG)
.short("b") .short("b")
.help("(unimplemented) like --backup but does not accept an argument") .help("like --backup but does not accept an argument")
) )
.arg( .arg(
Arg::with_name(OPT_IGNORED) Arg::with_name(OPT_IGNORED)
@ -190,7 +190,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
Arg::with_name(OPT_SUFFIX) Arg::with_name(OPT_SUFFIX)
.short("S") .short("S")
.long(OPT_SUFFIX) .long(OPT_SUFFIX)
.help("(unimplemented) override the usual backup suffix") .help("override the usual backup suffix")
.value_name("SUFFIX") .value_name("SUFFIX")
.takes_value(true) .takes_value(true)
.min_values(1) .min_values(1)
@ -268,14 +268,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
/// ///
/// ///
fn check_unimplemented<'a>(matches: &ArgMatches) -> Result<(), &'a str> { fn check_unimplemented<'a>(matches: &ArgMatches) -> Result<(), &'a str> {
if matches.is_present(OPT_BACKUP) { if matches.is_present(OPT_NO_TARGET_DIRECTORY) {
Err("--backup")
} else if matches.is_present(OPT_BACKUP_2) {
Err("-b")
} else if matches.is_present(OPT_BACKUP_NO_ARG) {
} else if matches.is_present(OPT_SUFFIX) {
Err("--suffix, -S")
} else if matches.is_present(OPT_NO_TARGET_DIRECTORY) {
Err("--no-target-directory, -T") Err("--no-target-directory, -T")
} else if matches.is_present(OPT_PRESERVE_CONTEXT) { } else if matches.is_present(OPT_PRESERVE_CONTEXT) {
Err("--preserve-context, -P") Err("--preserve-context, -P")