Allow functions -e completions to complete hidden __fish functions

...but only if the user has started their function name argument with an
underscore.
This commit is contained in:
Mahmoud Al-Qudsi 2018-06-27 14:42:42 -05:00
parent 092307d4c0
commit 144af5116a

View File

@ -1,4 +1,13 @@
complete -c functions -s e -l erase -d "Erase function" -x -a "(functions -n)"
function __fish_maybe_list_all_functions
# if the current commandline token starts with an _, list all functions
if string match -qr -- '^_' (commandline -ct)
functions -an
else
functions -n
end
end
complete -c functions -s e -l erase -d "Erase function" -x -a "(__fish_maybe_list_all_functions)"
complete -c functions -xa "(functions -na)" -d "Function"
complete -c functions -s a -l all -d "Show hidden functions"
complete -c functions -s h -l help -d "Display help and exit"