mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-25 20:33:08 +00:00
Make __fish_describe_command stop barfing on /
Prior to this fix, __fish_describe_command would error if the input contained any special characters, because it would be interpolated into a regex. Hack in a guard to do nothing if the input contains anything other than [a-zA-Z0-9_ ]
This commit is contained in:
parent
87f646d84d
commit
6a6ffe68cb
1 changed files with 5 additions and 0 deletions
|
@ -3,6 +3,11 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
function __fish_describe_command -d "Command used to find descriptions for commands"
|
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=" +- +" '{
|
apropos $argv 2>/dev/null | awk -v FS=" +- +" '{
|
||||||
split($1, names, ", ");
|
split($1, names, ", ");
|
||||||
for (name in names)
|
for (name in names)
|
||||||
|
|
Loading…
Reference in a new issue