mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-15 22:44:01 +00:00
Fix man completion for BSD's mandoc
This commit is contained in:
parent
0a277bf8c3
commit
3099d7bdeb
1 changed files with 6 additions and 8 deletions
|
@ -35,15 +35,13 @@ function __fish_complete_man
|
||||||
__fish_apropos $token 2>/dev/null | awk '
|
__fish_apropos $token 2>/dev/null | awk '
|
||||||
BEGIN { FS="[\t ]- "; OFS="\t"; }
|
BEGIN { FS="[\t ]- "; OFS="\t"; }
|
||||||
# BSD/Darwin
|
# BSD/Darwin
|
||||||
/^[^( \t]+\('$section'\)/ {
|
/^[^( \t]+(, [^( \t]+)*\('$section'\)/ {
|
||||||
split($1, pages, ", ");
|
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) {
|
for (i in pages) {
|
||||||
page = pages[i];
|
print pages[i], sect ": " $2
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# man-db
|
# man-db
|
||||||
|
|
Loading…
Reference in a new issue