mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
echo: do not infer long args
This commit is contained in:
parent
c439f81129
commit
1b324da436
2 changed files with 13 additions and 1 deletions
|
@ -132,13 +132,15 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn uu_app() -> Command {
|
pub fn uu_app() -> Command {
|
||||||
|
// Note: echo is different from the other utils in that it should **not**
|
||||||
|
// have `infer_long_args(true)`, because, for example, `--ver` should be
|
||||||
|
// printed as `--ver` and not show the version text.
|
||||||
Command::new(uucore::util_name())
|
Command::new(uucore::util_name())
|
||||||
// TrailingVarArg specifies the final positional argument is a VarArg
|
// TrailingVarArg specifies the final positional argument is a VarArg
|
||||||
// and it doesn't attempts the parse any further args.
|
// and it doesn't attempts the parse any further args.
|
||||||
// Final argument must have multiple(true) or the usage string equivalent.
|
// Final argument must have multiple(true) or the usage string equivalent.
|
||||||
.trailing_var_arg(true)
|
.trailing_var_arg(true)
|
||||||
.allow_hyphen_values(true)
|
.allow_hyphen_values(true)
|
||||||
.infer_long_args(true)
|
|
||||||
.version(crate_version!())
|
.version(crate_version!())
|
||||||
.about(ABOUT)
|
.about(ABOUT)
|
||||||
.after_help(AFTER_HELP)
|
.after_help(AFTER_HELP)
|
||||||
|
|
|
@ -293,3 +293,13 @@ fn old_octal_syntax() {
|
||||||
.succeeds()
|
.succeeds()
|
||||||
.stdout_is("A1\n");
|
.stdout_is("A1\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn partial_version_argument() {
|
||||||
|
new_ucmd!().arg("--ver").succeeds().stdout_is("--ver\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn partial_help_argument() {
|
||||||
|
new_ucmd!().arg("--he").succeeds().stdout_is("--he\n");
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue