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

Merge pull request #7000 from cakebaker/csplit_add_support_for_q

csplit: add support for `-q`
This commit is contained in:
Sylvestre Ledru 2024-12-26 10:20:08 +01:00 committed by GitHub
commit 958320e043
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 18 additions and 12 deletions

View file

@ -621,8 +621,9 @@ pub fn uu_app() -> Command {
)
.arg(
Arg::new(options::QUIET)
.short('s')
.short('q')
.long(options::QUIET)
.visible_short_alias('s')
.visible_alias("silent")
.help("do not print counts of output file sizes")
.action(ArgAction::SetTrue),

View file

@ -387,18 +387,23 @@ fn test_option_keep() {
#[test]
fn test_option_quiet() {
let (at, mut ucmd) = at_and_ucmd!();
ucmd.args(&["--quiet", "numbers50.txt", "13", "%25%", "/0$/"])
.succeeds()
.no_stdout();
for arg in ["-q", "--quiet", "-s", "--silent"] {
let (at, mut ucmd) = at_and_ucmd!();
ucmd.args(&[arg, "numbers50.txt", "13", "%25%", "/0$/"])
.succeeds()
.no_stdout();
let count = glob(&at.plus_as_string("xx*"))
.expect("there should be splits created")
.count();
assert_eq!(count, 3);
assert_eq!(at.read("xx00"), generate(1, 13));
assert_eq!(at.read("xx01"), generate(25, 30));
assert_eq!(at.read("xx02"), generate(30, 51));
let count = glob(&at.plus_as_string("xx*"))
.expect("there should be splits created")
.count();
assert_eq!(count, 3);
assert_eq!(at.read("xx00"), generate(1, 13));
assert_eq!(at.read("xx01"), generate(25, 30));
assert_eq!(at.read("xx02"), generate(30, 51));
at.remove("xx00");
at.remove("xx01");
at.remove("xx02");
}
}
#[test]