string: Also stop printing documentation

Especially as, in this case, the documentation is quite massive.

Caught by porting string's test to littlecheck.

See #3404 - this was already supposed to be included.
This commit is contained in:
Fabian Homborg 2019-06-25 17:15:48 +02:00
parent 60edc9a45d
commit 77d8487078
2 changed files with 15 additions and 3 deletions

View File

@ -55,7 +55,7 @@ static void string_error(io_streams_t &streams, const wchar_t *fmt, ...) {
static void string_unknown_option(parser_t &parser, io_streams_t &streams, const wchar_t *subcmd,
const wchar_t *opt) {
string_error(streams, BUILTIN_ERR_UNKNOWN, subcmd, opt);
builtin_print_help(parser, streams, L"string", streams.err);
builtin_print_error_trailer(parser, streams.err, L"string");
}
// We read from stdin if we are the second or later process in a pipeline.
@ -1344,7 +1344,7 @@ int builtin_string(parser_t &parser, io_streams_t &streams, wchar_t **argv) {
int argc = builtin_count_args(argv);
if (argc <= 1) {
streams.err.append_format(BUILTIN_ERR_MISSING_SUBCMD, cmd);
builtin_print_help(parser, streams, L"string", streams.err);
builtin_print_error_trailer(parser, streams.err, L"string");
return STATUS_INVALID_ARGS;
}
@ -1359,7 +1359,7 @@ int builtin_string(parser_t &parser, io_streams_t &streams, wchar_t **argv) {
}
if (!subcmd->handler) {
streams.err.append_format(BUILTIN_ERR_INVALID_SUBCMD, cmd, argv[1]);
builtin_print_help(parser, streams, L"string", streams.err);
builtin_print_error_trailer(parser, streams.err, L"string");
return STATUS_INVALID_ARGS;
}

View File

@ -189,6 +189,12 @@ string match: ^
# string invalidarg
string: Subcommand 'invalidarg' is not valid
Standard input (line 215):
string invalidarg; and echo "unexpected exit 0"
^
(Type 'help string' for related documentation)
####################
# string length
@ -271,6 +277,12 @@ string repeat: Expected argument
# string repeat -l fakearg 2>&1
string repeat: Unknown option '-l'
Standard input (line 291):
string repeat -l fakearg
^
(Type 'help string' for related documentation)
####################
# string repeat ""