diff --git a/src/builtin_type.cpp b/src/builtin_type.cpp index 3a1fa3ec8..870c341b9 100644 --- a/src/builtin_type.cpp +++ b/src/builtin_type.cpp @@ -132,7 +132,6 @@ maybe_t builtin_type(parser_t &parser, io_streams_t &streams, wchar_t **arg ++found; res = true; if (!opts.query && !opts.type) { - streams.out.append_format(_(L"%ls is a function"), name); auto path = function_get_definition_file(name); if (opts.path) { if (path) { @@ -140,6 +139,7 @@ maybe_t builtin_type(parser_t &parser, io_streams_t &streams, wchar_t **arg streams.out.append(L"\n"); } } else if (!opts.short_output) { + streams.out.append_format(_(L"%ls is a function"), name); streams.out.append(_(L" with definition")); streams.out.append(L"\n"); // Function path @@ -166,6 +166,7 @@ maybe_t builtin_type(parser_t &parser, io_streams_t &streams, wchar_t **arg streams.out.append(def); } } else { + streams.out.append_format(_(L"%ls is a function"), name); auto path = function_get_definition_file(name); if (path) { streams.out.append_format(_(L" (defined in %ls)"), path); diff --git a/tests/checks/type.fish b/tests/checks/type.fish index b0c162ecd..47e46b784 100644 --- a/tests/checks/type.fish +++ b/tests/checks/type.fish @@ -52,3 +52,9 @@ echo $status type -q echo $status # CHECK: 1 + +type -p alias +# CHECK: {{.*}}/alias.fish + +type -s alias +# CHECK: alias is a function (defined in {{.*}}/alias.fish)