fork/fish-shell
git clone https://git.julia.blue/fork/fish-shell
e0916e793
master
1# localization: skip(private) 2# 3# This function is used internally by the fish command completion code 4# 5 6# Perform this check once at startup rather than on each invocation 7if not type -q apropos 8function __fish_describe_command 9end 10exit 11end 12 13function __fish_describe_command -d"Command used to find descriptions for commands" 14argparse exact --$argv 15or return 1 16set -l suffix 17set -q _flag_exact&& set suffix'$' 18 19# $argv will be inserted directly into the awk regex, so it must be escaped 20set -l argv_regex( string escape --style=regex --" $argv " ) 21__fish_apropos "^ $argv$suffix " 2> /dev/null| awk -v FS=" +- +" '{ 22split($1, names, ", "); 23for (name in names) 24if (names[name] ~ /^'" $argv_regex "'.* *\([18]\)/ ) { 25sub( "( |\t)*\\\([18]\\\)", "", names[name] ); 26sub( " \\\[.*\\\]", "", names[name] ); 27print names[name] "\t" $2; 28} 29}' 30end