fork/fish-shell

git clone https://git.julia.blue/fork/fish-shell

Johannes AltmanningerPrepare to not localize private function descriptionsd835c5252

master
971 B31 linesraw
1# localization: tier1
2# This function is typically bound to Alt-W, it is used to list man page entries
3# for the command under the cursor.
4function __fish_whatis_current_token -d "Show man page entries or function description related to the token under the cursor"
5    set -l token (commandline -pt)
6
7    test -n "$token"
8    or return
9
10    set -l desc "$token: nothing appropriate."
11
12    set -l tokentype (type --type $token 2>/dev/null)
13
14    switch "$tokentype"
15        case function
16            set -l funcinfo (functions $token --details --verbose)
17
18            test $funcinfo[5] != n/a
19            and set desc "$token - $funcinfo[5]"
20
21        case builtin
22            # Since man pages can be localized, we can't look for "NAME".
23            set desc (__fish_print_help $token | sed -n 4p | string trim)
24
25        case file
26            set -l tmpdesc (whatis $token 2>/dev/null)
27            and set desc $tmpdesc
28    end
29
30    __fish_echo string join \n -- $desc
31end