Skip to content

Commit 6133ef5

Browse files
ajanicijvogonsoft
andauthored
du: Allow command-line argument that appears more than once (#11897)
--------- Co-authored-by: Aleksandar Janicijevic <aleks@vogonsoft.com>
1 parent bd76e84 commit 6133ef5

File tree

2 files changed

+261
-21
lines changed

2 files changed

+261
-21
lines changed

src/uu/du/src/du.rs

Lines changed: 44 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1289,131 +1289,150 @@ pub fn uu_app() -> Command {
12891289
.long(options::ALL)
12901290
.help(translate!("du-help-all"))
12911291
.conflicts_with(options::SUMMARIZE)
1292+
.overrides_with(options::ALL)
12921293
.action(ArgAction::SetTrue),
12931294
)
12941295
.arg(
12951296
Arg::new(options::APPARENT_SIZE)
12961297
.short('A')
12971298
.long(options::APPARENT_SIZE)
12981299
.help(translate!("du-help-apparent-size"))
1299-
.action(ArgAction::SetTrue),
1300+
.action(ArgAction::SetTrue)
1301+
.overrides_with(options::APPARENT_SIZE),
13001302
)
13011303
.arg(
13021304
Arg::new(options::BLOCK_SIZE)
13031305
.short('B')
13041306
.long(options::BLOCK_SIZE)
13051307
.value_name("SIZE")
1306-
.help(translate!("du-help-block-size")),
1308+
.help(translate!("du-help-block-size"))
1309+
.overrides_with(options::BLOCK_SIZE),
13071310
)
13081311
.arg(
13091312
Arg::new(options::BYTES)
13101313
.short('b')
13111314
.long("bytes")
13121315
.help(translate!("du-help-bytes"))
1313-
.action(ArgAction::SetTrue),
1316+
.action(ArgAction::SetTrue)
1317+
.overrides_with(options::BYTES),
13141318
)
13151319
.arg(
13161320
Arg::new(options::TOTAL)
13171321
.long("total")
13181322
.short('c')
13191323
.help(translate!("du-help-total"))
1320-
.action(ArgAction::SetTrue),
1324+
.action(ArgAction::SetTrue)
1325+
.overrides_with(options::TOTAL),
13211326
)
13221327
.arg(
13231328
Arg::new(options::MAX_DEPTH)
13241329
.short('d')
13251330
.long("max-depth")
13261331
.value_name("N")
1327-
.help(translate!("du-help-max-depth")),
1332+
.help(translate!("du-help-max-depth"))
1333+
.overrides_with(options::MAX_DEPTH),
13281334
)
13291335
.arg(
13301336
Arg::new(options::HUMAN_READABLE)
13311337
.long("human-readable")
13321338
.short('h')
13331339
.help(translate!("du-help-human-readable"))
1334-
.action(ArgAction::SetTrue),
1340+
.action(ArgAction::SetTrue)
1341+
.overrides_with(options::HUMAN_READABLE),
13351342
)
13361343
.arg(
13371344
Arg::new(options::INODES)
13381345
.long(options::INODES)
13391346
.help(translate!("du-help-inodes"))
1340-
.action(ArgAction::SetTrue),
1347+
.action(ArgAction::SetTrue)
1348+
.overrides_with(options::INODES),
13411349
)
13421350
.arg(
13431351
Arg::new(options::BLOCK_SIZE_1K)
13441352
.short('k')
13451353
.help(translate!("du-help-block-size-1k"))
1346-
.action(ArgAction::SetTrue),
1354+
.action(ArgAction::SetTrue)
1355+
.overrides_with(options::BLOCK_SIZE_1K),
13471356
)
13481357
.arg(
13491358
Arg::new(options::COUNT_LINKS)
13501359
.short('l')
13511360
.long("count-links")
13521361
.help(translate!("du-help-count-links"))
1353-
.action(ArgAction::SetTrue),
1362+
.action(ArgAction::SetTrue)
1363+
.overrides_with(options::COUNT_LINKS),
13541364
)
13551365
.arg(
13561366
Arg::new(options::DEREFERENCE)
13571367
.short('L')
13581368
.long(options::DEREFERENCE)
13591369
.help(translate!("du-help-dereference"))
1360-
.action(ArgAction::SetTrue),
1370+
.action(ArgAction::SetTrue)
1371+
.overrides_with(options::DEREFERENCE),
13611372
)
13621373
.arg(
13631374
Arg::new(options::DEREFERENCE_ARGS)
13641375
.short('D')
13651376
.visible_short_alias('H')
13661377
.long(options::DEREFERENCE_ARGS)
13671378
.help(translate!("du-help-dereference-args"))
1368-
.action(ArgAction::SetTrue),
1379+
.action(ArgAction::SetTrue)
1380+
.overrides_with(options::DEREFERENCE_ARGS),
13691381
)
13701382
.arg(
13711383
Arg::new(options::NO_DEREFERENCE)
13721384
.short('P')
13731385
.long(options::NO_DEREFERENCE)
13741386
.help(translate!("du-help-no-dereference"))
13751387
.overrides_with(options::DEREFERENCE)
1388+
.overrides_with(options::NO_DEREFERENCE)
13761389
.action(ArgAction::SetTrue),
13771390
)
13781391
.arg(
13791392
Arg::new(options::BLOCK_SIZE_1M)
13801393
.short('m')
13811394
.help(translate!("du-help-block-size-1m"))
1382-
.action(ArgAction::SetTrue),
1395+
.action(ArgAction::SetTrue)
1396+
.overrides_with(options::BLOCK_SIZE_1M),
13831397
)
13841398
.arg(
13851399
Arg::new(options::NULL)
13861400
.short('0')
13871401
.long("null")
13881402
.help(translate!("du-help-null"))
1389-
.action(ArgAction::SetTrue),
1403+
.action(ArgAction::SetTrue)
1404+
.overrides_with(options::NULL),
13901405
)
13911406
.arg(
13921407
Arg::new(options::SEPARATE_DIRS)
13931408
.short('S')
13941409
.long("separate-dirs")
13951410
.help(translate!("du-help-separate-dirs"))
1396-
.action(ArgAction::SetTrue),
1411+
.action(ArgAction::SetTrue)
1412+
.overrides_with(options::SEPARATE_DIRS),
13971413
)
13981414
.arg(
13991415
Arg::new(options::SUMMARIZE)
14001416
.short('s')
14011417
.long("summarize")
14021418
.help(translate!("du-help-summarize"))
1403-
.action(ArgAction::SetTrue),
1419+
.action(ArgAction::SetTrue)
1420+
.overrides_with(options::SUMMARIZE),
14041421
)
14051422
.arg(
14061423
Arg::new(options::SI)
14071424
.long(options::SI)
14081425
.help(translate!("du-help-si"))
1409-
.action(ArgAction::SetTrue),
1426+
.action(ArgAction::SetTrue)
1427+
.overrides_with(options::SI),
14101428
)
14111429
.arg(
14121430
Arg::new(options::ONE_FILE_SYSTEM)
14131431
.short('x')
14141432
.long(options::ONE_FILE_SYSTEM)
14151433
.help(translate!("du-help-one-file-system"))
1416-
.action(ArgAction::SetTrue),
1434+
.action(ArgAction::SetTrue)
1435+
.overrides_with(options::ONE_FILE_SYSTEM),
14171436
)
14181437
.arg(
14191438
Arg::new(options::THRESHOLD)
@@ -1422,14 +1441,16 @@ pub fn uu_app() -> Command {
14221441
.value_name("SIZE")
14231442
.num_args(1)
14241443
.allow_hyphen_values(true)
1425-
.help(translate!("du-help-threshold")),
1444+
.help(translate!("du-help-threshold"))
1445+
.overrides_with(options::THRESHOLD),
14261446
)
14271447
.arg(
14281448
Arg::new(options::VERBOSE)
14291449
.short('v')
14301450
.long("verbose")
14311451
.help(translate!("du-help-verbose"))
1432-
.action(ArgAction::SetTrue),
1452+
.action(ArgAction::SetTrue)
1453+
.overrides_with(options::VERBOSE),
14331454
)
14341455
.arg(
14351456
Arg::new(options::EXCLUDE)
@@ -1467,13 +1488,15 @@ pub fn uu_app() -> Command {
14671488
PossibleValue::new("ctime").alias("status"),
14681489
PossibleValue::new("creation").alias("birth"),
14691490
]))
1470-
.help(translate!("du-help-time")),
1491+
.help(translate!("du-help-time"))
1492+
.overrides_with(options::TIME),
14711493
)
14721494
.arg(
14731495
Arg::new(options::TIME_STYLE)
14741496
.long(options::TIME_STYLE)
14751497
.value_name("STYLE")
1476-
.help(translate!("du-help-time-style")),
1498+
.help(translate!("du-help-time-style"))
1499+
.overrides_with(options::TIME_STYLE),
14771500
)
14781501
.arg(
14791502
Arg::new(options::FILE)

0 commit comments

Comments
 (0)