Server IP : 184.154.167.98 / Your IP : 3.138.137.150 Web Server : Apache System : Linux pink.dnsnetservice.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64 User : puertode ( 1767) PHP Version : 8.2.26 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/share/bash-completion/completions/ |
Upload File : |
# man(1) completion -*- shell-script -*- _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 # file based completion if parameter looks like a path if [[ "$cur" == @(*/|[.~])* ]]; then _filedir "$manext" return fi local manpath=$( manpath 2>/dev/null || command man -w 2>/dev/null ) [[ -z $manpath ]] && manpath="/usr/share/man:/usr/local/share/man" # 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" } && complete -F _man man apropos whatis # ex: filetype=sh