builtin functions: don't mix up multiple arguments

This regressed in 2e38cf2a which is contained in 2.6.0.

Fixes #7515
This commit is contained in:
Johannes Altmanninger 2020-11-29 06:20:43 +01:00
parent 4ed22246c3
commit 7da93e2617
2 changed files with 11 additions and 1 deletions

View File

@ -329,7 +329,7 @@ maybe_t<int> builtin_functions(parser_t &parser, io_streams_t &streams, wchar_t
} else {
if (!opts.query) {
if (i != optind) streams.out.append(L"\n");
const wchar_t *funcname = argv[optind];
const wchar_t *funcname = argv[i];
report_function_metadata(funcname, opts.verbose, streams, parser, true);
wcstring def = functions_def(funcname);

View File

@ -73,6 +73,16 @@ functions -d description2 test_func_desc
functions test_func_desc | string match --quiet '*description2*'
or echo "Failed to find description 2" >&2
# ==========
# Verify that the functions are printed in order.
functions f1 test_func_desc
# CHECK: # Defined in {{.*}}
# CHECK: function f1
# CHECK: end
# CHECK: # Defined in {{.*}}
# CHECK: function test_func_desc --description description2
# CHECK: end
# Note: This test isn't ideal - if ls was loaded before,
# or doesn't exist, it'll succeed anyway.
#