summaryrefslogtreecommitdiff
path: root/completions/man
diff options
context:
space:
mode:
authorDavid Paleino <dapal@debian.org>2012-06-17 20:09:53 +0200
committerDavid Paleino <dapal@debian.org>2012-06-17 20:09:53 +0200
commit30649a02707d24744853f84946f744fdcf7c2757 (patch)
tree97d1a69318079910c4bdc1bbed8a2ba2f58aea7f /completions/man
parentc3d398fcc6e400be546c28eb1fc25abfa5816eac (diff)
downloadbash-completion-30649a02707d24744853f84946f744fdcf7c2757.tar.gz
Imported Upstream version 2.0upstream/2.0
Diffstat (limited to 'completions/man')
-rw-r--r--completions/man11
1 files changed, 5 insertions, 6 deletions
diff --git a/completions/man b/completions/man
index a9de57c4..0c3769d5 100644
--- a/completions/man
+++ b/completions/man
@@ -8,10 +8,10 @@ _man()
local cur prev words cword split
_init_completion -s -n : || return
- local i sect manpath manext mansect uname
+ local sect manpath manext mansect
- manext="@([0-9lnp]|[0-9][px]|man|3pm)?(.@([gx]z|bz2|lzma|Z))"
- mansect="@([0-9lnp]|[0-9][px]|3pm)"
+ manext="@([0-9lnp]|[0-9][px]|man|3?(gl|pm))?(.@([gx]z|bz2|lzma|Z))"
+ mansect="@([0-9lnp]|[0-9][px]|3?(gl|pm))"
case $prev in
-C|--config-file)
@@ -56,8 +56,7 @@ _man()
return 0
fi
- uname=$( uname -s )
- if [[ $uname == @(Linux|GNU|GNU/*|FreeBSD|Cygwin|CYGWIN_*) ]]; then
+ if [[ $OSTYPE == *@(darwin|linux|freebsd|cygwin)* ]] || _userland GNU; then
manpath=$( manpath 2>/dev/null || command man --path )
else
manpath=$MANPATH
@@ -89,7 +88,7 @@ _man()
if [[ "$prev" != $mansect ]]; then
# File based completion for the rest, prepending ./ if needed
# (man 1.6f needs that for man pages in current dir)
- local start=${#COMPREPLY[@]}
+ local i start=${#COMPREPLY[@]}
_filedir $manext
for (( i=$start; i < ${#COMPREPLY[@]}; i++ )); do
[[ ${COMPREPLY[i]} == */* ]] || COMPREPLY[i]=./${COMPREPLY[i]}