fork/fish-shell

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

Johannes AltmanningerMark private functions that don't need localizationa53db7256

master
530 B22 linesraw
1# localization: skip(private)
2
3# uses `whatis` if available to describe a command
4
5function __fish_whatis
6    set -l cmd $argv[1]
7    set -l fallback
8    if set -q argv[2]
9        set fallback $argv[2]
10    end
11
12    set -l description (whatis $cmd 2>/dev/null | string replace -r '.*? - ' '')[1]
13    if string match -qr -- "." "$description"
14        printf '%s\n' $description
15        return 0
16    else if not string match -q -- "$fallback" ""
17        printf '%s\n' $fallback
18        return 0
19    else
20        return 1
21    end
22end