mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
Merge pull request #5392 from zhitkoff/split-undocumented-opt-aliases
`split`: undocumented options aliases + help fix
This commit is contained in:
commit
f76b53d969
2 changed files with 29 additions and 1 deletions
|
@ -311,6 +311,7 @@ pub fn uu_app() -> Command {
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new(OPT_NUMERIC_SUFFIXES)
|
Arg::new(OPT_NUMERIC_SUFFIXES)
|
||||||
.long(OPT_NUMERIC_SUFFIXES)
|
.long(OPT_NUMERIC_SUFFIXES)
|
||||||
|
.alias("numeric")
|
||||||
.require_equals(true)
|
.require_equals(true)
|
||||||
.default_missing_value("0")
|
.default_missing_value("0")
|
||||||
.num_args(0..=1)
|
.num_args(0..=1)
|
||||||
|
@ -338,6 +339,7 @@ pub fn uu_app() -> Command {
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new(OPT_HEX_SUFFIXES)
|
Arg::new(OPT_HEX_SUFFIXES)
|
||||||
.long(OPT_HEX_SUFFIXES)
|
.long(OPT_HEX_SUFFIXES)
|
||||||
|
.alias("hex")
|
||||||
.default_missing_value("0")
|
.default_missing_value("0")
|
||||||
.require_equals(true)
|
.require_equals(true)
|
||||||
.num_args(0..=1)
|
.num_args(0..=1)
|
||||||
|
@ -372,7 +374,7 @@ pub fn uu_app() -> Command {
|
||||||
.allow_hyphen_values(true)
|
.allow_hyphen_values(true)
|
||||||
.value_name("SEP")
|
.value_name("SEP")
|
||||||
.action(ArgAction::Append)
|
.action(ArgAction::Append)
|
||||||
.help("use SEP instead of newline as the record separator; '\0' (zero) specifies the NUL character"),
|
.help("use SEP instead of newline as the record separator; '\\0' (zero) specifies the NUL character"),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new(OPT_IO)
|
Arg::new(OPT_IO)
|
||||||
|
|
|
@ -1192,6 +1192,19 @@ fn test_numeric_suffix() {
|
||||||
assert_eq!(at.read("x12"), "");
|
assert_eq!(at.read("x12"), "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_numeric_suffix_alias() {
|
||||||
|
let (at, mut ucmd) = at_and_ucmd!();
|
||||||
|
ucmd.args(&["-n", "4", "--numeric=9", "threebytes.txt"])
|
||||||
|
.succeeds()
|
||||||
|
.no_stdout()
|
||||||
|
.no_stderr();
|
||||||
|
assert_eq!(at.read("x09"), "a");
|
||||||
|
assert_eq!(at.read("x10"), "b");
|
||||||
|
assert_eq!(at.read("x11"), "c");
|
||||||
|
assert_eq!(at.read("x12"), "");
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_hex_suffix() {
|
fn test_hex_suffix() {
|
||||||
let (at, mut ucmd) = at_and_ucmd!();
|
let (at, mut ucmd) = at_and_ucmd!();
|
||||||
|
@ -1205,6 +1218,19 @@ fn test_hex_suffix() {
|
||||||
assert_eq!(at.read("x0c"), "");
|
assert_eq!(at.read("x0c"), "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_hex_suffix_alias() {
|
||||||
|
let (at, mut ucmd) = at_and_ucmd!();
|
||||||
|
ucmd.args(&["-n", "4", "--hex=9", "threebytes.txt"])
|
||||||
|
.succeeds()
|
||||||
|
.no_stdout()
|
||||||
|
.no_stderr();
|
||||||
|
assert_eq!(at.read("x09"), "a");
|
||||||
|
assert_eq!(at.read("x0a"), "b");
|
||||||
|
assert_eq!(at.read("x0b"), "c");
|
||||||
|
assert_eq!(at.read("x0c"), "");
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_numeric_suffix_no_equal() {
|
fn test_numeric_suffix_no_equal() {
|
||||||
new_ucmd!()
|
new_ucmd!()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue