diff options
author | David Paleino <dapal@debian.org> | 2011-11-03 12:32:52 +0100 |
---|---|---|
committer | David Paleino <dapal@debian.org> | 2011-11-03 12:32:52 +0100 |
commit | 2c8171c38d87ddef31c92a76547d3fdf773a1337 (patch) | |
tree | 5e720d5a06ead72ed55454bf6647a712a761ed91 /completions/man | |
parent | 9920a8faedf704420571d8072ccab27e9dac40ba (diff) | |
download | bash-completion-2c8171c38d87ddef31c92a76547d3fdf773a1337.tar.gz |
Imported Upstream version 1.90upstream/1.90
Diffstat (limited to 'completions/man')
-rw-r--r-- | completions/man | 60 |
1 files changed, 42 insertions, 18 deletions
diff --git a/completions/man b/completions/man index 9e5cd3a8..5c134d33 100644 --- a/completions/man +++ b/completions/man @@ -1,27 +1,57 @@ -# man(1) completion +# man(1) completion -*- shell-script -*- + +[[ $OSTYPE == *@(darwin|freebsd|solaris|cygwin|openbsd)* ]] || _userland GNU \ + || return 1 -[ $USERLAND = GNU -o $UNAME = Darwin \ - -o $UNAME = FreeBSD -o $UNAME = SunOS -o $UNAME = Cygwin \ - -o $UNAME = OpenBSD ] && _man() { - local cur i prev sect manpath manext mansect uname + local cur prev words cword split + _init_completion -s -n : || return + + local i sect manpath manext mansect uname manext="@([0-9lnp]|[0-9][px]|man|3pm)?(.@([gx]z|bz2|lzma|Z))" mansect="@([0-9lnp]|[0-9][px]|3pm)" - COMPREPLY=() - _get_comp_words_by_ref -n : cur prev + case $prev in + -C|--config-file) + _filedir conf + return + ;; + -l|--local-file) + _filedir $manext + return + ;; + -M|--manpath) + _filedir -d + return + ;; + -P|--pager) + COMPREPLY=( $( compgen -c -- "$cur" ) ) + return + ;; + -p|--preprocessor) + COMPREPLY=( $( compgen -W 'e p t g r v' -- "$cur" ) ) + return + ;; + -L|--locale|-m|--systems|-e|--extension|-r|--prompt|-R|--recode|\ + -E|--encoding) + return + ;; + esac - if [[ "$prev" == -l ]]; then - _filedir $manext - return 0 + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" -h )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + return fi _expand || return 0 - # file based completion if parameter contains / - if [[ "$cur" == */* ]]; then + # file based completion if parameter looks like a path + if [[ "$cur" == @(*/|[.~])* ]]; then _filedir $manext return 0 fi @@ -71,10 +101,4 @@ _man() } && complete -F _man man apropos whatis -# Local variables: -# mode: shell-script -# sh-basic-offset: 4 -# sh-indent-comment: t -# indent-tabs-mode: nil -# End: # ex: ts=4 sw=4 et filetype=sh |