mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
Reimplemented simply using args
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
This commit is contained in:
parent
db79b5abb2
commit
c4c6819dae
2 changed files with 14 additions and 10 deletions
|
@ -281,15 +281,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
|
|||
return 1;
|
||||
}
|
||||
|
||||
if sets.len() > 2 {
|
||||
show_error!(
|
||||
"extra operand '{}'\nTry `{} --help` for more information.",
|
||||
sets[2],
|
||||
executable!()
|
||||
);
|
||||
return 1;
|
||||
}
|
||||
|
||||
let stdin = stdin();
|
||||
let mut locked_stdin = stdin.lock();
|
||||
let stdout = stdout();
|
||||
|
@ -369,5 +360,10 @@ pub fn uu_app() -> App<'static, 'static> {
|
|||
.short("t")
|
||||
.help("first truncate SET1 to length of SET2"),
|
||||
)
|
||||
.arg(Arg::with_name(options::SETS).multiple(true))
|
||||
.arg(
|
||||
Arg::with_name(options::SETS)
|
||||
.multiple(true)
|
||||
.takes_value(true)
|
||||
.max_values(2),
|
||||
)
|
||||
}
|
||||
|
|
|
@ -275,3 +275,11 @@ fn test_interpret_backslash_at_eol_literally() {
|
|||
.succeeds()
|
||||
.stdout_is("\\");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_more_than_2_sets() {
|
||||
new_ucmd!()
|
||||
.args(&["'abcdefgh'", "'a", "'b'"])
|
||||
.pipe_in("hello world")
|
||||
.fails();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue