string: Fix swapped arguments in error message

Really this could do with a bespoke error, but this'll do for now.
This commit is contained in:
Fabian Boehm
2026-05-29 10:22:38 +02:00
parent bb74d8155e
commit 25cc01845a
2 changed files with 2 additions and 2 deletions

View File

@@ -68,7 +68,7 @@ fn take_args(
};
*optind += 1;
let Some(replacement) = args.get(*optind).copied() else {
err_fmt!(Error::UNEXP_ARG_COUNT, 1, 2)
err_fmt!(Error::UNEXP_ARG_COUNT, 2, 1)
.subcmd(cmd, subcmd)
.finish(streams);
return Err(STATUS_INVALID_ARGS);

View File

@@ -1311,7 +1311,7 @@ string replace --max-matches 99999999999999999999
string replace
# CHECKERR: string replace: missing argument
string replace one
# CHECKERR: string replace: expected 1 arguments; got 2
# CHECKERR: string replace: expected 2 arguments; got 1
string replace -r o '${bad_name}' foobar
# CHECKERR: string replace: Regular expression substitute error: unknown substring