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:
commit
97cb2b2de6
1 changed files with 7 additions and 13 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue