Let command -q work

This required "-sq" to be used and errored if just "-q" was given.

Instead, if only "-q" is given, we behave just as if "-sq" was.
This commit is contained in:
Fabian Homborg
2019-02-09 12:51:55 +01:00
parent fb7a6e5f34
commit dc0746bc45
2 changed files with 5 additions and 4 deletions

View File

@@ -87,7 +87,8 @@ int builtin_command(parser_t &parser, io_streams_t &streams, wchar_t **argv) {
return STATUS_CMD_OK;
}
if (!opts.find_path && !opts.all_paths) {
// Quiet implies find_path.
if (!opts.find_path && !opts.all_paths && !opts.quiet) {
builtin_print_help(parser, streams, cmd, streams.out);
return STATUS_INVALID_ARGS;
}
@@ -101,7 +102,7 @@ int builtin_command(parser_t &parser, io_streams_t &streams, wchar_t **argv) {
if (!opts.quiet) streams.out.append_format(L"%ls\n", path.c_str());
++found;
}
} else {
} else { // Either find_path explicitly or just quiet.
wcstring path;
if (path_get_path(command_name, &path, parser.vars())) {
if (!opts.quiet) streams.out.append_format(L"%ls\n", path.c_str());