mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
basenc: fix error code on on wrong arguments, fix usage printing test
This commit is contained in:
parent
9f9fb1901f
commit
e5fc8bca8d
2 changed files with 8 additions and 5 deletions
|
@ -18,6 +18,7 @@ use uucore::{
|
||||||
};
|
};
|
||||||
|
|
||||||
use std::io::{stdin, Read};
|
use std::io::{stdin, Read};
|
||||||
|
use uucore::error::UClapError;
|
||||||
|
|
||||||
static ABOUT: &str = "\
|
static ABOUT: &str = "\
|
||||||
With no FILE, or when FILE is -, read standard input.
|
With no FILE, or when FILE is -, read standard input.
|
||||||
|
@ -49,10 +50,12 @@ pub fn uu_app<'a>() -> Command<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parse_cmd_args(args: impl uucore::Args) -> UResult<(Config, Format)> {
|
fn parse_cmd_args(args: impl uucore::Args) -> UResult<(Config, Format)> {
|
||||||
let matches = uu_app().get_matches_from(
|
let matches = uu_app()
|
||||||
args.collect_str(InvalidEncodingHandling::ConvertLossy)
|
.try_get_matches_from(
|
||||||
.accept_any(),
|
args.collect_str(InvalidEncodingHandling::ConvertLossy)
|
||||||
);
|
.accept_any(),
|
||||||
|
)
|
||||||
|
.with_exit_code(1)?;
|
||||||
let format = ENCODINGS
|
let format = ENCODINGS
|
||||||
.iter()
|
.iter()
|
||||||
.find(|encoding| matches.is_present(encoding.0))
|
.find(|encoding| matches.is_present(encoding.0))
|
||||||
|
|
|
@ -183,7 +183,7 @@ sed -i "s/\(\(b2[ml]_[69]\|b32h_[56]\|z85_8\|z85_35\).*OUT=>\)[^}]*\(.*\)/\1\"\"
|
||||||
sed -i "s/\$prog: invalid input/\$prog: error: invalid input/g" tests/misc/basenc.pl
|
sed -i "s/\$prog: invalid input/\$prog: error: invalid input/g" tests/misc/basenc.pl
|
||||||
|
|
||||||
# basenc: swap out error message for unexpected arg
|
# basenc: swap out error message for unexpected arg
|
||||||
sed -i "s/ {ERR=>\"\$prog: foobar\\\\n\" \. \$try_help }/ {ERR=>\"error: Found argument '--foobar' which wasn't expected, or isn't valid in this context\n\nUSAGE:\n basenc [OPTION]... [FILE]\n\nFor more information try --help\n\"}]/" tests/misc/basenc.pl
|
sed -i "s/ {ERR=>\"\$prog: foobar\\\\n\" \. \$try_help }/ {ERR=>\"error: Found argument '--foobar' which wasn't expected, or isn't valid in this context\n\n\tIf you tried to supply \`--foobar\` as a value rather than a flag, use \`-- --foobar\`\n\nUSAGE:\n basenc [OPTION]... [FILE]\n\nFor more information try --help\n\"}]/" tests/misc/basenc.pl
|
||||||
sed -i "s/ {ERR_SUBST=>\"s\/(unrecognized|unknown) option \[-' \]\*foobar\[' \]\*\/foobar\/\"}],//" tests/misc/basenc.pl
|
sed -i "s/ {ERR_SUBST=>\"s\/(unrecognized|unknown) option \[-' \]\*foobar\[' \]\*\/foobar\/\"}],//" tests/misc/basenc.pl
|
||||||
|
|
||||||
# Remove the check whether a util was built. Otherwise tests against utils like "arch" are not run.
|
# Remove the check whether a util was built. Otherwise tests against utils like "arch" are not run.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue