1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-08-02 14:07:46 +00:00

install: Fix argument parsing for '--backup'

The '--backup' option would previously accept arguments separated from the
option either by a space or an equals sign. The GNU implementation strictly
requires an "equals" for argument separation.

As the argument to '--backup' is optional, the equals sign mustn't be ommited
as otherwise there is no way to tell a file argument apart from an argument
that's meant for the '--backup' option. This ensures that if '--backup' is
present it either has no further associated arguments (i.e. fallback to the
default), or the arguments are separated by an equals sign.
This commit is contained in:
Andreas Hartmann 2021-06-23 16:11:46 +02:00
parent 211af9a3ea
commit 3155cd510f

View file

@ -106,6 +106,9 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
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("(unimplemented) make a backup of each existing destination file")
.takes_value(true)
.require_equals(true)
.min_values(0)
.value_name("CONTROL") .value_name("CONTROL")
) )
.arg( .arg(