mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-26 10:43:47 +08:00
Fix man completion for BSD's mandoc
This commit is contained in:
parent
0a277bf8c3
commit
3099d7bdeb
|
@ -35,15 +35,13 @@ function __fish_complete_man
|
|||
__fish_apropos $token 2>/dev/null | awk '
|
||||
BEGIN { FS="[\t ]- "; OFS="\t"; }
|
||||
# BSD/Darwin
|
||||
/^[^( \t]+\('$section'\)/ {
|
||||
split($1, pages, ", ");
|
||||
/^[^( \t]+(, [^( \t]+)*\('$section'\)/ {
|
||||
paren = index($1, "(");
|
||||
sect = substr($1, paren + 1, length($1) - paren - 1);
|
||||
aliases = substr($1, 1, paren - 1)
|
||||
split(aliases, pages, ", ");
|
||||
for (i in pages) {
|
||||
page = pages[i];
|
||||
sub(/[ \t]+/, "", page);
|
||||
paren = index(page, "(");
|
||||
name = substr(page, 1, paren - 1);
|
||||
sect = substr(page, paren + 1, length(page) - paren - 1);
|
||||
print name, sect ": " $2;
|
||||
print pages[i], sect ": " $2
|
||||
}
|
||||
}
|
||||
# man-db
|
||||
|
|
Loading…
Reference in New Issue
Block a user