mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-24 17:46:01 +08:00
f64364cced
darcs-hash:20061129140004-ac50b-485ff6bfd71e9459ba62461f6e093ca5c9ddd664.gz
28 lines
548 B
Fish
28 lines
548 B
Fish
|
|
function __fish_complete_man
|
|
if test (commandline -ct)
|
|
|
|
# Try to guess what section to search in. If we don't know, we
|
|
# use [^)]*, which should match any section
|
|
|
|
set section ""
|
|
set prev (commandline -poc)
|
|
set -e prev[1]
|
|
while count $prev
|
|
switch $prev[1]
|
|
case '-**'
|
|
|
|
case '*'
|
|
set section $prev[1]
|
|
end
|
|
set -e prev[1]
|
|
end
|
|
|
|
set section $section"[^)]*"
|
|
|
|
# Do the actual search
|
|
apropos (commandline -ct) | sgrep \^(commandline -ct) | sed -n -e 's/\([^ ]*\).*(\('$section'\)) *- */\1'\t'\2: /p'
|
|
end
|
|
end
|
|
|