mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-03-05 04:39:39 +08:00
Add -h flag to builtin wait
This commit is contained in:
parent
7206be3e47
commit
66ae1a1edb
@ -178,9 +178,11 @@ int builtin_wait(parser_t &parser, io_streams_t &streams, wchar_t **argv) {
|
||||
const wchar_t *cmd = argv[0];
|
||||
int argc = builtin_count_args(argv);
|
||||
bool any_flag = false; // flag for -n option
|
||||
bool print_help = false;
|
||||
|
||||
static const wchar_t *const short_options = L":n";
|
||||
static const wchar_t *const short_options = L":nh";
|
||||
static const struct woption long_options[] = {{L"any", no_argument, nullptr, 'n'},
|
||||
{L"help", no_argument, nullptr, 'h'},
|
||||
{nullptr, 0, nullptr, 0}};
|
||||
|
||||
int opt;
|
||||
@ -190,6 +192,9 @@ int builtin_wait(parser_t &parser, io_streams_t &streams, wchar_t **argv) {
|
||||
case 'n':
|
||||
any_flag = true;
|
||||
break;
|
||||
case 'h':
|
||||
print_help = true;
|
||||
break;
|
||||
case ':': {
|
||||
builtin_missing_argument(parser, streams, cmd, argv[w.woptind - 1]);
|
||||
return STATUS_INVALID_ARGS;
|
||||
@ -205,6 +210,11 @@ int builtin_wait(parser_t &parser, io_streams_t &streams, wchar_t **argv) {
|
||||
}
|
||||
}
|
||||
|
||||
if (print_help) {
|
||||
builtin_print_help(parser, streams, cmd);
|
||||
return STATUS_CMD_OK;
|
||||
}
|
||||
|
||||
if (w.woptind == argc) {
|
||||
// no jobs specified
|
||||
retval = wait_for_backgrounds(parser, any_flag);
|
||||
|
Loading…
x
Reference in New Issue
Block a user