diff --git a/src/builtin.cpp b/src/builtin.cpp index 0fb131e2b..fa2e0376f 100644 --- a/src/builtin.cpp +++ b/src/builtin.cpp @@ -122,7 +122,7 @@ int parse_help_only_cmd_opts(struct help_only_cmd_opts_t &opts, int *optind, int break; } case ':': { - streams.err.append_format(BUILTIN_ERR_MISSING, cmd, argv[w.woptind - 1]); + builtin_missing_argument(parser, streams, cmd, argv[w.woptind - 1]); return STATUS_INVALID_ARGS; } case '?': { diff --git a/src/builtin_bind.cpp b/src/builtin_bind.cpp index 86978e857..c7bf8bb7d 100644 --- a/src/builtin_bind.cpp +++ b/src/builtin_bind.cpp @@ -331,7 +331,7 @@ static int parse_cmd_opts(bind_cmd_opts_t &opts, int *optind, //!OCLINT(high nc return STATUS_CMD_OK; } case ':': { - streams.err.append_format(BUILTIN_ERR_MISSING, cmd, argv[w.woptind - 1]); + builtin_missing_argument(parser, streams, cmd, argv[w.woptind - 1]); return STATUS_INVALID_ARGS; } case L'?': { diff --git a/src/builtin_block.cpp b/src/builtin_block.cpp index 8e06c8b3e..0e4d5aee3 100644 --- a/src/builtin_block.cpp +++ b/src/builtin_block.cpp @@ -51,7 +51,7 @@ static int parse_cmd_opts(block_cmd_opts_t &opts, int *optind, //!OCLINT(high n break; } case ':': { - streams.err.append_format(BUILTIN_ERR_MISSING, cmd, argv[w.woptind - 1]); + builtin_missing_argument(parser, streams, cmd, argv[w.woptind - 1]); return STATUS_INVALID_ARGS; } case '?': { diff --git a/src/builtin_builtin.cpp b/src/builtin_builtin.cpp index 6d888fac5..e10f17b49 100644 --- a/src/builtin_builtin.cpp +++ b/src/builtin_builtin.cpp @@ -38,7 +38,7 @@ static int parse_cmd_opts(builtin_cmd_opts_t &opts, int *optind, int argc, wchar break; } case ':': { - streams.err.append_format(BUILTIN_ERR_MISSING, cmd, argv[w.woptind - 1]); + builtin_missing_argument(parser, streams, cmd, argv[w.woptind - 1]); return STATUS_INVALID_ARGS; } case '?': { diff --git a/src/builtin_command.cpp b/src/builtin_command.cpp index b53cec1e8..13dc1ad3d 100644 --- a/src/builtin_command.cpp +++ b/src/builtin_command.cpp @@ -52,7 +52,7 @@ static int parse_cmd_opts(command_cmd_opts_t &opts, int *optind, int argc, wchar break; } case ':': { - streams.err.append_format(BUILTIN_ERR_MISSING, cmd, argv[w.woptind - 1]); + builtin_missing_argument(parser, streams, cmd, argv[w.woptind - 1]); return STATUS_INVALID_ARGS; } case '?': { diff --git a/src/builtin_commandline.cpp b/src/builtin_commandline.cpp index 39b693ae2..d26b3ee07 100644 --- a/src/builtin_commandline.cpp +++ b/src/builtin_commandline.cpp @@ -304,7 +304,7 @@ int builtin_commandline(parser_t &parser, io_streams_t &streams, wchar_t **argv) return STATUS_CMD_OK; } case ':': { - streams.err.append_format(BUILTIN_ERR_MISSING, cmd, argv[w.woptind - 1]); + builtin_missing_argument(parser, streams, cmd, argv[w.woptind - 1]); return STATUS_INVALID_ARGS; } case L'?': { @@ -330,8 +330,7 @@ int builtin_commandline(parser_t &parser, io_streams_t &streams, wchar_t **argv) } if (argc == w.woptind) { - streams.err.append_format(BUILTIN_ERR_MISSING, argv[0]); - builtin_print_help(parser, streams, cmd, streams.err); + builtin_missing_argument(parser, streams, cmd, argv[0]); return STATUS_INVALID_ARGS; } diff --git a/src/builtin_contains.cpp b/src/builtin_contains.cpp index 060abbfaa..346e267f1 100644 --- a/src/builtin_contains.cpp +++ b/src/builtin_contains.cpp @@ -36,7 +36,7 @@ static int parse_cmd_opts(contains_cmd_opts_t &opts, int *optind, int argc, wcha break; } case ':': { - streams.err.append_format(BUILTIN_ERR_MISSING, cmd, argv[w.woptind - 1]); + builtin_missing_argument(parser, streams, cmd, argv[w.woptind - 1]); return STATUS_INVALID_ARGS; } case '?': { diff --git a/src/builtin_echo.cpp b/src/builtin_echo.cpp index 76ee71056..db7afd99e 100644 --- a/src/builtin_echo.cpp +++ b/src/builtin_echo.cpp @@ -46,7 +46,7 @@ static int parse_cmd_opts(echo_cmd_opts_t &opts, int *optind, int argc, wchar_t break; } case ':': { - streams.err.append_format(BUILTIN_ERR_MISSING, cmd, argv[w.woptind - 1]); + builtin_missing_argument(parser, streams, cmd, argv[w.woptind - 1]); return STATUS_INVALID_ARGS; } case '?': { diff --git a/src/builtin_exit.cpp b/src/builtin_exit.cpp index 3390b44e7..9a15de052 100644 --- a/src/builtin_exit.cpp +++ b/src/builtin_exit.cpp @@ -35,7 +35,7 @@ static int parse_cmd_opts(exit_cmd_opts_t &opts, int *optind, //!OCLINT(high nc break; } case ':': { - streams.err.append_format(BUILTIN_ERR_MISSING, cmd, argv[w.woptind - 1]); + builtin_missing_argument(parser, streams, cmd, argv[w.woptind - 1]); return STATUS_INVALID_ARGS; } case '?': { diff --git a/src/builtin_function.cpp b/src/builtin_function.cpp index 6f29d93a2..9576ce9dc 100644 --- a/src/builtin_function.cpp +++ b/src/builtin_function.cpp @@ -154,7 +154,7 @@ static int parse_cmd_opts(function_cmd_opts_t &opts, int *optind, //!OCLINT(hig break; } case ':': { - streams.err.append_format(BUILTIN_ERR_MISSING, cmd, argv[w.woptind - 1]); + builtin_missing_argument(parser, streams, cmd, argv[w.woptind - 1]); return STATUS_INVALID_ARGS; } case '?': { diff --git a/src/builtin_functions.cpp b/src/builtin_functions.cpp index 92dbd57f9..5e6b42433 100644 --- a/src/builtin_functions.cpp +++ b/src/builtin_functions.cpp @@ -89,7 +89,7 @@ static int parse_cmd_opts(functions_cmd_opts_t &opts, int *optind, //!OCLINT(hi break; } case ':': { - streams.err.append_format(BUILTIN_ERR_MISSING, cmd, argv[w.woptind - 1]); + builtin_missing_argument(parser, streams, cmd, argv[w.woptind - 1]); return STATUS_INVALID_ARGS; } case '?': { diff --git a/src/builtin_history.cpp b/src/builtin_history.cpp index 27aeadcd3..275024ea6 100644 --- a/src/builtin_history.cpp +++ b/src/builtin_history.cpp @@ -170,7 +170,7 @@ static int parse_cmd_opts(history_cmd_opts_t &opts, int *optind, //!OCLINT(high break; } case ':': { - streams.err.append_format(BUILTIN_ERR_MISSING, cmd, argv[w.woptind - 1]); + builtin_missing_argument(parser, streams, cmd, argv[w.woptind - 1]); return STATUS_INVALID_ARGS; } case '?': { diff --git a/src/builtin_jobs.cpp b/src/builtin_jobs.cpp index 2f97ac7ec..9c2f9d50e 100644 --- a/src/builtin_jobs.cpp +++ b/src/builtin_jobs.cpp @@ -146,7 +146,7 @@ int builtin_jobs(parser_t &parser, io_streams_t &streams, wchar_t **argv) { return STATUS_CMD_OK; } case ':': { - streams.err.append_format(BUILTIN_ERR_MISSING, cmd, argv[w.woptind - 1]); + builtin_missing_argument(parser, streams, cmd, argv[w.woptind - 1]); return STATUS_INVALID_ARGS; } case '?': { diff --git a/src/builtin_read.cpp b/src/builtin_read.cpp index fbb862a90..492a5051e 100644 --- a/src/builtin_read.cpp +++ b/src/builtin_read.cpp @@ -151,7 +151,7 @@ static int parse_cmd_opts(read_cmd_opts_t &opts, int *optind, //!OCLINT(high nc break; } case ':': { - streams.err.append_format(BUILTIN_ERR_MISSING, cmd, argv[w.woptind - 1]); + builtin_missing_argument(parser, streams, cmd, argv[w.woptind - 1]); return STATUS_INVALID_ARGS; } case L'?': { diff --git a/src/builtin_return.cpp b/src/builtin_return.cpp index 2eabaf38d..7e1cc2cf2 100644 --- a/src/builtin_return.cpp +++ b/src/builtin_return.cpp @@ -35,7 +35,7 @@ static int parse_cmd_opts(return_cmd_opts_t &opts, int *optind, //!OCLINT(high break; } case ':': { - streams.err.append_format(BUILTIN_ERR_MISSING, cmd, argv[w.woptind - 1]); + builtin_missing_argument(parser, streams, cmd, argv[w.woptind - 1]); return STATUS_INVALID_ARGS; } case '?': { diff --git a/src/builtin_set.cpp b/src/builtin_set.cpp index c24483743..f70d105f6 100644 --- a/src/builtin_set.cpp +++ b/src/builtin_set.cpp @@ -397,7 +397,7 @@ int builtin_set(parser_t &parser, io_streams_t &streams, wchar_t **argv) { return STATUS_CMD_OK; } case ':': { - streams.err.append_format(BUILTIN_ERR_MISSING, cmd, argv[w.woptind - 1]); + builtin_missing_argument(parser, streams, cmd, argv[w.woptind - 1]); return STATUS_INVALID_ARGS; } case '?': { diff --git a/src/builtin_set_color.cpp b/src/builtin_set_color.cpp index 4505509f6..a4a5d12fc 100644 --- a/src/builtin_set_color.cpp +++ b/src/builtin_set_color.cpp @@ -117,7 +117,7 @@ int builtin_set_color(parser_t &parser, io_streams_t &streams, wchar_t **argv) { return STATUS_CMD_OK; } case ':': { - streams.err.append_format(BUILTIN_ERR_MISSING, cmd, argv[w.woptind - 1]); + builtin_missing_argument(parser, streams, cmd, argv[w.woptind - 1]); return STATUS_INVALID_ARGS; } case '?': { diff --git a/src/builtin_ulimit.cpp b/src/builtin_ulimit.cpp index 73c286924..0a3c7d650 100644 --- a/src/builtin_ulimit.cpp +++ b/src/builtin_ulimit.cpp @@ -244,7 +244,7 @@ int builtin_ulimit(parser_t &parser, io_streams_t &streams, wchar_t **argv) { return STATUS_CMD_OK; } case ':': { - streams.err.append_format(BUILTIN_ERR_MISSING, cmd, argv[w.woptind - 1]); + builtin_missing_argument(parser, streams, cmd, argv[w.woptind - 1]); return STATUS_INVALID_ARGS; } case '?': {