From 19a01fb3a4be6eb072d1dc16e0fb908237ef58ee Mon Sep 17 00:00:00 2001 From: Guillaume Ranquet Date: Thu, 1 Jun 2023 17:16:46 +0200 Subject: [PATCH] cp: makes --preserve requires = prevents --preserve to eat the next argument when no value is passed. default value for --preserve is set to mode,ownership,timestamps before the patch: cp --preserve foo bar error: invalid value 'foo' for '--preserve [...]' [possible values: mode, ownership, timestamps, context, link, links, xattr, all] Signed-off-by: Guillaume Ranquet --- src/uu/cp/src/cp.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/uu/cp/src/cp.rs b/src/uu/cp/src/cp.rs index 513fb8380a7..102918f9785 100644 --- a/src/uu/cp/src/cp.rs +++ b/src/uu/cp/src/cp.rs @@ -514,6 +514,8 @@ pub fn uu_app() -> Command { PRESERVABLE_ATTRIBUTES, )) .num_args(0..) + .require_equals(true) + .default_missing_value("mode,ownership,timestamps") .value_name("ATTR_LIST") .overrides_with_all([ options::ARCHIVE,