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

cp: make --preserve use the defaults when empty

This commit is contained in:
Emil Suleymanov 2022-11-09 14:43:27 +01:00
parent 0324a9480e
commit 8591d99c1b

View file

@ -745,9 +745,14 @@ impl Options {
attributes.push(Attribute::from_str(attribute_str)?); attributes.push(Attribute::from_str(attribute_str)?);
} }
} }
// `--preserve` case, use the defaults
if attributes.is_empty() {
DEFAULT_ATTRIBUTES.to_vec()
} else {
attributes attributes
} }
} }
}
} else if matches.get_flag(options::ARCHIVE) { } else if matches.get_flag(options::ARCHIVE) {
// --archive is used. Same as --preserve=all // --archive is used. Same as --preserve=all
add_all_attributes() add_all_attributes()