BASH=/bin/bash BASH_ARGC=() BASH_ARGV=() BASH_COMPLETION=/etc/bash_completion BASH_COMPLETION_COMPAT_DIR=/etc/bash_completion.d BASH_COMPLETION_DIR=/etc/bash_completion.d BASH_LINENO=() BASH_SOURCE=() BASH_VERSINFO=([0]="3" [1]="2" [2]="25" [3]="1" [4]="release" [5]="x86_64-redhat-linux-gnu") BASH_VERSION='3.2.25(1)-release' COLORS=/etc/DIR_COLORS.xterm COLUMNS=80 CVS_RSH=ssh DIRSTACK=() EUID=0 GROUPS=() G_BROKEN_FILENAMES=1 HISTFILE=/root/.bash_history HISTFILESIZE=1000 HISTSIZE=1000 HOME=/root HOSTNAME=bitfighter HOSTTYPE=x86_64 IFS=$' \t\n' INPUTRC=/etc/inputrc LANG=en_US.UTF-8 LESSOPEN='|/usr/bin/lesspipe.sh %s' LINES=24 LOGNAME=root LS_COLORS='no=00:fi=00:di=00;34:ln=00;36:pi=40;33:so=00;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:ex=00;32:*.cmd=00;32:*.exe=00;32:*.com=00;32:*.btm=00;32:*.bat=00;32:*.sh=00;32:*.csh=00;32:*.tar=00;31:*.tgz=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.zip=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.bz=00;31:*.tz=00;31:*.rpm=00;31:*.cpio=00;31:*.jpg=00;35:*.gif=00;35:*.bmp=00;35:*.xbm=00;35:*.xpm=00;35:*.png=00;35:*.tif=00;35:' MACHTYPE=x86_64-redhat-linux-gnu MAIL=/var/spool/mail/root MAILCHECK=60 OLDPWD=/ OPTERR=1 OPTIND=1 OSTYPE=linux-gnu PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin PIPESTATUS=([0]="0") PPID=22145 PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}"; echo -ne "\007"' PS1='[\u@\h \W]\$ ' PS2='> ' PS4='+ ' PWD=/root SHELL=/bin/bash SHELLOPTS=braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor SHLVL=1 SSH_CLIENT='96.2.123.136 31222 22' SSH_CONNECTION='96.2.123.136 31222 208.115.198.220 22' SSH_TTY=/dev/pts/0 TERM=xterm UID=0 USER=root _=/root _scp_path_esc='[][(){}<>",:;^&!$=?`|\\'\''[:space:]]' consoletype=pty tmpid=0 __expand_tilde_by_ref () { if [ "${!1:0:1}" = "~" ]; then if [ "${!1}" != "${!1//\/}" ]; then eval $1="${!1/%\/*}"/'${!1#*/}'; else eval $1="${!1}"; fi; fi } __get_cword_at_cursor_by_ref () { local cword words=(); __reassemble_comp_words_by_ref "$1" words cword; local i cur2; local cur="$COMP_LINE"; local index="$COMP_POINT"; for ((i = 0; i <= cword; ++i )) do while [[ "${#cur}" -ge ${#words[i]} && "${cur:0:${#words[i]}}" != "${words[i]}" ]]; do cur="${cur:1}"; ((index--)); done; if [[ "$i" -lt "$cword" ]]; then local old_size="${#cur}"; cur="${cur#${words[i]}}"; local new_size="${#cur}"; index=$(( index - old_size + new_size )); fi; done; if [[ "${words[cword]:0:${#cur}}" != "$cur" ]]; then cur2=${words[cword]}; else cur2=${cur:0:$index}; fi; local "$2" "$3" "$4" && _upvars -a${#words[@]} $2 "${words[@]}" -v $3 "$cword" -v $4 "$cur2" } __linux_fstab_unescape () { eval $1="'${!1//\'/\047}'"; eval $1="'${!1/%\\/\\\\}'"; eval "$1=$'${!1}'" } __ltrim_colon_completions () { if [[ "$1" == *:* && ( ${BASH_VERSINFO[0]} -lt 4 || ( ${BASH_VERSINFO[0]} -ge 4 && "$COMP_WORDBREAKS" == *:* ) ) ]]; then local colon_word=${1%${1##*:}}; local i=${#COMPREPLY[*]}; while [ $((--i)) -ge 0 ]; do COMPREPLY[$i]=${COMPREPLY[$i]#"$colon_word"}; done; fi } __reassemble_comp_words_by_ref () { local exclude i j ref; if [[ -n $1 ]]; then exclude="${1//[^$COMP_WORDBREAKS]}"; fi; eval $3=$COMP_CWORD; if [[ -n $exclude ]]; then for ((i=0, j=0; i < ${#COMP_WORDS[@]}; i++, j++)) do while [[ $i -gt 0 && -n ${COMP_WORDS[$i]} && ${COMP_WORDS[$i]//[^$exclude]} == ${COMP_WORDS[$i]} ]]; do [ $j -ge 2 ] && ((j--)); ref="$2[$j]"; eval $2[$j]=\${!ref}\${COMP_WORDS[i]}; [ $i = $COMP_CWORD ] && eval $3=$j; (( $i < ${#COMP_WORDS[@]} - 1)) && ((i++)) || break 2; done; ref="$2[$j]"; eval $2[$j]=\${!ref}\${COMP_WORDS[i]}; [[ $i == $COMP_CWORD ]] && eval $3=$j; done; else eval $2=\( \"\${COMP_WORDS[@]}\" \); fi } _aclocal () { COMPREPLY=(); local cur prev split=false; _get_comp_words_by_ref cur prev; _split_longopt && split=true; case "$prev" in --help | --print-ac-dir | --version) return 0 ;; --acdir | -I) _filedir -d; return 0 ;; --output) _filedir; return 0 ;; --warnings | -W) local cats=(syntax unsupported); COMPREPLY=($( compgen -W '${cats[@]} ${cats[@]/#/no-} all none error' -- "$cur" )); return 0 ;; esac; $split && return 0; _longopt $1 } _alias () { local cur; COMPREPLY=(); _get_comp_words_by_ref cur; case $COMP_LINE in *[^=]) COMPREPLY=($( compgen -A alias -- "$cur" )) ;; *=) COMPREPLY=("$( alias ${cur%=} 2>/dev/null | sed -e 's|^alias '"$cur"'\(.*\)$|\1|' )") ;; esac } _allowed_groups () { if _complete_as_root; then local IFS=' '; COMPREPLY=($( compgen -g -- "$1" )); else local IFS=' '; COMPREPLY=($( compgen -W "$( id -Gn 2>/dev/null || groups 2>/dev/null )" -- "$1" )); fi } _allowed_users () { if _complete_as_root; then local IFS=' '; COMPREPLY=($( compgen -u -- "${1:-$cur}" )); else local IFS=' '; COMPREPLY=($( compgen -W "$( id -un 2>/dev/null || whoami 2>/dev/null )" -- "${1:-$cur}" )); fi } _args () { args=0; if [[ "${COMP_WORDS[0]}" == lvm ]]; then offset=2; else offset=1; fi; for ((i=$offset; i < COMP_CWORD; i++ )) do if [[ "${COMP_WORDS[i]}" != -* ]]; then args=$(($args + 1)); fi; done } _aspell () { local cur prev split=false; COMPREPLY=(); _get_comp_words_by_ref cur prev; _split_longopt && split=true; case $prev in -c | -p | check | --conf | --personal | --repl | --per-conf) _filedir; return 0 ;; --conf-dir | --data-dir | --dict-dir | --home-dir | --local-data-dir | --prefix) _filedir -d; return 0 ;; dump | create | merge) COMPREPLY=($( compgen -W 'master personal repl' -- "$cur" )); return 0 ;; --mode) COMPREPLY=($( compgen -W 'none url email sgml tex' -- "$cur" )); return 0 ;; --sug-mode) COMPREPLY=($( compgen -W 'ultra fast normal bad-speller' -- "$cur" )); return 0 ;; --keymapping) COMPREPLY=($( compgen -W 'aspell ispell' -- "$cur" )); return 0 ;; -d | --master) _aspell_dictionary; return 0 ;; esac; $split && return 0; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--conf --conf-dir --data-dir --dict-dir \ --encoding --add-filter --rem-filter --mode \ --add-extra-dicts --rem-extra-dicts \ --home-dir --ignore --ignore-accents \ --dont-ignore-accents --ignore-case --dont-ignore-case \ --ignore-repl --dont-ignore-repl --jargon --keyboard \ --lang --language-tag --local-data-dir --master \ --module --add-module-search-order \ --rem-module-search-order --per-conf --personal \ --prefix --repl --run-together --dont-run-together \ --run-together-limit --run-together-min --save-repl \ --dont-save-repl --set-prefix --dont-set-prefix --size \ --spelling --strip-accents --dont-strip-accents \ --sug-mode --add-word-list-path --rem-word-list-path \ --backup --dont-backup --reverse --dont-reverse \ --time --dont-time --keymapping --add-email-quote \ --rem-email-quote --email-margin --add-tex-command \ --rem-tex-command --tex-check-comments \ --dont-tex-check-comments --add-tex-extension \ --rem-tex-extension --add-sgml-check --rem-sgml-check \ --add-sgml-extension --rem-sgml-extension' -- "$cur" )); else COMPREPLY=($( compgen -W 'usage help check pipe list \ config soundslike filter version dump create merge' -- "$cur" )); fi } _aspell_dictionary () { local datadir; datadir=$( aspell config data-dir 2>/dev/null || echo /usr/lib/aspell ); COMPREPLY=($( command ls $datadir/*.alias 2>/dev/null )); COMPREPLY=(${COMPREPLY[@]%.alias}); COMPREPLY=(${COMPREPLY[@]#$datadir/}); COMPREPLY=("${COMPREPLY[@]}" $( aspell dicts 2>/dev/null )); COMPREPLY=($( compgen -W '${COMPREPLY[@]}' -- "$cur" )) } _autoconf () { COMPREPLY=(); local cur prev split=false; _get_comp_words_by_ref cur prev; _split_longopt && split=true; case "$prev" in --help | -h | --version | -V | --trace | -t) return 0 ;; --output | -o) _filedir; return 0 ;; --warnings | -W) local cats=(cross obsolete syntax); COMPREPLY=($( compgen -W '${cats[@]} ${cats[@]/#/no-} all none error' -- "$cur" )); return 0 ;; --prepend-include | -B | --include | -I) _filedir -d; return 0 ;; esac; $split && return 0; if [[ "$cur" == -* ]]; then _longopt $1; return; fi; _filedir '@(ac|in)' } _automake () { COMPREPLY=(); local cur prev split=false; _get_comp_words_by_ref cur prev; _split_longopt && split=true; case "$prev" in --help | --version) return 0 ;; --warnings | -W) local cats=(gnu obsolete override portability syntax unsupported); COMPREPLY=($( compgen -W '${cats[@]} ${cats[@]/#/no-} all none error' -- "$cur" )); return 0 ;; --libdir) _filedir -d; return 0 ;; esac; $split && return 0; if [[ "$cur" == -* ]]; then _longopt $1; return; fi; _filedir } _autoreconf () { COMPREPLY=(); local cur prev split=false; _get_comp_words_by_ref cur prev; _split_longopt && split=true; case "$prev" in --help | -h | --version | -V) return 0 ;; --warnings | -W) local cats=(cross gnu obsolete override portability syntax unsupported); COMPREPLY=($( compgen -W '${cats[@]} ${cats[@]/#/no-} all none error' -- "$cur" )); return 0 ;; --prepend-include | -B | --include | -I) _filedir -d; return 0 ;; esac; $split && return 0; if [[ "$cur" == -* ]]; then _longopt $1; return 0; fi; if [[ $1 == autoheader ]]; then _filedir '@(ac|in)'; else _filedir -d; fi } _autoscan () { COMPREPLY=(); local cur prev split=false; _get_comp_words_by_ref cur prev; _split_longopt && split=true; case "$prev" in --help | -h | --version | -V) return 0 ;; --prepend-include | -B | --include | -I) _filedir -d; return 0 ;; esac; $split && return 0; if [[ "$cur" == -* ]]; then _longopt $1; return 0; fi; if [[ $1 == autoupdate ]]; then _filedir '@(ac|in)'; else _filedir -d; fi } _available_interfaces () { local cmd; if [ "${1:-}" = -w ]; then cmd="iwconfig"; else if [ "${1:-}" = -a ]; then cmd="ifconfig"; else cmd="ifconfig -a"; fi; fi; COMPREPLY=($( eval PATH="$PATH:/sbin" $cmd 2>/dev/null | awk '/^[^ \t]/ { print $1 }' )); COMPREPLY=($( compgen -W '${COMPREPLY[@]/%[[:punct:]]/}' -- "$cur" )) } _badblocks () { COMPREPLY=(); local cur prev; _get_comp_words_by_ref cur prev; case $prev in -b | -c | -e | -d | -p | -t) return 0 ;; -i | -o) _filedir; return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-b -c -e -d -f -i -n -o -p -s -t -v' -- "$cur" )); return 0; fi; cur=${cur:=/dev/}; _filedir } _bzip2 () { local cur prev xspec helpopts; COMPREPLY=(); _get_comp_words_by_ref cur prev; helpopts=`_parse_help ${COMP_WORDS[0]}`; case $prev in -b | -h | --help | -p) return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W "${helpopts//#/} -2 -3 -4 -5 -6 -7 -8 -9" -- "$cur" )); return 0; fi; local IFS=' '; xspec="*.bz2"; if [[ "$prev" == --* ]]; then [[ "$prev" == --decompress || "$prev" == --list || "$prev" == --test ]] && xspec="!"$xspec; [[ "$prev" == --compress ]] && xspec=; else if [[ "$prev" == -* ]]; then [[ "$prev" == -*[dt]* ]] && xspec="!"$xspec; [[ "$prev" == -*z* ]] && xspec=; fi; fi; _expand || return 0; _compopt_o_filenames; COMPREPLY=($( compgen -f -X "$xspec" -- "$cur" ) $( compgen -d -- "$cur" )) } _bzr_lazy () { unset _bzr; eval "$(bzr bash-completion)"; if [[ $(type -t _bzr) == function ]]; then unset _bzr_lazy; _bzr; return $?; else return 1; fi } _cd () { local cur IFS=' ' i j k; _get_comp_words_by_ref cur; if [[ "$cur" == ?(\\)\$* ]]; then COMPREPLY=($( compgen -v -P '$' -- "${cur#?(\\)$}" )); return 0; fi; _compopt_o_filenames; if [[ -z "${CDPATH:-}" || "$cur" == ?(.)?(.)/* ]]; then _filedir -d; return 0; fi; local -r mark_dirs=$(_rl_enabled mark-directories && echo y); local -r mark_symdirs=$(_rl_enabled mark-symlinked-directories && echo y); for i in ${CDPATH//:/' '}; do k="${#COMPREPLY[@]}"; for j in $( compgen -d $i/$cur ); do if [[ ( -n $mark_symdirs && -h $j || -n $mark_dirs && ! -h $j ) && ! -d ${j#$i/} ]]; then j="${j}/"; fi; COMPREPLY[k++]=${j#$i/}; done; done; _filedir -d; if [[ ${#COMPREPLY[@]} -eq 1 ]]; then i=${COMPREPLY[0]}; if [[ "$i" == "$cur" && $i != "*/" ]]; then COMPREPLY[0]="${i}/"; fi; fi; return 0 } _cd_devices () { COMPREPLY=("${COMPREPLY[@]}" $( compgen -f -d -X "!*/?([amrs])cd*" -- "${cur:-/dev/}" )) } _chage () { local cur prev split=false; COMPREPLY=(); _get_comp_words_by_ref cur prev; _split_longopt && split=true; case $prev in -d | --lastday | -E | --expiredate | -h | --help | -I | --inactive | -m | --mindays | -M | --maxdays | -W | --warndays) return 0 ;; esac; $split && return 0; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--lastday --expiredate --help --inactive \ --list --mindays --maxdays --warndays' -- "$cur" )); return 0; fi; COMPREPLY=($( compgen -u -- "$cur" )) } _chgrp () { local cur prev split=false; COMPREPLY=(); _get_comp_words_by_ref cur prev; cur=${cur//\\\\/}; _split_longopt && split=true; if [[ "$prev" == --reference ]]; then _filedir; return 0; fi; $split && return 0; if [[ "$cur" == -* ]]; then local w opts; for w in "${COMP_WORDS[@]}"; do [[ "$w" == -@(R|-recursive) ]] && opts="-H -L -P" && break; done; COMPREPLY=($( compgen -W '-c -h -f -R -v --changes --dereference \ --no-dereference --silent --quiet --reference --recursive \ --verbose --help --version $opts' -- "$cur" )); return 0; fi; if [[ $COMP_CWORD -eq 1 && "$cur" != -* || "$prev" == -* ]]; then _allowed_groups; else _filedir || return 0; fi; return 0 } _chkconfig () { local cur prev split=false; COMPREPLY=(); _get_comp_words_by_ref cur prev; _split_longopt && split=true; case $prev in --level=[1-6] | [1-6] | --list | --add | --del | --override) _services; return 0 ;; --level) COMPREPLY=($( compgen -W '1 2 3 4 5 6' -- "$cur" )); return 0 ;; esac; $split && return 0; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--list --add --del --override --level' -- "$cur" )); else if [[ $COMP_CWORD -eq 2 || $COMP_CWORD -eq 4 ]]; then COMPREPLY=($( compgen -W 'on off reset resetpriorities' -- "$cur" )); else _services; fi; fi } _chown () { local cur prev split=false; _get_comp_words_by_ref -n : cur prev; _split_longopt && split=true; case "$prev" in --from) _usergroup; return 0 ;; --reference) _filedir; return 0 ;; esac; $split && return 0; if [[ "$cur" == -* ]]; then local w opts; for w in "${COMP_WORDS[@]}"; do [[ "$w" == -@(R|-recursive) ]] && opts="-H -L -P" && break; done; COMPREPLY=($( compgen -W '-c -h -f -R -v --changes --dereference \ --no-dereference --from --silent --quiet --reference --recursive \ --verbose --help --version $opts' -- "$cur" )); else local args; _count_args :; if [[ $args == 1 ]]; then _usergroup -u; else _filedir; fi; fi } _chpasswd () { local cur prev split=false; COMPREPLY=(); _get_comp_words_by_ref cur prev; _split_longopt && split=true; case $prev in -c | --crypt) COMPREPLY=($( compgen -W 'DES MD5 NONE SHA256 SHA512' -- "$cur" )); return 0 ;; -s | --sha-rounds) return 0 ;; esac; $split && return 0; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--crypt-method --encrypted \ --help --md5 --sha-rounds' -- "$cur" )); return 0; fi } _chsh () { local cur prev; COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in --list-shells | --help | -v | --version) return 0 ;; -s | --shell) _shells; return 0 ;; esac; if [[ "$cur" == -* && "$( uname -s )" == @(Linux|GNU|GNU/*) ]]; then COMPREPLY=($( compgen -W '--shell --list-shells --help --version' -- "$cur" )); else COMPREPLY=($( compgen -u -- "$cur" )); fi; return 0 } _command () { local offset i; offset=1; for ((i=1; i <= COMP_CWORD; i++ )) do if [[ "${COMP_WORDS[i]}" != -* ]]; then offset=$i; break; fi; done; _command_offset $offset } _command_offset () { local cur func cline cspec noglob cmd i char_offset word_offset _COMMAND_FUNC _COMMAND_FUNC_ARGS; word_offset=$1; local first_word=${COMP_WORDS[$word_offset]}; for ((i=0; i <= ${#COMP_LINE}; i++ )) do if [[ "${COMP_LINE:$i:${#first_word}}" == "$first_word" ]]; then char_offset=$i; break; fi; done; COMP_LINE=${COMP_LINE:$char_offset}; COMP_POINT=$(( COMP_POINT - $char_offset )); for ((i=0; i <= COMP_CWORD - $word_offset; i++ )) do COMP_WORDS[i]=${COMP_WORDS[i+$word_offset]}; done; for ((i; i <= COMP_CWORD; i++ )) do unset COMP_WORDS[i]; done; COMP_CWORD=$(( $COMP_CWORD - $word_offset )); COMPREPLY=(); _get_comp_words_by_ref cur; if [[ $COMP_CWORD -eq 0 ]]; then _compopt_o_filenames; COMPREPLY=($( compgen -c -- "$cur" )); else cmd=${COMP_WORDS[0]}; if complete -p ${cmd##*/} >&/dev/null; then cspec=$( complete -p ${cmd##*/} ); if [ "${cspec#* -F }" != "$cspec" ]; then func=${cspec#*-F }; func=${func%% *}; if [[ ${#COMP_WORDS[@]} -ge 2 ]]; then $func $cmd "${COMP_WORDS[${#COMP_WORDS[@]}-1]}" "${COMP_WORDS[${#COMP_WORDS[@]}-2]}"; else $func $cmd "${COMP_WORDS[${#COMP_WORDS[@]}-1]}"; fi; if [ "${cspec#*-o }" != "$cspec" ]; then cspec=${cspec#*-o }; cspec=${cspec%% *}; if [[ "$cspec" != @(dir|file)names ]]; then COMPREPLY=("${COMPREPLY[@]//\\\\:/:}"); else _compopt_o_filenames; fi; fi; else if [ -n "$cspec" ]; then cspec=${cspec#complete}; cspec=${cspec%%${cmd##*/}}; COMPREPLY=($( eval compgen "$cspec" -- "$cur" )); fi; fi; else if [ ${#COMPREPLY[@]} -eq 0 ]; then _filedir; fi; fi; fi } _complete () { local cur prev; COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in -o) COMPREPLY=($( compgen -W 'bashdefault default dirnames filenames \ nospace plusdirs' -- "$cur" )); return 0 ;; -A) COMPREPLY=($( compgen -W 'alias arrayvar binding builtin command \ directory disabled enabled export file function group \ helptopic hostname job keyword running service setopt shopt \ signal stopped user variable' -- "$cur" )); return 0 ;; -C) COMPREPLY=($( compgen -A command -- "$cur" )); return 0 ;; -F) COMPREPLY=($( compgen -A function -- "$cur" )); return 0 ;; -p | -r) COMPREPLY=($( complete -p | sed -e 's|.* ||' )); COMPREPLY=($( compgen -W '${COMPREPLY[@]}' -- "$cur" )); return 0 ;; esac; if [[ "$cur" == -* ]]; then local opts="-a -b -c -d -e -f -g -j -k -o -s -u -v -A -G -W -P -S -X"; [[ $1 != compgen ]] && opts="$opts -F -C"; COMPREPLY=($( compgen -W "$opts" -- "$cur" )); else COMPREPLY=($( compgen -A command -- "$cur" )); fi } _complete_as_root () { [[ $EUID -eq 0 || -n ${root_command:-} ]] } _compopt_o_filenames () { type compopt >&/dev/null && compopt -o filenames 2> /dev/null || compgen -f /non-existing-dir/ > /dev/null } _configure () { local cur prev split=false; COMPREPLY=(); _get_comp_words_by_ref cur prev; _split_longopt && split=true; case $prev in --*prefix | --*dir) _filedir -d ;; esac; $split && return 0; [[ "$cur" != -* ]] && return 0; if [ -n "$COMP_CONFIGURE_HINTS" ]; then COMPREPLY=($( compgen -W "$( $1 --help 2>&1 | awk '/^ --[A-Za-z]/ { print $1; \ if ($2 ~ /--[A-Za-z]/) print $2 }' | sed -e 's/[[,].*//g' )" -- "$cur" )); else COMPREPLY=($( compgen -W "$( $1 --help 2>&1 | awk '/^ --[A-Za-z]/ { print $1; \ if ($2 ~ /--[A-Za-z]/) print $2 }' | sed -e 's/[[,=].*//g' )" -- "$cur" )); fi } _configured_interfaces () { if [ -f /etc/debian_version ]; then COMPREPLY=($( compgen -W "$( sed -ne 's|^iface \([^ ]\{1,\}\).*$|\1|p' /etc/network/interfaces )" -- "$cur" )); else if [ -f /etc/SuSE-release ]; then COMPREPLY=($( compgen -W "$( printf '%s\n' /etc/sysconfig/network/ifcfg-* | sed -ne 's|.*ifcfg-\(.*\)|\1|p' )" -- "$cur" )); else if [ -f /etc/pld-release ]; then COMPREPLY=($( compgen -W "$( command ls -B /etc/sysconfig/interfaces | sed -ne 's|.*ifcfg-\(.*\)|\1|p' )" -- "$cur" )); else COMPREPLY=($( compgen -W "$( printf '%s\n' /etc/sysconfig/network-scripts/ifcfg-* | sed -ne 's|.*ifcfg-\(.*\)|\1|p' )" -- "$cur" )); fi; fi; fi } _count_args () { local i cword words; __reassemble_comp_words_by_ref "$1" words cword; args=1; for i in "${words[@]:1:cword-1}"; do [[ "$i" != -* ]] && args=$(($args+1)); done } _cpio () { local cur prev split=false; COMPREPLY=(); _get_comp_words_by_ref -n : cur prev; _split_longopt && split=true; case $prev in -H | --format) _cpio_format; return 0 ;; -E | -F | -I | --file | --pattern-file) _filedir; return 0 ;; -R | --owner) _usergroup; return 0 ;; --rsh-command) _compopt_o_filenames; COMPREPLY=($( compgen -c -- "$cur" )); return 0 ;; esac; $split && return 0; if [ $COMP_CWORD -eq 1 ]; then COMPREPLY=($( compgen -W '-o --create -i --extract -p --pass-through \ -? --help --license --usage --version' -- "$cur" )); else case ${COMP_WORDS[1]} in -o | --create) if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-0 -a -c -v -A -B\ -L -V -C -H -M -O -F --file --format\ --message --null --reset-access-time\ --verbose --dot --append --block-size\ --dereference --io-size --quiet\ --force-local --rsh-command --help\ --version' -- "$cur" )); fi ;; -i | --extract) if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-b -c -d -f -m -n -r\ -t -s -u -v -B -S -V -C -E -H -M -R -I\ -F --file --make-directories\ --nonmatching\ --preserve-modification-time\ --numeric-uid-gid --rename -t --list\ --swap-bytes --swap --dot\ --unconditional --verbose --block-size\ --swap-halfwords --io-size\ --pattern-file --format --owner\ --no-preserve-owner --message\ --force-local --no-absolute-filenames\ --sparse --only-verify-crc --quiet\ --rsh-command --help\ --to-stdout \ --version' -- "$cur" )); fi ;; -p | --pass-through) if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-0 -a -d -l -m -u -v\ -L -V -R --null --reset-access-time\ --make-directories --link --quiet\ --preserve-modification-time\ --unconditional --verbose --dot\ --dereference --owner\ --no-preserve-owner --sparse --help\ --version' -- "$cur" )); else _filedir -d; fi ;; esac; fi } _cpio_format () { COMPREPLY=($( compgen -W 'bin odc newc crc tar ustar hpbin hpodc' -- "$cur" )) } _crontab () { local cur prev; COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in -u) _allowed_users; return 0 ;; esac; local i opts=" -u -l -r -e"; [ "$(uname -s)" = Linux ] && opts="$opts -i"; [ -e /etc/selinux ] && opts="$opts -s"; for ((i=0; i < ${#COMP_WORDS[@]}-1; i++ )) do case "${COMP_WORDS[i]}" in -l) opts=${opts// -l -r -e/}; opts=${opts// -i/}; opts=${opts// -s/} ;; -e) opts=${opts// -l -r -e/}; opts=${opts// -i/} ;; -r) opts=${opts// -l -r -e/} ;; -u) opts=${opts// -u/}; opts=${opts// -i/} ;; -i | -s) opts=${opts// ${COMP_WORDS[i]}/} ;; esac; done; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '$opts' -- "$cur" )); return 0; fi; [[ "${COMP_LINE}" == *\ -@(l|r|e)* ]] || _filedir } _cryptsetup () { local cur prev arg; COMPREPLY=(); cur=`_get_cword`; prev=`_get_pword`; case $prev in --key-file | --master-key-file | --header-backup-file | -d) _filedir; return 0 ;; esac; _get_first_arg; if [ -z $arg ]; then if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--hash --cipher --verify-passphrase \ --key-file --master-key-file --key-slot --key-size --size \ --offset --skip --readonly --iter-time --batch-mode --timeout \ --tries --align-payload --version' -- "$cur" )); else COMPREPLY=($( compgen -W 'create remove status resize luksFormat \ luksOpen luksClose luksSuspend luksResume luksAddKey \ luksRemoveKey luksKillSlot luksDelKey luksUUID isLuks \ luksDump luksHeaderBackup luksHeaderRestore' -- "$cur" )); fi; else _count_args; case $arg in create) case $args in 2) _cryptsetup_name ;; 3) _cryptsetup_device ;; esac ;; remove | status | resize | luksClose | luksSuspend | luksResume) case $args in 2) _cryptsetup_name ;; esac ;; luksFormat | luksAddKey | luksRemoveKey) case $args in 2) _cryptsetup_device ;; 3) _filedir ;; esac ;; luksOpen) case $args in 2) _cryptsetup_device ;; 3) _cryptsetup_name ;; esac ;; luksKillSlot | luksDelKey | luksUUID | isLuks | luksDump) case $args in 2) _cryptsetup_device ;; esac ;; luksHeaderBackup | luksHeaderRestore) case $args in 2) _cryptsetup_device ;; 3) COMPREPLY=('--header-backup-file') ;; esac ;; esac; fi; return 0 } _cryptsetup_device () { cur=${cur:=/dev/}; _filedir } _cryptsetup_name () { COMPREPLY=($( compgen -X control -W '$( command ls /dev/mapper )' -- "$cur" )) } _cvs () { local cur prev count mode i cvsroot cvsroots pwd; local -a flags miss files entries changed newremoved; COMPREPLY=(); _get_comp_words_by_ref -n : cur prev; count=0; for i in "${COMP_WORDS[@]}"; do [ $count -eq $COMP_CWORD ] && break; if [[ "${COMP_WORDS[((count))]}" == "$cvsroot" && "$mode" == cvsroot ]]; then mode=""; fi; if [ -z "$mode" ]; then case $i in -H | --help) COMPREPLY=($( compgen -W "$( _cvs_commands )" -- "$cur" )); return 0 ;; -d) mode=cvsroot; cvsroot=${COMP_WORDS[((count+1))]} ;; ad | add | new) mode=add ;; adm | admin | rcs) mode=admin ;; ann | annotate) mode=annotate ;; checkout | co | get) mode=checkout ;; com | commit | ci) mode=commit ;; di | dif | diff) mode=diff ;; ex | exp | export) mode=export ;; edit | unedit) mode=$i ;; hi | his | history) mode=history ;; im | imp | import) mode=import ;; re | rel | release) mode=release ;; log | rlog) mode=log ;; rdiff | patch) mode=rdiff ;; remove | rm | delete) mode=remove ;; rtag | rfreeze) mode=rtag ;; st | stat | status) mode=status ;; tag | freeze) mode=tag ;; up | upd | update) mode=update ;; esac; else if [[ "$i" = -* ]]; then flags=("${flags[@]}" $i); fi; fi; count=$((++count)); done; case $mode in add) case $prev in -m) return 0 ;; -k) _cvs_kflags; return 0 ;; esac; if [[ "$cur" != -* ]]; then set_prefix; if [[ $COMP_CWORD -gt 1 && -r ${prefix:-}CVS/Entries ]]; then get_entries; [ -z "$cur" ] && files=$( command ls -Ad !(CVS) ) || files=$( command ls -d ${cur}* 2>/dev/null ); for i in "${entries[@]}"; do files=(${files[@]/#$i//}); done; COMPREPLY=($( compgen -X '*~' -W '${files[@]}' -- $cur )); fi; else COMPREPLY=($( compgen -W "$( _cvs_command_options $mode )" -- "$cur" )); fi ;; admin) case $prev in -a | -A | -b | -c | -e | -l | -m | -n | -N | -o | -s | -t- | -u) return 0 ;; -t) _filedir; return 0 ;; -k) _cvs_kflags; return 0 ;; esac; if [[ "$cur" = -* ]]; then COMPREPLY=($( compgen -W "$( _cvs_command_options $mode )" -- "$cur" )); fi ;; annotate) [[ "$prev" == -@(r|D) ]] && return 0; if [[ "$cur" = -* ]]; then COMPREPLY=($( compgen -W "$( _cvs_command_options $mode )" -- "$cur" )); else get_entries; COMPREPLY=($( compgen -W '${entries[@]}' -- "$cur" )); fi ;; checkout) case $prev in -r | -D | j) return 0 ;; -d) _filedir -d; return 0 ;; -k) _cvs_kflags; return 0 ;; esac; if [[ "$cur" != -* ]]; then [ -z "$cvsroot" ] && cvsroot=$CVSROOT; COMPREPLY=($( cvs -d "$cvsroot" co -c 2> /dev/null | awk '{print $1}' )); COMPREPLY=($( compgen -W '${COMPREPLY[@]}' -- "$cur" )); else COMPREPLY=($( compgen -W "$( _cvs_command_options $mode )" -- "$cur" )); fi ;; commit) case $prev in -m | -r) return 0 ;; -F) _filedir; return 0 ;; esac; set_prefix; if [[ "$cur" != -* && -r ${prefix:-}CVS/Entries ]]; then if [ -n "${COMP_CVS_REMOTE:-}" ]; then changed=($( cvs -q diff --brief 2>&1 | sed -ne 's/^Files [^ ]* and \([^ ]*\) differ$/\1/p' )); newremoved=($( cvs -q diff --brief 2>&1 | sed -ne 's/^cvs diff: \([^ ]*\) .*, no comparison available$/\1/p' )); COMPREPLY=($( compgen -W '${changed[@]:-} \ ${newremoved[@]:-}' -- "$cur" )); else COMPREPLY=($(compgen -o default -- "$cur")); fi; else COMPREPLY=($( compgen -W "$( _cvs_command_options $mode )" -- "$cur" )); fi ;; cvsroot) _cvs_roots ;; export) case $prev in -r | -D) return 0 ;; -d) _filedir -d; return 0 ;; -k) _cvs_kflags; return 0 ;; esac; if [[ "$cur" != -* ]]; then [ -z "$cvsroot" ] && cvsroot=$CVSROOT; COMPREPLY=($( cvs -d "$cvsroot" co -c | awk '{print $1}' )); COMPREPLY=($( compgen -W '${COMPREPLY[@]}' -- "$cur" )); else COMPREPLY=($( compgen -W "$( _cvs_command_options $mode )" -- "$cur" )); fi ;; diff) if [[ "$cur" == -* ]]; then _longopt diff; else get_entries; COMPREPLY=($( compgen -W '${entries[@]:-}' -- "$cur" )); fi ;; remove) if [[ "$cur" != -* ]]; then set_prefix; if [[ $COMP_CWORD -gt 1 && -r ${prefix:-}CVS/Entries ]]; then get_entries; for i in "${entries[@]}"; do [ ! -r "$i" ] && miss=("${miss[@]}" $i); done; COMPREPLY=($(compgen -W '${miss[@]:-}' -- "$cur")); fi; else COMPREPLY=($( compgen -W "$( _cvs_command_options $mode )" -- "$cur" )); fi ;; import) case $prev in -I | -b | -m | -W) return 0 ;; -k) _cvs_kflags; return 0 ;; esac; if [[ "$cur" != -* ]]; then [ -z "$cvsroot" ] && cvsroot=$CVSROOT; prefix=${cur%/*}; if [ -r ${cvsroot}/${prefix} ]; then get_modules; COMPREPLY=(${COMPREPLY[@]#$cvsroot}); COMPREPLY=(${COMPREPLY[@]#\/}); fi; pwd=$( pwd ); pwd=${pwd##*/}; COMPREPLY=($( compgen -W '${COMPREPLY[@]} $pwd' -- $cur )); else COMPREPLY=($( compgen -W "$( _cvs_command_options $mode )" -- "$cur" )); fi ;; update) case $prev in -r | -D | -j | -I | -W) return 0 ;; -k) _cvs_kflags; return 0 ;; esac; if [[ "$cur" = -* ]]; then COMPREPLY=($( compgen -W "$( _cvs_command_options $mode )" -- "$cur" )); fi ;; "") case $prev in -T) _filedir -d; return 0 ;; -e | -s) return 0 ;; -z) COMPREPLY=($( compgen -W '1 2 3 4 5 6 7 8 9' -- "$cur" )); return 0 ;; esac; COMPREPLY=($( compgen -W '$( _cvs_commands ) $( _cvs_options ) \ --help --help-commands --help-options --version' -- "$cur" )) ;; esac; return 0 } _cvs_command_options () { cvs --help $1 2>&1 | sed -ne 's/^[[:space:]]*\(-[^[:space:]=[]*\).*/\1/p' } _cvs_commands () { cvs --help-commands 2>&1 | awk '/^( *|\t)/ { print $1 }' } _cvs_kflags () { COMPREPLY=($( compgen -W 'kv kvl k o b v' -- "$cur" )) } _cvs_options () { cvs --help-options 2>&1 | awk '/^( *|\t)-/ { print $1 }' } _cvs_roots () { local -a cvsroots; cvsroots=($CVSROOT); [ -r ~/.cvspass ] && cvsroots=("${cvsroots[@]}" $( awk '{ print $2 }' ~/.cvspass )); [ -r CVS/Root ] && cvsroots=("${cvsroots[@]}" $(cat CVS/Root)); COMPREPLY=($( compgen -W '${cvsroots[@]}' -- "$cur" )); __ltrim_colon_completions "$cur" } _dd () { local cur; COMPREPLY=(); _get_comp_words_by_ref -n = cur; case $cur in if=* | of=*) cur=${cur#*=}; _filedir; return 0 ;; conv=*) cur=${cur#*=}; COMPREPLY=($( compgen -W 'ascii ebcdic ibm block unblock lcase notrunc ucase swab noerror sync' -- "$cur" )); return 0 ;; esac; _expand || return 0; COMPREPLY=($( compgen -W '--help --version' -- "$cur" ) $( compgen -W 'bs cbs conv count ibs if obs of seek skip' -S '=' -- "$cur" )) } _dhclient () { local cur prev; COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in -cf | -lf | -pf | -sf) _filedir; return 0 ;; -s) _known_hosts_real "$cur"; return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-p -d -q -1 -r -lf -pf \ -cf -sf -s -g -n -nw -w' -- "$cur" )); else _available_interfaces; fi } _dumpe2fs () { COMPREPLY=(); local cur prev; _get_comp_words_by_ref cur prev; case $prev in -o | -V) return 0 ;; -i) _filedir; return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-b -o -f -h -i -x -V' -- "$cur" )); return 0; fi; cur=${cur:=/dev/}; _filedir } _dvd_devices () { COMPREPLY=("${COMPREPLY[@]}" $( compgen -f -d -X "!*/?(r)dvd*" -- "${cur:-/dev/}" )) } _e2freefrag () { COMPREPLY=(); local cur prev; _get_comp_words_by_ref cur prev; case $prev in -c | -h) return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-c -h' -- "$cur" )); return 0; fi; cur=${cur:=/dev/}; _filedir } _e2label () { COMPREPLY=(); local cur cword; _get_comp_words_by_ref cur cword; if [ $cword -eq 1 ]; then cur=${cur:=/dev/}; _filedir; fi } _edquota () { local cur prev split=false; COMPREPLY=(); _get_comp_words_by_ref cur prev; _split_longopt && split=true; case $prev in -F | --format) _quota_formats; return 0 ;; -f | --filesystem) _filesystems; return 0 ;; esac; $split && return 0; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-r --remote -m --no-mixed-pathnames \ -g --group -u --user -p --prototype -F --format -f --filesystem \ -t --edit-period -T --edit-times' -- "$cur" )); else _user_or_group; fi } _ether_wake () { COMPREPLY=(); local cur prev; _get_comp_words_by_ref -n : cur prev; case $prev in -i) _available_interfaces; return 0 ;; -p) return 0 ;; esac; if [[ $cur == -* ]]; then COMPREPLY=($( compgen -W '-b -D -i -p -V' -- "$cur" )); return 0; fi; _mac_addresses } _expand () { if [[ "$cur" == \~*/* ]]; then eval cur=$cur; else if [[ "$cur" == \~* ]]; then cur=${cur#\~}; COMPREPLY=($( compgen -P '~' -u "$cur" )); [ ${#COMPREPLY[@]} -eq 1 ] && eval COMPREPLY[0]=${COMPREPLY[0]}; return ${#COMPREPLY[@]}; fi; fi } _export () { local cur; COMPREPLY=(); _get_comp_words_by_ref cur; case $COMP_LINE in *=\$*) COMPREPLY=($( compgen -v -P '$' -- "${cur#*=\$}" )) ;; *[^=]) COMPREPLY=($( compgen -v -S '=' -- "$cur" )) ;; *=) COMPREPLY=("$( eval echo -n \"$`echo ${cur%=}`\" | ( echo -n \' sed -e 's/'\''/'\''\\\'\'''\''/g' echo -n \' ) )") ;; esac } _faillog () { local cur prev split=false; COMPREPLY=(); _get_comp_words_by_ref cur prev; _split_longopt && split=true; case $prev in -h | --help | -l | --lock-time | -m | --maximum | -t | --time) return 0 ;; -u | --user) COMPREPLY=($( compgen -u -- "$cur" )); return 0 ;; esac; $split && return 0; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--all --help --lock-time \ --maximum --reset --time --user' -- "$cur" )); return 0; fi } _filedir () { local i IFS=' ' xspec; _tilde "$cur" || return 0; local -a toks; local quoted tmp; _quote_readline_by_ref "$cur" quoted; toks=(${toks[@]-} $( compgen -d -- "$quoted" | { while read -r tmp; do printf '%s\n' $tmp done } )); if [[ "$1" != -d ]]; then [[ ${BASH_VERSINFO[0]} -ge 4 ]] && xspec=${1:+"!*.@($1|${1^^})"} || xspec=${1:+"!*.@($1|$(printf %s $1 | tr '[:lower:]' '[:upper:]'))"}; toks=(${toks[@]-} $( compgen -f -X "$xspec" -- $quoted)); fi; [ ${#toks[@]} -ne 0 ] && _compopt_o_filenames; COMPREPLY=("${COMPREPLY[@]}" "${toks[@]}") } _filedir_xspec () { local IFS cur xspec; IFS=' '; COMPREPLY=(); _get_comp_words_by_ref cur; _expand || return 0; xspec=$( awk "/^complete[ \t]+.*[ \t]${1##*/}([ \t]|\$)/ { print \$0; exit }" "$BASH_COMPLETION" ); xspec=${xspec#*-X }; xspec=${xspec%% *}; local -a toks; local tmp; toks=(${toks[@]-} $( compgen -d -- "$(quote_readline "$cur")" | { while read -r tmp; do # see long TODO comment in _filedir() --David printf '%s\n' $tmp done } )); eval xspec="${xspec}"; local matchop=!; if [[ $xspec == !* ]]; then xspec=${xspec#!}; matchop=@; fi; [[ ${BASH_VERSINFO[0]} -ge 4 ]] && xspec="$matchop($xspec|${xspec^^})" || xspec="$matchop($xspec|$(printf %s $xspec | tr '[:lower:]' '[:upper:]'))"; toks=(${toks[@]-} $( eval compgen -f -X "!$xspec" -- "\$(quote_readline "\$cur")" | { while read -r tmp; do [ -n $tmp ] && printf '%s\n' $tmp done } )); [ ${#toks[@]} -ne 0 ] && _compopt_o_filenames; COMPREPLY=("${toks[@]}") } _filefrag () { COMPREPLY=(); local cur; _get_comp_words_by_ref cur; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-B -b -s -v -x' -- "$cur" )); return 0; fi; _filedir } _filesystems () { COMPREPLY=($( compgen -W "$(awk '/^\// {print $1}' /etc/mtab)" -- "$cur" )) } _find () { local cur prev i exprfound onlyonce; COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in -maxdepth | -mindepth) COMPREPLY=($( compgen -W '0 1 2 3 4 5 6 7 8 9' -- "$cur" )); return 0 ;; -newer | -anewer | -cnewer | -fls | -fprint | -fprint0 | -fprintf | -name | -iname | -lname | -ilname | -wholename | -iwholename | -samefile) _filedir; return 0 ;; -fstype) _fstypes; if [[ "$( uname -s )" == *BSD ]]; then COMPREPLY=("${COMPREPLY[@]}" $( compgen -W 'local rdonly' -- "$cur" )); fi; return 0 ;; -gid) _gids; return 0 ;; -group) COMPREPLY=($( compgen -g -- "$cur" 2>/dev/null)); return 0 ;; -xtype | -type) COMPREPLY=($( compgen -W 'b c d p f l s' -- "$cur" )); return 0 ;; -uid) _uids; return 0 ;; -user) COMPREPLY=($( compgen -u -- "$cur" )); return 0 ;; -exec | -execdir | -ok | -okdir) COMP_WORDS=(COMP_WORDS[0] "$cur"); COMP_CWORD=1; _command; return 0 ;; -[acm]min | -[acm]time | -iname | -lname | -wholename | -iwholename | -lwholename | -ilwholename | -inum | -path | -ipath | -regex | -iregex | -links | -perm | -size | -used | -printf | -context) return 0 ;; -regextype) COMPREPLY=($( compgen -W 'emacs posix-awk posix-basic \ posix-egrep posix-extended' -- "$cur" )); return 0 ;; esac; _expand || return 0; for i in ${COMP_WORDS[@]}; do [[ "$i" = [-\(\),\!]* ]] && exprfound=1 && break; done; if [[ "$exprfound" != 1 && "$cur" != [-\(\),\!]* ]]; then _filedir -d; return 0; fi; COMPREPLY=($( compgen -W '-daystart -depth -follow -help \ -ignore_readdir_race -maxdepth -mindepth -mindepth -mount \ -noignore_readdir_race -noleaf -regextype -version -warn -nowarn \ -xdev \ -amin -anewer -atime -cmin -cnewer -ctime -empty -executable -false \ -fstype -gid -group -ilname -iname -inum -ipath -iregex -iwholename \ -links -lname -mmin -mtime -name -newer -nogroup -nouser -path -perm \ -readable -regex -samefile -size -true -type -uid -used -user \ -wholename -writable -xtype -context \ -delete -exec -execdir -fls -fprint -fprint0 -fprintf -ls -ok -okdir \ -print -print0 -printf -prune -quit' -- "$cur" )); onlyonce=' -daystart -depth -follow -help -ignore_readdir_race -maxdepth \ -mindepth -mount -noignore_readdir_race -noleaf -nowarn -regextype \ -version -warn -xdev '; COMPREPLY=($( (while read -d ' ' i; do [[ -z "$i" || "${onlyonce/ ${i%% *} / }" == "$onlyonce" ]] && continue # flatten array with spaces on either side, # otherwise we cannot grep on word boundaries of # first and last word COMPREPLY=" ${COMPREPLY[@]} " # remove word from list of completions COMPREPLY=( ${COMPREPLY/ ${i%% *} / } ) done printf '%s ' "${COMPREPLY[@]}") <<<"${COMP_WORDS[@]}" )); _filedir; return 0 } _fstypes () { local fss; if [ -e /proc/filesystems ]; then fss="$( cut -d' ' -f2 /proc/filesystems ) $( awk '! /\*/ { print $NF }' /etc/filesystems 2>/dev/null )"; else fss="$( awk '/^[ \t]*[^#]/ { print $3 }' /etc/fstab 2>/dev/null ) $( awk '/^[ \t]*[^#]/ { print $3 }' /etc/mnttab 2>/dev/null ) $( awk '/^[ \t]*[^#]/ { print $4 }' /etc/vfstab 2>/dev/null ) $( awk '{ print $1 }' /etc/dfs/fstypes 2>/dev/null ) $( [ -d /etc/fs ] && command ls /etc/fs )"; fi; [ -n "$fss" ] && COMPREPLY=("${COMPREPLY[@]}" $( compgen -W "$fss" -- "$cur" )) } _function () { local cur prev; COMPREPLY=(); _get_comp_words_by_ref cur prev; if [[ $1 == @(declare|typeset) ]]; then if [ "$prev" = -f ]; then COMPREPLY=($( compgen -A function -- "$cur" )); else if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-a -f -F -i -r -x -p' -- "$cur" )); fi; fi; else if [ $COMP_CWORD -eq 1 ]; then COMPREPLY=($( compgen -A function -- "$cur" )); else COMPREPLY=("() $( type -- ${COMP_WORDS[1]} | sed -e 1,2d )"); fi; fi } _gcc () { local cur cc backend; COMPREPLY=(); _get_comp_words_by_ref cur; _expand || return 0; case $1 in gcj) backend=jc1 ;; gpc) backend=gpc1 ;; *77) backend=f771 ;; *) backend=cc1 ;; esac; if [[ "$cur" == -* ]]; then cc=$( $1 -print-prog-name=$backend ); COMPREPLY=($( compgen -W "$( $cc --help 2>/dev/null | tr '\t' ' ' | sed -e '/^ *-/!d' -e 's/ *-\([^ ]*\).*/-\1/' | sort -u )" -- "$cur" )); else _filedir; fi } _gdb () { local cur prev; COMPREPLY=(); _get_comp_words_by_ref cur prev; if [ $COMP_CWORD -eq 1 ]; then local IFS; _compopt_o_filenames; if [[ "$cur" == */* ]]; then IFS=' '; COMPREPLY=($( PATH="$PATH:." compgen -d -c -- "$cur" )); else IFS=":"; local path_array=($( sed -e 's/:\{2,\}/:/g' -e 's/^://' -e 's/:$//' <<<"$PATH" )); IFS=' '; COMPREPLY=($( compgen -d -W '$(find "${path_array[@]}" . \ -mindepth 1 -maxdepth 1 -not -type d -executable \ -printf "%f\\n" 2>/dev/null)' -- "$cur" )); fi; else if [ $COMP_CWORD -eq 2 ]; then prev=${prev##*/}; COMPREPLY=($( compgen -fW "$( command ps axo comm,pid | awk '{if ($1 ~ /^'"$prev"'/) print $2}' )" -- "$cur" )); fi; fi } _gendiff () { COMPREPLY=(); local cur prev cword; _get_comp_words_by_ref cur prev cword; if [[ $cword -eq 1 ]]; then _filedir -d; else if [[ $prev == *\> ]]; then _filedir; fi; fi } _get_comp_words_by_ref () { local exclude flag i OPTIND=1; local cur cword words=(); local upargs=() upvars=() vcur vcword vprev vwords; while getopts "c:i:n:p:w:" flag "$@"; do case $flag in c) vcur=$OPTARG ;; i) vcword=$OPTARG ;; n) exclude=$OPTARG ;; p) vprev=$OPTARG ;; w) vwords=$OPTARG ;; esac; done; while [[ $# -ge $OPTIND ]]; do case ${!OPTIND} in cur) vcur=cur ;; prev) vprev=prev ;; cword) vcword=cword ;; words) vwords=words ;; *) echo "bash: $FUNCNAME(): \`${!OPTIND}': unknown argument" 1>&2; return 1 ;; esac; let "OPTIND += 1"; done; __get_cword_at_cursor_by_ref "$exclude" words cword cur; [[ -n $vcur ]] && { upvars+=("$vcur"); upargs+=(-v $vcur "$cur") }; [[ -n $vcword ]] && { upvars+=("$vcword"); upargs+=(-v $vcword "$cword") }; [[ -n $vprev ]] && { upvars+=("$vprev"); upargs+=(-v $vprev "${words[cword - 1]}") }; [[ -n $vwords ]] && { upvars+=("$vwords"); upargs+=(-a${#words[@]} $vwords "${words[@]}") }; (( ${#upvars[@]} )) && local "${upvars[@]}" && _upvars "${upargs[@]}" } _get_cword () { local LC_CTYPE=C; local cword words; __reassemble_comp_words_by_ref "$1" words cword; if [[ -n ${2//[^0-9]/} ]]; then printf "%s" "${words[cword-$2]}"; else if [[ "${#words[cword]}" -eq 0 || "$COMP_POINT" == "${#COMP_LINE}" ]]; then printf "%s" "${words[cword]}"; else local i; local cur="$COMP_LINE"; local index="$COMP_POINT"; for ((i = 0; i <= cword; ++i )) do while [[ "${#cur}" -ge ${#words[i]} && "${cur:0:${#words[i]}}" != "${words[i]}" ]]; do cur="${cur:1}"; ((index--)); done; if [[ "$i" -lt "$cword" ]]; then local old_size="${#cur}"; cur="${cur#${words[i]}}"; local new_size="${#cur}"; index=$(( index - old_size + new_size )); fi; done; if [[ "${words[cword]:0:${#cur}}" != "$cur" ]]; then printf "%s" "${words[cword]}"; else printf "%s" "${cur:0:$index}"; fi; fi; fi } _get_first_arg () { local i; arg=; for ((i=1; i < COMP_CWORD; i++ )) do if [[ "${COMP_WORDS[i]}" != -* ]]; then arg=${COMP_WORDS[i]}; break; fi; done } _get_pword () { if [ $COMP_CWORD -ge 1 ]; then _get_cword "${@:-}" 1; fi } _getent () { local cur prev; COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in passwd) COMPREPLY=($( compgen -u "$cur" )); return 0 ;; group) COMPREPLY=($( compgen -g "$cur" )); return 0 ;; services) COMPREPLY=($( compgen -s "$cur" )); return 0 ;; hosts) COMPREPLY=($( compgen -A hostname "$cur" )); return 0 ;; protocols | networks | ahosts | ahostsv4 | ahostsv6 | rpc) COMPREPLY=($( compgen -W "$( getent "$prev" | awk '{ print $1 }' )" -- "$cur" )); return 0 ;; aliases | shadow) COMPREPLY=($( compgen -W "$( getent "$prev" | cut -d: -f1 )" -- "$cur" )); return 0 ;; esac; if [ $COMP_CWORD -eq 1 ]; then COMPREPLY=($( compgen -W 'passwd group hosts services protocols \ networks ahosts ahostsv4 ahostsv6 aliases ethers netgroup rpc \ shadow' -- "$cur" )); fi } _gids () { if type getent >&/dev/null; then COMPREPLY=($( compgen -W '$( getent group | cut -d: -f3 )' -- "$cur" )); else if type perl >&/dev/null; then COMPREPLY=($( compgen -W '$( perl -e '"'"'while (($gid) = (getgrent)[2]) { print $gid . "\n" }'"'"' )' -- "$cur" )); else COMPREPLY=($( compgen -W '$( cut -d: -f3 /etc/group )' -- "$cur" )); fi; fi } _gpasswd () { local cur prev; COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in -a | -d | -A | -M) COMPREPLY=($( compgen -u -- "$cur" )); return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-a -d -r -R -A -M' -- "$cur" )); return 0; fi; COMPREPLY=($( compgen -g -- "$cur" )) } _gpg () { local cur prev; COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in -s | --sign | --clearsign | --decrypt-files | --load-extension) _filedir; return 0 ;; --export | --sign-key | --lsignkey | --nrsignkey | --nrlsignkey | --editkey) COMPREPLY=($( compgen -W "$( gpg --list-keys 2>/dev/null | sed -ne 's@^pub.*/\([^ ]*\).*$@\1@p' -ne 's@^.*\(<\([^>]*\)>\).*$@\2@p' )" -- "$cur" )); return 0 ;; -r | --recipient) COMPREPLY=($( compgen -W "$( gpg --list-keys 2>/dev/null | sed -ne 's@^.*<\([^>]*\)>.*$@\1@p')" -- "$cur" )); if [ -e ~/.gnupg/gpg.conf ]; then COMPREPLY=("${COMPREPLY[@]}" $( compgen -W "$( sed -ne 's@^[ \t]*group[ \t][ \t]*\([^=]*\).*$@\1@p' ~/.gnupg/gpg.conf )" -- "$cur")); fi; return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '$(gpg --dump-options)' -- "$cur" )); fi } _groupadd () { local cur prev split=false; COMPREPLY=(); _get_comp_words_by_ref cur prev; _split_longopt && split=true; case $prev in -g | --gid | -K | --key | -p | --password) return 0 ;; esac; $split && return 0; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--force --gid --help \ --key --non-unique --password --system' -- "$cur" )); return 0; fi } _groupmems () { local cur prev; COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in -a | -d) COMPREPLY=($( compgen -u -- "$cur" )); return 0 ;; -g) COMPREPLY=($( compgen -g -- "$cur" )); return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-a -d -p -g -l' -- "$cur" )); return 0; fi } _groupmod () { local cur prev split=false; COMPREPLY=(); _get_comp_words_by_ref cur prev; _split_longopt && split=true; case $prev in -g | --gid | -h | --help | -n | --new-name | -p | --password) return 0 ;; esac; $split && return 0; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--gid --help --new-name \ --non-unique --password' -- "$cur" )); return 0; fi; COMPREPLY=($( compgen -g -- "$cur" )) } _grpck () { local cur; COMPREPLY=(); _get_comp_words_by_ref cur; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-r -s' -- "$cur" )); return 0; fi; _filedir } _gzip () { local cur prev xspec helpopts; COMPREPLY=(); _get_comp_words_by_ref cur prev; helpopts=`_parse_help ${COMP_WORDS[0]}`; case $prev in -b | --blocksize | -p | --processes | -S | --suffix | -h | --help | -V | --version) return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W "$helpopts -1 -2 -3 -4 -5 -6 -7 -8 -9" -- "$cur" )); return 0; fi; local IFS=' '; xspec="*.@(gz|t[ag]z)"; if [[ "$prev" == --* ]]; then [[ "$prev" == --decompress || "$prev" == --list || "$prev" == --test ]] && xspec="!"$xspec; [[ "$prev" == --force ]] && xspec=; else if [[ "$prev" == -* ]]; then [[ "$prev" == -*[dlt]* ]] && xspec="!"$xspec; [[ "$prev" == -*f* ]] && xspec=; else if [[ "$prev" == '>' || "$prev" == '>>' ]]; then xspec=; else if [ "$prev" = '<' ]; then xspec=; fi; fi; fi; fi; _expand || return 0; _compopt_o_filenames; COMPREPLY=($( compgen -f -X "$xspec" -- "$cur" ) $( compgen -d -- "$cur" )) } _hg () { local cur prev cmd cmd_index opts i; local global_args='--cwd|-R|--repository'; local hg="$1"; local canonical=0; COMPREPLY=(); cur="$2"; prev="$3"; for ((i=1; $i<=$COMP_CWORD; i++)) do if [[ ${COMP_WORDS[i]} != -* ]]; then if [[ ${COMP_WORDS[i-1]} != @($global_args) ]]; then cmd="${COMP_WORDS[i]}"; cmd_index=$i; break; fi; fi; done; if [[ "$cur" == -* ]]; then if [ "$(type -t "_hg_opt_$cmd")" = function ] && "_hg_opt_$cmd"; then return; fi; opts=$(_hg_cmd debugcomplete --options "$cmd"); COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$opts' -- "$cur")); return; fi; case "$prev" in -R | --repository) _hg_paths; _hg_repos; return ;; --cwd) return ;; esac; if [ -z "$cmd" ] || [ $COMP_CWORD -eq $i ]; then _hg_commands; return; fi; local help; if _hg_command_specific; then return; fi; help=$(_hg_cmd help "$cmd"); if [ $? -ne 0 ]; then return; fi; cmd=${help#hg }; cmd=${cmd%%[' ']*}; canonical=1; _hg_command_specific } _hg_bookmarks () { local bookmarks="$(_hg_cmd bookmarks --quiet )"; local IFS=' '; COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$bookmarks' -- "$cur")) } _hg_branches () { local branches="$(_hg_cmd branches -q)"; local IFS=' '; COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$branches' -- "$cur")) } _hg_cmd () { HGPLAIN=1 "$hg" "$@" 2> /dev/null } _hg_cmd_bisect () { local i subcmd; for ((i=cmd_index+1; i<=COMP_CWORD; i++)) do if [[ ${COMP_WORDS[i]} != -* ]]; then if [[ ${COMP_WORDS[i-1]} != @($global_args) ]]; then subcmd="${COMP_WORDS[i]}"; break; fi; fi; done; if [ -z "$subcmd" ] || [ $COMP_CWORD -eq $i ] || [ "$subcmd" = help ]; then COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W 'bad good help init next reset' -- "$cur")); return; fi; case "$subcmd" in good | bad) _hg_labels ;; esac; return } _hg_cmd_bookmarks () { if [[ "$prev" = @(-d|--delete|-m|--rename) ]]; then _hg_bookmarks; return; fi } _hg_cmd_email () { case "$prev" in -c | --cc | -t | --to | -f | --from | --bcc) if [ "$(type -t _hg_emails)" = function ]; then local arg=to; if [[ "$prev" == @(-f|--from) ]]; then arg=from; fi; local addresses=$(_hg_emails $arg); COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$addresses' -- "$cur")); fi; return ;; -m | --mbox) return ;; -s | --subject) return ;; esac; _hg_labels; return } _hg_cmd_qclone () { local count=$(_hg_count_non_option); if [ $count = 1 ]; then _hg_paths; fi; _hg_repos } _hg_cmd_qcommit () { local root=$(_hg_cmd root); local files=$(cd "$root/.hg/patches" && _hg_cmd status -nmar); COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$files' -- "$cur")) } _hg_cmd_qdelete () { local qcmd=qunapplied; if [[ "$prev" = @(-r|--rev) ]]; then qcmd=qapplied; fi; _hg_ext_mq_patchlist $qcmd } _hg_cmd_qfinish () { if [[ "$prev" = @(-a|--applied) ]]; then return; fi; _hg_ext_mq_patchlist qapplied } _hg_cmd_qfold () { _hg_ext_mq_patchlist qunapplied } _hg_cmd_qgoto () { if [[ "$prev" = @(-n|--name) ]]; then _hg_ext_mq_queues; return; fi; _hg_ext_mq_patchlist qseries } _hg_cmd_qguard () { local prefix=''; if [[ "$cur" == +* ]]; then prefix=+; else if [[ "$cur" == -* ]]; then prefix=-; fi; fi; local ncur=${cur#[-+]}; if ! [ "$prefix" ]; then _hg_ext_mq_patchlist qseries; return; fi; local guards=$(_hg_ext_mq_guards); COMPREPLY=(${COMPREPLY[@]:-} $(compgen -P $prefix -W '$guards' -- "$ncur")) } _hg_cmd_qheader () { _hg_ext_mq_patchlist qseries } _hg_cmd_qpop () { if [[ "$prev" = @(-n|--name) ]]; then _hg_ext_mq_queues; return; fi; _hg_ext_mq_patchlist qapplied } _hg_cmd_qpush () { if [[ "$prev" = @(-n|--name) ]]; then _hg_ext_mq_queues; return; fi; _hg_ext_mq_patchlist qunapplied } _hg_cmd_qqueue () { local q; local queues; local opts="--list --create --rename --delete --purge"; queues=$( _hg_cmd qqueue --quiet ); COMPREPLY=($( compgen -W "${opts} ${queues}" "${cur}" )) } _hg_cmd_qrename () { _hg_ext_mq_patchlist qseries } _hg_cmd_qsave () { if [[ "$prev" = @(-n|--name) ]]; then _hg_ext_mq_queues; return; fi } _hg_cmd_qselect () { local guards=$(_hg_ext_mq_guards); COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$guards' -- "$cur")) } _hg_cmd_shelve () { _hg_status "mard" } _hg_cmd_sign () { _hg_labels } _hg_cmd_strip () { _hg_labels } _hg_cmd_transplant () { case "$prev" in -s | --source) _hg_paths; _hg_repos; return ;; --filter) return ;; esac; _hg_labels; return } _hg_cmd_unshelve () { _hg_shelves } _hg_command_specific () { if [ "$(type -t "_hg_cmd_$cmd")" = function ]; then "_hg_cmd_$cmd"; return 0; fi; if [ "$cmd" != status ] && [ "$prev" = -r ] || [ "$prev" == --rev ]; then if [ $canonical = 1 ]; then _hg_labels; return 0; else if [[ status != "$cmd"* ]]; then _hg_labels; return 0; else return 1; fi; fi; fi; case "$cmd" in help) _hg_commands ;; export) if _hg_ext_mq_patchlist qapplied && [ "${COMPREPLY[*]}" ]; then return 0; fi; _hg_labels ;; manifest | update) _hg_labels ;; pull | push | outgoing | incoming) _hg_paths; _hg_repos ;; paths) _hg_paths ;; add) _hg_status "u" ;; merge) _hg_labels ;; commit | record) _hg_status "mar" ;; remove) _hg_status "d" ;; forget) _hg_status "a" ;; diff) _hg_status "mar" ;; revert) _hg_status "mard" ;; clone) local count=$(_hg_count_non_option); if [ $count = 1 ]; then _hg_paths; fi; _hg_repos ;; debugindex | debugindexdot) COMPREPLY=(${COMPREPLY[@]:-} $(compgen -f -X "!*.i" -- "$cur")) ;; debugdata) COMPREPLY=(${COMPREPLY[@]:-} $(compgen -f -X "!*.d" -- "$cur")) ;; *) return 1 ;; esac; return 0 } _hg_commands () { local commands; commands="$(_hg_cmd debugcomplete "$cur")" || commands=""; COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$commands' -- "$cur")) } _hg_count_non_option () { local i count=0; local filters="$1"; for ((i=1; $i<=$COMP_CWORD; i++)) do if [[ "${COMP_WORDS[i]}" != -* ]]; then if [[ ${COMP_WORDS[i-1]} == @($filters|$global_args) ]]; then continue; fi; count=$(($count + 1)); fi; done; echo $(($count - 1)) } _hg_ext_mq_guards () { _hg_cmd qselect --series | sed -e 's/^.//' } _hg_ext_mq_patchlist () { local patches; patches=$(_hg_cmd $1); if [ $? -eq 0 ] && [ "$patches" ]; then COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$patches' -- "$cur")); return 0; fi; return 1 } _hg_ext_mq_queues () { local root=$(_hg_cmd root); local n; for n in $(cd "$root"/.hg && compgen -d -- "$cur"); do if [ "$n" != patches ] && [ -e "$root/.hg/$n/series" ]; then COMPREPLY=(${COMPREPLY[@]:-} "$n"); fi; done } _hg_labels () { _hg_tags; _hg_branches; _hg_bookmarks } _hg_opt_qguard () { local i; for ((i=cmd_index+1; i<=COMP_CWORD; i++)) do if [[ ${COMP_WORDS[i]} != -* ]]; then if [[ ${COMP_WORDS[i-1]} != @($global_args) ]]; then _hg_cmd_qguard; return 0; fi; else if [ "${COMP_WORDS[i]}" = -- ]; then _hg_cmd_qguard; return 0; fi; fi; done; return 1 } _hg_paths () { local paths="$(_hg_cmd paths | sed -e 's/ = .*$//')"; COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$paths' -- "$cur")) } _hg_repos () { local i; for i in $(compgen -d -- "$cur"); do test ! -d "$i"/.hg || COMPREPLY=(${COMPREPLY[@]:-} "$i"); done } _hg_shelves () { local shelves="$(_hg_cmd unshelve -l .)"; local IFS=' '; COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$shelves' -- "$cur")) } _hg_status () { local files="$(_hg_cmd status -n$1 .)"; local IFS=' '; COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$files' -- "$cur")) } _hg_tags () { local tags="$(_hg_cmd tags -q)"; local IFS=' '; COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$tags' -- "$cur")) } _iconv () { local cur prev split=false; COMPREPLY=(); _get_comp_words_by_ref cur prev; _split_longopt && split=true; case $prev in -'?' | --help | --usage | -V | --version | --unicode-subst | --byte-subst | --widechar-subst) return 0 ;; -f | --from-code | -t | --to-code) COMPREPLY=($( compgen -W '$( iconv -l | \ sed -e "s@/*\$@@" -e "s/[,()]//g" )' -- "$cur" )); return 0 ;; -o | --output) _filedir; return 0 ;; esac; $split && return 0; if [[ "$cur" = -* ]]; then COMPREPLY=($( compgen -W '--from-code --to-code --list -c --unicode-subst --byte-subst --widechar-subst --output --silent --verbose --help --usage --version' -- "$cur" )); return 0; fi } _id () { local cur; COMPREPLY=(); _get_comp_words_by_ref cur; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-a -g --group -G --groups -n --name\ -r --real -u --user --help --version' -- "$cur" )); else COMPREPLY=($( compgen -u "$cur" )); fi } _ifupdown () { local cur; COMPREPLY=(); _get_comp_words_by_ref cur; if [ $COMP_CWORD -eq 1 ]; then _configured_interfaces; COMPREPLY=($(compgen -W '${COMPREPLY[@]}' -- "$cur")); fi; return 0 } _info () { local cur i infopath; COMPREPLY=(); _get_comp_words_by_ref cur; _expand || return 0; if [[ "$cur" == */* ]]; then _filedir; return 0; fi; infopath='/usr/share/info'; if [ "${INFOPATH: -1:1}" == ':' ]; then infopath=${INFOPATH}${infopath}; else if [ ${INFOPATH:+set} ]; then infopath=$INFOPATH; fi; fi; infopath=$infopath:; if [ -n "$cur" ]; then infopath="${infopath//://$cur* }"; else infopath="${infopath//:// }"; fi; COMPREPLY=($( eval command ls "$infopath" 2>/dev/null )); COMPREPLY=(${COMPREPLY[@]##*/?(:)}); for ((i=0 ; i < ${#COMPREPLY[@]} ; ++i )) do if [ "${COMPREPLY[$i]}" == 'dir' ]; then unset COMPREPLY[$i]; fi; done; COMPREPLY=(${COMPREPLY[@]%.@(gz|bz2|xz|lzma)}); COMPREPLY=($( compgen -W '${COMPREPLY[@]%.*}' -- "${cur//\\\\/}" )); return 0 } _insmod () { local cur prev modpath; COMPREPLY=(); _get_comp_words_by_ref cur prev; if [[ ${1##*/} == modprobe && "${COMP_WORDS[1]}" == -r ]]; then _installed_modules "$cur"; return 0; fi; if [[ "$cur" == */* ]]; then _filedir '@(?(k)o?(.gz))'; return 0; fi; if [[ $COMP_CWORD -gt 1 && "${COMP_WORDS[COMP_CWORD-1]}" != -* ]]; then COMPREPLY=($( compgen -W "$( /sbin/modinfo -p ${COMP_WORDS[1]} | cut -d: -f1 )" -- "$cur" )); else _modules $(uname -r); fi; return 0 } _installed_alternatives () { local admindir; for i in alternatives dpkg/alternatives rpm/alternatives; do [ -d /var/lib/$i ] && admindir=/var/lib/$i && break; done; for ((i=1; i < COMP_CWORD; i++ )) do if [[ "${COMP_WORDS[i]}" == --admindir ]]; then admindir=${COMP_WORDS[i+1]}; break; fi; done; COMPREPLY=($( compgen -W '$( command ls $admindir )' -- "$cur" )) } _installed_modules () { COMPREPLY=($( compgen -W "$( PATH="$PATH:/sbin" lsmod | awk '{if (NR != 1) print $1}' )" -- "$1" )) } _ip () { COMPREPLY=(); local cur prev words cword; _get_comp_words_by_ref cur prev words cword; case $prev in -V | -Version | -rc | -rcvbuf) return 0 ;; -f | -family) COMPREPLY=($( compgen -W 'inet inet6 ipx dnet link' -- "$cur" )); return 0 ;; -b | -batch) _filedir; return 0 ;; -force) COMPREPLY=($( compgen -W '-batch' -- "$cur" )); return 0 ;; esac; local subcword cmd subcmd; for ((subcword=1; subcword < ${#words[@]}-1; subcword++ )) do [[ ${words[subcword]} == -b?(atch) ]] && return 0; [[ -n $cmd ]] && subcmd=${words[subcword]} && break; [[ ${words[subcword]} != -* && ${words[subcword-1]} != -@(f?(amily)|rc?(vbuf)) ]] && cmd=${words[subcword]}; done; if [[ -z $cmd ]]; then case $cur in -*) local c="-Version -statistics -details -resolve -family -oneline -timestamp -batch -rcvbuf"; [[ $cword -eq 1 ]] && c="$c -force"; COMPREPLY=($( compgen -W "$c" -- "$cur" )); return 0 ;; *) COMPREPLY=($( compgen -W "help $( ip help 2>&1 | sed -e '/OBJECT := /,/}/!d' -e 's/.*{//' -e 's/}.*//' -e 's/|//g' )" -- "$cur" )); return 0 ;; esac; fi; [[ $subcmd == help ]] && return 0; case $cmd in link) case $subcmd in add) ;; delete) case $(($cword-$subcword)) in 1) _available_interfaces ;; 2) COMPREPLY=($( compgen -W 'type' -- "$cur" )) ;; 3) [[ $prev == type ]] && COMPREPLY=($( compgen -W 'vlan veth vcan dummy ifb macvlan can' -- "$cur" )) ;; esac ;; set) if [[ $cword-$subcword -eq 1 ]]; then _available_interfaces; else case $prev in arp | dynamic | multicast | allmulticast | promisc | trailers) COMPREPLY=($( compgen -W 'on off' -- "$cur" )) ;; txqueuelen | name | address | broadcast | mtu | netns | alias) ;; *) local c="arp dynamic multicast allmulticast promisc trailers txqueuelen name address broadcast mtu netns alias"; [[ $prev != @(up|down) ]] && c="$c up down"; COMPREPLY=($( compgen -W "$c" -- "$cur" )) ;; esac; fi ;; show) [[ $cword -eq $subcword+1 ]] && _available_interfaces ;; *) [[ $cword -eq $subcword ]] && COMPREPLY=($( compgen -W 'help add delete set show' -- "$cur" )) ;; esac ;; addr) case $subcmd in add | change | replace) ;; del) ;; show | flush) ;; *) [[ $cword -eq $subcword ]] && COMPREPLY=($( compgen -W 'help add change replace del show flush' -- "$cur" )) ;; esac ;; addrlabel) case $subcmd in list | add | del | flush) ;; *) [[ $cword -eq $subcword ]] && COMPREPLY=($( compgen -W 'help list add del flush' -- "$cur" )) ;; esac ;; route) case $subcmd in list | flush) ;; get) ;; add | del | change | append | replace | monitor) ;; *) [[ $cword -eq $subcword ]] && COMPREPLY=($( compgen -W 'help list flush get add del change append replace monitor' -- "$cur" )) ;; esac ;; rule) case $subcmd in list | add | del | flush) ;; *) [[ $cword -eq $subcword ]] && COMPREPLY=($( compgen -W 'help list add del flush' -- "$cur" )) ;; esac ;; neigh) case $subcmd in add | del | change | replace) ;; show | flush) ;; *) [[ $cword -eq $subcword ]] && COMPREPLY=($( compgen -W 'help add del change replace show flush' -- "$cur" )) ;; esac ;; ntable) case $subcmd in change) ;; show) ;; *) [[ $cword -eq $subcword ]] && COMPREPLY=($( compgen -W 'help change show' -- "$cur" )) ;; esac ;; tunnel) case $subcmd in add | change | del | show | prl | 6rd) ;; *) [[ $cword -eq $subcword ]] && COMPREPLY=($( compgen -W 'help add change del show prl 6rd' -- "$cur" )) ;; esac ;; maddr) case $subcmd in add | del) ;; show) if [[ $cword -eq $subcword+1 || $prev == dev ]]; then _available_interfaces; [[ $prev != dev ]] && COMPREPLY=($( compgen -W '${COMPREPLY[@]} dev' -- "$cur" )); fi ;; *) [[ $cword -eq $subcword ]] && COMPREPLY=($( compgen -W 'help add del show' -- "$cur" )) ;; esac ;; mroute) case $subcmd in show) ;; *) [[ $cword -eq $subcword ]] && COMPREPLY=($( compgen -W 'help show' -- "$cur" )) ;; esac ;; monitor) case $subcmd in all) ;; *) [[ $cword -eq $subcword ]] && COMPREPLY=($( compgen -W 'help all' -- "$cur" )) ;; esac ;; xfrm) case $subcmd in state | policy | monitor) ;; *) [[ $cword -eq $subcword ]] && COMPREPLY=($( compgen -W 'state policy monitor' -- "$cur" )) ;; esac ;; esac } _iptables () { local cur prev table chain; COMPREPLY=(); _get_comp_words_by_ref cur prev; chain='s/^Chain \([^ ]\{1,\}\).*$/\1/p'; if [[ $COMP_LINE == *-t\ *filter* ]]; then table="-t filter"; else if [[ $COMP_LINE == *-t\ *nat* ]]; then table="-t nat"; else if [[ $COMP_LINE == *-t\ *mangle* ]]; then table="-t mangle"; fi; fi; fi; _split_longopt; case $prev in -*[AIDRPFXLZ]) COMPREPLY=($( compgen -W '`iptables $table -nL | \ sed -ne "s/^Chain \([^ ]\{1,\}\).*$/\1/p"`' -- "$cur" )) ;; -*t) COMPREPLY=($( compgen -W 'nat filter mangle' -- "$cur" )) ;; -j) if [[ "$table" == "-t filter" || -z "$table" ]]; then COMPREPLY=($( compgen -W 'ACCEPT DROP LOG ULOG REJECT \ `iptables $table -nL | sed -ne "$chain" \ -e "s/INPUT|OUTPUT|FORWARD|PREROUTING|POSTROUTING//"`' -- "$cur" )); else if [ "$table" = "-t nat" ]; then COMPREPLY=($( compgen -W 'ACCEPT DROP LOG ULOG REJECT \ MIRROR SNAT DNAT MASQUERADE `iptables $table -nL | \ sed -ne "$chain" -e "s/OUTPUT|PREROUTING|POSTROUTING//"`' -- "$cur" )); else if [ "$table" = "-t mangle" ]; then COMPREPLY=($( compgen -W 'ACCEPT DROP LOG ULOG REJECT \ MARK TOS `iptables $table -nL | sed -ne "$chain" \ -e "s/INPUT|OUTPUT|FORWARD|PREROUTING|POSTROUTING//"`' -- "$cur" )); fi; fi; fi ;; *) if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--in-interface --out-interface --source \ --destination --protocol --fragment --match --append \ --delete --insert --replace --list --flush --zero --new \ --delete-chain --policy --rename-chain --proto --source \ --destination --in-interface --jump --match --numeric \ --out-interface --table --verbose --line-numbers --exact \ --fragment --modprobe --set-counters --version' -- "$cur")); fi ;; esac } _kernel_versions () { COMPREPLY=($( compgen -W '$( command ls /lib/modules )' -- "$cur" )) } _kill () { local cur; COMPREPLY=(); _get_comp_words_by_ref cur; if [[ $COMP_CWORD -eq 1 && "$cur" == -* ]]; then _signals; else _pids; fi } _killall () { local cur; COMPREPLY=(); _get_comp_words_by_ref cur; if [[ $COMP_CWORD -eq 1 && "$cur" == -* ]]; then _signals; else _pnames; fi; return 0 } _known_hosts () { local options; COMPREPLY=(); [[ "$1" == -a || "$2" == -a ]] && options=-a; [[ "$1" == -c || "$2" == -c ]] && options="$options -c"; _known_hosts_real $options "$(_get_cword :)" } _known_hosts_real () { local configfile flag prefix; local cur curd awkcur user suffix aliases i host; local -a kh khd config; local OPTIND=1; while getopts "acF:p:" flag "$@"; do case $flag in a) aliases='yes' ;; c) suffix=':' ;; F) configfile=$OPTARG ;; p) prefix=$OPTARG ;; esac; done; [ $# -lt $OPTIND ] && echo "error: $FUNCNAME: missing mandatory argument CWORD"; cur=${!OPTIND}; let "OPTIND += 1"; [ $# -ge $OPTIND ] && echo "error: $FUNCNAME("$@"): unprocessed arguments:" $(while [ $# -ge $OPTIND ]; do printf '%s\n' ${!OPTIND}; shift; done); [[ $cur == *@* ]] && user=${cur%@*}@ && cur=${cur#*@}; kh=(); if [ -n "$configfile" ]; then [ -r "$configfile" ] && config=("${config[@]}" "$configfile"); else for i in /etc/ssh/ssh_config "${HOME}/.ssh/config" "${HOME}/.ssh2/config"; do [ -r $i ] && config=("${config[@]}" "$i"); done; fi; if [ ${#config[@]} -gt 0 ]; then local OIFS=$IFS IFS=' '; local -a tmpkh; tmpkh=($( awk 'sub("^[ \t]*([Gg][Ll][Oo][Bb][Aa][Ll]|[Uu][Ss][Ee][Rr])[Kk][Nn][Oo][Ww][Nn][Hh][Oo][Ss][Tt][Ss][Ff][Ii][Ll][Ee][ \t]+", "") { print $0 }' "${config[@]}" | sort -u )); for i in "${tmpkh[@]}"; do i=${i//\"}; __expand_tilde_by_ref i; [ -r "$i" ] && kh=("${kh[@]}" "$i"); done; IFS=$OIFS; fi; if [ -z "$configfile" ]; then for i in /etc/ssh/ssh_known_hosts /etc/ssh/ssh_known_hosts2 /etc/known_hosts /etc/known_hosts2 ~/.ssh/known_hosts ~/.ssh/known_hosts2; do [ -r $i ] && kh=("${kh[@]}" $i); done; for i in /etc/ssh2/knownhosts ~/.ssh2/hostkeys; do [ -d $i ] && khd=("${khd[@]}" $i/*pub); done; fi; if [[ ${#kh[@]} -gt 0 || ${#khd[@]} -gt 0 ]]; then awkcur=${cur//\//\\\/}; awkcur=${awkcur//\./\\\.}; curd=$awkcur; if [[ "$awkcur" == [0-9]*[.:]* ]]; then awkcur="^$awkcur[.:]*"; else if [[ "$awkcur" == [0-9]* ]]; then awkcur="^$awkcur.*[.:]"; else if [ -z "$awkcur" ]; then awkcur="[a-z.:]"; else awkcur="^$awkcur"; fi; fi; fi; if [ ${#kh[@]} -gt 0 ]; then COMPREPLY=("${COMPREPLY[@]}" $( awk 'BEGIN {FS=","} /^\s*[^|\#]/ {for (i=1; i<=2; ++i) { \ sub(" .*$", "", $i); \ sub("^\\[", "", $i); sub("\\](:[0-9]+)?$", "", $i); \ if ($i ~ /'"$awkcur"'/) {print $i} \ }}' "${kh[@]}" 2>/dev/null )); fi; if [ ${#khd[@]} -gt 0 ]; then for i in "${khd[@]}"; do if [[ "$i" == *key_22_$curd*.pub && -r "$i" ]]; then host=${i/#*key_22_/}; host=${host/%.pub/}; COMPREPLY=("${COMPREPLY[@]}" $host); fi; done; fi; for ((i=0; i < ${#COMPREPLY[@]}; i++ )) do COMPREPLY[i]=$prefix$user${COMPREPLY[i]}$suffix; done; fi; if [[ ${#config[@]} -gt 0 && -n "$aliases" ]]; then local hosts=$( sed -ne 's/^[ \t]*[Hh][Oo][Ss][Tt]\([Nn][Aa][Mm][Ee]\)\{0,1\}['"$'\t '"']\{1,\}\([^#*?]*\)\(#.*\)\{0,1\}$/\2/p' "${config[@]}" ); COMPREPLY=("${COMPREPLY[@]}" $( compgen -P "$prefix$user" -S "$suffix" -W "$hosts" -- "$cur" )); fi; if [[ -n ${COMP_KNOWN_HOSTS_WITH_AVAHI:-} ]] && type avahi-browse >&/dev/null; then COMPREPLY=("${COMPREPLY[@]}" $( compgen -P "$prefix$user" -S "$suffix" -W "$( avahi-browse -cpr _workstation._tcp 2>/dev/null | awk -F';' '/^=/ { print $7 }' | sort -u )" -- "$cur" )); fi; if [ -n "${COMP_KNOWN_HOSTS_WITH_HOSTFILE-1}" ]; then COMPREPLY=("${COMPREPLY[@]}" $( compgen -A hostname -P "$prefix$user" -S "$suffix" -- "$cur" )); fi; __ltrim_colon_completions "$prefix$user$cur"; return 0 } _lastlog () { local cur prev split=false; COMPREPLY=(); _get_comp_words_by_ref cur prev; _split_longopt && split=true; case $prev in -b | --before | -h | --help | -t | --time) return 0 ;; -u | --user) COMPREPLY=($( compgen -u -- "$cur" )); return 0 ;; esac; $split && return 0; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--before --help --time --user' -- "$cur" )); return 0; fi } _linux_fstab () { COMPREPLY=(); local fs_spec fs_file fs_other; local oldifs="$IFS"; while read -r fs_spec fs_file fs_other; do if [[ $fs_spec = [#]* ]]; then continue; fi; if [[ $1 == -L ]]; then local fs_label=${fs_spec/#LABEL=}; if [[ $fs_label != "$fs_spec" ]]; then __linux_fstab_unescape fs_label; IFS=''; COMPREPLY+=("$fs_label"); IFS=$oldifs; fi; else __linux_fstab_unescape fs_spec; __linux_fstab_unescape fs_file; IFS=''; [[ $fs_spec = */* ]] && COMPREPLY+=("$fs_spec"); [[ $fs_file = */* ]] && COMPREPLY+=("$fs_file"); IFS=$oldifs; fi; done; _reply_compgen_array } _logicalvolumes () { COMPREPLY=($(compgen -W "$( lvscan 2>/dev/null | sed -n -e "s|^.*'\(.*\)'.*$|\1|p" )" -- "$cur" )) } _longopt () { local cur prev split=false; _get_comp_words_by_ref -n = cur prev; _split_longopt && split=true; case "$prev" in --*[Dd][Ii][Rr]*) _filedir -d; return 0 ;; --*[Ff][Ii][Ll][Ee]* | --*[Pp][Aa][Tt][Hh]*) _filedir; return 0 ;; esac; $split && return 0; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W "$( $1 --help 2>&1 | sed -ne 's/.*\(--[-A-Za-z0-9]\{1,\}\).*/\1/p' | sort -u )" -- "$cur" )); else if [[ "$1" == @(mk|rm)dir ]]; then _filedir -d; else _filedir; fi; fi } _look () { local cur; COMPREPLY=(); _get_comp_words_by_ref cur; if [ $COMP_CWORD = 1 ]; then COMPREPLY=($( compgen -W '$(look "$cur" 2>/dev/null)' -- "$cur" )); fi } _lsof () { COMPREPLY=(); local cur prev; _get_comp_words_by_ref cur prev; case $prev in -'?' | -h | +c | -c | -d | -F | -i | +r | -r | -s | -S | -T) return 0 ;; -A | -k | -m | +m | -o) _filedir; return 0 ;; +d | +D) _filedir -d; return 0 ;; -D) COMPREPLY=($( compgen -W '? b i r u' -- "$cur" )); return 0 ;; -f) COMPREPLY=($( compgen -W 'c f g G n' -- "$cur" )); return 0 ;; -g) _pgids; return 0 ;; -p) _pids; return 0 ;; -u) COMPREPLY=($( compgen -u -- "$cur" )); return 0 ;; esac; if [[ "$cur" == [-+]* ]]; then COMPREPLY=($( compgen -W '-h -a -A -b -c +c -C +d -d +D -D +f -f -F -g -i -k -l +L -L +m -m +M -M -n -N -o -O -p -P +r -r -R -s -S -T -t -u -U -v -V +w -w -x -X -z -Z' -- "$cur" )); return 0; fi; _filedir } _lvchange () { local cur prev; COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in -a | -A | -C | -M | --available | --autobackup | --continguous | --persistent) COMPREPLY=($( compgen -W 'y n' -- "$cur" )); return 0 ;; -p | --permission) COMPREPLY=($( compgen -W 'r rw' -- "$cur" )); return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--autobackup --available \ --addtag --alloc --contiguous --debug --deltag \ --force --help --ignorelockingfailure \ --persistent --major --minor --partial \ --permission --readahead --refresh --test \ --verbose --version' -- "$cur" )); else _logicalvolumes; fi } _lvcreate () { local cur prev; COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in -A | -C | -M | -Z | --autobackup | --continguous | --persistent | --zero) COMPREPLY=($( compgen -W 'y n' -- "$cur" )); return 0 ;; -L | --size) _sizes; return 0 ;; -p | --permission) COMPREPLY=($( compgen -W 'r rw' -- "$cur" )); return 0 ;; -n | --name) _logicalvolumes; return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--autobackup --addtag --alloc \ --contiguous --debug --help --stripes \ --stripesize --extents --size --persistent \ --major --minor --name --permission \ --readahead --test --type --verbose --zero \ --version' -- "$cur" )); else _args; if [ $args -eq 0 ]; then _volumegroups; else _physicalvolumes; fi; fi } _lvdisplay () { local cur prev; COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in --units) _units; return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--colon --columns --units \ --partial --maps --verbose --debug --help --version' -- "$cur" )); else _logicalvolumes; fi } _lvextend () { local cur prev; COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in -A | --autobackup) COMPREPLY=($( compgen -W 'y n' -- "$cur" )); return 0 ;; -L | --size) _sizes; return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--autobackup --alloc \ --debug --help --stripes --stripesize \ --extents --size --nofsck --resizefs \ --test --type --verbose --version' -- "$cur" )); else _args; if [ $args -eq 0 ]; then _logicalvolumes; else _physicalvolumes; fi; fi } _lvm () { local cur; COMPREPLY=(); _get_comp_words_by_ref cur; if [ $COMP_CWORD -eq 1 ]; then COMPREPLY=($( compgen -W 'dumpconfig help lvchange \ lvcreate lvdisplay lvextend lvmchange \ lvmdiskscan lvmsadc lvmsar lvreduce \ lvremove lvrename lvresize lvs lvscan \ pvchange pvcreate pvdata pvdisplay pvmove \ pvremove pvresize pvs pvscan vgcfgbackup \ vgcfgrestore vgchange vgck vgconvert \ vgcreate vgdisplay vgexport vgextend \ vgimport vgmerge vgmknodes vgreduce \ vgremove vgrename vgs vgscan vgsplit \ version' -- "$cur" )); else case ${COMP_WORDS[1]} in pvchange) _pvchange ;; pvcreate) _pvcreate ;; pvdisplay) _pvdisplay ;; pvmove) _pvmove ;; pvremove) _pvremove ;; pvresize) _pvresize ;; pvs) _pvs ;; pvscan) _pvscan ;; vgcfgbackup) _vgcfgbackup ;; vgcfgrestore) _vgcfgrestore ;; vgchange) _vgchange ;; vgck) _vgck ;; vgconvert) _vgconvert ;; vgcreate) _vgcreate ;; vgdisplay) _vgdisplay ;; vgexport) _vgexport ;; vgextend) _vgextend ;; vgimport) _vgimport ;; vgmerge) _vgmerge ;; vgmknodes) _vgmknodes ;; vgreduce) _vgreduce ;; vgremove) _vgremove ;; vgrename) _vgrename ;; vgs) _vgs ;; vgscan) _vgscan ;; vgsplit) _vgsplit ;; lvchange) _lvchange ;; lvcreate) _lvcreate ;; lvdisplay) _lvdisplay ;; lvextend) _lvextend ;; lvreduce) _lvreduce ;; lvremove) _lvremove ;; lvrename) _lvrename ;; lvresize) _lvresize ;; lvs) _lvs ;; lvscan) _lvscan ;; esac; fi } _lvmdiskscan () { local cur; COMPREPLY=(); _get_comp_words_by_ref cur; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--debug --help \ --lvmpartition --verbose --version' -- "$cur" )); fi } _lvreduce () { local cur prev; COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in -A | --autobackup) COMPREPLY=($( compgen -W 'y n' -- "$cur" )); return 0 ;; -L | --size) _sizes; return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--autobackup \ --debug --force --help --extents \ --size --nofsck --resizefs --test --verbose --version' -- "$cur" )); else _logicalvolumes; fi } _lvremove () { local cur prev; COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in -A | --autobackup) COMPREPLY=($( compgen -W 'y n' -- "$cur" )); return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--autobackup --debug \ --force --help --test --verbose --version' -- "$cur" )); else _logicalvolumes; fi } _lvrename () { local cur prev; COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in -A | --autobackup) COMPREPLY=($( compgen -W 'y n' -- "$cur" )); return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--autobackup --debug \ --help --test --verbose --version' -- "$cur" )); else _logicalvolumes; fi } _lvresize () { local cur prev; COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in -A | --autobackup) COMPREPLY=($( compgen -W 'y n' -- "$cur" )); return 0 ;; -L | --size) _sizes; return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--autobackup --alloc \ --debug --help --stripes --stripesize \ --extents --size --nofsck --resizefs \ --test --type --verbose --version' -- "$cur" )); else _args; if [ $args -eq 0 ]; then _logicalvolumes; else _physicalvolumes; fi; fi } _lvs () { local cur prev; COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in -o | -O | --options | --sort) COMPREPLY=($( compgen -W 'lv_uuid lv_name lv_attr lv_minor \ lv_size seg_count origin snap_percent segtype stripes \ stripesize chunksize seg_start seg_size' -- "$cur" )); return 0 ;; --units) _units; return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--aligned --debug --help \ --ignorelockingfailure --noheadings --nosuffix --options \ --sort --partial --segments --separator --unbuffered --units \ --verbose --version' -- "$cur" )); else _logicalvolumes; fi } _lvscan () { local cur; COMPREPLY=(); _get_comp_words_by_ref cur; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--blockdevice --debug \ --help --ignorelockingfailure \ --partial --verbose --version' -- "$cur" )); fi } _mac_addresses () { local re='\([A-Fa-f0-9]\{2\}:\)\{5\}[A-Fa-f0-9]\{2\}'; local PATH="$PATH:/sbin:/usr/sbin"; COMPREPLY=("${COMPREPLY[@]}" $( ifconfig -a 2>/dev/null | sed -ne "s/.*[[:space:]]HWaddr[[:space:]]\{1,\}\($re\)[[:space:]]*$/\1/p" )); COMPREPLY=("${COMPREPLY[@]}" $( arp -an 2>/dev/null | sed -ne "s/.*[[:space:]]\($re\)[[:space:]].*/\1/p" -ne "s/.*[[:space:]]\($re\)[[:space:]]*$/\1/p" )); COMPREPLY=("${COMPREPLY[@]}" $( sed -ne "s/^[[:space:]]*\($re\)[[:space:]].*/\1/p" /etc/ethers 2>/dev/null )); COMPREPLY=($( compgen -W '${COMPREPLY[@]}' -- "$cur" )); __ltrim_colon_completions "$cur" } _make () { local file makef makef_dir="." makef_inc cur prev i split=false; COMPREPLY=(); _get_comp_words_by_ref cur prev; _split_longopt && split=true; case $prev in -f | -o | -W | --file | --makefile | --old-file | --new-file | --assume-old | --assume-new | --what-if) _filedir; return 0 ;; -I | -C | --directory | --include-dir) _filedir -d; return 0 ;; esac; $split && return 0; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-b -m -B -C -d -e -f -h -i -I\ -j -l -k -n -o -p -q -r -R - s -S -t -v -w -W \ --always-make --directory --debug \ --environment-overrides --file --makefile --help \ --ignore-errors --include-dir --jobs --load-average \ --max-load --keep-going --just-print --dry-run \ --recon --old-file --assume-old --print-data-base \ --question --no-builtin-rules --no-builtin-variables \ --silent --quiet --no-keep-goind --stop --touch \ --version --print-directory --no-print-directory \ --what-if --new-file --assume-new \ --warn-undefined-variables' -- "$cur" )); else for ((i=0; i < ${#COMP_WORDS[@]}; i++ )) do if [[ ${COMP_WORDS[i]} == -@(C|-directory) ]]; then eval makef_dir=${COMP_WORDS[i+1]}; break; fi; done; for ((i=0; i < ${#COMP_WORDS[@]}; i++ )) do if [[ ${COMP_WORDS[i]} == -@(f|-?(make)file) ]]; then eval makef=${COMP_WORDS[i+1]}; break; fi; done; [ -n "$makef" ] && makef="-f ${makef}"; [ -n "$makef_dir" ] && makef_dir="-C ${makef_dir}"; COMPREPLY=($( compgen -W "$( make -qp $makef $makef_dir 2>/dev/null | awk -F':' '/^[a-zA-Z0-9][^$#\/\t=]*:([^=]|$)/ \ {split($1,A,/ /);for(i in A)print A[i]}' )" -- "$cur" )); fi } _man () { local cur i prev 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; if [[ "$prev" == -l ]]; then _filedir $manext; return 0; fi; _expand || return 0; if [[ "$cur" == */* ]]; then _filedir $manext; return 0; fi; uname=$( uname -s ); if [[ $uname == @(Linux|GNU|GNU/*|FreeBSD|Cygwin|CYGWIN_*) ]]; then manpath=$( manpath 2>/dev/null || command man --path ); else manpath=$MANPATH; fi; if [ -z "$manpath" ]; then COMPREPLY=($( compgen -c -- "$cur" )); return 0; fi; [[ "$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; COMPREPLY=($( eval command ls "$manpath" 2>/dev/null )); COMPREPLY=(${COMPREPLY[@]##*/?(:)}); COMPREPLY=(${COMPREPLY[@]%.@([gx]z|bz2|lzma|Z)}); COMPREPLY=($( compgen -W '${COMPREPLY[@]%.*}' -- "${cur//\\\\/}" )); if [[ "$prev" != $mansect ]]; then local 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 } _mii_diag () { local cur prev split=false; COMPREPLY=(); _get_comp_words_by_ref cur prev; _split_longopt && split=true; case $prev in -F | -A | --advertise | --fixed-speed) COMPREPLY=($( compgen -W '100baseT4 100baseTx \ 100baseTx-FD 100baseTx-HD 10baseT 10baseT-FD \ 10baseT-HD' -- "$cur" )); return 0 ;; esac; $split && return 0; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--advertise --fixed-speed --all-interfaces \ --status --debug --read-parameters --set-parameters --msg-level \ --phy --restart --reset --verbose --version --watch --help' -- "$cur" )); else _available_interfaces -a; fi } _mii_tool () { local cur prev split=false; COMPREPLY=(); _get_comp_words_by_ref cur prev; _split_longopt && split=true; case $prev in -F | --force) COMPREPLY=($( compgen -W '100baseTx-FD 100baseTx-HD \ 10baseT-FD 10baseT-HD' -- "$cur" )); return 0 ;; -A | --advertise) COMPREPLY=($( compgen -W '100baseT4 100baseTx-FD 100baseTx-HD \ 10baseT-FD 10baseT-HD' -- "$cur" )); return 0 ;; esac; $split && return 0; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--verbose --version --reset --restart \ --watch --log --advertise --force' -- "$cur" )); else _available_interfaces -a; fi } _mkinitrd () { local cur prev args split=false; COMPREPLY=(); _get_comp_words_by_ref cur prev; _split_longopt && split=true; case $prev in --preload | --with | --builtin) _modules; return 0 ;; --fstab | --dsdt) _filedir; return 0 ;; --net-dev) _available_interfaces; return 0 ;; esac; $split && return 0; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--version --help -v -f --preload \ --force-scsi-probe --omit-scsi-modules \ --omit-ide-modules --image-version --force-raid-probe \ --omit-raid-modules --with --force-lvm-probe \ --omit-lvm-modules --builtin --omit-dmraid --net-dev \ --fstab --nocompress --dsdt --bootchart' -- "$cur" )); else _count_args; case $args in 1) _filedir ;; 2) _kernel_versions ;; esac; fi } _mktemp () { COMPREPLY=(); local cur prev split=false; _get_comp_words_by_ref cur prev; _split_longopt && split=true; case "$prev" in --help | --version | --suffix) return 0 ;; --tmpdir | -p) _filedir -d; return 0 ;; esac; $split && return 0; [[ "$cur" == -* ]] && COMPREPLY=($( compgen -W '-d -u -q -p -t' -- "$cur" )) } _modules () { local modpath; modpath=/lib/modules/$1; COMPREPLY=($( compgen -W "$( command ls -R $modpath | sed -ne 's/^\(.*\)\.k\{0,1\}o\(\.gz\)\{0,1\}$/\1/p' )" -- "$cur" )) } _mount () { local cur sm host prev; COMPREPLY=(); _get_comp_words_by_ref -n : cur prev; case $prev in -t | --types) _fstypes; return 0 ;; esac; [[ "$cur" == \\ ]] && cur="/"; if [[ "$cur" == *:* ]]; then for sm in "$(type -P showmount)" {,/usr}/{,s}bin/showmount; do [ -x "$sm" ] || continue; COMPREPLY=($( compgen -W "$( "$sm" -e ${cur%%:*} | awk 'NR>1 {print $1}' )" -- "${cur#*:}" )); return 0; done; fi; if [[ "$cur" == //* ]]; then host=${cur#//}; host=${host%%/*}; if [ -n "$host" ]; then COMPREPLY=($( compgen -P "//$host" -W "$( smbclient -d 0 -NL $host 2>/dev/null | sed -ne '/^['"$'\t '"']*Sharename/,/^$/p' | sed -ne '3,$s|^[^A-Za-z]*\([^'"$'\t '"']*\).*$|/\1|p' )" -- "${cur#//$host}" )); fi; else if [ -r /etc/vfstab ]; then COMPREPLY=($( compgen -W "$( awk '! /^[ \t]*#/ {if ($3 ~ /\//) print $3}' /etc/vfstab )" -- "$cur" )); else if [ ! -e /etc/fstab ]; then COMPREPLY=($( compgen -W "$( mount | awk '! /^[ \t]*#/ {if ($3 ~ /\//) print $3}' )" -- "$cur" )); else if [ "$prev" = -L ]; then _linux_fstab -L < /etc/fstab; else if [ "$prev" = -U ]; then COMPREPLY=($( compgen -W '$(sed -ne "s/^[[:space:]]*UUID=\([^[:space:]]*\).*/\1/p" /etc/fstab )' -- "$cur" )); else _linux_fstab < /etc/fstab; fi; fi; fi; fi; fi; return 0 } _newgrp () { COMPREPLY=(); if [[ "`_get_cword`" == "-" ]]; then COMPREPLY=(-); else _allowed_groups; fi } _newusers () { local cur prev split=false; COMPREPLY=(); _get_comp_words_by_ref cur prev; _split_longopt && split=true; case $prev in -c | --crypt) COMPREPLY=($( compgen -W 'DES MD5 NONE SHA256 SHA512' -- "$cur" )); return 0 ;; -s | --sha-rounds) return 0 ;; esac; $split && return 0; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--crypt-method --help --system \ --sha-rounds' -- "$cur" )); return 0; fi; _filedir } _nslookup () { local cur; COMPREPLY=(); _get_comp_words_by_ref cur; COMPREPLY=($( compgen -P '-' -W 'all class= debug d2 domain= srchlist= \ defname search port= querytype= type= recurse retry root timeout vc \ ignoretc' -- "$cur" )) } _openssl () { local cur prev commands command options formats; COMPREPLY=(); _get_comp_words_by_ref cur prev; commands='asn1parse ca ciphers crl crl2pkcs7 dgst dh dhparam dsa \ dsaparam ec ecparam enc engine errstr gendh gendsa genrsa \ nseq ocsp passwd pkcs12 pkcs7 pkcs8 prime rand req rsa \ rsautl s_client s_server s_time sess_id smime speed spkac \ verify version x509 md2 md4 md5 rmd160 sha sha1 aes-128-cbc \ aes-128-ecb aes-192-cbc aes-192-ecb aes-256-cbc aes-256-ecb \ base64 bf bf-cbc bf-cfb bf-ecb bf-ofb camellia-128-cbc \ camellia-128-ecb camellia-192-cbc camellia-192-ecb \ camellia-256-cbc camellia-256-ecb cast cast-cbc cast5-cbc \ cast5-cfb cast5-ecb cast5-ofb des des-cbc des-cfb des-ecb \ des-ede des-ede-cbc des-ede-cfb des-ede-ofb des-ede3 \ des-ede3-cbc des-ede3-cfb des-ede3-ofb des-ofb des3 desx rc2 \ rc2-40-cbc rc2-64-cbc rc2-cbc rc2-cfb rc2-ecb rc2-ofb rc4 \ rc4-40'; if [ $COMP_CWORD -eq 1 ]; then COMPREPLY=($( compgen -W "$commands" -- "$cur" )); else command=${COMP_WORDS[1]}; case $prev in -CA | -CAfile | -CAkey | -CAserial | -cert | -certfile | -config | -content | -dcert | -dkey | -dhparam | -extfile | -in | -inkey | -kfile | -key | -keyout | -out | -oid | -prvrify | -rand | -recip | -revoke | -sess_in | -sess_out | -spkac | -sign | -signkey | -signer | -signature | -ss_cert | -untrusted | -verify) _filedir; return 0 ;; -outdir | -CApath) _filedir -d; return 0 ;; -name | -crlexts | -extensions) _openssl_sections; return 0 ;; -inform | -outform | -keyform | -certform | -CAform | -CAkeyform | -dkeyform | -dcertform) formats='DER PEM'; case $command in x509) formats="$formats NET" ;; smime) formats="$formats SMIME" ;; esac; COMPREPLY=($( compgen -W "$formats" -- "$cur" )); return 0 ;; -connect) _known_hosts_real "$cur"; return 0 ;; -starttls) COMPREPLY=($( compgen -W 'smtp pop3 imap ftp' -- "$cur" )); return 0 ;; -cipher) COMPREPLY=($( compgen -W "$(openssl ciphers | tr ':' '\n')" -- "$cur" )); return 0 ;; esac; if [[ "$cur" == -* ]]; then case $command in asn1parse) options='-inform -in -out -noout -offset -length -i -oid \ -strparse' ;; ca) options='-verbose -config -name -gencrl -revoke \ -crl_reason -crl_hold -crl_compromise \ -crl_CA_compromise -crldays -crlhours -crlexts \ -startdate -enddate -days -md -policy -keyfile -key \ -passin -cert -selfsig -in -out -notext -outdir \ -infiles -spkac -ss_cert -preserveDN -noemailDN \ -batch -msie_hack -extensions -extfile -engine \ -subj -utf8 -multivalue-rdn' ;; ciphers) options='-v -ssl2 -ssl3 -tls1' ;; crl) options='-inform -outform -text -in -out -noout -hash \ -issuer -lastupdate -nextupdate -CAfile -CApath' ;; crl2pkcs7) options='-inform -outform -in -out -print_certs' ;; dgst) options='-md5 -md4 -md2 -sha1 -sha -mdc2 -ripemd160 -dss1 \ -c -d -hex -binary -out -sign -verify -prverify \ -signature' ;; dsa) options='-inform -outform -in -passin -out -passout -des \ -des3 -idea -text -noout -modulus -pubin -pubout' ;; dsaparam) options='-inform -outform -in -out -noout -text -C -rand \ -genkey' ;; enc) options='-ciphername -in -out -pass -e -d -a -A -k -kfile \ -S -K -iv -p -P -bufsize -debug' ;; dhparam) options='-inform -outform -in -out -dsaparam -noout -text \ -C -2 -5 -rand' ;; gendsa) options='-out -des -des3 -idea -rand' ;; genrsa) options='-out -passout -des -des3 -idea -f4 -3 -rand' ;; pkcs7) options='-inform -outform -in -out -print_certs -text \ -noout' ;; rand) options='-out -rand -base64' ;; req) options='-inform -outform -in -passin -out -passout -text \ -noout -verify -modulus -new -rand -newkey -newkey \ -nodes -key -keyform -keyout -md5 -sha1 -md2 -mdc2 \ -config -x509 -days -asn1-kludge -newhdr -extensions \ -reqexts section' ;; rsa) options='-inform -outform -in -passin -out -passout \ -sgckey -des -des3 -idea -text -noout -modulus -check \ -pubin -pubout -engine' ;; rsautl) options='-in -out -inkey -pubin -certin -sign -verify \ -encrypt -decrypt -pkcs -ssl -raw -hexdump -asn1parse' ;; s_client) options='-connect -verify -cert -certform -key -keyform \ -pass -CApath -CAfile -reconnect -pause -showcerts \ -debug -msg -nbio_test -state -nbio -crlf -ign_eof \ -quiet -ssl2 -ssl3 -tls1 -no_ssl2 -no_ssl3 -no_tls1 \ -bugs -cipher -starttls -engine -tlsextdebug \ -no_ticket -sess_out -sess_in -rand' ;; s_server) options='-accept -context -verify -Verify -crl_check \ -crl_check_all -cert -certform -key -keyform -pass \ -dcert -dcertform -dkey -dkeyform -dpass -dhparam \ -nbio -nbio_test -crlf -debug -msg -state -CApath \ -CAfile -nocert -cipher -quiet -no_tmp_rsa -ssl2 \ -ssl3 -tls1 -no_ssl2 -no_ssl3 -no_tls1 -no_dhe \ -bugs -hack -www -WWW -HTTP -engine -tlsextdebug \ -no_ticket -id_prefix -rand' ;; s_time) options='-connect -www -cert -key -CApath -CAfile -reuse \ -new -verify -nbio -time -ssl2 -ssl3 -bugs -cipher' ;; sess_id) options='-inform -outform -in -out -text -noout -context \ ID' ;; smime) options='-encrypt -decrypt -sign -verify -pk7out -des \ -des3 -rc2-40 -rc2-64 -rc2-128 -aes128 -aes192 -aes256 \ -in -certfile -signer -recip -inform -passin -inkey \ -out -outform -content -to -from -subject -text -rand' ;; speed) options='-engine' ;; verify) options='-CApath -CAfile -purpose -untrusted -help \ -issuer_checks -verbose -certificates' ;; x509) options='-inform -outform -keyform -CAform -CAkeyform -in \ -out -serial -hash -subject_hash -issuer_hash -subject \ -issuer -nameopt -email -startdate -enddate -purpose \ -dates -modulus -fingerprint -alias -noout -trustout \ -clrtrust -clrreject -addtrust -addreject -setalias \ -days -set_serial -signkey -x509toreq -req -CA -CAkey \ -CAcreateserial -CAserial -text -C -md2 -md5 -sha1 \ -mdc2 -clrext -extfile -extensions -engine' ;; md5 | md4 | md2 | sha1 | sha | mdc2 | ripemd160) options='-c -d' ;; esac; COMPREPLY=($( compgen -W "$options" -- "$cur" )); else if [[ "$command" == speed ]]; then COMPREPLY=($( compgen -W 'md2 mdc2 md5 hmac sha1 rmd160 \ idea-cbc rc2-cbc rc5-cbc bf-cbc des-cbc des-ede3 rc4 \ rsa512 rsa1024 rsa2048 rsa4096 dsa512 dsa1024 dsa2048 idea \ rc2 des rsa blowfish' -- "$cur" )); else _filedir; fi; fi; fi } _openssl_sections () { local config f; for ((i=2; i < COMP_CWORD; i++ )) do if [[ "${COMP_WORDS[i]}" == -config ]]; then config=${COMP_WORDS[i+1]}; break; fi; done; if [ -z "$config" ]; then for f in /etc/ssl/openssl.cnf /etc/pki/tls/openssl.cnf /usr/share/ssl/openssl.cnf; do [ -f $f ] && config=$f && break; done; fi; [ ! -f "$config" ] && return 0; COMPREPLY=($( compgen -W "$( awk '/\[.*\]/ {print $2}' $config )" -- "$cur" )) } _parse_help () { $1 ${2:---help} 2>&1 | sed -e '/^[[:space:]]*-/!d' -e 's|[,/]| |g' | awk '{ print $1; if ($2 ~ /^-/) { print $2 } }' | sed -e 's|[<=].*||' } _passwd () { local cur prev; COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in -n | -x | -w | -i | -\? | --help | --usage) return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-k -l --stdin -u -d -n -x -w -i -S \ -? --help --usage' -- "$cur" )); return 0; fi; _allowed_users } _pci_ids () { COMPREPLY=(${COMPREPLY[@]:-} $( compgen -W "$( PATH="$PATH:/sbin" lspci -n | awk '{print $3}')" -- "$cur" )) } _perl () { local cur prev prefix temp; local optPrefix optSuffix; COMPREPLY=(); _get_comp_words_by_ref -n : cur prev; prefix=""; if [[ "$cur" == -?* ]]; then temp=$cur; prev=${temp:0:2}; cur=${temp:2}; optPrefix=-P$prev; optSuffix=-S/; prefix=$prev; fi; case $prev in -D | -e | -E | -i | -F | -l) return 0 ;; -I | -x) local IFS=' '; _compopt_o_filenames; COMPREPLY=($( compgen -d $optPrefix $optSuffix -- "$cur" )); return 0 ;; -m | -M) temp="${cur#-}"; prefix="$prefix${cur%$temp}"; cur="$temp"; _perlmodules $1; return 0 ;; -V) if [[ $cur == :* ]]; then temp="${cur##+(:)}"; prefix="$prefix${cur%$temp}"; local IFS=' '; COMPREPLY=($( compgen -P "$prefix" -W '$( $1 -MConfig -e "print join \"\\n\", keys %Config::Config" 2>/dev/null )' -- "$temp" )); __ltrim_colon_completions "$prefix$temp"; fi; return 0 ;; -d | -dt) if [[ $cur == :* ]]; then temp="${cur#:}"; prefix="$prefix${cur%$temp}"; cur="Devel::$temp"; _perlmodules $1; fi; return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-C -s -T -u -U -W -X -h -v -V -c -w -d \ -D -p -n -a -F -l -0 -I -m -M -P -S -x -i -e ' -- "$cur" )); else _filedir; fi } _perldoc () { local cur prev prefix temp; COMPREPLY=(); _get_comp_words_by_ref -n : cur prev; prefix=""; if [[ "$cur" == -?* ]]; then temp=$cur; prev=${temp:0:2}; cur=${temp:2}; prefix=$prev; fi; case $prev in -f) _perlfunctions "$cur"; return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-h -v -t -u -m -l -F -X -f -q' -- "$cur" )); else if [[ "$cur" != */* ]]; then _perlmodules; COMPREPLY=("${COMPREPLY[@]}" $( compgen -W '$( MANPAGER=/bin/cat PAGER=/bin/cat man perl | \ sed -ne "/perl.*Perl overview/,/perlwin32/p" | \ awk "\$NF=2 { print \$1}" | command grep perl )' -- "$cur" )); fi; _filedir 'p@(l|m|od)'; fi } _perlfunctions () { COMPREPLY=($( compgen -P "$prefix" -W "$( $(dirname $(readlink -f ${BASH_SOURCE[0]}))/helpers/perl functions $cur )" -- "$cur" )) } _perlmodules () { COMPREPLY=($( compgen -P "$prefix" -W "$( $1 $(dirname $(readlink -f ${BASH_SOURCE[0]}))/helpers/perl modules $cur )" -- "$cur" )); __ltrim_colon_completions "$prefix$cur" } _pgids () { COMPREPLY=($( compgen -W '$( command ps axo pgid= )' -- "$cur" )) } _pgrep () { local cur; COMPREPLY=(); _get_comp_words_by_ref cur; _pnames; return 0 } _physicalvolumes () { COMPREPLY=($(compgen -W "$( pvscan 2>/dev/null | sed -n -e 's|^.*PV \(.*\) VG.*$|\1|p' )" -- "$cur" )) } _pids () { COMPREPLY=($( compgen -W '$( command ps axo pid= )' -- "$cur" )) } _pkg_config () { local cur prev split=false; COMPREPLY=(); _get_comp_words_by_ref cur prev; _split_longopt && split=true; case $prev in --variable | --define-variable | --atleast-version | --atleast-pkgconfig-version | --exact-version | --max-version) return 0 ;; -\? | --help | --version | --usage) return 0 ;; esac; $split && return 0; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--version --modversion \ --atleast-pkgconfig-version --libs --static \ --short-errors --libs-only-l --libs-only-other \ --libs-only-L --cflags --cflags-only-I \ --cflags-only-other --variable --define-variable \ --exists --uninstalled --atleast-version \ --exact-version --max-version --list-all --debug \ --print-errors --silence-errors --errors-to-stdout \ --print-provides --print-requires --help --usage' -- "$cur")); else COMPREPLY=($( compgen -W "$( pkg-config --list-all 2>/dev/null | awk '{print $1}' )" -- "$cur" )); fi } _pm_action () { local cur; _get_comp_words_by_ref cur; COMPREPLY=($( compgen -W "--help $( _parse_help "$1" )" -- "$cur" )) } _pm_is_supported () { local cur; _get_comp_words_by_ref cur; COMPREPLY=($( compgen -W '--help --suspend --hibernate --suspend-hybrid' -- "$cur" )) } _pm_powersave () { local cur; _get_comp_words_by_ref cur; COMPREPLY=($( compgen -W "true false" -- "$cur" )) } _pnames () { COMPREPLY=($( compgen -X '' -W '$( command ps axo command= | \ sed -e "s/ .*//" -e "s:.*/::" -e "s/:$//" -e "s/^[[(-]//" \ -e "s/[])]$//" | sort -u )' -- "$cur" )) } _pvchange () { local cur prev; COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in -A | -x | --autobackup | --allocatable) COMPREPLY=($( compgen -W 'y n' -- "$cur" )); return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--all --autobackup \ --debug --help --test --uuid \ --allocatable --verbose --addtag --deltag \ --version' -- "$cur" )); else _physicalvolumes; fi } _pvcreate () { local cur prev; COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in --restorefile) _filedir; return 0 ;; -M | --metadatatype) COMPREPLY=($( compgen -W '1 2' -- "$cur" )); return 0 ;; --metadatacopies) COMPREPLY=($( compgen -W '0 1 2' -- "$cur" )); return 0 ;; --metadatasize | --setphysicalvolumesize) _sizes; return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--restorefile --debug \ --force --help --labelsector --metadatatype \ --metadatacopies --metadatasize \ --setphysicalvolumesize --test --uuid \ --verbose --yes --version' -- "$cur" )); else _physicalvolumes; fi } _pvdisplay () { local cur prev; COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in --units) _units; return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--colon --columns --units \ --verbose --debug --help --version' -- "$cur" )); else _physicalvolumes; fi } _pvmove () { local cur prev; COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in -A | --autobackup) COMPREPLY=($( compgen -W 'y n' -- "$cur" )); return 0 ;; -n | --name) _logicalvolumes; return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--abort --autobackup \ --background --debug --force --help --interval --test --verbose \ --version --name' -- "$cur" )); else _physicalvolumes; fi } _pvremove () { local cur; COMPREPLY=(); _get_comp_words_by_ref cur; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--debug --force \ --help --yes --test --verbose --version' -- "$cur" )); else _physicalvolumes; fi } _pvs () { local cur prev; COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in -o | -O | --options | --sort) COMPREPLY=($( compgen -W 'pv_fmt pv_uuid \ pv_size pv_free pv_used pv_name \ pv_attr pv_pe_count \ pv_pe_alloc_count' -- "$cur" )); return 0 ;; --units) _units; return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--aligned --all --debug \ --help --ignorelockingfailure --noheadings \ --nosuffix --options --sort --separator --unbuffered --units \ --verbose --version' -- "$cur" )); else _physicalvolumes; fi } _pvscan () { local cur; COMPREPLY=(); _get_comp_words_by_ref cur; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--debug --exported --novolumegroup \ --help --ignorelockingfailure --partial --short --uuid \ --verbose --version' -- "$cur" )); fi } _pwck () { local cur; COMPREPLY=(); _get_comp_words_by_ref cur; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-q -r -s' -- "$cur" )); return 0; fi; _filedir } _python () { local prev cur i; COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in -'?' | -h | --help | -V | --version | -c | -m) return 0 ;; -Q) COMPREPLY=($( compgen -W "old new warn warnall" -- "$cur" )); return 0 ;; -W) COMPREPLY=($( compgen -W "ignore default all module once error" -- "$cur" )); return 0 ;; !(?(*/)python*([0-9.])|-?)) [[ $COMP_CWORD -lt 2 || ${COMP_WORDS[COMP_CWORD-2]} != -@(Q|W) ]] && _filedir ;; esac; for ((i=0; i < ${#COMP_WORDS[@]}-1; i++ )) do if [[ ${COMP_WORDS[i]} == -c ]]; then _filedir; fi; done; if [[ "$cur" != -* ]]; then _filedir 'py?([co])'; else COMPREPLY=($( compgen -W "$( _parse_help $1 -h )" -- "$cur" )); fi; return 0 } _qdbus () { local cur; COMPREPLY=(); _get_comp_words_by_ref cur; [ -n "$cur" ] && unset COMP_WORDS[${#COMP_WORDS[@]}-1]; COMPREPLY=($( compgen -W '$( command ${COMP_WORDS[@]} 2>/dev/null | \ sed s/\(.*\)// )' -- "$cur" )) } _quota () { local cur prev split=false; COMPREPLY=(); _get_comp_words_by_ref cur prev; _split_longopt && split=true; case $prev in -F | --format) _quota_formats; return 0 ;; esac; $split && return 0; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-F --format -g --group -u --user -v \ --verbose -s --human-readable -p --raw-grace -i --no-autofs -l \ --local-only -A --all-nfs -m --no-mixed-pathnames -q --quiet -Q \ --quiet-refuse -w --no-wrap' -- "$cur" )); else _user_or_group; fi } _quota_formats () { COMPREPLY=($( compgen -W 'vfsold vfsv0 rpc xfs' -- "$cur" )) } _quotacheck () { local cur prev split=false; COMPREPLY=(); _get_comp_words_by_ref cur prev; _split_longopt && split=true; case $prev in -F | --format) _quota_formats; return 0 ;; esac; $split && return 0; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-b --backup -v --verbose -d --debug \ -g --group -u --user -c --create-files -f --force -i \ --interactive -n --use-first-dquot -M --try-remount -m \ --no-remount -R --exclude-root -F --format -a --all' -- "$cur" )); else _filesystems; fi } _quotaoff () { local cur prev split=false; COMPREPLY=(); _get_comp_words_by_ref cur prev; _split_longopt && split=true; case $prev in -F | --format) _quota_formats; return 0 ;; -x | --xfs-command) COMPREPLY=($( compgen -W 'delete enforce' -- "$cur" )); return 0 ;; esac; $split && return 0; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-a --all -v --verbose -u --user \ -g --group -p --print-state -x --xfs-command -F --format' -- "$cur" )); else _filesystems; fi } _quotaon () { local cur prev split=false; COMPREPLY=(); _get_comp_words_by_ref cur prev; _split_longopt && split=true; case $prev in -F | --format) _quota_formats; return 0 ;; esac; $split && return 0; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-a --all -v --verbose -u --user \ -g --group -f --off -p --print-state -F --format' -- "$cur" )); else _filesystems; fi } _quote_readline_by_ref () { if [[ ${1:0:1} == "'" ]]; then if [[ ${BASH_VERSINFO[0]} -ge 4 ]]; then printf -v $2 %s "${1:1}"; else printf -v $2 %q "${1:1}"; printf -v $2 %q ${!2}; fi; else if [[ ${BASH_VERSINFO[0]} -le 3 && ${1:0:1} == '"' ]]; then printf -v $2 %q "${1:1}"; else printf -v $2 %q "$1"; fi; fi; [[ ${!2:0:1} == '$' ]] && eval $2=${!2} } _rcs () { local cur prev file dir i; COMPREPLY=(); _get_comp_words_by_ref cur prev; file=${cur##*/}; dir=${cur%/*}; [ "$file" = "$dir" ] && dir=.; COMPREPLY=($( compgen -f "$dir/RCS/$file" )); for ((i=0; i < ${#COMPREPLY[@]}; i++ )) do file=${COMPREPLY[$i]##*/}; dir=${COMPREPLY[$i]%RCS/*}; COMPREPLY[$i]=$dir$file; done; COMPREPLY=("${COMPREPLY[@]}" $( compgen -G "$dir/$file*,v" )); for ((i=0; i < ${#COMPREPLY[@]}; i++ )) do COMPREPLY[$i]=${COMPREPLY[$i]%,v}; done; [[ ${#COMPREPLY[@]} -eq 0 && $1 == ci ]] && _filedir || _filedir -d } _realcommand () { type -P "$1" > /dev/null && { if type -p realpath > /dev/null; then realpath "$(type -P "$1")"; else if type -p readlink > /dev/null; then readlink -f "$(type -P "$1")"; else type -P "$1"; fi; fi } } _renice () { local command cur curopt i; COMPREPLY=(); _get_comp_words_by_ref cur; command=$1; i=0; while [[ $i -le $COMP_CWORD && ${#COMPREPLY[@]} -eq 0 ]]; do curopt=${COMP_WORDS[COMP_CWORD-$i]}; case "$curopt" in -u) _allowed_users ;; -g) _pgids ;; -p | $command) _pids ;; esac; i=$(( ++i )); done } _reply_compgen_array () { local i wlist; for i in ${!COMPREPLY[*]}; do local q=$(quote "$(printf %q "${COMPREPLY[$i]}")"); wlist+=$q' '; done; local ecur="$cur"; ecur="${ecur//\\/\\\\}"; ecur="${ecur//\'/\'}"; local oldifs=$IFS; IFS=' ' eval 'COMPREPLY=(`compgen -W "$wlist" -- "${ecur}"`)'; IFS=$oldifs } _repquota () { local cur prev split=false; COMPREPLY=(); _get_comp_words_by_ref cur prev; _split_longopt && split=true; case $prev in -F | --format) _quota_formats; return 0 ;; esac; $split && return 0; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-a --all -v --verbose -s --human-readable \ -c --batch-translation -C --no-batch-translation -t \ --truncate-names -n --no-names -p --raw-grace -i --no-autofs \ -u --user -g --group -F --format' -- "$cur" )); else _filesystems; fi } _rl_enabled () { [[ "$( bind -v )" = *$1+([[:space:]])on* ]] } _rmmod () { local cur; COMPREPLY=(); _get_comp_words_by_ref cur; _installed_modules "$cur"; return 0 } _root_command () { local PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin; local root_command=$1; _command $1 $2 $3 } _route () { local cur prev; COMPREPLY=(); _get_comp_words_by_ref cur prev; if [ "$prev" = dev ]; then _available_interfaces; return 0; fi; local i found; for opt in add del -host -net netmask metric mss window irtt reject mod dyn reinstate dev default gw; do found=false; for ((i=1; i < ${#COMP_WORDS[@]}-1; i++ )) do [ "${COMP_WORDS[i]}" = "$opt" ] && found=true && break; done; $found || COMPREPLY[${#COMPREPLY[@]}]="$opt"; done; COMPREPLY=($( compgen -W '"${COMPREPLY[@]}"' -- "$cur" )) } _rpm () { local cur prev opts nodig nosig; COMPREPLY=(); _get_comp_words_by_ref cur prev; nodig=""; nosig=""; _rpm_nodigsig; if [ $COMP_CWORD -eq 1 ]; then case $cur in -b*) COMPREPLY=($( compgen -W '-ba -bb -bc -bi -bl -bp -bs' -- "$cur" )) ;; -t*) COMPREPLY=($( compgen -W '-ta -tb -tc -ti -tl -tp -ts' -- "$cur" )) ;; --*) COMPREPLY=($( compgen -W '--help --version --initdb \ --checksig --recompile --rebuild --resign --addsign \ --rebuilddb --showrc --setperms --setugids --tarbuild \ --eval --install --upgrade --query --freshen --erase \ --verify --querytags --rmsource --rmspec --clean \ --import' -- "$cur" )) ;; *) COMPREPLY=($( compgen -W '-b -e -E -F -i -q -t -U -V' -- "$cur" )) ;; esac; return 0; fi; case $prev in --dbpath | --excludepath | --prefix | --relocate | --root) _filedir -d; return 0 ;; --eval | -E) COMPREPLY=($( compgen -W "$( rpm --showrc | sed -ne 's/^-\{0,1\}[0-9]\{1,\}[:=][[:space:]]\{1,\}\([^[:space:](]\{3,\}\).*/%\1/p' )" -- "$cur" )); return 0 ;; --pipe) _compopt_o_filenames; COMPREPLY=($( compgen -c -- "$cur" )); return 0 ;; --rcfile) _filedir; return 0 ;; --specfile) _filedir spec; return 0 ;; --whatprovides) if [[ "$cur" == */* ]]; then _filedir; else local IFS=' '; COMPREPLY=($( compgen -W "$( rpm -qa $nodig $nosig --queryformat='%{providename}\n' )" -- "$cur" )); fi; return 0 ;; --whatrequires) if [[ "$cur" == */* ]]; then _filedir; else local IFS=' '; COMPREPLY=($( compgen -W "$( rpm -qa $nodig $nosig --queryformat='%{requirename}\n' )" -- "$cur" )); fi; return 0 ;; --target) COMPREPLY=($( compgen -W "$( command rpm --showrc | sed -ne 's/^\s*compatible\s\s*build\s\s*archs\s*:\s*\(.*\)/\1/ p' )" -- "$cur" )); return 0 ;; --define | -D | --fileid | --hdrid | --pkgid) return 0 ;; esac; opts="--define --eval --macros --nodigest --nosignature --rcfile --quiet --pipe --verbose"; case ${COMP_WORDS[1]} in -[iFU]* | --install | --freshen | --upgrade) if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W "$opts --percent --force --test --replacepkgs --replacefiles --root --excludedocs --includedocs --noscripts --ignorearch --dbpath --prefix --ignoreos --nodeps --allfiles --ftpproxy --ftpport --justdb --httpproxy --httpport --noorder --relocate --badreloc --notriggers --excludepath --ignoresize --oldpackage --queryformat --repackage --nosuggests" -- "$cur" )); else _filedir '[rs]pm'; fi ;; -e | --erase) if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W "$opts --allmatches --noscripts --notriggers --nodeps --test --repackage" -- "$cur" )); else _rpm_installed_packages "$nodig" "$nosig"; fi ;; -q* | --query) opts="$opts --changelog --configfiles --conflicts --docfiles --dump --enhances --filesbypkg --filecaps --fileclass --filecolor --fileprovide --filerequire --filesbypkg --info --list --obsoletes --pipe --provides --queryformat --rcfile --requires --scripts --suggests --triggers --xml"; if [[ $COMP_LINE == *\ -@(*([^ -])f|-file )* ]]; then if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W "$opts --dbpath --fscontext --last --root --state" -- "$cur" )); else _filedir; fi; else if [[ $COMP_LINE == *\ -@(*([^ -])g|-group )* ]]; then _rpm_groups; else if [[ $COMP_LINE == *\ -@(*([^ -])p|-package )* ]]; then if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W "$opts --ftpport --ftpproxy --httpport --httpproxy --nomanifest" -- "$cur" )); else _filedir '[rs]pm'; fi; else if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W "$opts --all --file --fileid --dbpath --fscontext --ftswalk --group --hdrid --last --package --pkgid --root --specfile --state --triggeredby --whatprovides --whatrequires" -- "$cur" )); else if [[ $COMP_LINE != *\ -@(*([^ -])a|-all )* ]]; then _rpm_installed_packages "$nodig" "$nosig"; fi; fi; fi; fi; fi ;; -K* | --checksig) if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W "$opts --nopgp --nogpg --nomd5" -- "$cur" )); else _filedir '[rs]pm'; fi ;; -[Vy]* | --verify) if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W "$opts --root --dbpath --nodeps --nogroup --nolinkto --nomode --nomtime --nordev --nouser --nofiles --noscripts --nomd5 --querytags --specfile --whatrequires --whatprovides" -- "$cur" )); else if [[ $COMP_LINE == *\ -@(*([^ -])f|-file )* ]]; then _filedir; else if [[ $COMP_LINE == *\ -@(*([^ -])g|-group )* ]]; then _rpm_groups; else if [[ $COMP_LINE == *\ -@(*([^ -])p|-package )* ]]; then _filedir '[rs]pm'; else _rpm_installed_packages "$nodig" "$nosig"; fi; fi; fi; fi ;; -[bt]*) if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W "$opts --short-circuit --timecheck --clean --rmsource --rmspec --test --sign --buildroot --target --nobuild --nodeps --nodirtokens" -- "$cur" )); else if [[ ${COMP_WORDS[1]} == -b* ]]; then _filedir spec; else _filedir '@(t?(ar.)@([gx]z|bz?(2))|tar?(.@(lzma|Z)))'; fi; fi ;; --rebuild | --recompile) if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W "$opts --nodeps --rmsource --rmspec --sign --nodirtokens --target" -- "$cur" )); else _filedir '@(?(no)src.r|s)pm'; fi ;; --tarbuild) _filedir '@(t?(ar.)@([gx]z|bz?(2))|tar?(.@(lzma|Z)))' ;; --resign | --addsign) _filedir '[rs]pm' ;; --setperms | --setgids) _rpm_installed_packages "$nodig" "$nosig" ;; --clean | --rmsource | --rmspec) if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--clean --rmsource --rmspec' -- "$cur" )); else _filedir spec; fi ;; --import | --dbpath | --root) if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--import --dbpath --root' -- "$cur" )); else _filedir; fi ;; esac; return 0 } _rpm_groups () { local IFS=' '; COMPREPLY=($( compgen -W "$( rpm -qa $nodig $nosig --queryformat '%{group}\n' )" -- "$cur" )) } _rpm_installed_packages () { local nodig="$1" nosig="$2"; if [[ -r /var/log/rpmpkgs && /var/log/rpmpkgs -nt /var/lib/rpm/Packages ]]; then COMPREPLY=($( compgen -W "$( sed -ne 's|^\([^[:space:]]\{1,\}\)-[^[:space:]-]\{1,\}-[^[:space:]-]\{1,\}\.rpm$|\1|p' /var/log/rpmpkgs )" -- "$cur" )); else if type rpmqpack >&/dev/null; then COMPREPLY=($( compgen -W '$( rpmqpack )' -- "$cur" )); else _rpm_nodigsig; COMPREPLY=($( rpm -qa $nodig $nosig --qf='%{NAME} ' "$cur*" )); fi; fi } _rpm_nodigsig () { if [[ -z "$nodig" && -z "$nosig" ]]; then local rpmver; rpmver=$(rpm --version); rpmver=${rpmver##* }; if [[ "$rpmver" > "4.0.4" ]]; then nodig="--nodigest"; fi; if [[ "$rpmver" > "4.0.99" ]]; then nosig="--nosignature"; fi; fi } _rsync () { COMPREPLY=(); local cur prev; _get_comp_words_by_ref -n : cur prev; _expand || return 0; case $prev in --config | --password-file | --include-from | --exclude-from) _filedir; return 0 ;; -T | --temp-dir | --compare-dest) _filedir -d; return 0 ;; -e | --rsh) COMPREPLY=($( compgen -W 'rsh ssh' -- "$cur" )); return 0 ;; --compress-level) COMPREPLY=($( compgen -W '1 2 3 4 5 6 7 8 9' -- "$cur" )); return 0 ;; esac; case $cur in -*) COMPREPLY=($( compgen -W '--verbose --quiet --no-motd --checksum \ --archive --recursive --relative --no-implied-dirs \ --backup --backup-dir --suffix= --update --inplace --append \ --append-verify --dirs --old-dirs --links --copy-links \ --copy-unsafe-links --safe-links --copy-dirlinks \ --keep-dirlinks --hard-links --perms --executability --chmod= \ --acls --xattrs --owner --group --devices --copy-devices \ --specials --times --omit-dir-times --super --fake-super \ --sparse --dry-run --whole-file --no-whole-file \ --one-file-system --block-size= --rsh= --rsync-path= \ --existing --ignore-existing --remove-source-files --delete \ --delete-before --delete-during --delete-delay --delete-after \ --delete-excluded --ignore-errors --force --max-delete= \ --max-size= --min-size= --partial --partial-dir= \ --delay-updates --prune-empty-dirs --numeric-ids --timeout= \ --contimeout= --ignore-times --size-only --modify-window= \ --temp-dir= --fuzzy --compare-dest= --copy-dest= --link-dest= \ --compress --compress-level= --skip-compress= --cvs-exclude \ --filter= --exclude= --exclude-from= --include= \ --include-from= --files-from= --from0 --protect-args \ --address= --port= --sockopts= --blocking-io --no-blocking-io \ --stats --8-bit-output --human-readable --progress \ --itemize-changes --out-format= --log-file= \ --log-file-format= --password-file= --list-only --bwlimit= \ --write-batch= --only-write-batch= --read-batch= --protocol= \ --iconv= --ipv4 --ipv6 --version --help --daemon --config= \ --no-detach' -- "$cur" )) ;; *:*) if type _scp_remote_files >&/dev/null; then local i shell=ssh; for ((i=1; i < COMP_CWORD; i++ )) do if [[ "${COMP_WORDS[i]}" == -@(e|-rsh) ]]; then shell=${COMP_WORDS[i+1]}; break; fi; done; [ "$shell" = ssh ] && _scp_remote_files; fi ;; *) _known_hosts_real -c -a "$cur"; type _scp_local_files >&/dev/null && _scp_local_files || _filedir ;; esac; return 0 } _rtcwake () { COMPREPLY=(); local cur prev split=false; _get_comp_words_by_ref cur prev; _split_longopt && split=true; case "$prev" in --help | -h | --version | -V | --seconds | -s | --time | -t) return 0 ;; --mode | -m) COMPREPLY=($( compgen -W 'standby mem disk on no off' -- "$cur" )); return 0 ;; --device | -d) COMPREPLY=($( command ls -d /dev/rtc?* 2>/dev/null )); COMPREPLY=($( compgen -W '${COMPREPLY[@]#/dev/}' -- "$cur" )); return 0 ;; esac; $split && return 0; COMPREPLY=($( compgen -W '--device --local --mode --seconds --time --utc \ --verbose --version --help' -- "$cur" )) } _samba_debuglevel () { COMPREPLY=($( compgen -W '0 1 2 3 4 5 6 7 8 9 10' -- "$cur" )) } _samba_domains () { if [ -n "${COMP_SAMBA_SCAN:-}" ]; then COMPREPLY=($( compgen -W '$( smbtree -N -D )' -- "$cur" )); fi } _samba_hosts () { if [ -n "${COMP_SAMBA_SCAN:-}" ]; then COMPREPLY=($( compgen -W "$( smbtree -N -S | sed -ne 's/^[[:space:]]*\\\\*\([^[:space:]]*\).*/\1/p' )" -- $cur )); fi } _samba_resolve_order () { COMPREPLY=($( compgen -W 'lmhosts host wins bcast' -- "$cur" )) } _scp () { local configfile cur prev prefix; COMPREPLY=(); _get_comp_words_by_ref -n : cur prev; _ssh_suboption_check && { COMPREPLY=("${COMPREPLY[@]/%/ }"); return 0 }; case $prev in -l | -P) return 0 ;; -F | -i | -S) _filedir; type compopt >&/dev/null && compopt +o nospace; return 0 ;; -c) _ssh_ciphers; COMPREPLY=("${COMPREPLY[@]/%/ }"); return 0 ;; -o) _ssh_options; return 0 ;; esac; _expand || return 0; if [[ "$cur" == *:* ]]; then _scp_remote_files; return 0; fi; if [[ "$cur" == -F* ]]; then cur=${cur#-F}; prefix=-F; else set -- "${COMP_WORDS[@]}"; while [ $# -gt 0 ]; do if [ "${1:0:2}" = -F ]; then if [ ${#1} -gt 2 ]; then configfile="$(dequote "${1:2}")"; else shift; [ "$1" ] && configfile="$(dequote "$1")"; fi; break; fi; shift; done; case $cur in -*) COMPREPLY=($( compgen -W '-1 -2 -4 -6 -B -C -c -F -i -l -o \ -P -p -q -r -S -v' -- "$cur" )); COMPREPLY=("${COMPREPLY[@]/%/ }"); return 0 ;; */*) ;; *) _known_hosts_real -c -a -F "$configfile" "$cur" ;; esac; fi; _scp_local_files "$prefix"; return 0 } _scp_local_files () { local IFS=' '; local dirsonly=false; if [ "$1" = -d ]; then dirsonly=true; shift; fi; if $dirsonly; then COMPREPLY=("${COMPREPLY[@]}" $( command ls -aF1d $cur* 2>/dev/null | sed -e "s/$_scp_path_esc/\\\\&/g" -e '/[^\/]$/d' -e "s/^/$1/")); else COMPREPLY=("${COMPREPLY[@]}" $( command ls -aF1d $cur* 2>/dev/null | sed -e "s/$_scp_path_esc/\\\\&/g" -e 's/[*@|=]$//g' -e 's/[^\/]$/& /g' -e "s/^/$1/")); fi } _scp_remote_files () { local IFS=' '; cur=${cur/\\:/:}; local userhost=${cur%%?(\\):*}; local path=${cur#*:}; path=$( sed -e 's/\\\\\\\('$_scp_path_esc'\)/\\\1/g' <<<"$path" ); if [ -z "$path" ]; then path=$(ssh -o 'Batchmode yes' $userhost pwd 2>/dev/null); fi; local files; if [ "$1" = -d ]; then files=$( ssh -o 'Batchmode yes' $userhost command ls -aF1d "$path*" 2>/dev/null | sed -e 's/'$_scp_path_esc'/\\\\\\&/g' -e '/[^\/]$/d' ); else files=$( ssh -o 'Batchmode yes' $userhost command ls -aF1d "$path*" 2>/dev/null | sed -e 's/'$_scp_path_esc'/\\\\\\&/g' -e 's/[*@|=]$//g' -e 's/[^\/]$/& /g' ); fi; COMPREPLY=("${COMPREPLY[@]}" $files) } _screen () { local cur prev words cword; COMPREPLY=(); _get_comp_words_by_ref cur prev words cword; if ((cword > 2)); then case ${words[cword-2]} in -[dD]) _screen_sessions; return 0 ;; esac; fi; case $prev in -[rR]) _screen_sessions 'Detached'; return 0 ;; -[dD]) _screen_sessions 'Attached'; return 0 ;; -x) _screen_sessions; return 0 ;; -s) _shells; return 0 ;; -c) _filedir; return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-a -A -c -d -D -e -f -fn -fa -h -i -ln \ -list -L -m -O -p -q -r -R -s -S -t -U -v -wipe -x -X --help \ --version' -- "$cur" )); fi } _screen_sessions () { COMPREPLY=($( compgen -W "$( command screen -ls | sed -ne 's|^\t\{1,\}\([0-9]\{1,\}\.[^\t]\{1,\}\).*'"$1"'.*$|\1|p' )" -- "$cur" )) } _service () { local cur prev sysvdir; COMPREPLY=(); _get_comp_words_by_ref cur prev; [[ ${COMP_WORDS[0]} != @(*init.d/!(functions|~)|service) ]] && return 0; [ $COMP_CWORD -gt 2 ] && return 0; if [[ $COMP_CWORD -eq 1 && $prev == "service" ]]; then _services; else [ -d /etc/rc.d/init.d ] && sysvdir=/etc/rc.d/init.d || sysvdir=/etc/init.d; COMPREPLY=($( compgen -W '`sed -e "y/|/ /" \ -ne "s/^.*\(U\|msg_u\)sage.*{\(.*\)}.*$/\2/p" \ $sysvdir/${prev##*/} 2>/dev/null`' -- "$cur" )); fi; return 0 } _services () { local sysvdir famdir; [ -d /etc/rc.d/init.d ] && sysvdir=/etc/rc.d/init.d || sysvdir=/etc/init.d; famdir=/etc/xinetd.d; COMPREPLY=($( printf '%s\n' $sysvdir/!(*.rpm@(orig|new|save)|*~|functions) )); if [ -d $famdir ]; then COMPREPLY=("${COMPREPLY[@]}" $( printf '%s\n' $famdir/!(*.rpm@(orig|new|save)|*~) )); fi; COMPREPLY=($( compgen -W '${COMPREPLY[@]#@($sysvdir|$famdir)/}' -- "$cur" )) } _setquota () { local cur prev split=false; COMPREPLY=(); _get_comp_words_by_ref cur prev; _split_longopt && split=true; case $prev in -F | --format) _quota_formats; return 0 ;; esac; $split && return 0; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-r --remote -m --no-mixed-pathnames \ -F --format -g --group -u --user -p --prototype -b --batch \ -c --continue-batch -t --edit-period -T --edit-times -a --all' -- "$cur" )); else _count_args; case $args in 1) _user_or_group ;; 2) _filesystems ;; esac; fi } _sftp () { local cur prev configfile; COMPREPLY=(); _get_comp_words_by_ref cur prev; _ssh_suboption_check && return 0; case $prev in -b | -F | -P) _filedir; return 0 ;; -o) _ssh_options; return 0 ;; esac; if [[ "$cur" == -F* ]]; then cur=${cur#-F}; _filedir; COMPREPLY=("${COMPREPLY[@]/#/-F}"); cur=-F$cur; else if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-1 -C -v -B -b -F -o -P -R -S -s' -- "$cur" )); else set -- "${COMP_WORDS[@]}"; while [ $# -gt 0 ]; do if [ "${1:0:2}" = -F ]; then if [ ${#1} -gt 2 ]; then configfile="$(dequote "${1:2}")"; else shift; [ "$1" ] && configfile="$(dequote "$1")"; fi; break; fi; shift; done; _known_hosts_real -a -F "$configfile" "$cur"; fi; fi; return 0 } _sh () { COMPREPLY=(); local cur prev; _get_comp_words_by_ref cur prev; case $prev in -c) return 0 ;; -o | +o) COMPREPLY=($( compgen -W 'allexport errexit ignoreeof monitor noclobber noglob noexec nolog notify nounset verbose vi xtrace' -- "$cur" )); return 0 ;; esac; local opts="-a -b -C -e -f -h -i -m -n -o -u -v -x"; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W "$opts -c -s" -- "$cur" )); return 0; else if [[ "$cur" == +* ]]; then COMPREPLY=($( compgen -W "${opts//-/+}" -- "$cur" )); return 0; fi; fi; _filedir sh } _shells () { COMPREPLY=("${COMPREPLY[@]}" $( compgen -W '$( command grep "^[[:space:]]*/" /etc/shells 2>/dev/null )' -- "$cur" )) } _signals () { local i; COMPREPLY=($( compgen -A signal SIG${cur#-} )); for ((i=0; i < ${#COMPREPLY[@]}; i++ )) do COMPREPLY[i]=-${COMPREPLY[i]#SIG}; done } _sizes () { COMPREPLY=($( compgen -W 'k K m M g G t T' -- "$cur" )) } _smbcacls () { local cur prev split=false; COMPREPLY=(); _get_comp_words_by_ref cur prev; _split_longopt && split=true; case $prev in -s) _filedir; return 0 ;; -l | --log-basename) _filedir -d; return 0 ;; -d | --debuglevel) _samba_debuglevel; return 0 ;; esac; $split && return 0; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-a -M -D -S -U -C -G --numeric -t \ -h --help -V -s -d --debuglevel -l --log-basename' -- "$cur" )); fi } _smbclient () { local cur prev split=false; COMPREPLY=(); _get_comp_words_by_ref cur prev; _split_longopt && split=true; case $prev in -R) _samba_resolve_order; return 0 ;; -t) COMPREPLY=($( compgen -W 'SJIS EUC JIS7 JIS8 JUNET HEX CAP' -- "$cur" )); return 0 ;; -s | -A | --authentication-file) _filedir; return 0 ;; -l | --log-basename | -D) _filedir -d; return 0 ;; -O) COMPREPLY=($( compgen -W 'SO_KEEPALIVE SO_REUSEADDR \ SO_BROADCAST TCP_NODELAY IPTOS_LOWDELAY \ IPTOS_THROUGHPUT SO_SNDBUF SO_RCVBUF \ SO_SNDLOWAT SO_RCVLOWAT' -- "$cur" )); return 0 ;; -T) COMPREPLY=($( compgen -W 'c x I X F b g q r N a' -- "$cur" )); return 0 ;; -W | --workgroup) _samba_domains; return 0 ;; -d | --debuglevel) _samba_debuglevel; return 0 ;; -p | --port | -M | -I | -b | -U | --user | -n | -i | -T | -c) return 0 ;; -\? | --help | -V | --version) return 0 ;; esac; $split && return 0; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-b -d -L -U -I -M -m -A -N -i -O \ -p -R -s -k -P -c -D -W -l -E --debuglevel \ --log-basename --workgroup' -- "$cur" )); fi } _smbcquotas () { local cur prev split=false; COMPREPLY=(); _get_comp_words_by_ref cur prev; _split_longopt && split=true; case $prev in -s | -A | --authentication-file) _filedir; return 0 ;; -l | --log-basename) _filedir -d; return 0 ;; -d | --debuglevel) _samba_debuglevel; return 0 ;; esac; $split && return 0; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-u -L -F -S -n -t -v -h --help -V \ -s --debuglevel --log-basename -N -k \ --authentication-file --user' -- "$cur" )); fi } _smbget () { local cur prev split=false; COMPREPLY=(); _get_comp_words_by_ref cur prev; _split_longopt && split=true; case $prev in -o | -f | --outputfile | --rcfile) _filedir; return 0 ;; -d | --debuglevel) _samba_debuglevel; return 0 ;; esac; $split && return 0; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-a --guest -r --resume -R --recursive -u \ --username -p --password -w --workgroup -n --nonprompt -d \ --debuglevel -D --dots -P --keep-permissions -o --outputfile -f \ --rcfile -q --quiet -v --verbose -b --blocksize -? --help --usage' -- "$cur" )); fi } _smbpasswd () { local cur prev; COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in -r) _samba_hosts; return 0 ;; -R) _samba_resolve_order; return 0 ;; -c) _filedir; return 0 ;; -D) _samba_debuglevel; return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-a -c -x -d -e -D -n -r -R -m -U -h \ -s -w -W -i -L' -- "$cur" )); fi } _smbtar () { local cur prev; COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in -r | -t) _filedir tar; return 0 ;; -s) _samba_hosts; return 0 ;; -l) _samba_debuglevel; return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-r -i -a -v -s -p -x -X -N -b -d -l -u -t' -- "$cur" )); fi } _smbtree () { local cur prev split=false; COMPREPLY=(); _get_comp_words_by_ref cur prev; _split_longopt && split=true; case $prev in -s | -A | --authentication-file) _filedir; return 0 ;; -l | --log-basename) _filedir -d; return 0 ;; -d | --debuglevel) _samba_debuglevel; return 0 ;; esac; $split && return 0; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-b -D -S -V -s -d --debuglevel -l \ --log-basename -N -k -A --authentication-file -U --user\ -h --help' -- "$cur" )); fi } _split_longopt () { if [[ "$cur" == --?*=* ]]; then prev="${cur%%?(\\)=*}"; cur="${cur#*=}"; return 0; fi; return 1 } _sqlite3 () { COMPREPLY=(); local cur prev; _get_comp_words_by_ref cur prev; local dbexts='@(sqlite?(3)|?(s?(3))db)'; case $prev in -help | -version | -separator | -nullvalue | *.$dbexts) return 0 ;; -init) _filedir; return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-help -init -echo -header -noheader -bail -interactive -batch -column -csv -html -line -list -separator -nullvalue -version' -- "$cur" )); return 0; fi; _filedir $dbexts } _ssh () { local cur prev configfile; local -a config; COMPREPLY=(); _get_comp_words_by_ref -n : cur prev; _ssh_suboption_check && return 0; case $prev in -F | -i | -S) _filedir; return 0 ;; -c) _ssh_ciphers; return 0 ;; -m) _ssh_macs; return 0 ;; -l) COMPREPLY=($( compgen -u -- "$cur" )); return 0 ;; -o) _ssh_options; return 0 ;; -w) _available_interfaces; return 0 ;; -b) _ssh_bindaddress; return 0 ;; esac; if [[ "$cur" == -F* ]]; then cur=${cur#-F}; _filedir; COMPREPLY=("${COMPREPLY[@]/#/-F}"); cur=-F$cur; else if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-1 -2 -4 -6 -A -a -C -f -g -K -k -M \ -N -n -q -s -T -t -V -v -X -v -Y -y -b -b -c -D -e -F \ -i -L -l -m -O -o -p -R -S -w' -- "$cur" )); else set -- "${COMP_WORDS[@]}"; while [ $# -gt 0 ]; do if [ "${1:0:2}" = -F ]; then if [ ${#1} -gt 2 ]; then configfile="$(dequote "${1:2}")"; else shift; [ "$1" ] && configfile="$(dequote "$1")"; fi; break; fi; shift; done; _known_hosts_real -a -F "$configfile" "$cur"; if [ $COMP_CWORD -ne 1 ]; then _compopt_o_filenames; COMPREPLY=("${COMPREPLY[@]}" $( compgen -c -- "$cur" )); fi; fi; fi; return 0 } _ssh_bindaddress () { COMPREPLY=("${COMPREPLY[@]}" $( compgen -W "$( PATH="$PATH:/sbin" ifconfig -a | sed -ne 's/.*addr:\([^[:space:]]*\).*/\1/p' -ne 's/.*inet[[:space:]]\{1,\}\([^[:space:]]*\).*/\1/p' )" -- "$cur" )) } _ssh_ciphers () { COMPREPLY=("${COMPREPLY[@]}" $( compgen -W '3des-cbc aes128-cbc \ aes192-cbc aes256-cbc aes128-ctr aes192-ctr aes256-ctr arcfour128 \ arcfour256 arcfour blowfish-cbc cast128-cbc' -- "$cur" )) } _ssh_copy_id () { local cur prev; COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in -i) _filedir; return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-i' -- "$cur" )); else _known_hosts_real -a "$cur"; fi; return 0 } _ssh_macs () { COMPREPLY=("${COMPREPLY[@]}" $( compgen -W 'hmac-md5 hmac-sha1 \ umac-64@openssh.com hmac-ripemd160 hmac-sha1-96 hmac-md5-96' -- "$cur" )) } _ssh_options () { type compopt >&/dev/null && compopt -o nospace; COMPREPLY=($( compgen -S = -W 'AddressFamily BatchMode BindAddress \ ChallengeResponseAuthentication CheckHostIP Cipher Ciphers \ ClearAllForwardings Compression CompressionLevel ConnectionAttempts \ ConnectTimeout ControlMaster ControlPath DynamicForward EscapeChar \ ExitOnForwardFailure ForwardAgent ForwardX11 ForwardX11Trusted \ GatewayPorts GlobalKnownHostsFile GSSAPIAuthentication \ GSSAPIDelegateCredentials HashKnownHosts Host HostbasedAuthentication \ HostKeyAlgorithms HostKeyAlias HostName IdentityFile IdentitiesOnly \ KbdInteractiveDevices LocalCommand LocalForward LogLevel MACs \ NoHostAuthenticationForLocalhost NumberOfPasswordPrompts \ PasswordAuthentication PermitLocalCommand Port \ PreferredAuthentications Protocol ProxyCommand PubkeyAuthentication \ RekeyLimit RemoteForward RhostsRSAAuthentication RSAAuthentication \ SendEnv ServerAliveInterval ServerAliveCountMax SmartcardDevice \ StrictHostKeyChecking TCPKeepAlive Tunnel TunnelDevice \ UsePrivilegedPort User UserKnownHostsFile VerifyHostKeyDNS \ VisualHostKey XAuthLocation' -- "$cur" )) } _ssh_suboption () { local prev=${1%%=*} cur=${1#*=}; case $prev in BatchMode | ChallengeResponseAuthentication | CheckHostIP | ClearAllForwardings | Compression | ExitOnForwardFailure | ForwardAgent | ForwardX11 | ForwardX11Trusted | GatewayPorts | GSSAPIAuthentication | GSSAPIKeyExchange | GSSAPIDelegateCredentials | GSSAPITrustDns | HashKnownHosts | HostbasedAuthentication | IdentitiesOnly | KbdInteractiveAuthentication | KbdInteractiveDevices | NoHostAuthenticationForLocalhost | PasswordAuthentication | PubkeyAuthentication | RhostsRSAAuthentication | RSAAuthentication | StrictHostKeyChecking | TCPKeepAlive | UsePrivilegedPort | VerifyHostKeyDNS | VisualHostKey) COMPREPLY=($( compgen -W 'yes no' -- "$cur")) ;; AddressFamily) COMPREPLY=($( compgen -W 'any inet inet6' -- "$cur" )) ;; BindAddress) _ssh_bindaddress ;; Cipher) COMPREPLY=($( compgen -W 'blowfish des 3des' -- "$cur" )) ;; Protocol) COMPREPLY=($( compgen -W '1 2 1,2 2,1' -- "$cur" )) ;; Tunnel) COMPREPLY=($( compgen -W 'yes no point-to-point ethernet' -- "$cur" )) ;; PreferredAuthentications) COMPREPLY=($( compgen -W 'gssapi-with-mic host-based \ publickey keyboard-interactive password' -- "$cur" )) ;; MACs) _ssh_macs ;; Ciphers) _ssh_ciphers ;; esac; return 0 } _ssh_suboption_check () { local cureq=`_get_cword :=` preveq=`_get_pword :=`; if [[ $cureq == *=* && $preveq == -o ]]; then _ssh_suboption $cureq; return $?; fi; return 1 } _strace () { local cur prev offset i syscalls arch unistd; offset=0; for ((i=1; i <= COMP_CWORD; i++ )) do case ${COMP_WORDS[$i]} in -o | -e | -p) i=$((i+1)); continue ;; -*) continue ;; esac; offset=$i; break; done; if [ $offset -gt 0 ]; then _command_offset $offset; else COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in -e) if [[ "$cur" == *=* ]]; then prev=${cur/=*/}; cur=${cur/*=/}; arch=$(command uname -m); syscalls=$(awk '/^#define __NR/ {print $2}' /usr/include/asm/unistd.h | sed -e 's/__NR_//'); if [ -z "$syscalls" ]; then if [[ "$arch" == *86 ]]; then unistd=/usr/include/asm/unistd_32.h; else unistd=/usr/include/asm/unistd_64.h; fi; syscalls=$(awk '/^#define __NR/ {print $2}' $unistd | sed -e 's/__NR_//'); fi; case $prev in trace) COMPREPLY=($( compgen -W "$syscalls file process network signal ipc desc all none" -- "$cur")); return 0 ;; esac; else COMPREPLY=($( compgen -S"=" -W 'trace abbrev verbose raw signal read write' -- "$cur" )); fi; return 0 ;; -o) _filedir; return 0 ;; -p) _pids; return 0 ;; -S) COMPREPLY=($( compgen -W 'time calls name nothing' -- "$cur" )); return 0 ;; -u) _allowed_users; return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-c -d -f -ff -F --help -i -q \ -r -t -tt -ttt -T -v -V -x -xx -a -e -o -O -p \ -s -S -u -E' -- "$cur" )); else COMPREPLY=($( compgen -c -- "$cur" )); fi; fi } _svn () { local cur prev commands options command; COMPREPLY=(); _get_comp_words_by_ref cur prev; commands='add blame praise annotate ann cat checkout co cleanup commit \ ci copy cp delete del remove rm diff di export help ? h import \ info list ls lock log merge mkdir move mv rename ren \ propdel pdel pd propedit pedit pe propget pget pg \ proplist plist pl propset pset ps resolved revert \ status stat st switch sw unlock update up'; if [[ $COMP_CWORD -eq 1 ]]; then if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--version' -- $cur )); else COMPREPLY=($( compgen -W "$commands" -- $cur )); fi; else case $prev in --config-dir) _filedir -d; return 0 ;; -F | --file | --targets) _filedir; return 0 ;; --encoding) COMPREPLY=($( compgen -W '$( iconv --list | \ sed -e "s@//@@;" )' -- "$cur" )); return 0 ;; --editor-cmd | --diff-cmd | --diff3-cmd) COMP_WORDS=(COMP_WORDS[0] $cur); COMP_CWORD=1; _command; return 0 ;; esac; command=${COMP_WORDS[1]}; if [[ "$cur" == -* ]]; then case $command in add) options='--auto-props --no-auto-props --force --targets --no-ignore --non-recursive -N -q --quiet' ;; blame | annotate | ann | praise) options='-r --revisions --username --password --no-auth-cache --non-interactive -v --verbose --incremental --xml' ;; cat) options='-r --revision --username --password --no-auth-cache --non-interactive' ;; checkout | co) options='-r --revision -q --quiet -N --non-recursive --username --password --no-auth-cache --non-interactive --ignore-externals' ;; cleanup) options='--diff3-cmd' ;; commit | ci) options='-m --message -F --file --encoding --force-log -q --quiet --non-recursive -N --targets --editor-cmd --username --password --no-auth-cache --non-interactive --no-unlock' ;; copy | cp) options='-m --message -F --file --encoding --force-log -r --revision -q --quiet --editor-cmd -username --password --no-auth-cache --non-interactive' ;; delete | del | remove | rm) options='--force -m --message -F --file --encoding --force-log -q --quiet --targets --editor-cmd --username --password --no-auth-cache --non-interactive' ;; diff | di) options='-r --revision -x --extensions --diff-cmd --no-diff-deleted -N --non-recursive --username --password --no-auth-cache --non-interactive --force --old --new --notice-ancestry' ;; export) options='-r --revision -q --quiet --username --password --no-auth-cache --non-interactive -N --non-recursive --force --native-eol --ignore-externals' ;; import) options='--auto-props --no-auto-props -m --message -F --file --encoding --force-log -q --quiet --non-recursive --no-ignore --editor-cmd --username --password --no-auth-cache --non-interactive' ;; info) options='--username --password --no-auth-cache --non-interactive -r --revision --xml --targets -R --recursive --incremental' ;; list | ls) options='-r --revision -v --verbose -R --recursive --username --password --no-auth-cache --non-interactive --incremental --xml' ;; lock) options='-m --message -F --file --encoding --force-log --targets --force --username --password --no-auth-cache --non-interactive' ;; log) options='-r --revision -v --verbose --targets --username --password --no-auth-cache --non-interactive --stop-on-copy --incremental --xml -q --quiet --limit' ;; merge) options='-r --revision -N --non-recursive -q --quiet --force --dry-run --diff3-cmd --username --password --no-auth-cache --non-interactive --ignore-ancestry' ;; mkdir) options='-m --message -F --file --encoding --force-log -q --quiet --editor-cmd --username --password --no-auth-cache --non-interactive' ;; move | mv | rename | ren) options='-m --message -F --file --encoding --force-log -r --revision -q --quiet --force --editor-cmd --username --password --no-auth-cache --non-interactive' ;; propdel | pdel | pd) options='-q --quiet -R --recursive -r --revision --revprop --username --password --no-auth-cache --non-interactive' ;; propedit | pedit | pe) options='-r --revision --revprop --encoding --editor-cmd --username --password --no-auth-cache --non-interactive --force' ;; propget | pget | pg) options='-R --recursive -r --revision --revprop --strict --username --password --no-auth-cache --non-interactive' ;; proplist | plist | pl) options='-v --verbose -R --recursive -r --revision --revprop -q --quiet --username --password --no-auth-cache --non-interactive' ;; propset | pset | ps) options='-F --file -q --quiet --targets -R --recursive --revprop --encoding --username --password --no-auth-cache --non-interactive -r --revision --force' ;; resolved) options='--targets -R --recursive -q --quiet' ;; revert) options='--targets -R --recursive -q --quiet' ;; status | stat | st) options='-u --show-updates -v --verbose -N --non-recursive -q --quiet --username --password --no-auth-cache --non-interactive --no-ignore --ignore-externals --incremental --xml' ;; switch | sw) options='--relocate -r --revision -N --non-recursive -q --quiet --username --password --no-auth-cache --non-interactive --diff3-cmd' ;; unlock) options='--targets --force --username --password --no-auth-cache --non-interactive' ;; update | up) options='-r --revision -N --non-recursive -q --quiet --username --password --no-auth-cache --non-interactive --diff3-cmd --ignore-externals' ;; esac; options="$options --help -h --config-dir"; COMPREPLY=($( compgen -W "$options" -- $cur )); else if [[ "$command" == @(help|h|\?) ]]; then COMPREPLY=($( compgen -W "$commands" -- $cur )); else _filedir; fi; fi; fi; return 0 } _svnadmin () { local cur prev commands options mode; COMPREPLY=(); _get_comp_words_by_ref cur prev; commands='create deltify dump help ? hotcopy list-dblogs list-unused-dblogs load lslocks lstxns recover rmlocks rmtxns setlog verify'; if [[ $COMP_CWORD -eq 1 ]]; then if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--version' -- $cur )); else COMPREPLY=($( compgen -W "$commands" -- $cur )); fi; else case $prev in --config-dir) _filedir -d; return 0 ;; --fs-type) COMPREPLY=($( compgen -W 'fsfs bdb' -- $cur )); return 0 ;; esac; command=${COMP_WORDS[1]}; if [[ "$cur" == -* ]]; then case $command in create) options='--bdb-txn-nosync --bdb-log-keep --config-dir --fs-type' ;; deltify) options='-r --revision -q --quiet' ;; dump) options='-r --revision --incremental -q --quiet --deltas' ;; hotcopy) options='--clean-logs' ;; load) options='--ignore-uuid --force-uuid --parent-dir -q --quiet --use-pre-commit-hook --use-post-commit-hook' ;; rmtxns) options='-q --quiet' ;; setlog) options='-r --revision --bypass-hooks' ;; esac; options="$options --help -h"; COMPREPLY=($( compgen -W "$options" -- $cur )); else if [[ "$command" == @(help|h|\?) ]]; then COMPREPLY=($( compgen -W "$commands" -- $cur )); else _filedir; fi; fi; fi; return 0 } _svnlook () { local cur prev commands options mode; COMPREPLY=(); _get_comp_words_by_ref cur; commands='author cat changed date diff dirs-changed help ? h history info lock log propget pget pg proplist plist pl tree uuid youngest'; if [[ $COMP_CWORD -eq 1 ]]; then if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--version' -- $cur )); else COMPREPLY=($( compgen -W "$commands" -- $cur )); fi; else command=${COMP_WORDS[1]}; if [[ "$cur" == -* ]]; then case $command in author | cat | date | dirs-changed | info | log) options='-r --revision -t --transaction' ;; changed) options='-r --revision -t --transaction --copy-info' ;; diff) options='-r --revision -t --transaction --no-diff-deleted --no-diff-added --diff-copy-from' ;; history) options='-r --revision --show-ids' ;; propget | proplist) options='-r --revision -t --transaction --revprop' ;; tree) options='-r --revision -t --transaction --show-ids --full-paths' ;; esac; options="$options --help -h"; COMPREPLY=($( compgen -W "$options" -- $cur )); else if [[ "$command" == @(help|h|\?) ]]; then COMPREPLY=($( compgen -W "$commands" -- $cur )); else _filedir; fi; fi; fi; return 0 } _sysctl () { local cur; COMPREPLY=(); _get_comp_words_by_ref cur; COMPREPLY=($( compgen -W "$( PATH="$PATH:/sbin" sysctl -N -a 2>/dev/null )" -- "$cur" )); return 0 } _tar () { local cur ext regex tar untar; COMPREPLY=(); _get_comp_words_by_ref cur; if [ $COMP_CWORD -eq 1 ]; then COMPREPLY=($( compgen -W 'c t x u r d A' -- "$cur" )); return 0; fi; case ${COMP_WORDS[1]} in ?(-)[cr]*f) _filedir; return 0 ;; +([^IZzJjy])f) ext='@(@(tar|gem|spkg)?(.@(Z|[gx]z|bz?(2)|lzma))|t@([glx]z|bz?(2)))'; regex='\(\(tar\|gem\|spkg\)\(\.\(Z\|[gx]z\|bz?(2)\|lzma\)\)\?\|t\([glx]z\|bz2\?\)\)' ;; *[Zz]*f) ext='@(t?(ar.)|gem.|spkg.)@(gz|Z)'; regex='\(t\(ar\.\)\?\|gem\.\|spkg\.\)\(gz\|Z\)' ;; *[Ijy]*f) ext='@(@(t?(ar.)|gem.)bz?(2)|spkg)'; regex='\(\(t\(ar\.\)\?\|gem\.\)bz2\?\|spkg\)' ;; *[J]*f) ext='@(t?(ar.)|gem.|spkg.)@(lz?(ma)|xz)'; regex='\(t\(ar\.\)\?\|gem\.\|spkg\.\)\(lzma\|xz\)\?' ;; *) _filedir; return 0 ;; esac; if [[ "$COMP_LINE" == *$ext' ' ]]; then tar=$( sed -e 's/^.* \([^ ]*'$regex'\) .*$/\1/' <<<"$COMP_LINE" ); untar=t${COMP_WORDS[1]//[^Izjyf]/}; local IFS=' '; COMPREPLY=($( compgen -W "$( printf '%s\n' $( tar $untar $tar 2>/dev/null ) )" -- "$cur" )); return 0; fi; _filedir "$ext"; return 0 } _tcpdump () { local cur prev; COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in -r | -w | -F) _filedir; return 0 ;; -i) _available_interfaces -a; return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-a -d -e -f -l -n -N -O -p \ -q -R -S -t -u -v -x -C -F -i -m -r -s -T -w -E' -- "$cur" )); fi } _tilde () { local result=0; if [[ ${1:0:1} == "~" && $1 == ${1//\/} ]]; then _compopt_o_filenames; COMPREPLY=($( compgen -P '~' -u "${1#\~}" )); result=${#COMPREPLY[@]}; fi; return $result } _tune2fs () { COMPREPLY=(); local cur prev; _get_comp_words_by_ref cur prev; case $prev in -c | -C | -E | -i | -J | -L | -m | -r | -T) return 0 ;; -e) COMPREPLY=($( compgen -W 'continue remount-ro panic' -- "$cur" )); return 0 ;; -g) _gids; COMPREPLY=($( compgen -g -W '${COMPREPLY[@]}' -- "$cur" )); return 0 ;; -M) _filedir -d ;; -o) local -a opts=(^debug ^bsdgroups ^user_xattr ^acl ^uid16 ^journal_data ^journal_data_ordered ^journal_data_writeback); COMPREPLY=($( compgen -W '${opts[@]} ${opts[@]#^}' -- "$cur" )); return 0 ;; -O) local -a opts=(^dir_index ^dir_nlink ^extent ^extra_isize ^filetype ^flex_bg ^has_journal ^huge_file ^large_file ^resize_inode ^sparse_super ^uninit_bg); COMPREPLY=($( compgen -W '${opts[@]} ${opts[@]#^}' -- "$cur" )); return 0 ;; -u) _uids; COMPREPLY=($( compgen -u -W '${COMPREPLY[@]}' -- "$cur" )); return 0 ;; -U) COMPREPLY=($( compgen -W 'clear random time' -- "$cur" )); return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-c -C -e -E -f -g -i -j -J -l -L -m -M -o -O -r -T -u -U' -- "$cur" )); fi; cur=${cur:=/dev/}; _filedir } _uids () { if type getent >&/dev/null; then COMPREPLY=($( compgen -W '$( getent passwd | cut -d: -f3 )' -- "$cur" )); else if type perl >&/dev/null; then COMPREPLY=($( compgen -W '$( perl -e '"'"'while (($uid) = (getpwent)[2]) { print $uid . "\n" }'"'"' )' -- "$cur" )); else COMPREPLY=($( compgen -W '$( cut -d: -f3 /etc/passwd )' -- "$cur" )); fi; fi } _umount () { local cur; _get_comp_words_by_ref cur; COMPREPLY=(); if [[ $(uname -s) = Linux && -r /proc/mounts ]]; then _linux_fstab < /proc/mounts; else local IFS=' '; COMPREPLY=($( compgen -W '$( mount | cut -d" " -f 3 )' -- "$cur" )); fi; return 0 } _units () { COMPREPLY=($( compgen -W 'h s b k m g t H K M G T' -- "$cur" )) } _update_alternatives () { local cur prev mode args i; COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in --altdir | --admindir) _filedir -d; return 0 ;; --help | --usage | --version) return 0 ;; esac; for ((i=1; i < COMP_CWORD; i++ )) do if [[ "${COMP_WORDS[i]}" == --@(install|remove|auto|display|config|remove-all|set) ]]; then mode=${COMP_WORDS[i]}; args=$(($COMP_CWORD - i)); break; fi; done; case $mode in --install) case $args in 1 | 3) _filedir ;; 2) _installed_alternatives ;; 4) ;; *) case $((args % 4)) in 0 | 2) _filedir ;; 1) COMPREPLY=($( compgen -W '--slave' -- "$cur" )) ;; 3) _installed_alternatives ;; esac ;; esac ;; --remove | --set) case $args in 1) _installed_alternatives ;; 2) _filedir ;; esac ;; --auto | --remove-all | --display | --config) _installed_alternatives ;; *) COMPREPLY=($( compgen -W '--verbose --quiet --help --version \ --altdir --admindir --install --remove --auto --display \ --config --set' -- "$cur" )) ;; esac } _upvar () { if unset -v "$1"; then if (( $# == 2 )); then eval $1=\"\$2\"; else eval $1=\(\"\${@:2}\"\); fi; fi } _upvars () { if ! (( $# )); then echo "${FUNCNAME[0]}: usage: ${FUNCNAME[0]} [-v varname" "value] | [-aN varname [value ...]] ..." 1>&2; return 2; fi; while (( $# )); do case $1 in -a*) [[ -n ${1#-a} ]] || { echo "bash: ${FUNCNAME[0]}: \`$1': missing" "number specifier" 1>&2; return 1 }; printf %d "${1#-a}" >&/dev/null || { echo "bash:" "${FUNCNAME[0]}: \`$1': invalid number specifier" 1>&2; return 1 }; [[ -n "$2" ]] && unset -v "$2" && eval $2=\(\"\${@:3:${1#-a}}\"\) && shift $((${1#-a} + 2)) || { echo "bash: ${FUNCNAME[0]}:" "\`$1${2+ }$2': missing argument(s)" 1>&2; return 1 } ;; -v) [[ -n "$2" ]] && unset -v "$2" && eval $2=\"\$3\" && shift 3 || { echo "bash: ${FUNCNAME[0]}: $1: missing" "argument(s)" 1>&2; return 1 } ;; *) echo "bash: ${FUNCNAME[0]}: $1: invalid option" 1>&2; return 1 ;; esac; done } _usb_ids () { COMPREPLY=(${COMPREPLY[@]:-} $( compgen -W "$( PATH="$PATH:/sbin" lsusb | awk '{print $6}' )" -- "$cur" )) } _user_at_host () { local cur; COMPREPLY=(); _get_comp_words_by_ref -n : cur; if [[ $cur == *@* ]]; then _known_hosts_real "$cur"; else COMPREPLY=($( compgen -u -- "$cur" )); fi; return 0 } _user_or_group () { local i; for ((i=1; i < COMP_CWORD; i++ )) do if [[ "${COMP_WORDS[i]}" == -g ]]; then COMPREPLY=($( compgen -g -- "$cur" )); return 0; fi; done; COMPREPLY=($( compgen -u -- "$cur" )) } _useradd () { local cur prev split=false; COMPREPLY=(); _get_comp_words_by_ref cur prev; _split_longopt && split=true; case $prev in -c | --comment | -h | --help | -e | --expiredate | -f | --inactive | -k | --key | -p | --password | -u | --uid | -Z | --selinux-user) return 0 ;; -b | --base-dir | -d | --home | -k | --skel) _filedir -d; return 0 ;; -g | --gid) _gids; COMPREPLY=($( compgen -W '${COMPREPLY[@]} $( compgen -g )' -- "$cur" )); return 0 ;; -G | --groups) COMPREPLY=($( compgen -g -- "$cur" )); return 0 ;; -s | --shell) _shells; return 0 ;; esac; $split && return 0; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--base-dir --comment --home-dir --defaults \ --expiredate --inactive --gid --groups --help --skel --key \ --no-log-init --create-home --no-create-home --no-user-group \ --non-unique --password --system --shell --uid --user-group \ --selinux-user' -- "$cur" )); return 0; fi } _userdel () { local cur; COMPREPLY=(); _get_comp_words_by_ref cur; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--force --help --remove' -- "$cur" )); return 0; fi; COMPREPLY=($( compgen -u -- "$cur" )) } _usergroup () { if [[ $cur = *\\\\* || $cur = *:*:* ]]; then return; else if [[ $cur = *\\:* ]]; then local prefix; prefix=${cur%%*([^:])}; prefix=${prefix//\\}; local mycur="${cur#*[:]}"; if [[ $1 == -u ]]; then _allowed_groups "$mycur"; else local IFS=' '; COMPREPLY=($( compgen -g -- "$mycur" )); fi; COMPREPLY=($( compgen -P "$prefix" -W "${COMPREPLY[@]}" )); else if [[ $cur = *:* ]]; then local mycur="${cur#*:}"; if [[ $1 == -u ]]; then _allowed_groups "$mycur"; else local IFS=' '; COMPREPLY=($( compgen -g -- "$mycur" )); fi; else if [[ $1 == -u ]]; then _allowed_users "$cur"; else local IFS=' '; COMPREPLY=($( compgen -u -- "$cur" )); fi; fi; fi; fi } _usermod () { local cur prev split=false; COMPREPLY=(); _get_comp_words_by_ref cur prev; _split_longopt && split=true; case $prev in -c | --comment | -d | --home | -e | --expiredate | -f | --inactive | -h | --help | -l | --login | -p | --password | -u | --uid | -Z | --selinux-user) return 0 ;; -g | --gid) _gids; COMPREPLY=($( compgen -W '${COMPREPLY[@]} $( compgen -g )' -- "$cur" )); return 0 ;; -G | --groups) COMPREPLY=($( compgen -g -- "$cur" )); return 0 ;; -s | --shell) _shells; return 0 ;; esac; $split && return 0; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--append --comment --home --expiredate \ --inactive --gid --groups --help --login --lock --move-home \ --non-unique --password --shell --uid --unlock --selinux-user' -- "$cur" )); return 0; fi; COMPREPLY=($( compgen -u -- "$cur" )) } _vgcfgbackup () { local cur prev; COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in -f | --file) _filedir; return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--debug --file --help \ --ignorelockingfailure --partial --verbose \ --version' -- "$cur" )); else _volumegroups; fi } _vgcfgrestore () { local cur prev; COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in -f | --file) _filedir; return 0 ;; -M | --metadatatype) COMPREPLY=($( compgen -W '1 2' -- "$cur" )); return 0 ;; -n | --name) _volumegroups; return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--debug --file --list \ --help --metadatatype --name --test \ --verbose --version' -- "$cur" )); else _volumegroups; fi } _vgchange () { local cur prev; COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in -a | -A | -x | --available | --autobackup | --resizeable) COMPREPLY=($( compgen -W 'y n' -- "$cur" )); return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--autobackup --alloc \ --partial --debug --help --ignorelockingfailure \ --test --uuid --verbose --version \ --available --resizeable --logicalvolume \ --addtag --deltag' -- "$cur" )); else _volumegroups; fi } _vgck () { local cur; COMPREPLY=(); _get_comp_words_by_ref cur; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--debug \ --help --verbose --version' -- "$cur" )); else _volumegroups; fi } _vgconvert () { local cur prev; COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in -M | --metadatatype) COMPREPLY=($( compgen -W '1 2' -- "$cur" )); return 0 ;; --metadatacopies) COMPREPLY=($( compgen -W '0 1 2' -- "$cur" )); return 0 ;; --metadatasize) _sizes; return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--debug --help --labelsector \ --metadatatype --metadatacopies --metadatasize \ --test --verbose --version' -- "$cur" )); else _volumegroups; fi } _vgcreate () { local cur prev; COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in -A | --autobackup) COMPREPLY=($( compgen -W 'y n' -- "$cur" )); return 0 ;; -M | --metadatatype) COMPREPLY=($( compgen -W '1 2' -- "$cur" )); return 0 ;; -s | --physicalextentsize) _sizes; return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--autobackup --addtag --alloc \ --debug --help --maxlogicalvolumes --metadatatype \ --maxphysicalvolumes --physicalextentsize --test \ --verbose --version' -- "$cur" )); else _args; if [ $args -eq 0 ]; then _volumegroups; else _physicalvolumes; fi; fi } _vgdisplay () { local cur prev; COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in --units) _units; return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--colon --columns --units \ --partial --activevolumegroups --verbose \ --debug --help --version' -- "$cur" )); else _volumegroups; fi } _vgextend () { local cur prev; COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in -A | --autobackup) COMPREPLY=($( compgen -W 'y n' -- "$cur" )); return 0 ;; -L | --size) _sizes; return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--autobackup --debug \ --help --test --verbose --version' -- "$cur" )); else _args; if [ $args -eq 0 ]; then _volumegroups; else _physicalvolumes; fi; fi } _vgmerge () { local cur prev; COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in -A | --autobackup) COMPREPLY=($( compgen -W 'y n' -- "$cur" )); return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--autobackup --debug --help \ --list --test --verbose --version' -- "$cur" )); else _volumegroups; fi } _vgmknodes () { local cur; COMPREPLY=(); _get_comp_words_by_ref cur; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--debug --help --verbose \ --version' -- "$cur" )); else _volumegroups; fi } _vgport () { local cur prev; COMPREPLY=(); _get_comp_words_by_ref cur; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--all --debug \ --help --verbose --version' -- "$cur" )); else _volumegroups; fi } _vgreduce () { local cur prev; COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in -A | --autobackup) COMPREPLY=($( compgen -W 'y n' -- "$cur" )); return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--all --autobackup \ --debug --help --removemissing --test \ --verbose --version' -- "$cur" )); else _args; if [ $args -eq 0 ]; then _volumegroups; else _physicalvolumes; fi; fi } _vgremove () { local cur; COMPREPLY=(); _get_comp_words_by_ref cur; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--debug --help --test \ --verbose --version' -- "$cur" )); else _volumegroups; fi } _vgrename () { local cur prev; COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in -A | --autobackup) COMPREPLY=($( compgen -W 'y n' -- "$cur" )); return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--autobackup --debug \ --help --test --verbose --version' -- "$cur" )); else _volumegroups; fi } _vgs () { local cur prev; COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in -o | -O | --options | --sort) COMPREPLY=($( compgen -W 'vg_fmt vg_uuid vg_name \ vg_attr vg_size vg_free vg_sysid \ vg_extent_size vg_extent_count vg_free_count \ max_lv max_pv pv_count lv_count snap_count \ vg_seqno' -- "$cur" )); return 0 ;; --units) _units; return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--aligned --debug \ --help --ignorelockingfailure --noheadings \ --nosuffix --options --sort --partial \ --separator --unbuffered --units \ --verbose --version' -- "$cur" )); else _volumegroups; fi } _vgscan () { local cur; COMPREPLY=(); _get_comp_words_by_ref cur; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--debug --help \ --ignorelockingfailure --mknodes \ --partial --verbose --version' -- "$cur" )); fi } _vgsplit () { local cur prev; COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in -A | --autobackup) COMPREPLY=($( compgen -W 'y n' -- "$cur" )); return 0 ;; -M | --metadatatype) COMPREPLY=($( compgen -W '1 2' -- "$cur" )); return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--autobackup --debug \ --help --list --metadatatype --test \ --verbose --version' -- "$cur" )); else _args; if [[ $args -eq 0 || $args -eq 1 ]]; then _volumegroups; else _physicalvolumes; fi; fi } _vipw () { local cur prev; COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in -h | --help) return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--group --help --passwd \ --quiet --shadow' -- "$cur" )); return 0; fi } _volumegroups () { COMPREPLY=($(compgen -W "$( vgscan 2>/dev/null | sed -n -e 's|.*Found.*"\(.*\)".*$|\1|p' )" -- "$cur" )) } _xhost () { local cur; _get_comp_words_by_ref cur; case $cur in +*) _known_hosts_real -p+ "${cur:1}" ;; -*) _known_hosts_real -p- "${cur:1}" ;; *) _known_hosts_real "$cur" ;; esac; return 0 } _xmllint () { local cur prev; COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in -o | --output) _filedir; return 0 ;; --path | --dtdvalidfpi | --maxmem | --encode | --pattern) return 0 ;; --dtdvalid) _filedir 'dtd?(.gz)'; return 0 ;; --relaxng) _filedir 'rng?(.gz)'; return 0 ;; --schema) _filedir 'xsd?(.gz)'; return 0 ;; --schematron) _filedir 'sch?(.gz)'; return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '$( xmllint --help 2>&1 | \ sed -ne "s/^[[:space:]]*\(--[^[:space:]:]*\).*/\1/p" ) \ -o' -- "$cur" )); return 0; fi; _filedir '@(*ml|htm|svg|xs[dl]|rng|wsdl|jnlp)?(.gz)' } _xmlwf () { local cur prev; COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in -d) _filedir -d; return 0 ;; -e) COMPREPLY=($( compgen -W 'US-ASCII UTF-8 UTF-16 \ ISO-8859-1' -- "$cur" )); return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-c -d -e -m -n -p -r -s -t -v -w \ -x' -- "$cur" )); return 0; fi; _filedir '@(*ml|htm|svg|xs[dl]|rng|wsdl|jnlp)' } _xmodmap () { COMPREPLY=(); local cur prev; _get_comp_words_by_ref cur prev; case $prev in -display | -e) return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-display -help -grammar -verbose -quiet -n -e -pm -pk -pke -pp' -- "$cur" )); return 0; fi; _filedir } _xrandr () { local cur prev output modes; COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in --output) local outputs=$(xrandr|awk '/connected/ {print $1}'); COMPREPLY=($(compgen -W "$outputs" -- "$cur")); return 0 ;; --mode) for ((i = 1; i < COMP_CWORD; i++ )) do if [[ "${COMP_WORDS[i]}" == "--output" ]]; then output=${COMP_WORDS[i+1]}; break; fi; done; modes=$(xrandr|sed -e "1,/$output/ d" -e "/connected/,$ d"|awk '{print $1}'); COMPREPLY=($( compgen -W "$modes" -- "$cur")); return 0 ;; esac; case $cur in *) COMPREPLY=($(compgen -W '-display -help --orientation --query \ --size --rate --version -x -y --screen --verbose --dryrun \ --prop --fb --fbmm --dpi --output --auto --mode --preferred \ --pos --reflect --rotate --left-of --right-of --above --below \ --same-as --set --off --crtc --newmode --rmmode --addmode \ --delmode' -- "$cur")); return 0 ;; esac; return 0 } _xrdb () { COMPREPLY=(); local cur prev; _get_comp_words_by_ref cur prev; case $prev in -backup | -display | -help) return 0 ;; -cpp | -edit) _filedir; return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-help -display -all -global -screen -screens -n -quiet -cpp -nocpp -symbols -query -load -override -merge -remove -retain -edit -backup' -- "$cur" )); return 0; fi; _filedir } _xsltproc () { local cur prev; COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in --output | -o) _filedir; return 0 ;; --maxdepth) return 0 ;; --encoding) COMPREPLY=($( compgen -W "$( iconv -l | sed -e '/^UTF[1378]/d' -e '/^ISO[0-9_]/d' -e '/^8859/d' -e 's/\/.*//')" -- "$cur" )); return 0 ;; --param | --stringparam) return 0 ;; --path) _filedir -d; return 0 ;; --writesubtree) _filedir -d; return 0 ;; esac; [[ $COMP_CWORD -gt 2 && `_get_cword '' 2` == --?(string)param ]] && return 0; if [[ "$cur" == -* ]]; then _longopt xsltproc; else _filedir '@(xsl|xslt|xml)'; fi } _yum () { local cur prev special i split=false; COMPREPLY=(); _get_comp_words_by_ref cur prev; for ((i=0; i < ${#COMP_WORDS[@]}-1; i++ )) do if [[ ${COMP_WORDS[i]} == @(install|update|upgrade|remove|erase|deplist|info) ]]; then special=${COMP_WORDS[i]}; fi; done; if [ -n "$special" ]; then if [[ "$cur" == */* && "$special" == @(deplist|install|update|upgrade) ]]; then _filedir rpm; return 0; fi; case $special in install) _yum_list available; return 0 ;; deplist | info) _yum_list all; return 0 ;; upgrade | update) _yum_list updates; return 0 ;; remove | erase) _yum_list installed; return 0 ;; esac; fi; _split_longopt && split=true; case $prev in list) COMPREPLY=($( compgen -W 'all available updates \ installed extras obsoletes recent' -- $cur )) ;; clean) COMPREPLY=($( compgen -W 'packages headers metadata \ cache dbcache all' -- $cur )) ;; repolist) COMPREPLY=($( compgen -W 'all enabled disabled' -- $cur )) ;; localinstall | localupdate) _filedir rpm ;; -d | -e) COMPREPLY=($( compgen -W '0 1 2 3 4 5 6 7 8 9 10' -- $cur )) ;; -c) _filedir ;; --installroot) _filedir -d ;; --enablerepo) COMPREPLY=($( compgen -W '$( _yum_repolist disabled )' -- $cur )) ;; --disablerepo) COMPREPLY=($( compgen -W '$( _yum_repolist enabled )' -- $cur )) ;; --disableexcludes) COMPREPLY=($( compgen -W '$( _yum_repolist all ) all main' -- $cur )) ;; --enableplugin | --disableplugin) COMPREPLY=($( compgen -W '$( _yum_plugins )' -- $cur )) ;; --color) COMPREPLY=($( compgen -W 'always auto never' -- $cur )) ;; -R | -x | --exclude) return 0 ;; -h | --help | --version) return 0 ;; *) COMPREPLY=($( compgen -W 'install update check-update upgrade \ remove erase list info provides whatprovides clean makecache \ groupinstall groupupdate grouplist groupremove groupinfo \ search shell resolvedep localinstall localupdate deplist \ repolist help' -- $cur )) ;; esac; $split && return 0; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--help --tolerant -C -c -R -d \ --showduplicates -e --quiet --verbose -y --version --installroot \ --enablerepo --disablerepo --exclude --disableexcludes --obsoletes \ --noplugins --nogpgcheck --disableplugin --enableplugin \ --skip-broken --color' -- $cur )); return 0; fi } _yum_list () { if [[ "$1" == all ]]; then COMPREPLY=($( yum -d 0 -C list $1 "$cur*" 2>/dev/null | sed -ne '/^Available /d' -e '/^Installed /d' -e '/^Updated /d' -e 's/[[:space:]].*//p' )); else COMPREPLY=($( yum -d 0 -C list $1 "$cur*" 2>/dev/null | sed -ne 1d -e 's/[[:space:]].*//p' )); fi } _yum_plugins () { command ls /usr/lib/yum-plugins/*.py{,c,o} 2> /dev/null | sed -ne 's|.*/\([^./]*\)\.py[co]\{0,1\}$|\1|p' | sort -u } _yum_repolist () { yum --noplugins -C repolist $1 2> /dev/null | sed -ne '/^repo\s\s*id/d' -e '/^repolist:/d' -e 's/[[:space:]].*//p' } dequote () { eval echo "$1" 2> /dev/null } get_entries () { local IFS=' '; [ -r ${prefix:-}CVS/Entries ] && entries=$(cut -d/ -f2 -s ${prefix:-}CVS/Entries) } get_modules () { if [ -n "$prefix" ]; then COMPREPLY=($( command ls -d ${cvsroot}/${prefix}/!(CVSROOT) )); else COMPREPLY=($( command ls -d ${cvsroot}/!(CVSROOT) )); fi } quote () { echo \'${1//\'/\'\\\'\'}\' } quote_readline () { local quoted; _quote_readline_by_ref "$1" ret; printf %s "$ret" } set_prefix () { [ -z ${prefix:-} ] || prefix=${cur%/*}/; [ -r ${prefix:-}CVS/Entries ] || prefix="" }