fish-shell/share/functions/__fish_whatis.fish
Fabian Homborg c2970f9618 Reformat all files
This runs build_tools/style.fish, which runs clang-format on C++, fish_indent on fish and (new) black on python.

If anything is wrong with the formatting, we should fix the tools, but automated formatting is worth it.
2019-05-05 12:09:25 +02:00

22 lines
504 B
Fish

# uses `whatis` if available to describe a command
function __fish_whatis
set -l cmd $argv[1]
set -l fallback
if set -q argv[2]
set fallback $argv[2]
end
set -l description (whatis $cmd 2>/dev/null | string replace -r '.*? - ' '')[1]
if not string match -qr -- "." "$description"
printf '%s\n' $description
return 0
else if not string match -q -- "$fallback" ""
printf '%s\n' $fallback
return 0
else
return 1
end
end