mirror of
https://github.com/fish-shell/fish-shell
synced 2024-11-10 15:14:44 +00:00
functions -q
: Return false without an argument
This erroneously listed functions and returned true.
This commit is contained in:
parent
bfa051e466
commit
93c0d3f4a5
4 changed files with 15 additions and 0 deletions
|
@ -337,6 +337,11 @@ int builtin_functions(parser_t &parser, io_streams_t &streams, wchar_t **argv) {
|
|||
return STATUS_CMD_OK;
|
||||
}
|
||||
|
||||
// If we query with no argument, just return false.
|
||||
if (opts.query && argc == optind) {
|
||||
return STATUS_CMD_ERROR;
|
||||
}
|
||||
|
||||
if (opts.list || argc == optind) {
|
||||
wcstring_list_t names = function_get_names(opts.show_hidden);
|
||||
std::sort(names.begin(), names.end());
|
||||
|
|
|
@ -29,3 +29,6 @@ fish: function: The name 'test' is reserved,
|
|||
and can not be used as a function name
|
||||
function test; echo banana; end
|
||||
^
|
||||
|
||||
####################
|
||||
# Checking `functions -q` without arguments
|
||||
|
|
|
@ -48,4 +48,7 @@ diff (functions name3 | psub) (functions name3a | psub)
|
|||
|
||||
logmsg Checking reserved names
|
||||
function test; echo banana; end
|
||||
|
||||
logmsg Checking `functions -q` without arguments
|
||||
functions -q; or echo "False"
|
||||
exit 0
|
||||
|
|
|
@ -73,3 +73,7 @@ Function name4 not found as expected
|
|||
|
||||
####################
|
||||
# Checking reserved names
|
||||
|
||||
####################
|
||||
# Checking `functions -q` without arguments
|
||||
False
|
||||
|
|
Loading…
Reference in a new issue