Apache/2.4.7 (Ubuntu) Linux sman1baleendah 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) safemode : OFF MySQL: ON | Perl: ON | cURL: OFF | WGet: ON > / usr / share / bash-completion / completions / | server ip : 104.21.89.46 your ip : 172.69.214.172 H O M E |
Filename | /usr/share/bash-completion/completions/whatis |
Size | 2.94 kb |
Permission | rw-r--r-- |
Owner | root : root |
Create time | 27-Apr-2025 09:54 |
Last modified | 07-Apr-2014 22:10 |
Last accessed | 05-Jul-2025 20:47 |
Actions | edit | rename | delete | download (gzip) |
View | text | code | image |
# man(1) completion -*- shell-script -*-
[[ $OSTYPE == *@(darwin|freebsd|solaris|cygwin|openbsd)* ]] || _userland GNU \
|| return 1
_man()
{
local cur prev words cword split
_init_completion -s -n : || return
local comprsuffix=".@([glx]z|bz2|lzma|Z)"
local manext="@([0-9lnp]|[0-9][px]|man|3?(gl|pm))?($comprsuffix)"
local mansect="@([0-9lnp]|[0-9][px]|3?(gl|pm))"
case $prev in
-C|--config-file)
_filedir conf
return
;;
-l|--local-file)
_filedir "$manext"
return
;;
-M|--manpath)
_filedir -d
return
;;
-P|--pager)
compopt -o filenames
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
$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 looks like a path
if [[ "$cur" == @(*/|[.~])* ]]; then
_filedir "$manext"
return 0
fi
local manpath
if [[ $OSTYPE == *@(darwin|linux|freebsd|cygwin)* ]] || _userland GNU; then
manpath=$( manpath 2>/dev/null || command man --path )
else
manpath=$MANPATH
fi
if [[ -z $manpath ]]; then
COMPREPLY=( $( compgen -c -- "$cur" ) )
return 0
fi
# determine manual section to search
local sect
[[ "$prev" == $mansect ]] && sect=$prev || sect='*'
manpath=$manpath:
if [[ -n $cur ]]; then
manpath="${manpath//://*man$sect/$cur* } ${manpath//://*cat$sect/$cur* }"
else
manpath="${manpath//://*man$sect/ } ${manpath//://*cat$sect/ }"
fi
# redirect stderr for when path doesn't exist
COMPREPLY=( $( eval command ls "$manpath" 2>/dev/null ) )
# weed out directory path names and paths to man pages
COMPREPLY=( ${COMPREPLY[@]##*/?(:)} )
# strip suffix from man pages
COMPREPLY=( ${COMPREPLY[@]%$comprsuffix} )
COMPREPLY=( $( compgen -W '${COMPREPLY[@]%.*}' -- "${cur//\\\\/}" ) )
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 i start=${#COMPREPLY[@]}
_filedir "$manext"
for (( i=$start; i < ${#COMPREPLY[@]}; i++ )); do
[[ ${COMPREPLY[i]} == */* ]] || COMPREPLY[i]=./${COMPREPLY[i]}
done
fi
__ltrim_colon_completions "$cur"
return 0
} &&
complete -F _man man apropos whatis
# ex: ts=4 sw=4 et filetype=sh
[[ $OSTYPE == *@(darwin|freebsd|solaris|cygwin|openbsd)* ]] || _userland GNU \
|| return 1
_man()
{
local cur prev words cword split
_init_completion -s -n : || return
local comprsuffix=".@([glx]z|bz2|lzma|Z)"
local manext="@([0-9lnp]|[0-9][px]|man|3?(gl|pm))?($comprsuffix)"
local mansect="@([0-9lnp]|[0-9][px]|3?(gl|pm))"
case $prev in
-C|--config-file)
_filedir conf
return
;;
-l|--local-file)
_filedir "$manext"
return
;;
-M|--manpath)
_filedir -d
return
;;
-P|--pager)
compopt -o filenames
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
$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 looks like a path
if [[ "$cur" == @(*/|[.~])* ]]; then
_filedir "$manext"
return 0
fi
local manpath
if [[ $OSTYPE == *@(darwin|linux|freebsd|cygwin)* ]] || _userland GNU; then
manpath=$( manpath 2>/dev/null || command man --path )
else
manpath=$MANPATH
fi
if [[ -z $manpath ]]; then
COMPREPLY=( $( compgen -c -- "$cur" ) )
return 0
fi
# determine manual section to search
local sect
[[ "$prev" == $mansect ]] && sect=$prev || sect='*'
manpath=$manpath:
if [[ -n $cur ]]; then
manpath="${manpath//://*man$sect/$cur* } ${manpath//://*cat$sect/$cur* }"
else
manpath="${manpath//://*man$sect/ } ${manpath//://*cat$sect/ }"
fi
# redirect stderr for when path doesn't exist
COMPREPLY=( $( eval command ls "$manpath" 2>/dev/null ) )
# weed out directory path names and paths to man pages
COMPREPLY=( ${COMPREPLY[@]##*/?(:)} )
# strip suffix from man pages
COMPREPLY=( ${COMPREPLY[@]%$comprsuffix} )
COMPREPLY=( $( compgen -W '${COMPREPLY[@]%.*}' -- "${cur//\\\\/}" ) )
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 i start=${#COMPREPLY[@]}
_filedir "$manext"
for (( i=$start; i < ${#COMPREPLY[@]}; i++ )); do
[[ ${COMPREPLY[i]} == */* ]] || COMPREPLY[i]=./${COMPREPLY[i]}
done
fi
__ltrim_colon_completions "$cur"
return 0
} &&
complete -F _man man apropos whatis
# ex: ts=4 sw=4 et filetype=sh