Describe Command awk-ification

Changed __fish_describe_command to use awk instead of sed, and handle 'alternative' names, as used by OS X. (And possibly some BSDs?)

darcs-hash:20060205221805-494f2-85a48edd8e6fbcfc1dcd28079e4adfa52a0466d0.gz
This commit is contained in:
Nicholas Pilon 2006-02-06 08:18:05 +10:00
parent 89ae02976f
commit bde5921258

View File

@ -252,7 +252,7 @@ end
#
function __fish_describe_command -d "Command used to find descriptions for commands"
apropos $argv | sed -ne "s/^$argv\([^ ]*\) *([18]) *- \(.*\)\$/$argv\1"\t"\2/p"
apropos $argv | awk -v FS=" +- +" '{split($1, names, ", "); for (name in names) if (names[name] ~ /^'"$argv"'.* *\([18]\)/) { sub("\\([18]\\)", "", names[name]); print names[name] "\t" $2; } }'
end
#