1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 03:27:44 +00:00

Merge pull request #5764 from cakebaker/mv_simplify_condition

mv: simplify condition
This commit is contained in:
Sylvestre Ledru 2024-01-01 17:45:34 +01:00 committed by GitHub
commit 97cb2b2de6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -128,13 +128,13 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let mut app = uu_app();
let matches = app.try_get_matches_from_mut(args)?;
if !matches.contains_id(OPT_TARGET_DIRECTORY)
&& matches
.get_many::<OsString>(ARG_FILES)
.map(|f| f.len())
.unwrap_or(0)
== 1
{
let files: Vec<OsString> = matches
.get_many::<OsString>(ARG_FILES)
.unwrap_or_default()
.cloned()
.collect();
if files.len() == 1 && !matches.contains_id(OPT_TARGET_DIRECTORY) {
app.error(
ErrorKind::TooFewValues,
format!(
@ -144,12 +144,6 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
.exit();
}
let files: Vec<OsString> = matches
.get_many::<OsString>(ARG_FILES)
.unwrap_or_default()
.cloned()
.collect();
let overwrite_mode = determine_overwrite_mode(&matches);
let backup_mode = backup_control::determine_backup_mode(&matches)?;
let update_mode = update_control::determine_update_mode(&matches);