diff --git a/share/functions/__fish_describe_command.fish b/share/functions/__fish_describe_command.fish index 43936c4be..d102f0e71 100644 --- a/share/functions/__fish_describe_command.fish +++ b/share/functions/__fish_describe_command.fish @@ -3,6 +3,11 @@ # function __fish_describe_command -d "Command used to find descriptions for commands" + # We're going to try to build a regex out of $argv inside awk. + # Make sure $argv has no special characters. + # TODO: stop interpolating argv into regex, and remove this hack. + string match --quiet --regex '^[a-zA-Z0-9_ ]+$' -- "$argv" + or return apropos $argv 2>/dev/null | awk -v FS=" +- +" '{ split($1, names, ", "); for (name in names)