aboutsummaryrefslogtreecommitdiffhomepage
path: root/share
diff options
context:
space:
mode:
authorGravatar David Adam <zanchey@ucc.gu.uwa.edu.au>2015-12-04 16:22:49 +0800
committerGravatar David Adam <zanchey@ucc.gu.uwa.edu.au>2015-12-04 16:23:57 +0800
commitef67fc7ba05ab2c9b8e6b5240ce4f9da92ca79b8 (patch)
tree87819e4707a33a3b81a069f47ffbe2f6f423e3d7 /share
parent83c0f43b339896106a85b7cd655380b79808a9ac (diff)
__fish_complete_man: rework AWK script
Adds support for the man-db alias format used in CentOS/RHEL 5 Adds basic support for the output of apropos on Solaris Work on #2087.
Diffstat (limited to 'share')
-rw-r--r--share/functions/__fish_complete_man.fish20
1 files changed, 15 insertions, 5 deletions
diff --git a/share/functions/__fish_complete_man.fish b/share/functions/__fish_complete_man.fish
index 59c8c24e..1bdaa5c6 100644
--- a/share/functions/__fish_complete_man.fish
+++ b/share/functions/__fish_complete_man.fish
@@ -35,17 +35,27 @@ function __fish_complete_man
print name, sect ": " $2;
}
}
- # Linux
- /^[^( \t]+ \('$section'\)/ {
+ # man-db
+ /^[^( \t]+ +\('$section'\)/ {
split($1, t, " ");
sect = substr(t[2], 2, length(t[2]) - 2);
print t[1], sect ": " $2;
}
- # Solaris
- /^[^( \t]+\t+[^\(\t]/ {
+ # man-db RHEL 5 with [aliases]
+ /^[^( \t]+ +\[.*\] +\('$section'\)/ {
split($1, t, " ");
sect = substr(t[3], 2, length(t[3]) - 2);
- print t[2], sect ": " $2;
+ print t[1], sect ": " $2;
+ }
+ # Solaris 11
+ # Does not display descriptions
+ # Solaris apropos outputs embedded backspace in descriptions
+ /^[0-9]+\. [^( \t]*\('$section'\) / {
+ split($1, t, " ")
+ paren = index(t[2], "(");
+ name = substr(t[2], 1, paren - 1);
+ sect = substr(t[2], paren + 1, length(t[2]) - paren - 1);
+ print name, sect
}
'
end