Skip to content

Commit 958320e

Browse files
authored
Merge pull request #7000 from cakebaker/csplit_add_support_for_q
csplit: add support for `-q`
2 parents b974206 + db37c31 commit 958320e

File tree

2 files changed

+18
-12
lines changed

2 files changed

+18
-12
lines changed

src/uu/csplit/src/csplit.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -621,8 +621,9 @@ pub fn uu_app() -> Command {
621621
)
622622
.arg(
623623
Arg::new(options::QUIET)
624-
.short('s')
624+
.short('q')
625625
.long(options::QUIET)
626+
.visible_short_alias('s')
626627
.visible_alias("silent")
627628
.help("do not print counts of output file sizes")
628629
.action(ArgAction::SetTrue),

tests/by-util/test_csplit.rs

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -387,18 +387,23 @@ fn test_option_keep() {
387387

388388
#[test]
389389
fn test_option_quiet() {
390-
let (at, mut ucmd) = at_and_ucmd!();
391-
ucmd.args(&["--quiet", "numbers50.txt", "13", "%25%", "/0$/"])
392-
.succeeds()
393-
.no_stdout();
390+
for arg in ["-q", "--quiet", "-s", "--silent"] {
391+
let (at, mut ucmd) = at_and_ucmd!();
392+
ucmd.args(&[arg, "numbers50.txt", "13", "%25%", "/0$/"])
393+
.succeeds()
394+
.no_stdout();
394395

395-
let count = glob(&at.plus_as_string("xx*"))
396-
.expect("there should be splits created")
397-
.count();
398-
assert_eq!(count, 3);
399-
assert_eq!(at.read("xx00"), generate(1, 13));
400-
assert_eq!(at.read("xx01"), generate(25, 30));
401-
assert_eq!(at.read("xx02"), generate(30, 51));
396+
let count = glob(&at.plus_as_string("xx*"))
397+
.expect("there should be splits created")
398+
.count();
399+
assert_eq!(count, 3);
400+
assert_eq!(at.read("xx00"), generate(1, 13));
401+
assert_eq!(at.read("xx01"), generate(25, 30));
402+
assert_eq!(at.read("xx02"), generate(30, 51));
403+
at.remove("xx00");
404+
at.remove("xx01");
405+
at.remove("xx02");
406+
}
402407
}
403408

404409
#[test]

0 commit comments

Comments
 (0)