File manager - Edit - /home/newsbmcs.com/public_html/static/img/logo/completions.tar
Back
convert 0000644 00000021321 15036124163 0006147 0 ustar 00 # bash completion for ImageMagick -*- shell-script -*- _ImageMagick() { case $prev in -channel) COMPREPLY=($(compgen -W 'Red Green Blue Opacity Matte Cyan Magenta Yellow Black' -- "$cur")) return ;; -colormap) COMPREPLY=($(compgen -W 'shared private' -- "$cur")) return ;; -colorspace) COMPREPLY=($(compgen -W 'GRAY OHTA RGB Transparent XYZ YCbCr YIQ YPbPr YUV CMYK' -- "$cur")) return ;; -compose) COMPREPLY=($(compgen -W 'Over In Out Atop Xor Plus Minus Add Subtract Difference Multiply Bumpmap Copy CopyRed CopyGreen CopyBlue CopyOpacity' -- "$cur")) return ;; -compress) COMPREPLY=($(compgen -W 'None BZip Fax Group4 JPEG Lossless LZW RLE Zip' -- "$cur")) return ;; -dispose) COMPREPLY=($(compgen -W 'Undefined None Background Previous' \ -- "$cur")) return ;; -encoding) COMPREPLY=($(compgen -W 'AdobeCustom AdobeExpert AdobeStandard AppleRoman BIG5 GB2312 Latin2 None SJIScode Symbol Unicode Wansung' -- "$cur")) return ;; -endian) COMPREPLY=($(compgen -W 'MSB LSB' -- "$cur")) return ;; -filter) COMPREPLY=($(compgen -W 'Point Box Triangle Hermite Hanning Hamming Blackman Gaussian Quadratic Cubic Catrom Mitchell Lanczos Bessel Sinc' -- "$cur")) return ;; -format) COMPREPLY=($(compgen -W "$(convert -list format | awk \ '/ [r-][w-][+-] / { sub("[*]$","",$1); print tolower($1) }')" \ -- "$cur")) return ;; -gravity) COMPREPLY=($(compgen -W 'Northwest North NorthEast West Center East SouthWest South SouthEast' -- "$cur")) return ;; -intent) COMPREPLY=($(compgen -W 'Absolute Perceptual Relative Saturation' -- "$cur")) return ;; -interlace) COMPREPLY=($(compgen -W 'None Line Plane Partition' -- "$cur")) return ;; -limit) COMPREPLY=($(compgen -W 'Disk File Map Memory' -- "$cur")) return ;; -list) COMPREPLY=($(compgen -W 'Delegate Format Magic Module Resource Type' -- "$cur")) return ;; -map) COMPREPLY=($(compgen -W 'best default gray red green blue' \ -- "$cur")) _filedir return ;; -noise) COMPREPLY=($(compgen -W 'Uniform Gaussian Multiplicative Impulse Laplacian Poisson' -- "$cur")) return ;; -preview) COMPREPLY=($(compgen -W 'Rotate Shear Roll Hue Saturation Brightness Gamma Spiff Dull Grayscale Quantize Despeckle ReduceNoise AddNoise Sharpen Blur Treshold EdgeDetect Spread Shade Raise Segment Solarize Swirl Implode Wave OilPaint CharcoalDrawing JPEG' -- "$cur")) return ;; -mask | -profile | -texture | -tile | -write) _filedir return ;; -type) COMPREPLY=($(compgen -W 'Bilevel Grayscale Palette PaletteMatte TrueColor TrueColorMatte ColorSeparation ColorSeparationlMatte Optimize' -- "$cur")) return ;; -units) COMPREPLY=($(compgen -W 'Undefined PixelsPerInch PixelsPerCentimeter' -- "$cur")) return ;; -virtual-pixel) COMPREPLY=($(compgen -W 'Constant Edge mirror tile' -- "$cur")) return ;; -visual) COMPREPLY=($(compgen -W 'StaticGray GrayScale StaticColor PseudoColor TrueColor DirectColor defaut visualid' \ -- "$cur")) return ;; esac return 1 } _convert() { local cur prev words cword _init_completion || return _ImageMagick && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1" -help)' -- "$cur")) elif [[ $cur == +* ]]; then COMPREPLY=($(compgen -W '+adjoin +append +compress +contrast +debug +dither +endian +gamma +label +map +mask +matte +negate +noise +page +raise +render +write' -- "$cur")) else _filedir fi } && complete -F _convert convert _mogrify() { local cur prev words cword _init_completion || return _ImageMagick && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1" -help)' -- "$cur")) elif [[ $cur == +* ]]; then COMPREPLY=($(compgen -W '+compress +contrast +debug +dither +endian +gamma +label +map +mask +matte +negate +page +raise' -- "$cur")) else _filedir fi } && complete -F _mogrify mogrify _display() { local cur prev words cword _init_completion || return _ImageMagick && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1" -help)' -- "$cur")) elif [[ $cur == +* ]]; then COMPREPLY=($(compgen -W '+compress +contrast +debug +dither +endian +gamma +label +map +matte +negate +page +raise +write' -- "$cur")) else _filedir fi } && complete -F _display display _animate() { local cur prev words cword _init_completion || return _ImageMagick && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1" -help)' -- "$cur")) elif [[ $cur == +* ]]; then COMPREPLY=($(compgen -W '+debug +dither +gamma +map +matte' \ -- "$cur")) else _filedir fi } && complete -F _animate animate _identify() { local cur prev words cword _init_completion || return _ImageMagick && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1" -help)' -- "$cur")) elif [[ $cur == +* ]]; then COMPREPLY=($(compgen -W '+debug' -- "$cur")) else _filedir fi } && complete -F _identify identify _montage() { local cur prev words cword _init_completion || return _ImageMagick && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1" -help)' -- "$cur")) elif [[ $cur == +* ]]; then COMPREPLY=($(compgen -W '+adjoin +compress +debug +dither +endian +gamma +label +matte +page' -- "$cur")) else _filedir fi } && complete -F _montage montage _composite() { local cur prev words cword _init_completion || return _ImageMagick && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1" -help)' -- "$cur")) elif [[ $cur == +* ]]; then COMPREPLY=($(compgen -W '+compress +debug +dither +endian +label +matte +negate +page +write' -- "$cur")) else _filedir fi } && complete -F _composite composite _compare() { local cur prev words cword _init_completion || return _ImageMagick && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1" -help)' -- "$cur")) elif [[ $cur == +* ]]; then COMPREPLY=($(compgen -W '+debug' -- "$cur")) else _filedir fi } && complete -F _compare compare _conjure() { local cur prev words cword _init_completion || return _ImageMagick && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1" -help)' -- "$cur")) elif [[ $cur == +* ]]; then COMPREPLY=($(compgen -W '+debug' -- "$cur")) else _filedir fi } && complete -F _conjure conjure _import() { local cur prev words cword _init_completion || return _ImageMagick && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1" -help)' -- "$cur")) elif [[ $cur == +* ]]; then COMPREPLY=($(compgen -W '+debug' -- "$cur")) else _filedir fi } && complete -F _import import _stream() { local cur prev words cword _init_completion || return _ImageMagick && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1" -help)' -- "$cur")) elif [[ $cur == +* ]]; then COMPREPLY=($(compgen -W '+debug' -- "$cur")) else _filedir fi } && complete -F _stream stream # ex: filetype=sh firefox 0000644 00000002270 15036124163 0006133 0 ustar 00 # firefox completion -*- shell-script -*- _firefox() { local cur prev words cword split _init_completion -s || return [[ $cur == -MOZ_LOG*=* ]] && prev=${cur%%=*} cur=${cur#*=} case $prev in --help | --version | --display | --UILocale | -MOZ_LOG | --new-window | --new-tab | \ --private-window | --window-size | --search | --start-debugger-server | \ --recording | --debugger-args | -[hvPa]) return ;; --profile | --screenshot) _filedir -d return ;; -MOZ_LOG_FILE) _filedir log return ;; --recording-file) _filedir return ;; --debugger | -d) COMPREPLY=($(compgen -c -- "$cur")) return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return fi _filedir "@(?([xs])htm?(l)|pdf|txt)" } && complete -F _firefox firefox mozilla-firefox iceweasel # ex: filetype=sh _hexdump 0000644 00000001245 15036124163 0006303 0 ustar 00 # hexdump(1) completion -*- shell-script -*- # Use of this file is deprecated on Linux. Upstream completion is # available in util-linux >= 2.23, use that instead. _hexdump() { local cur prev words cword _init_completion || return case $prev in -V | -e | -n | -s) return ;; -f) _filedir return ;; esac if [[ $cur == -* ]]; then local opts="$(_parse_help "$1")" COMPREPLY=($(compgen -W '${opts:-$(_parse_usage "$1")}' -- "$cur")) return fi _filedir } && complete -F _hexdump hexdump hd # ex: filetype=sh hcitool 0000644 00000022610 15036124163 0006132 0 ustar 00 # bash completion for bluez utils -*- shell-script -*- _bluetooth_addresses() { if [[ -n ${COMP_BLUETOOTH_SCAN:-} ]]; then COMPREPLY+=($(compgen -W "$(hcitool scan | awk '/^\t/{print $1}')" -- "$cur")) fi } _bluetooth_devices() { COMPREPLY+=($(compgen -W "$(hcitool dev | awk '/^\t/{print $1}')" -- "$cur")) } _bluetooth_services() { COMPREPLY=($(compgen -W 'DID SP DUN LAN FAX OPUSH FTP HS HF HFAG SAP NAP GN PANU HCRP HID CIP A2SRC A2SNK AVRCT AVRTG UDIUE UDITE SYNCML' \ -- "$cur")) } _bluetooth_packet_types() { COMPREPLY=($(compgen -W 'DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3' \ -- "$cur")) } _hcitool() { local cur prev words cword split _init_completion -s || return case $prev in -i) _bluetooth_devices return ;; --role) COMPREPLY=($(compgen -W 'm s' -- "$cur")) return ;; --pkt-type) _bluetooth_packet_types return ;; esac $split && return local arg _get_first_arg if [[ -z $arg ]]; then if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) else COMPREPLY=($(compgen -W 'dev inq scan name info spinq epinq cmd con cc dc sr cpt rssi lq tpl afh lst auth enc key clkoff clock' -- "$cur")) fi else local args case $arg in name | info | dc | rssi | lq | afh | auth | key | clkoff | lst) _count_args if ((args == 2)); then _bluetooth_addresses fi ;; cc) if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '--role --pkt-type' -- "$cur")) else _count_args if ((args == 2)); then _bluetooth_addresses fi fi ;; sr) _count_args if ((args == 2)); then _bluetooth_addresses else COMPREPLY=($(compgen -W 'master slave' -- "$cur")) fi ;; cpt) _count_args if ((args == 2)); then _bluetooth_addresses else _bluetooth_packet_types fi ;; tpl | enc | clock) _count_args if ((args == 2)); then _bluetooth_addresses else COMPREPLY=($(compgen -W '0 1' -- "$cur")) fi ;; esac fi } && complete -F _hcitool hcitool _sdptool() { local cur prev words cword split _init_completion -s || return case $prev in --bdaddr) _bluetooth_addresses return ;; esac $split && return local arg _get_first_arg if [[ -z $arg ]]; then if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) else COMPREPLY=($(compgen -W 'search browse records add del get setattr setseq' -- "$cur")) fi else case $arg in search) if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '--bdaddr --tree --raw --xml' \ -- "$cur")) else _bluetooth_services fi ;; browse | records) if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '--tree --raw --xml' -- "$cur")) else _bluetooth_addresses fi ;; add) if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '--handle --channel' -- "$cur")) else _bluetooth_services fi ;; get) if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '--bdaddr --tree --raw --xml' \ -- "$cur")) fi ;; esac fi } && complete -F _sdptool sdptool _l2ping() { local cur prev words cword _init_completion || return case $prev in -i) _bluetooth_devices return ;; -s | -c | -t | -d) return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_usage "$1")' -- "$cur")) else _bluetooth_addresses fi } && complete -F _l2ping l2ping _rfcomm() { local cur prev words cword _init_completion || return case $prev in -f | --config) _filedir return ;; -i) _bluetooth_devices _bluetooth_addresses return ;; esac local arg _get_first_arg if [[ -z $arg ]]; then if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) else COMPREPLY=($(compgen -W 'show connect listen watch bind release' -- "$cur")) fi else local args _count_args if ((args == 2)); then _bluetooth_devices else case $arg in connect | bind) if ((args == 3)); then _bluetooth_addresses fi ;; esac fi fi } && complete -F _rfcomm rfcomm _ciptool() { local cur prev words cword _init_completion || return case $prev in -i) _bluetooth_devices _bluetooth_addresses return ;; esac local arg _get_first_arg if [[ -z $arg ]]; then if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) else COMPREPLY=($(compgen -W 'show search connect release loopback' \ -- "$cur")) fi else local args case $arg in connect | release | loopback) _count_args if ((args == 2)); then _bluetooth_addresses fi ;; esac fi } && complete -F _ciptool ciptool _dfutool() { local cur prev words cword _init_completion || return case $prev in -d | --device) _bluetooth_devices return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) else local args _count_args case $args in 1) COMPREPLY=($(compgen -W 'verify modify upgrade archive' \ -- "$cur")) ;; 2) _filedir ;; esac fi } && complete -F _dfutool dfutool _hciconfig() { local cur prev words cword _init_completion || return local arg _get_first_arg if [[ -z $arg ]]; then if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '--help --all' -- "$cur")) else COMPREPLY=($(compgen -W 'up down reset rstat auth noauth encrypt noencrypt secmgr nosecmgr piscan noscan iscan pscan ptype name class voice iac inqmode inqdata inqtype inqparams pageparms pageto afhmode aclmtu scomtu putkey delkey commands features version revision lm' -- "$cur")) fi else local args case $arg in putkey | delkey) _count_args if ((args == 2)); then _bluetooth_addresses fi ;; lm) _count_args if ((args == 2)); then COMPREPLY=($(compgen -W 'MASTER SLAVE NONE ACCEPT' \ -- "$cur")) fi ;; ptype) _count_args if ((args == 2)); then _bluetooth_packet_types fi ;; esac fi } && complete -F _hciconfig hciconfig _hciattach() { local cur prev words cword _init_completion || return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '-n -p -t -b -s -l' -- "$cur")) else local args _count_args case $args in 1) COMPREPLY=($(printf '%s\n' /dev/tty*)) COMPREPLY=($(compgen -W '${COMPREPLY[@]} ${COMPREPLY[@]#/dev/}' -- "$cur")) ;; 2) COMPREPLY=($(compgen -W 'any ericsson digi xircom csr bboxes swave bcsp 0x0105 0x080a 0x0160 0x0002' -- "$cur")) ;; 3) COMPREPLY=($(compgen -W '9600 19200 38400 57600 115200 230400 460800 921600' -- "$cur")) ;; 4) COMPREPLY=($(compgen -W 'flow noflow' -- "$cur")) ;; 5) _bluetooth_addresses ;; esac fi } && complete -F _hciattach hciattach # ex: filetype=sh tcpnice 0000644 00000000657 15036124163 0006125 0 ustar 00 # tcpnice completion -*- shell-script -*- _tcpnice() { local cur prev words cword _init_completion || return case $prev in -*i) _available_interfaces -a return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_usage "$1")' -- "$cur")) fi } && complete -F _tcpnice tcpnice # ex: filetype=sh wol 0000644 00000002250 15036124163 0005270 0 ustar 00 # wol(1) completion -*- shell-script -*- _wol() { local cur prev words cword split _init_completion -s -n : || return case $prev in --version | --help | --port | --passwd | --wait | -!(-*)[Vpw]) return ;; --host | --ipaddr | -!(-*)[hi]) # Broadcast addresses local PATH=$PATH:/sbin COMPREPLY=($({ ip addr show || ifconfig -a } 2>/dev/null | command sed -ne 's/.*[[:space:]]Bcast:\([^[:space:]]*\).*/\1/p' -ne \ 's/.*inet.*[[:space:]]brd[[:space:]]\([^[:space:]]*\).*/\1/p' -ne \ 's/.*[[:space:]]broadcast[[:space:]]\{1,\}\([^[:space:]]*\).*/\1/p')) _known_hosts_real -- "$cur" return ;; --file | -!(-*)f) _filedir return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return fi _mac_addresses } && complete -F _wol wol # ex: filetype=sh gendiff 0000644 00000000413 15036124163 0006070 0 ustar 00 # gendiff(1) completion -*- shell-script -*- _gendiff() { local cur prev words cword _init_completion -o '@(diff|patch)' || return ((cword == 1)) && _filedir -d } && complete -F _gendiff gendiff # ex: filetype=sh debconf 0000644 00000000446 15036124163 0006074 0 ustar 00 _have debconf-show && _debconf_show() { local cur COMPREPLY=() cur=${COMP_WORDS[COMP_CWORD]} COMPREPLY=($( compgen -W '--listowners --listdbs --db=' -- $cur ) \ $( apt-cache pkgnames -- $cur ) ) } complete -F _debconf_show debconf-show newusers 0000644 00000001222 15036124163 0006340 0 ustar 00 # newusers(8) completion -*- shell-script -*- _newusers() { local cur prev words cword split _init_completion -s || return case $prev in -c | --crypt) COMPREPLY=($(compgen -W 'DES MD5 NONE SHA256 SHA512' -- "$cur")) return ;; -s | --sha-rounds) return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return fi _filedir } && complete -F _newusers newusers # ex: filetype=sh jar 0000644 00000000761 15036124163 0005250 0 ustar 00 # jar(1) completion -*- shell-script -*- _jar() { local cur prev words cword _init_completion || return if ((cword == 1)); then COMPREPLY=($(compgen -W 'c t x u' -- "$cur")) return fi case ${words[1]} in *c*f) _filedir ;; *f) _filedir_xspec unzip ;; *) _filedir ;; esac } && complete -F _jar jar # ex: filetype=sh gcc 0000644 00000005163 15036124163 0005231 0 ustar 00 # gcc(1) completion -*- shell-script -*- _gcc() { local cur prev prev2 words cword argument prefix prefix_length _init_completion || return # Test that GCC is recent enough and if not fallback to # parsing of --completion option. if ! $1 --completion=" " 2>/dev/null; then if [[ $cur == -* ]]; then local cc=$($1 -print-prog-name=cc1 2>/dev/null) [[ $cc ]] || return COMPREPLY=($(compgen -W "$($cc --help 2>/dev/null | tr '\t' ' ' | command sed -e '/^ *-/!d' -e 's/ *-\([^][ <>]*\).*/-\1/')" \ -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace else _filedir fi return fi # extract also for situations like: -fsanitize=add if ((cword > 2)); then prev2="${COMP_WORDS[cword - 2]}" fi # sample: -fsan if [[ $cur == -* ]]; then argument=$cur prefix="" # sample: -fsanitize= elif [[ $cur == "=" && $prev == -* ]]; then argument=$prev$cur prefix=$prev$cur # sample: -fsanitize=add elif [[ $prev == "=" && $prev2 == -* ]]; then argument=$prev2$prev$cur prefix=$prev2$prev # sample: --param lto- elif [[ $prev == --param ]]; then argument="$prev $cur" prefix="$prev " fi if [[ ! -v argument ]]; then _filedir else # In situation like '-fsanitize=add' $cur is equal to last token. # Thus we need to strip the beginning of suggested option. prefix_length=$((${#prefix} + 1)) local flags=$($1 --completion="$argument" | cut -c $prefix_length-) [[ ${flags} == "=*" ]] && compopt -o nospace 2>/dev/null COMPREPLY=($(compgen -W "$flags" -- "")) fi } && complete -F _gcc gcc{,-5,-6,-7,-8} g++{,-5,-6,-7,-8} g77 g95 \ gccgo{,-5,-6,-7,-8} gcj gfortran{,-5,-6,-7,-8} gpc && { cc --version 2>/dev/null | command grep -q GCC || [[ $(_realcommand cc) == *gcc* ]] && complete -F _gcc cc || complete -F _minimal cc c++ --version 2>/dev/null | command grep -q GCC || [[ $(_realcommand c++) == *g++* ]] && complete -F _gcc c++ || complete -F _minimal c++ f77 --version 2>/dev/null | command grep -q GCC || [[ $(_realcommand f77) == *gfortran* ]] && complete -F _gcc f77 || complete -F _minimal f77 f95 --version 2>/dev/null | command grep -q GCC || [[ $(_realcommand f95) == *gfortran* ]] && complete -F _gcc f95 || complete -F _minimal f95 } # ex: filetype=sh mailmanctl 0000644 00000000717 15036124163 0006616 0 ustar 00 # mailmanctl completion -*- shell-script -*- _mailmanctl() { local cur prev words cword _init_completion || return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '--no-restart --run-as-user --stale-lock-cleanup --quiet --help' -- "$cur")) else COMPREPLY=($(compgen -W 'start stop restart reopen' -- "$cur")) fi } && complete -F _mailmanctl mailmanctl # ex: filetype=sh export 0000644 00000002757 15036124163 0006024 0 ustar 00 # bash export completion -*- shell-script -*- _export() { local cur prev words cword _init_completion -n = || return local i action=variable remove=false for ((i = 1; i < cword; i++)); do case ${words[i]} in -p) return ;; -*f*) action=function ;;& -*n*) remove=true ;; -*) continue ;; esac break done if [[ $cur == *=* ]]; then _variable_assignments $cur && return fi case $cur in *=) local pval=$(quote "$(eval printf %s \"\$\{${cur%=}-\}\")") # Complete previous value if it's not empty. if [[ $pval != \'\' ]]; then COMPREPLY=("$pval") else cur=${cur#*=} _filedir fi ;; *=*) cur=${cur#*=} _filedir ;; *) if [[ $cword -eq 1 && $cur == -* ]]; then COMPREPLY=($(compgen -W '-p $(_parse_usage "$1")' -- "$cur")) return fi local suffix="" if ! $remove; then suffix="=" compopt -o nospace fi COMPREPLY=($(compgen -A $action -S "$suffix" -- "$cur")) ;; esac } && complete -F _export export # ex: filetype=sh ypmatch 0000644 00000001367 15036124163 0006144 0 ustar 00 # bash completion for yp-tools -*- shell-script -*- _ypmatch() { local cur prev words cword _init_completion || return local map cmd=${1##*/} [[ $cmd == ypcat && $cword -gt 1 ]] && return [[ $cmd == ypmatch && $cword -gt 2 ]] && return if [[ $cmd == ypmatch && $cword -eq 1 && ${#words[@]} -eq 3 ]]; then map=${words[2]} COMPREPLY=($(compgen -W '$(ypcat $map 2>/dev/null | \ cut -d':' -f 1)' -- "$cur")) else [[ $cmd == ypmatch && $cword -ne 2 ]] && return COMPREPLY=($(compgen -W \ '$(printf "%s\n" $(ypcat -x 2>/dev/null | \ cut -d"\"" -f 2))' -- "$cur")) fi } && complete -F _ypmatch ypmatch ypcat # ex: filetype=sh chmod 0000644 00000001611 15036124163 0005561 0 ustar 00 # chmod(1) completion -*- shell-script -*- _chmod() { local cur prev words cword split _init_completion -s || return case $prev in --help | --version) return ;; --reference) _filedir return ;; esac $split && return # Adapted from coreutils 8.28 chmod man page local modearg="-@(@(+([rwxXst])|[ugo])|+([0-7]))" # shellcheck disable=SC2053 if [[ $cur == -* && $cur != $modearg ]]; then local opts=$(_parse_help "$1") COMPREPLY=($(compgen -W '${opts:-$(_parse_usage "$1")}' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return fi local args _count_args "" "" "$modearg" case $args in 1) ;; # mode *) _filedir ;; esac } && complete -F _chmod chmod # ex: filetype=sh medusa 0000644 00000001240 15036124163 0005743 0 ustar 00 # bash completion for medusa -*- shell-script -*- _medusa() { local cur prev words cword _init_completion || return case $prev in -*h) _known_hosts_real -- "$cur" return ;; -*[HUPCO]) _filedir return ;; -*M) COMPREPLY=($(compgen -W "$($1 -d | awk '/^ +\+/ {print $2}' | command sed -e 's/\.mod$//')")) return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) fi } && complete -F _medusa medusa # ex: filetype=sh lz4 0000644 00000002222 15036124163 0005177 0 ustar 00 # lz4 completion -*- shell-script -*- _lz4() { local cur prev words cword _init_completion || return case $prev in -b) _filedir return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -X '-*#*' -W \ '$(_parse_help "$1" -h) -B{4..7} -i{1..9}' -- "$cur")) return fi local args word xspec="*.?(t)lz4" _count_args ((args > 2)) && return for word in "${words[@]}"; do case $word in -*[dt]*) case $args in 1) xspec="!"$xspec ;; 2) [[ $word == *t* ]] && return ;; esac break ;; -z) case $args in 1) xspec= ;; 2) xspec="!"$xspec ;; esac break ;; esac done _tilde "$cur" || return local IFS=$'\n' compopt -o filenames COMPREPLY=($(compgen -f -X "$xspec" -- "$cur") $(compgen -d -- "$cur")) } && complete -F _lz4 lz4 lz4c # ex: filetype=sh bzip2 0000644 00000002054 15036124163 0005517 0 ustar 00 # bash completion for bzip2 -*- shell-script -*- _bzip2() { local cur prev words cword _init_completion || return case $prev in --help | -!(-*)[bhp]) return ;; -!(-*)n) COMPREPLY=($(compgen -W "{1..$(_ncpus)}" -- "$cur")) return ;; esac if [[ $cur == -* ]]; then local helpopts=$(_parse_help "$1") COMPREPLY=($(compgen -W "${helpopts//#/} -2 -3 -4 -5 -6 -7 -8 -9" \ -- "$cur")) return fi local IFS=$'\n' xspec="*.?(t)bz2" if [[ $prev == --* ]]; then [[ $prev == --@(decompress|list|test) ]] && xspec="!"$xspec [[ $prev == --compress ]] && xspec= elif [[ $prev == -* ]]; then [[ $prev == -*[dt]* ]] && xspec="!"$xspec [[ $prev == -*z* ]] && xspec= fi _tilde "$cur" || return compopt -o filenames COMPREPLY=($(compgen -f -X "$xspec" -- "$cur") $(compgen -d -- "$cur")) } && complete -F _bzip2 bzip2 pbzip2 lbzip2 # ex: filetype=sh lzip 0000644 00000002167 15036124163 0005454 0 ustar 00 # lzip(1) completion -*- shell-script -*- _lzip() { local cur prev words cword split _init_completion -s || return local decompress=false case $prev in --help | --version | --member-size | --match-length | --dictionary-size | \ --volume-size | --data-size | -!(-*)@([bmsSB]|[hV]*)) return ;; --decompress-!(-*)d) decompress=true ;; --threads-!(-*)n) COMPREPLY=($(compgen -W "{1..$(_ncpus)}" -- "$cur")) return ;; --output-!(-*)o) _filedir return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1") {-1..-9}' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return fi if $decompress; then _filedir lz return fi local IFS=$'\n' compopt -o filenames COMPREPLY=($(compgen -f -X "*.lz" -- "$cur") $(compgen -d -- "$cur")) } && complete -F _lzip clzip lzip pdlzip plzip # ex: filetype=sh systemd-cat 0000644 00000003266 15036124163 0006734 0 ustar 00 # systemd-cat(1) completion -*- shell-script -*- # SPDX-License-Identifier: LGPL-2.1-or-later # # This file is part of systemd. # # # systemd is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version. # # systemd is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with systemd; If not, see <http://www.gnu.org/licenses/>. __contains_word() { local w word=$1; shift for w in "$@"; do [[ $w = "$word" ]] && return done } _systemd_cat() { local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} words cword local i verb comps local -A OPTS=( [STANDALONE]='-h --help --version' [ARG]='-t --identifier -p --priority --level-prefix' ) _init_completion || return if __contains_word "$prev" ${OPTS[ARG]}; then case $prev in --identifier|-t) comps='' ;; --priority|-p) comps='emerg alert crit err warning notice info debug' ;; --level-prefix) comps='yes no' ;; esac COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 fi COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") ) } complete -F _systemd_cat systemd-cat povray 0000644 00000004010 15036124163 0006003 0 ustar 00 # povray completion -*- shell-script -*- # by "David Necas (Yeti)" <yeti@physics.muni.cz> _povray() { local cur prev words cword _init_completion || return local povcur=$cur pfx oext defoext defoext=png # default output extension, if cannot be determined FIXME _expand || return case $povcur in [-+]I*) cur="${povcur#[-+]I}" # to confuse _filedir pfx="${povcur%"$cur"}" _filedir pov COMPREPLY=(${COMPREPLY[@]/#/$pfx}) return ;; [-+]O*) # guess what output file type user may want case $( IFS=$'\n' command grep '^[-+]F' <<<"${words[*]}" ) in [-+]FN) oext=png ;; [-+]FP) oext=ppm ;; [-+]F[CT]) oext=tga ;; *) oext=$defoext ;; esac # complete filename corresponding to previously specified +I COMPREPLY=($( IFS=$'\n' command grep '^[-+]I' <<<"${words[*]}" )) COMPREPLY=(${COMPREPLY[@]#[-+]I}) COMPREPLY=(${COMPREPLY[@]/%.pov/.$oext}) cur="${povcur#[-+]O}" # to confuse _filedir pfx="${povcur%"$cur"}" _filedir $oext COMPREPLY=(${COMPREPLY[@]/#/$pfx}) return ;; *.ini\[ | *.ini\[*[^]]) # sections in .ini files cur="${povcur#*\[}" pfx="${povcur%\["$cur"}" # prefix == filename [[ -r $pfx ]] || return COMPREPLY=($(command sed -e 's/^[[:space:]]*\[\('"$cur"'[^]]*\]\).*$/\1/' \ -e 't' -e 'd' -- "$pfx")) # to prevent [bar] expand to nothing. can be done more easily? COMPREPLY=("${COMPREPLY[@]/#/${pfx}[}") return ;; *) _filedir '@(ini|pov)' return ;; esac } && complete -F _povray povray xpovray spovray # ex: filetype=sh vncviewer 0000644 00000005640 15036124163 0006505 0 ustar 00 # bash completion for vncviewer -*- shell-script -*- _vncviewer_bootstrap() { local fname case $(_realcommand vncviewer) in *xvnc4viewer) fname=_xvnc4viewer ;; *tightvncviewer) fname=_tightvncviewer ;; *) fname=_known_hosts ;; esac # Install real completion for subsequent completions complete -F $fname vncviewer $fname # Generate completions once for now unset -f _vncviewer_bootstrap } && complete -F _vncviewer_bootstrap vncviewer _tightvncviewer() { local cur prev words cword _init_completion || return case $prev in -passwd) _filedir return ;; -encodings) COMPREPLY=($(compgen -W 'copyrect tight hextile zlib corre rre raw' -- "$cur")) return ;; -via) _known_hosts_real -- "$cur" return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '-help -listen -via -shared -noshared -viewonly -fullscreen -noraiseonbeep -passwd -encodings -bgr233 -owncmap -truecolour -truecolor -depth -compresslevel -quality -nojpeg -nocursorshape -x11cursor' -- "$cur")) else _known_hosts_real -- "$cur" fi } && complete -F _tightvncviewer tightvncviewer # NOTE: - VNC Viewer options are case insensitive. # Preferred case is taken from -help. _xvnc4viewer() { local cur prev words cword _init_completion || return # Both single dash (-) and double dash (--) are allowed as option prefix local opt=${prev/#--/-} case ${opt,,} in # -passwd, -PasswordFile -passwd | -passwordfile) _filedir return ;; -preferredencoding) COMPREPLY=($(compgen -W 'zrle hextile raw' -- "$cur")) return ;; -via) _known_hosts_real -- "$cur" return ;; esac if [[ $cur == -* || $cur == --* ]]; then # Default to vncviewer camelcase options, see `vncviewer -help' local dash options=(AcceptClipboard AutoSelect DebugDelay display DotWhenNoCursor FullColor FullColour FullScreen geometry help listen Log LowColourLevel MenuKey name Parent passwd PasswordFile PointerEventInterval PreferredEncoding SendClipboard SendPrimary Shared UseLocalCursor via ViewOnly WMDecorationHeight WMDecorationWidth ZlibLevel) [[ $cur == --* ]] && dash=-- || dash=- local IFS=$' \t\n' reset=$(shopt -p nocasematch) shopt -s nocasematch local option COMPREPLY=($(for option in "${options[@]}"; do [[ $dash$option == "$cur"* ]] && printf '%s\n' $dash$option done)) $reset else _known_hosts_real -- "$cur" fi } && complete -F _xvnc4viewer xvnc4viewer # ex: filetype=sh localectl 0000644 00000006375 15036124163 0006445 0 ustar 00 # localectl(1) completion -*- shell-script -*- # SPDX-License-Identifier: LGPL-2.1-or-later # # This file is part of systemd. # # Copyright © 2010 Ran Benita # # systemd is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version. # # systemd is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with systemd; If not, see <http://www.gnu.org/licenses/>. __contains_word () { local w word=$1; shift for w in "$@"; do [[ $w = "$word" ]] && return done } __locale_fields=( LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT LC_IDENTIFICATION ) # LC_ALL is omitted on purpose _localectl() { local i verb comps locale_vals local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} local OPTS='-h --help --version --no-convert --no-pager --no-ask-password -H --host -M --machine' if __contains_word "$prev" $OPTS; then case $prev in --host|-H) comps='' ;; esac COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 fi if [[ $cur = -* ]]; then COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") ) return 0 fi local -A VERBS=( [STANDALONE]='status list-locales list-keymaps list-x11-keymap-models list-x11-keymap-layouts list-x11-keymap-options' [VARIANTS]='list-x11-keymap-variants' [LOCALES]='set-locale' [KEYMAPS]='set-keymap' [X11]='set-x11-keymap' ) for ((i=0; i < COMP_CWORD; i++)); do if __contains_word "${COMP_WORDS[i]}" ${VERBS[*]}; then verb=${COMP_WORDS[i]} break fi done if [[ -z ${verb-} ]]; then comps=${VERBS[*]} elif __contains_word "$verb" ${VERBS[VARIANTS]}; then comps=$(command localectl list-x11-keymap-layouts) elif __contains_word "$verb" ${VERBS[LOCALES]}; then if [[ $cur = *=* ]]; then mapfile -t locale_vals < <(command localectl list-locales 2>/dev/null) COMPREPLY=( $(compgen -W '${locale_vals[*]}' -- "${cur#=}") ) elif [[ $prev = "=" ]]; then mapfile -t locale_vals < <(command localectl list-locales 2>/dev/null) COMPREPLY=( $(compgen -W '${locale_vals[*]}' -- "$cur") ) else compopt -o nospace COMPREPLY=( $(compgen -W '${__locale_fields[*]}' -S= -- "$cur") ) fi return 0 elif __contains_word "$verb" ${VERBS[KEYMAPS]}; then comps=$(command localectl list-keymaps) elif __contains_word "$verb" ${VERBS[STANDALONE]} ${VERBS[X11]}; then comps='' fi COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 } complete -F _localectl localectl arp 0000644 00000003073 15036124163 0005255 0 ustar 00 # arp(8) completion -*- shell-script -*- _arp() { local cur prev words cword _init_completion || return case $prev in --device | -!(-*)i) _available_interfaces -a return ;; --protocol | -!(-*)[Ap]) # TODO protocol/address family return ;; --file | -!(-*)f) _filedir return ;; --hw-type | -!(-*)[Ht]) # TODO: parse from --help output? COMPREPLY=($(compgen -W 'ash ether ax25 netrom rose arcnet \ dlci fddi hippi irda x25 eui64' -- "$cur")) return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) return fi local args _count_args "" "@(--device|--protocol|--file|--hw-type|-!(-*)[iApfHt])" case $args in 1) local ips=$("$1" -an | command sed -ne \ 's/.*(\([0-9]\{1,3\}\(\.[0-9]\{1,3\}\)\{3\}\)).*/\1/p') COMPREPLY=($(compgen -W '$ips' -- "$cur")) ;; 2) # TODO if -d mode: "pub"; if not -f mode: hw_addr # TODO hw_addr is a configured interface with --use-device/-*D* ;; 3) # TODO netmask|pub|temp if -s mode ;; 4) # TODO netmask value if previous was "netmask" ;; 5) # TODO "pub" if 3rd was "netmask" ;; esac } && complete -F _arp arp # ex: filetype=sh ipcrm 0000644 00000002617 15036124163 0005610 0 ustar 00 _ipcrm_module() { local cur prev OPTS KEYIDS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-m'|'--shmem-id') KEYIDS="$(ipcs -m | awk '{if (3 < NR) {print $2}}')" COMPREPLY=( $(compgen -W "$KEYIDS" -- $cur) ) return 0 ;; '-M'|'--shmem-key') KEYIDS="$(ipcs -m | awk '{if (3 < NR) {print $1}}')" COMPREPLY=( $(compgen -W "$KEYIDS" -- $cur) ) return 0 ;; '-q'|'--queue-id') KEYIDS="$(ipcs -q | awk '{if (3 < NR) {print $2}}')" COMPREPLY=( $(compgen -W "$KEYIDS" -- $cur) ) return 0 ;; '-Q'|'--queue-key') KEYIDS="$(ipcs -q | awk '{if (3 < NR) {print $1}}')" COMPREPLY=( $(compgen -W "$KEYIDS" -- $cur) ) return 0 ;; '-s'|'--semaphore-id') KEYIDS="$(ipcs -s | awk '{if (3 < NR) {print $2}}')" COMPREPLY=( $(compgen -W "$KEYIDS" -- $cur) ) return 0 ;; '-S'|'--semaphore-key') KEYIDS="$(ipcs -s | awk '{if (3 < NR) {print $1}}')" COMPREPLY=( $(compgen -W "$KEYIDS" -- $cur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in '=') cur=${cur#=} COMPREPLY=( $(compgen -W "shm msg sem" -- $cur) ) return 0 ;; esac OPTS=" --shmem-id --shmem-key --queue-id --queue-key --semaphore-id --semaphore-key --all= --verbose --help --version" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 } complete -F _ipcrm_module ipcrm macof 0000644 00000000650 15036124163 0005556 0 ustar 00 # macof completion -*- shell-script -*- _macof() { local cur prev words cword _init_completion || return case $prev in -i) _available_interfaces -a return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_usage "$1")' -- "$cur")) fi } && complete -F _macof macof # ex: filetype=sh rmlist 0000644 00000000553 15036124163 0006005 0 ustar 00 # mailman rmlist completion -*- shell-script -*- _rmlist() { local cur prev words cword _init_completion || return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '--archives --help' -- "$cur")) else _xfunc list_lists _mailman_lists fi } && complete -F _rmlist rmlist # ex: filetype=sh function 0000644 00000002361 15036124163 0006317 0 ustar 00 # bash shell function completion -*- shell-script -*- _function() { local cur prev words cword _init_completion || return if [[ $1 == @(declare|typeset) ]]; then if [[ $cur == [-+]* ]]; then local opts opts=($(_parse_usage "$1")) # Most options also have a '+' form. We'll exclude the ones that don't with compgen. opts+=(${opts[*]/-/+}) COMPREPLY=($(compgen -W "${opts[*]}" -X '+[Ffgp]' -- "$cur")) else local i=1 while [[ ${words[i]} == [-+]* ]]; do if [[ ${words[i]} == -*[fF]* ]]; then COMPREPLY=($(compgen -A function -- "$cur")) return fi ((i++)) done if ((i > 1)); then # There was at least one option and it was not one that limited operations to functions COMPREPLY=($(compgen -A variable -- "$cur")) fi fi elif ((cword == 1)); then COMPREPLY=($(compgen -A function -- "$cur")) else COMPREPLY=("() $(type -- ${words[1]} | command sed -e 1,2d)") fi } && complete -F _function function declare typeset # ex: filetype=sh withlist 0000644 00000000633 15036124163 0006341 0 ustar 00 # mailman withlist completion -*- shell-script -*- _withlist() { local cur prev words cword _init_completion || return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '--lock --interactive --run --all --quiet --help' -- "$cur")) else _xfunc list_lists _mailman_lists fi } && complete -F _withlist withlist # ex: filetype=sh hid2hci 0000644 00000000534 15036124163 0006004 0 ustar 00 # hid2hci completion -*- shell-script -*- _hid2hci() { local cur prev words cword _init_completion || return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '--help --quiet -0 --tohci -1 --tohid' \ -- "$cur")) fi } && complete -F _hid2hci hid2hci # ex: filetype=sh chrt 0000644 00000001630 15036124163 0005430 0 ustar 00 _chrt_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-h'|'--help'|'-V'|'--version') return 0 ;; '-T'|'--sched-runtime'|'-P'|'--sched-period'|'-D'|'--sched-deadline') COMPREPLY=( $(compgen -W "nanoseconds" -- $cur) ) return 0 ;; esac case $cur in -*) OPTS=" --all-tasks --batch --deadline --fifo --help --idle --max --other --pid --reset-on-fork --rr --sched-deadline --sched-period --sched-runtime --verbose --version " COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac local i for i in ${COMP_WORDS[*]}; do case $i in '-p'|'--pid') COMPREPLY=( $(compgen -W "$(cd /proc && echo [0-9]*)" -- $cur) ) return 0 ;; esac done COMPREPLY=( $(compgen -c -- $cur) ) return 0 } complete -F _chrt_module chrt _umount 0000644 00000001167 15036124163 0006163 0 ustar 00 # umount(8) completion -*- shell-script -*- # Use of this file is deprecated on Linux. Upstream completion is # available in util-linux >= 2.28, use that instead. if [[ $OSTYPE == *linux* ]]; then . "$BASH_SOURCE.linux" return fi # umount(8) completion. This relies on the mount point being the third # space-delimited field in the output of mount(8) # _umount() { local cur prev words cword _init_completion || return local IFS=$'\n' COMPREPLY=($(compgen -W '$(mount | cut -d" " -f 3)' -- "$cur")) } && complete -F _umount -o dirnames umount # ex: filetype=sh grub 0000644 00000024614 15036124163 0005436 0 ustar 00 # # Bash completion for grub # # Copyright (C) 2010 Free Software Foundation, Inc. # # GRUB is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # GRUB is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GRUB. If not, see <http://www.gnu.org/licenses/>. # bash completion for grub __grub_dir() { local i c=1 boot_dir for (( c=1; c <= ${#COMP_WORDS[@]}; c++ )); do i="${COMP_WORDS[c]}" case "$i" in --boot-directory) c=$((++c)) i="${COMP_WORDS[c]}" boot_dir="${i##*=}"; break ;; esac done boot_dir=${boot_dir-/boot} echo "${boot_dir%/}/grub" } # This function generates completion reply with compgen # - arg: accepts 1, 2, 3, or 4 arguments # $1 wordlist separate by space, tab or newline # $2 (optional) prefix to add # $3 (optional) current word to complete # $4 (optional) suffix to add __grubcomp () { local cur="${COMP_WORDS[COMP_CWORD]}" if [ $# -gt 2 ]; then cur="$3" fi case "$cur" in --*=) COMPREPLY=() ;; *) local IFS=' '$'\t'$'\n' COMPREPLY=($(compgen -P "${2-}" -W "${1-}" -S "${4-}" -- "$cur")) ;; esac } # Function that return long options from the help of the command # - arg: $1 (optional) command to get the long options from __grub_get_options_from_help () { local prog if [ $# -ge 1 ]; then prog="$1" else prog="${COMP_WORDS[0]}" fi local i IFS=" "$'\t'$'\n' for i in $(LC_ALL=C $prog --help) do case $i in --*) echo "${i%=*}";; esac done } # Function that return long options from the usage of the command # - arg: $1 (optional) command to get the long options from __grub_get_options_from_usage () { local prog if [ $# -ge 1 ]; then prog="$1" else prog="${COMP_WORDS[0]}" fi local i IFS=" "$'\t'$'\n' for i in $(LC_ALL=C $prog --usage) do case $i in \[--*\]) i=${i#[} # Remove leading [ echo ${i%%?(=*)]} # Remove optional value and trailing ] ;; esac done } __grub_get_last_option () { local i for (( i=$COMP_CWORD-1; i > 0; i-- )); do if [[ "${COMP_WORDS[i]}" == -* ]]; then echo "${COMP_WORDS[i]}" break; fi done } __grub_list_menuentries () { local cur="${COMP_WORDS[COMP_CWORD]}" local config_file=$(__grub_dir)/grub.cfg if [ -f "$config_file" ];then local IFS=$'\n' COMPREPLY=( $(compgen \ -W "$( awk -F "[\"']" '/menuentry/ { print $2 }' $config_file )" \ -- "$cur" )) #'# Help emacs syntax highlighting fi } __grub_list_modules () { local grub_dir=$(__grub_dir) local IFS=$'\n' COMPREPLY=( $( compgen -f -X '!*/*.mod' -- "${grub_dir}/$cur" | { while read -r tmp; do [ -n $tmp ] && { tmp=${tmp##*/} printf '%s\n' ${tmp%.mod} } done } )) } # # grub-set-default & grub-reboot # _grub_set_entry () { local cur prev split=false COMPREPLY=() cur=`_get_cword` prev=${COMP_WORDS[COMP_CWORD-1]} _split_longopt && split=true case "$prev" in --boot-directory) _filedir -d return ;; esac $split && return 0 if [[ "$cur" == -* ]]; then __grubcomp "$(__grub_get_options_from_help)" else # Default complete with a menuentry __grub_list_menuentries fi } __grub_set_default_program="grub-set-default" complete -F _grub_set_entry -o filenames ${__grub_set_default_program} unset __grub_set_default_program __grub_reboot_program="grub-reboot" complete -F _grub_set_entry -o filenames ${__grub_reboot_program} unset __grub_reboot_program # # grub-editenv # _grub_editenv () { local cur prev COMPREPLY=() cur=`_get_cword` prev=${COMP_WORDS[COMP_CWORD-1]} case "$prev" in create|list|set|unset) COMPREPLY=( "" ) return ;; esac __grubcomp "$(__grub_get_options_from_help) create list set unset" } __grub_editenv_program="grub-editenv" complete -F _grub_editenv -o filenames ${__grub_editenv_program} unset __grub_editenv_program # # grub-mkconfig # _grub_mkconfig () { local cur prev COMPREPLY=() cur=`_get_cword` if [[ "$cur" == -* ]]; then __grubcomp "$(__grub_get_options_from_help)" else _filedir fi } __grub_mkconfig_program="grub-mkconfig" complete -F _grub_mkconfig -o filenames ${__grub_mkconfig_program} unset __grub_mkconfig_program # # grub-setup # _grub_setup () { local cur prev split=false COMPREPLY=() cur=`_get_cword` prev=${COMP_WORDS[COMP_CWORD-1]} _split_longopt && split=true case "$prev" in -d|--directory) _filedir -d return ;; esac $split && return 0 if [[ "$cur" == -* ]]; then __grubcomp "$(__grub_get_options_from_help)" else # Default complete with a filename _filedir fi } __grub_bios_setup_program="grub-bios-setup" complete -F _grub_setup -o filenames ${__grub_bios_setup_program} unset __grub_bios_setup_program __grub_sparc64_setup_program="grub-sparc64-setup" complete -F _grub_setup -o filenames ${__grub_sparc64_setup_program} unset __grub_sparc64_setup_program # # grub-install # _grub_install () { local cur prev last split=false COMPREPLY=() cur=`_get_cword` prev=${COMP_WORDS[COMP_CWORD-1]} last=$(__grub_get_last_option) _split_longopt && split=true case "$prev" in --boot-directory) _filedir -d return ;; --disk-module) __grubcomp "biosdisk ata" return ;; esac $split && return 0 if [[ "$cur" == -* ]]; then __grubcomp "$(__grub_get_options_from_help)" else case "$last" in --modules) __grub_list_modules return ;; esac # Default complete with a filename _filedir fi } __grub_install_program="grub-install" complete -F _grub_install -o filenames ${__grub_install_program} unset __grub_install_program # # grub-mkfont # _grub_mkfont () { local cur COMPREPLY=() cur=`_get_cword` if [[ "$cur" == -* ]]; then __grubcomp "$(__grub_get_options_from_help)" else # Default complete with a filename _filedir fi } __grub_mkfont_program="grub-mkfont" complete -F _grub_mkfont -o filenames ${__grub_mkfont_program} unset __grub_mkfont_program # # grub-mkrescue # _grub_mkrescue () { local cur prev last COMPREPLY=() cur=`_get_cword` prev=${COMP_WORDS[COMP_CWORD-1]} last=$(__grub_get_last_option) if [[ "$cur" == -* ]]; then __grubcomp "$(__grub_get_options_from_help)" else case "$last" in --modules) __grub_list_modules return ;; esac # Default complete with a filename _filedir fi } __grub_mkrescue_program="grub-mkrescue" complete -F _grub_mkrescue -o filenames ${__grub_mkrescue_program} unset __grub_mkrescue_program # # grub-mkimage # _grub_mkimage () { local cur prev split=false COMPREPLY=() cur=`_get_cword` prev=${COMP_WORDS[COMP_CWORD-1]} _split_longopt && split=true case "$prev" in -d|--directory|-p|--prefix) _filedir -d return ;; -O|--format) # Get available format from help local prog=${COMP_WORDS[0]} __grubcomp "$(LC_ALL=C $prog --help | \ awk -F ":" '/available formats/ { print $2 }' | \ sed 's/, / /g')" return ;; esac $split && return 0 if [[ "$cur" == -* ]]; then __grubcomp "$(__grub_get_options_from_help)" else # Default complete with a filename _filedir fi } __grub_mkimage_program="grub-mkimage" complete -F _grub_mkimage -o filenames ${__grub_mkimage_program} unset __grub_mkimage_program # # grub-mkpasswd-pbkdf2 # _grub_mkpasswd_pbkdf2 () { local cur COMPREPLY=() cur=`_get_cword` if [[ "$cur" == -* ]]; then __grubcomp "$(__grub_get_options_from_help)" else # Default complete with a filename _filedir fi } __grub_mkpasswd_pbkdf2_program="grub-mkpasswd-pbkdf2" complete -F _grub_mkpasswd_pbkdf2 -o filenames ${__grub_mkpasswd_pbkdf2_program} unset __grub_mkpasswd_pbkdf2_program # # grub-probe # _grub_probe () { local cur prev split=false COMPREPLY=() cur=`_get_cword` prev=${COMP_WORDS[COMP_CWORD-1]} _split_longopt && split=true case "$prev" in -t|--target) # Get target type from help local prog=${COMP_WORDS[0]} __grubcomp "$(LC_ALL=C $prog --help | \ awk -F "[()]" '/--target=/ { print $2 }' | \ sed 's/|/ /g')" return ;; esac $split && return 0 if [[ "$cur" == -* ]]; then __grubcomp "$(__grub_get_options_from_help)" else # Default complete with a filename _filedir fi } __grub_probe_program="grub-probe" complete -F _grub_probe -o filenames ${__grub_probe_program} unset __grub_probe_program # # grub-script-check # _grub_script_check () { local cur COMPREPLY=() cur=`_get_cword` if [[ "$cur" == -* ]]; then __grubcomp "$(__grub_get_options_from_help)" else # Default complete with a filename _filedir fi } __grub_script_check_program="grub-script-check" complete -F _grub_script_check -o filenames ${__grub_script_check_program} # Local variables: # mode: shell-script # sh-basic-offset: 4 # sh-indent-comment: t # indent-tabs-mode: nil # End: # ex: ts=4 sw=4 et filetype=sh redis-cli 0000644 00000001753 15036124163 0006351 0 ustar 00 # -*- sh -*- # # Bash completion function for the 'redis-cli' command. # # Steve # -- # http://www.steve.org.uk # _redis-cli() { COMPREPLY=() cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} # # All known commands accepted. Sorted. # opts='bgrewriteaof bgsave dbsize debug decr decrby del echo exists expire expireat flushall flushdb get getset incr incrby info keys lastsave lindex llen lpop lpush lrange lrem lset ltrim mget move mset msetnx ping randomkey rename renamenx rewriteaof rpop rpoplpush rpush sadd save scard sdiff sdiffstore select set setnx shutdown sinter sinterstore sismember slaveof smembers smove sort spop srandmember srem sunion sunionstore ttl type zadd zcard zincrby zrange zrangebyscore zrem zremrangebyscore zrevrange zscore' # # Only complete on the first term. # if [ $COMP_CWORD -eq 1 ]; then COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) return 0 fi } complete -F _redis-cli redis-cli jps 0000644 00000001132 15036124163 0005261 0 ustar 00 # jps(1) completion -*- shell-script -*- _jps() { local cur prev words cword _init_completion || return case $prev in -J* | -help) return ;; esac if [[ $cur == -* ]]; then # Not using _parse_usage because output has [-help] which does not # mean -h, -e, -l, -p... COMPREPLY=($(compgen -W "-q -m -l -v -V -J -help" -- "$cur")) [[ ${COMPREPLY-} == -J* ]] && compopt -o nospace else _known_hosts_real -- "$cur" fi } && complete -F _jps jps # ex: filetype=sh lrzip 0000644 00000002125 15036124163 0005630 0 ustar 00 # lrzip(1) completion -*- shell-script -*- _lrzip() { local cur prev words cword _init_completion || return local xspec="*.lrz" case $prev in -*@([wSm]|[Vh?]*)) return ;; -*d) xspec="!"$xspec ;; -*o) _filedir return ;; -*O) _filedir -d return ;; -*L) COMPREPLY=($(compgen -W '{1..9}' -- "$cur")) return ;; -*N) COMPREPLY=($(compgen -W '{-20..19}' -- "$cur")) return ;; -*p) COMPREPLY=($(compgen -W "{1..$(_ncpus)}" -- "$cur")) return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) return fi _tilde "$cur" || return local IFS=$'\n' compopt -o filenames COMPREPLY=($(compgen -f -X "$xspec" -- "$cur") $(compgen -d -- "$cur")) } && complete -F _lrzip lrzip # ex: filetype=sh aptitude 0000644 00000010172 15036124163 0006310 0 ustar 00 # Debian aptitude(1) completion -*- shell-script -*- _have grep-status && { _comp_dpkg_hold_packages() { grep-status -P -e "^$1" -a -FStatus 'hold' -n -s Package } } || { _comp_dpkg_hold_packages() { command grep -B 2 'hold' /var/lib/dpkg/status | awk "/Package: $1/ { print \$2 }" } } _aptitude() { local cur prev words cword _init_completion || return local special i for ((i = 1; i < ${#words[@]} - 1; i++)); do if [[ ${words[i]} == @(@(|re)install|@(|un)hold|@(|un)markauto|@(dist|full|safe)-upgrade|download|show|forbid-version|purge|remove|changelog|why@(|-not)|keep@(|-all)|build-dep|@(add|remove)-user-tag|versions) ]]; then special=${words[i]} break fi done if [[ -v special ]]; then case $special in install | hold | markauto | unmarkauto | dist-upgrade | full-upgrade | \ safe-upgrade | download | show | changelog | why | why-not | build-dep | \ add-user-tag | remove-user-tag | versions) COMPREPLY=($(_xfunc apt-cache _apt_cache_packages)) return ;; purge | remove | reinstall | forbid-version) COMPREPLY=( $(_xfunc dpkg _comp_dpkg_installed_packages "$cur")) return ;; unhold) COMPREPLY=($(_comp_dpkg_hold_packages "$cur")) return ;; esac fi case $prev in # don't complete anything if these options are found autoclean | clean | forget-new | search | upgrade | update | keep-all) return ;; -!(-*)S) _filedir return ;; --display-format | --width | -!(-*)[wFo]) return ;; --sort | -!(-*)O) COMPREPLY=($(compgen -W 'installsize installsizechange debsize name priority version' -- "$cur")) return ;; --target-release | --default-release | -!(-*)t) COMPREPLY=($(apt-cache policy | command grep "release.o=Debian,a=$cur" | command sed -e "s/.*a=\(\w*\).*/\1/" | uniq 2>/dev/null)) return ;; esac if [[ $cur == -* ]]; then local opts=" $($1 --help 2>&1 | command sed -e \ 's/--with(out)-recommends/--without-recommends\n--with-recommends/' | _parse_help - | tr '\n' ' ') " # Exclude some mutually exclusive options for i in "${words[@]}"; do [[ $i == -u ]] && opts=${opts/ -i / } [[ $i == -i ]] && opts=${opts/ -u / } done # Do known short -> long replacements; at least up to 0.8.12, --help # outputs mostly only short ones. COMPREPLY=($opts) for i in "${!COMPREPLY[@]}"; do case ${COMPREPLY[i]} in -h) COMPREPLY[i]=--help ;; -s) COMPREPLY[i]=--simulate ;; -d) COMPREPLY[i]=--download-only ;; -P) COMPREPLY[i]=--prompt ;; -y) COMPREPLY[i]=--assume-yes ;; -F) COMPREPLY[i]=--display-format ;; -O) COMPREPLY[i]=--sort ;; -W) COMPREPLY[i]=--show-why ;; -w) COMPREPLY[i]=--width ;; -V) COMPREPLY[i]=--show-versions ;; -D) COMPREPLY[i]=--show-deps ;; -v) COMPREPLY[i]=--verbose ;; -t) COMPREPLY[i]=--target-release ;; -q) COMPREPLY[i]=--quiet ;; esac done COMPREPLY=($(compgen -W '${COMPREPLY[@]}' -- "$cur")) else COMPREPLY=($(compgen -W 'update upgrade safe-upgrade forget-new clean autoclean install reinstall remove hold unhold purge markauto unmarkauto why why-not dist-upgrade full-upgrade download search show forbid-version changelog keep keep-all build-dep add-user-tag remove-user-tag versions' -- "$cur")) fi } && complete -F _aptitude -o default aptitude aptitude-curses # ex: filetype=sh _newgrp 0000644 00000000660 15036124163 0006133 0 ustar 00 # newgrp(1) completion -*- shell-script -*- # Use of this file is deprecated on Linux. Upstream completion is # available in util-linux >= 2.23, use that instead. _newgrp() { local cur prev words cword _init_completion || return if [[ $cur == "-" ]]; then COMPREPLY=(-) else _allowed_groups "$cur" fi } && complete -F _newgrp newgrp # ex: filetype=sh snap 0000644 00000004757 15036124163 0005446 0 ustar 00 # -*- sh -*- # # Copyright (C) 2016-2017 Canonical Ltd # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License version 3 as # published by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. _complete_snap() { # TODO: add support for sourcing this function from the core snap. local cur prev words cword _init_completion -n : || return if [[ ${#words[@]} -le 2 ]]; then # we're completing on the first word COMPREPLY=($(GO_FLAGS_COMPLETION=1 "${words[@]}")) return 0 fi local command if [[ ${words[1]} =~ ^- ]]; then # global options take no args return 0 fi for w in "${words[@]:1}"; do if [[ "$w" == "-h" || "$w" == "--help" ]]; then # completing on help gets confusing return 0 fi done command="${words[1]}" # Only split on newlines local IFS=$'\n' # now we pass _just the bit that's being completed_ of the command # to snap for it to figure it out. go-flags isn't smart enough to # look at COMP_WORDS etc. itself. if [ "$command" = "debug" ]; then command="${words[2]}" COMPREPLY=($(GO_FLAGS_COMPLETION=1 snap debug "$command" "$cur")) elif [ "$command" = "routine" ]; then command="${words[2]}" COMPREPLY=($(GO_FLAGS_COMPLETION=1 snap routine "$command" "$cur")) else COMPREPLY=($(GO_FLAGS_COMPLETION=1 snap "$command" "$cur")) fi case $command in install|info|sign-build) _filedir '@(snap|comp)' ;; ack) _filedir ;; try) _filedir -d ;; connect|disconnect|interfaces) # interface completions will only end in ':' when they all # end in ':' (i.e. you either get offered snap names up to # and including the ':', or you get offered the whole thing) if [[ "$COMPREPLY" == *: ]]; then compopt -o nospace fi esac __ltrim_colon_completions "$cur" return 0 } complete -F _complete_snap snap mcookie 0000644 00000001127 15036124163 0006117 0 ustar 00 _mcookie_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-f'|'--file') local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 ;; '-m'|'--max-size') COMPREPLY=( $(compgen -W "bytes" -- $cur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS="--file --max-size --verbose --version --help" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac return 0 } complete -F _mcookie_module mcookie groupadd 0000644 00000001153 15036124163 0006275 0 ustar 00 # groupadd(8) completion -*- shell-script -*- _groupadd() { local cur prev words cword split _init_completion -s || return # TODO: if -o/--non-unique is given, could complete on existing gids # with -g/--gid case $prev in --gid | --key | --password | -!(-*)[gKp]) return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace fi } && complete -F _groupadd groupadd # ex: filetype=sh _write 0000644 00000000357 15036124163 0005766 0 ustar 00 # write(1) completion -*- shell-script -*- # Use of this file is deprecated on Linux. Upstream completion is # available in util-linux >= 2.23, use that instead. complete -u write # ex: filetype=sh isort 0000644 00000002514 15036124163 0005632 0 ustar 00 # isort completion -*- shell-script -*- _isort() { local cur prev words cword _init_completion || return case $prev in --help | --add-import | --builtin | --future | --from-first | -ff | \ --force-grid-wrap | -fgw | --indent | --lines | --lines-after-imports | -lai | \ --lines-between-types | -lbt | --line-ending | -le | --no-lines-before | -nlb | \ --dont-skip | -ns | --thirdparty | --project | --remove-import | --skip | \ --skip-glob | -sg | --settings-path | -sp | --top | --virtual-env | --line-width | \ --wrap-length | -wl | -[habfiloprstw]) return ;; --jobs | -j) COMPREPLY=($(compgen -W "{1..$(_ncpus)}" -- "$cur")) return ;; --multi-line | -m) COMPREPLY=($(compgen -W '{0..5}' -- "$cur")) return ;; --section-default | -sd) COMPREPLY=($(compgen -W 'FUTURE STDLIB THIRDPARTY FIRSTPARTY LOCALFOLDER' -- "$cur")) return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) return fi _filedir '@(py|pyi)' } && complete -F _isort isort # ex: filetype=sh 7z 0000644 00000010312 15036124163 0005025 0 ustar 00 # 7z(1) completion -*- shell-script -*- _7z() { local cur prev words cword _init_completion -n = || return if ((cword == 1)); then COMPREPLY=($(compgen -W 'a b d e l t u x' -- "$cur")) return fi local mode [[ ${words[1]} == [adu] ]] && mode=w || mode=r case $cur in -ao*) COMPREPLY=($(compgen -P${cur:0:3} -W 'a s t u' -- "${cur:3}")) return ;; -?(a)[ix]*) local opt if [[ $cur == -a[ix]* ]]; then opt=${cur:0:3} cur=${cur:3} else opt=${cur:0:2} cur=${cur:2} fi if [[ $cur != *[@\!]* ]]; then COMPREPLY=($(compgen -P$opt -W '@ ! r@ r-@ r0@ r! r-! r0!' \ -- "$cur")) elif [[ $cur == ?(r@(-|0|))@* ]]; then local IFS=$' \t\n' reset=$(shopt -po noglob) set -o noglob COMPREPLY=($(compgen -P"${opt}${cur%%@*}@" -f -- "${cur#*@}")) $reset compopt -o filenames fi return ;; -mhe=* | -mhc=* | -ms=* | -mt=*) COMPREPLY=($(compgen -W 'on off' -- "${cur#*=}")) return ;; -mx=*) COMPREPLY=($(compgen -W '0 1 3 5 7 9' -- "${cur#*=}")) return ;; -o* | -w?*) local reset=$(shopt -po noglob) set -o noglob compopt -o filenames local ifs=$IFS IFS=$'\n' COMPREPLY=($(compgen -d -P${cur:0:2} -S/ -- "${cur:2}")) IFS=$ifs $reset compopt -o nospace return ;; -r?*) COMPREPLY=($(compgen -P${cur:0:2} -W '- 0' -- "${cur:2}")) return ;; -scs*) COMPREPLY=($(compgen -P${cur:0:4} -W 'UTF-8 WIN DOS' \ -- "${cur:4}")) return ;; -ssc?*) COMPREPLY=($(compgen -P${cur:0:4} -W '-' -- "${cur:4}")) return ;; -t*) if [[ $mode == w ]]; then COMPREPLY=($(compgen -P${cur:0:2} -W '7z bzip2 gzip swfc tar wim xz zip' -- "${cur:2}")) else COMPREPLY=($(compgen -P${cur:0:2} -W '7z apm arj bzip2 cab chm cpio cramfs deb dmg elf fat flv gzip hfs iso lzh lzma lzma86 macho mbr mslz mub nsis ntfs pe ppmd rar rpm squashfs swf swfc tar udf vhd wim xar xz z zip' \ -- "${cur:2}")) fi return ;; -m*=* | -p* | -u* | -v*) return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '-ai -an -ao -ax -bd -i -m{x,s,f,he,hc,mt}= -o -p -r -scs -sfx -si -slp -slt -so -ssc -t -u -v -w -x -y' \ -- "$cur")) [[ ${COMPREPLY-} == -@(an|bd|sfx|si|slt|so|ssc|[rwy]) ]] || compopt -o nospace return fi local args _count_args = if ((args == 2)); then _filedir_xspec unzip # TODO: parsing 7z i output? # - how to figure out if the format is input or output? # - find string Formats:, read until next empty line # - extensions start from column 26 # - ignore everything in parens # - terminate on two spaces # - terminate on token containing anything [^a-z0-9] # (assumption: extensions are all lowercase) [[ $mode == w ]] && _filedir '@(7z|bz2|swf|?(g)tar|?(t)[bglx]z|tb?(z)2|wim)' || _filedir '@(7z|arj|bz2|cab|chm|cpio|deb|dmg|flv|gem|img|iso|lz[ah]|lzma?(86)|msi|pmd|[rx]ar|rpm|sw[fm]|?(g)tar|taz|?(t)[bglx]z|tb?(z)2|vhd|wim|Z)' else if [[ ${words[1]} == d ]]; then local IFS=$'\n' COMPREPLY=($(compgen -W "$(printf '%s\n' "$($1 l ${words[2]} \ -slt 2>/dev/null | command sed -n '/^Path =/s/^Path = \(.*\)$/\1/p' \ 2>/dev/null | tail -n+2)")" -- "$cur")) compopt -o filenames else _filedir fi fi } && complete -F _7z 7z 7za # ex: filetype=sh aclocal 0000644 00000001525 15036124163 0006071 0 ustar 00 # aclocal(1) completion -*- shell-script -*- _aclocal() { local cur prev words cword split _init_completion -s || return case "$prev" in --help | --print-ac-dir | --version) return ;; --acdir | -I) _filedir -d return ;; --output) _filedir return ;; --warnings | -W) local cats=(syntax unsupported) COMPREPLY=($(compgen -W \ '${cats[@]} ${cats[@]/#/no-} all none error' -- "$cur")) return ;; esac $split && return COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace } && complete -F _aclocal aclocal aclocal-1.1{0..6} # ex: filetype=sh chromium-browser 0000644 00000002605 15036124163 0007777 0 ustar 00 # chromium-browser completion -*- shell-script -*- _chromium_browser() { local cur prev words cword split _init_completion -s -n : || return case $prev in --help | --app | --proxy-pac-url | -h) return ;; --user-data-dir) _filedir -d return ;; --proxy-server) case $cur in *://*) local prefix="${cur%%://*}://" _known_hosts_real -- "${cur#*://}" COMPREPLY=("${COMPREPLY[@]/#/$prefix}") __ltrim_colon_completions "$cur" ;; *) compopt -o nospace COMPREPLY=($(compgen -S :// -W 'http socks socks4 socks5' -- "$cur")) ;; esac return ;; --password-store) COMPREPLY=($(compgen -W 'basic gnome kwallet' -- "$cur")) return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return fi _filedir "@(?([mxs])htm?(l)|pdf|txt)" } && complete -F _chromium_browser chromium-browser google-chrome \ google-chrome-stable chromium chrome # ex: filetype=sh tox 0000644 00000002625 15036124163 0005307 0 ustar 00 # tox completion -*- shell-script -*- _tox() { local cur prev words cword _init_completion || return # Complete defaults following a "--" if [[ "${words[*]:0:cword} " == *\ --\ * && $cur != -- ]]; then compopt -o bashdefault -o default return fi case $prev in --help | --version | --num | --index-url | --hashseed | --force-dep | -!(-*)[hni]) return ;; -!(-*)c) _filedir ini return ;; --installpkg | --result-json | --workdir) _filedir return ;; -!(-*)e) local envs=$( { "$1" --listenvs-all || "$1" --listenvs } 2>/dev/null ) [[ $envs ]] || envs=$( command sed -e 's/,/ /g' -ne 's/^envlist[[:space:]]*=//p' \ tox.ini 2>/dev/null ) local prefix="" [[ $cur == *,* ]] && prefix="${cur%,*}," COMPREPLY=($(compgen -X '*[{}]*' -W "$envs ALL" -- "${cur##*,}")) ((${#COMPREPLY[@]} == 1)) && COMPREPLY=(${COMPREPLY/#/$prefix}) return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1") --' -- "$cur")) return fi } && complete -F _tox tox # ex: filetype=sh pylint 0000644 00000006405 15036124163 0006014 0 ustar 00 # pylint(1) completion -*- shell-script -*- _pylint() { local cur prev words cword split _init_completion -s || return local python=python [[ ${1##*/} == *3* ]] && python=python3 case $prev in --version | --help | --long-help | --help-msg | --init-hook | --ignore | --enable | \ --evaluation | --max-line-length | --max-module-lines | \ --indent-string | --min-similarity-lines | --max-args | \ --ignored-argument-names | --max-locals | --max-returns | --max-branchs | \ --max-statements | --max-parents | --max-attributes | --min-public-methods | \ --max-public-methods | --required-attributes | --bad-functions | \ --module-rgx | --const-rgx | --class-rgx | --function-rgx | --method-rgx | \ --attr-rgx | --argument-rgx | --variable-rgx | --inlinevar-rgx | --good-names | \ --bad-names | --no-docstring-rgx | --dummy-variables-rgx | \ --additional-builtins | --notes | --ignored-classes | --generated-members | \ --overgeneral-exceptions | --ignore-iface-methods | \ --defining-attr-methods | --valid-classmethod-first-arg | \ --valid-metaclass-classmethod-first-arg | -!(-*)[he]) return ;; --disable | -!(-*)d) COMPREPLY=($(compgen -W 'all' -- "$cur")) return ;; --rcfile) _filedir return ;; --persistent | --include-ids | --symbols | --files-output | --reports | \ --comment | --ignore-comments | --ignore-docstrings | --ignore-imports | \ --init-import | --ignore-mixin-members | --zope | --suggestion-mode | \ -!(-*)[isr]) COMPREPLY=($(compgen -W 'yes no' -- "$cur")) return ;; --load-plugins | --deprecated-modules) local prefix= [[ $cur == *,* ]] && prefix="${cur%,*}," cur="${cur##*,}" _xfunc python _python_modules $python ((${#COMPREPLY[@]} == 1)) && COMPREPLY=(${COMPREPLY/#/$prefix}) return ;; --jobs | -!(-*)j) COMPREPLY=($(compgen -W "{1..$(_ncpus)}" -- "$cur")) return ;; --confidence) local prefix= [[ $cur == *,* ]] && prefix="${cur%,*}," COMPREPLY=($(compgen -W "HIGH INFERENCE INFERENCE_FAILURE UNDEFINED" -- "${cur##*,}")) ((${#COMPREPLY[@]} == 1)) && COMPREPLY=(${COMPREPLY/#/$prefix}) return ;; --format | -!(-*)f) COMPREPLY=($(compgen -W 'text parseable colorized json msvs' \ -- "$cur")) return ;; --import-graph | --ext-import-graph | --int-import-graph) _filedir dot return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W \ '$(_parse_help "$1" --long-help)' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return fi [[ $cur == @(.|*/)* ]] || _xfunc python _python_modules $python _filedir py } && complete -F _pylint pylint pylint-2 pylint-3 # ex: filetype=sh xz 0000644 00000002760 15036124163 0005136 0 ustar 00 # xz(1) completion -*- shell-script -*- _xz() { local cur prev words cword split _init_completion -s || return local xspec="*.@(xz|lzma|txz|tlz)" case $prev in --decompress | --list | --test | -!(-*)[dlt]*) xspec="!"$xspec ;; --files | --files0) _filedir return ;; --check | -!(-*)C) COMPREPLY=($(compgen -W 'crc32 crc64 sha256 none' -- "$cur")) return ;; --format | -!(-*)F) COMPREPLY=($(compgen -W 'auto xz lzma raw' -- "$cur")) return ;; --threads | -!(-*)T) COMPREPLY=($(compgen -W "{0..$(_ncpus)}" -- "$cur")) return ;; --memlimit | --memlimit-compress | --memlimit-decompress | --memory | \ --suffix | --delta | --lzma1 | --lzma2 | -!(-*)[MS]) return ;; --help | --long-help | --version | --info-memory | -!(-*)[hHV]) return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1" --long-help) {-1..-9}' \ -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return fi _tilde "$cur" || return local IFS=$'\n' compopt -o filenames COMPREPLY=($(compgen -f -X "$xspec" -- "$cur") $(compgen -d -- "$cur")) } && complete -F _xz xz pxz # ex: filetype=sh add_members 0000644 00000001403 15036124163 0006730 0 ustar 00 # mailman add_members completion -*- shell-script -*- _add_members() { local cur prev words cword split _init_completion -s || return case $prev in -r | -d | --regular-members-file | --digest-members-file) _filedir return ;; -w | -a | --welcome-msg | --admin-notify) COMPREPLY=($(compgen -W 'y n' -- "$cur")) return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '--regular-members-file --digest-members-file --welcome-msg --admin-notify --help' -- "$cur")) else _xfunc list_lists _mailman_lists fi } && complete -F _add_members add_members # ex: filetype=sh munindoc 0000644 00000000500 15036124163 0006277 0 ustar 00 # munindoc completion -*- shell-script -*- _munindoc() { local cur prev words cword _init_completion || return COMPREPLY=($(compgen -W \ '$(command ls /usr/share/munin/plugins 2>/dev/null)' -- "$cur")) } && complete -F _munindoc munindoc # ex: filetype=sh add-apt-repository 0000644 00000004307 15036124163 0010223 0 ustar 00 # bash completion for add-apt-repository -*- shell-script -*- _add-apt-repository_components() { if test -r /etc/lsb-release && grep -q Ubuntu /etc/lsb-release; then COMPREPLY=( $(compgen -W 'main restricted universe multiverse main/debug' -- "$cur") ) elif test -r /etc/debian_version; then COMPREPLY=( $(compgen -W 'main contrib free non-free' -- "$cur") ) fi } _add-apt-repository_ppa() { : # nothing to do currently } _add-apt-repository_uca() { : # add param to list valid UCAs for current release } _add-apt-repository_uri() { COMPREPLY=( $(compgen -W 'http:// https:// mirror:// ftp:// file:/ copy:/ rsh:// ssh://' -- "$cur") ) } _add-apt-repository_sourceslist() { : # maybe add help to autofill full sources.list line } _add-apt-repository_help() { "$1" --help | grep '^\s*-' | tr ',' '\n' | _parse_help - } _add-apt-repository() { local cur prev words cword _init_completion || return if [[ $cur == -* ]]; then COMPREPLY=( $(compgen -W "$(_add-apt-repository_help $1)" -- "$cur") ) return fi case $prev in -p|--pocket) COMPREPLY=( $(compgen -W 'release security updates proposed backports' -- "$cur") ) return ;; -c|--component) _add-apt-repository_components return ;; -P|--ppa) _add-apt-repository_ppa return ;; -C|--cloud) _add-apt-repository_uca return ;; -U|--uri) _add-apt-repository_uri return ;; -S|--sourceslist) _add-apt-repository_sourceslist return ;; esac # check if last param was -S/--sourceslist, # as it can accept multiple words local i=$cword while [[ $i -ge 0 ]]; do case $words[$i] in -S|--sourceslist) _add-apt-repository_sourceslist return ;; esac i=$(( $i - 1 )) done } complete -F _add-apt-repository add-apt-repository # also complete the alias complete -F _add-apt-repository apt-add-repository # ex: filetype=sh kcov 0000644 00000003340 15036124163 0005432 0 ustar 00 # kcov(1) completion -*- shell-script -*- _kcov() { local cur prev words cword split _init_completion -s -n : || return case "$prev" in --pid | -p) _pids return ;; --sort-type | -s) COMPREPLY=($(compgen -W 'filename percent reverse lines uncovered' -- "$cur")) return ;; --include-path | --exclude-path) _filedir return ;; --replace-src-path) if [[ $cur == ?*:* ]]; then cur="${cur##*:}" _filedir else _filedir compopt -o nospace fi return ;; --limits | -l) if [[ $cur == ?*,* ]]; then prev="${cur%,*}" cur="${cur##*,}" COMPREPLY=($(compgen -W "{0..100}" -- "$cur")) ((${#COMPREPLY[@]} == 1)) && COMPREPLY=(${COMPREPLY/#/$prev,}) else COMPREPLY=($(compgen -W "{0..100}" -- "$cur")) ((${#COMPREPLY[@]} == 1)) && COMPREPLY=(${COMPREPLY/%/,}) compopt -o nospace fi return ;; --title | -t | --include-pattern | --exclude-pattern | --path-strip-level) # argument required but no completions available return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1" --help)' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return fi _filedir } && complete -F _kcov kcov # ex: filetype=sh freeciv 0000644 00000002050 15036124163 0006110 0 ustar 00 # freeciv client completions -*- shell-script -*- _freeciv() { local cur prev words cword _init_completion || return case $prev in --help | --version | --name | --port | -[hvnp]) return ;; --file | --log | --music | --read | --Sound | --tiles | -[flmrSt]) _filedir return ;; --Announce | -A) COMPREPLY=($(compgen -W 'IPv4 IPv6 none' -- "$cur")) return ;; --debug | -d) COMPREPLY=($(compgen -W '{0..3}' -- "$cur")) return ;; --Meta | --server | -[Ms]) _known_hosts_real -- "$cur" return ;; --Plugin | -P) COMPREPLY=($(compgen -W 'none esd sdl' -- "$cur")) return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) fi } && complete -F _freeciv freeciv{,-{gtk{2,3},sdl,xaw}} civclient # ex: filetype=sh gpg 0000644 00000002413 15036124163 0005245 0 ustar 00 # bash completion for gpg -*- shell-script -*- _gpg() { local cur prev words cword _init_completion || return case $prev in --sign | --clearsign | --decrypt-files | --load-extension | -!(-*)s) _filedir return ;; --export | --sign-key | --lsign-key | --nrsign-key | --nrlsign-key | --edit-key) # return list of public keys COMPREPLY=($(compgen -W "$($1 --list-keys 2>/dev/null | command sed -ne \ 's@^pub.*/\([^ ]*\).*$@\1@p' -ne \ 's@^.*\(<\([^>]*\)>\).*$@\2@p')" -- "$cur")) return ;; --recipient | -!(-*)r) COMPREPLY=($(compgen -W "$($1 --list-keys 2>/dev/null | command sed -ne \ 's@^.*<\([^>]*\)>.*$@\1@p')" -- "$cur")) if [[ -e ~/.gnupg/gpg.conf ]]; then COMPREPLY+=($(compgen -W "$(command sed -ne \ 's@^[ \t]*group[ \t][ \t]*\([^=]*\).*$@\1@p' \ ~/.gnupg/gpg.conf)" -- "$cur")) fi return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$($1 --dump-options)' -- "$cur")) fi } && complete -F _gpg -o default gpg # ex: filetype=sh python 0000644 00000003347 15036124163 0006020 0 ustar 00 # bash completion for python -*- shell-script -*- _python_modules() { COMPREPLY+=($(compgen -W \ "$(${1:-python} ${BASH_SOURCE[0]%/*}/../helpers/python $cur \ 2>/dev/null)" -- "$cur")) } _python_warning_actions() { COMPREPLY+=($(compgen -W "ignore default all module once error" \ ${prefix:+-P "$prefix"} -- "$cur")) } _python() { local cur prev words cword prefix _init_completion || return case $cur in -[QWX]?*) prefix=${cur:0:2} prev=$prefix cur=${cur:2} ;; esac case $prev in --help | --version | -!(-*)[?hVcX]) return ;; -!(-*)m) _python_modules "$1" return ;; -!(-*)Q) COMPREPLY=($(compgen -W "old new warn warnall" -P "$prefix" \ -- "$cur")) return ;; -!(-*)W) _python_warning_actions return ;; --jit) # TODO: quite a few others, parse from "--jit help" output? COMPREPLY=($(compgen -W "help off" -- "$cur")) return ;; !(?(*/)python*([0-9.])|?(*/)pypy*([0-9.])|-?)) [[ $cword -lt 2 || ${words[cword - 2]} != -[QWX] ]] && _filedir ;; esac # if -c or -m is already given, complete all kind of files. if [[ ${words[*]::cword} == *\ -[cm]\ * ]]; then _filedir elif [[ $cur != -* ]]; then _filedir 'py?([cowz])' else COMPREPLY=($(compgen -W '$(_parse_help "$1" -h)' -- "$cur")) fi } && complete -F _python python python2 python2.7 python3 python3.{3..9} pypy pypy3 micropython # ex: filetype=sh useradd 0000644 00000002403 15036124163 0006116 0 ustar 00 # useradd(8) completion -*- shell-script -*- _useradd() { local cur prev words cword split _init_completion -s || return # TODO: if -o/--non-unique is given, could complete on existing uids # with -u/--uid case $prev in --comment | --help | --expiredate | --inactive | --key | --password | --uid | \ --selinux-user | -!(-*)[chefKpuZ]) return ;; --base-dir | --home-dir | --skel | --root | -!(-*)[bdkR]) _filedir -d return ;; --gid | -!(-*)g) _gids COMPREPLY=($(compgen -W '${COMPREPLY[@]} $(compgen -g)' \ -- "$cur")) return ;; --groups | -!(-*)G) local prefix= [[ $cur == *,* ]] && prefix="${cur%,*}," COMPREPLY=($(compgen -g -- "${cur##*,}")) ((${#COMPREPLY[@]} == 1)) && COMPREPLY=(${COMPREPLY/#/$prefix}) return ;; --shell | -!(-*)s) _shells return ;; esac $split && return [[ $cur == -* ]] && COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) } && complete -F _useradd useradd # ex: filetype=sh zramctl 0000644 00000002412 15036124163 0006143 0 ustar 00 _zramctl_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-a'|'--algorithm') COMPREPLY=( $(compgen -W "lzo lz4 lz4hc deflate 842" -- $cur) ) return 0 ;; '-o'|'--output') local prefix realcur OUTPUT_ALL OUTPUT realcur="${cur##*,}" prefix="${cur%$realcur}" OUTPUT_ALL="NAME DISKSIZE DATA COMPR ALGORITHM STREAMS ZERO-PAGES TOTAL MEM-LIMIT MEM-USED MIGRATED MOUNTPOINT" for WORD in $OUTPUT_ALL; do if ! [[ $prefix == *"$WORD"* ]]; then OUTPUT="$WORD ${OUTPUT:-""}" fi done compopt -o nospace COMPREPLY=( $(compgen -P "$prefix" -W "$OUTPUT" -S ',' -- $realcur) ) return 0 ;; '-s'|'--size') COMPREPLY=( $(compgen -W "size" -- $cur) ) return 0 ;; '-t'|'--streams') COMPREPLY=( $(compgen -W "number" -- $cur) ) return 0 ;; esac case $cur in -*) OPTS=" --algorithm --bytes --find --noheadings --output --output-all --raw --reset --size --streams --help --version" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- ${cur:-"/dev/zram"}) ) return 0 } complete -F _zramctl_module zramctl id 0000644 00000000661 15036124163 0005067 0 ustar 00 # id(1) completion -*- shell-script -*- _id() { local cur prev words cword _init_completion || return if [[ $cur == -* ]]; then local opts=$(_parse_help "$1") [[ $opts ]] || opts="-G -g -u" # POSIX fallback COMPREPLY=($(compgen -W "$opts" -- "$cur")) else COMPREPLY=($(compgen -u "$cur")) fi } && complete -F _id id # ex: filetype=sh ifup 0000644 00000001612 15036124163 0005433 0 ustar 00 # Red Hat & Debian GNU/Linux if{up,down} completion -*- shell-script -*- _userland GNU || return 1 _ifupdown() { local cur prev words cword _init_completion || return case $prev in --help | --version | --allow | --exclude | --option | -!(-*)[hVXo]) return ;; --interfaces | -!(-*)i) _filedir return ;; --state-dir) _filedir -d return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) return fi local args _count_args "" "@(--allow|-i|--interfaces|--state-dir|-X|--exclude|-o)" if ((args == 1)); then _configured_interfaces COMPREPLY=($(compgen -W '${COMPREPLY[@]}' -- "$cur")) fi } && complete -F _ifupdown ifup ifdown ifquery ifstatus # ex: filetype=sh update-alternatives 0000644 00000004633 15036124163 0010457 0 ustar 00 # bash completion for update-alternatives -*- shell-script -*- _installed_alternatives() { local admindir # find the admin dir for i in alternatives dpkg/alternatives rpm/alternatives; do [[ -d /var/lib/$i ]] && admindir=/var/lib/$i && break done for ((i = 1; i < cword; i++)); do if [[ ${words[i]} == --admindir ]]; then admindir=${words[i + 1]} break fi done COMPREPLY=($(compgen -W '$(command ls $admindir)' -- "$cur")) } _update_alternatives() { local cur prev words cword _init_completion || return case $prev in --altdir | --admindir) _filedir -d return ;; --help | --usage | --version) return ;; esac local mode args i # find which mode to use and how many real args used so far for ((i = 1; i < cword; i++)); do if [[ ${words[i]} == --@(install|remove|auto|display|config|remove-all|set) ]]; then mode=${words[i]} args=$((cword - i)) break fi done case ${mode-} in --install) case $args in 1 | 3) _filedir ;; 2) _installed_alternatives ;; 4) # priority - no completions ;; *) 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 '$(_parse_help "$1")' -- "$cur")) ;; esac } && complete -F _update_alternatives update-alternatives alternatives # ex: filetype=sh watch 0000644 00000002233 15036124163 0005576 0 ustar 00 # watch(1) completion -*- shell-script -*- [[ $OSTYPE == *linux* ]] || return 1 _watch() { local cur prev words cword split _init_completion -s || return local offset=0 i for ((i = 1; i <= cword; i++)); do case ${words[i]} in --help | --version | -!(-*)h) return ;; --interval | -!(-*)n) ((i++)) continue ;; -*) continue ;; esac offset=$i break done if ((offset > 0)); then _command_offset $offset return fi case $prev in --differences | -!(-*)d) [[ $cur != -* ]] && COMPREPLY=($(compgen -W 'cumulative' -- "$cur")) return ;; --interval | -!(-*)n) return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return fi } && complete -F _watch watch # ex: filetype=sh gm 0000644 00000001524 15036124163 0005075 0 ustar 00 # bash completion for gm(1) -*- shell-script -*- _gm_commands() { COMPREPLY+=($(compgen -W '$("$1" help | awk "/^ +[^ ]+ +- / { print \$1 }")' -- "$cur")) } _gm() { local cur prev words cword _init_completion || return if ((cword == 1)); then _gm_commands "$1" return elif [[ $cword -eq 2 && ${words[1]} == time ]]; then _gm_commands "$1" return fi local gmcmd=${words[1]} [[ $gmcmd == time ]] && gmcmd=${words[2]} case $gmcmd in help) [[ $prev == help ]] && _gm_commands "$1" return ;; version) return ;; esac # TODO... defer some commnds to the imagemagick "gm"less completions etc? compopt -o default } && complete -F _gm gm # ex: filetype=sh lvm 0000644 00000046015 15036124163 0005274 0 ustar 00 # bash completion for lvm -*- shell-script -*- _lvm_filedir() { cur=${cur:-/dev/} _filedir } _lvm_volumegroups() { COMPREPLY=($(compgen -W "$(vgscan 2>/dev/null | command sed -n -e 's|.*Found.*"\(.*\)".*$|\1|p')" -- "$cur")) } _lvm_physicalvolumes_all() { COMPREPLY=($(compgen -W "$(pvscan 2>/dev/null | command sed -n -e 's|^.*PV \([^ ]*\) .*|\1|p')" -- "$cur")) } _lvm_physicalvolumes() { COMPREPLY=($(compgen -W "$(pvscan 2>/dev/null | command sed -n -e 's|^.*PV \(.*\) VG.*$|\1|p')" -- "$cur")) } _lvm_logicalvolumes() { COMPREPLY=($(compgen -W "$(lvscan 2>/dev/null | command sed -n -e "s|^.*'\(.*\)'.*$|\1|p")" -- "$cur")) if [[ $cur == /dev/mapper/* ]]; then _filedir local i for i in "${!COMPREPLY[@]}"; do [[ ${COMPREPLY[i]} == */control ]] && unset 'COMPREPLY[i]' done fi } _lvm_units() { COMPREPLY=($(compgen -W 'h s b k m g t H K M G T' -- "$cur")) } _lvm_sizes() { COMPREPLY=($(compgen -W 'k K m M g G t T' -- "$cur")) } # @param $1 glob matching args known to take an argument _lvm_count_args() { args=0 local offset=1 if [[ ${words[0]} == lvm ]]; then offset=2 fi local i prev=${words[offset - 1]} for ((i = offset; i < cword; i++)); do # shellcheck disable=SC2053 if [[ ${words[i]} != -* && $prev != $1 ]]; then ((args++)) fi prev=${words[i]} done } _lvmdiskscan() { local cur prev words cword _init_completion || return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) fi } && complete -F _lvmdiskscan lvmdiskscan _pvscan() { local cur prev words cword _init_completion || return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) fi } && complete -F _pvscan pvscan _pvs() { local cur prev words cword _init_completion || return case $prev in --options | --sort | -!(-*)[oO]) 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 ;; --units) _lvm_units return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) else _lvm_physicalvolumes_all fi } && complete -F _pvs pvs _pvdisplay() { local cur prev words cword _init_completion || return case $prev in --units) _lvm_units return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) else _lvm_physicalvolumes_all fi } && complete -F _pvdisplay pvdisplay _pvchange() { local cur prev words cword _init_completion || return case $prev in --autobackup | --allocatable | -!(-*)[Ax]) COMPREPLY=($(compgen -W 'y n' -- "$cur")) return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) else _lvm_physicalvolumes_all fi } && complete -F _pvchange pvchange _pvcreate() { local cur prev words cword _init_completion || return case $prev in --restorefile) _filedir return ;; --metadatatype | -!(-*)M) COMPREPLY=($(compgen -W '1 2' -- "$cur")) return ;; --metadatacopies) COMPREPLY=($(compgen -W '0 1 2' -- "$cur")) return ;; --metadatasize | --setphysicalvolumesize) _lvm_sizes return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) else _lvm_filedir fi } && complete -F _pvcreate pvcreate _pvmove() { local cur prev words cword _init_completion || return case $prev in --autobackup | -!(-*)A) COMPREPLY=($(compgen -W 'y n' -- "$cur")) return ;; --name | -!(-*)n) _lvm_logicalvolumes return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) else _lvm_physicalvolumes fi } && complete -F _pvmove pvmove _pvremove() { local cur prev words cword _init_completion || return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) else _lvm_physicalvolumes_all fi } && complete -F _pvremove pvremove _vgscan() { local cur prev words cword _init_completion || return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) fi } && complete -F _vgscan vgscan _vgs() { local cur prev words cword _init_completion || return case $prev in --options | --sort | -!(-*)[oO]) 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 ;; --units) _lvm_units return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) else _lvm_volumegroups fi } && complete -F _vgs vgs _vgdisplay() { local cur prev words cword _init_completion || return case $prev in --units) _lvm_units return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) else _lvm_volumegroups fi } && complete -F _vgdisplay vgdisplay _vgchange() { local cur prev words cword _init_completion || return case $prev in --available | --autobackup | --resizeable | -!(-*)[aAx]) COMPREPLY=($(compgen -W 'y n' -- "$cur")) return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) else _lvm_volumegroups fi } && complete -F _vgchange vgchange _vgcreate() { local cur prev words cword _init_completion || return case $prev in --autobackup | -!(-*)A) COMPREPLY=($(compgen -W 'y n' -- "$cur")) return ;; --metadatatype | -!(-*)M) COMPREPLY=($(compgen -W '1 2' -- "$cur")) return ;; --physicalextentsize | -!(-*)s) _lvm_sizes return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) else local args _lvm_count_args '@(-A|--autobackup|-M|--metadatatype|-s|--physicalextentsize)' if ((args == 0)); then _lvm_volumegroups else _lvm_physicalvolumes_all fi fi } && complete -F _vgcreate vgcreate _vgremove() { local cur prev words cword _init_completion || return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) else _lvm_volumegroups fi } && complete -F _vgremove vgremove _vgrename() { local cur prev words cword _init_completion || return case $prev in --autobackup | -!(-*)A) COMPREPLY=($(compgen -W 'y n' -- "$cur")) return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) else _lvm_volumegroups fi } && complete -F _vgrename vgrename _vgreduce() { local cur prev words cword _init_completion || return case $prev in --autobackup | -!(-*)A) COMPREPLY=($(compgen -W 'y n' -- "$cur")) return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) else local args _lvm_count_args '@(-A|--autobackup)' if ((args == 0)); then _lvm_volumegroups else _lvm_physicalvolumes fi fi } && complete -F _vgreduce vgreduce _vgextend() { local cur prev words cword _init_completion || return case $prev in --autobackup | -!(-*)A) COMPREPLY=($(compgen -W 'y n' -- "$cur")) return ;; --size | -!(-*)L) _lvm_sizes return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) else local args _lvm_count_args '@(-A|--autobackup|-L|--size)' if ((args == 0)); then _lvm_volumegroups else _lvm_physicalvolumes_all fi fi } && complete -F _vgextend vgextend _vgport() { local cur prev words cword _init_completion || return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) else _lvm_volumegroups fi } && complete -F _vgport vgimport vgexport _vgck() { local cur prev words cword _init_completion || return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) else _lvm_volumegroups fi } && complete -F _vgck vgck _vgconvert() { local cur prev words cword _init_completion || return case $prev in --metadatatype | -!(-*)M) COMPREPLY=($(compgen -W '1 2' -- "$cur")) return ;; --metadatacopies) COMPREPLY=($(compgen -W '0 1 2' -- "$cur")) return ;; --metadatasize) _lvm_sizes return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) else _lvm_volumegroups fi } && complete -F _vgconvert vgconvert _vgcfgbackup() { local cur prev words cword _init_completion || return case $prev in --file | -!(-*)f) _filedir return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) else _lvm_volumegroups fi } && complete -F _vgcfgbackup vgcfgbackup _vgcfgrestore() { local cur prev words cword _init_completion || return case $prev in --file | -!(-*)f) _filedir return ;; --metadatatype | -!(-*)M) COMPREPLY=($(compgen -W '1 2' -- "$cur")) return ;; --name | -!(-*)n) _lvm_volumegroups return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) else _lvm_volumegroups fi } && complete -F _vgcfgrestore vgcfgrestore _vgmerge() { local cur prev words cword _init_completion || return case $prev in --autobackup | -!(-*)A) COMPREPLY=($(compgen -W 'y n' -- "$cur")) return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) else _lvm_volumegroups fi } && complete -F _vgmerge vgmerge _vgsplit() { local cur prev words cword _init_completion || return case $prev in --autobackup | -!(-*)A) COMPREPLY=($(compgen -W 'y n' -- "$cur")) return ;; --metadatatype | -!(-*)M) COMPREPLY=($(compgen -W '1 2' -- "$cur")) return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) else local args _lvm_count_args '@(-A|--autobackup|-M|--metadatatype)' if ((args == 0 || args == 1)); then _lvm_volumegroups else _lvm_physicalvolumes fi fi } && complete -F _vgsplit vgsplit _vgmknodes() { local cur prev words cword _init_completion || return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) else _lvm_volumegroups fi } && complete -F _vgmknodes vgmknodes _lvscan() { local cur prev words cword _init_completion || return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) fi } && complete -F _lvscan lvscan _lvs() { local cur prev words cword _init_completion || return case $prev in --options | --sort | -!(-*)[oO]) 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 ;; --units) _lvm_units return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) else _lvm_logicalvolumes fi } && complete -F _lvs lvs _lvdisplay() { local cur prev words cword _init_completion || return case $prev in --units) _lvm_units return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) else _lvm_logicalvolumes fi } && complete -F _lvdisplay lvdisplay _lvchange() { local cur prev words cword _init_completion || return case $prev in --available | --autobackup | --contiguous | --persistent | -!(-*)[aACM]) COMPREPLY=($(compgen -W 'y n' -- "$cur")) return ;; --permission | -!(-*)p) COMPREPLY=($(compgen -W 'r rw' -- "$cur")) return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) else _lvm_logicalvolumes fi } && complete -F _lvchange lvchange _lvcreate() { local cur prev words cword _init_completion || return case $prev in --autobackup | --contiguous | --persistent | --zero | -!(-*)[ACMZ]) COMPREPLY=($(compgen -W 'y n' -- "$cur")) return ;; --size | -!(-*)L) _lvm_sizes return ;; --permission | -!(-*)p) COMPREPLY=($(compgen -W 'r rw' -- "$cur")) return ;; --name | -!(-*)n) _lvm_logicalvolumes return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) else local args _lvm_count_args '@(-A|-C|-M|-Z|--autobackup|--contiguous|--persistent|--zero|-L|--size|-p|--permission|-n|--name)' if ((args == 0)); then _lvm_volumegroups else _lvm_physicalvolumes fi fi } && complete -F _lvcreate lvcreate _lvremove() { local cur prev words cword _init_completion || return case $prev in --autobackup | -!(-*)A) COMPREPLY=($(compgen -W 'y n' -- "$cur")) return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) else _lvm_logicalvolumes fi } && complete -F _lvremove lvremove _lvrename() { local cur prev words cword _init_completion || return case $prev in --autobackup | -!(-*)A) COMPREPLY=($(compgen -W 'y n' -- "$cur")) return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) else _lvm_logicalvolumes fi } && complete -F _lvrename lvrename _lvreduce() { local cur prev words cword _init_completion || return case $prev in --autobackup | -!(-*)A) COMPREPLY=($(compgen -W 'y n' -- "$cur")) return ;; --size | -!(-*)L) _lvm_sizes return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) else _lvm_logicalvolumes fi } && complete -F _lvreduce lvreduce _lvresize() { local cur prev words cword _init_completion || return case $prev in --autobackup | -!(-*)A) COMPREPLY=($(compgen -W 'y n' -- "$cur")) return ;; --size | -!(-*)L) _lvm_sizes return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) else local args _lvm_count_args '@(-A|--autobackup|-L|--size)' if ((args == 0)); then _lvm_logicalvolumes else _lvm_physicalvolumes fi fi } && complete -F _lvresize lvresize _lvextend() { local cur prev words cword _init_completion || return case $prev in --autobackup | -!(-*)A) COMPREPLY=($(compgen -W 'y n' -- "$cur")) return ;; --size | -!(-*)L) _lvm_sizes return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) else local args _lvm_count_args '@(-A|--autobackup|-L|--size)' if ((args == 0)); then _lvm_logicalvolumes else _lvm_physicalvolumes fi fi } && complete -F _lvextend lvextend _lvm() { local cur prev words cword _init_completion || return if ((cword == 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 "${words[1]}" in pvchange | pvcreate | pvdisplay | pvmove | pvremove | pvresize | pvs | pvscan | \ vgcfgbackup | vgcfgrestore | vgchange | vgck | vgconvert | vgcreate | \ vgdisplay | vgexport | vgextend | vgimport | vgmerge | vgmknodes | vgreduce | \ vgremove | vgrename | vgs | vgscan | vgsplit | lvchange | lvcreate | lvdisplay | \ lvextend | lvreduce | lvremove | lvrename | lvresize | lvscan) _${words[1]} ;; esac fi } && complete -F _lvm lvm # ex: filetype=sh pyvenv 0000644 00000000660 15036124163 0006021 0 ustar 00 # bash completion for pyvenv -*- shell-script -*- _pyvenv() { local cur prev words cword split _init_completion -s || return case $prev in -h | --help) return ;; esac $split && return if [[ $cur == -* ]]; then _longopt "$1" return fi _filedir -d } && complete -F _pyvenv pyvenv pyvenv-3.{4..9} # ex: filetype=sh idn 0000644 00000001232 15036124163 0005240 0 ustar 00 # idn(1) completion -*- shell-script -*- _idn() { local cur prev words cword split _init_completion -s || return case $prev in --help | --version | -!(-*)[hV]) return ;; --profile | -!(-*)p) COMPREPLY=($(compgen -W 'Nameprep iSCSI Nodeprep Resourceprep trace SASLprep' -- "$cur")) return ;; esac if ! $split && [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace fi } && complete -F _idn idn # ex: filetype=sh _chfn 0000644 00000000356 15036124163 0005551 0 ustar 00 # chfn(1) completion -*- shell-script -*- # Use of this file is deprecated on Linux. Upstream completion is # available in util-linux >= 2.23, use that instead. complete -u chfn # ex: filetype=sh addpart 0000644 00000000744 15036124163 0006114 0 ustar 00 _addpart_module() { local cur COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" case $COMP_CWORD in 1) OPTS="--help --version $(lsblk -pnro name)" compopt -o bashdefault -o default COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) ;; 2) # FIXME: how to determine next free partition number ;; 3) COMPREPLY=( $(compgen -W "start" -- $cur) ) ;; 4) COMPREPLY=( $(compgen -W "length" -- $cur) ) ;; esac return 0 } complete -F _addpart_module addpart _cal 0000644 00000001636 15036124163 0005374 0 ustar 00 # cal(1) completion -*- shell-script -*- # Use of this file is deprecated on Linux. Upstream completion is # available in util-linux >= 2.23, use that instead. _cal() { local cur prev words cword _init_completion || return case $prev in -m) if [[ $OSTYPE == *bsd* ]]; then COMPREPLY=($(compgen -W '{1..12}' -- "$cur")) return fi ;; -s) [[ $OSTYPE == *bsd* ]] && return ;; -A | -B | -d | -H) return ;; esac if [[ $cur == -* ]]; then local opts=$(_parse_help "$1") COMPREPLY=($(compgen -W '${opts:-$(_parse_usage "$1")}' -- "$cur")) return fi local args _count_args ((args == 1)) && COMPREPLY=($(compgen -W '{1..12}' -- "$cur")) } && complete -F _cal cal ncal # ex: filetype=sh _nmcli 0000644 00000014042 15036124163 0005732 0 ustar 00 # nmcli completion -*- shell-script -*- # Use of this file is deprecated. Upstream completion is available in # NetworkManager >= 0.9.8.0, use that instead. _nmcli_list() { COMPREPLY=($(compgen -W '$1' -- "$cur")) } _nmcli_con_id() { local IFS=$'\n' COMPREPLY=($(compgen -W "$(nmcli con list 2>/dev/null | tail -n +2 | awk -F ' {2,}' '{print $1 }')" -- "$cur")) } _nmcli_con_uuid() { COMPREPLY=($(compgen -W "$(nmcli con list 2>/dev/null | tail -n +2 | awk -F ' {2,}' '{print $2}')" -- "$cur")) } _nmcli_ap_ssid() { local IFS=$'\n' COMPREPLY=($(compgen -W "$(nmcli dev wifi list 2>/dev/null | tail -n +2 | awk -F ' {2,}' '{print $1}')" -- "$cur")) } _nmcli_ab_bssid() { COMPREPLY=($(compgen -W "$(nmcli dev wifi list 2>/dev/null | tail -n +2 | awk -F ' {2,}' '{print $2}')" -- "$cur")) } _nmcli() { local cur prev words cword _init_completion || return case $prev in -m | --mode) COMPREPLY=($(compgen -W 'tabular multiline' -- "$cur")) return ;; -f | --fields) COMPREPLY=($(compgen -W 'all common' -- "$cur")) return ;; -e | --escape) _nmcli_list "yes no" return ;; id) _nmcli_con_id return ;; uuid) _nmcli_con_uuid return ;; iface) _available_interfaces return ;; bssid) _nmcli_ab_bssid return ;; wep-key-type) _nmcli_list "key phrase" return ;; esac if ((cword == 1)); then if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '--terse --pretty --mode --fields --escape --version --help' -- "$cur")) else COMPREPLY=($(compgen -W "nm con dev" -- "$cur")) fi else local object=${words[1]} local command=${words[2]} case $object in nm) case $command in enable) _nmcli_list "true false" return ;; sleep) _nmcli_list "true false" return ;; wifi) _nmcli_list "on off" return ;; wwan) _nmcli_list "on off" return ;; wimax) _nmcli_list "on off" return ;; esac COMPREPLY=($(compgen -W 'status permissions enable sleep wifi wwan wimax' -- "$cur")) ;; con) case $command in list) COMPREPLY=($(compgen -W 'id uuid' -- "$cur")) return ;; up) if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '--nowait --timeout' \ -- "$cur")) else COMPREPLY=($(compgen -W 'id uuid iface ap nsp' \ -- "$cur")) fi return ;; down) COMPREPLY=($(compgen -W 'id uuid' -- "$cur")) return ;; delete) COMPREPLY=($(compgen -W 'id uuid' -- "$cur")) return ;; esac COMPREPLY=($(compgen -W 'list status up down delete' \ -- "$cur")) ;; dev) case $command in list) COMPREPLY=($(compgen -W 'iface' -- "$cur")) return ;; disconnect) if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '--nowait --timeout' \ -- "$cur")) else COMPREPLY=($(compgen -W 'iface' -- "$cur")) fi return ;; wifi) local subcommand=${words[3]} case $subcommand in list) COMPREPLY=($(compgen -W 'iface bssid' \ -- "$cur")) return ;; connect) if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '--private --nowait --timeout' -- "$cur")) else if [[ $prev == "connect" ]]; then _nmcli_ap_ssid else COMPREPLY=($(compgen -W 'password wep-key-type iface bssid name' \ -- "$cur")) fi fi return ;; esac COMPREPLY=($(compgen -W 'list connect' -- "$cur")) return ;; esac COMPREPLY=($(compgen -W 'status list disconnect wifi' \ -- "$cur")) ;; esac fi } && complete -F _nmcli nmcli # ex: filetype=sh cryptdisks_start 0000644 00000002274 15036124163 0010111 0 ustar 00 # cryptdisks_{start,stop} completion by first column of crypttab # # Copyright 2013 Claudius Hubig <cl_crds@chubig.net>, 2-clause BSD _cryptdisks() { local action="$1" t for t in $( awk -vt="${COMP_WORDS[COMP_CWORD]}" \ '($1 !~ /^#/ && index($1,t) == 1) {print $1}' \ "${TABFILE-"/etc/crypttab"}" ); do if [ "$action" = start -a ! -e "/dev/mapper/$t" ] || [ "$action" = stop -a -e "/dev/mapper/$t" ]; then COMPREPLY+=( "$t" ) fi done return 0; } _cryptdisks_start() { local i include_options=y COMPREPLY=() for (( i=0; i < COMP_CWORD-1; i++ )); do if [ "${COMP_WORDS[i]}" = "--" ] || [[ "${COMP_WORDS[i]}" != -* ]]; then include_options=n break fi done if [ "$include_options" = "y" ]; then for i in "-r" "--readonly" "--"; do if [[ "$i" == "${COMP_WORDS[COMP_CWORD]}"* ]]; then COMPREPLY+=( "$i" ) fi done fi _cryptdisks start "$@" } _cryptdisks_stop() { COMPREPLY=() _cryptdisks stop "$@"; } complete -F _cryptdisks_start cryptdisks_start complete -F _cryptdisks_stop cryptdisks_stop ssh 0000644 00000040157 15036124163 0005274 0 ustar 00 # ssh(1) completion -*- shell-script -*- _ssh_queries() { COMPREPLY+=($(compgen -W \ "cipher cipher-auth help mac kex key key-cert key-plain key-sig protocol-version compression sig ciphers macs kexalgorithms pubkeyacceptedkeytypes hostkeyalgorithms hostbasedkeytypes hostbasedacceptedkeytypes" \ -- "${cur,,}")) } _ssh_query() { ${1:-ssh} -Q $2 2>/dev/null } _ssh_ciphers() { local ciphers='$(_ssh_query "$1" cipher)' [[ $ciphers ]] || ciphers="3des-cbc aes128-cbc aes192-cbc aes256-cbc aes128-ctr aes192-ctr aes256-ctr arcfour128 arcfour256 arcfour blowfish-cbc cast128-cbc" COMPREPLY+=($(compgen -W "$ciphers" -- "$cur")) } _ssh_macs() { local macs='$(_ssh_query "$1" mac)' [[ $macs ]] || macs="hmac-md5 hmac-sha1 umac-64@openssh.com hmac-ripemd160 hmac-sha1-96 hmac-md5-96" COMPREPLY+=($(compgen -W "$macs" -- "$cur")) } _ssh_options() { local opts=( AddKeysToAgent AddressFamily BatchMode BindAddress CanonicalDomains CanonicalizeFallbackLocal CanonicalizeHostname CanonicalizeMaxDots CanonicalizePermittedCNAMEs CASignatureAlgorithms CertificateFile ChallengeResponseAuthentication CheckHostIP Ciphers ClearAllForwardings Compression ConnectionAttempts ConnectTimeout ControlMaster ControlPath ControlPersist DynamicForward EnableSSHKeysign EscapeChar ExitOnForwardFailure FingerprintHash ForwardAgent ForwardX11 ForwardX11Timeout ForwardX11Trusted GatewayPorts GlobalKnownHostsFile GSSAPIAuthentication GSSAPIClientIdentity GSSAPIDelegateCredentials GSSAPIKeyExchange GSSAPIRenewalForcesRekey GSSAPIServerIdentity GSSAPITrustDns HashKnownHosts Host HostbasedAuthentication HostbasedKeyTypes HostKeyAlgorithms HostKeyAlias HostName IdentitiesOnly IdentityAgent IdentityFile IgnoreUnknown Include IPQoS KbdInteractiveAuthentication KbdInteractiveDevices KexAlgorithms LocalCommand LocalForward LogLevel MACs NoHostAuthenticationForLocalhost NumberOfPasswordPrompts PasswordAuthentication PermitLocalCommand PKCS11Provider Port PreferredAuthentications ProxyCommand ProxyJump ProxyUseFdpass PubkeyAcceptedKeyTypes PubkeyAuthentication RekeyLimit RemoteCommand RemoteForward RequestTTY RevokedHostKeys SendEnv ServerAliveCountMax ServerAliveInterval SmartcardDevice StreamLocalBindMask StreamLocalBindUnlink StrictHostKeyChecking SyslogFacility TCPKeepAlive Tunnel TunnelDevice UpdateHostKeys UsePrivilegedPort User UserKnownHostsFile VerifyHostKeyDNS VisualHostKey XAuthLocation) local protocols=$(_ssh_query "$1" protocol-version) if [[ -z $protocols || $protocols == *1* ]]; then opts+=(Cipher CompressionLevel Protocol RhostsRSAAuthentication RSAAuthentication) fi compopt -o nospace local IFS=$' \t\n' reset=$(shopt -p nocasematch) shopt -s nocasematch local option COMPREPLY=($(for option in "${opts[@]}"; do [[ $option == "$cur"* ]] && printf '%s=\n' "$option" done)) $reset } # Complete a ssh suboption (like ForwardAgent=y<tab>) # Two parameters: the string to complete including the equal sign, and # the ssh executable to invoke (optional). # Not all suboptions are completed. # Doesn't handle comma-separated lists. _ssh_suboption() { # Split into subopt and subval local prev=${1%%=*} cur=${1#*=} case ${prev,,} in batchmode | canonicaldomains | canonicalizefallbacklocal | \ challengeresponseauthentication | checkhostip | \ clearallforwardings | controlpersist | compression | enablesshkeysign | \ exitonforwardfailure | forwardagent | forwardx11 | forwardx11trusted | \ gatewayports | gssapiauthentication | gssapikeyexchange | \ gssapidelegatecredentials | gssapirenewalforcesrekey | gssapitrustdns | \ hashknownhosts | hostbasedauthentication | identitiesonly | \ kbdinteractiveauthentication | kbdinteractivedevices | \ nohostauthenticationforlocalhost | passwordauthentication | permitlocalcommand | \ proxyusefdpass | pubkeyauthentication | rhostsrsaauthentication | \ rsaauthentication | streamlocalbindunlink | \ tcpkeepalive | useprivilegedport | visualhostkey) COMPREPLY=($(compgen -W 'yes no' -- "$cur")) ;; addkeystoagent) COMPREPLY=($(compgen -W 'yes ask confirm no' -- "$cur")) ;; addressfamily) COMPREPLY=($(compgen -W 'any inet inet6' -- "$cur")) ;; bindaddress) _ip_addresses ;; canonicalizehostname) COMPREPLY=($(compgen -W 'yes no always' -- "$cur")) ;; identityfile) _ssh_identityfile ;; *file | identityagent | include | controlpath | revokedhostkeys | xauthlocation) _filedir ;; casignaturealgorithms) COMPREPLY=($(compgen -W '$(_ssh_query "$2" sig)' -- "$cur")) ;; cipher) COMPREPLY=($(compgen -W 'blowfish des 3des' -- "$cur")) ;; ciphers) _ssh_ciphers "$2" ;; controlmaster) COMPREPLY=($(compgen -W 'yes ask auto autoask no' -- "$cur")) ;; compressionlevel) COMPREPLY=($(compgen -W '{1..9}' -- "$cur")) ;; fingerprinthash) COMPREPLY=($(compgen -W 'md5 sha256' -- "$cur")) ;; ipqos) COMPREPLY=($(compgen -W 'af1{1..4} af2{2..3} af3{1..3} af4{1..3} cs{0..7} ef lowdelay throughput reliability' -- "$cur")) ;; hostbasedkeytypes | hostkeyalgorithms) COMPREPLY=($(compgen -W '$(_ssh_query "$2" key)' -- "$cur")) ;; kexalgorithms) COMPREPLY=($(compgen -W '$(_ssh_query "$2" kex)' -- "$cur")) ;; loglevel) COMPREPLY=($(compgen -W 'QUIET FATAL ERROR INFO VERBOSE DEBUG{,1,2,3}' -- "$cur")) ;; macs) _ssh_macs "$2" ;; pkcs11provider) _filedir so ;; preferredauthentications) COMPREPLY=($(compgen -W 'gssapi-with-mic host-based publickey keyboard-interactive password' -- "$cur")) ;; protocol) local protocols=($(_ssh_query "$2" protocol-version)) [[ $protocols ]] || protocols=(1 2) if ((${#protocols[@]} > 1)); then COMPREPLY=($(compgen -W '${protocols[@]}' -- "$cur")) fi ;; proxyjump) _known_hosts_real -a ${configfile:+-F "$configfile"} -- "$cur" ;; proxycommand | remotecommand | localcommand) COMPREPLY=($(compgen -c -- "$cur")) ;; pubkeyacceptedkeytypes) COMPREPLY=($(compgen -W '$(_ssh_query "$2" key)' -- "$cur")) ;; requesttty) COMPREPLY=($(compgen -W 'no yes force auto' -- "$cur")) ;; stricthostkeychecking) COMPREPLY=($(compgen -W 'accept-new ask no off' -- "$cur")) ;; syslogfacility) COMPREPLY=($(compgen -W 'DAEMON USER AUTH LOCAL{0..7}' -- "$cur")) ;; tunnel) COMPREPLY=($(compgen -W 'yes no point-to-point ethernet' \ -- "$cur")) ;; updatehostkeys | verifyhostkeydns) COMPREPLY=($(compgen -W 'yes no ask' -- "$cur")) ;; esac return 0 } # Try to complete -o SubOptions= # # Returns 0 if the completion was handled or non-zero otherwise. _ssh_suboption_check() { # Get prev and cur words without splitting on = local cureq=$(_get_cword :=) preveq=$(_get_pword :=) if [[ $cureq == *=* && $preveq == -*o ]]; then _ssh_suboption $cureq "$1" return $? fi return 1 } # Search COMP_WORDS for '-F configfile' or '-Fconfigfile' argument _ssh_configfile() { set -- "${words[@]}" while (($# > 0)); do if [[ $1 == -F* ]]; then if ((${#1} > 2)); then configfile="$(dequote "${1:2}")" else shift [[ ${1-} ]] && configfile="$(dequote "$1")" fi break fi shift done } # With $1 set, look for public key files, else private # shellcheck disable=SC2120 _ssh_identityfile() { [[ -z $cur && -d ~/.ssh ]] && cur=~/.ssh/id _filedir if ((${#COMPREPLY[@]} > 0)); then COMPREPLY=($(compgen -W '${COMPREPLY[@]}' \ -X "${1:+!}*.pub" -- "$cur")) fi } _ssh() { local cur prev words cword _init_completion -n : || return local configfile _ssh_configfile _ssh_suboption_check "$1" && return local ipvx case $prev in -*b) _ip_addresses return ;; -*c) _ssh_ciphers "$1" return ;; -*[DeLpRW]) return ;; -*[EFS]) _filedir return ;; -*i) _ssh_identityfile return ;; -*I) _filedir so return ;; -*J) _known_hosts_real -a ${configfile:+-F "$configfile"} -- "$cur" return ;; -*l) COMPREPLY=($(compgen -u -- "$cur")) return ;; -*m) _ssh_macs "$1" return ;; -*O) COMPREPLY=($(compgen -W 'check forward cancel exit stop' -- "$cur")) return ;; -*o) _ssh_options "$1" return ;; -*Q) _ssh_queries "$1" return ;; -*w) _available_interfaces return ;; -*4*) ipvx=-4 ;; -*6*) ipvx=-6 ;; esac if [[ $cur == -F* ]]; then cur=${cur#-F} _filedir # Prefix completions with '-F' COMPREPLY=("${COMPREPLY[@]/#/-F}") cur=-F$cur # Restore cur elif [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_usage "$1")' -- "$cur")) else _known_hosts_real ${ipvx-} -a ${configfile:+-F "$configfile"} -- "$cur" local args _count_args if ((args > 1)); then compopt -o filenames COMPREPLY+=($(compgen -c -- "$cur")) fi fi } && shopt -u hostcomplete && complete -F _ssh ssh slogin autossh sidedoor # sftp(1) completion # _sftp() { local cur prev words cword _init_completion || return local configfile _ssh_configfile _ssh_suboption_check && return local ipvx case $prev in -*[BDlPRs]) return ;; -*[bF]) _filedir return ;; -*i) _ssh_identityfile return ;; -*c) _ssh_ciphers return ;; -*J) _known_hosts_real -a ${configfile:+-F "$configfile"} -- "$cur" return ;; -*o) _ssh_options return ;; -*S) compopt -o filenames COMPREPLY=($(compgen -c -- "$cur")) return ;; -*4*) ipvx=-4 ;; -*6*) ipvx=-6 ;; esac if [[ $cur == -F* ]]; then cur=${cur#-F} _filedir # Prefix completions with '-F' COMPREPLY=("${COMPREPLY[@]/#/-F}") cur=-F$cur # Restore cur elif [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_usage "$1")' -- "$cur")) else _known_hosts_real ${ipvx-} -a ${configfile:+-F "$configfile"} -- "$cur" fi } && shopt -u hostcomplete && complete -F _sftp sftp # things we want to backslash escape in scp paths # shellcheck disable=SC2089 _scp_path_esc='[][(){}<>"'"'"',:;^&!$=?`\\|[:space:]]' # Complete remote files with ssh. If the first arg is -d, complete on dirs # only. Returns paths escaped with three backslashes. # shellcheck disable=SC2120 _scp_remote_files() { local IFS=$'\n' # remove backslash escape from the first colon cur=${cur/\\:/:} local userhost=${cur%%?(\\):*} local path=${cur#*:} # unescape (3 backslashes to 1 for chars we escaped) # shellcheck disable=SC2090 path=$(command sed -e 's/\\\\\\\('$_scp_path_esc'\)/\\\1/g' <<<"$path") # default to home dir of specified user on remote host if [[ -z $path ]]; then path=$(ssh -o 'Batchmode yes' $userhost pwd 2>/dev/null) fi local files if [[ $1 == -d ]]; then # escape problematic characters; remove non-dirs # shellcheck disable=SC2090 files=$(ssh -o 'Batchmode yes' $userhost \ command ls -aF1dL "$path*" 2>/dev/null | command sed -e 's/'$_scp_path_esc'/\\\\\\&/g' -e '/[^\/]$/d') else # escape problematic characters; remove executables, aliases, pipes # and sockets; add space at end of file names # shellcheck disable=SC2090 files=$(ssh -o 'Batchmode yes' $userhost \ command ls -aF1dL "$path*" 2>/dev/null | command sed -e 's/'$_scp_path_esc'/\\\\\\&/g' -e 's/[*@|=]$//g' \ -e 's/[^\/]$/& /g') fi COMPREPLY+=($files) } # This approach is used instead of _filedir to get a space appended # after local file/dir completions, and -o nospace retained for others. # If first arg is -d, complete on directory names only. The next arg is # an optional prefix to add to returned completions. _scp_local_files() { local IFS=$'\n' local dirsonly=false if [[ ${1-} == -d ]]; then dirsonly=true shift fi if $dirsonly; then COMPREPLY+=($(command ls -aF1dL $cur* 2>/dev/null | command sed -e "s/$_scp_path_esc/\\\\&/g" -e '/[^\/]$/d' -e "s/^/${1-}/")) else COMPREPLY+=($(command ls -aF1dL $cur* 2>/dev/null | command sed -e "s/$_scp_path_esc/\\\\&/g" -e 's/[*@|=]$//g' \ -e 's/[^\/]$/& /g' -e "s/^/${1-}/")) fi } # scp(1) completion # _scp() { local cur prev words cword _init_completion -n : || return local configfile _ssh_configfile _ssh_suboption_check && { COMPREPLY=("${COMPREPLY[@]/%/ }") return } local ipvx case $prev in -*c) _ssh_ciphers COMPREPLY=("${COMPREPLY[@]/%/ }") return ;; -*F) _filedir compopt +o nospace return ;; -*i) _ssh_identityfile compopt +o nospace return ;; -*J) _known_hosts_real -a ${configfile:+-F "$configfile"} -- "$cur" return ;; -*[lP]) return ;; -*o) _ssh_options return ;; -*S) compopt +o nospace -o filenames COMPREPLY=($(compgen -c -- "$cur")) return ;; -*4*) ipvx=-4 ;; -*6*) ipvx=-6 ;; esac _expand || return case $cur in !(*:*)/* | [.~]*) ;; # looks like a path *:*) _scp_remote_files return ;; esac local prefix if [[ $cur == -F* ]]; then cur=${cur#-F} prefix=-F else case $cur in -*) COMPREPLY=($(compgen -W '$(_parse_usage "${words[0]}")' \ -- "$cur")) COMPREPLY=("${COMPREPLY[@]/%/ }") return ;; */* | [.~]*) # not a known host, pass through ;; *) _known_hosts_real ${ipvx-} -c -a \ ${configfile:+-F "$configfile"} -- "$cur" ;; esac fi _scp_local_files "${prefix-}" } && complete -F _scp -o nospace scp # ex: filetype=sh busctl 0000644 00000016301 15036124163 0005765 0 ustar 00 # busctl(1) completion -*- shell-script -*- # SPDX-License-Identifier: LGPL-2.1-or-later # # This file is part of systemd. # # systemd is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version. # # systemd is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with systemd; If not, see <http://www.gnu.org/licenses/>. __contains_word () { local w word=$1; shift for w in "$@"; do [[ $w = "$word" ]] && return done } __get_machines() { local a b machinectl list --full --no-legend --no-pager 2>/dev/null | { while read a b; do echo " $a"; done; }; } __get_busnames() { local mode=$1 local a b busctl $mode list --no-legend --no-pager --full 2>/dev/null | { while read a b; do echo " $a"; done; }; } __get_objects() { local mode=$1 local busname=$2 local a b busctl $mode tree --list --no-legend --no-pager $busname 2>/dev/null | { while read a b; do echo " $a"; done; }; } __get_interfaces() { local mode=$1 local busname=$2 local path=$3 local a b c busctl $mode introspect --list --no-legend --no-pager $busname $path 2>/dev/null | { while read a b c; do [[ "$b" == "interface" ]] && echo " $a"; done; }; } __get_members() { local mode=$1 local busname=$2 local path=$3 local interface=$4 local type=$5 local flags=$6 local a b c d e busctl $mode introspect --list --no-legend --no-pager $busname $path $interface 2>/dev/null | sed -e 's/^\.//' | { while read a b c d e; do [[ "$b" == "$type" && ( -z $flags || "$e" == "$flags" ) ]] && echo " $a"; done; }; } __get_signature() { local mode=$1 local busname=$2 local path=$3 local interface=$4 local member=$5 local a b c d busctl $mode introspect --list --no-legend --no-pager $busname $path $interface 2>/dev/null | sed -e 's/^\.//' | { while read a b c d; do [[ "$a" == "$member" && "$c" != '-' ]] && echo " \"$c\""; done; }; } _busctl() { local i n verb comps mode local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} local -A OPTS=( [STANDALONE]='-h --help --version --no-pager --no-legend --system --user --show-machine --unique --acquired --activatable --list -q --quiet --verbose --expect-reply=no --auto-start=no --allow-interactive-authorization=no --augment-creds=no --watch-bind=yes -j -l --full' [ARG]='--address -H --host -M --machine --match --timeout --size --json --destination' ) if __contains_word "--user" ${COMP_WORDS[*]}; then mode=--user else mode=--system fi if __contains_word "$prev" ${OPTS[ARG]}; then case $prev in --host|-H) comps=$(compgen -A hostname) ;; --machine|-M) comps=$( __get_machines ) ;; --json) comps=$( busctl --json=help 2>/dev/null ) ;; --destination) comps=$( __get_busnames $mode ) ;; esac COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 fi if [[ "$cur" = -* ]]; then COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") ) return 0 fi local -A VERBS=( [STANDALONE]='list help' [BUSNAME]='status monitor capture tree' [OBJECT]='introspect' [METHOD]='call' [EMIT]='emit' [PROPERTY_GET]='get-property' [PROPERTY_SET]='set-property' ) for ((i=0; i < COMP_CWORD; i++)); do if __contains_word "${COMP_WORDS[i]}" ${VERBS[*]} && ! __contains_word "${COMP_WORDS[i-1]}" ${OPTS[ARG]}; then verb=${COMP_WORDS[i]} break fi done n=$(($COMP_CWORD - $i)) if [[ -z ${verb-} ]]; then comps=${VERBS[*]} elif __contains_word "$verb" ${VERBS[STANDALONE]}; then comps='' elif __contains_word "$verb" ${VERBS[BUSNAME]}; then comps=$( __get_busnames $mode) elif __contains_word "$verb" ${VERBS[OBJECT]}; then if [[ $n -eq 1 ]] ; then comps=$( __get_busnames $mode) elif [[ $n -eq 2 ]] ; then comps=$( __get_objects $mode ${COMP_WORDS[COMP_CWORD-1]}) elif [[ $n -eq 3 ]] ; then comps=$( __get_interfaces $mode ${COMP_WORDS[COMP_CWORD-2]} ${COMP_WORDS[COMP_CWORD-1]}) else comps='' fi elif __contains_word "$verb" ${VERBS[METHOD]}; then if [[ $n -eq 1 ]] ; then comps=$( __get_busnames $mode) elif [[ $n -eq 2 ]] ; then comps=$( __get_objects $mode ${COMP_WORDS[COMP_CWORD-1]}) elif [[ $n -eq 3 ]] ; then comps=$( __get_interfaces $mode ${COMP_WORDS[COMP_CWORD-2]} ${COMP_WORDS[COMP_CWORD-1]}) elif [[ $n -eq 4 ]] ; then comps=$( __get_members $mode ${COMP_WORDS[COMP_CWORD-3]} ${COMP_WORDS[COMP_CWORD-2]} ${COMP_WORDS[COMP_CWORD-1]} method) elif [[ $n -eq 5 ]] ; then comps=$( __get_signature $mode ${COMP_WORDS[COMP_CWORD-4]} ${COMP_WORDS[COMP_CWORD-3]} ${COMP_WORDS[COMP_CWORD-2]} ${COMP_WORDS[COMP_CWORD-1]}) else comps='' fi elif __contains_word "$verb" ${VERBS[EMIT]}; then comps='' elif __contains_word "$verb" ${VERBS[PROPERTY_GET]}; then if [[ $n -eq 1 ]] ; then comps=$( __get_busnames $mode) elif [[ $n -eq 2 ]] ; then comps=$( __get_objects $mode ${COMP_WORDS[COMP_CWORD-1]}) elif [[ $n -eq 3 ]] ; then comps=$( __get_interfaces $mode ${COMP_WORDS[COMP_CWORD-2]} ${COMP_WORDS[COMP_CWORD-1]}) elif [[ $n -eq 4 ]] ; then comps=$( __get_members $mode ${COMP_WORDS[COMP_CWORD-3]} ${COMP_WORDS[COMP_CWORD-2]} ${COMP_WORDS[COMP_CWORD-1]} property) else comps='' fi elif __contains_word "$verb" ${VERBS[PROPERTY_SET]}; then if [[ $n -eq 1 ]] ; then comps=$( __get_busnames $mode) elif [[ $n -eq 2 ]] ; then comps=$( __get_objects $mode ${COMP_WORDS[COMP_CWORD-1]}) elif [[ $n -eq 3 ]] ; then comps=$( __get_interfaces $mode ${COMP_WORDS[COMP_CWORD-2]} ${COMP_WORDS[COMP_CWORD-1]}) elif [[ $n -eq 4 ]] ; then comps=$( __get_members $mode ${COMP_WORDS[COMP_CWORD-3]} ${COMP_WORDS[COMP_CWORD-2]} ${COMP_WORDS[COMP_CWORD-1]} property writable) elif [[ $n -eq 5 ]] ; then comps=$( __get_signature $mode ${COMP_WORDS[COMP_CWORD-4]} ${COMP_WORDS[COMP_CWORD-3]} ${COMP_WORDS[COMP_CWORD-2]} ${COMP_WORDS[COMP_CWORD-1]}) else comps='' fi fi COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 } complete -F _busctl busctl remove_members 0000644 00000001073 15036124163 0007500 0 ustar 00 # mailman remove_members completion -*- shell-script -*- _remove_members() { local cur prev words cword split _init_completion -s || return case $prev in -f | --file) _filedir return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '--file --all --fromall --nouserack --noadminack --help' -- "$cur")) else _xfunc list_lists _mailman_lists fi } && complete -F _remove_members remove_members # ex: filetype=sh pytest 0000644 00000010244 15036124163 0006021 0 ustar 00 # bash completion for pytest(1) -*- shell-script -*- _pytest() { local cur prev words cword split _init_completion -s -n : || return case $prev in --help | --maxfail | --report | --junit-prefix | --doctest-glob | -!(-*)[hkmorp]) return ;; --import-mode) COMPREPLY=($(compgen -W "prepend append" -- "$cur")) return ;; --capture) COMPREPLY=($(compgen -W "fd sys no tee-sys" -- "$cur")) return ;; --lfnf | --last-failed-no-failures) COMPREPLY=($(compgen -W "all none" -- "$cur")) return ;; --tb) COMPREPLY=($(compgen -W "auto long short line native no" \ -- "$cur")) return ;; --show-capture) COMPREPLY=($(compgen -W "no stdout stderr log all" -- "$cur")) return ;; --color) COMPREPLY=($(compgen -W "yes no auto" -- "$cur")) return ;; --pastebin) COMPREPLY=($(compgen -W "failed all" -- "$cur")) return ;; --junit-xml) _filedir xml return ;; --result-log | --log-file) _filedir log return ;; --ignore) _filedir return ;; --confcutdir | --basetemp | --rsyncdir | --rootdir) _filedir -d return ;; --doctest-report) COMPREPLY=($(compgen -W "none cdiff ndiff udiff only_first_failure" -- "$cur")) return ;; --assert) COMPREPLY=($(compgen -W "plain reinterp rewrite" -- "$cur")) return ;; --genscript) _filedir py return ;; --pythonwarnings | -!(-*)W) _xfunc python _python_warning_actions return ;; --numprocesses | -!(-*)n) COMPREPLY=($(compgen -W "{1..$(_ncpus)} auto" -- "$cur")) return ;; --dist) local modes=$("$1" --dist=nonexistent-distmode 2>&1 | command sed -e 's/[^[:space:][:alnum:]-]\{1,\}//g' \ -ne 's/.*choose from //p') COMPREPLY=($(compgen -W '$modes' -- "$cur")) return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return fi if [[ $cur == *.py::*:* ]]; then local file=${cur/.py:*/.py} local class=${cur#*.py::} in_class=false local line class=${class%%:*} while IFS= read -r line; do if [[ $line =~ ^class[[:space:]]+${class}[[:space:]:\(] ]]; then in_class=true elif [[ $line =~ ^class[[:space:]] ]]; then in_class=false fi if $in_class && [[ $line =~ ^[[:space:]]+(async[[:space:]]+)?def[[:space:]]+(test_[A-Za-z0-9_]+) ]]; then COMPREPLY+=(${BASH_REMATCH[2]}) fi done 2>/dev/null <"$file" ((!${#COMPREPLY[@]})) || COMPREPLY=($(compgen -P "$file::$class::" -W '${COMPREPLY[@]}' \ -- "${cur##*:?(:)}")) __ltrim_colon_completions "$cur" return elif [[ $cur == *.py:* ]]; then local file="${cur/.py:*/.py}" line while IFS= read -r line; do if [[ $line =~ ^class[[:space:]]+(Test[A-Za-z0-9_]+) ]]; then COMPREPLY+=(${BASH_REMATCH[1]}) elif [[ $line =~ ^(async[[:space:]]+)?def[[:space:]]+(test_[A-Za-z0-9_]+) ]]; then COMPREPLY+=(${BASH_REMATCH[2]}) fi done 2>/dev/null <"$file" ((!${#COMPREPLY[@]})) || COMPREPLY=($(compgen -P "$file::" -W '${COMPREPLY[@]}' \ -- "${cur##*.py:?(:)}")) __ltrim_colon_completions "$cur" return fi _filedir py } && complete -F _pytest pytest pytest-2 pytest-3 py.test py.test-2 py.test-3 # ex: filetype=sh column 0000644 00000002651 15036124163 0005771 0 ustar 00 _column_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-c'|'--output-width'|'-l'|'--table-columns-limit') COMPREPLY=( $(compgen -W "number" -- $cur) ) return 0 ;; '-s'|'--separator'|'-o'|'--output-separator'|'-n'|'--table-name'|'-O') COMPREPLY=( $(compgen -W "string" -- $cur) ) return 0 ;; '-O'|'--table-order'|'-N'|'--table-columns'|'-E'|'--table-noextreme'|'-H'|'--table-hide'|'-R'|'--table-right'|'-T'|'--table-truncate'|'-W'|'--table-wrap') COMPREPLY=( $(compgen -W "string" -- $cur) ) return 0 ;; '-r'|'--tree'|'-i'|'--tree-id'|'-p'|'--tree-parent') COMPREPLY=( $(compgen -W "string" -- $cur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS="--columns --table --table-name --table-order --table-columns --table-columns-limit --table-noextreme --table-noheadings --table-header-repeat --table-hide --table-right --table-truncate --table-wrap --keep-empty-lines --json --tree --tree-id --tree-parent --output-width --separator --output-separator --fillrows --help --version" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 } complete -F _column_module column dict 0000644 00000003413 15036124163 0005414 0 ustar 00 # dict(1) completion -*- shell-script -*- _dictdata() { dict $host $port $1 2>/dev/null | command sed -ne \ 's/^[[:blank:]]\{1,\}\([^[:blank:]]*\).*$/\1/p' } _dict() { local cur prev words cword _init_completion || return local host port db i for ((i = 1; i < cword; i++)); do case ${words[i]} in --host | -!(-*)h) host=${words[++i]} [[ -n $host ]] && host="-h $host" ;; --port | -!(-*)p) port=${words[++i]} [[ -n $port ]] && port="-p $port" ;; --database | -!(-*)d) db=${words[++i]} [[ -n $db ]] && host="-d $db" ;; esac done if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) return fi case $prev in --database | -info | -!(-*)[di]) COMPREPLY=($(compgen -W '$(_dictdata -D)' -- "$cur")) return ;; --strategy | -!(-*)s) COMPREPLY=($(compgen -W '$(_dictdata -S)' -- "$cur")) return ;; esac local dictfile=/usr/share/dict/words if [[ -r $dictfile ]]; then # Dictfile may be too large for practical compgen -W usage, so narrow # it down with grep if $cur looks like something that's safe to embed # in a pattern instead. if [[ $cur == +([-A-Za-z0-9/.]) ]]; then COMPREPLY=($(compgen -W \ '$(command grep "^${cur//./\\.}" $dictfile)' -- "$cur")) else COMPREPLY=($(compgen -W '$(cat $dictfile)' -- "$cur")) fi fi } && complete -F _dict -o default dict rdict # ex: filetype=sh iwpriv 0000644 00000001325 15036124163 0006011 0 ustar 00 # iwpriv completion -*- shell-script -*- _iwpriv() { local cur prev words cword _init_completion || return case $prev in roam) COMPREPLY=($(compgen -W 'on off' -- "$cur")) return ;; port) COMPREPLY=($(compgen -W 'ad-hoc managed' -- "$cur")) return ;; esac if ((cword == 1)); then if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '--help --version' -- "$cur")) else _available_interfaces -w fi else COMPREPLY=($(compgen -W '--all roam port' -- "$cur")) fi } && complete -F _iwpriv iwpriv # ex: filetype=sh iptables 0000644 00000003654 15036124163 0006303 0 ustar 00 # bash completion for iptables -*- shell-script -*- _iptables() { local cur prev words cword split _init_completion -s || return local table chain='s/^Chain \([^ ]\{1,\}\).*$/\1/p' [[ ${words[*]} =~ [[:space:]]-(t|-table=?)[[:space:]]*([^[:space:]]+) ]] && table="-t ${BASH_REMATCH[2]}" case $prev in -*[AIDRPFXLZ]) COMPREPLY=($(compgen -W '`"$1" $table -nL 2>/dev/null | \ command 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 `"$1" $table -nL 2>/dev/null | command sed -ne "$chain" \ -e "s/INPUT|OUTPUT|FORWARD|PREROUTING|POSTROUTING//"`' -- \ "$cur")) elif [[ $table == "-t nat" ]]; then COMPREPLY=($(compgen -W 'ACCEPT DROP LOG ULOG REJECT MIRROR SNAT DNAT MASQUERADE `"$1" $table -nL 2>/dev/null | \ command sed -ne "$chain" -e "s/OUTPUT|PREROUTING|POSTROUTING//"`' \ -- "$cur")) elif [[ $table == "-t mangle" ]]; then COMPREPLY=($(compgen -W 'ACCEPT DROP LOG ULOG REJECT MARK TOS `"$1" $table -nL 2>/dev/null | command sed -ne "$chain" \ -e "s/INPUT|OUTPUT|FORWARD|PREROUTING|POSTROUTING//"`' -- \ "$cur")) fi ;; *) if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$("$1" --help 2>&1 | command sed -e "s/^\[\!\]//" | _parse_help -)' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace fi ;; esac } && complete -F _iptables iptables # ex: filetype=sh sbcl 0000644 00000001243 15036124163 0005413 0 ustar 00 # -*- shell-script -*- # bash programmable completion for various Common Lisp implementations by # Nikodemus Siivola <nikodemus@random-state.net> _sbcl() { local cur prev words cword _init_completion || return # completing an option (may or may not be separated by a space) if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '--core --noinform --help --version --sysinit --userinit --eval --noprint --disable-debugger --end-runtime-options --end-toplevel-options ' -- "$cur")) else _filedir fi } && complete -F _sbcl sbcl sbcl-mt # ex: filetype=sh dsniff 0000644 00000001006 15036124163 0005736 0 ustar 00 # dsniff completion -*- shell-script -*- _dsniff() { local cur prev words cword _init_completion || return case $prev in -r | -w | -f | -p) _filedir return ;; -i) _available_interfaces -a return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_usage "$1") -r -w -p' -- "$cur")) fi } && complete -F _dsniff dsniff # ex: filetype=sh gzip 0000644 00000002207 15036124163 0005442 0 ustar 00 # bash completion for gzip -*- shell-script -*- _gzip() { local cur prev words cword _init_completion || return case $prev in --blocksize | --suffix | --help | --version | -!(-*)[bShV]) return ;; --processes | -!(-*)p) COMPREPLY=($(compgen -W "{1..$(_ncpus)}" -- "$cur")) return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1") {-1..-9}' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return fi local IFS=$'\n' xspec="*.@(gz|t[ag]z)" [[ ${1##*/} == pigz ]] && xspec="*.@([gz]z|t[ag]z)" if [[ $prev == --* ]]; then [[ $prev == --@(decompress|list|test) ]] && xspec="!"$xspec [[ $prev == --force ]] && xspec= elif [[ $prev == -* ]]; then [[ $prev == -*[dlt]* ]] && xspec="!"$xspec [[ $prev == -*f* ]] && xspec= fi _tilde "$cur" || return compopt -o filenames COMPREPLY=($(compgen -f -X "$xspec" -- "$cur") $(compgen -d -- "$cur")) } && complete -F _gzip gzip pigz # ex: filetype=sh pkgrm 0000644 00000002037 15036124163 0005612 0 ustar 00 # pkgrm completion -*- shell-script -*- # # Copyright 2006 Yann Rouillard <yann@opencsw.org> _pkgrm() { local cur prev words cword _init_completion || return # if a spool directory was given # we must complete with the package # available in this directory local spool=/var/sadm/pkg local i=$cword while ((i-- > 0)); do ((i--)) case "${words[i]}" in -s) spool="${words[i + 1]}" break ;; esac done case $prev in -a | -V) _filedir ;; -s | -R) _filedir -d ;; -Y) ;; *) if [[ ${cur} == -* ]]; then local opts="-a -A -n -M -R -s -v -V -Y" COMPREPLY=($(compgen -W "${opts}" -- ${cur})) else COMPREPLY=($(compgen -W "$(/bin/ls -1 $spool)" -- ${cur})) fi ;; esac } && complete -F _pkgrm pkgrm # ex: filetype=sh qemu 0000644 00000006373 15036124163 0005450 0 ustar 00 # bash completion for qemu -*- shell-script -*- _qemu() { local cur prev words cword _init_completion || return case $prev in -fd[ab] | -hd[abcd] | -cdrom | -option-rom | -kernel | -initrd | -bootp | -pidfile | \ -loadvm | -mtdblock | -sd | -pflash | -bios) _filedir return ;; -tftp | -smb | -L | -chroot) _filedir -d return ;; -boot) COMPREPLY=($(compgen -W 'a c d n' -- "$cur")) return ;; -k) COMPREPLY=($(compgen -W 'ar de-ch es fo fr-ca hu ja mk no pt-br sv da en-gb et fr fr-ch is lt nl pl ru th de en-us fi fr-be hr it lv nl-be pt sl tr' -- "$cur")) return ;; -soundhw) COMPREPLY=($(compgen -W "$($1 -soundhw help | awk \ '/^[[:lower:]]/ {print $1}') all" -- "$cur")) return ;; -machine | -M) COMPREPLY=($(compgen -W "$($1 $prev help | awk \ '/^[[:lower:]]/ {print $1}')" -- "$cur")) return ;; -cpu) COMPREPLY=($(compgen -W "$($1 -cpu help | awk '{print $2}')" \ -- "$cur")) return ;; -usbdevice) COMPREPLY=($(compgen -W 'mouse tablet disk: host: serial: braille net' -- "$cur")) return ;; -net) COMPREPLY=($(compgen -W 'nic user tap socket vde none dump' \ -- "$cur")) return ;; -serial | -parallel | -monitor) COMPREPLY=($(compgen -W 'vc pty none null /dev/ file: stdio pipe: COM udp: tcp: telnet: unix: mon: braille' -- "$cur")) return ;; -redir) COMPREPLY=($(compgen -S":" -W 'tcp udp' -- "$cur")) return ;; -bt) COMPREPLY=($(compgen -W 'hci vhci device' -- "$cur")) return ;; -vga) COMPREPLY=($(compgen -W 'cirrus std vmware xenfb none' -- "$cur")) return ;; -drive) COMPREPLY=($(compgen -S"=" -W 'file if bus unit index media cyls snapshot cache format serial addr' -- "$cur")) return ;; -balloon) COMPREPLY=($(compgen -W 'none virtio' -- "$cur")) return ;; -smbios) COMPREPLY=($(compgen -W 'file type' -- "$cur")) return ;; -watchdog) COMPREPLY=($(compgen -W "$($1 -watchdog help 2>&1 | awk '{print $1}')" -- "$cur")) return ;; -watchdog-action) COMPREPLY=($(compgen -W 'reset shutdown poweroff pause debug none' -- "$cur")) return ;; -runas) _allowed_users return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1" -help) -fd{a,b} -hd{a..d}' -- "$cur")) else _filedir fi } && complete -F _qemu qemu qemu-kvm qemu-system-i386 qemu-system-x86_64 # ex: filetype=sh prlimit 0000644 00000002461 15036124163 0006153 0 ustar 00 _prlimit_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-p'|'--pid') PIDS=$(cd /proc && echo [0-9]*) COMPREPLY=( $(compgen -W "$PIDS" -- $cur) ) return 0 ;; '-o'|'--output') local prefix realcur OUTPUT_ALL OUTPUT realcur="${cur##*,}" prefix="${cur%$realcur}" OUTPUT_ALL="DESCRIPTION RESOURCE SOFT HARD UNITS" for WORD in $OUTPUT_ALL; do if ! [[ $prefix == *"$WORD"* ]]; then OUTPUT="$WORD ${OUTPUT:-""}" fi done compopt -o nospace COMPREPLY=( $(compgen -P "$prefix" -W "$OUTPUT" -S ',' -- $realcur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in '=') cur=${cur#=} # FIXME: is there anything what could be printed # as limit value(s) ;; -*) OPTS="--pid --output --noheadings --raw --verbose --help --version --core= --data= --nice= --fsize= --sigpending= --memlock= --rss= --nofile= --msgqueue= --rtprio= --stack= --cpu= --nproc= --as= --locks= --rttime=" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac compopt -o bashdefault COMPREPLY=( $(compgen -c -- $cur) ) return 0 } complete -F _prlimit_module prlimit lsscsi 0000644 00000001122 15036124163 0005764 0 ustar 00 # lsscsi(8) completion -*- shell-script -*- _lsscsi() { local cur prev words cword split _init_completion -s || return case $prev in --help | --version | -!(-*)[hV]*) return ;; --sysfsroot | -!(-*)y) _filedir -d return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace fi } && complete -F _lsscsi lsscsi # ex: filetype=sh _su 0000644 00000001732 15036124163 0005261 0 ustar 00 # bash completion for su(1) -*- shell-script -*- # Use of this file is deprecated on Linux. Upstream completion is # available in util-linux >= 2.23, use that instead. if [[ $OSTYPE != *linux* ]]; then complete -u su # default completion return fi _su() { # linux-specific completion local cur prev words cword split _init_completion -s || return case "$prev" in -s | --shell) _shells return ;; -c | --command | --session-command) local IFS=$'\n' compopt -o filenames COMPREPLY=($(compgen -d -c -- "$cur")) return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1" --help)' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return fi COMPREPLY=($(compgen -u -- "$cur")) } && complete -F _su su # ex: filetype=sh automake 0000644 00000001547 15036124163 0006305 0 ustar 00 # automake(1) completion -*- shell-script -*- _automake() { local cur prev words cword split _init_completion -s || return case "$prev" in --help | --version) return ;; --warnings | -W) local cats=(gnu obsolete override portability syntax unsupported) COMPREPLY=($(compgen -W \ '${cats[@]} ${cats[@]/#/no-} all none error' -- "$cur")) return ;; --libdir) _filedir -d return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return fi _filedir } && complete -F _automake automake automake-1.1{0..6} # ex: filetype=sh portinstall 0000644 00000001577 15036124163 0007055 0 ustar 00 # bash completion for FreeBSD portinstall -*- shell-script -*- _portinstall() { local cur prev words cword _init_completion || return local portsdir indexfile local -a COMPREPLY2 portsdir=${PORTSDIR:-/usr/ports}/ # First try INDEX-5 indexfile=$portsdir/INDEX-5 # Then INDEX if INDEX-5 does not exist or system is not FreeBSD 5.x [[ ${OSTYPE%.*} == freebsd5 && -f $indexfile ]] || indexfile=$portsdir/INDEX [[ $prev == -l || $prev == -L || $prev == -o ]] && return COMPREPLY=($(command grep -E "^$cur" 2>/dev/null <$indexfile | cut -d'|' -f1)) COMPREPLY2=($(command grep -E "^[^\|]+\|$portsdir$cur" 2>/dev/null \ <$indexfile | cut -d'|' -f2)) COMPREPLY2=(${COMPREPLY2[@]#$portsdir}) COMPREPLY+=("${COMPREPLY2[@]}") } && complete -F _portinstall -o dirnames portinstall # ex: filetype=sh avctrl 0000644 00000000721 15036124163 0005763 0 ustar 00 # avctrl completion -*- shell-script -*- _avctrl() { local cur prev words cword _init_completion || return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '--help --quiet' -- "$cur")) else local args _count_args if ((args == 1)); then COMPREPLY=($(compgen -W 'discover switch' -- "$cur")) fi fi } && complete -F _avctrl avctrl # ex: filetype=sh ether-wake 0000644 00000001033 15036124163 0006521 0 ustar 00 # ether-wake(8) completion -*- shell-script -*- _ether_wake() { local cur prev words cword _init_completion -n : || return case $prev in -i) _available_interfaces -a return ;; -p) return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1" -u) -V' -- "$cur")) return fi _mac_addresses } && complete -F _ether_wake ether-wake etherwake # ex: filetype=sh puppet 0000644 00000023425 15036124163 0006013 0 ustar 00 # bash completion for puppet -*- shell-script -*- _puppet_logdest() { if [[ -z $cur ]]; then COMPREPLY=($(compgen -W 'syslog console /' -- "$cur")) else COMPREPLY=($(compgen -W 'syslog console' -- "$cur")) _filedir fi } _puppet_digest() { COMPREPLY=($(compgen -W 'MD5 MD2 SHA1 SHA256' -- "$cur")) } _puppet_certs() { local puppetca="puppet cert" PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin type puppetca &>/dev/null && puppetca=puppetca if [[ $1 == --all ]]; then cert_list=$($puppetca --list --all | command sed -e 's/^[+-]\{0,1\}\s*\(\S\+\)\s\+.*$/\1/') else cert_list=$($puppetca --list) fi COMPREPLY+=($(compgen -W "$cert_list" -- "$cur")) } _puppet_types() { puppet_types=$(puppet describe --list | command sed -e 's/^\(\S\{1,\}\).*$/\1/') COMPREPLY+=($(compgen -W "$puppet_types" -- "$cur")) } _puppet_references() { local puppetdoc="puppet doc" PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin type puppetdoc &>/dev/null && puppetdoc=puppetdoc puppet_doc_list=$($puppetdoc --list | command sed -e 's/^\(\S\{1,\}\).*$/\1/') COMPREPLY+=($(compgen -W "$puppet_doc_list" -- "$cur")) } _puppet_subcmd_opts() { # puppet cmd help is somewhat slow, avoid if possible [[ -z $cur || $cur == -* ]] && COMPREPLY+=($(compgen -W \ '$(_parse_usage "$1" "help $2")' -- "$cur")) } _puppet() { local cur prev words cword _init_completion || return local subcommand action case $prev in -h | --help | -V | --version) return ;; esac case ${words[0]} in puppetmasterd) subcommand=master ;; puppetd) subcommand=agent ;; puppetca) subcommand=cert ;; ralsh) subcommand=resource ;; puppetrun) subcommand=kick ;; puppetqd) subcommand=queue ;; filebucket) subcommand=filebucket ;; puppetdoc) subcommand=doc ;; pi) subcommand=describe ;; puppet) case ${words[1]} in agent | apply | cert | describe | doc | filebucket | kick | master | parser | queue | resource) subcommand=${words[1]} ;; *.pp | *.rb) subcommand=apply ;; *) COMPREPLY=($(compgen -W 'agent apply cert describe doc filebucket kick master parser queue resource' \ -- "$cur")) return ;; esac ;; esac case $subcommand in agent) case $prev in --certname) _known_hosts_real -- "$cur" return ;; --digest) _puppet_digest return ;; --fqdn) _known_hosts_real -- "$cur" return ;; -l | --logdest) _puppet_logdest return ;; --masterport) COMPREPLY=($(compgen -W '8140' -- "$cur")) return ;; -w | --waitforcert) COMPREPLY=($(compgen -W '0 15 30 60 120' -- "$cur")) return ;; *) _puppet_subcmd_opts "$1" $subcommand # _parse_usage doesn't grok [-D|--daemonize|--no-daemonize] COMPREPLY+=($(compgen -W '--no-daemonize' -- "$cur")) return ;; esac ;; apply) case $prev in --catalog) COMPREPLY=($(compgen -W '-' -- "$cur")) _filedir json return ;; --execute) return ;; -l | --logdest) _puppet_logdest return ;; *) if [[ $cur == -* ]]; then _puppet_subcmd_opts "$1" $subcommand else _filedir fi return ;; esac ;; cert) case $prev in --digest) _puppet_digest return ;; *) action=$prev COMPREPLY=($(compgen -W '--digest --debug --help --verbose --version' \ -- "$cur")) case $action in fingerprint | list | verify | --fingerprint | --list | --verify) COMPREPLY+=($(compgen -W '--all' -- "$cur")) _puppet_certs --all return ;; generate | --generate) _known_hosts_real -- "$cur" return ;; clean | print | revoke | --clean | --print | --revoke) _puppet_certs --all return ;; sign | --sign) COMPREPLY+=($(compgen -W '--all' -- "$cur")) _puppet_certs return ;; *) COMPREPLY+=($(compgen -W 'clean fingerprint generate list print revoke sign verify reinventory' -- "$cur")) return ;; esac ;; esac ;; describe) _puppet_subcmd_opts "$1" $subcommand if [[ $cur != -* ]]; then _puppet_types fi return ;; doc) case $prev in -o | --outputdir) _filedir -d return ;; -m | --mode) COMPREPLY=($(compgen -W 'text trac pdf rdoc' -- "$cur")) return ;; -r | --reference) _puppet_references return ;; *) if [[ $cur == -* ]]; then _puppet_subcmd_opts "$1" $subcommand else _filedir fi return ;; esac ;; filebucket) case $prev in -s | --server) _known_hosts_real -- "$cur" return ;; -b | --bucket) _filedir -d return ;; *) if [[ $cur == -* ]]; then _puppet_subcmd_opts "$1" $subcommand else COMPREPLY=($(compgen -W 'backup get restore' \ -- "$cur")) _filedir fi return ;; esac ;; kick) case $prev in -c | --class) return ;; --host) _known_hosts_real -- "$cur" return ;; -t | --tag) return ;; *) if [[ $cur == -* ]]; then _puppet_subcmd_opts "$1" $subcommand else _known_hosts_real -- "$cur" fi return ;; esac ;; master) case $prev in -l | --logdest) _puppet_logdest return ;; *) _puppet_subcmd_opts "$1" $subcommand # _parse_usage doesn't grok [-D|--daemonize|--no-daemonize] COMPREPLY+=($(compgen -W '--no-daemonize' -- "$cur")) return ;; esac ;; parser) action=$prev case $action in validate) _filedir pp return ;; *) COMPREPLY=($(compgen -W 'validate' -- "$cur")) return ;; esac ;; queue) case $prev in -l | --logdest) _puppet_logdest return ;; *) if [[ $cur == -* ]]; then _puppet_subcmd_opts "$1" $subcommand else _filedir fi return ;; esac ;; resource | *) _puppet_subcmd_opts "$1" $subcommand return ;; esac } && complete -F _puppet puppetmasterd puppetd puppetca ralsh puppetrun puppetqd filebucket puppetdoc puppet # ex: filetype=sh plague-client 0000644 00000000631 15036124163 0007221 0 ustar 00 # bash completion for plague-client -*- shell-script -*- _plague_client() { local cur prev words cword _init_completion || return ((cword == 1)) && COMPREPLY=($(compgen -W 'build detail finish help is_paused kill list list_builders pause requeue unpause update_builders' -- "$cur")) } && complete -F _plague_client plague-client # ex: filetype=sh tar 0000644 00000044347 15036124163 0005272 0 ustar 00 # bash completion for GNU tar -*- shell-script -*- # # General info # ============ # # The "old" style arguments # ------------------------- # # We don't "advice" the old tar option format by default for GNU tar, example: # # 'tar czfT /tmp/archive.tar patterns.txt' # # We rather advice the 'tar -czf /tmp/archive.tar -T patterns.txt' format of # arguments. Though, if user starts the 'first' tar argument without leading # dash, we treat the command line apropriately. # # # long/short options origin # ------------------------- # # For GNU tar, everything is parsed from `tar --help` output so not so much # per-distribution work should be needed. The _parse_help does not seem to be # good enough so parsed here directly. # # # FIXME: --starting-file (-K) (should be matched for extraction only) # FIXME: handle already used (at least short) options # FIXME: Test-cases for make check. # - check for no global variable pollution # FIXME: why PS4='$BASH_SOURCE:$LINENO: ' shows sometimes negative lines? # FIXME: timeout on tarball listing # FIXME: cache 'tar --help' parsing results into global variables # FIXME: at least 'tar -<tab>' should show some helping text (apart from just # pure option advices) # FIXME: short option completion should be more intuitive # - verbose mode option should be advised multiple times # - mode option should be advised only once # - format option should be advised only once # ... __gtar_parse_help_opt() { local opttype arg opt separator optvar opttype=long arg="$2" opt="$1" separator=" " case "$opt" in --*) ;; -\?) return ;; -*) opttype=short opt=${opt##-} separator= ;; *) echo "bash_completion: $FUNCNAME: unknown option $opt" >&2 return 1 ;; esac # Remove arguments. opt=${opt//\[*/} opt=${opt//=*/=} # Basic sanity. opt=${opt//\"*/} opt=${opt//\'*/} opt=${opt//\;*/} optvar=$opttype'_arg_'$arg eval "$optvar=\"\$$optvar$separator\"\"$opt\"" } __gtar_parse_help_line() { local i for i in $1; do case "$i" in # regular options --* | -*) __gtar_parse_help_opt "$i" "$2" ;; # end once there is single non-option word *) break ;; esac done } __gnu_tar_parse_help() { local str line arg while IFS= read line; do # Ok, this requires some comment probably. The GNU help output prints # options on lines beginning with spaces. After that, there is one # or more options separated by ', ' separator string. We are matching # like this then: ^<spaces>(<separator>?<option>)+<whatever>$ if [[ $line =~ \ ^[[:blank:]]{1,10}(((,[[:blank:]])?(--?([\]\[a-zA-Z0-9?=-]+))(,[[:space:]])?)+).*$ ]]; then line=${BASH_REMATCH[1]} str="${line//,/ }" # Detect that all options on this line accept arguments (and whether # the arguments are required or not). Note that only long option # description in GNU help output mentions arguments. So the $line # variable may contain e.g. '-X, --XXX[=NAME], -XXX2[=NAME]'. arg=none if [[ $line =~ --[A-Za-z0-9-]+(\[?)= ]]; then [[ -n ${BASH_REMATCH[1]} ]] && arg=opt || arg=req fi __gtar_parse_help_line "$str" "$arg" fi done <<<"$(tar --help)" long_opts="\ $long_arg_none $long_arg_opt $long_arg_req" short_opts="$short_arg_none$short_arg_opt$short_arg_req" } # Hack: parse --warning keywords from tar's error output __gtar_parse_warnings() { local line LC_ALL=C tar --warning= 2>&1 | while IFS= read line; do if [[ $line =~ ^[[:blank:]]*-[[:blank:]]*[\`\']([a-zA-Z0-9-]+)\'$ ]]; then echo "${BASH_REMATCH[1]} no-${BASH_REMATCH[1]}" fi done } # Helper to obtain last character of string. __tar_last_char() { echo "${1:$((${#1} - 1))}" } __tar_parse_old_opt() { local first_word char # current word is the first word [[ $cword -eq 1 && -n $cur && ${cur:0:1} != '-' ]] && old_opt_progress=1 # check that first argument does not begin with "-" first_word=${words[1]} [[ -n $first_word && ${first_word:0:1} != "-" ]] && old_opt_used=1 # parse the old option (if present) contents to allow later code expect # corresponding arguments if ((old_opt_used == 1)); then char=${first_word:0:1} while [[ -n $char ]]; do if __tar_is_argreq "$char"; then old_opt_parsed+=("$char") fi first_word=${first_word##$char} char=${first_word:0:1} done fi } # Make the analysis of whole command line. __tar_preparse_cmdline() { local first_arg i modes="ctxurdA" shift # progname __tar_parse_old_opt first_arg=1 for i in "$@"; do case "$i" in --delete | --test-label) tar_mode=${i:2:100} tar_mode_arg=$i break ;; --*) # skip ;; -*[$modes]*) tar_mode=${i//[^$modes]/} tar_mode=${tar_mode:0:1} tar_mode_arg=$i break ;; *[$modes]*) # Only the first arg may be "MODE" without leading dash if ((first_arg == 1)); then tar_mode=${i//[^$modes]/} tar_mode=${tar_mode:0:1} tar_mode_arg=$i fi ;; esac first_arg=0 done } # Generate completions for -f/--file. __tar_file_option() { local ext="$1" case "$tar_mode" in c) # no need to advise user to re-write existing tarball _filedir -d ;; *) _filedir "$ext" ;; esac } # Returns truth if option requires argument. No equal sign must be pasted. # Accepts option in format: 'c', '-c', '--create' __tar_is_argreq() { local opt opt=$1 case "$opt" in -[A-Za-z0-9?]) [[ $short_arg_req =~ ${opt##-} ]] && return 0 ;; [A-Za-z0-9?]) [[ $short_arg_req =~ ${opt} ]] && return 0 ;; --*) [[ $long_arg_req =~ [[:blank:]]$opt=[[:blank:]] ]] && return 0 ;; esac return 1 } # Called only for short parameter __tar_complete_mode() { local short_modes rawopt generated \ allshort_raw_unused allshort_raw \ filler i short_modes="ctx" [[ ! -v basic_tar ]] && short_modes="ctxurdA" # Remove prefix when needed rawopt=${cur#-} # -c -z -x ... => czx allshort_raw=${short_opts//[- ]/} # init the 'mode' option if no option is in ${cur} if [[ $tar_mode == none ]]; then # when user passed something like 'tar cf' do not put the '-' before filler= if [[ -z $cur && ! -v basic_tar ]]; then filler=- fi generated="" for ((i = 0; 1; i++)); do local c="${short_modes:i:1}" [[ -z $c ]] && break generated+=" $filler$cur$c" done COMPREPLY=($(compgen -W "$generated")) return 0 fi # The last short option requires argument, like '-cf<TAB>'. Cut the # completion here to enforce argument processing. if ((old_opt_progress == 0)) && __tar_is_argreq "$(__tar_last_char "$cur")"; then COMPREPLY=("$cur") && return 0 fi allshort_raw_unused=${allshort_raw//[$rawopt]/} if [[ $tar_mode != none ]]; then allshort_raw_unused=${allshort_raw_unused//[$short_modes]/} fi generated= for ((i = 0; 1; i++)); do local c="${allshort_raw_unused:i:1}" [[ -z $c ]] && break generated+=" $cur$c" done COMPREPLY=($(compgen -W "$generated")) return 0 } __gtar_complete_lopts() { local rv COMPREPLY=($(compgen -W "$long_opts" -- "$cur")) rv=$? [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return $rv } __gtar_complete_sopts() { local generated short_mode_opts i c short_mode_opts="ctxurdA" generated=${short_opts//[$short_mode_opts]/} for ((i = 0; 1; i++)); do c="${allshort_raw_unused:i:1}" [[ -z $c ]] && break generated+=" $cur$c" done COMPREPLY=($(compgen -W "$generated" -- "$cur")) } __tar_try_mode() { case "$cur" in --*) # posix tar does not support long opts [[ -v basic_tar ]] && return 0 __gtar_complete_lopts return $? ;; -*) # posix tar does not support short optios [[ -v basic_tar ]] && return 0 __tar_complete_mode && return 0 ;; *) if [[ $cword -eq 1 || $tar_mode == none ]]; then __tar_complete_mode && return 0 fi ;; esac return 1 } __tar_adjust_PREV_from_old_option() { # deal with old style arguments here # $ tar cfTC # expects this sequence of arguments: # $ tar cfTC ARCHIVE_FILE PATTERNS_FILE CHANGE_DIR if ((old_opt_used == 1 && cword > 1 && \ cword < ${#old_opt_parsed[@]} + 2)); then # make e.g. 'C' option from 'cffCT' prev="-${old_opt_parsed[cword - 2]}" fi } __tar_extract_like_mode() { local i for i in x d t delete; do [[ $tar_mode == "$i" ]] && return 0 done return 1 } __tar_try_list_archive() { local tarball tarbin untar i __tar_extract_like_mode || return 1 # This all is just to approach directory completion from "virtual" # directory structure in tarball (for which the _filedir is unusable) set -- "${words[@]}" tarbin=$1 untar="tf" shift for i in "$@"; do if [[ $i == *.$ext ]]; then tarball=$i break fi done if [[ -n $tarball ]]; then local IFS=$'\n' COMPREPLY=($(compgen -o filenames -W "$( $tarbin $untar "$tarball" 2>/dev/null | while read line; do printf "%q\n" "$(printf %q"\n" "$line")" done )" -- "$(printf "%q\n" "$cur")")) return 0 fi } __tar_cleanup_prev() { if [[ $prev =~ ^-[a-zA-Z0-9?]*$ ]]; then # transform '-caf' ~> '-f' prev="-$(__tar_last_char "$prev")" fi } __tar_detect_ext() { local tars='@(@(tar|gem|spkg)?(.@(Z|[bgx]z|bz2|lz?(ma|o)|zst))|t@([abglx]z|b?(z)2|zst))' ext="$tars" case "$tar_mode_arg" in --*) # Should never happen? ;; ?(-)*[cr]*f) ext='@(tar|gem|spkg)' case ${words[1]} in *a*) ext="$tars" ;; *z*) ext='t?(ar.)gz' ;; *Z*) ext='ta@(r.Z|z)' ;; *[jy]*) ext='t@(?(ar.)bz?(2)|b2)' ;; *J*) ext='t?(ar.)xz' ;; esac ;; +([^ZzJjy])f) # Pass through using defaults above ;; *[Zz]*f) ext='@(@(t?(ar.)|gem.|spkg.)@(gz|Z)|taz)' ;; *[jy]*f) ext='@(@(t?(ar.)|gem.)bz?(2)|spkg|tb2)' ;; *[J]*f) ext='@(@(tar|gem|spkg).@(lzma|xz)|t[lx]z)' ;; esac } _gtar() { local long_opts short_opts \ long_arg_none="" long_arg_opt="" long_arg_req="" \ short_arg_none="" short_arg_opt="" short_arg_req="" \ tar_mode tar_mode_arg old_opt_progress=0 \ old_opt_used=0 old_opt_parsed=() # Main mode, e.g. -x or -c (extract/creation) local tar_mode=none # The mode argument, e.g. -cpf or -c # FIXME: handle long options local tar_mode_arg= if [[ -v BASHCOMP_TAR_OPT_DEBUG ]]; then set -x PS4='$BASH_SOURCE:$LINENO: ' fi local cur prev words cword split _init_completion -s || return # Fill the {long,short}_{opts,arg*} __gnu_tar_parse_help __tar_preparse_cmdline "${words[@]}" local ext __tar_detect_ext while true; do # just-for-easy-break while, not looping __tar_adjust_PREV_from_old_option __tar_posix_prev_handle && break __tar_cleanup_prev # Handle all options *REQUIRING* argument. Optional arguments are up to # user (TODO: is there any sane way to deal with this?). This case # statement successes only if there already is PREV. case $prev in --directory | -!(-*)C) _filedir -d break ;; --atime-preserve) COMPREPLY=($(compgen -W 'replace system' -- "$cur")) break ;; --group) COMPREPLY=($(compgen -g -- "$cur")) break ;; --owner) COMPREPLY=($(compgen -u -- "$cur")) break ;; --info-script | --new-volume-script | --rmt-command | --rsh-command | \ --use-compress-program | -!(-*)[FI]) compopt -o filenames COMPREPLY=($(compgen -c -- "$cur")) break ;; --volno-file | --add-file | --files-from | --exclude-from | \ --index-file | --listed-incremental | -!(-*)[TXg]) _filedir break ;; --format | -!(-*)H) COMPREPLY=($(compgen -W 'gnu oldgnu pax posix ustar v7' \ -- "$cur")) break ;; --quoting-style) COMPREPLY=($(compgen -W 'literal shell shell-always c c-maybe escape locale clocale' -- "$cur")) break ;; --totals) COMPREPLY=($(compgen -W 'SIGHUP SIGQUIT SIGINT SIGUSR1 SIGUSR2' \ -- "$cur")) break ;; --warning) COMPREPLY=($(compgen -W "$(__gtar_parse_warnings)" -- "$cur")) break ;; --file | -!(-*)f) __tar_file_option "$ext" break ;; --*) # parameter with required argument but no completion yet [[ " $long_arg_req " =~ \ $prev=\ ]] && break # parameter with optional argument passed with =, something like # --occurrence=*<TAB> which is not handled above [[ " $long_arg_opt " =~ \ $prev\ ]] && break # if there is some unknown option with '=', for example # (literally) user does --nonexistent=<TAB>, we do not want # continue also $split && break # Most probably, when code goes here, the PREV variable contains # some string from "$long_arg_none" and we want continue. ;; -!(-*)[a-zA-Z0-9?]) # argument required but no completion yet [[ $short_arg_req =~ ${prev##-} ]] && break ;; esac # safety belts case "$cur" in -[a-zA-Z0-9]=*) # e.g. 'tar -c -f=sth' does not what user could expect break ;; esac # Handle the main operational mode of tar. We should do it as soon as # possible. __tar_try_mode && break # handle others case "$cur" in --*) __gtar_complete_lopts break ;; -*) # called only if it is *not* first parameter __gtar_complete_sopts break ;; esac # the first argument must be "mode" argument or --param, if any of those # was truth - the 'break' statement would have been already called ((cword == 1)) && break __tar_try_list_archive && break # file completion on relevant files if [[ $tar_mode != none ]]; then _filedir fi break done # just-for-easy-break while if [[ -v BASHCOMP_TAR_OPT_DEBUG ]]; then set +x unset PS4 fi } __tar_posix_prev_handle() { case "$prev" in -f) __tar_file_option "$ext" return 0 ;; -b) return 0 ;; esac return 1 } _posix_tar() { local long_opts short_opts basic_tar \ long_arg_none="" long_arg_opt long_arg_req="" \ short_arg_none short_arg_opt short_arg_req \ tar_mode tar_mode_arg old_opt_progress=0 \ old_opt_used=1 old_opt_parsed=() # Main mode, e.g. -x or -c (extract/creation) local tar_mode=none # The mode argument, e.g. -cpf or -c local tar_mode_arg= local cur prev words cword split _init_completion -s || return basic_tar=yes tar_mode=none # relatively compatible modes are {c,t,x} # relatively compatible options {b,f,m,v,w} short_arg_req="fb" short_arg_none="wmv" short_opts="$short_arg_req$short_arg_none" __tar_preparse_cmdline "${words[@]}" local ext __tar_detect_ext __tar_adjust_PREV_from_old_option __tar_posix_prev_handle && return __tar_try_mode && return __tar_try_list_archive && return # file completion on relevant files _filedir } _tar() { local cmd=${COMP_WORDS[0]} func line line="$($cmd --version 2>/dev/null)" case "$line" in *GNU*) func=_gtar ;; *) func=_posix_tar ;; esac $func "$@" # Install real completion for subsequent completions if [[ ${COMP_TAR_INTERNAL_PATHS-} ]]; then complete -F $func -o dirnames tar else complete -F $func tar fi unset -f _tar } if [[ ${COMP_TAR_INTERNAL_PATHS-} ]]; then complete -F _tar -o dirnames tar complete -F _gtar -o dirnames gtar complete -F _posix_tar -o dirnames bsdtar complete -F _posix_tar -o dirnames star else complete -F _tar tar complete -F _gtar gtar complete -F _posix_tar bsdtar complete -F _posix_tar star fi # ex: filetype=sh dselect 0000644 00000001147 15036124163 0006116 0 ustar 00 # Debian Linux dselect(8) completion -*- shell-script -*- _dselect() { local cur prev words cword _init_completion || return case $prev in --admindir) _filedir -d return ;; -D | -debug) _filedir return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) else COMPREPLY=($(compgen -W 'access update select install config remove quit' -- "$cur")) fi } && complete -F _dselect dselect # ex: filetype=sh tracepath 0000644 00000001064 15036124163 0006444 0 ustar 00 # tracepath(8) completion -*- shell-script -*- _tracepath() { local cur prev words cword _init_completion || return case $prev in -*[lmp]) return ;; esac if [[ $cur == -* ]]; then local opts=$(_parse_help "$1") COMPREPLY=($(compgen -W '${opts:-$(_parse_usage "$1")}' -- "$cur")) return fi local ipvx [[ $1 == *6 ]] && ipvx=-6 _known_hosts_real ${ipvx-} -- "$cur" } && complete -F _tracepath tracepath tracepath6 # ex: filetype=sh dpkg 0000644 00000010511 15036124163 0005413 0 ustar 00 # This function is required by _dpkg and _dpkg-reconfigure -*- shell-script -*- _have grep-status && { _comp_dpkg_installed_packages() { grep-status -P -e "^$1" -a -FStatus 'ok installed' -n -s Package } } || { _comp_dpkg_installed_packages() { command grep -A 1 "Package: $1" /var/lib/dpkg/status 2>/dev/null | command grep -B 1 -Ee "ok installed|half-installed|unpacked| \ half-configured" \ -Ee "^Essential: yes" | awk "/Package: $1/ { print \$2 }" 2>/dev/null } } _have grep-status && { _comp_dpkg_purgeable_packages() { grep-status -P -e "^$1" -a -FStatus 'ok installed' -o -FStatus 'ok config-files' -n -s Package } } || { _comp_dpkg_purgeable_packages() { command grep -A 1 "Package: $1" /var/lib/dpkg/status 2>/dev/null | command grep -B 1 -Ee "ok installed|half-installed|unpacked| \ half-configured|config-files" \ -Ee "^Essential: yes" | awk "/Package: $1/ { print \$2 }" 2>/dev/null } } # Debian dpkg(1) completion # _dpkg() { local cur prev words cword split _init_completion -s || return local i=$cword # find the last option flag if [[ $cur != -* ]]; then while [[ $prev != -* && $i -ne 1 ]]; do prev=${words[--i - 1]} done fi case $prev in --install | --unpack | --record-avail | --contents | --info | --fsys-tarfile | \ --field | --control | --extract | --vextract | --raw-extract | -!(-*)[ciAIfexX]) _filedir '?(u|d)deb' return ;; --build | -!(-*)b) _filedir -d return ;; --status | --print-avail | --list | -!(-*)[spl]) COMPREPLY=($(_xfunc apt-cache _apt_cache_packages)) return ;; --show | -!(-*)W) if [[ $1 == *dpkg-query ]]; then COMPREPLY=($(_xfunc apt-cache _apt_cache_packages)) else _filedir '?(u|d)deb' fi return ;; --search | -!(-*)S) _filedir return ;; --remove | --verify | -!(-*)[rV]) COMPREPLY=($(_comp_dpkg_installed_packages "$cur")) return ;; --listfiles | --purge | -!(-*)[LP]) COMPREPLY=($(_comp_dpkg_purgeable_packages "$cur")) return ;; esac $split && return COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace } && complete -F _dpkg dpkg dpkg-query # Debian dpkg-deb(1) completion # _dpkg_deb() { local cur prev words cword split _init_completion -s || return _expand || return 0 local i=$cword # find the last option flag if [[ $cur != -* ]]; then while [[ $prev != -* && $i -ne 1 ]]; do i=$((i-1)) prev=${words[i-1]} done fi case $prev in -c|-I|-W|-f|-e|-x|-X|-R|--contents|--info|--show|--field|--control| \ --extract|--vextract|--raw-extract|--fsys-tarfile) _filedir '?(u|d)deb' return 0 ;; -b|--build) _filedir -d return 0 ;; esac $split && return COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) [[ $COMPREPLY == *= ]] && compopt -o nospace } && complete -F _dpkg_deb dpkg-deb # Debian GNU dpkg-reconfigure(8) completion # _dpkg_reconfigure() { local cur prev words cword _init_completion || return local opt case $prev in --frontend | -!(-*)f) opt=($(printf '%s\n' /usr/share/perl5/Debconf/FrontEnd/*)) opt=(${opt[@]##*/}) opt=(${opt[@]%.pm}) COMPREPLY=($(compgen -W '${opt[@]}' -- "$cur")) return ;; --priority | -!(-*)p) COMPREPLY=($(compgen -W 'low medium high critical' -- "$cur")) return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '--frontend --priority --all --unseen-only --help --showold --force --terse' -- "$cur")) else COMPREPLY=($(_comp_dpkg_installed_packages "$cur")) fi } && complete -F _dpkg_reconfigure -o default dpkg-reconfigure # ex: filetype=sh kmod 0000644 00000006243 15036124163 0005427 0 ustar 00 # kmod completion -*- shell-script -*- # # This file is part of kmod. # # Copyright 2010 Ran Benita # Copyright (C) 2013 Intel Corporation. All rights reserved. # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with this program; if not, see <http://www.gnu.org/licenses/>. __contains_word () { local word=$1; shift for w in "$@"; do [[ "$w" = "$word" ]] && return 0; done return 1 } __is_opt () { local prevprev=${COMP_WORDS[COMP_CWORD-2]} local short="$1" long="$2" if [[ "$prev" = "$short" || "$prev" = "$long" ]]; then declare -g cur=${cur#=} return 0 elif [[ "$prev" = "=" && "$prevprev" = "$long" ]]; then return 0 fi return 1 } _kmod_static_nodes () { local OPTS='-o -f -h --help' local OPTS_EQUAL='--output --format' local GROUP_FORMAT='human tmpfiles devname' if __is_opt '-o' '--output'; then compopt -o filenames COMPREPLY=( $(compgen -f -- "$cur") ) return 0 elif __is_opt '-f' '--format'; then COMPREPLY=( $(compgen -W "$GROUP_FORMAT" -- "$cur" ) ) return 0 fi local cur=${COMP_WORDS[COMP_CWORD]} compopt -o nospace COMPREPLY=( $(compgen -W "$OPTS" -- "$cur") ) COMPREPLY+=( $(compgen -W "$OPTS_EQUAL" -S= -- "$cur") ) } _kmod() { local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} local VERBS=(help list static-nodes) local OPTS='-h --help -V --version' local verb # standalone options, no other option or action allowed for ((i=0; $i < $COMP_CWORD; i++)); do if __contains_word "${COMP_WORDS[i]}" ${OPTS}; then return 0 fi done # find the action for ((i=0; $i <= $COMP_CWORD; i++)); do if __contains_word "${COMP_WORDS[i]}" "${VERBS[@]}"; then verb=${COMP_WORDS[i]} break fi done if [[ -z $verb ]]; then COMPREPLY=( $(compgen -W '${OPTS[*]} ${VERBS[*]}' -- "$cur") ) return 0 fi local func=${verb//-/_} if declare -F _kmod_${func} > /dev/null; then _kmod_${func} fi # allow the space if there's only one completion and it doesn't end with # '=' if [[ ${#COMPREPLY[@]} == 1 && ${COMPREPLY[0]} != *"=" ]] ; then compopt +o nospace fi return 0 } complete -F _kmod kmod update-initramfs 0000644 00000001105 15036124163 0007741 0 ustar 00 # update-initramfs(8) completion _update_initramfs() { local cur prev valid_options _get_comp_words_by_ref cur prev # The only option that takes an argument is -k if [[ "$prev" == '-k' ]]; then # Complete with kernel versions _kernel_versions COMPREPLY=( $( compgen -W '${COMPREPLY[@]} all' -- "$cur" ) ) return; fi # Complete with available options (obtained from -h) valid_options=$( update-initramfs -h 2>&1 | \ sed -e '/^ -/!d;s/^ \(-\w\+\).*/\1/' ) COMPREPLY=( $( compgen -W "$valid_options" -- $cur ) ) } complete -F _update_initramfs update-initramfs userdel 0000644 00000001041 15036124164 0006130 0 ustar 00 # userdel(8) completion -*- shell-script -*- _userdel() { local cur prev words cword _init_completion || return case $prev in --help | -!(-*)h) return ;; --root | -!(-*)R) _filedir -d return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) return fi COMPREPLY=($(compgen -u -- "$cur")) } && complete -F _userdel userdel # ex: filetype=sh pm-hibernate 0000644 00000000501 15036124164 0007040 0 ustar 00 # bash completion for pm-utils -*- shell-script -*- _pm_action() { local cur prev words cword _init_completion || return COMPREPLY=($(compgen -W "--help $(_parse_help "$1")" -- "$cur")) } && complete -F _pm_action pm-hibernate pm-suspend pm-suspend-hybrid # ex: filetype=sh hping2 0000644 00000001430 15036124164 0005656 0 ustar 00 # bash completion for hping2 -*- shell-script -*- _hping2() { local cur prev words cword _init_completion || return case $prev in --interface | -!(-*)I) _available_interfaces return ;; --spoof | -!(-*)a) _known_hosts_real -- "$cur" return ;; --tos | -!(-*)o) COMPREPLY=($(compgen -W '02 04 08 10')) return ;; --file | -!(-*)E) _filedir return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) else _known_hosts_real -- "$cur" fi } && complete -F _hping2 hping hping2 hping3 # ex: filetype=sh perl 0000644 00000010273 15036124164 0005436 0 ustar 00 # bash completion for perl -*- shell-script -*- _perl_helper() { COMPREPLY=($(compgen -P "$prefix" -W \ "$(${2:-perl} ${BASH_SOURCE[0]%/*}/../helpers/perl $1 $cur)" \ -- "$cur")) [[ $1 == functions ]] || __ltrim_colon_completions "$prefix$cur" } _perl() { local cur prev words cword _init_completion -n : || return local prefix="" temp optPrefix optSuffix # If option not followed by whitespace, reassign prev and cur if [[ $cur == -?* ]]; then temp=$cur prev=${temp:0:2} cur=${temp:2} if [[ $prev == -d && $cur == t* ]]; then prev=-dt cur=${cur:1} fi optPrefix=-P$prev optSuffix=-S/ prefix=$prev case $prev in -*[DeEiFl]) return ;; -*[Ix]) local IFS=$'\n' compopt -o filenames COMPREPLY=($(compgen -d $optPrefix $optSuffix -- "$cur")) return ;; -*[mM]) temp="${cur#-}" prefix+="${cur%$temp}" cur="$temp" _perl_helper modules $1 return ;; -*V) if [[ $cur == :* ]]; then temp="${cur##+(:)}" prefix+="${cur%$temp}" local IFS=$'\n' 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 ;; -*d | -*dt) if [[ $cur == :* ]]; then temp="${cur#:}" prefix="$prefix${cur%$temp}" cur="Devel::$temp" _perl_helper modules $1 fi ;; esac # Unlike other perl options, having a space between the `-e' and # `-E' options and their arguments, e.g. `perl -e "exit 2"', is # valid syntax. However, the argument is neither a filename nor a # directory, but one line of perl program, thus do not suggest # _filedir completion. elif [[ $prev == -e ]] || [[ $prev == -E ]]; then return # Likewise, `-I' also accepts a space between option and argument # and it takes a directory as value. elif [[ $prev == -I ]]; then local IFS=$'\n' compopt -o filenames COMPREPLY=($(compgen -d ${optPrefix-} ${optSuffix-} -- "$cur")) return elif [[ $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 } && complete -F _perl perl _perldoc() { local cur prev words cword _init_completion -n : || return local prefix="" temp # completing an option (may or may not be separated by a space) if [[ $cur == -?* ]]; then temp=$cur prev=${temp:0:2} cur=${temp:2} prefix=$prev fi local perl="${1%doc}" [[ $perl == "$1" ]] || ! type $perl &>/dev/null && perl= case $prev in -*[hVnoMwL]) return ;; -*d) _filedir return ;; -*f) _perl_helper functions $perl return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1" -h)' -- "$cur")) else # return available modules (unless it is clearly a file) if [[ $cur != @(*/|[.~])* ]]; then _perl_helper perldocs $perl if [[ $cur == p* ]]; then COMPREPLY+=($(compgen -W \ '$(PERLDOC_PAGER=cat "$1" -u perl | \ command sed -ne "/perl.*Perl overview/,/perlwin32/p" | \ awk "\$NF=2 && \$1 ~ /^perl/ { print \$1 }")' \ -- "$cur")) fi fi _filedir 'p@([lm]|od)' fi } && complete -F _perldoc -o bashdefault perldoc # ex: filetype=sh fsck 0000644 00000001402 15036124164 0005414 0 ustar 00 _fsck_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-b') COMPREPLY=( $(compgen -W "superblock" -- $cur) ) return 0 ;; '-B') COMPREPLY=( $(compgen -W "blocksize" -- $cur) ) return 0 ;; '-j') COMPREPLY=( $(compgen -W "external_journal" -- $cur) ) return 0 ;; '-l'|'-L') COMPREPLY=( $(compgen -W "bad_blocks_file" -- $cur) ) return 0 ;; '-?') return 0 ;; esac case $cur in -*) OPTS="-p -n -y -c -f -v -b -B -j -l -L" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac compopt -o bashdefault -o default COMPREPLY=( $(compgen -W "$(lsblk -pnro name)" -- $cur) ) return 0 } complete -F _fsck_module fsck lsusb 0000644 00000000647 15036124164 0005630 0 ustar 00 # lsusb(8) completion -*- shell-script -*- _lsusb() { local cur prev words cword _init_completion || return case $prev in --help | --version | -!(-*)@([sD]|[hV]*)) return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) fi } && complete -F _lsusb lsusb # ex: filetype=sh ant 0000644 00000005360 15036124164 0005257 0 ustar 00 # bash completion for ant and phing -*- shell-script -*- _ant_parse_targets() { local line basedir [[ $1 == */* ]] && basedir=${1%/*} || basedir=. # parse buildfile for targets while read -rd '>' line; do if [[ $line =~ \<(target|extension-point)[[:space:]].*name=[\"\']([^\"\']+) ]]; then targets+=" ${BASH_REMATCH[2]}" fi done <$1 # parse imports while read -rd '>' line; do if [[ $line =~ \<import[[:space:]].*file=[\"\']([^\"\']+) ]]; then local imported_buildfile imported_buildfile="${basedir}/${BASH_REMATCH[1]}" if [[ -f $imported_buildfile ]]; then _ant_parse_targets $imported_buildfile fi fi done <$1 } _ant() { local cur prev words cword _init_completion || return case $prev in -h | -help | --h | --help | -projecthelp | -p | -version | -diagnostics) return ;; -buildfile | -file | -f) _filedir 'xml' return ;; -logfile | -l) [[ $1 != *phing || $prev != -l ]] && _filedir return ;; -propertyfile) _filedir properties return ;; -nice) COMPREPLY=($(compgen -W '{1..10}' -- "$cur")) return ;; -lib) _filedir -d return ;; -logger | -listener | -inputhandler | -main | -find | -s) return ;; esac if [[ $cur == -D* ]]; then return elif [[ $cur == -* ]]; then # The </dev/null prevents "phing -" weirdness/getting just a literal # tab displayed on complete on CentOS 6 with phing 2.6.1. COMPREPLY=( $(compgen -W '$(_parse_help "$1" -h </dev/null)' -- "$cur")) else # available targets completion # find which buildfile to use local buildfile=build.xml i for ((i = 1; i < cword; i++)); do if [[ ${words[i]} == -@(?(build)file|f) ]]; then buildfile=${words[i + 1]} break fi done if ((i == cword)); then for i in ${ANT_ARGS-}; do if [[ $prev == -@(?(build)file|f) ]]; then buildfile=$i break fi prev=$i done fi [[ ! -f $buildfile ]] && return local targets # fill targets _ant_parse_targets $buildfile COMPREPLY=($(compgen -W '$targets' -- "$cur")) fi } && complete -F _ant ant phing type complete-ant-cmd.pl &>/dev/null && complete -C complete-ant-cmd.pl -F _ant ant || : # ex: filetype=sh p4 0000644 00000002572 15036124164 0005022 0 ustar 00 # Perforce completion -*- shell-script -*- # by Frank Cusack <frank@google.com> _p4() { local cur prev words cword _init_completion || return local p4commands p4filetypes # rename isn't really a command p4commands="$(p4 help commands 2>/dev/null | awk 'NF>3 {print $1}')" p4filetypes="ctext cxtext ktext kxtext ltext tempobj ubinary \ uresource uxbinary xbinary xltext xtempobj xtext \ text binary resource" if ((cword == 1)); then COMPREPLY=($(compgen -W "$p4commands" -- "$cur")) elif ((cword == 2)); then case $prev in help) COMPREPLY=($(compgen -W "simple commands environment filetypes jobview revisions usage views $p4commands" \ -- "$cur")) ;; admin) COMPREPLY=($(compgen -W "checkpoint stop" -- "$cur")) ;; *) ;; esac elif ((cword > 2)); then case $prev in -t) case ${words[cword - 2]} in add | edit | reopen) COMPREPLY=($(compgen -W "$p4filetypes" -- "$cur")) ;; *) ;; esac ;; *) ;; esac fi } && complete -F _p4 -o default p4 g4 # ex: filetype=sh 2to3 0000644 00000001633 15036124164 0005263 0 ustar 00 # bash completion for 2to3 -*- shell-script -*- _2to3() { local cur prev words cword split _init_completion -s || return case $prev in -h | --help | --add-suffix) return ;; -f | --fix | -x | --nofix) COMPREPLY=($(compgen -W \ "$($1 --list-fixes 2>/dev/null | command sed -e 1d)" -- "$cur")) return ;; -j | --processes) COMPREPLY=($(compgen -W "{1..$(_ncpus)}" -- "$cur")) return ;; -o | --output-dir) _filedir -d return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return fi _filedir py } && complete -F _2to3 2to3 # ex: filetype=sh lftp 0000644 00000001151 15036124164 0005434 0 ustar 00 # lftp(1) completion -*- shell-script -*- _lftp() { local cur prev words cword _init_completion || return case $prev in -!(-*)f) _filedir return ;; --help | --version | -!(-*)[chveups]) return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) return fi COMPREPLY=($(compgen -W '$("$1" -c "bookmark list" 2>/dev/null)' -- "$cur")) _known_hosts_real -- "$cur" } && complete -F _lftp lftp # ex: filetype=sh findfs 0000644 00000001267 15036124164 0005750 0 ustar 00 _findfs_module() { local cur prev OPTS findable COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS="--version --help" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac for i in $(lsblk -rpno label); do findable+=" LABEL=$i" done for i in $(lsblk -rpno uuid); do findable+=" UUID=$i" done for i in $(lsblk -rpno partlabel); do findable+=" PARTLABEL=$i" done for i in $(lsblk -rpno partuuid); do findable+=" PARTUUID=$i" done COMPREPLY=( $(compgen -W "$findable" -- $cur) ) return 0 } complete -F _findfs_module findfs webmitm 0000644 00000000554 15036124164 0006141 0 ustar 00 # webmitm completion -*- shell-script -*- _webmitm() { local cur prev words cword _init_completion || return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_usage "$1")' -- "$cur")) else _known_hosts_real -- "$cur" fi } && complete -F _webmitm webmitm # ex: filetype=sh mktemp 0000644 00000001247 15036124164 0005772 0 ustar 00 # mktemp(1) completion -*- shell-script -*- _mktemp() { local cur prev words cword split _init_completion -s || return case "$prev" in --help | --version | --suffix) return ;; --tmpdir | -!(-*)p) _filedir -d return ;; esac $split && return if [[ $cur == -* ]]; then local opts=$(_parse_help "$1") [[ $opts ]] || opts="-d -u -q -p -t" # non-GNU fallback COMPREPLY=($(compgen -W "$opts" -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace fi } && complete -F _mktemp mktemp # ex: filetype=sh list_lists 0000644 00000000717 15036124164 0006667 0 ustar 00 # mailman list_lists completion -*- shell-script -*- _mailman_lists() { COMPREPLY=($(compgen -W '$(list_lists -b 2>/dev/null)' -- "$cur")) } _list_lists() { local cur prev words cword _init_completion || return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '--advertised --virtual-host-overview --bare --help' -- "$cur")) fi } && complete -F _list_lists list_lists # ex: filetype=sh ebtables 0000644 00000007154 15036124164 0006261 0 ustar 00 # bash completion for ebtables -*- shell-script -*- _ebtables() { local cur prev words cword split _init_completion -s || return local table chain='s/^Bridge chain: \([^ ,]\{1,\}\).*$/\1/p' \ targets='ACCEPT DROP CONTINUE RETURN' [[ ${words[*]} =~ [[:space:]]-(t|-table=?)[[:space:]]*([^[:space:]]+) ]] && table="-t ${BASH_REMATCH[2]}" case $prev in -!(-*)[AIDPFXLZ]) COMPREPLY=($(compgen -W '`"$1" $table -L 2>/dev/null | \ command sed -ne "$chain"`' -- "$cur")) ;; -!(-*)t) COMPREPLY=($(compgen -W 'nat filter broute' -- "$cur")) ;; -!(-*)j) if [[ $table == "-t filter" || -z $table ]]; then COMPREPLY=($(compgen -W '$targets $("$1" $table -L 2>/dev/null | \ command sed -n -e "s/INPUT\|OUTPUT\|FORWARD//" \ -e "$chain")' \ -- "$cur")) elif [[ $table == "-t nat" ]]; then COMPREPLY=($(compgen -W '$targets $("$1" $table -L 2>/dev/null | \ command sed -n -e "s/OUTPUT|PREROUTING|POSTROUTING//" \ -e "$chain")' \ -- "$cur")) elif [[ $table == "-t broute" ]]; then COMPREPLY=($(compgen -W 'ACCEPT DROP $("$1" $table -L 2>/dev/null | \ command sed -n -e "s/BROUTING//" -e "$chain")' \ -- "$cur")) fi ;; *) if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '--802_3-sap --802_3-type --among-dst --among-dst-file --among-src --among-src-file --append --arp-gratuitous --arp-htype --arp-ip-dst --arp-ip-src --arp-mac-dst --arp-mac-src --arp-opcode --arp-ptype --arpreply-mac --arpreply-target --atomic-commit --atomic-file --atomic-init --atomic-save --change-counters --concurrent --delete --delete-chain --destination --dnat-target --dst --flush --help --in-if --in-interface --init-table --insert --ip6-destination --ip6-destination-port --ip6-dport --ip6-dst --ip6-icmp-type --ip6-prococol --ip6-proto --ip6-protocol --ip6-source --ip6-source-port --ip6-sport --ip6-src --ip6-tclass --ip-destination --ip-destination-port --ip-dport --ip-dst --ip-proto --ip-protocol --ip-source --ip-source-port --ip-sport --ip-src --ip-tos --jump --Lc --limit --limit-burst --list --Lmac2 --Ln --log --log-arp --logical-in --logical-out --log-ip --log-ip6 --log-level --log-prefix --Lx --mark --mark-and --mark-or --mark-set --mark-target --mark-xor --modprobe --new-chain --nflog --nflog-group --nflog-prefix --nflog-range --nflog-threshold --out-if --out-interface --pkttype-type --policy --proto --protocol --redirect-target --rename-chain --set-counter --snat-arp --snat-target --source --src --stp-flags --stp-forward-delay --stp-hello-time --stp-max-age --stp-msg-age --stp-port --stp-root-addr --stp-root-cost --stp-root-prio --stp-sender-addr --stp-sender-prio --stp-type --table --to-destination --to-dst --to-source --to-src --ulog --ulog-cprange --ulog-nlgroup --ulog-prefix --ulog-qthreshold --version --vlan-encap --vlan-id --vlan-prio --zero' -- "$cur")) fi ;; esac } && complete -F _ebtables ebtables # ex: filetype=sh qdbus 0000644 00000000577 15036124164 0005620 0 ustar 00 # Qt qdbus, dcop completion -*- shell-script -*- _qdbus() { local cur prev words cword _init_completion || return [[ -n $cur ]] && unset "words[$((${#words[@]} - 1))]" COMPREPLY=($(compgen -W '$(command ${words[@]} 2>/dev/null | \ command sed "s/(.*)//")' -- "$cur")) } && complete -F _qdbus qdbus dcop # ex: filetype=sh cfrun 0000644 00000002367 15036124164 0005616 0 ustar 00 # cfrun completion -*- shell-script -*- _cfrun() { local cur prev words cword _init_completion || return local i section=1 for ((i = 1; i < cword; i++)); do if [[ ${words[i]} == -- ]]; then ((section++)) fi done case $section in 1) case $prev in -f) _filedir return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '-f -h -d -S -T -v' -- "$cur")) else local hostfile=${CFINPUTS:-/var/lib/cfengine/inputs}/cfrun.hosts for ((i = 1; i < cword; i++)); do if [[ ${words[i]} == -f ]]; then hostfile=${words[i + 1]} break fi done [[ ! -f $hostfile ]] && return COMPREPLY=($(compgen -W "$(command grep -v \ -E '(=|^$|^#)' $hostfile)" -- "$cur")) fi ;; 2) COMPREPLY=($(compgen -W '$(_parse_help cfagent)' -- "$cur")) ;; esac } && complete -F _cfrun cfrun # ex: filetype=sh unshare 0000644 00000001650 15036124164 0006140 0 ustar 00 _unshare_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '--propagation') COMPREPLY=( $(compgen -W "slave shared private unchanged" -- $cur) ) return 0 ;; '-s'|'--setgroups') COMPREPLY=( $(compgen -W "allow deny" -- $cur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS="--mount --uts --ipc --net --pid --user --cgroup --time --fork --kill-child --keep-caps --mount-proc --map-current-user --map-root-user --propagation --setgroups --help --version --root --wd --monotonic --boottime --setuid --setgid" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac compopt -o bashdefault COMPREPLY=( $(compgen -c -- $cur) ) return 0 } complete -F _unshare_module unshare _yum 0000644 00000010577 15036124164 0005454 0 ustar 00 # yum(8) completion -*- shell-script -*- # Use of this file is deprecated. Upstream completion is available in # yum > 3.2.25, use that instead. _yum_list() { if [[ $1 == all ]]; then # Try to strip in between headings like "Available Packages" # This will obviously only work for English :P COMPREPLY=($(yum -d 0 -C list $1 "$cur*" 2>/dev/null | command sed -ne '/^Available /d' -e '/^Installed /d' -e '/^Updated /d' \ -e 's/[[:space:]].*//p')) else # Drop first line (e.g. "Updated Packages") COMPREPLY=($(yum -d 0 -C list $1 "$cur*" 2>/dev/null | command sed -ne 1d -e 's/[[:space:]].*//p')) fi } _yum_repolist() { # -d 0 causes repolist to output nothing as of yum 3.2.22: # http://yum.baseurl.org/ticket/83 # Drop first ("repo id repo name") and last ("repolist: ...") rows yum --noplugins -C repolist $1 2>/dev/null | command sed -ne '/^repo\s\s*id/d' -e '/^repolist:/d' -e 's/[[:space:]].*//p' } _yum_plugins() { command ls /usr/lib/yum-plugins/*.py{,c,o} 2>/dev/null | command sed -ne 's|.*/\([^./]*\)\.py[co]\{0,1\}$|\1|p' | sort -u } _yum() { local cur prev words cword split _init_completion -s || return local special i for ((i = 1; i < ${#words[@]} - 1; i++)); do if [[ ${words[i]} == @(install|update|upgrade|remove|erase|deplist|info) ]]; then special=${words[i]} break fi done if [[ -v special ]]; then # TODO: install|update|upgrade should not match *src.rpm if [[ $cur == @(*/|[.~])* && \ $special == @(deplist|install|update|upgrade) ]]; then _filedir rpm return fi case $special in install) _yum_list available return ;; deplist | info) _yum_list all return ;; upgrade | update) _yum_list updates return ;; remove | erase) # _rpm_installed_packages is not arch-qualified _yum_list installed return ;; esac fi 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) # TODO: should not match *src.rpm _filedir rpm ;; -d | -e) COMPREPLY=($(compgen -W '{0..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) # argument required but no completions available return ;; -h | --help | --version) # no other options useful with these return ;; *) 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 if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace fi } && complete -F _yum yum # ex: filetype=sh renice 0000644 00000001420 15036124164 0005733 0 ustar 00 _renice_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-g'|'--pgrp') local PGRP PGRP=$(ps -ax -opgrp | sed '1d') COMPREPLY=( $(compgen -W "$PGRP" -- $cur) ) return 0 ;; '-n'|'--priority') COMPREPLY=( $(compgen -W "{-20..20}" -- $cur) ) return 0 ;; '-p'|'--pid') local PIDS PIDS=$(cd /proc && echo [0-9]*) COMPREPLY=( $(compgen -W "$PIDS" -- $cur) ) return 0 ;; '-u'|'--user') COMPREPLY=( $(compgen -u -- $cur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac OPTS="--pgrp --priority --pid --user --help --version" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 } complete -F _renice_module renice hardlink 0000644 00000001134 15036124164 0006264 0 ustar 00 _hardlink_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-x'|'--exclude') COMPREPLY=( $(compgen -W "regex" -- $cur) ) return 0 ;; '-H'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS=" --content --dry-run --verbose --force --exclude --version --help " COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -d -- $cur) ) return 0 } complete -F _hardlink_module hardlink getopt 0000644 00000001457 15036124164 0006002 0 ustar 00 _getopt_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-l'|'--longoptions') COMPREPLY=( $(compgen -W "longopts" -- $cur) ) return 0 ;; '-n'|'--name') COMPREPLY=( $(compgen -W "name" -- $cur) ) return 0 ;; '-o'|'--options') COMPREPLY=( $(compgen -W "optstring" -- $cur) ) return 0 ;; '-s'|'--shell') COMPREPLY=( $(compgen -W "sh bash csh tcsh" -- $cur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS="--alternative --help --longoptions --name --options --quiet --quiet-output --shell --test --unquoted --version" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac return 0 } complete -F _getopt_module getopt faillog 0000644 00000001200 15036124164 0006077 0 ustar 00 # faillog(8) completion -*- shell-script -*- _faillog() { local cur prev words cword split _init_completion -s || return case $prev in --help | --lock-time | --maximum | --time | -!(-*)[hlmt]) return ;; --user | -!(-*)u) COMPREPLY=($(compgen -u -- "$cur")) return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace fi } && complete -F _faillog faillog # ex: filetype=sh _hwclock 0000644 00000001156 15036124164 0006265 0 ustar 00 # hwclock(8) completion -*- shell-script -*- # Use of this file is deprecated. Upstream completion is available in # util-linux >= 2.23, use that instead. _hwclock() { local cur prev words cword _init_completion || return case $prev in -h | --help | -V | --version | --date | --epoch) return ;; -f | --rtc | --adjfile) _filedir return ;; esac COMPREPLY=( $(PATH="$PATH:/sbin" compgen -W '$(_parse_help "$1")' -- "$cur")) } && complete -F _hwclock hwclock # ex: filetype=sh _umount.linux 0000644 00000011006 15036124164 0007313 0 ustar 00 # umount(8) completion -*- shell-script -*- # Use of this file is deprecated on Linux. Upstream completion is # available in util-linux >= 2.28, use that instead. # Just like COMPREPLY=(`compgen -W "${COMPREPLY[*]}" -- "$cur"`), only better! # # This will correctly escape special characters in COMPREPLY. _reply_compgen_array() { # Create the argument for compgen -W by escaping twice. # # One round of escape is because we want to reply with escaped arguments. A # second round is required because compgen -W will helpfully expand it's # argument. local i wlist for i in ${!COMPREPLY[*]}; do local q=$(quote "$(printf %q "${COMPREPLY[i]}")") wlist+=$q$'\n' done # We also have to add another round of escaping to $cur. local ecur="$cur" ecur=${ecur//\\/\\\\} ecur=${ecur//\'/\\\'} # Actually generate completions. local ifs=$IFS IFS=$'\n' eval 'COMPREPLY=(`compgen -W "$wlist" -- "${ecur}"`)' IFS=$ifs } # Unescape strings in the linux fstab(5) format (with octal escapes). __linux_fstab_unescape() { eval $1="'${!1//\'/\\047}'" eval $1="'${!1/%\\/\\\\}'" eval "$1=$'${!1}'" } # Complete linux fstab entries. # # Reads a file from stdin in the linux fstab(5) format; as used by /etc/fstab # and /proc/mounts. With 1st arg -L, look for entries by label. # shellcheck disable=SC2120 _linux_fstab() { COMPREPLY=() # Read and unescape values into COMPREPLY local fs_spec fs_file fs_other local ifs="$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=$'\0' COMPREPLY+=("$fs_label") IFS=$ifs fi else __linux_fstab_unescape fs_spec __linux_fstab_unescape fs_file IFS=$'\0' [[ $fs_spec == */* ]] && COMPREPLY+=("$fs_spec") [[ $fs_file == */* ]] && COMPREPLY+=("$fs_file") IFS=$ifs fi done # Add relative paths to COMPREPLY if [[ $cur && $cur != /* ]]; then local realcur [[ $cur == */ ]] && # don't let readlink drop last / from path realcur="$(readlink -f "$cur." 2>/dev/null)/" || realcur=$(readlink -f "$cur" 2>/dev/null) if [[ $realcur ]]; then local dirrealcur="" dircur="" basecur if [[ $cur == */* ]]; then dirrealcur="${realcur%/*}/" dircur="${cur%/*}/" fi basecur=${cur#"$dircur"} local i for i in ${!COMPREPLY[*]}; do [[ ${COMPREPLY[i]} == "$realcur"* ]] && COMPREPLY+=($(cd "$dircur" 2>/dev/null && compgen -f -d -P "$dircur" \ -X "!${COMPREPLY[i]##"$dirrealcur"}" -- "$basecur")) done fi fi _reply_compgen_array } _umount() { local cur prev words cword _init_completion || return case "$prev" in -t) # FIXME: no<fstype> local split=false if [[ $cur == ?*,* ]]; then prev="${cur%,*}" cur="${cur##*,}" split=true fi COMPREPLY=($(compgen -W 'adfs affs autofs btrfs cifs coda cramfs debugfs devpts efs ext2 ext3 ext4 fuse hfs hfsplus hpfs iso9660 jfs minix msdos ncpfs nfs nfs4 ntfs ntfs-3g proc qnx4 ramfs reiserfs romfs squashfs smbfs sysv tmpfs ubifs udf ufs umsdos usbfs vfat xfs' -- "$cur")) _fstypes $split && COMPREPLY=(${COMPREPLY[@]/#/$prev,}) return ;; -O) # argument required but no completions available return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '-V -h -v -n -r -d -i -a -t -O -f -l --no-canonicalize --fake' -- "$cur")) [[ ${COMPREPLY-} ]] && return fi if [[ -r /proc/mounts ]]; then # Linux /proc/mounts is properly quoted. This is important when # unmounting usb devices with pretty names. _linux_fstab </proc/mounts else local IFS=$'\n' COMPREPLY=($(compgen -W '$(mount | cut -d" " -f 3)' -- "$cur")) fi } && complete -F _umount -o dirnames umount # ex: filetype=sh tsig-keygen 0000644 00000001204 15036124164 0006714 0 ustar 00 # tsig-keygen(8) completion -*- shell-script -*- _tsig_keygen() { local cur prev words cword _init_completion || return case $prev in -h) return ;; -a) COMPREPLY=($(compgen -W 'hmac-{md5,sha{1,224,256,384,512}}' -- "$cur")) return ;; -r) COMPREPLY=($(compgen -W keyboard -- "$cur")) _filedir return ;; esac [[ $cur != -* ]] || COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) } && complete -F _tsig_keygen tsig-keygen # ex: filetype=sh prelink 0000644 00000001652 15036124164 0006141 0 ustar 00 # prelink(8) completion -*- shell-script -*- _prelink() { local cur prev words cword split _init_completion -s || return case $prev in -'?' | --help | --usage | -V | --version | -r | --reloc-only) return ;; -b | --black-list | --dynamic-linker | --undo-output) _filedir return ;; -c | --config-file) _filedir conf return ;; -C | --cache) _filedir cache return ;; --ld-library-path) _filedir -d return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return fi _filedir } && complete -F _prelink prelink # ex: filetype=sh mtx 0000644 00000002232 15036124164 0005300 0 ustar 00 # mtx completion -*- shell-script -*- # by Jon Middleton <jjm@ixtab.org.uk> _mtx() { local cur prev words cword _init_completion || return local options tapes drives options="-f nobarcode invert noattach --version inquiry noattach \ inventory status load unload eepos first last next" tapes=$(mtx status 2>/dev/null | awk '/Storage Element [0-9]+:Full/ { printf "%s ", $3 }') tapes=${tapes//:Full/} drives=$(mtx status 2>/dev/null | awk '/Data Transfer Element [0-9]+:(Full|Empty)/ { printf "%s ", $4 }') drives=${drives//:Full/} drives=${drives//:Empty/} if ((cword > 1)); then case $prev in load) COMPREPLY=($(compgen -W "$tapes" -- "$cur")) ;; unload | first | last | next) COMPREPLY=($(compgen -W "$drives" -- "$cur")) ;; -f) true ;; *) true ;; esac else COMPREPLY=($(compgen -W "$options" -- "$cur")) fi } && complete -F _mtx mtx # ex: filetype=sh apt 0000644 00000016531 15036124164 0005263 0 ustar 00 # Debian apt(8) completion -*- shell-script -*- _apt() { local sourcesdir="/etc/apt/sources.list.d" local cur prev words cword _init_completion || return local GENERIC_APT_GET_OPTIONS=' -d --download-only -y --assume-yes --assume-no -u --show-upgraded -m --ignore-missing -t --target-release --download --fix-missing --ignore-hold --upgrade --only-upgrade --allow-change-held-packages --allow-remove-essential --allow-downgrades --print-uris --trivial-only --remove --arch-only --allow-unauthenticated --allow-insecure-repositories --install-recommends --install-suggests --no-install-recommends --no-install-suggests --fix-policy ' # see if the user selected a command already local COMMANDS=( "list" "search" "show" "showsrc" "install" "reinstall" "remove" "purge" "autoremove" "autopurge" "update" "upgrade" "full-upgrade" "dist-upgrade" "edit-sources" "help" "source" "build-dep" "clean" "autoclean" "download" "changelog" "moo" "depends" "rdepends" "policy") local command i for (( i=1; i < ${#words[@]}; i++ )); do if [[ " ${COMMANDS[*]} " == *" ${words[i]} "* ]]; then command=${words[i]} break fi done # Complete a -t<SPACE><TAB> case $prev in -t|--target-release) COMPREPLY=( $( compgen -W "$(apt-cache policy | grep -Eo 'a=[^,]*|n=[^,]*' | cut -f2- -d= | sort -u)" -- "$cur" ) ) return 0 ;; esac # When the cursor (cword) is before the command word (i), only suggest # options but not package or file names: if [[ $cur == -* || ( -v command && $cword -le $i ) ]]; then case ${command-} in install|reinstall|remove|purge|upgrade|dist-upgrade|full-upgrade|autoremove|autopurge) COMPREPLY=( $( compgen -W '--show-progress --fix-broken --purge --verbose-versions --auto-remove -s --simulate --dry-run --download --fix-missing --fix-policy --ignore-hold --force-yes --trivial-only --reinstall --solver -t --target-release'"$GENERIC_APT_GET_OPTIONS" -- "$cur" ) ) return 0 ;; update) COMPREPLY=( $( compgen -W '--list-cleanup --print-uris --allow-insecure-repositories ' -- "$cur" ) ) return 0 ;; list) COMPREPLY=( $( compgen -W '--installed --upgradable --manual-installed -v --verbose -a --all-versions -t --target-release ' -- "$cur" ) ) return 0 ;; show) COMPREPLY=( $( compgen -W '-a --all-versions ' -- "$cur" ) ) return 0 ;; depends|rdepends) COMPREPLY=( $( compgen -W '-i --important --installed --pre-depends --depends --recommends --suggests --replaces --breaks --conflicts --enhances --recurse --implicit' -- "$cur" ) ) return 0 ;; search) COMPREPLY=( $( compgen -W ' -n --names-only -f --full' -- "$cur" ) ) return 0 ;; showsrc) COMPREPLY=( $( compgen -W ' --only-source' -- "$cur" ) ) return 0 ;; source) COMPREPLY=( $( compgen -W ' -s --simulate --dry-run -b --compile --build -P --build-profiles --diff-only --debian-only --tar-only --dsc-only -t --target-release '"$GENERIC_APT_GET_OPTIONS" -- "$cur" ) ) return 0 ;; build-dep) COMPREPLY=( $( compgen -W ' -a --host-architecture -s --simulate --dry-run -P --build-profiles -t --target-release --purge --solver '"$GENERIC_APT_GET_OPTIONS" -- "$cur" ) ) return 0 ;; moo) COMPREPLY=( $( compgen -W ' --color ' -- "$cur" ) ) return 0 ;; clean|autoclean) COMPREPLY=( $( compgen -W ' -s --simulate --dry-run ' -- "$cur" ) ) return 0 ;; esac return fi # specific command arguments if [[ -v command ]]; then case $command in remove|purge|autoremove|autopurge) if [[ -f /etc/debian_version ]]; then # Debian system COMPREPLY=( $( \ _xfunc dpkg _comp_dpkg_installed_packages $cur ) ) else # assume RPM based _xfunc rpm _rpm_installed_packages fi return 0 ;; show|list|download|changelog|depends|rdepends) COMPREPLY=( $( apt-cache --no-generate pkgnames "$cur" \ 2> /dev/null ) ) return 0 ;; install|reinstall) if [[ "$cur" == .* || "$cur" == /* || "$cur" == ~* ]]; then _filedir "deb" else COMPREPLY=( $( apt-cache --no-generate pkgnames "$cur" \ 2> /dev/null ) ) fi return 0 ;; source|build-dep|showsrc|policy) if [[ "$command" == build-dep && ( "$cur" == .* || "$cur" == /* || "$cur" == ~* ) ]]; then _filedir "dsc" else COMPREPLY=( $( apt-cache --no-generate pkgnames "$cur" \ 2> /dev/null ) $( apt-cache dumpavail | \ command grep "^Source: $cur" | sort -u | cut -f2 -d" " ) ) fi return 0 ;; edit-sources) COMPREPLY=( $( compgen -W '$( command ls $sourcesdir )' \ -- "$cur" ) ) return 0 ;; moo) COMPREPLY=( $( compgen -W 'moo' \ -- "$cur" ) ) return 0 ;; esac else # no command yet, show what commands we have COMPREPLY=( $( compgen -W '${COMMANDS[@]}' -- "$cur" ) ) fi return 0 } && complete -F _apt apt # ex: ts=4 sw=4 et filetype=sh jpegoptim 0000644 00000001573 15036124164 0006475 0 ustar 00 # jpegoptim(1) completion -*- shell-script -*- _jpegoptim() { local cur prev words cword split _init_completion -s || return case $prev in --help | --version | -!(-*)[hV]*) return ;; --dest | -!(-*)d) _filedir -d return ;; --max | --threshold | -!(-*)[mT]) COMPREPLY=($(compgen -W '{0..100}' -- "$cur")) return ;; --size | -!(-*)S) COMPREPLY=($(compgen -W '{1..99}%' -- "$cur")) return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return fi _filedir 'jp?(e)g' } && complete -F _jpegoptim jpegoptim # ex: filetype=sh insmod 0000644 00000001006 15036124164 0005757 0 ustar 00 # Linux insmod(8) completion -*- shell-script -*- _insmod() { local cur prev words cword _init_completion || return # do filename completion for first argument if ((cword == 1)); then _filedir '@(?(k)o?(.[gx]z))' else # do module parameter completion COMPREPLY=($(compgen -W "$(PATH="$PATH:/sbin" modinfo \ -p ${words[1]} 2>/dev/null | cut -d: -f1)" -- "$cur")) fi } && complete -F _insmod insmod insmod.static # ex: filetype=sh ipcalc 0000644 00000001036 15036124164 0005724 0 ustar 00 # ipcalc(1) completion -*- shell-script -*- _ipcalc() { local cur prev words cword _init_completion || return case $prev in --help | --version | --split | -[hs]) return ;; esac # --split takes 3 args local i for i in {1..3}; do [[ ${words[cword - i]} == -@(-split|s) ]] && return done [[ $cur != -* ]] || COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) } && complete -F _ipcalc ipcalc # ex: filetype=sh acpi 0000644 00000000714 15036124164 0005407 0 ustar 00 # acpi(1) completion -*- shell-script -*- _acpi() { local cur prev words cword _init_completion || return case $prev in --help | --version | -!(-*)[hv]) return ;; --directory | -!(-*)d) _filedir -d return ;; esac COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) } && complete -F _acpi acpi # ex: filetype=sh pdftotext 0000644 00000001722 15036124164 0006514 0 ustar 00 # bash completion for pdftotext(1) -*- shell-script -*- _pdftotext() { local cur prev words cword _init_completion || return case $prev in -h | -help | --help | -'?' | -f | -l | -r | -x | -y | -W | -H | -fixed | -opw | -upw) return ;; -enc) COMPREPLY=($(compgen -W '$("$1" -listenc 2>/dev/null | command sed -e 1d)' -- "$cur")) return ;; -eol) COMPREPLY=($(compgen -W "unix dos mac" -- "$cur")) return ;; esac if [[ $cur == -* && ${prev,,} != *.pdf ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) return fi case ${prev,,} in - | *.txt) ;; *.pdf) COMPREPLY=($(compgen -W '-' -- "$cur")) _filedir txt ;; *) _filedir pdf ;; esac } && complete -F _pdftotext pdftotext # ex: filetype=sh pine 0000644 00000001603 15036124164 0005424 0 ustar 00 # pine/alpine completion -*- shell-script -*- _pine() { local cur prev words cword _init_completion || return case $prev in -help | -d | -f | -c | -I | -n | -url | -copy_pinerc | -copy_abook) return ;; -attach | -attachlist | -attach_and_delete | -p | -P | -pinerc | -passfile | -x) _filedir return ;; -sort) COMPREPLY=($(compgen -W 'arrival subject threaded orderedsubject date from size score to cc' -- "$cur")) return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1" -h)' -- "$cur")) else COMPREPLY=($(compgen -W '$(awk "{print \$1}" ~/.addressbook \ 2>/dev/null)' -- "$cur")) fi } && complete -F _pine pine alpine # ex: filetype=sh fdisk 0000644 00000003573 15036124164 0005601 0 ustar 00 _fdisk_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-s'|'--getsz') COMPREPLY=( $(compgen -W "$(lsblk -pnro name)" -- $cur) ) return 0 ;; '-b'|'--sector-size') COMPREPLY=( $(compgen -W "512 1024 2048 4096" -- $cur) ) return 0 ;; '-c'|'--compatibility') COMPREPLY=( $(compgen -W "dos nondos" -- $cur) ) return 0 ;; '-L'|'--color') COMPREPLY=( $(compgen -W "auto never always" -- $cur) ) return 0 ;; '--output') local prefix realcur OUTPUT_ALL OUTPUT realcur="${cur##*,}" prefix="${cur%$realcur}" OUTPUT_ALL=" Attrs Boot Bsize Cpg Cylinders Device End End-C/H/S Flags Fsize Id Name Sectors Size Slice Start Start-C/H/S Type Type-UUID UUID " for WORD in $OUTPUT_ALL; do if ! [[ $prefix == *"$WORD"* ]]; then OUTPUT="$WORD ${OUTPUT:-""}" fi done compopt -o nospace COMPREPLY=( $(compgen -P "$prefix" -W "$OUTPUT" -S ',' -- "$realcur") ) return 0 ;; '-u'|'--units') COMPREPLY=( $(compgen -W "cylinders sectors" -- $cur) ) return 0 ;; '-C'|'--cylinders'|'-H'|'--heads'|'-S'|'--sectors') COMPREPLY=( $(compgen -W "number" -- $cur) ) return 0 ;; '-h'|'--help'|'-v'|'--version'|'-V'|'--list') return 0 ;; esac case $cur in -*) OPTS="--sector-size --protect-boot --compatibility --color --list --list-details --noauto-pt --lock --output --type --units --getsz --bytes --wipe --wipe-partitions --cylinders --heads --sectors --help --version" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac compopt -o bashdefault -o default COMPREPLY=( $(compgen -W "$(lsblk -pnro name)" -- $cur) ) return 0 } complete -F _fdisk_module fdisk dpkg-source 0000644 00000006324 15036124164 0006721 0 ustar 00 # Debian dpkg-source completion -*- shell-script -*- _dpkg_source() { local cur prev words cword _init_completion || return local options word action packopts unpackopts fields packopts="-c -l -F -V -T -D -U -W -E -sa -i -I -sk -sr -ss -sA -sK -sP \ -sU -sR" unpackopts="-sp -sn -su" options="-x -b --print-format --before-build --after-build --commit $packopts $unpackopts" fields="Format Source Version Binary Maintainer Uploader Architecture \ Standards-Version Build-Depends Files" action=options for word in "${words[@]:1}"; do if [[ $word == -x ]]; then action=unpack elif [[ $word == -b ]]; then action=pack elif [[ $word == -h ]]; then action=help fi done case $action in unpack) case $prev in -x) _filedir -d _filedir 'dsc' ;; *) COMPREPLY=($(compgen -W "$unpackopts" -- "$cur")) _filedir -d _filedir ;; esac return ;; pack) case $prev in -b) _filedir -d ;; -c | -l | -T | -i | -I) # -c: get controlfile # -l: get per-version info from this file # -T: read variables here, not debian/substvars # -i: <regexp> filter out files to ignore diffs of. # -I: filter out files when building tarballs. # return directory names and file names _filedir -d _filedir ;; -F) # -F: force change log format COMPREPLY=($(command ls /usr/lib/dpkg/parsechangelog)) ;; -V) # -V: set a substitution variable # we don't know anything about possible variables or values # so we don't try to suggest any completion. COMPREPLY=() ;; -D) # -D: override or add a .dsc field and value # if $cur doesn't contain a = yet, suggest variable names if [[ $cur == *=* ]]; then # $cur contains a "=" COMPREPLY=() else COMPREPLY=($(compgen -W "$fields" -- "$cur")) fi ;; -U) # -U: remove a field # Suggest possible fieldnames COMPREPLY=($(compgen -W "$fields" -- "$cur")) ;; *) COMPREPLY=($(compgen -W "$packopts $unpackopts" \ -- "$cur")) ;; esac return ;; *) COMPREPLY=($(compgen -W "$options" -- "$cur")) return ;; esac } && complete -F _dpkg_source dpkg-source # ex: filetype=sh _mock 0000644 00000004030 15036124164 0005556 0 ustar 00 # bash completion for mock -*- shell-script -*- # Use of this file is deprecated. Upstream completion is available in # mock > 1.1.0, use that instead. _mock() { local cur prev words cword split _init_completion -s || return local plugins='tmpfs root_cache yum_cache bind_mount ccache' local cfgdir=/etc/mock count=0 i for i in "${words[@]}"; do ((count == cword)) && break if [[ $i == --configdir ]]; then cfgdir="${words[count + 1]}" elif [[ $i == --configdir=* ]]; then cfgdir=${i/*=/} fi ((count++)) done case $prev in -h | --help | --copyin | --copyout | --arch | -D | --define | --with | --without | \ --uniqueext | --rpmbuild_timeout | --sources | --cwd) return ;; -r | --root) COMPREPLY=($(compgen -W "$(command ls $cfgdir)" -- "$cur")) COMPREPLY=(${COMPREPLY[@]/%.cfg/}) return ;; --configdir | --resultdir) _filedir -d return ;; --spec) _filedir spec return ;; --target) # Yep, compatible archs, not compatible build archs # (e.g. ix86 chroot builds in x86_64 mock host) # This would actually depend on what the target root # can be used to build for... COMPREPLY=($(compgen -W "$(command rpm --showrc | command sed -ne 's/^\s*compatible\s\s*archs\s*:\s*\(.*\)/\1/i p')" \ -- "$cur")) return ;; --enable-plugin | --disable-plugin) COMPREPLY=($(compgen -W "$plugins" -- "$cur")) return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace else _filedir '@(?(no)src.r|s)pm' fi } && complete -F _mock mock # ex: filetype=sh cppcheck 0000644 00000005110 15036124164 0006246 0 ustar 00 # bash completion for cppcheck(1) -*- shell-script -*- _cppcheck() { local cur prev words cword split _init_completion -s || return case $prev in --append | --exitcode-suppressions | --rule-file | --config-excludes-file | \ --suppressions-list | --includes-file | --include | -i) _filedir return ;; -D | -U | --rule | --suppress | --template | --max-configs | -h | --help | --version | \ --errorlist | --config-exclude | -l) return ;; --enable) # split comma-separated list split=false if [[ $cur == ?*,* ]]; then prev="${cur%,*}" cur="${cur##*,}" split=true fi COMPREPLY=($(compgen -W 'all warning style performance portability information unusedFunction missingInclude' \ -- "$cur")) $split && COMPREPLY=(${COMPREPLY[@]/#/"$prev,"}) return ;; --error-exitcode) COMPREPLY=($(compgen -W '{0..255}' -- "$cur")) return ;; --file-list) _filedir [[ -z $cur || $cur == - ]] && COMPREPLY+=(-) return ;; -I) _filedir -d return ;; -j) COMPREPLY=($(compgen -W "{2..$(_ncpus)}" -- "$cur")) return ;; --language | -x) COMPREPLY=($(compgen -W 'c c++' -- "$cur")) return ;; --std) COMPREPLY=($(compgen -W 'c89 c99 c11 c++03 c++11 c++14 c++17 c++20' -- "$cur")) return ;; --platform) _filedir COMPREPLY+=($(compgen -W 'unix32 unix64 win32A win32W win64 native' -- "$cur")) return ;; -rp | --relative-paths) if $split; then # -rp without argument is allowed _filedir -d return fi ;; --library) _filedir cfg return ;; --xml-version) COMPREPLY=($(compgen -W '1 2' -- "$cur")) return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace else _filedir '@([cht]pp|[cht]xx|cc|[ch]++|[ch])' fi } && complete -F _cppcheck cppcheck # ex: filetype=sh ip 0000644 00000031212 15036124164 0005100 0 ustar 00 # ip(8) completion -*- shell-script -*- _iproute2_etc() { COMPREPLY+=($(compgen -W \ "$(awk '!/#/ { print $2 }' /etc/iproute2/$1 2>/dev/null)" \ -- "$cur")) } _ip() { local cur prev words cword _init_completion || return case $prev in -V | -Version | -rc | -rcvbuf) return ;; -f | -family) COMPREPLY=($(compgen -W 'inet inet6 ipx dnet link' -- "$cur")) return ;; -b | -batch) _filedir return ;; -force) COMPREPLY=($(compgen -W '-batch' -- "$cur")) return ;; esac local subcword cmd subcmd="" for ((subcword = 1; subcword < ${#words[@]} - 1; subcword++)); do [[ ${words[subcword]} == -b?(atch) ]] && return [[ -v cmd ]] && subcmd=${words[subcword]} && break [[ ${words[subcword]} != -* && \ ${words[subcword - 1]} != -@(f?(amily)|rc?(vbuf)) ]] && cmd=${words[subcword]} done if [[ ! -v cmd ]]; then case $cur in -*) local c="-Version -statistics -details -resolve -family -oneline -timestamp -batch -rcvbuf" ((cword == 1)) && c+=" -force" COMPREPLY=($(compgen -W "$c" -- "$cur")) ;; *) COMPREPLY=($(compgen -W "help $($1 help 2>&1 | command sed -e \ '/OBJECT := /,/}/!d' -e \ 's/.*{//' -e \ 's/}.*//' -e \ 's/|//g')" -- "$cur")) ;; esac return fi [[ $subcmd == help ]] && return case $cmd in l | link) case $subcmd in add) # TODO ;; 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 == 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+=" up down" COMPREPLY=($(compgen -W "$c" -- "$cur")) ;; esac fi ;; show) if ((cword == subcword + 1)); then _available_interfaces COMPREPLY+=($(compgen -W 'dev group up' -- "$cur")) elif [[ $prev == dev ]]; then _available_interfaces elif [[ $prev == group ]]; then _iproute2_etc group fi ;; *) ((cword == subcword)) && COMPREPLY=($(compgen -W 'help add delete set show' \ -- "$cur")) ;; esac ;; a | addr | address) case $subcmd in add | change | replace) if [[ $prev == dev ]]; then _available_interfaces elif [[ $prev == scope ]]; then _iproute2_etc rt_scopes else : # TODO fi ;; del) if [[ $prev == dev ]]; then _available_interfaces elif [[ $prev == scope ]]; then _iproute2_etc rt_scopes else : # TODO fi ;; show | flush) if ((cword == subcword + 1)); then _available_interfaces COMPREPLY+=($(compgen -W 'dev scope to label dynamic permanent tentative deprecated dadfailed temporary primary secondary up' -- "$cur")) elif [[ $prev == dev ]]; then _available_interfaces elif [[ $prev == scope ]]; then _iproute2_etc rt_scopes fi ;; *) ((cword == subcword)) && COMPREPLY=($(compgen -W 'help add change replace del show flush' -- "$cur")) ;; esac ;; addrlabel) case $subcmd in list | add | del | flush) if [[ $prev == dev ]]; then _available_interfaces else : # TODO fi ;; *) ((cword == subcword)) && COMPREPLY=($(compgen -W 'help list add del flush' \ -- "$cur")) ;; esac ;; r | route) case $subcmd in list | flush) if [[ $prev == proto ]]; then _iproute2_etc rt_protos else : # TODO fi ;; get) # TODO ;; a | add | d | del | change | append | r | replace | monitor) if [[ $prev == via ]]; then COMPREPLY=($(compgen -W "$($1 r | command sed -ne \ 's/.*via \([0-9.]*\).*/\1/p')" -- "$cur")) elif [[ $prev == "$subcmd" ]]; then COMPREPLY=($(compgen -W "table default \ $($1 r | cut -d ' ' -f 1)" -- "$cur")) elif [[ $prev == dev ]]; then _available_interfaces -a elif [[ $prev == table ]]; then COMPREPLY=($(compgen -W 'local main default' -- "$cur")) else COMPREPLY=($(compgen -W 'via dev weight' -- "$cur")) fi ;; *) ((cword == subcword)) && COMPREPLY=($(compgen -W 'help list flush get add del change append replace monitor' -- "$cur")) ;; esac ;; rule) case $subcmd in add | del | list | lst) case $prev in from | to | tos | dsfield | fwmark | uidrange | ipproto | sport | \ dport | priority | protocol | suppress_prefixlength | \ suppress_ifgroup | realms | nat | goto) ;; iif | oif) _available_interfaces -a ;; table | lookup) COMPREPLY=($(compgen -W 'local main default' -- "$cur")) ;; *) COMPREPLY=($(compgen -W 'from to tos dsfield fwmark uidrange ipproto sport dport priority table lookup protocol suppress_prefixlength suppress_ifgroup realms nat goto iif oif not' -- "$cur")) ;; esac ;; flush | save) if [[ $prev == protocol ]]; then : else COMPREPLY=($(compgen -W 'protocol' -- "$cur")) fi ;; restore | show) ;; *) ((cword == subcword)) && COMPREPLY=($(compgen -W 'help add del list flush save restore show' -- "$cur")) ;; esac ;; neigh) case $subcmd in add | del | change | replace) # TODO ;; show | flush) # TODO ;; *) ((cword == subcword)) && COMPREPLY=($(compgen -W 'help add del change replace show flush' -- "$cur")) ;; esac ;; ntable) case $subcmd in change) # TODO ;; show) # TODO ;; *) ((cword == subcword)) && COMPREPLY=($(compgen -W 'help change show' \ -- "$cur")) ;; esac ;; tunnel) case $subcmd in show) ;; add | change | del | prl | 6rd) # TODO ;; *) ((cword == subcword)) && COMPREPLY=($(compgen -W 'help add change del show prl 6rd' -- "$cur")) ;; esac ;; maddr) case $subcmd in add | del) # TODO ;; show) if [[ $cword -eq $subcword+1 || $prev == dev ]]; then _available_interfaces [[ $prev != dev ]] && COMPREPLY=($(compgen -W '${COMPREPLY[@]} dev' \ -- "$cur")) fi ;; *) ((cword == subcword)) && COMPREPLY=($(compgen -W 'help add del show' \ -- "$cur")) ;; esac ;; mroute) case $subcmd in show) # TODO ;; *) ((cword == subcword)) && COMPREPLY=($(compgen -W 'help show' -- "$cur")) ;; esac ;; monitor) case $subcmd in all) ;; *) ((cword == subcword)) && COMPREPLY=($(compgen -W 'help all' -- "$cur")) ;; esac ;; netns) case $subcmd in list | monitor) ;; add | identify | list-id) # TODO ;; delete | exec | pids | set) [[ $prev == "$subcmd" ]] && COMPREPLY=($(compgen -W "$($1 netns list)" -- "$cur")) ;; *) ((cword == subcword)) && COMPREPLY=($(compgen -W 'help add delete exec identify list list-id monitor pids set' -- "$cur")) ;; esac ;; xfrm) case $subcmd in state | policy | monitor) # TODO ;; *) ((cword == subcword)) && COMPREPLY=($(compgen -W 'state policy monitor' \ -- "$cur")) ;; esac ;; esac } && complete -F _ip ip # ex: filetype=sh java 0000644 00000021472 15036124164 0005420 0 ustar 00 # bash completion for java, javac and javadoc -*- shell-script -*- # available path elements completion _java_path() { cur=${cur##*:} _filedir '@(jar|zip)' } # exact classpath determination _java_find_classpath() { local i # search first in current options for ((i = 1; i < cword; i++)); do if [[ ${words[i]} == -@(cp|classpath) ]]; then classpath=${words[i + 1]} break fi done # default to environment [[ ! -v classpath ]] && classpath=${CLASSPATH-} # default to current directory [[ -z $classpath ]] && classpath=. } # exact sourcepath determination _java_find_sourcepath() { local i # search first in current options for ((i = 1; i < cword; i++)); do if [[ ${words[i]} == -sourcepath ]]; then sourcepath=${words[i + 1]} break fi done # default to classpath if [[ ! -v sourcepath ]]; then local classpath _java_find_classpath sourcepath=$classpath fi } # available classes completion _java_classes() { local classpath i # find which classpath to use _java_find_classpath # convert package syntax to path syntax cur=${cur//.//} # parse each classpath element for classes for i in ${classpath//:/ }; do if [[ $i == *.@(jar|zip) && -r $i ]]; then if type zipinfo &>/dev/null; then COMPREPLY+=($(zipinfo -1 "$i" "$cur*" 2>/dev/null | command grep '^[^$]*\.class$')) elif type unzip &>/dev/null; then # Last column, between entries consisting entirely of dashes COMPREPLY+=($(unzip -lq "$i" "$cur*" 2>/dev/null | awk '$NF ~ /^-+$/ { flag=!flag; next }; flag && $NF ~ /^[^$]*\.class/ { print $NF }')) elif type jar &>/dev/null; then COMPREPLY+=($(jar tf "$i" "$cur" | command grep '^[^$]*\.class$')) fi elif [[ -d $i ]]; then COMPREPLY+=( $(compgen -d -- "$i/$cur" | command sed -e "s|^$i/\(.*\)|\1.|") $(compgen -f -X '!*.class' -- "$i/$cur" | command sed -e '/\$/d' -e "s|^$i/||") ) [[ ${COMPREPLY-} == *.class ]] || compopt -o nospace # FIXME: if we have foo.class and foo/, the completion # returns "foo/"... how to give precedence to files # over directories? fi done if ((${#COMPREPLY[@]} != 0)); then # remove class extension COMPREPLY=(${COMPREPLY[@]%.class}) # convert path syntax to package syntax COMPREPLY=(${COMPREPLY[@]//\//.}) fi } # available packages completion _java_packages() { local sourcepath i # find which sourcepath to use _java_find_sourcepath # convert package syntax to path syntax cur=${cur//.//} # parse each sourcepath element for packages for i in ${sourcepath//:/ }; do if [[ -d $i ]]; then COMPREPLY+=($(command ls -F -d $i/$cur* 2>/dev/null | command sed -e 's|^'$i'/||')) fi done if ((${#COMPREPLY[@]} != 0)); then # keep only packages COMPREPLY=($(tr " " "\n" <<<"${COMPREPLY[@]}" | command grep "/$")) # remove packages extension COMPREPLY=(${COMPREPLY[@]%/}) # convert path syntax to package syntax cur="${COMPREPLY[*]//\//.}" fi } # java completion # _java() { local cur prev words cword _init_completion -n : || return local i for ((i = 1; i < cword; i++)); do case ${words[i]} in -cp | -classpath) ((i++)) # skip the classpath string. ;; -*) # this is an option, not a class/jarfile name. ;; *) # once we've seen a class, just do filename completion _filedir return ;; esac done case $cur in # standard option completions -verbose:*) COMPREPLY=($(compgen -W 'class gc jni' -- "${cur#*:}")) return ;; -javaagent:*) cur=${cur#*:} _filedir '@(jar|zip)' return ;; -agentpath:*) cur=${cur#*:} _filedir so return ;; # various non-standard option completions -splash:*) cur=${cur#*:} _filedir '@(gif|jp?(e)g|png)' return ;; -Xbootclasspath*:*) _java_path return ;; -Xcheck:*) COMPREPLY=($(compgen -W 'jni' -- "${cur#*:}")) return ;; -Xgc:*) COMPREPLY=($(compgen -W 'singlecon gencon singlepar genpar' \ -- "${cur#*:}")) return ;; -Xgcprio:*) COMPREPLY=($(compgen -W 'throughput pausetime deterministic' \ -- "${cur#*:}")) return ;; -Xloggc:* | -Xverboselog:*) cur=${cur#*:} _filedir return ;; -Xshare:*) COMPREPLY=($(compgen -W 'auto off on' -- "${cur#*:}")) return ;; -Xverbose:*) COMPREPLY=($(compgen -W 'memory load jni cpuinfo codegen opt gcpause gcreport' -- "${cur#*:}")) return ;; -Xverify:*) COMPREPLY=($(compgen -W 'all none remote' -- "${cur#*:}")) return ;; # the rest that we have no completions for -D* | -*:*) return ;; esac case $prev in -cp | -classpath) _java_path return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1" -help)' -- "$cur")) [[ $cur == -X* ]] && COMPREPLY+=($(compgen -W '$(_parse_help "$1" -X)' -- "$cur")) else if [[ $prev == -jar ]]; then # jar file completion _filedir '[jw]ar' else # classes completion _java_classes fi fi [[ ${COMPREPLY-} == -*[:=] ]] && compopt -o nospace __ltrim_colon_completions "$cur" } && complete -F _java java _javadoc() { local cur prev words cword _init_completion || return case $prev in -overview | -helpfile) _filedir '?(x)htm?(l)' return ;; -doclet | -exclude | -subpackages | -source | -locale | -encoding | -windowtitle | \ -doctitle | -header | -footer | -top | -bottom | -group | -noqualifier | -tag | \ -charset | -sourcetab | -docencoding) return ;; -stylesheetfile) _filedir css return ;; -d | -link | -linkoffline) _filedir -d return ;; -classpath | -cp | -bootclasspath | -docletpath | -sourcepath | -extdirs | \ -excludedocfilessubdir) _java_path return ;; esac # -linkoffline takes two arguments if [[ $cword -gt 2 && ${words[cword - 2]} == -linkoffline ]]; then _filedir -d return fi if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1" -help)' -- "$cur")) else # source files completion _filedir java # packages completion _java_packages fi } && complete -F _javadoc javadoc _javac() { local cur prev words cword _init_completion -n : || return case $prev in -d) _filedir -d return ;; -cp | -classpath | -bootclasspath | -sourcepath | -extdirs) _java_path return ;; esac if [[ $cur == -+([a-zA-Z0-9-_]):* ]]; then # Parse required options from -foo:{bar,quux,baz} local helpopt=-help [[ $cur == -X* ]] && helpopt=-X # For some reason there may be -g:none AND -g:{lines,source,vars}; # convert the none case to the curly brace format so it parses like # the others. local opts=$("$1" $helpopt 2>&1 | command sed -e 's/-g:none/-g:{none}/' -ne \ "s/^[[:space:]]*${cur%%:*}:{\([^}]\{1,\}\)}.*/\1/p") COMPREPLY=($(compgen -W "${opts//,/ }" -- "${cur#*:}")) return fi if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1" -help)' -- "$cur")) [[ $cur == -X* ]] && COMPREPLY+=($(compgen -W '$(_parse_help "$1" -X)' -- "$cur")) else # source files completion _filedir java fi [[ ${COMPREPLY-} == -*[:=] ]] && compopt -o nospace __ltrim_colon_completions "$cur" } && complete -F _javac javac # ex: filetype=sh ldapsearch 0000644 00000010554 15036124164 0006604 0 ustar 00 # bash completion for openldap -*- shell-script -*- _ldap_uris() { COMPREPLY=($(compgen -W 'ldap:// ldaps://' -- "$cur")) } _ldap_protocols() { COMPREPLY=($(compgen -W '2 3' -- "$cur")) } _ldapsearch() { local cur prev words cword _init_completion || return case $prev in -*h) _known_hosts_real -- "$cur" return ;; -*H) _ldap_uris return ;; -*T) _filedir -d return ;; -*[fy]) _filedir return ;; -*s) COMPREPLY=($(compgen -W 'base one sub children' -- "$cur")) return ;; -*a) COMPREPLY=($(compgen -W 'never always search find' -- "$cur")) return ;; -*P) _ldap_protocols return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1") -MM -ZZ' -- "$cur")) fi } && complete -F _ldapsearch ldapsearch _ldapaddmodify() { local cur prev words cword _init_completion || return case $prev in -*h) _known_hosts_real -- "$cur" return ;; -*H) _ldap_uris return ;; -*[Sfy]) _filedir return ;; -*P) _ldap_protocols return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1") -MM -ZZ' -- "$cur")) fi } && complete -F _ldapaddmodify ldapadd ldapmodify _ldapdelete() { local cur prev words cword _init_completion || return case $prev in -*h) _known_hosts_real -- "$cur" return ;; -*H) _ldap_uris return ;; -*[fy]) _filedir return ;; -*P) _ldap_protocols return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1") -MM -ZZ' -- "$cur")) fi } && complete -F _ldapdelete ldapdelete _ldapcompare() { local cur prev words cword _init_completion || return case $prev in -*h) _known_hosts_real -- "$cur" return ;; -*H) _ldap_uris return ;; -*y) _filedir return ;; -*P) _ldap_protocols return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1") -MM -ZZ' -- "$cur")) fi } && complete -F _ldapcompare ldapcompare _ldapmodrdn() { local cur prev words cword _init_completion || return case $prev in -*h) _known_hosts_real -- "$cur" return ;; -*H) _ldap_uris return ;; -*[fy]) _filedir return ;; -*P) _ldap_protocols return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1") -ZZ -MM' -- "$cur")) fi } && complete -F _ldapmodrdn ldapmodrdn _ldapwhoami() { local cur prev words cword _init_completion || return case $prev in -*h) _known_hosts_real -- "$cur" return ;; -*H) _ldap_uris return ;; -*[fy]) _filedir return ;; -*P) _ldap_protocols return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1") -MM -ZZ' -- "$cur")) fi } && complete -F _ldapwhoami ldapwhoami _ldappasswd() { local cur prev words cword _init_completion || return case $prev in -*h) _known_hosts_real -- "$cur" return ;; -*H) _ldap_uris return ;; -*[tTy]) _filedir return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1") -MM -ZZ' -- "$cur")) fi } && complete -F _ldappasswd ldappasswd # ex: filetype=sh rpmcheck 0000644 00000001000 15036124164 0006254 0 ustar 00 # bash completion for rpmcheck -*- shell-script -*- _rpmcheck() { local cur prev words cword _init_completion || return case $prev in -base) _filedir return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '-explain -failures -successes -dump -dump-all -base -help -compressed-input' -- "$cur")) else _filedir fi } && complete -F _rpmcheck rpmcheck # ex: filetype=sh fusermount 0000644 00000001176 15036124164 0006705 0 ustar 00 # fusermount completion -*- shell-script -*- _fusermount() { local cur prev words cword _init_completion || return case $prev in -*[hVo]) return ;; -*u) COMPREPLY=($(compgen -W "$(awk \ '{ if ($3 ~ /^fuse(\.|$)/) print $2 }' /etc/mtab \ 2>/dev/null)" -- "$cur")) return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1" -h)' -- "$cur")) else _filedir -d fi } && complete -F _fusermount fusermount # ex: filetype=sh man 0000644 00000005702 15036124164 0005250 0 ustar 00 # man(1) completion -*- shell-script -*- _man() { local cur prev words cword split _init_completion -s -n : || return local comprsuffix=".@([glx]z|bz2|lzma|Z)" local manext="@([0-9lnp]|[0-9][px]|man|3?(gl|pm))?($comprsuffix)" local mansect="@([0-9lnp]|[0-9][px]|3?(gl|pm))" case $prev in --config-file | -!(-*)C) _filedir conf return ;; --local-file | -!(-*)l) _filedir "$manext" return ;; --manpath | -!(-*)M) _filedir -d return ;; --pager | -!(-*)P) compopt -o filenames COMPREPLY=($(compgen -c -- "$cur")) return ;; --preprocessor | -!(-*)p) COMPREPLY=($(compgen -W 'e p t g r v' -- "$cur")) return ;; --locale | --systems | --extension | --prompt | --recode | --encoding | \ -!(-*)[LmerRE]) return ;; esac $split && return if [[ $cur == -* ]]; then local opts=$(_parse_help "$1" -h) COMPREPLY=($(compgen -W '${opts:-$(_parse_usage "$1")}' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return fi # file based completion if parameter looks like a path if [[ $cur == @(*/|[.~])* ]]; then _filedir "$manext" return fi local manpath=$(manpath 2>/dev/null || command man -w 2>/dev/null) [[ -z $manpath ]] && manpath="/usr/share/man:/usr/local/share/man" # determine manual section to search local sect # shellcheck disable=SC2053 [[ $prev == $mansect ]] && sect=$prev || sect='*' _expand || return manpath=$manpath: if [[ -n $cur ]]; then manpath="${manpath//://*man$sect/$cur* } ${manpath//://*cat$sect/$cur* }" else manpath="${manpath//://*man$sect/ } ${manpath//://*cat$sect/ }" fi local IFS=$' \t\n' reset=$(shopt -p failglob) shopt -u failglob # redirect stderr for when path doesn't exist COMPREPLY=($(eval command ls "$manpath" 2>/dev/null)) $reset if ((${#COMPREPLY[@]} != 0)); then # weed out directory path names and paths to man pages COMPREPLY=(${COMPREPLY[@]##*/?(:)}) # strip suffix from man pages COMPREPLY=(${COMPREPLY[@]%$comprsuffix}) COMPREPLY=($(compgen -W '${COMPREPLY[@]%.*}' -- "${cur//\\\\/}")) fi # shellcheck disable=SC2053 if [[ $prev != $mansect ]]; then # File based completion for the rest, prepending ./ if needed # (man 1.6f needs that for man pages in current dir) local i start=${#COMPREPLY[@]} _filedir "$manext" for ((i = start; i < ${#COMPREPLY[@]}; i++)); do [[ ${COMPREPLY[i]} == */* ]] || COMPREPLY[i]=./${COMPREPLY[i]} done fi __ltrim_colon_completions "$cur" } && complete -F _man man apropos whatis # ex: filetype=sh rpm2tgz 0000644 00000000560 15036124164 0006077 0 ustar 00 # Slackware rpm2tgz completion -*- shell-script -*- _rpm2tgz() { local cur prev words cword _init_completion || return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '-s -S -n -r -d -c' -- "$cur")) return fi _filedir "rpm" } && complete -F _rpm2tgz rpm2tgz rpm2txz rpm2targz # ex: filetype=sh delpart 0000644 00000001063 15036124164 0006124 0 ustar 00 _delpart_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $COMP_CWORD in 1) OPTS="--help --version $(lsblk -pnro name)" compopt -o bashdefault -o default COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) ;; 2) prev="${COMP_WORDS[COMP_CWORD-1]}" COMPREPLY=( $(compgen -W "$(cat /sys/block/${prev##*/}/*/partition 2>/dev/null)" -- $cur) ) ;; esac return 0 } complete -F _delpart_module delpart ldapvi 0000644 00000002533 15036124164 0005753 0 ustar 00 # bash completion for ldapvi -*- shell-script -*- _ldapvi() { local cur prev words cword _init_completion || return case $prev in --host | -!(-*)h) _known_hosts_real -- "$cur" return ;; --sasl-mech | -!(-*)Y) COMPREPLY=($(compgen -W 'EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 PLAIN ANONYMOUS' -- "$cur")) return ;; --bind) COMPREPLY=($(compgen -W 'simple sasl' -- "$cur")) return ;; --bind-dialog) COMPREPLY=($(compgen -W 'never auto always' -- "$cur")) return ;; --scope) COMPREPLY=($(compgen -W 'base one sub' -- "$cur")) return ;; --deref) COMPREPLY=($(compgen -W 'never searching finding always' \ -- "$cur")) return ;; --encoding) COMPREPLY=($(compgen -W 'ASCII UTF-8 binary' -- "$cur")) return ;; --tls) COMPREPLY=($(compgen -W 'never allow try strict' -- "$cur")) return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) fi } && complete -F _ldapvi ldapvi # ex: filetype=sh _look 0000644 00000000675 15036124164 0005604 0 ustar 00 # look(1) completion -*- shell-script -*- # Use of this file is deprecated on Linux. Upstream completion is # available in util-linux >= 2.23, use that instead. _look() { local cur prev words cword _init_completion || return if ((cword == 1)); then COMPREPLY=($(compgen -W '$(look "$cur" 2>/dev/null)' -- "$cur")) fi } && complete -F _look -o default look # ex: filetype=sh modinfo 0000644 00000002333 15036124164 0006125 0 ustar 00 # Linux modinfo(8) completion -*- shell-script -*- _modinfo() { local cur prev words cword split _init_completion -s || return case "$prev" in --field | -!(-*)F) COMPREPLY=($(compgen -W 'alias author depends description filename firmware license parm srcversion staging vermagic version' -- "${cur,,}")) return ;; --set-version | -!(-*)k) _kernel_versions return ;; esac $split && return if [[ $cur == -* ]]; then local opts=$(_parse_help "$1") COMPREPLY=($(compgen -W '${opts:-$(_parse_usage "$1")}' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return fi local i version=$(uname -r) for ((i = ${#words[@]} - 1; i > 0; i--)); do if [[ ${words[i]} == -@(!(-*)k*|-set-version) ]]; then version=${words[i + 1]} break fi done # do filename completion if we're giving a path to a module if [[ $cur == @(*/|[.~])* ]]; then _filedir '@(?(k)o?(.[gx]z))' else _modules $version fi } && complete -F _modinfo modinfo # ex: filetype=sh rcs 0000644 00000001531 15036124164 0005260 0 ustar 00 # bash completion for rcs -*- shell-script -*- _rcs() { local cur prev words cword _init_completion || return local file dir i file=${cur##*/} dir=${cur%/*} # deal with relative directory [[ $file == "$dir" ]] && dir=. COMPREPLY=($(compgen -f -- "$dir/RCS/$file")) for i in ${!COMPREPLY[*]}; do file=${COMPREPLY[i]##*/} dir=${COMPREPLY[i]%RCS/*} COMPREPLY[i]=$dir$file done COMPREPLY+=($(compgen -G "$dir/$file*,v")) for i in ${!COMPREPLY[*]}; do COMPREPLY[i]=${COMPREPLY[i]%,v} done # default to files if nothing returned and we're checking in. # otherwise, default to directories [[ ${#COMPREPLY[@]} -eq 0 && $1 == *ci ]] && _filedir || _filedir -d } && complete -F _rcs ci co rlog rcs rcsdiff # ex: filetype=sh freeciv-server 0000644 00000000747 15036124164 0007430 0 ustar 00 # freeciv-server completion -*- shell-script -*- _civserver() { local cur prev words cword _init_completion || return case $prev in -f | -g | -l | -r | --file | --log | --gamelog | --read) _filedir return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) fi } && complete -F _civserver civserver freeciv-server # ex: filetype=sh wipefs 0000644 00000002326 15036124164 0005771 0 ustar 00 _wipefs_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-O'|'--output') local prefix realcur OUTPUT_ALL OUTPUT realcur="${cur##*,}" prefix="${cur%$realcur}" OUTPUT_ALL="UUID LABEL LENGTH TYPE OFFSET USAGE DEVICE" for WORD in $OUTPUT_ALL; do if ! [[ $prefix == *"$WORD"* ]]; then OUTPUT="$WORD ${OUTPUT:-""}" fi done compopt -o nospace COMPREPLY=( $(compgen -P "$prefix" -W "$OUTPUT" -S ',' -- $realcur) ) return 0 ;; '-o'|'--offset') COMPREPLY=( $(compgen -W "offset" -- $cur) ) return 0 ;; '-t'|'--types') local TYPES TYPES="$(blkid -k)" COMPREPLY=( $(compgen -W "$TYPES" -- $cur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS=" --all --backup --force --noheadings --json --lock --no-act --offset --output --parsable --quiet --types --help --version " COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac compopt -o bashdefault -o default COMPREPLY=( $(compgen -W "$(lsblk -pnro name)" -- $cur) ) return 0 } complete -F _wipefs_module wipefs setsid 0000644 00000000670 15036124164 0005767 0 ustar 00 _setsid_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS="--ctty --wait --help --version" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac compopt -o bashdefault COMPREPLY=( $(compgen -c -- $cur) ) return 0 } complete -F _setsid_module setsid optipng 0000644 00000002232 15036124164 0006150 0 ustar 00 # optipng(1) completion -*- shell-script -*- _optipng() { local cur prev words cword _init_completion || return case $prev in -'?' | -h | --help | -f) return ;; -o) COMPREPLY=($(compgen -W '{0..7}' -- "$cur")) return ;; -out | -log) _filedir return ;; -dir) _filedir -d return ;; -i) COMPREPLY=($(compgen -W '0 1' -- "$cur")) return ;; -zc | -zm) COMPREPLY=($(compgen -W '{1..9}' -- "$cur")) return ;; -zw) COMPREPLY=($(compgen -W '256 512 1k 2k 4k 8k 16k 32k' \ -- "$cur")) return ;; -strip) COMPREPLY=($(compgen -W 'all' -- "$cur")) return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) return fi _filedir '@(png|bmp|gif|pnm|tif?(f))' } && complete -F _optipng optipng # ex: filetype=sh xrdb 0000644 00000001000 15036124164 0005417 0 ustar 00 # xrdb(1) completion -*- shell-script -*- _xrdb() { local cur prev words cword _init_completion || return case $prev in -backup | -display | -help) return ;; -cpp | -edit) _filedir return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) return fi _filedir } && complete -F _xrdb xrdb # ex: filetype=sh more 0000644 00000001360 15036124164 0005433 0 ustar 00 _more_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-n'|'--lines') COMPREPLY=( $(compgen -W "number" -- $cur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS=" --silent --logical --no-pause --print-over --clean-print --squeeze --plain --lines --help --version " COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; +*) OPTS="+number +/pattern" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 } complete -F _more_module more lua 0000644 00000000666 15036124164 0005262 0 ustar 00 # lua(1) completion -*- shell-script -*- _lua() { local cur prev words cword _init_completion || return case $prev in -e | -l | -v | -) return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W "$(_parse_help "$1")" -- "$cur")) return fi _filedir 'l@(ua|?(ua)c)' } && complete -F _lua lua # ex: filetype=sh dmypy 0000644 00000002066 15036124164 0005637 0 ustar 00 # dmypy completion -*- shell-script -*- _dmypy() { local cur prev words cword _init_completion || return case $prev in --help | --version | -[hV]) return ;; --status-file) _filedir return ;; esac local cmd i for ((i = 1; i < cword; i++)); do if [[ ${words[i]} != -* && ${words[i - 1]} != --status-file ]]; then cmd=${words[i]} break fi done case ${cmd-} in check | run) _filedir '@(py|pyi)' return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) return fi if [[ ! -v cmd ]]; then local cmds=$($1 --help 2>&1 | command sed -ne '/positional arguments/{p;n;p;q}' | command sed -ne 's/{\(.*\)}/\1/p') COMPREPLY=($(IFS="," compgen -W '$cmds' -- "$cur")) return fi } && complete -F _dmypy dmypy # ex: filetype=sh asciidoc 0000644 00000002255 15036124164 0006253 0 ustar 00 # asciidoc(1) completion -*- shell-script -*- _asciidoc_doctype() { COMPREPLY+=($(compgen -W 'article book manpage' -- "$cur")) } _asciidoc() { local cur prev words cword split _init_completion -s || return case $prev in --attribute | -!(-*)a) return ;; --backend | -!(-*)b) COMPREPLY=($(compgen -W 'docbook html4 xhtml11' -- "$cur")) return ;; --conf-file | -!(-*)f) _filedir conf return ;; --doctype | -!(-*)d) _asciidoc_doctype return ;; --help | -!(-*)h) COMPREPLY=($(compgen -W 'manpage syntax topics' -- "$cur")) return ;; --out-file | -!(-*)o) _filedir return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1" "--help manpage")' \ -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return fi _filedir } && complete -F _asciidoc asciidoc asciidoc.py # ex: filetype=sh ping 0000644 00000003720 15036124164 0005430 0 ustar 00 # ping(8) completion -*- shell-script -*- _ping() { local cur prev words cword _init_completion -n = || return local ipvx case $prev in -*[cFGghilmPpstVWwz]) return ;; -*I) _available_interfaces -a return ;; -*M) # Path MTU strategy in Linux, mask|time in FreeBSD local opts="do want dont" [[ $OSTYPE == *bsd* ]] && opts="mask time" COMPREPLY=($(compgen -W '$opts' -- "$cur")) return ;; -*N) if [[ $cur != *= ]]; then COMPREPLY=($(compgen -W 'name ipv6 ipv6-global ipv6-sitelocal ipv6-linklocal ipv6-all ipv4 ipv4-all subject-ipv6= subject-ipv4= subject-name= subject-fqdn=' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace fi return ;; -*Q) # TOS in Linux, "somewhat quiet" (no args) in FreeBSD if [[ $OSTYPE != *bsd* ]]; then COMPREPLY=($(compgen -W '{0..7}' -- "$cur")) return fi ;; -*S) # Socket sndbuf in Linux, source IP in FreeBSD [[ $OSTYPE == *bsd* ]] && _ip_addresses return ;; -*T) # Timestamp option in Linux, TTL in FreeBSD [[ $OSTYPE == *bsd* ]] || COMPREPLY=($(compgen -W 'tsonly tsandaddr' -- "$cur")) return ;; -*4*) ipvx=-4 ;; -*6*) ipvx=-6 ;; esac if [[ $cur == -* ]]; then local opts=$(_parse_help "$1") COMPREPLY=($(compgen -W '${opts:-$(_parse_usage "$1")}' -- "$cur")) return fi [[ $1 == *6 ]] && ipvx=-6 _known_hosts_real ${ipvx-} -- "$cur" } && complete -F _ping ping ping6 # ex: filetype=sh inotifywait 0000644 00000002371 15036124164 0007042 0 ustar 00 # bash completion for inotifywait(1) and inotifywatch(1) -*- shell-script -*- _inotifywait_events() { # Expecting line with "Events:", followed by ones starting with one # tab. Word following the tab is event name, others are line # wrapped explanations. COMPREPLY+=($(compgen -W "$($1 --help 2>/dev/null | command sed -e '/^Events:/,/^[^'$'\t'']/!d' \ -ne 's/^'$'\t''\([^ '$'\t'']\{1,\}\)[ '$'\t''].*/\1/p')" \ -- "$cur")) } _inotifywait() { local cur prev words cword _init_completion || return case $prev in --help | --exclude | --excludei | --format | --timefmt | --timeout | -!(-*)[ht]) return ;; --fromfile | --outfile | -!(-*)o) _filedir return ;; --event | -!(-*)e) _inotifywait_events "$1" return ;; --ascending | --descending) COMPREPLY=($(compgen -W 'total' -- "$cur")) _inotifywait_events "$1" return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) return fi _filedir } && complete -F _inotifywait inotifywait inotifywatch # ex: filetype=sh cksfv 0000644 00000001010 15036124164 0005575 0 ustar 00 # cksfv completion by Chris <xris@forevermore.net> -*- shell-script -*- _cksfv() { local cur prev words cword _init_completion || return if ((cword == 1)); then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) return fi case "$prev" in -*C | -*g) _filedir -d return ;; -*f) _filedir 'sfv' return ;; esac _filedir } && complete -F _cksfv cksfv # ex: filetype=sh links 0000644 00000006327 15036124164 0005621 0 ustar 00 # bash completion for links -*- shell-script -*- _links() { local cur prev words cword _init_completion -n : || return case $prev in -html-t-text-color | -html-t-link-color) COMPREPLY=($(compgen -W '{0..15}' -- "$cur")) return ;; -http.fake-firefox | -html-[gt]-ignore-document-color) COMPREPLY=($(compgen -W '0 1' -- "$cur")) return ;; --help | -help | -mode | -display | -source | -dump | -width | -max-connections | \ -max-connections-to-host | -retries | -receive-timeout | \ -unrestartable-receive-timeout | -*-size | -*-proxy | \ -append-text-to-dns-lookups | -ssl.client-cert-passwd | -http.fake-* | \ -http.extra-header | -ftp.anonymous-passwd | -*-color | -*-gamma | \ -bfu-aspect | -html-image-scale | -html-margin) return ;; -lookup) _known_hosts_real -- "$cur" return ;; -driver) local drivers=$("$1" -driver foo 2>&1 | command sed -ne '$!d' -e '/^[a-z0-9, ]\{1,\}$/s/,/ /gp') [[ $drivers ]] || drivers='x svgalib fb directfb pmshell atheos' COMPREPLY=($(compgen -W "$drivers" -- "$cur")) return ;; -codepage | -bookmarks-codepage | -http-assume-codepage) _xfunc iconv _iconv_charsets return ;; -download-dir) _filedir -d return ;; -bind-address) _ip_addresses return ;; -bind-address-ipv6) _ip_addresses -6 __ltrim_colon_completions "$cur" return ;; -async-dns | -download-utime | -aggressive-cache | -only-proxies | \ -http-bugs.* | -http.do-not-track | -ftp.use-* | -ftp.fast | -ftp.set-iptos | \ -smb.allow-hyperlinks-to-smb | -save-url-history | -dither-letters | \ -dither-images | -overwrite-instead-of-scroll | -html-*) COMPREPLY=($(compgen -W '0 1' -- "$cur")) return ;; -address-preference | -http.referer) COMPREPLY=($(compgen -W '{0..4}' -- "$cur")) return ;; -ssl-certificates | -display-optimize | -gamma-correction) COMPREPLY=($(compgen -W '{0..2}' -- "$cur")) return ;; -ssl.client-cert-key) _filedir '@(key|pem)' return ;; -ssl.client-cert-crt) _filedir '@(c?(e)rt|cer|pem|der)' return ;; -bookmarks-file) _filedir html return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1" | command grep -vF -- "->")' -- "$cur")) return fi local dir for dir in .links .links2; do if [[ -r ~/$dir/links.his ]]; then COMPREPLY+=($(compgen -W '$(cat ~/$dir/links.his)' -- "$cur")) __ltrim_colon_completions "$cur" fi done _filedir '@(htm|html)' } && complete -F _links links links2 # ex: filetype=sh pydoc 0000644 00000002021 15036124164 0005602 0 ustar 00 # pydoc completion -*- shell-script -*- _pydoc() { local cur prev words cword _init_completion || return case $prev in -k | -p) return ;; -w) _filedir return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W \ '$("$1" | command sed -e "s/^pydoc3\{0,1\} //" | _parse_help -)' \ -- "$cur")) return fi COMPREPLY=($(compgen -W 'keywords topics modules' -- "$cur")) if [[ $cur != @(.|*/)* ]]; then local python=python [[ ${1##*/} == *3* ]] && python=python3 _xfunc python _python_modules $python fi # Note that we don't do "pydoc modules" as it is known to hang on # some systems; _python_modules tends to work better and faster. COMPREPLY+=($(compgen -W \ '$($1 keywords topics | command sed -e /^Here/d)' -- "$cur")) _filedir py } && complete -F _pydoc pydoc pydoc3 # ex: filetype=sh _rfkill 0000644 00000001637 15036124164 0006122 0 ustar 00 # bash completion for rfkill -*- shell-script -*- # Use of this file is deprecated on systems with util-linux >= 2.31, which # ships completion for the rfkill included with it. _rfkill() { local cur prev words cword _init_completion || return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '--version' -- "$cur")) else case $cword in 1) COMPREPLY=($(compgen -W "help event list block unblock" \ -- "$cur")) ;; 2) if [[ $prev == block || $prev == unblock ]]; then COMPREPLY=($(compgen -W "$($1 list | awk -F: \ '/^[0-9]/ {print $1}') all wifi bluetooth uwb wimax \ wwan gps" -- "$cur")) fi ;; esac fi } && complete -F _rfkill rfkill # ex: filetype=sh namei 0000644 00000000764 15036124164 0005571 0 ustar 00 _namei_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS="--help --version --mountpoints --modes --owners --long --nosymlinks --vertical" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 } complete -F _namei_module namei utmpdump 0000644 00000000733 15036124164 0006347 0 ustar 00 _utmpdump_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS="--follow --reverse --output --version --help" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 } complete -F _utmpdump_module utmpdump mii-diag 0000644 00000001217 15036124164 0006152 0 ustar 00 # mii-diag(8) completion -*- shell-script -*- _mii_diag() { local cur prev words cword split _init_completion -s || return case $prev in -F | -A | --advertise | --fixed-speed) COMPREPLY=($(compgen -W '100baseT4 100baseTx 100baseTx-FD 100baseTx-HD 10baseT 10baseT-FD 10baseT-HD' -- "$cur")) return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) else _available_interfaces -a fi } && complete -F _mii_diag -o default mii-diag # ex: filetype=sh getent 0000644 00000003661 15036124164 0005765 0 ustar 00 # bash completion for getent -*- shell-script -*- _getent() { local cur prev words cword split _init_completion -s || return local i db for ((i = 1; i < cword; i++)); do case ${words[i]} in --version | --usage | --help | -!(-*)[V?]) return ;; --service | -!(-*)s) ((i++)) ;; -*) ;; *) # First non-option value is the db db=${words[i]} break ;; esac done case ${db-} in passwd) COMPREPLY=($(compgen -u -- "$cur")) return ;; group) COMPREPLY=($(compgen -g -- "$cur")) return ;; services) COMPREPLY=($(compgen -s -- "$cur")) return ;; hosts) COMPREPLY=($(compgen -A hostname -- "$cur")) return ;; protocols | networks | ahosts | ahostsv4 | ahostsv6 | rpc) COMPREPLY=($(compgen -W "$($1 $db | awk '{ print $1 }')" -- "$cur")) return ;; aliases | shadow | gshadow) COMPREPLY=($(compgen -W "$($1 $db | cut -d: -f1)" -- "$cur")) return ;; ethers | netgroup) return ;; esac case $prev in -s | --service) return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace elif [[ ! -v db ]]; then COMPREPLY=($(compgen -W 'passwd group hosts services protocols networks ahosts ahostsv4 ahostsv6 aliases ethers netgroup rpc shadow gshadow' -- "$cur")) fi } && complete -F _getent getent # ex: filetype=sh filesnarf 0000644 00000000677 15036124164 0006454 0 ustar 00 # filesnarf etc completion -*- shell-script -*- _snarf() { local cur prev words cword _init_completion || return case $prev in -i) _available_interfaces -a return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_usage "$1")' -- "$cur")) fi } && complete -F _snarf filesnarf mailsnarf msgsnarf # ex: filetype=sh psql 0000644 00000010424 15036124164 0005451 0 ustar 00 # bash completion for Postgresql -*- shell-script -*- _pg_databases() { # -w was introduced in 8.4, https://launchpad.net/bugs/164772 # "Access privileges" in output may contain linefeeds, hence the NF > 1 COMPREPLY=($(compgen -W "$(psql -XAtqwlF $'\t' 2>/dev/null | awk 'NF > 1 { print $1 }')" -- "$cur")) } _pg_users() { # -w was introduced in 8.4, https://launchpad.net/bugs/164772 COMPREPLY=($(compgen -W "$(psql -XAtqwc 'select usename from pg_user' \ template1 2>/dev/null)" -- "$cur")) ((${#COMPREPLY[@]} == 0)) && COMPREPLY=($(compgen -u -- "$cur")) } # createdb(1) completion # _createdb() { local cur prev words cword split _init_completion -s || return case $prev in --host | -!(-*)h) _known_hosts_real -- "$cur" return ;; --username | --owner | -!(-*)[UO]) _pg_users return ;; --help | --version | --port | --tablespace | --encoding | --template | -!(-*)[pDET]) return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace else _pg_databases fi } && complete -F _createdb createdb # createuser(1) completion # _createuser() { local cur prev words cword split _init_completion -s || return case $prev in --help | --version | --port | --connection-limit | -!(-*)[pc]) return ;; --host | -!(-*)h) _known_hosts_real -- "$cur" return ;; --username | -!(-*)U) _pg_users return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace fi } && complete -F _createuser createuser # dropdb(1) completion # _dropdb() { local cur prev words cword split _init_completion -s || return case $prev in --host | -!(-*)h) _known_hosts_real -- "$cur" return ;; --username | -!(-*)U) _pg_users return ;; --help | --version) return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace else _pg_databases fi } && complete -F _dropdb dropdb # dropuser(1) completion # _dropuser() { local cur prev words cword split _init_completion -s || return case $prev in --help | --version | --port | -!(-*)p) return ;; --host | -!(-*)h) _known_hosts_real -- "$cur" return ;; --username | -!(-*)U) _pg_users return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace else _pg_users fi } && complete -F _dropuser dropuser # psql(1) completion # _psql() { local cur prev words cword split _init_completion -s || return case $prev in --host | -!(-*)h) _known_hosts_real -- "$cur" return ;; --username | -!(-*)U) _pg_users return ;; --dbname | -!(-*)d) _pg_databases return ;; --output | --file | --log-file | -!(-*)[ofL]) _filedir return ;; --help | --version | --command | --field-separator | --port | --pset | \ --record-separator | --table-attr | --set | --variable | -!(-*)[?VcFpPRTv]) return ;; esac $split && return if [[ $cur == -* ]]; then # return list of available options COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace else # return list of available databases _pg_databases fi } && complete -F _psql psql # ex: filetype=sh udevadm 0000644 00000017767 15036124164 0006140 0 ustar 00 # udevadm(8) completion -*- shell-script -*- # SPDX-License-Identifier: LGPL-2.1-or-later # # This file is part of systemd. # # Copyright © 2010 Ran Benita # # systemd is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version. # # systemd is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with systemd; If not, see <http://www.gnu.org/licenses/>. __contains_word () { local w word=$1; shift for w in "$@"; do [[ $w = "$word" ]] && return done } __get_all_sysdevs() { local -a devs=(/sys/bus/*/devices/*/ /sys/class/*/*/) printf '%s\n' "${devs[@]%/}" } __get_all_devs() { local i for i in /dev/* /dev/*/*; do echo $i done } __get_all_device_units() { systemctl list-units -t device --full --no-legend --no-pager --plain 2>/dev/null | \ { while read -r a b; do echo "$a"; done; } } _udevadm() { local i verb comps builtin local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} local -A OPTS=( [COMMON]='-h --help -V --version' [DEBUG]='-d --debug' [INFO_STANDALONE]='-r --root -a --attribute-walk -x --export -e --export-db -c --cleanup-db -w --wait-for-initialization' [INFO_ARG]='-q --query -p --path -n --name -P --export-prefix -d --device-id-of-file' [TRIGGER_STANDALONE]='-v --verbose -n --dry-run -q --quiet -w --settle --wait-daemon --uuid' [TRIGGER_ARG]='-t --type -c --action -s --subsystem-match -S --subsystem-nomatch -a --attr-match -A --attr-nomatch -p --property-match -g --tag-match -y --sysname-match --name-match -b --parent-match' [SETTLE]='-t --timeout -E --exit-if-exists' [CONTROL_STANDALONE]='-e --exit -s --stop-exec-queue -S --start-exec-queue -R --reload --ping' [CONTROL_ARG]='-l --log-priority -p --property -m --children-max -t --timeout' [MONITOR_STANDALONE]='-k --kernel -u --udev -p --property' [MONITOR_ARG]='-s --subsystem-match -t --tag-match' [TEST]='-a --action -N --resolve-names' ) local verbs=(info trigger settle control monitor test-builtin test) local builtins=(blkid btrfs hwdb input_id keyboard kmod net_id net_setup_link path_id usb_id uaccess) for ((i=0; i < COMP_CWORD; i++)); do if __contains_word "${COMP_WORDS[i]}" "${verbs[@]}"; then verb=${COMP_WORDS[i]} break fi done if [[ -z ${verb-} ]]; then if [[ "$cur" = -* ]]; then COMPREPLY=( $(compgen -W '${OPTS[COMMON]} ${OPTS[DEBUG]}' -- "$cur") ) else COMPREPLY=( $(compgen -W '${verbs[*]}' -- "$cur") ) fi return 0 fi case $verb in 'info') if __contains_word "$prev" ${OPTS[INFO_ARG]}; then case $prev in -q|--query) comps='name symlink path property all' ;; -p|--path) comps=$( __get_all_sysdevs ) local IFS=$'\n' ;; -n|--name) comps=$( __get_all_devs ) ;; *) comps='' ;; esac COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 fi if [[ $cur = -* ]]; then comps="${OPTS[COMMON]} ${OPTS[INFO_STANDALONE]} ${OPTS[INFO_ARG]}" else comps=$( __get_all_sysdevs; __get_all_device_units ) local IFS=$'\n' fi ;; 'trigger') if __contains_word "$prev" ${OPTS[TRIGGER_ARG]}; then case $prev in -t|--type) comps='devices subsystems' ;; -c|--action) comps=$( udevadm trigger --action help ) ;; -y|--sysname-match|-b|--parent-match) comps=$( __get_all_sysdevs ) local IFS=$'\n' ;; --name-match) comps=$( __get_all_devs ) ;; *) comps='' ;; esac COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 fi if [[ $cur = -* ]]; then comps="${OPTS[COMMON]} ${OPTS[TRIGGER_STANDALONE]} ${OPTS[TRIGGER_ARG]}" else comps=$( __get_all_sysdevs; __get_all_device_units ) local IFS=$'\n' fi ;; 'settle') if __contains_word "$prev" ${OPTS[SETTLE]}; then case $prev in -E|--exit-if-exists) comps=$( compgen -A file -- "$cur" ) ;; *) comps='' ;; esac COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 fi comps="${OPTS[COMMON]} ${OPTS[SETTLE]}" ;; 'control') if __contains_word "$prev" ${OPTS[CONTROL_ARG]}; then case $prev in -l|--log-priority) comps='alert crit debug emerg err info notice warning' ;; *) comps='' ;; esac COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 fi comps="${OPTS[COMMON]} ${OPTS[CONTROL_STANDALONE]} ${OPTS[CONTROL_ARG]}" ;; 'monitor') if __contains_word "$prev" ${OPTS[MONITOR_ARG]}; then case $prev in *) comps='' ;; esac COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 fi comps="${OPTS[COMMON]} ${OPTS[MONITOR_STANDALONE]} ${OPTS[MONITOR_ARG]}" ;; 'test') if __contains_word "$prev" ${OPTS[TEST]}; then case $prev in -a|--action) comps=$( udevadm test --action help ) ;; -N|--resolve-names) comps='early late never' ;; esac COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 fi if [[ $cur = -* ]]; then comps="${OPTS[COMMON]} ${OPTS[TEST]}" else comps=$( __get_all_sysdevs ) local IFS=$'\n' fi ;; 'test-builtin') for ((i=0; i < COMP_CWORD; i++)); do if __contains_word "${COMP_WORDS[i]}" "${builtins[@]}"; then builtin=${COMP_WORDS[i]} break fi done if [[ -z $builtin ]]; then comps="${builtins[@]}" elif [[ $cur = -* ]]; then comps="${OPTS[COMMON]}" else comps=$( __get_all_sysdevs ) local IFS=$'\n' fi ;; *) comps=${VERBS[*]} ;; esac COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 } complete -F _udevadm udevadm chown 0000644 00000002117 15036124164 0005610 0 ustar 00 # chown(1) completion -*- shell-script -*- _chown() { local cur prev words cword split # Don't treat user:group as separate words. _init_completion -s -n : || return case "$prev" in --from) _usergroup return ;; --reference) _filedir return ;; esac $split && return if [[ $cur == -* ]]; then # Complete -options local w opts for w in "${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 # The first argument is an usergroup; the rest are filedir. _count_args : if ((args == 1)); then _usergroup -u else _filedir fi fi } && complete -F _chown chown # ex: filetype=sh quota 0000644 00000007175 15036124164 0005634 0 ustar 00 # bash completion for quota-tools -*- shell-script -*- _user_or_group() { local i # complete on groups if -g was given for ((i = 1; i < cword; i++)); do if [[ ${words[i]} == -@(g|-group) ]]; then COMPREPLY=($(compgen -g -- "$cur")) return fi done # otherwise complete on users COMPREPLY=($(compgen -u -- "$cur")) } _quota_parse_help() { local opts=$(_parse_help "$1") COMPREPLY=($(compgen -W '${opts:-$(_parse_usage "$1")}' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace } _quota_formats() { COMPREPLY=($(compgen -W 'vfsold vfsv0 rpc xfs' -- "$cur")) } _filesystems() { # Only list filesystems starting with "/", otherwise we also get #+ "binfmt_misc", "proc", "tmpfs", ... COMPREPLY=($(compgen -W "$(awk '/^\// {print $1}' /etc/mtab)" \ -- "$cur")) } _quota() { local cur prev words cword split _init_completion -s || return case $prev in -F | --format) _quota_formats return ;; -h | --help | -V | --version) return ;; esac $split && return if [[ $cur == -* ]]; then _quota_parse_help "$1" else _user_or_group fi } && complete -F _quota -o default quota _setquota() { local cur prev words cword split _init_completion -s || return case $prev in -F | --format) _quota_formats return ;; -p | --prototype) _user_or_group return ;; -h | --help | -V | --version) return ;; esac $split && return if [[ $cur == -* ]]; then _quota_parse_help "$1" else local args _count_args case $args in 1) _user_or_group ;; 2) _filesystems ;; esac fi } && complete -F _setquota -o default setquota _edquota() { local cur prev words cword split _init_completion -s || return case $prev in -F | --format) _quota_formats return ;; -f | --filesystem) _filesystems return ;; -p | --prototype) _user_or_group return ;; -h | --help | -V | --version) return ;; esac $split && return if [[ $cur == -* ]]; then _quota_parse_help "$1" else _user_or_group fi } && complete -F _edquota -o default edquota _quotacheck() { local cur prev words cword split _init_completion -s || return case $prev in -F | --format) _quota_formats return ;; -h | --help | -V | --version) return ;; esac $split && return if [[ $cur == -* ]]; then _quota_parse_help "$1" else _filesystems fi } && complete -F _quotacheck -o default quotacheck repquota _quotaon() { local cur prev words cword split _init_completion -s || return case $prev in -F | --format) _quota_formats return ;; -x | --xfs-command) COMPREPLY=($(compgen -W 'delete enforce' -- "$cur")) return ;; -h | --help | -V | --version) return ;; esac $split && return if [[ $cur == -* ]]; then _quota_parse_help "$1" else _filesystems fi } && complete -F _quotaon -o default quotaon quotaoff # ex: filetype=sh autorpm 0000644 00000000536 15036124164 0006164 0 ustar 00 # autorpm(8) completion -*- shell-script -*- _autorpm() { local cur prev words cword _init_completion || return COMPREPLY=($(compgen -W '--notty --debug --help --version auto add fullinfo info help install list remove set' -- "$cur")) } && complete -F _autorpm autorpm # ex: filetype=sh invoke-rc.d 0000644 00000002306 15036124164 0006611 0 ustar 00 # invoke-rc.d(8) completion -*- shell-script -*- # # Copyright (C) 2004 Servilio Afre Puentes <servilio@gmail.com> _invoke_rc_d() { local cur prev words cword _init_completion || return local sysvdir services options valid_options [[ -d /etc/rc.d/init.d ]] && sysvdir=/etc/rc.d/init.d || sysvdir=/etc/init.d services=($(printf '%s ' $sysvdir/!(README*|*.sh|$_backup_glob))) services=(${services[@]#$sysvdir/}) options=(--help --quiet --force --try-anyway --disclose-deny --query --no-fallback) if [[ $cword -eq 1 || $prev == --* ]]; then valid_options=($( tr " " "\n" <<<"${words[*]} ${options[*]}" | command sed -ne "/$(command sed 's/ /\\|/g' <<<"${options[*]}")/p" | sort | uniq -u )) COMPREPLY=($(compgen -W '${valid_options[@]} ${services[@]}' -- "$cur")) elif [[ -x $sysvdir/$prev ]]; then COMPREPLY=($(compgen -W '`command sed -e "y/|/ /" \ -ne "s/^.*Usage:[ ]*[^ ]*[ ]*{*\([^}\"]*\).*$/\1/p" \ $sysvdir/$prev`' -- "$cur")) else COMPREPLY=() fi } && complete -F _invoke_rc_d invoke-rc.d # ex: filetype=sh pkg_delete 0000644 00000000743 15036124164 0006600 0 ustar 00 # bash completion for *BSD package management tools -*- shell-script -*- _pkg_delete() { local cur prev words cword _init_completion || return local pkgdir=${PKG_DBDIR:-/var/db/pkg}/ [[ $prev == -o || $prev == -p || $prev == -W ]] && return COMPREPLY=($(compgen -d -- "$pkgdir$cur")) ((${#COMPREPLY[@]} == 0)) || COMPREPLY=(${COMPREPLY[@]#$pkgdir}) } && complete -F _pkg_delete -o dirnames pkg_delete pkg_info pkg_deinstall # ex: filetype=sh gdbus 0000644 00000001647 15036124164 0005605 0 ustar 00 # Check for bash [ -z "$BASH_VERSION" ] && return #################################################################################################### __gdbus() { local IFS=$'\n' local cur=`_get_cword :` local suggestions=$(gdbus complete "${COMP_LINE}" ${COMP_POINT}) COMPREPLY=($(compgen -W "$suggestions" -- "$cur")) # Remove colon-word prefix from COMPREPLY items case "$cur" in *:*) case "$COMP_WORDBREAKS" in *:*) local colon_word=${cur%${cur##*:}} local i=${#COMPREPLY[*]} while [ $((--i)) -ge 0 ]; do COMPREPLY[$i]=${COMPREPLY[$i]#"$colon_word"} done ;; esac ;; esac } #################################################################################################### complete -o nospace -F __gdbus gdbus unshunt 0000644 00000000533 15036124164 0006176 0 ustar 00 # mailman unshunt completion -*- shell-script -*- _unshunt() { local cur prev words cword _init_completion || return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) else _filedir -d fi } && complete -F _unshunt unshunt # ex: filetype=sh sshow 0000644 00000000762 15036124164 0005641 0 ustar 00 # sshow completion -*- shell-script -*- _sshow() { local cur prev words cword _init_completion || return case $prev in -*i) _available_interfaces -a return ;; -*p) _filedir pcap return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_usage "$1")' -- "$cur")) fi } && complete -F _sshow sshow # ex: filetype=sh mysqladmin 0000644 00000003343 15036124164 0006652 0 ustar 00 # bash completion for mysqladmin -*- shell-script -*- _mysqladmin() { local cur prev words cword split _init_completion -s || return case $prev in --user | -!(-*)u) COMPREPLY=($(compgen -u -- "$cur")) return ;; --host | -!(-*)h) _known_hosts_real -- "$cur" return ;; --character-sets-dir | --ssl-capath) _filedir -d return ;; --default-character-set) _xfunc mysql _mysql_character_sets return ;; --socket | -!(-*)S) _filedir sock return ;; --defaults-file | --defaults-extra-file) _filedir return ;; --ssl-ca | --ssl-cert) _filedir '@(pem|cer|c?(e)rt)' return ;; --ssl-key) _filedir '@(pem|key)' return ;; --count | --port | --set-variable | --sleep | --ssl-cipher | --wait | \ --connect_timeout | --shutdown_timeout | -!(-*)[cPOiw]) return ;; --help | --version | -!(-*)[?V]) return ;; esac $split && return COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) COMPREPLY+=($(compgen -W 'create debug drop extended-status flush-hosts flush-logs flush-status flush-tables flush-threads flush-privileges kill password old-password ping processlist reload refresh shutdown status start-slave stop-slave variables version' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace } && complete -F _mysqladmin mysqladmin # ex: filetype=sh ifstat 0000644 00000004003 15036124164 0005760 0 ustar 00 # bash completion for ifstat(1) -*- shell-script -*- _ifstat() { local cur prev words cword split _init_completion -s || return case $prev in --help | --version | --scan | --interval | -!(-*)[hvV]) return ;; -!(-*)i) # TODO comma separated _available_interfaces -a return ;; -!(-*)d) # iproute2: no completion (scan delay) # traditional: parse driver if ! { "$1" --help 2>&1 || : } | command grep -q -- '-d.*--scan'; then COMPREPLY=($(compgen -W '$("$1" -v | command \ sed -e "s/[,.]//g" -ne "s/^.*drivers://p")' -- "$cur")) fi return ;; --noupdate | -!(-*)s) # iproute2: pass through (skip history update) # traditional: hostnames (snmp) if ! { "$1" --help 2>&1 || : } | command grep -q -- '-s.*--noupdate'; then _known_hosts_real -- "$cur" return fi ;; -!(-*)t) # iproute2: no completion (interval) # traditional: pass through (add timestamp) ! { "$1" --help 2>&1 || : } | command grep -q -- '-t.*--interval' || return ;; --extended | -!(-*)x) # iproute2: parse xstat types COMPREPLY=($(compgen -W '$("$1" -x nonexistent-xstat 2>&1 | awk "found { print \$1 } /supported xstats:/ { found=1 }")' \ -- "$cur")) return ;; esac $split && return if [[ $cur == -* ]]; then local opts=$(_parse_help "$1") COMPREPLY=($(compgen -W '${opts:-$(_parse_usage "$1")}' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return fi } && complete -F _ifstat ifstat # ex: filetype=sh killall 0000644 00000001420 15036124164 0006112 0 ustar 00 # killall(1) completion -*- shell-script -*- [[ $OSTYPE == *@(linux|freebsd|darwin)* ]] || return 1 _killall() { local cur prev words cword split _init_completion -s || return case $prev in --context | --older-than | --younger-than | --version | -!(-*)@([Zoy]|V*)) return ;; --signal | -!(-*)s) _signals return ;; --user | -!(-*)u) _allowed_users return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) ((cword == 1)) && _signals - return fi _pnames } && complete -F _killall killall # ex: filetype=sh ua 0000644 00000003677 15036124164 0005113 0 ustar 00 # bash completion for ubuntu-pro-client . /etc/os-release # For VERSION_ID API_ENDPOINTS=$(/usr/bin/python3 -c 'from uaclient.api.api import VALID_ENDPOINTS; print(" ".join(VALID_ENDPOINTS))') SERVICES="anbox-cloud cc-eal cis esm-apps esm-infra fips fips-updates landscape livepatch realtime-kernel ros ros-updates usg" SUBCMDS="--debug --help --version api attach auto-attach collect-logs config detach disable enable fix help refresh security-status status system version" _ua_complete() { local cur_word prev_word cur_word="${COMP_WORDS[COMP_CWORD]}" prev_word="${COMP_WORDS[COMP_CWORD-1]}" case ${COMP_CWORD} in 1) # shellcheck disable=SC2207 COMPREPLY=($(compgen -W "$SUBCMDS" -- $cur_word)) ;; 2) case ${prev_word} in disable) # shellcheck disable=SC2207 COMPREPLY=($(compgen -W "$SERVICES" -- $cur_word)) ;; enable) # shellcheck disable=SC2207 COMPREPLY=($(compgen -W "$SERVICES" -- $cur_word)) ;; api) # shellcheck disable=SC2207 COMPREPLY=($(compgen -W "$API_ENDPOINTS" -- $cur_word)) ;; esac ;; *) local subcmd subcmd="${COMP_WORDS[1]}" case ${subcmd} in disable) # shellcheck disable=SC2207 COMPREPLY=($(compgen -W "$SERVICES" -- $cur_word)) ;; enable) # shellcheck disable=SC2207 COMPREPLY=($(compgen -W "$SERVICES" -- $cur_word)) ;; *) COMPREPLY=() ;; esac ;; esac } complete -F _ua_complete ua complete -F _ua_complete pro # vi: syntax=sh expandtab ldattach 0000644 00000002700 15036124164 0006254 0 ustar 00 _ldattach_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-s'|'--speed') COMPREPLY=( $(compgen -W "speed" -- $cur) ) return 0 ;; '-c'|'--intro-command') COMPREPLY=( $(compgen -W "string" -- $cur) ) return 0 ;; '-p'|'--pause') COMPREPLY=( $(compgen -W "seconds" -- $cur) ) return 0 ;; '-i'|'--iflag') local IFLAGS IFLAGS="BRKINT ICRNL IGNBRK IGNCR IGNPAR IMAXBEL INLCR INPCK ISTRIP IUCLC IUTF8 IXANY IXOFF IXON PARMRK -BRKINT -ICRNL -IGNBRK -IGNCR -IGNPAR -IMAXBEL -INLCR -INPCK -ISTRIP -IUCLC -IUTF8 -IXANY -IXOFF -IXON -PARMRK" COMPREPLY=( $(compgen -W "$IFLAGS" -- $cur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS="--debug --speed --intro-command --pause --sevenbits --eightbits --noparity --evenparity --oddparity --onestopbit --twostopbits --iflag --help --version" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; /*) local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 ;; esac local LDISC_DEVICE LDISC_DEVICE="6PACK AX25 GIGASET GIGASET_M101 HCI HDLC IRDA M101 MOUSE PPP PPS R3964 SLIP STRIP SYNCPPP SYNC_PPP TTY X25 /dev/" COMPREPLY=( $(compgen -W "$LDISC_DEVICE" -- $cur) ) return 0 } complete -F _ldattach_module ldattach _rtcwake 0000644 00000001555 15036124164 0006276 0 ustar 00 # bash completion for rtcwake -*- shell-script -*- # Use of this file is deprecated. Upstream completion is available in # util-linux >= 2.23, use that instead. _rtcwake() { local cur prev words cword split _init_completion -s || return case "$prev" in --help | -h | --version | -V | --seconds | -s | --time | -t) return ;; --mode | -m) COMPREPLY=($(compgen -W 'standby mem disk on no off' -- "$cur")) return ;; --device | -d) COMPREPLY=($(command ls -d /dev/rtc?* 2>/dev/null)) COMPREPLY=($(compgen -W '${COMPREPLY[@]#/dev/}' -- "$cur")) return ;; esac $split && return COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) } && complete -F _rtcwake rtcwake # ex: filetype=sh jshint 0000644 00000001607 15036124164 0005774 0 ustar 00 # bash completion for jshint -*- shell-script -*- _jshint() { local cur prev words cword split _init_completion -s || return case $prev in -v | --version | -h | --help | --exclude | --filename | -e | --extra-ext) return ;; -c | --config) _filedir return ;; --reporter) COMPREPLY=($(compgen -W "jslint checkstyle unix" -- "$cur")) return ;; --extract) COMPREPLY=($(compgen -W "auto always never" -- "$cur")) return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return fi _filedir js } && complete -F _jshint jshint # ex: filetype=sh snownews 0000644 00000000553 15036124164 0006357 0 ustar 00 # snownews(1) completion -*- shell-script -*- _snownews() { local cur prev words cword _init_completion || return if [[ $cur == -* ]]; then # return list of available options COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) fi } && complete -F _snownews snownews # ex: filetype=sh pyflakes 0000644 00000000677 15036124164 0006321 0 ustar 00 # pyflakes(1) completion -*- shell-script -*- _pyflakes() { local cur prev words cword _init_completion || return case $prev in -h | --help | --version) return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) return fi _filedir py } && complete -F _pyflakes pyflakes # ex: filetype=sh taskset 0000644 00000002275 15036124164 0006155 0 ustar 00 _taskset_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-c'|'--cpu-list') local prefix realcur CPULIST_ALL CPULIST realcur="${cur##*,}" prefix="${cur%$realcur}" CPULIST_ALL=$(sed 's/^/{/; s/-/../g; s/,/} {/g; s/$/}/' /sys/devices/system/cpu/online) for WORD in $(eval echo $CPULIST_ALL); do if ! [[ $prefix == *"$WORD"* ]]; then CPULIST="$WORD ${CPULIST:-""}" fi done compopt -o nospace COMPREPLY=( $(compgen -P "$prefix" -W "$CPULIST" -S ',' -- $realcur) ) return 0 ;; '-p'|'--pid') local PIDS # FIXME: the pid argument is ambiguous. When # setting an affinity the optarg has to be cpu # mask. The following is good only for getting # affinity. PIDS=$(cd /proc && echo [0-9]*) COMPREPLY=( $(compgen -W "$PIDS" -- $cur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS="--all-tasks --pid --cpu-list --help --version" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac compopt -o bashdefault COMPREPLY=( $(compgen -c -- $cur) ) return 0 } complete -F _taskset_module taskset getconf 0000644 00000001433 15036124164 0006117 0 ustar 00 # getconf(1) completion -*- shell-script -*- _getconf() { local cur prev words cword _init_completion || return case $prev in -a) _filedir return ;; -v) COMPREPLY=($(compgen -W \ '$("$1" -a 2>/dev/null | awk "{ print \$1 }")' -- \ "${cur:-POSIX_V}")) return ;; esac if [[ $prev == PATH_MAX ]]; then # TODO more path vars, better handling _filedir elif [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '-a -v' -- "$cur")) else COMPREPLY=($(compgen -W \ '$("$1" -a 2>/dev/null | awk "{ print \$1 }")' -- "$cur")) fi } && complete -F _getconf getconf # ex: filetype=sh carton 0000644 00000003524 15036124164 0005763 0 ustar 00 # carton(3pm) completion -*- shell-script -*- _carton_commands() { local cmds=$("${1:-carton}" usage 2>&1 | command sed -ne '/.*command.* is one of/{n;p;q;}') COMPREPLY+=($(IFS="$IFS," compgen -W "$cmds" -- "$cur")) } _carton_command_help() { local help=$(PERLDOC_PAGER=cat PERLDOC=-otext "${1:-carton}" -h $2 2>&1) COMPREPLY+=($(compgen -W '$help' -- "$cur")) } _carton() { local cur prev words cword split _init_completion -s || return local i command for ((i = 1; i < cword; i++)); do case ${words[i]} in -*) ;; *) command=${words[i]} break ;; esac done if [[ ! -v command ]]; then _carton_commands "$1" return fi case $prev in --version | -v) return ;; --help | -h) [[ -n $command ]] || _carton_commands "$1" return ;; --cpanfile) if [[ $command == install ]]; then _filedir return fi ;; --path) if [[ $command == install ]]; then _filedir -d return fi ;; --without) if [[ $command == install ]]; then local phases="configure build test runtime develop" COMPREPLY+=($(compgen -W '$phases' -- "$cur")) return fi ;; esac $split && return if [[ $cur == -* ]]; then [[ $command == @(help|usage) ]] || COMPREPLY=(--help) _carton_command_help "$1" $command fi case $command in show | update) : # TODO modules completion ;; esac } && complete -F _carton carton # ex: filetype=sh dmesg 0000644 00000002316 15036124164 0005572 0 ustar 00 _dmesg_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-F'|'--file') local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 ;; '-f'|'--facility') COMPREPLY=( $(compgen -W "kern user mail daemon auth syslog lpr news" -- $cur) ) return 0 ;; '-l'|'--level'|'-n'|'--console-level') COMPREPLY=( $(compgen -W "emerg alert crit err warn notice info debug" -- $cur) ) return 0 ;; '-s'|'--buffer-size') COMPREPLY=( $(compgen -W "size" -- $cur) ) return 0 ;; '--time-format') COMPREPLY=( $(compgen -W "delta reltime ctime notime iso" -- $cur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac OPTS="--clear --read-clear --console-off --show-delta --reltime --console-on --file --facility --human --kernel --color --level --console-level --noescape --nopager --raw --syslog --buffer-size --ctime --notime --time-format --userspace --follow --follow-new --decode --since --until --help --version" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 } complete -F _dmesg_module dmesg chmem 0000644 00000000765 15036124164 0005572 0 ustar 00 _chmem_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS=" --enable --disable --blocks --verbose --zone --help --version " COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac COMPREPLY=( $(compgen -W "size range blockrange" -- $cur) ) return 0 } complete -F _chmem_module chmem pwd 0000644 00000000700 15036124164 0005260 0 ustar 00 # pwd(1) completion -*- shell-script -*- _pwd() { local cur prev words cword _init_completion || return case $prev in --help | --version) return ;; esac COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} ]] || COMPREPLY=($(compgen -W '$(_parse_usage "$1")' -- "$cur")) } && complete -F _pwd pwd # ex: filetype=sh ntpdate 0000644 00000001307 15036124164 0006131 0 ustar 00 # bash completion for ntpdate -*- shell-script -*- _ntpdate() { local cur prev words cword _init_completion || return case $prev in -*k) _filedir return ;; -*U) COMPREPLY=($(compgen -u -- "$cur")) return ;; -*p) COMPREPLY=($(compgen -W '{1..8}' -- "$cur")) return ;; -*[aeot]) return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_usage "$1")' -- "$cur")) else _known_hosts_real -- "$cur" fi } && complete -F _ntpdate ntpdate # ex: filetype=sh kill 0000644 00000001101 15036124164 0005415 0 ustar 00 # kill(1) completion -*- shell-script -*- _kill() { local cur prev words cword _init_completion || return case $prev in -s) _signals return ;; -l) return ;; esac if [[ $cword -eq 1 && $cur == -* ]]; then # return list of available signals _signals - COMPREPLY+=($(compgen -W "-s -l" -- "$cur")) else # return list of available PIDs _pids fi } && complete -F _kill kill # ex: filetype=sh arping 0000644 00000001133 15036124164 0005747 0 ustar 00 # arping(8) completion -*- shell-script -*- _arping() { local cur prev words cword _init_completion || return case $prev in -*c | -*w) return ;; -*I) _available_interfaces -a return ;; -*s) _ip_addresses return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1" -h)' -- "$cur")) return fi _known_hosts_real -- "$cur" } && complete -F _arping arping # ex: filetype=sh lzma 0000644 00000001623 15036124164 0005436 0 ustar 00 # lzma(1) completion -*- shell-script -*- # by Per Øyvind Karlsen <peroyvind@mandriva.org> _lzma() { local cur prev words cword split _init_completion -s || return $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1") -{1..9}' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return fi local IFS=$'\n' xspec="*.@(lzma|tlz)" if [[ $prev == --* ]]; then [[ $prev == --@(decompress|list|test) ]] && xspec="!"$xspec [[ $prev == --compress ]] && xspec= elif [[ $prev == -* ]]; then [[ $prev == -*[dt]* ]] && xspec="!"$xspec [[ $prev == -*z* ]] && xspec= fi _tilde "$cur" || return compopt -o filenames COMPREPLY=($(compgen -f -X "$xspec" -- "$cur") $(compgen -d -- "$cur")) } && complete -F _lzma lzma # ex: filetype=sh msynctool 0000644 00000002501 15036124164 0006516 0 ustar 00 # bash completion for msynctool -*- shell-script -*- _msynctool() { local cur prev words cword _init_completion || return case $words in --configure) COMPREPLY=($(compgen -W "$($1 --showgroup \ $prev | awk '/^Member/ {print $2}' | command sed \ -e 's/:$//')" -- "$cur")) return ;; --addmember) COMPREPLY=($(compgen -W '$($1 --listplugins \ | command sed -e 1d)' -- "$cur")) return ;; esac case $prev in --configure | --addgroup | --delgroup | --showgroup | --sync | --addmember) COMPREPLY=($(compgen -W '$($1 --listgroups \ | command sed -e 1d)' -- "$cur")) return ;; --showformats | --filter-objtype | --slow-sync) COMPREPLY=($(compgen -W '$($1 --listobjects \ | command sed -e 1d)' -- "$cur")) return ;; esac COMPREPLY=($(compgen -W '--listgroups --listplugins --listobjects --showformats --showgroup --sync --filter-objtype --slow-sync --wait --multi --addgroup --delgroup --addmember --configure --manual --configdir --conflict' -- "$cur")) } && complete -F _msynctool msynctool # ex: filetype=sh blkid 0000644 00000004147 15036124164 0005564 0 ustar 00 _blkid_module() { local cur prev OPTS OUTPUT_ALL OUTPUT_ALL='' COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-c'|'--cache-file') local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 ;; '-o'|'--output') COMPREPLY=( $(compgen -W "value device export full" -- $cur) ) return 0 ;; '-s'|'--match-tag') COMPREPLY=( $(compgen -W "tag" -- $cur) ) return 0 ;; '-t'|'--match-token') COMPREPLY=( $(compgen -W "TYPE= LABEL= UUID=" -- $cur) ) return 0 ;; '-L'|'--label') COMPREPLY=( $(compgen -W "$(cd /dev/disk/by-label/ 2>/dev/null && echo *)" -- $cur) ) return 0 ;; '-U'|'--uuid') COMPREPLY=( $(compgen -W "$(cd /dev/disk/by-uuid/ 2>/dev/null && echo *)" -- $cur) ) return 0 ;; '-S'|'--size') COMPREPLY=( $(compgen -W "size" -- $cur) ) return 0 ;; '-O'|'--offset') COMPREPLY=( $(compgen -W "offset" -- $cur) ) return 0 ;; '-u'|'--usages') OUTPUT_ALL={,no}{filesystem,raid,crypto,other} ;; '-n'|'--match-types') OUTPUT_ALL=" $(awk '{print $NF}' /proc/filesystems) $(\ls /lib/modules/$(uname -r)/kernel/fs) " ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac if [ -n "$OUTPUT_ALL" ]; then local prefix realcur OUTPUT_ALL OUTPUT realcur="${cur##*,}" prefix="${cur%$realcur}" for WORD in $OUTPUT_ALL; do if ! [[ $prefix == *"$WORD"* ]]; then OUTPUT="$WORD ${OUTPUT:-""}" fi done compopt -o nospace COMPREPLY=( $(compgen -P "$prefix" -W "$OUTPUT" -S ',' -- "$realcur") ) return 0 fi case $cur in -*) OPTS=" --cache-file --no-encoding --garbage-collect --output --list-filesystems --match-tag --match-token --list-one --label --uuid --probe --info --size --offset --usages --match-types --no-part-details --help --version " COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac compopt -o bashdefault -o default COMPREPLY=( $(compgen -W "$(lsblk -pnro name)" -- $cur) ) return 0 } complete -F _blkid_module blkid fbi 0000644 00000003454 15036124164 0005237 0 ustar 00 # bash completion for fbi(1) -*- shell-script -*- _fbi() { local cur prev words cword _init_completion || return case "$prev" in -l | --list) _filedir return ;; -r | --resolution) COMPREPLY+=($(compgen -W '{1..5}')) return ;; -f | --font) local IFS=$'\n' COMPREPLY=($(compgen -W '$(fc-list 2>/dev/null)' -- "$cur")) return ;; -m | --mode) COMPREPLY=($(compgen -W '$(command sed \ -n "/^mode/{s/^mode \{1,\}\"\([^\"]\{1,\}\)\"/\1/g;p}" \ /etc/fb.modes 2>/dev/null)' -- "$cur")) return ;; -d | --device) COMPREPLY=($(compgen -f -d -- "${cur:-/dev/}")) return ;; --cachemem | --blend | -T | --vt | -s | --scroll | -t | --timeout | -g | --gamma) # argument required but no completions available return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '--help --version --store --list --text --autozoom --{,no}autoup --{,no}autodown --{,no}fitwidth --{,no}verbose --{,no}random --{,no}comments --{,no}edit --{,no}backup --{,no}preserve --{,no}readahead --cachemem --blend --vt --scroll --timeout --{,no}once --resolution --gamma --font --device --mode' -- "$cur")) [[ ${COMPREPLY-} ]] && return fi # FIXME: It is hard to determine correct supported extensions. # fbi can handle any format that imagemagick can plus some others _filedir 'bmp|gif|jp?(e)g|pcd|png|p[pgb]m|tif?(f)|webp|xpm|xwd|?(e)ps|pdf|dvi|txt|svg?(z)|cdr|[ot]tf' } && complete -F _fbi fbi # ex: filetype=sh check_perms 0000644 00000000477 15036124164 0006764 0 ustar 00 # mailman check_perms completion -*- shell-script -*- _check_perms() { local cur prev words cword _init_completion || return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '-f -v -h' -- "$cur")) fi } && complete -F _check_perms check_perms # ex: filetype=sh shellcheck 0000644 00000003200 15036124164 0006571 0 ustar 00 # bash completion for shellcheck(1) -*- shell-script -*- _shellcheck_optarg() { local args=$("$1" --help 2>&1 | command sed -e 's/,/ /g' -ne 's/^.*'$2'\>.*(\([^)]*\)).*/\1/p') COMPREPLY+=($(compgen -W '$args' -- "$cur")) } _shellcheck() { local cur prev words cword split _init_completion -s || return case $prev in --version | -!(-*)V*) return ;; --exclude | --include | -!(-*)[ei]) return ;; --format | -!(-*)f) local args=$("$1" --format=nonexistent-format /dev/null 2>&1 | command sed -ne '/^Supported formats/,//p' | command sed -ne '/^[[:space:]]/p') COMPREPLY=($(compgen -W '$args' -- "$cur")) return ;; --color | -!(-*)C) _shellcheck_optarg "$1" --color return ;; --shell | -!(-*)s) _shellcheck_optarg "$1" --shell return ;; --enable | -!(-*)o) COMPREPLY=($(compgen -W 'all' -- "$cur")) # TODO others? return ;; --source-path | -!(-*)P) _filedir -d COMPREPLY+=($(compgen -W 'SCRIPTDIR' -- "$cur")) return ;; --wiki-link-count | -!(-*)W) return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return fi _filedir } && complete -F _shellcheck shellcheck # ex: filetype=sh eog 0000644 00000001205 15036124164 0005241 0 ustar 00 # eog(1) completion -*- shell-script -*- _eog() { local cur prev words cword split _init_completion -s || return case $prev in -'?' | --help | --help-all | --help-gtk) return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1" --help-all)' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return fi _filedir '@(ani|?(w)bmp|gif|ico|j2[ck]|jp[cefgx2]|jpeg|jpg2|pcx|p[gp]m|pn[gm]|ras|svg?(z)|tga|tif?(f)|x[bp]m)' } && complete -F _eog eog # ex: filetype=sh htop 0000644 00000001447 15036124164 0005451 0 ustar 00 # htop(1) completion -*- shell-script -*- _htop() { local cur prev words cword split _init_completion -s || return case "$prev" in --sort-key | -!(-*)s) COMPREPLY=($(compgen -W '$("$1" -s help)' -- "$cur")) return ;; --user | -!(-*)u) COMPREPLY=($(compgen -u -- "$cur")) return ;; --delay | -!(-*)d) # argument required but no completions available return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1" --help)' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return fi } && complete -F _htop htop # ex: filetype=sh upgradepkg 0000644 00000001443 15036124164 0006624 0 ustar 00 # Slackware Linux upgradepkg completion -*- shell-script -*- _upgradepkg() { local cur prev words cword _init_completion || return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '--dry-run --install-new --reinstall --verbose' -- "$cur")) return fi if [[ $cur == ?*%* ]]; then prev="${cur%%?(\\)%*}" cur="${cur#*%}" local nofiles IFS=$'\n' compopt -o filenames COMPREPLY=($(compgen -P "$prev%" -f -X "!*.@(t[bgxl]z)" -- "$cur")) [[ ${COMPREPLY-} ]] || nofiles=1 COMPREPLY+=($(compgen -P "$prev%" -S '/' -d -- "$cur")) [[ -v nofiles ]] && compopt -o nospace return fi _filedir 't[bglx]z' } && complete -F _upgradepkg upgradepkg # ex: filetype=sh info 0000644 00000003602 15036124164 0005425 0 ustar 00 # bash completion for info -*- shell-script -*- _info() { local cur prev words cword split _init_completion -s || return # default completion if parameter looks like a path if [[ $cur == @(*/|[.~])* ]]; then _filedir return fi case $prev in --apropos | --index-search | --node | --help | --version | -!(-*)[knhv]) return ;; -!(-*)d) if [[ ${1##*/} == info ]]; then _filedir -d return fi ;; --directory) _filedir -d return ;; --dribble | --file | --output | --restore | --raw-filename | --rcfile | -!(-*)[for]) _filedir return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return fi local i infopath=/usr/share/info if [[ ${INFOPATH-} == *: ]]; then infopath=${INFOPATH}${infopath} elif [[ ${INFOPATH:+set} ]]; then infopath=$INFOPATH fi _expand || return infopath=$infopath: if [[ -n $cur ]]; then infopath="${infopath//://$cur* }" else infopath="${infopath//:// }" fi # redirect stderr for when path doesn't exist COMPREPLY=($(eval command ls "$infopath" 2>/dev/null)) # weed out directory path names and paths to info pages COMPREPLY=(${COMPREPLY[@]##*/?(:)}) # weed out info dir file for i in ${!COMPREPLY[*]}; do [[ ${COMPREPLY[i]} == dir ]] && unset "COMPREPLY[i]" done # strip suffix from info pages COMPREPLY=(${COMPREPLY[@]%.@(gz|bz2|xz|lzma)}) COMPREPLY=($(compgen -W '${COMPREPLY[@]%.*}' -- "${cur//\\\\/}")) } && complete -F _info info pinfo # ex: filetype=sh deja-dup 0000644 00000001260 15036124164 0006161 0 ustar 00 # bash completion for deja-dup(1) -*- shell-script -*- _deja_dup() { local cur prev words cword split _init_completion -s || return case $prev in -'?' | --help | --help-*) return ;; --restore) _filedir return ;; --restore-missing) _filedir -d return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1" --help-all)' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return fi } && complete -F _deja_dup deja-dup # ex: filetype=sh make 0000644 00000014050 15036124164 0005406 0 ustar 00 # bash completion for GNU make -*- shell-script -*- _make_target_extract_script() { local mode="$1" shift local prefix="$1" local prefix_pat=$(command sed 's/[][\,.*^$(){}?+|/]/\\&/g' <<<"$prefix") local basename=${prefix##*/} local dirname_len=$((${#prefix} - ${#basename})) if [[ $mode == -d ]]; then # display mode, only output current path component to the next slash local output="\2" else # completion mode, output full path to the next slash local output="\1\2" fi cat <<EOF 1,/^# * Make data base/ d; # skip any makefile output /^# * Finished Make data base/,/^# * Make data base/{ d; # skip any makefile output } /^# * Variables/,/^# * Files/ d; # skip until files section /^# * Not a target/,/^$/ d; # skip not target blocks /^${prefix_pat}/,/^$/! d; # skip anything user dont want # The stuff above here describes lines that are not # explicit targets or not targets other than special ones # The stuff below here decides whether an explicit target # should be output. /^# * File is an intermediate prerequisite/ { s/^.*$//;x; # unhold target d; # delete line } /^$/ { # end of target block x; # unhold target /^$/d; # dont print blanks s|^\(.\{${dirname_len}\}\)\(.\{${#basename}\}[^:/]*/\{0,1\}\)[^:]*:.*$|${output}|p; d; # hide any bugs } # This pattern includes a literal tab character as \t is not a portable # representation and fails with BSD sed /^[^# :%]\{1,\}:/ { # found target block /^\.PHONY:/ d; # special target /^\.SUFFIXES:/ d; # special target /^\.DEFAULT:/ d; # special target /^\.PRECIOUS:/ d; # special target /^\.INTERMEDIATE:/ d; # special target /^\.SECONDARY:/ d; # special target /^\.SECONDEXPANSION:/ d; # special target /^\.DELETE_ON_ERROR:/ d; # special target /^\.IGNORE:/ d; # special target /^\.LOW_RESOLUTION_TIME:/ d; # special target /^\.SILENT:/ d; # special target /^\.EXPORT_ALL_VARIABLES:/ d; # special target /^\.NOTPARALLEL:/ d; # special target /^\.ONESHELL:/ d; # special target /^\.POSIX:/ d; # special target /^\.NOEXPORT:/ d; # special target /^\.MAKE:/ d; # special target EOF # don't complete with hidden targets unless we are doing a partial completion if [[ -z ${prefix_pat} || ${prefix_pat} == */ ]]; then cat <<EOF /^${prefix_pat}[^a-zA-Z0-9]/d; # convention for hidden tgt EOF fi cat <<EOF h; # hold target d; # delete line } EOF } _make() { local cur prev words cword split _init_completion -s || return local makef makef_dir=("-C" ".") i case $prev in --file | --makefile | --old-file | --assume-old | --what-if | --new-file | \ --assume-new | -!(-*)[foW]) _filedir return ;; --include-dir | --directory | -!(-*)[ICm]) _filedir -d return ;; -!(-*)E) COMPREPLY=($(compgen -v -- "$cur")) return ;; --eval | -!(-*)[DVx]) return ;; --jobs | -!(-*)j) COMPREPLY=($(compgen -W "{1..$(($(_ncpus) * 2))}" -- "$cur")) return ;; esac $split && return if [[ $cur == -* ]]; then local opts="$(_parse_help "$1")" COMPREPLY=($(compgen -W '${opts:-$(_parse_usage "$1")}' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace elif [[ $cur == *=* ]]; then prev=${cur%%=*} cur=${cur#*=} local diropt [[ ${prev,,} == *dir?(ectory) ]] && diropt=-d _filedir $diropt else # before we check for makefiles, see if a path was specified # with -C/--directory for ((i = 1; i < ${#words[@]}; i++)); do if [[ ${words[i]} == -@(C|-directory) ]]; then # eval for tilde expansion eval "makef_dir=( -C \"${words[i + 1]}\" )" break fi done # before we scan for targets, see if a Makefile name was # specified with -f/--file/--makefile for ((i = 1; i < ${#words[@]}; i++)); do if [[ ${words[i]} == -@(f|-?(make)file) ]]; then # eval for tilde expansion eval "makef=( -f \"${words[i + 1]}\" )" break fi done # recognise that possible completions are only going to be displayed # so only the base name is shown local mode=-- if ((COMP_TYPE != 9)); then mode=-d # display-only mode fi local IFS=$' \t\n' script=$(_make_target_extract_script $mode "$cur") COMPREPLY=($(LC_ALL=C \ $1 -npq __BASH_MAKE_COMPLETION__=1 \ ${makef+"${makef[@]}"} "${makef_dir[@]}" .DEFAULT 2>/dev/null | command sed -ne "$script")) if [[ $mode != -d ]]; then # Completion will occur if there is only one suggestion # so set options for completion based on the first one [[ ${COMPREPLY-} == */ ]] && compopt -o nospace fi fi } && complete -F _make make gmake gnumake pmake colormake bmake # ex: filetype=sh fallocate 0000644 00000001321 15036124164 0006420 0 ustar 00 _fallocate_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-o'|'--offset'|'-l'|'--length') COMPREPLY=( $(compgen -W "bytes" -- $cur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS=" --collapse-range --dig-holes --insert-range --length --keep-size --offset --punch-hole --zero-range --posix --verbose --help --version " COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 } complete -F _fallocate_module fallocate mutt 0000644 00000010545 15036124164 0005467 0 ustar 00 # mutt completion -*- shell-script -*- # # Mutt doesn't have an "addressbook" like Pine, but it has aliases and # a "query" function to retrieve addresses, so that's what we use here. # @param $1 (cur) Current word to complete _muttaddr() { _muttaliases "$1" _muttquery "$1" COMPREPLY+=($(compgen -u -- "$1")) } # Find muttrc to use # @output muttrc filename _muttrc() { # Search COMP_WORDS for '-F muttrc' or '-Fmuttrc' argument set -- "${words[@]}" while (($# > 0)); do if [[ $1 == -F* ]]; then if ((${#1} > 2)); then muttrc="$(dequote "${1:2}")" else shift [[ $1 ]] && muttrc="$(dequote "$1")" fi break fi shift done if [[ ! -v muttrc ]]; then if [[ -f ~/.${muttcmd}rc ]]; then muttrc=\~/.${muttcmd}rc elif [[ -f ~/.${muttcmd}/${muttcmd}rc ]]; then muttrc=\~/.${muttcmd}/${muttcmd}rc fi fi printf "%s" "${muttrc-}" } # Recursively build list of sourced config files # @param $1 List of config files found so far # @param $2 Config file to process # @output List of config files _muttconffiles() { local file sofar local -a newconffiles sofar=" $1 " shift while [[ ${1-} ]]; do newconffiles=($(command sed -n 's|^source[[:space:]]\{1,\}\([^[:space:]]\{1,\}\).*$|\1|p' "$(eval printf %s $1)")) for file in ${newconffiles+"${newconffiles[@]}"}; do __expand_tilde_by_ref file [[ ! -f $file || $sofar == *\ $file\ * ]] && continue sofar+=" $file" sofar=" $(eval _muttconffiles \"$sofar\" $file) " done shift done printf '%s\n' $sofar } # @param $1 (cur) Current word to complete _muttaliases() { local cur=$1 muttrc muttcmd=${words[0]} local -a conffiles aliases muttrc=$(_muttrc) [[ -z $muttrc ]] && return conffiles=($(eval _muttconffiles $muttrc $muttrc)) # shellcheck disable=SC2046 aliases=("$(command sed -n 's|^alias[[:space:]]\{1,\}\([^[:space:]]\{1,\}\).*$|\1|p' \ $(eval echo "${conffiles[@]}"))") COMPREPLY+=($(compgen -W "${aliases[*]}" -- "$cur")) } # @param $1 (cur) Current word to complete _muttquery() { local cur=$1 querycmd muttcmd=${words[0]} local -a queryresults querycmd="$($muttcmd -Q query_command 2>/dev/null | command sed -e 's|^query_command=\"\(.*\)\"$|\1|' -e 's|%s|'$cur'|')" if [[ -z $cur || -z $querycmd ]]; then queryresults=() else __expand_tilde_by_ref querycmd queryresults=($($querycmd | command sed -n '2,$s|^\([^[:space:]]\{1,\}\).*|\1|p')) fi COMPREPLY+=($(compgen -W "${queryresults[*]}" -- "$cur")) } # @param $1 (cur) Current word to complete _muttfiledir() { local cur=$1 folder muttrc spoolfile muttcmd=${words[0]} muttrc=$(_muttrc) if [[ $cur == [=+]* ]]; then folder="$($muttcmd -F "$muttrc" -Q folder 2>/dev/null | command sed -e 's|^folder=\"\(.*\)\"$|\1|')" : folder:=~/Mail # Match any file in $folder beginning with $cur # (minus the leading '=' sign). compopt -o filenames COMPREPLY=($(compgen -f -- "$folder/${cur:1}")) COMPREPLY=(${COMPREPLY[@]#$folder/}) return elif [[ $cur == !* ]]; then spoolfile="$($muttcmd -F "$muttrc" -Q spoolfile 2>/dev/null | command sed -e 's|^spoolfile=\"\(.*\)\"$|\1|')" [[ -n $spoolfile ]] && eval cur="${cur/^!/$spoolfile}" fi _filedir } _mutt() { local cur prev words cword _init_completion -n =+! || return case $cur in -*) COMPREPLY=($(compgen -W '-A -a -b -c -e -f -F -H -i -m -n -p -Q -R -s -v -x -y -z -Z -h' -- "$cur")) return ;; *) case $prev in -*[afFHi]) _muttfiledir "$cur" return ;; -*A) _muttaliases "$cur" return ;; -*[emQshpRvyzZ]) return ;; *) _muttaddr "$cur" return ;; esac ;; esac } && complete -F _mutt -o default mutt muttng # ex: filetype=sh ssh-add 0000644 00000001245 15036124164 0006016 0 ustar 00 # ssh-add(1) completion -*- shell-script -*- _ssh_add() { local cur prev words cword _init_completion || return case $prev in -*E) COMPREPLY=($(compgen -W 'md5 sha256' -- "$cur")) return ;; -*t) return ;; -*T) _filedir return ;; -*[se]) _filedir so return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1" "-\?")' -- "$cur")) return fi _filedir } && complete -F _ssh_add ssh-add # ex: filetype=sh sqlite3 0000644 00000001606 15036124164 0006060 0 ustar 00 # sqlite3(1) completion -*- shell-script -*- _sqlite3() { local cur prev words cword _init_completion || return local dbexts='@(sqlite?(3)|?(s?(3))db)' case $prev in -help | -version | -lookaside | -mmap | -newline | -nullvalue | -pagecache | \ -scratch | -separator | *.$dbexts) return ;; -init) _filedir return ;; -cmd) compopt -o filenames COMPREPLY=($(compgen -c -- "$cur")) return ;; esac [[ $cword -gt 2 && ${words[cword - 2]} == -@(lookaside|pagecache|scratch) ]] && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1" -help)' -- "$cur")) return fi _filedir "$dbexts" } && complete -F _sqlite3 sqlite3 # ex: filetype=sh resizepart 0000644 00000001135 15036124164 0006661 0 ustar 00 _resizepart_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $COMP_CWORD in 1) OPTS="--help --version $(lsblk -pnro name)" compopt -o bashdefault -o default COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) ;; 2) prev="${COMP_WORDS[COMP_CWORD-1]}" COMPREPLY=( $(compgen -W "$(cat /sys/block/${prev##*/}/*/partition 2>/dev/null)" -- $cur) ) ;; 3) COMPREPLY="length" ;; esac return 0 } complete -F _resizepart_module resizepart list_owners 0000644 00000000633 15036124164 0007043 0 ustar 00 # mailman list_owners completion -*- shell-script -*- _list_owners() { local cur prev words cword _init_completion || return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '--with-listnames --moderators --help' \ -- "$cur")) else _xfunc list_lists _mailman_lists fi } && complete -F _list_owners list_owners # ex: filetype=sh koji 0000644 00000014322 15036124164 0005427 0 ustar 00 # koji completion -*- shell-script -*- _koji_search() { COMPREPLY+=($(compgen -W \ '$("$1" -q search $2 "$cur*" 2>/dev/null)' -- "$cur")) } _koji_build() { _koji_search "$1" build } _koji_package() { _koji_search "$1" package } _koji_user() { _koji_search "$1" user } _koji_tag() { COMPREPLY+=($(compgen -W '$("$1" -q list-tags 2>/dev/null)' -- "$cur")) } _koji_target() { COMPREPLY+=($(compgen -W '$("$1" -q list-targets 2>/dev/null | awk "{ print \$1 }")' -- "$cur")) } _koji() { local cur prev words cword split _init_completion -s || return local commandix command for ((commandix = 1; commandix < cword; commandix++)); do if [[ ${words[commandix]} != -* ]]; then command=${words[commandix]} break fi done case $prev in --help | --help-commands | -!(-*)h*) return ;; --config | --keytab | -!(-*)[co]) _filedir return ;; --runas | --user | --editor | --by) _koji_user "$1" return ;; --authtype) COMPREPLY=($(compgen -W 'noauth ssl password kerberos' -- "$cur")) return ;; --topdir) _filedir -d return ;; --type) case ${command-} in latest-pkg | list-tagged) COMPREPLY=($(compgen -W 'maven' -- "$cur")) ;; esac return ;; --name) case ${command-} in list-targets) _koji_target "$1" ;; esac return ;; --owner) _koji_user "$1" return ;; --tag | --latestfrom) _koji_tag "$1" return ;; --package) _koji_package "$1" return ;; --build) _koji_build "$1" return ;; --build-target) _koji_target "$1" return ;; esac $split && return if [[ -v command ]]; then if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W \ '$(_parse_help "$1" "$command --help")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return fi # How many'th non-option arg (1-based) for $command are we completing? local i nth=1 for ((i = commandix + 1; i < cword; i++)); do [[ ${words[i]} == -* ]] || ((nth++)) done case $command in build | maven-build | win-build) case $nth in 1) _koji_target "$1" ;; 2) _filedir src.rpm ;; esac ;; cancel) _koji_build "$1" ;; chain-build) case $nth in 1) _koji_target "$1" ;; esac ;; download-build) case $nth in 1) _koji_build "$1" ;; esac ;; import-comps) case $nth in 1) _filedir xml ;; 2) _koji_tag "$1" ;; esac ;; latest-by-tag) _koji_package "$1" ;; latest-pkg | list-groups | list-tag-inheritance | show-groups) case $nth in 1) _koji_tag "$1" ;; esac ;; list-tagged) case $nth in 1) _koji_tag "$1" ;; 2) _koji_package "$1" ;; esac ;; list-untagged) case $nth in 1) _koji_package "$1" ;; esac ;; move-pkg) case $nth in 1 | 2) _koji_tag "$1" ;; *) _koji_package "$1" ;; esac ;; search) case $nth in 1) COMPREPLY=($(compgen -W 'package build tag target user host rpm' -- "$cur")) ;; esac ;; tag-pkg | untag-pkg) case $nth in 1) _koji_tag "$1" ;; *) _koji_package "$1" ;; esac ;; taginfo) _koji_tag "$1" ;; wait-repo) case $nth in 1) for ((i = commandix + 1; i < cword; i++)); do if [[ ${words[i]} == --target ]]; then _koji_target "$1" return fi done _koji_tag "$1" ;; esac ;; esac return fi if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace elif [[ ! -v command ]]; then COMPREPLY=($(compgen -W '$("$1" --help-commands 2>/dev/null | \ awk "/^( +|\t)/ { print \$1 }")' -- "$cur")) fi } && complete -F _koji koji arm-koji ppc-koji s390-koji sparc-koji # ex: filetype=sh pngfix 0000644 00000001456 15036124164 0005772 0 ustar 00 # pngfix completion -*- shell-script -*- _pngfix() { local cur prev words cword split _init_completion -s || return case $prev in --suffix | --prefix) return ;; --output) _filedir return ;; --strip) COMPREPLY=($(IFS='|' compgen -W '$("$1" --help 2>&1 | command sed -ne "s/.*--strip=\[\([^]]*\)\].*/\1/p")' \ -- "$cur")) return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return fi _filedir png } && complete -F _pngfix pngfix # ex: filetype=sh lilo 0000644 00000003125 15036124164 0005431 0 ustar 00 # bash completion for lilo(8) -*- shell-script -*- _lilo_labels() { COMPREPLY=($(compgen -W "$(awk -F= '$1 ~ /^[ \t]*label$/ {print $2}' \ ${1:-/etc/lilo.conf} 2>/dev/null | command sed -e 's/\"//g')" \ -- "$cur")) } _lilo() { local cur prev words cword _init_completion || return case $prev in -C | -i | -m | -s | -S) _filedir return ;; -r) _filedir -d return ;; -I | -D | -R) # label completion local i conf for i in "${!words[@]}"; do if [[ ${words[i]} == -C ]]; then conf=${words[i + 1]} break fi done _lilo_labels $conf return ;; -A | -b | -M | -u | -U) # device completion cur=${cur:=/dev/} _filedir return ;; -T) # topic completion COMPREPLY=($(compgen -W 'help ChRul EBDA geom geom= table= video' -- "$cur")) return ;; -B) _filedir bmp return ;; -E) _filedir '@(bmp|dat)' return ;; esac if [[ $cur == -* ]]; then # relevant options completion COMPREPLY=($(compgen -W '-A -B -b -c -C -d -E -f -g -i -I -l -L -m -M -p -P -q -r -R -s -S -t -T -u -U -v -V -w -x -z' -- "$cur")) fi } && complete -F _lilo lilo # ex: filetype=sh gio 0000644 00000007366 15036124164 0005263 0 ustar 00 # # Copyright (C) 2018 Red Hat, Inc. # # This library is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as # published by the Free Software Foundation; either version 2.1 of the # licence, or (at your option) any later version. # # This is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public # License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with this library; if not, see <http://www.gnu.org/licenses/>. # # Check for bash [ -z "$BASH_VERSION" ] && return #################################################################################################### # Check whether the suggestions have common prefix (i.e. suggestions won't be # shown and prefix will be completed first) __gio_has_common_prefix() { local i for (( i = 1; i < ${#COMPREPLY[@]}; i++ )); do if [[ "${COMPREPLY[i-1]:${#cur}:1}" != "${COMPREPLY[i]:${#cur}:1}" ]]; then return 1 # False fi done return 0 # True } # Complete file location __gio_location() { # Prevent breaking on colons, we have to work with uris local cur _get_comp_words_by_ref -n : cur # Resolve dirname for dir listing local dir="" if [[ $cur =~ "/"$ ]]; then dir="$cur" elif [[ $cur =~ "/" ]]; then # Subtract basename because dirname cmd doesn't work well with schemes dir=${cur%$(basename "$cur")} fi # List volumes and mounts local mounts=( ) local mount while IFS=$'\n' read mount; do # Do not care about local mounts [[ "$mount" =~ ^"file:" ]] && continue # Use only matching mounts [[ "$mount" =~ ^"$cur" && "$mount" != "$cur" ]] && mounts+=("$mount") done < <(gio mount -li | sed -n -r 's/^ *(default_location|activation_root)=(.*)$/\2/p' | sort -u) # Workaround to unescape dir name (e.g. "\ " -> " ") local -a tmp="( ${dir} )" local unescaped_dir="${tmp[0]}" # List files local files=() local names=() local name size type while IFS=$'\t' read name size type; do # Escape name properly local escaped_name="$(printf "%q" "$name")" # Append slash for directories and space for files if [[ "$type" == "(directory)" ]]; then escaped_name="$escaped_name/" else escaped_name="$escaped_name " fi local path="$dir$escaped_name" # Use only matching paths if [[ "$path" =~ ^"$cur" ]]; then files+=("$path") names+=("$escaped_name") fi done < <(gio list -hl "$unescaped_dir" 2> /dev/null) COMPREPLY=("${files[@]}" "${mounts[@]}") # Workaround to show suggestions as basenames only if ! __gio_has_common_prefix; then COMPREPLY=("${mounts[@]} ${names[@]}") # Workaround to prevent overwriting suggestions, it adds empty # suggestion, otherwise names with colons will be corrupted COMPREPLY+=(" ") return 0 fi # Workaround to complete names with colons, it removes colon prefix from # COMPREPLY __ltrim_colon_completions "$cur" } __gio() { # Complete subcommands if (( ${COMP_CWORD} == 1 )); then COMPREPLY=($(compgen -W "help version cat copy info launch list mime mkdir monitor mount move open rename remove save set trash tree" -- "${COMP_WORDS[1]}")) compopt +o nospace return 0 fi # Complete file locations __gio_location } #################################################################################################### complete -o nospace -F __gio gio mkinitrd 0000644 00000002310 15036124164 0006306 0 ustar 00 # bash completion for mkinitrd -*- shell-script -*- _mkinitrd() { local cur prev words cword split _init_completion -s || return case $prev in --preload | --with | --builtin) _modules return ;; --fstab | --dsdt) _filedir return ;; --net-dev) _available_interfaces return ;; esac $split && return 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")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace else local args _count_args case $args in 1) _filedir ;; 2) _kernel_versions ;; esac fi } && complete -F _mkinitrd mkinitrd # ex: filetype=sh scriptreplay 0000644 00000001625 15036124164 0007216 0 ustar 00 _scriptreplay_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-c'|'--cr-mode') COMPREPLY=( $(compgen -W "auto never always" -- $cur) ) return 0 ;; '-d'|'--divisor'|'-m'|'--maxdelay') COMPREPLY=( $(compgen -W "digit" -- $cur) ) return 0 ;; '-x'|'--stream') COMPREPLY=( $(compgen -W "out in signal info" -- $cur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS="--timing --log-in --log-out --log-io --log-timing --summary --stream --cr-mode --typescript --divisor --maxdelay --version --help" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 } complete -F _scriptreplay_module scriptreplay makepkg 0000644 00000002026 15036124164 0006110 0 ustar 00 # makepkg completion -*- shell-script -*- # Slackware Linux variant _makepkg_slackware() { local cur prev words cword _init_completion || return case "$prev" in -l | --linkadd | -c | --chown) COMPREPLY=($(compgen -W 'y n' -- "$cur")) return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W \ '$($1 | command sed -e "s/^options://" | _parse_help -)' \ -- "$cur")) return fi _filedir } _makepkg_bootstrap() { local fname help # Use --help to detect variant; the Slackware one starts making # a package for unknown args, including --version :P help=$("$1" --help 2>&1) case ${help,,} in *slackware*) fname=_makepkg_slackware ;; *) fname=_minimal ;; esac unset -f _makepkg_bootstrap complete -F $fname makepkg $fname } && complete -F _makepkg_bootstrap makepkg # ex: filetype=sh munin-node-configure 0000644 00000001360 15036124164 0010521 0 ustar 00 # munin-node-configure completion -*- shell-script -*- _munin_node_configure() { local cur prev words cword _init_completion || return case $prev in --config) _filedir return ;; --servicedir | --libdir) _filedir -d return ;; --snmp) _known_hosts_real -- "$cur" return ;; --snmpversion) COMPREPLY=($(compgen -W '1 2c 3' -- "$cur")) return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) fi } && complete -F _munin_node_configure munin-node-configure # ex: filetype=sh aspell 0000644 00000006453 15036124164 0005761 0 ustar 00 # bash completion for aspell -*- shell-script -*- _aspell_dictionary() { local datadir aspell=${1:-aspell} datadir=$($aspell config data-dir 2>/dev/null || echo /usr/lib/aspell) # First, get aliases (dicts dump does not list them) COMPREPLY=($(printf '%s\n' $datadir/*.alias)) COMPREPLY=("${COMPREPLY[@]%.alias}") COMPREPLY=("${COMPREPLY[@]#$datadir/}") # Then, add the canonical dicts COMPREPLY+=($($aspell dicts 2>/dev/null)) COMPREPLY=($(compgen -X '\*' -W '${COMPREPLY[@]}' -- "$cur")) } _aspell() { local cur prev words cword split _init_completion -s || return case $prev in -c | -p | check | --conf | --personal | --repl | --per-conf) _filedir return ;; --conf-dir | --data-dir | --dict-dir | --home-dir | --local-data-dir | --prefix) _filedir -d return ;; dump | create | merge) COMPREPLY=($(compgen -W 'master personal repl' -- "$cur")) return ;; --mode) COMPREPLY=($(compgen -W "$($1 modes 2>/dev/null | awk '{ print $1 }')" -- "$cur")) return ;; --sug-mode) COMPREPLY=($(compgen -W 'ultra fast normal bad-speller' \ -- "$cur")) return ;; --keymapping) COMPREPLY=($(compgen -W 'aspell ispell' -- "$cur")) return ;; -d | --master) _aspell_dictionary "$1" return ;; --add-filter | --rem-filter) COMPREPLY=($(compgen -W "$($1 filters 2>/dev/null | awk '{ print $1 }')" -- "$cur")) return ;; esac $split && return 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")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace else COMPREPLY=($(compgen -W 'usage help check pipe list config soundslike filter version dump create merge' -- "$cur")) fi } && complete -F _aspell aspell # ex: filetype=sh dd 0000644 00000002374 15036124164 0005066 0 ustar 00 # bash completion for dd -*- shell-script -*- _dd() { local cur prev words cword _init_completion -n = || return case $cur in if=* | of=*) cur=${cur#*=} _filedir return ;; conv=*) cur=${cur#*=} COMPREPLY=($(compgen -W 'ascii ebcdic ibm block unblock lcase ucase sparse swab sync excl nocreat notrunc noerror fdatasync fsync' -- "$cur")) return ;; iflag=* | oflag=*) cur=${cur#*=} COMPREPLY=($(compgen -W 'append direct directory dsync sync fullblock nonblock noatime nocache noctty nofollow count_bytes skip_bytes seek_bytes' -- "$cur")) return ;; status=*) cur=${cur#*=} COMPREPLY=($(compgen -W 'none noxfer progress' -- "$cur")) return ;; esac COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur") $(compgen -W 'bs cbs conv count ibs if iflag obs of oflag seek skip status' -S '=' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace } && complete -F _dd dd # ex: filetype=sh nethogs 0000644 00000001054 15036124164 0006140 0 ustar 00 # bash completion for nethogs(8) -*- shell-script -*- _nethogs() { local cur prev words cword _init_completion || return case "$prev" in -d) # expect integer value COMPREPLY+=($(compgen -W '{0..9}')) compopt -o nospace return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_usage "$1" -h)' -- "$cur")) return fi _available_interfaces -a } && complete -F _nethogs nethogs # ex: filetype=sh nsenter 0000644 00000002237 15036124164 0006153 0 ustar 00 _nsenter_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-S'|'--uid') COMPREPLY=( $(compgen -W "uid" -- $cur) ) return 0 ;; '-G'|'--gid') COMPREPLY=( $(compgen -W "gid" -- $cur) ) return 0 ;; '-t'|'--target') local PIDS PIDS=$(cd /proc && echo [0-9]*) COMPREPLY=( $(compgen -W "$PIDS" -- $cur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in '=') # FIXME: --root and --wd should use get only # directories as compgen output. If $cur is # overwrote the same way as below in case segment # for $prev the command-line will get mangled. cur=${cur#=} ;; -*) OPTS=" --all --target --mount= --uts= --ipc= --net= --pid= --cgroup= --user= --time= --setuid --setgid --preserve-credentials --root= --wd= --no-fork --help --version " COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 } complete -F _nsenter_module nsenter mkfs.cramfs 0000644 00000001507 15036124164 0006706 0 ustar 00 _mkfs.cramfs_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-b') COMPREPLY=( $(compgen -W "blksize" -- $cur) ) return 0 ;; '-e') COMPREPLY=( $(compgen -W "edition" -- $cur) ) return 0 ;; '-N') COMPREPLY=( $(compgen -W "big little host" -- $cur) ) return 0 ;; '-i') COMPREPLY=( $(compgen -f -- $cur) ) return 0 ;; '-n') COMPREPLY=( $(compgen -W "name" -- $cur) ) return 0 ;; '-h'|'-V') return 0 ;; esac case $cur in -*) OPTS="-h -v -E -b -e -N -i -n -p -s -z" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac compopt -o bashdefault -o default COMPREPLY=( $(compgen -W "$(lsblk -pnro name)" -- $cur) ) return 0 } complete -F _mkfs.cramfs_module mkfs.cramfs colrm 0000644 00000000775 15036124164 0005616 0 ustar 00 _colrm_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS="--version --help" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac case $COMP_CWORD in 1) COMPREPLY=( $(compgen -W "startcol" -- $cur) ) ;; 2) COMPREPLY=( $(compgen -W "endcol" -- $cur) ) ;; esac return 0 } complete -F _colrm_module colrm munin-run 0000644 00000001205 15036124164 0006417 0 ustar 00 # munin-run completion -*- shell-script -*- _munin_run() { local cur prev words cword _init_completion || return case $prev in --config | --sconffile) _filedir return ;; --servicedir | --sconfdir) _filedir -d return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) else COMPREPLY=($(compgen -W \ '$(command ls /etc/munin/plugins 2>/dev/null)' -- "$cur")) fi } && complete -F _munin_run munin-run # ex: filetype=sh wodim 0000644 00000006776 15036124164 0005630 0 ustar 00 # bash completion for cdrecord/wodim -*- shell-script -*- _cdrecord() { local cur prev words cword _init_completion -n = || return local generic_options track_options track_mode # foo=bar style option if [[ $cur == *=* ]]; then prev=${cur%%=*} cur=${cur#*=} case $prev in textfile | cuefile | msifile) _filedir ;; blank) COMPREPLY=($(compgen -W 'help all fast track unreserve trtail unclose session' -- "$cur")) ;; driveropts) if [[ $cur == *=* ]]; then prev=${cur%%=*} cur=${cur#*=} case $prev in varirec) COMPREPLY=($(compgen -W "-2 -1 0 1 2" -- "$cur")) ;; gigarec) COMPREPLY=($(compgen -W "0.6 0.7 0.8 1.0 1.2 1.3 1.4" -- "$cur")) ;; tattoofile) _filedir ;; esac else COMPREPLY=($(compgen -W 'burnfree noburnfree varirec= gigarec= audiomaster forcespeed noforcespeed speedread nospeedread singlesession nosinglesession hidecdr nohidecdr tattooinfo tattoofile=' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace fi ;; driver) COMPREPLY=($(compgen -W "$($1 driver=help 2>&1 | awk 'NR > 1 { print $1 }') help" -- "$cur")) ;; minbuf) COMPREPLY=($(compgen -W '{25..95}' -- "$cur")) ;; esac return fi generic_options=(-version -v -V -d -silent -force -immed -dummy -clone -dao -sao -tao -raw -raw96r -raw96p -raw16 -multi -msinfo -toc -atip -fix -nofix -waiti -load -lock -eject -format -setdropts -checkdrive -prcap -inq -scanbus --devices -reset -abort -overburn -ignsize -useinfo -packet -noclose -text "debug=" "kdebug=" "minbuf=" "msifile=" "speed=" "blank=" "fs=" "ts=" "dev=" "gracetime=" "timeout=" "driver=" "driveropts=" "defpregap=" "pktsize=" "mcn=" "textfile=" "cuefile=") track_options=(-audio -swab -data -mode2 -xa -xa1 -xa2 -xamix -cdi -isosize -pad -nopad -shorttrack -noshorttrack -preemp -nopreemp -copy -nocopy -scms "isrc=" "index=" "padsize=" "pregap=" "tsize=") # look if previous was either a file or a track option track_mode=0 if ((cword > 1)); then if [[ -f $prev ]]; then track_mode=1 else local opt for opt in "${track_options[@]}"; do if [[ $opt == "$prev" ]]; then track_mode=1 break fi done fi fi # files are always eligible completion _filedir # track options are always available COMPREPLY+=($(compgen -W '${track_options[@]}' -- "$cur")) # general options are no more available after file or track option if ((track_mode == 0)); then COMPREPLY+=($(compgen -W '${generic_options[@]}' -- "$cur")) fi [[ ${COMPREPLY-} == *= ]] && compopt -o nospace } && complete -F _cdrecord cdrecord wodim # ex: filetype=sh btrfs 0000644 00000006626 15036124164 0005623 0 ustar 00 # original by Alfredo Esteban <aedelatorre at xxxxxxxxx> # (http://www.spinics.net/lists/linux-btrfs/msg15899.html) # edited by Joseph Wang <joequant at gmail.com> # (http://lists.alioth.debian.org/pipermail/bash-completion-devel/2013-June/004868.html) # edited by John C F <john.ch.fr at gmail.com> on 2015-02-02 _btrfs_mnts() { local MNTS MNTS='' while read mnt; do MNTS+="$mnt " done < <(mount -t btrfs | awk '{print $3}') COMPREPLY+=( $( compgen -W "$MNTS" -- "$cur" ) ) } _btrfs() { local cur prev words cword _init_completion || return COMPREPLY=() local cmd=${words[1]} commands='subvolume filesystem balance device scrub check rescue restore inspect-internal property send receive quota qgroup replace help version' commands_subvolume='create delete list snapshot find-new get-default set-default show sync' commands_filesystem='defragment sync resize show df du label usage' commands_balance='start pause cancel resume status' commands_device='scan add delete remove ready stats usage' commands_scrub='start cancel resume status' commands_rescue='chunk-recover super-recover zero-log create-control-device' commands_inspect_internal='inode-resolve logical-resolve subvolid-resolve rootid min-dev-size dump-tree dump-super tree-stats' commands_property='get set list' commands_quota='enable disable rescan' commands_qgroup='assign remove create destroy show limit' commands_replace='start status cancel' if [[ "$cur" == -* && $cword -le 3 && "$cmd" != "help" ]]; then COMPREPLY=( $( compgen -W '--help' -- "$cur" ) ) return 0 fi if [[ $cword -eq 1 ]]; then COMPREPLY=( $( compgen -W "$commands" -- "$cur" ) ) return 0 elif [[ $cword -eq 2 ]]; then case $cmd in subvolume) opts="$commands_subvolume" ;; filesystem) opts="$commands_filesystem" ;; balance) opts="$commands_balance" ;; device) opts="$commands_device" ;; scrub) opts="$commands_scrub" ;; check) _filedir return 0 ;; rescue) opts="$commands_rescue" ;; restore) _filedir return 0 ;; inspect-internal) opts="$commands_inspect_internal" ;; property) opts="$commands_property" ;; send|receive) _filedir -d return 0 ;; quota) opts="$commands_quota" ;; qgroup) opts="$commands_qgroup" ;; replace) opts="$commands_replace" ;; help) opts="--full" ;; version) return 0 ;; esac COMPREPLY=( $( compgen -W "$opts" -- "$cur" ) ) return 0 elif [[ $cword -eq 3 ]]; then case $cmd in filesystem) case $prev in defragment) _filedir return 0 ;; df|usage) _btrfs_mnts return 0 ;; label) _btrfs_mnts _filedir return 0 ;; esac ;; device|rescue) _filedir return 0 ;; inspect-internal) case $prev in min-dev-size) _btrfs_mnts return 0 ;; dump-tree|dump-super|rootid|inode-resolve) _filedir return 0 ;; esac ;; receive) case $prev in -f) _filedir return 0 ;; esac ;; replace) case $prev in status|cancel) _btrfs_mnts return 0 ;; start) _filedir return 0 ;; esac ;; subvolume) case $prev in list) _btrfs_mnts return 0 ;; esac ;; esac fi _filedir -d return 0 } complete -F _btrfs btrfs lslogins 0000644 00000003327 15036124164 0006330 0 ustar 00 _lslogins_module() { local cur prev OPTS LSLOGINS_COLS_ALL COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" LSLOGINS_COLS_ALL=" USER UID GECOS HOMEDIR SHELL NOLOGIN PWD-LOCK PWD-EMPTY PWD-DENY GROUP GID SUPP-GROUPS SUPP-GIDS LAST-LOGIN LAST-TTY LAST-HOSTNAME FAILED-LOGIN FAILED-TTY HUSHED PWD-WARN PWD-CHANGE PWD-MIN PWD-MAX PWD-EXPIR CONTEXT PROC " case $prev in '-g'|'--groups') COMPREPLY=( $(compgen -W "$(getent group | awk -F: '{print $1}')" -- $cur) ) return 0 ;; '-l'|'--logins') COMPREPLY=( $(compgen -W "$(getent passwd | awk -F: '{print $1}')" -- $cur) ) return 0 ;; '--time-format') COMPREPLY=( $(compgen -W "short full iso" -- $cur) ) return 0 ;; '--wtmp-file'|'--btmp-file'|'--lastlog') local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 ;; '-o'|'--output') local prefix realcur LSLOGINS_COLS realcur="${cur##*,}" prefix="${cur%$realcur}" for WORD in $LSLOGINS_COLS_ALL; do if ! [[ $prefix == *"$WORD"* ]]; then LSLOGINS_COLS="$WORD ${LSLOGINS_COLS:-""}" fi done compopt -o nospace COMPREPLY=( $(compgen -P "$prefix" -W "$LSLOGINS_COLS" -S ',' -- $realcur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac COMPREPLY=( $(compgen -W " --acc-expiration --colon-separate --export --failed --supp-groups --groups --last --logins --newline --noheadings --notruncate --output --output-all --pwd --raw --system-accs --time-format --user-accs --context --print0 --wtmp-file --btmp-file --lastlog --help --version " -- $cur) ) return 0 } complete -F _lslogins_module lslogins file-roller 0000644 00000002126 15036124164 0006706 0 ustar 00 # file-roller(1) completion -*- shell-script -*- _file_roller() { local cur prev words cword split _init_completion -s || return local exts='@(7z|ace|alz|ar|arj|[bglx]z|bz2|tb?(z)2|cab|cb[rz]|iso?(9660)|Z|t[abglx]z|cpio|deb|rar|?(g)tar|gem|lh[az]|lz[4h]|?(t)lrz|lzma|lzo|wim|swm|rpm|sit|zoo)' case $prev in --help | --help-all | --help-gtk | --help-sm-client | -!(-*)'?') return ;; --sm-client-state-file) _filedir return ;; --add-to | -!(-*)a) _filedir_xspec unzip _filedir "$exts" return ;; --extract-to | --default-dir | -!(-*)e) _filedir -d return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1" --help-all)' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return fi _filedir_xspec unzip _filedir "$exts" } && complete -F _file_roller file-roller # ex: filetype=sh geoiplookup 0000644 00000001253 15036124164 0007027 0 ustar 00 # geoiplookup(1) completion -*- shell-script -*- _geoiplookup() { local cur prev words cword _init_completion || return case $prev in -h | -'?' | -v) return ;; -d) _filedir -d return ;; -f) _filedir dat return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_usage "$1" -h)' -- "$cur")) return fi local ipvx [[ $1 == *6 ]] && ipvx=-6 || ipvx=-4 _known_hosts_real $ipvx -- "$cur" } && complete -F _geoiplookup geoiplookup geoiplookup6 # ex: filetype=sh vipw 0000644 00000000674 15036124164 0005465 0 ustar 00 # vipw(8) and vigr completion -*- shell-script -*- _vipw() { local cur prev words cword _init_completion || return case $prev in --help | -!(-*)h) return ;; --root | -!(-*)R) _filedir -d return ;; esac COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) } && complete -F _vipw vipw vigr # ex: filetype=sh autoscan 0000644 00000001356 15036124164 0006313 0 ustar 00 # autoscan(1) completion -*- shell-script -*- _autoscan() { local cur prev words cword split _init_completion -s || return case "$prev" in --help | --version | -!(-*)[hV]) return ;; --prepend-include | --include | -!(-*)[BI]) _filedir -d return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return fi if [[ $1 == *autoupdate ]]; then _filedir '@(ac|in)' else _filedir -d fi } && complete -F _autoscan autoscan autoupdate # ex: filetype=sh config_list 0000644 00000001112 15036124164 0006764 0 ustar 00 # mailman config_list completion -*- shell-script -*- _config_list() { local cur prev words cword split _init_completion -s || return case $prev in -i | -o | --inputfile | --outputfile) _filedir return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '--inputfile --outputfile --checkonly --verbose --help' -- "$cur")) else _xfunc list_lists _mailman_lists fi } && complete -F _config_list config_list # ex: filetype=sh dot 0000644 00000002412 15036124164 0005256 0 ustar 00 # dot(1) completion -*- shell-script -*- _dot() { local cur prev words cword _init_completion -n := || return [[ $prev == -[V?] ]] && return case $cur in -G* | -N* | -E* | -l?* | -q?* | -s?* | -Ln* | -LU* | -LC* | -LT*) return ;; -T*) local langs=($("$1" -TNON_EXISTENT 2>&1 | command sed -ne 's/.*one of://p')) COMPREPLY=($(compgen -P -T -W '${langs[@]}' -- "${cur#-T}")) return ;; -K*) local layouts=($("$1" -KNON_EXISTENT 2>&1 | command sed -ne 's/.*one of://p')) COMPREPLY=($(compgen -P -K -W '${layouts[@]}' -- "${cur#-K}")) return ;; -o*) cur=${cur#-o} _filedir COMPREPLY=($(compgen -P -o -W '${COMPREPLY[@]}' -- "$cur")) return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '-V -v -G -N -E -T -K -l -o -O -P -q -s -y -n -n1 -n2 -x -Lg -LO -Ln -LU -LC -LT -m -c -?' -- "$cur")) [[ ${COMPREPLY-} == -@([GNETKo]|L[nUCT]) ]] && compopt -o nospace return fi _filedir dot } && complete -F _dot dot # ex: filetype=sh hwclock 0000644 00000001700 15036124164 0006121 0 ustar 00 _hwclock_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-f'|'--rtc'|'--adjfile') local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 ;; '--date'|'--delay') COMPREPLY=( $(compgen -W "time" -- $cur) ) return 0 ;; '--epoch') COMPREPLY=( $(compgen -W "year" -- $cur) ) return 0 ;; '-h'|'-?'|'--help'|'-v'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS="--help --show --get --set --hctosys --systohc --systz --adjust --getepoch --setepoch --predict --version --utc --localtime --rtc --directisa --date --delay --epoch --update-drift --noadjfile --adjfile --test --debug" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac return 0 } complete -F _hwclock_module hwclock pkg-get 0000644 00000004316 15036124164 0006033 0 ustar 00 # pkg-get.completion completion -*- shell-script -*- # # Copyright 2006 Yann Rouillard <yann@opencsw.org> _pkg_get_get_catalog_file() { local url="$1" local catalog_file i conffile for file in /etc/opt/csw/pkg-get.conf /opt/csw/etc/pkg-get.conf /etc/pkg-get.conf; do if [[ -f $file ]]; then conffile="$file" break fi done conffile="${conffile:-/opt/csw/etc/pkg-get.conf}" if [[ -z $url ]]; then url=$(awk -F= ' $1=="url" { print $2 }' $conffile) fi catalog_file="${url##*//}" catalog_file="${catalog_file%%/*}" catalog_file="/var/pkg-get/catalog-$catalog_file" echo "$catalog_file" } && _pkg_get() { local cur prev file catalog_file url command COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD - 1]}" if [[ ${prev} == "-s" ]]; then return 1 fi local i=${#COMP_WORDS[*]} while ((i > 0)); do if [[ ${COMP_WORDS[--i]} == -s ]]; then url="${COMP_WORDS[i + 1]}" fi if [[ ${COMP_WORDS[i]} == @(-[aDdiUu]|available|describe|download|install|list|updatecatalog|upgrade) ]]; then command="${COMP_WORDS[i]}" fi done if [[ -v command ]]; then if [[ $command == @(-[Ddi]|describe|download|install) ]]; then catalog_file=$(_pkg_get_get_catalog_file "$url") if [[ -f $catalog_file ]]; then local packages_list=$(awk ' $0 ~ /BEGIN PGP SIGNATURE/ { exit } $1 ~ /^Hash:/ || $1 ~ /^ *(-|#|$)/ { next } { print $1 }' $catalog_file) COMPREPLY=($(compgen -W "${packages_list}" -- ${cur})) fi fi return fi if [[ ${cur} == -* ]]; then local opts="-c -d -D -f -i -l -s -S -u -U -v" COMPREPLY=($(compgen -W "${opts}" -- ${cur})) return fi local commands="available describe download install list \ updatecatalog upgrade" COMPREPLY=($(compgen -W "${commands}" -- ${cur})) } && complete -F _pkg_get pkg-get # ex: filetype=sh cpio 0000644 00000005523 15036124164 0005430 0 ustar 00 # bash completion for cpio -*- shell-script -*- _cpio() { local cur prev words cword split _init_completion -s -n : || return # --name value style option case $prev in --format | -!(-*)H) COMPREPLY=($(compgen -W \ 'bin odc newc crc tar ustar hpbin hpodc' -- "$cur")) return ;; --file | --pattern-file | -!(-*)[EFI]) _filedir return ;; --owner | -!(-*)R) _usergroup return ;; --rsh-command) compopt -o filenames COMPREPLY=($(compgen -c -- "$cur")) return ;; esac $split && return if ((cword == 1)); then COMPREPLY=($(compgen -W '-o --create -i --extract -p --pass-through -? --help --license --usage --version' -- "$cur")) else case ${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 --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 } && complete -F _cpio cpio # ex: filetype=sh _xm 0000644 00000017062 15036124164 0005262 0 ustar 00 # bash completion for xm -*- shell-script -*- # Use of this file is deprecated. The 'xm' command itself is no longer # provided by upstream. It has been replaced with the 'xl' command, for # which upstream provides completion, use that instead. _xen_domain_names() { COMPREPLY=($(compgen -W "$(xm list 2>/dev/null | awk '!/Name|Domain-0/ { print $1 }')" -- "$cur")) } _xen_domain_ids() { COMPREPLY=($(compgen -W "$(xm list 2>/dev/null | awk '!/Name|Domain-0/ { print $2 }')" -- "$cur")) } _xm() { local cur prev words cword _init_completion || return # TODO: _split_longopt local args command commands options commands='console vncviewer create new delete destroy domid domname dump-core list mem-max mem-set migrate pause reboot rename reset restore resume save shutdown start suspend sysrq trigger top unpause uptime usb-add usb-del vcpu-list vcpu-pin vcpu-set debug-keys dmesg info log serve sched-credit sched-sedf block-attach block-detach block-list block-configure network-attach network-detach network-list vtpm-list pci-attach pci-detach pci-list pci-list-assignable-devices scsi-attach scsi-detach scsi-list vnet-list vnet-create vnet-delete labels addlabel rmlabel getlabel dry-run resources dumppolicy setpolicy resetpolicy getpolicy shell help' if ((cword == 1)); then COMPREPLY=($(compgen -W "$commands" -- "$cur")) else if [[ $cur == *=* ]]; then prev=${cur/=*/} cur=${cur/*=/} fi command=${words[1]} if [[ $cur == -* ]]; then # possible options for the command case $command in create) options='-c' ;; dmesg) options='--clear' ;; list) options='--long' ;; reboot) options='-w -a' ;; shutdown) options='-w -a -R -H' ;; sched-credit) options='-d -w -c' ;; block-list | network-list | vtpm-list | vnet-list) options='-l --long' ;; getpolicy) options='--dumpxml' ;; new) options='-h --help --help_config -q --quiet --path= -f= --defconfig= -F= --config= -b --dryrun -x --xmldryrun -s --skipdtd -p --paused -c --console_autoconnect' ;; esac COMPREPLY=($(compgen -W "$options" -- "$cur")) else case $command in console | destroy | domname | domid | list | mem-set | mem-max | \ pause | reboot | rename | shutdown | unpause | vcpu-list | vcpu-pin | \ vcpu-set | block-list | network-list | vtpm-list) _count_args case $args in 2) _xen_domain_names ;; esac ;; migrate) _count_args case $args in 2) _xen_domain_names ;; 3) _known_hosts_real -- "$cur" ;; esac ;; restore | dry-run | vnet-create) _filedir ;; save) _count_args case $args in 2) _xen_domain_names ;; 3) _filedir ;; esac ;; sysrq) _count_args case $args in 2) _xen_domain_names ;; 3) COMPREPLY=($(compgen -W "r s e i u b" -- "$cur")) ;; esac ;; block-attach) _count_args case $args in 2) _xen_domain_names ;; 3) COMPREPLY=($(compgen -W "phy: file:" -- "$cur")) ;; 5) COMPREPLY=($(compgen -W "w r" -- "$cur")) ;; 6) _xen_domain_names ;; esac ;; block-detach) _count_args case $args in 2) _xen_domain_names ;; 3) COMPREPLY=($(compgen -W "$(xm block-list $prev \ 2>/dev/null | awk '!/Vdev/ { print $1 }')" \ -- "$cur")) ;; esac ;; network-attach) _count_args case $args in 2) _xen_domain_names ;; *) COMPREPLY=($(compgen -W "script= ip= mac= bridge= backend=" -- "$cur")) ;; esac ;; network-detach) _count_args case $args in 2) _xen_domain_names ;; 3) COMPREPLY=($(compgen -W "$(xm network-list $prev \ 2>/dev/null | awk '!/Idx/ { print $1 }')" \ -- "$cur")) ;; esac ;; sched-credit) case $prev in -d) _xen_domain_names return ;; esac ;; create) _filedir COMPREPLY+=( $(compgen -W '$(command ls /etc/xen 2>/dev/null)' \ -- "$cur")) ;; new) case $prev in -f | -F | --defconfig | --config) _filedir return ;; --path) _filedir -d return ;; esac _count_args case $args in 2) _xen_domain_names ;; esac ;; esac fi fi } && complete -F _xm xm # ex: filetype=sh smartctl 0000644 00000010420 15036124164 0006317 0 ustar 00 # bash completion for smartctl(8) -*- shell-script -*- _smartctl_quietmode() { COMPREPLY=($(compgen -W 'errorsonly silent noserial' -- "$cur")) } _smartctl_device() { case $cur in areca* | 3ware* | megaraid* | cciss*) # shellcheck disable=SC2054 COMPREPLY+=(${cur%%,*},{0..31}) COMPREPLY=($(compgen -W '"${COMPREPLY[@]}"' -- "$cur")) ;; hpt*) # shellcheck disable=SC2054 COMPREPLY+=(hpt,{1..4}/{1..8} hpt,{1..4}/{1..8}/{1..5}) COMPREPLY=($(compgen -W '"${COMPREPLY[@]}"' -- "$cur")) ;; *) COMPREPLY=($(compgen -W "ata scsi sat usbcypress usbjmicron usbsunplus marvell areca 3ware hpt megaraid cciss auto test" \ -- "$cur")) case "${COMPREPLY[@]}" in areca | 3ware | hpt | megaraid | cciss) compopt -o nospace ;; esac ;; esac } _smartctl_tolerance() { COMPREPLY=($(compgen -W 'normal conservative permissive verypermissive' \ -- "$cur")) } _smartctl_badsum() { COMPREPLY=($(compgen -W 'warn exit ignore' -- "$cur")) } _smartctl_report() { COMPREPLY=($(compgen -W 'ioctl ataioctl scsiioctl' -- "$cur")) } _smartctl_powermode() { COMPREPLY=($(compgen -W 'never sleep standby idle' -- "$cur")) } _smartctl_feature() { COMPREPLY=($(compgen -W 'on off' -- "$cur")) } _smartctl_log() { COMPREPLY=($(compgen -W 'error selftest selective directory background sasphy sasphy,reset sataphy sataphy,reset scttemp scttempsts scttemphist scterc gplog smartlog xerror xselftest' -- "$cur")) } _smartctl_vendorattribute() { COMPREPLY=($(compgen -W 'help 9,minutes 9,seconds 9,halfminutes 9,temp 192,emergencyretractcyclect 193,loadunload 194,10xCelsius 194,unknown 198,offlinescanuncsectorct 200,writeerrorcount 201,detectedtacount 220,temp' -- "$cur")) } _smartctl_firmwarebug() { COMPREPLY=($(compgen -W 'none samsung samsung2 samsung3 swapid' \ -- "$cur")) } _smartctl_presets() { COMPREPLY=($(compgen -W 'use ignore show showall' -- "$cur")) } _smartctl_test() { [[ $cur == @(pending|scttempint|vendor), ]] && return COMPREPLY=($(compgen -W 'offline short long conveyance select, select,redo select,next afterselect,on afterselect,off pending, scttempint, vendor,' -- "$cur")) [[ ${COMPREPLY-} == *, ]] && compopt -o nospace } _smartctl_drivedb() { local prefix= if [[ $cur == +* ]]; then prefix=+ cur="${cur#+}" fi _filedir h [[ -n $prefix ]] && COMPREPLY=("${COMPREPLY[@]/#/$prefix}") } _smartctl() { local cur prev words cword split _init_completion -s || return case $prev in --quietmode | -!(-*)q) _smartctl_quietmode ;; --device | -!(-*)d) _smartctl_device return ;; --tolerance | -!(-*)T) _smartctl_tolerance return ;; --badsum | -!(-*)b) _smartctl_badsum return ;; --report | -!(-*)r) _smartctl_report return ;; --nocheck | -!(-*)n) _smartctl_powermode return ;; --smart | --offlineauto | --saveauto | -!(-*)[soS]) _smartctl_feature return ;; --log | -!(-*)l) _smartctl_log return ;; --vendorattribute | -!(-*)v) _smartctl_vendorattribute return ;; --firmwarebug | -!(-*)F) _smartctl_firmwarebug return ;; --presets | -!(-*)P) _smartctl_presets return ;; --drivedb | -!(-*)B) _smartctl_drivedb return ;; --test | -!(-*)t) _smartctl_test return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace else cur=${cur:=/dev/} _filedir fi } && complete -F _smartctl smartctl # ex: filetype=sh badblocks 0000644 00000001123 15036124164 0006412 0 ustar 00 # badblocks(8) completion -*- shell-script -*- _badblocks() { local cur prev words cword _init_completion || return case $prev in -*[bcedpt]) return ;; -*[io]) _filedir return ;; esac if [[ $cur == -* ]]; then # Filter out -w (dangerous) and -X (internal use) COMPREPLY=($(compgen -X -[wX] -W '$(_parse_usage "$1")' -- "$cur")) return fi cur=${cur:=/dev/} _filedir } && complete -F _badblocks badblocks # ex: filetype=sh checksec 0000644 00000001352 15036124164 0006242 0 ustar 00 # bash completion for checksec -*- shell-script -*- _checksec() { local cur prev words cword _init_completion || return case $prev in --version | --help) return ;; --file | --fortify-file) _filedir return ;; --dir) _filedir -d return ;; --proc) _pnames return ;; --proc-libs | --fortify-proc) _pids return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) return fi } && complete -F _checksec checksec # ex: filetype=sh blkdiscard 0000644 00000001256 15036124164 0006577 0 ustar 00 _blkdiscard_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-o'|'--offset'|'-l'|'--length'|'-p'|'--step') COMPREPLY=( $(compgen -W "num" -- $cur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS=" --force --offset --length --step --secure --zeroout --verbose --help --version " COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac compopt -o bashdefault -o default COMPREPLY=( $(compgen -W "$(lsblk -pnro name)" -- $cur) ) return 0 } complete -F _blkdiscard_module blkdiscard hexdump 0000644 00000001757 15036124164 0006155 0 ustar 00 _hexdump_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-L'|'--color') COMPREPLY=( $(compgen -W "auto never always" -- $cur) ) return 0 ;; '-e'|'--format') COMPREPLY=( $(compgen -W "format" -- $cur) ) return 0 ;; '-n'|'--length') COMPREPLY=( $(compgen -W "length" -- $cur) ) return 0 ;; '-s'|'--skip') COMPREPLY=( $(compgen -W "offset" -- $cur) ) return 0 ;; '-V'|'--version'|'-h'|'--help') return 0 ;; esac case $cur in -*) OPTS=" --one-byte-octal --one-byte-char --canonical --two-bytes-decimal --two-bytes-octal --two-bytes-hex --color= --format --format-file --length --skip --no-squeezing --version --help" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 } complete -F _hexdump_module hexdump gresource 0000644 00000002514 15036124164 0006471 0 ustar 00 # Check for bash [ -z "$BASH_VERSION" ] && return #################################################################################################### __gresource() { local choices coffset section if [ ${COMP_CWORD} -gt 2 ]; then if [ ${COMP_WORDS[1]} = --section ]; then section=${COMP_WORDS[2]} coffset=2 else coffset=0 fi else coffset=0 fi case "$((${COMP_CWORD}-$coffset))" in 1) choices=$'--section \nhelp \nsections \nlist \ndetails \nextract ' ;; 2) case "${COMP_WORDS[$(($coffset+1))]}" in --section) return 0 ;; help) choices=$'sections\nlist\ndetails\nextract' ;; sections|list|details|extract) COMPREPLY=($(compgen -f -- ${COMP_WORDS[${COMP_CWORD}]})) return 0 ;; esac ;; 3) case "${COMP_WORDS[$(($coffset+1))]}" in list|details|extract) choices="$(gresource list ${COMP_WORDS[$(($coffset+2))]} 2> /dev/null | sed -e 's.$. .')" ;; esac ;; esac local IFS=$'\n' COMPREPLY=($(compgen -W "${choices}" -- "${COMP_WORDS[${COMP_CWORD}]}")) } #################################################################################################### complete -o nospace -F __gresource gresource readprofile 0000644 00000001247 15036124164 0006771 0 ustar 00 _readprofile_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-m'|'--mapfile'|'-p'|'--profile') local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 ;; '-M'|'--multiplier') COMPREPLY=( $(compgen -W "multiplier" -- $cur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac OPTS="--mapfile --profile --multiplier --info --verbose --all --histbin --counters --reset --no-auto --help --version" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 } complete -F _readprofile_module readprofile oggdec 0000644 00000001550 15036124164 0005722 0 ustar 00 # bash completion for oggdec(1) -*- shell-script -*- _oggdec() { local cur prev words cword split _init_completion -s || return case $prev in --help | --version | -!(-*)[hV]*) return ;; --bits | -!(-*)b) COMPREPLY=($(compgen -W "8 16" -- "$cur")) return ;; --endianness | --sign | -!(-*)[es]) COMPREPLY=($(compgen -W "0 1" -- "$cur")) return ;; --output | -!(-*)o) _filedir wav return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return fi _filedir ogg } && complete -F _oggdec oggdec # ex: filetype=sh ulimit 0000644 00000001557 15036124164 0006004 0 ustar 00 # bash completion for ulimit -*- shell-script -*- _ulimit() { local cur prev words cword _init_completion || return # TODO combined option support (-aH, -Sc etc) local mode case $prev in -a) COMPREPLY=($(compgen -W "-S -H" -- "$cur")) return ;; -[SH]) ;; -*) mode=$prev ;; esac if [[ ! -v mode ]]; then local word for word in "${words[@]}"; do [[ $word == -*a* ]] && return done if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_usage "$1")' -- "$cur")) return fi fi local args _count_args ((args == 1)) && COMPREPLY=($(compgen -W "soft hard unlimited" -- "$cur")) } && complete -F _ulimit ulimit # ex: filetype=sh list_admins 0000644 00000000601 15036124164 0006774 0 ustar 00 # mailman list_admins completion -*- shell-script -*- _list_admins() { local cur prev words cword _init_completion || return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '--all-vhost --all --help' -- "$cur")) else _xfunc list_lists _mailman_lists fi } && complete -F _list_admins list_admins # ex: filetype=sh smbclient 0000644 00000016071 15036124164 0006456 0 ustar 00 # bash completion for samba -*- shell-script -*- _samba_resolve_order() { COMPREPLY=($(compgen -W 'lmhosts host wins bcast' -- "$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 | command sed -ne 's/^[[:space:]]*\\\\*\([^[:space:]]*\).*/\1/p' )" -- "$cur")) fi } _samba_debuglevel() { COMPREPLY=($(compgen -W '{0..10}' -- "$cur")) } _samba_sockopts() { COMPREPLY=($(compgen -W 'SO_KEEPALIVE SO_REUSEADDR SO_BROADCAST TCP_NODELAY IPTOS_LOWDELAY IPTOS_THROUGHPUT SO_SNDBUF SO_RCVBUF SO_SNDLOWAT SO_RCVLOWAT' -- "$cur")) } _samba_signing() { COMPREPLY=($(compgen -W 'on off required' -- "$cur")) } _smbclient() { local cur prev words cword split _init_completion -s || return case $prev in --name-resolve | -!(-*)R) _samba_resolve_order return ;; -!(-*)t) COMPREPLY=($(compgen -W 'SJIS EUC JIS7 JIS8 JUNET HEX CAP' \ -- "$cur")) return ;; --configfile | --authentication-file | -!(-*)[sA]) _filedir return ;; --log-basename | --directory | -!(-*)[lD]) _filedir -d return ;; --socket-options | -!(-*)O) _samba_sockopts return ;; -!(-*)T) COMPREPLY=($(compgen -W 'c x I X F b g q r N a' -- "$cur")) return ;; --workgroup | -!(-*)W) _samba_domains return ;; --debuglevel | -!(-*)d) _samba_debuglevel return ;; --list | -!(-*)L) _samba_hosts return ;; --signing | -!(-*)S) _samba_signing return ;; --port | --message | --ip-address | --send-buffer | --user | --netbiosname | \ --scope | --tar | --command | --max-protocol | -!(-*)[pMIbUniTcm]) return ;; --help | --version | -!(-*)[?V]) return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace fi } && complete -F _smbclient smbclient _smbget() { local cur prev words cword split _init_completion -s || return case $prev in --outputfile | --rcfile | -!(-*)[of]) _filedir return ;; --debuglevel | -!(-*)d) _samba_debuglevel return ;; --workgroup | -!(-*)w) _samba_domains return ;; --username | --password | --blocksize | -!(-*)[upb]) return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace fi } && complete -F _smbget smbget _smbcacls() { local cur prev words cword split _init_completion -s || return case $prev in --configfile | --authentication-file | -!(-*)[As]) _filedir return ;; --log-basename | -!(-*)l) _filedir -d return ;; --debuglevel | -!(-*)d) _samba_debuglevel return ;; --signing) _samba_signing return ;; --socket-options | -!(-*)O) _samba_sockopts return ;; --workgroup | -!(-*)W) _samba_domains return ;; --help | --usage | --delete | --modify | --add | --set | --chown | --chgrp | \ --netbiosname | --scope | --user | -!(-*)[?DMaSCGniU]) return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace fi } && complete -F _smbcacls smbcacls _smbcquotas() { local cur prev words cword split _init_completion -s || return case $prev in --configfile | --authentication-file | -!(-*)[sA]) _filedir return ;; --log-basename | -!(-*)l) _filedir -d return ;; --debuglevel | -!(-*)d) _samba_debuglevel return ;; --signing) _samba_signing return ;; --help | --usage | --user | --set | -!(-*)[?UuS]) return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace fi } && complete -F _smbcquotas smbcquotas _smbpasswd() { local cur prev words cword _init_completion || return case $prev in -*r) _samba_hosts return ;; -*R) _samba_resolve_order return ;; -*c) _filedir return ;; -*D) _samba_debuglevel return ;; -*[Uhw]) return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1" -h)' -- "$cur")) fi } && complete -F _smbpasswd smbpasswd _smbtar() { local cur prev words cword _init_completion || return case $prev in -*[rt]) _filedir tar return ;; -*s) _samba_hosts return ;; -*l) _samba_debuglevel return ;; -*N) _filedir return ;; -*[pxbdu]) return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) fi } && complete -F _smbtar smbtar _smbtree() { local cur prev words cword split _init_completion -s || return case $prev in --configfile | --authentication-file | -!(-*)[sA]) _filedir return ;; --log-basename | -!(-*)l) _filedir -d return ;; --debuglevel | -!(-*)d) _samba_debuglevel return ;; --signing | -!(-*)S) _samba_signing return ;; --help | --usage | --user | -!(-*)[?U]) return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace fi } && complete -F _smbtree smbtree # ex: filetype=sh ipcs 0000644 00000001002 15036124164 0005420 0 ustar 00 _ipcs_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-i'|'--id') COMPREPLY=( $(compgen -W "id" -- $cur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac OPTS="--id --help --version --shmems --queues --semaphores --all --time --pid --creator --limits --summary --human --bytes" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 } complete -F _ipcs_module ipcs ipsec 0000644 00000006070 15036124164 0005577 0 ustar 00 # Linux ipsec(8) completion (for FreeS/WAN and strongSwan) -*- shell-script -*- # Complete ipsec.conf conn entries. # # Reads a file from stdin in the ipsec.conf(5) format. _ipsec_connections() { local keyword name while read -r keyword name; do if [[ $keyword == [#]* ]]; then continue; fi [[ $keyword == conn && $name != '%default' ]] && COMPREPLY+=("$name") done COMPREPLY=($(compgen -W '${COMPREPLY[@]}' -- "$cur")) } _ipsec_freeswan() { local cur prev words cword _init_completion || return if ((cword == 1)); then COMPREPLY=($(compgen -W 'auto barf eroute klipsdebug look manual pluto ranbits rsasigkey setup showdefaults showhostkey spi spigrp tncfg whack' -- "$cur")) return fi case ${words[1]} in auto) COMPREPLY=($(compgen -W '--asynchronous --up --add --delete --replace --down --route --unroute --ready --status --rereadsecrets' -- "$cur")) ;; manual) COMPREPLY=($(compgen -W '--up --down --route --unroute --union' \ -- "$cur")) ;; ranbits) COMPREPLY=($(compgen -W '--quick --continuous --bytes' -- "$cur")) ;; setup) COMPREPLY=($(compgen -W '--start --stop --restart' -- "$cur")) ;; *) ;; esac } _ipsec_strongswan() { local cur prev words cword _init_completion || return if ((cword == 1)); then COMPREPLY=($(compgen -W 'down irdumm leases listaacerts listacerts listalgs listall listcacerts listcainfos listcards listcerts listcrls listgroups listocsp listocspcerts listpubkeys openac pki pluto pool purgecerts purgecrls purgeike purgeocsp ready reload rereadaacerts rereadacerts rereadall rereadcacerts rereadcrls rereadgroups rereadocspcerts rereadsecrets restart route scdecrypt scencrypt scepclient secrets start starter status statusall stop stroke unroute uci up update version whack --confdir --copyright --directory --help --version --versioncode' -- "$cur")) return fi case ${words[1]} in down | route | status | statusall | unroute | up) local confdir=$(ipsec --confdir) _ipsec_connections <"$confdir/ipsec.conf" ;; list*) COMPREPLY=($(compgen -W '--utc' -- "$cur")) ;; restart | start) COMPREPLY=($(compgen -W '--attach-gdb --auto-update --debug --debug-all --debug-more --nofork' -- "$cur")) ;; pki) COMPREPLY=($(compgen -W '--gen --issue --keyid --print --pub --req --self --signcrl --verify' -- "$cur")) ;; pool) ;; irdumm) _filedir 'rb' ;; *) ;; esac } case "$(ipsec --version 2>/dev/null)" in *strongSwan*) complete -F _ipsec_strongswan ipsec ;; *) complete -F _ipsec_freeswan ipsec ;; esac # ex: filetype=sh autoreconf 0000644 00000001774 15036124164 0006647 0 ustar 00 # autoreconf(1) completion -*- shell-script -*- _autoreconf() { local cur prev words cword split _init_completion -s || return case "$prev" in --help | -h | --version | -V) return ;; --warnings | -W) local cats=(cross gnu obsolete override portability syntax unsupported) COMPREPLY=($(compgen -W \ '${cats[@]} ${cats[@]/#/no-} all none error' -- "$cur")) return ;; --prepend-include | -B | --include | -I) _filedir -d return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return fi if [[ $1 == *autoheader ]]; then _filedir '@(ac|in)' else _filedir -d fi } && complete -F _autoreconf autoreconf autoheader # ex: filetype=sh luac 0000644 00000000746 15036124164 0005424 0 ustar 00 # luac(1) completion -*- shell-script -*- _luac() { local cur prev words cword _init_completion || return case $prev in -v | -) return ;; -o) _filedir return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W "$(_parse_help "$1")" -- "$cur")) return fi _filedir lua } && complete -F _luac luac # ex: filetype=sh kldload 0000644 00000000731 15036124164 0006104 0 ustar 00 # FreeBSD kldload completion -*- shell-script -*- [[ $OSTYPE == *freebsd* ]] || return 1 _kldload() { local cur prev words cword _init_completion || return local moddir=/modules/ [[ -d $moddir ]] || moddir=/boot/kernel/ compopt -o filenames COMPREPLY=($(compgen -f "$moddir$cur")) COMPREPLY=(${COMPREPLY[@]#$moddir}) COMPREPLY=(${COMPREPLY[@]%.ko}) } && complete -F _kldload kldload # ex: filetype=sh pm-powersave 0000644 00000000432 15036124164 0007115 0 ustar 00 # pm-powersave(8) completion -*- shell-script -*- _pm_powersave() { local cur prev words cword _init_completion || return COMPREPLY=($(compgen -W "true false" -- "$cur")) } && complete -F _pm_powersave pm-powersave # ex: filetype=sh xsltproc 0000644 00000002310 15036124164 0006343 0 ustar 00 # xsltproc(1) completion -*- shell-script -*- _xsltproc() { local cur prev words cword _init_completion || return case $prev in --output | -o) _filedir return ;; # TODO : number only --maxdepth) return ;; --encoding) # some aliases removed COMPREPLY=($(compgen -X '@(UTF[1378]|8859|ISO[0-9_])*' \ -W "$(iconv -l | command sed -e 's/\/.*//')" -- "$cur")) return ;; --param | --stringparam) return ;; # not really like --writesubtree --path) _filedir -d return ;; --writesubtree) _filedir -d return ;; esac [[ $cword -gt 2 && $(_get_cword '' 2) == --?(string)param ]] && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) COMPREPLY=("${COMPREPLY[@]%:}") else # TODO: 1st file xsl|xslt, 2nd XML _filedir '@(xsl|xslt|xml|dbk|docbook|page)' fi } && complete -F _xsltproc xsltproc # ex: filetype=sh e2label 0000644 00000000444 15036124164 0006001 0 ustar 00 # e2label(8) completion -*- shell-script -*- _e2label() { local cur prev words cword _init_completion || return if ((cword == 1)); then cur=${cur:=/dev/} _filedir fi } && complete -F _e2label e2label # ex: filetype=sh mii-tool 0000644 00000001524 15036124164 0006224 0 ustar 00 # mii-tool(8) completion -*- shell-script -*- _mii_tool() { local cur prev words cword split _init_completion -s || return case $prev in --force | -!(-*)F) COMPREPLY=($(compgen -W '100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD' -- "$cur")) return ;; --advertise | -!(-*)A) COMPREPLY=($(compgen -W '100baseT4 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD' -- "$cur")) return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace else _available_interfaces -a fi } && complete -F _mii_tool -o default mii-tool # ex: filetype=sh find_member 0000644 00000001035 15036124164 0006737 0 ustar 00 # mailman find_member completion -*- shell-script -*- _find_member() { local cur prev words cword split _init_completion -s || return case $prev in -l | -x | --listname | --exclude) _xfunc list_lists _mailman_lists return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '--listname --exclude --owners --help' \ -- "$cur")) fi } && complete -F _find_member find_member # ex: filetype=sh mypy 0000644 00000002634 15036124164 0005474 0 ustar 00 # mypy completion -*- shell-script -*- _mypy() { local cur prev words cword split _init_completion -s || return [[ $cword -gt 2 && ${words[cword - 2]} == --shadow-file ]] && prev=--shadow-file # hack; takes two args case $prev in --help | --version | --python-version | --platform | --always-true | \ --always-false | --find-occurrences | --package | --command | -!(-*)[hVpc]) return ;; --config-file) _filedir return ;; --follow-imports) COMPREPLY=($(compgen -W 'normal silent skip error' -- "$cur")) return ;; --python-executable) COMPREPLY=($(compgen -c -- "${cur:-py}")) return ;; --*-dir | --*-report) _filedir -d return ;; --custom-typing | --module | -!(-*)m) _xfunc python _python_modules return ;; --shadow-file) _filedir '@(py|pyi)' return ;; --junit-xml) _filedir xml return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) return fi _filedir '@(py|pyi)' } && complete -F _mypy mypy # ex: filetype=sh appdata-validate 0000644 00000001427 15036124164 0007676 0 ustar 00 # appdata-validate(1) completion -*- shell-script -*- _appdata_validate() { local cur prev words cword split _init_completion -s || return case $prev in -h | --help | --version) return ;; --output-format) COMPREPLY=($(compgen -W "$($1 --help | command sed -ne 's/--output-format.*\[\(.*\)\]/\1/' -e 's/|/ /gp')" \ -- "$cur")) return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return fi _filedir appdata.xml } && complete -F _appdata_validate appdata-validate # ex: filetype=sh gkrellm 0000644 00000001661 15036124164 0006132 0 ustar 00 # gkrellm(1) completion -*- shell-script -*- _gkrellm() { local cur prev words cword _init_completion || return case $prev in -t | --theme) _filedir -d return ;; -p | --plugin) _filedir so return ;; -s | --server) _known_hosts_real -- "$cur" return ;; -l | --logfile) _filedir return ;; -g | --geometry | -c | --config | -P | --port | -d | --debug-level) # Argument required but no completions available return ;; -h | --help | -v | --version) # All other options are noop with these return ;; esac COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) } && complete -F _gkrellm gkrellm gkrellm2 # ex: filetype=sh slapt-src 0000644 00000003551 15036124164 0006405 0 ustar 00 # slapt-src(8) completion -*- shell-script -*- _slapt_src() { local cur prev words cword split _init_completion -s -n : || return case "$prev" in --config | -c) _filedir return ;; --search | -s | --postprocess | -p) # argument required but no completions available return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1" --help)' -- "$cur")) if [[ ${COMPREPLY-} ]]; then [[ $COMPREPLY == *= ]] && compopt -o nospace return fi fi local i t # search for last action (-i|-w|-b|-f) for ((i = ${#words[@]} - 1; i > 0; i--)); do if [[ ${words[i]} == -@([iwfb]|-install|-show|-build|-fetch) ]]; then t="all" break fi done if [[ $t != all ]]; then return fi local config="/etc/slapt-get/slapt-srcrc" # default config location # search for config for ((i = ${#words[@]} - 1; i > 0; i--)); do if [[ ${words[i]} == -@(c|-config) ]]; then config="${words[i + 1]}" __expand_tilde_by_ref config break fi if [[ ${words[i]} == --config=?* ]]; then config="${words[i]#*=}" break fi done [[ -r $config ]] || return if [[ $cur == *:* ]]; then local name=${cur%:*} COMPREPLY=($(LC_ALL=C "$1" --config "$config" --search "^$name" \ 2>/dev/null | LC_ALL=C command sed -ne \ "/^$cur/{s/^$name:\([^ ]*\) .*$/\1/;p}")) else COMPREPLY=($(LC_ALL=C "$1" --config "$config" --search "^$cur" \ 2>/dev/null | LC_ALL=C command sed -ne "/^$cur/{s/ .*$//;p}")) fi } && complete -F _slapt_src slapt-src # ex: filetype=sh lsblk 0000644 00000004152 15036124164 0005602 0 ustar 00 _lsblk_module() { local cur prev OPTS LSBLK_COLS_ALL COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" LSBLK_COLS_ALL=" NAME KNAME PATH MAJ:MIN FSAVAIL FSSIZE FSTYPE FSUSED FSUSE% FSVER MOUNTPOINT LABEL UUID PTUUID PTTYPE PARTTYPE PARTTYPENAME PARTLABEL PARTUUID PARTFLAGS RA RO RM HOTPLUG MODEL SERIAL SIZE STATE OWNER GROUP MODE ALIGNMENT MIN-IO OPT-IO PHY-SEC LOG-SEC ROTA SCHED RQ-SIZE TYPE DISC-ALN DISC-GRAN DISC-MAX DISC-ZERO WSAME WWN RAND PKNAME HCTL TRAN SUBSYSTEMS REV VENDOR ZONED DAX " case $prev in '-e'|'--exclude'|'-I'|'--include') local realcur prefix MAJOR_ALL MAJOR I J realcur="${cur##*,}" prefix="${cur%$realcur}" for I in /sys/dev/block/*; do J=${I##*/} MAJOR_ALL="${MAJOR_ALL:-""} ${J%%:*}" done for WORD in ${MAJOR_ALL:-""}; do if ! [[ $prefix == *"$WORD"* ]]; then MAJOR="$WORD ${MAJOR:-""}" fi done compopt -o nospace COMPREPLY=( $(compgen -P "$prefix" -W "${MAJOR:-""}" -S ',' -- $realcur) ) return 0 ;; '-o'|'--output'|'-E'|'--dedup') local prefix realcur LSBLK_COLS realcur="${cur##*,}" prefix="${cur%$realcur}" for WORD in $LSBLK_COLS_ALL; do if ! [[ $prefix == *"$WORD"* ]]; then LSBLK_COLS="$WORD ${LSBLK_COLS:-""}" fi done compopt -o nospace COMPREPLY=( $(compgen -P "$prefix" -W "$LSBLK_COLS" -S ',' -- $realcur) ) return 0 ;; '-x'|'--sort') compopt -o nospace COMPREPLY=( $(compgen -W "$LSBLK_COLS_ALL" -- $cur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS="--all --bytes --nodeps --discard --exclude --fs --help --include --json --ascii --list --dedup --merge --perms --noheadings --output --output-all --paths --pairs --raw --inverse --topology --scsi --sort --width --help --version" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac compopt -o bashdefault -o default COMPREPLY=( $(compgen -W "$($1 -pnro name)" -- $cur) ) return 0 } complete -F _lsblk_module lsblk minicom 0000644 00000002110 15036124164 0006116 0 ustar 00 # bash completion for minicom -*- shell-script -*- _minicom() { local cur prev words cword split _init_completion -s || return case $prev in --attrib | --color | -!(-*)[ac]) COMPREPLY=($(compgen -W 'on off' -- "$cur")) return ;; --script | --capturefile | -!(-*)[SC]) _filedir return ;; --ptty | -!(-*)p) COMPREPLY=($(printf '%s\n' /dev/tty*)) COMPREPLY=($(compgen -W '${COMPREPLY[@]} ${COMPREPLY[@]#/dev/}' \ -- "$cur")) return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return fi COMPREPLY=( $(printf '%s\n' /etc/minirc.* /etc/minicom/minirc.* ~/.minirc.* | command sed -e '/\*$/d' -e 's/^.*minirc\.//' | command grep "^${cur}")) } && complete -F _minicom -o default minicom # ex: filetype=sh lslocks 0000644 00000002074 15036124164 0006146 0 ustar 00 _lslocks_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-p'|'--pid') local PIDS # /proc/locks can have 8 to 9 fields, see commit # 55c0d16bab8cc84b72bf11cb2fdd8aa6205ac608 PIDS="$(awk '{print $(NF-3)}' /proc/locks)" COMPREPLY=( $(compgen -W "$PIDS" -- $cur) ) return 0 ;; '-o'|'--output') local prefix realcur OUTPUT_ALL OUTPUT realcur="${cur##*,}" prefix="${cur%$realcur}" OUTPUT_ALL="COMMAND PID TYPE SIZE MODE M START END PATH BLOCKER" for WORD in $OUTPUT_ALL; do if ! [[ $prefix == *"$WORD"* ]]; then OUTPUT="$WORD ${OUTPUT:-""}" fi done compopt -o nospace COMPREPLY=( $(compgen -P "$prefix" -W "$OUTPUT" -S ',' -- $realcur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac OPTS=" --json --noinaccessible --noheadings --output --output-all --pid --raw --notruncate --help --version " COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 } complete -F _lslocks_module lslocks cowsay 0000644 00000001037 15036124164 0005777 0 ustar 00 # bash completion for cowsay -*- shell-script -*- _cowsay() { local cur prev words cword _init_completion || return case $prev in -f) COMPREPLY=($(compgen -W \ '$(cowsay -l 2>/dev/null | tail -n +2)' -- "$cur")) return ;; esac # relevant options completion COMPREPLY=($(compgen -W '-b -d -g -p -s -t -w -y -e -f -h -l -n -T -W' \ -- "$cur")) } && complete -F _cowsay -o default cowsay cowthink # ex: filetype=sh timeout 0000644 00000001760 15036124164 0006163 0 ustar 00 # timeout(1) completion -*- shell-script -*- _timeout() { local cur prev words cword split i found=false _init_completion -s || return for ((i = 1; i <= COMP_CWORD; i++)); do if [[ ${COMP_WORDS[i]} != -* && ${COMP_WORDS[i - 1]} != = ]]; then if $found; then _command_offset $i return fi found=true fi [[ ${COMP_WORDS[i]} == -@(-kill-after|-signal|!(-*)[ks]) ]] && ((i++)) done case $prev in --help | --version | --kill-after | -!(-*)k) return ;; --signal | -!(-*)s) _signals return ;; esac $split && return if [[ $cur == -* ]]; then local opts=$(_parse_help "$1") COMPREPLY=($(compgen -W '${opts:-$(_parse_usage "$1")}' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace fi } && complete -F _timeout timeout # ex: filetype=sh sfdisk 0000644 00000004114 15036124164 0005754 0 ustar 00 _sfdisk_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-d'|'--dump'|'-J'|'--json'|'-l'|'--list'|'-F'|'--list-free'|'-r'|'--reorder'|'-s'|'--show-size'|'-V'|'--verify'|'-A'|'--activate'|'--delete') compopt -o bashdefault -o default COMPREPLY=( $(compgen -W "$(lsblk -dpnro name)" -- $cur) ) return 0 ;; '-N'|'--partno') COMPREPLY=( $(compgen -W "number" -- $cur) ) return 0 ;; '--color'|'-w'|'--wipe'|'-W'|'--wipe-partitions') COMPREPLY=( $(compgen -W "auto never always" -- $cur) ) return 0 ;; '-o'|'--output') local prefix realcur OUTPUT_ALL OUTPUT realcur="${cur##*,}" prefix="${cur%$realcur}" OUTPUT_ALL=" Attrs Boot Bsize Cpg Cylinders Device End End-C/H/S Flags Fsize Id Name Sectors Size Slice Start Start-C/H/S Type Type-UUID UUID " for WORD in $OUTPUT_ALL; do if ! [[ $prefix == *"$WORD"* ]]; then OUTPUT="$WORD ${OUTPUT:-""}" fi done compopt -o nospace COMPREPLY=( $(compgen -P "$prefix" -W "$OUTPUT" -S ',' -- "$realcur") ) return 0 ;; '-O'|'--backup-file') local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 ;; '-h'|'--help'|'-v'|'--version') return 0 ;; esac case $cur in '=') cur=${cur#=} ;; -*) OPTS=" --activate --dump --json --show-geometry --list --list-free --disk-id --reorder --show-size --list-types --verify --relocate --delete --part-label --part-type --part-uuid --part-attrs --append --backup --bytes --move-data --force --color --lock --partno --no-act --no-reread --no-tell-kernel --backup-file --output --quiet --wipe --wipe-partitions --label --label-nested --help --version " COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac compopt -o bashdefault -o default COMPREPLY=( $(compgen -W "$(lsblk -pnro name)" -- $cur) ) return 0 } complete -F _sfdisk_module sfdisk dnsspoof 0000644 00000000764 15036124164 0006333 0 ustar 00 # dnsspoof completion -*- shell-script -*- _dnsspoof() { local cur prev words cword _init_completion || return case $prev in -i) _available_interfaces -a return ;; -f) _filedir return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_usage "$1")' -- "$cur")) fi } && complete -F _dnsspoof dnsspoof # ex: filetype=sh vmstat 0000644 00000001275 15036124164 0006014 0 ustar 00 # vmstat(8) completion -*- shell-script -*- _vmstat() { local cur prev words cword _init_completion || return case $prev in --help | --version | --partition | -!(-*)[hVcMNnwp]) return ;; --unit | -!(-*)S) [[ $OSTYPE == *linux* ]] && COMPREPLY=($(compgen -W 'k K m M' -- "$cur")) return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} ]] || COMPREPLY=($(compgen -W '$(_parse_usage "$1")' -- "$cur")) fi } && complete -F _vmstat vmstat # ex: filetype=sh perltidy 0000644 00000003605 15036124164 0006331 0 ustar 00 # perltidy(1) completion -*- shell-script -*- _perltidy() { local cur prev words cword _init_completion -n = || return case $prev in -h | --help) return ;; -o) _filedir return ;; esac case $cur in -pro=* | --profile=*) cur="${cur#*=}" _filedir return ;; -ole=* | --output-line-ending=*) COMPREPLY=($(compgen -W 'dos win mac unix' -- "${cur#*=}")) return ;; -bt=* | --brace-tightness=* | -pt=* | --paren-tightness=* | \ -sbt=* | --square-bracket-tightness=* | \ -bvt=* | --brace-vertical-tightness=* | \ -pvt=* | --paren-vertical-tightness=* | \ -sbvt=* | --square-bracket-vertical-tightness=* | \ -bvtc=* | --brace-vertical-tightness-closing=* | \ -pvtc=* | --paren-vertical-tightness-closing=* | \ -sbvtc=* | --square-bracket-vertical-tightness-closing=* | \ -cti=* | --closing-token-indentation=* | \ -kbl=* | --keep-old-blank-lines=* | \ -vt=* | --vertical-tightness=*) COMPREPLY=($(compgen -W '0 1 2' -- "${cur#*=}")) return ;; -vtc=* | --vertical-tightness-closing=*) COMPREPLY=($(compgen -W '0 1' -- "${cur#*=}")) return ;; -cab=* | --comma-arrow-breakpoints=*) COMPREPLY=($(compgen -W '0 1 2 3' -- "${cur#*=}")) return ;; -*=) return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace else _filedir 'p[lm]|t' fi } && complete -F _perltidy perltidy # ex: filetype=sh jq 0000644 00000002342 15036124164 0005104 0 ustar 00 # jq(1) completion -*- shell-script -*- _jq() { local cur prev words cword _init_completion || return case $prev in --help | --version | --arg | --argjson | --slurpfile | --argfile) return ;; --indent) COMPREPLY=($(compgen -W '{1..8}' -- "$cur")) return ;; --from-file | --run-tests | -!(-*)f) _filedir return ;; -!(-*)L) _filedir -d return ;; esac ((cword > 2)) && case ${words[cword - 2]} in --arg | --argjson) return ;; --slurpfile | --argfile) _filedir json return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) return fi local args # TODO: DTRT with args taking 2 options _count_args "" "@(--arg|--arg?(json|file)|--?(slurp|from-)file|--indent|--run-tests|-!(-*)[fL])" # 1st arg is filter ((args == 1)) && return # 2... are input files _filedir json } && complete -F _jq jq # ex: filetype=sh cleanarch 0000644 00000000540 15036124164 0006410 0 ustar 00 # mailman cleanarch completion -*- shell-script -*- _cleanarch() { local cur prev words cword _init_completion || return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '--status --dry-run --quiet --help' \ -- "$cur")) fi } && complete -F _cleanarch cleanarch # ex: filetype=sh patch 0000644 00000003367 15036124164 0005601 0 ustar 00 # patch(1) completion -*- shell-script -*- _patch() { local cur prev words cword split _init_completion -s || return case $prev in --strip | --ifdef | --prefix | --basename-prefix | --suffix | --get | \ -!(-*)[pDBYzg]) return ;; --fuzz | -!(-*)F) COMPREPLY=($(compgen -W '{0..3}' -- "$cur")) return ;; --input | -!(-*)i) _filedir '@(?(d)patch|dif?(f))' return ;; --output | --reject-file | -!(-*)[or]) [[ ! $cur || $cur == - ]] && COMPREPLY=(-) _filedir return ;; --quoting-style) COMPREPLY=($(compgen -W 'literal shell shell-always c escape' \ -- "$cur")) return ;; --version-control | -!(-*)V) COMPREPLY=($(compgen -W 'simple numbered existing' -- "$cur")) return ;; --directory | -!(-*)d) _filedir -d return ;; --reject-format) COMPREPLY=($(compgen -W 'context unified' -- "$cur")) return ;; --read-only) COMPREPLY=($(compgen -W 'ignore warn fail' -- "$cur")) return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return fi local args _count_args case $args in 1) _filedir ;; 2) _filedir '@(?(d)patch|dif?(f))' ;; esac } && complete -F _patch patch # ex: filetype=sh rpcdebug 0000644 00000001742 15036124164 0006270 0 ustar 00 # bash completion for rpcdebug -*- shell-script -*- _rpcdebug_flags() { local i module for ((i = 1; i < ${#words[@]}; i++)); do if [[ ${words[i]} == -m ]]; then module=${words[i + 1]} break fi done if [[ -n $module ]]; then COMPREPLY=($(compgen -W "$(rpcdebug -vh 2>&1 | command sed -ne 's/^'$module'[[:space:]]\{1,\}//p')" -- "$cur")) fi } _rpcdebug() { local cur prev words cword _init_completion || return case $prev in -*s) _rpcdebug_flags return ;; -*c) _rpcdebug_flags return ;; -*m) COMPREPLY=($(compgen -W 'rpc nfs nfsd nlm' -- "$cur")) return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_usage "$1" -h) -s -c' -- "$cur")) fi } && complete -F _rpcdebug rpcdebug # ex: filetype=sh pkgadd 0000644 00000003346 15036124164 0005731 0 ustar 00 # pkgadd completion -*- shell-script -*- # # Copyright 2006 Yann Rouillard <yann@opencsw.org> _pkgadd() { local cur prev words cword _init_completion -n : || return # if a device directory was given # we must complete with the package # available in this directory local device=/var/spool/pkg local i=$cword while ((i-- > 0)); do case "${words[i]}" in -d) device="${words[i + 1]}" break ;; esac done case $prev in -d) _filedir pkg _filedir -d ;; -a | -r | -V) _filedir ;; -k | -s | -R) _filedir -d ;; -P | -x) ;; *) if [[ ${cur} == -* ]]; then local opts="-a -A -d -k -n -M -P -r -R -s -v -V -x" COMPREPLY=($(compgen -W "${opts}" -- ${cur})) else local pkginst_list if [[ -d $device ]]; then local -a tmplist for filedir in $(/bin/ls -1 $device); do if [[ -d "$device/$filedir" ]] && [[ -f "$device/$filedir/pkginfo" ]]; then tmplist+=(${tmplist[@]:-} "$filedir") fi done pkginst_list="${tmplist[*]}" else pkginst_list="$(strings "$(dequote $device)" | command grep ^PKG= | sort -u | cut -d= -f2)" fi COMPREPLY=($(compgen -W "$pkginst_list" -- ${cur})) fi ;; esac } && complete -F _pkgadd pkgadd # ex: filetype=sh ipv6calc 0000644 00000002017 15036124164 0006200 0 ustar 00 # ipv6calc completion -*- shell-script -*- _ipv6calc() { local cur prev words cword split _init_completion -s || return case "$prev" in --debug | -!(-*)d) return ;; --in | --out | --action | -!(-*)[IOA]) # With ipv6calc < 0.73.0, -m does nothing here, so use sed instead. COMPREPLY=($(compgen -W "$($1 "$prev" -h 2>&1 | command sed -ne 's/^[[:space:]]\{1,\}\([^[:space:]:]\{1,\}\)[[:space:]]*:.*/\1/p')" \ -- "$cur")) return ;; --db-geoip | --db-ip2location-ipv4 | --db-ip2location-ipv6) _filedir return ;; --printstart | --printend) return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$("$1" -h 2>&1 | command sed -e "s/[][]//g" | _parse_help -)' -- "$cur")) fi } && complete -F _ipv6calc ipv6calc # ex: filetype=sh unace 0000644 00000000730 15036124164 0005564 0 ustar 00 # unace(1) completion -*- shell-script -*- _unace() { local cur prev words cword _init_completion || return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '-c -c- -f -f- -o -o- -p -y -y-' -- "$cur")) else if ((cword == 1)); then COMPREPLY=($(compgen -W 'e l t v x' -- "$cur")) else _filedir ace fi fi } && complete -F _unace unace # ex: filetype=sh nc 0000644 00000002316 15036124164 0005073 0 ustar 00 # nc(1) completion -*- shell-script -*- _nc() { local cur prev words cword _init_completion -n : || return case $prev in -*[hIiMmOPpqVWw]) return ;; -*s) if [[ ${words[*]} == *-6* ]]; then _ip_addresses -6 __ltrim_colon_completions "$cur" else _ip_addresses fi return ;; -*T) COMPREPLY=($(compgen -W 'critical inetcontrol lowcost lowdelay netcontrol throughput reliability ef af{11..43} cs{0..7}' \ -- "$cur")) return ;; -*X) COMPREPLY=($(compgen -W '4 5 connect' -- "$cur")) return ;; -*x) _known_hosts_real -- "$cur" return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1" -h)' -- "$cur")) return fi # Complete 1st non-option arg only local args _count_args "" "-*[IiMmOPpqsTVWwXx]" ((args == 1)) || return _known_hosts_real -- "$cur" } && complete -F _nc nc # ex: filetype=sh mplayer 0000644 00000026320 15036124164 0006145 0 ustar 00 # mplayer(1) completion -*- shell-script -*- _mplayer_options_list() { cur=${cur%\\} COMPREPLY=($(compgen -W "$($1 -noconfig all $2 help 2>/dev/null | command sed -e '/^Available/,/^$/!d' -e '/^Available/d' | awk '{print $1}' | command sed -e 's/:$//' -e 's/^'${2#-}'$//' -e 's/<.*//')" -- "$cur")) } _mplayer() { local cur prev words cword _init_completion -n : || return local cmd=${words[0]} i j k=0 case $prev in -[av][cfo] | -[av]fm | -vop | -fstype | -demuxer | -o[av]c | -of | -profile | \ -audio-demuxer | -sub-demuxer) _mplayer_options_list $cmd $prev return ;; -show-profile) _mplayer_options_list $cmd -profile return ;; -audiofile | -audio-file) _filedir '@(mp3|mpg|og[ag]|w?(a)v|mid|flac|mka|ac3|ape)' return ;; -font | -subfont) if [[ $prev == -font ]]; then _filedir '@(desc|ttf)' else _filedir ttf fi local IFS=$'\n' COMPREPLY+=($(compgen -W '$(fc-list 2>/dev/null)' -- "$cur")) return ;; -sub | -sub-file) _filedir '@(srt|sub|txt|utf|rar|mpsub|smi|js|ssa|ass)' return ;; -vobsub) _filedir '@(idx|ifo|sub)' local IFS=$'\n' COMPREPLY=($(for i in "${COMPREPLY[@]}"; do if [[ -f $i && -r $i ]]; then printf '%s\n' ${i%.*} else printf '%s\n' $i fi done)) return ;; -subcp | -msgcharset) local cp cp=($(iconv --list 2>/dev/null | command sed -e "s@//@@;" 2>/dev/null)) if [[ $cur == "${cur,,}" ]]; then COMPREPLY=($(compgen -W '${cp[@],,}' -- "$cur")) else COMPREPLY=($(compgen -W '${cp[@]^^}' -- "$cur")) fi return ;; -ifo) _filedir ifo return ;; -cuefile) _filedir '@(bin|cue)' return ;; -skin) # if you don't have installed mplayer in /usr you # may want to set the MPLAYER_SKINS_DIR global variable local -a dirs if [[ -n $MPLAYER_SKINS_DIR ]]; then dirs=($MPLAYER_SKINS_DIR) else dirs=(/usr/share/mplayer/skins /usr/local/share/mplayer/skins) fi local IFS=$'\n' for i in ~/.mplayer/skins "${dirs[@]}"; do if [[ -d $i && -r $i ]]; then for j in $(compgen -d -- $i/$cur); do COMPREPLY[k++]=${j#$i/} done fi done return ;; -cdrom-device) _cd_devices _dvd_devices return ;; -dvd-device) _dvd_devices _filedir iso return ;; -bluray-device) _filedir -d return ;; -mixer | -dvdauth | -fb | -zrdev) cur=${cur:=/dev/} _filedir return ;; -edl | -edlout | -lircconf | -menu-cfg | -playlist | -csslib | -dumpfile | \ -subfile | -aofile | -fbmodeconfig | -include | -o | -dvdkey | -passlogfile) _filedir return ;; -autoq | -autosync | -loop | -menu-root | -speed | -sstep | -aid | -alang | \ -bandwidth | -bluray-angle | -bluray-chapter | -cache | -chapter | -dvd-speed | \ -dvdangle | -fps | -frames | -mc | -passwd | -user | -sb | -srate | -ss | -vcd | \ -vi | -vid | -vivo | -ffactor | -sid | -slang | -spualign | -spuaa | -spugauss | \ -vobsubid | -delay | -bpp | -brightness | -contrast | -dfbopts | -display | \ -fbmode | -geometry | -guiwid | -hue | -icelayer | -screen[wh] | -wid | \ -monitor-dotclock | -monitor-[hv]freq | -panscan | \ -saturation | -xineramascreen | -zrcrop | -zrnorm | -zrquality | \ -zr[xy]doff | -zr[vh]dec | -pp | -x | -y | -xy | -z | -stereo | \ -audio-density | -audio-delay | -audio-preload | -endpos | -osdlevel | \ -ffourcc | -sws | -skiplimit | -format | -ofps | -aadriver | \ -aaosdcolor | -aasubcolor | -vobsubout | -vobsuboutid | -vobsuboutindex | \ -sub-bg-alpha | -sub-bg-color | -subdelay | -subfps | -subpos | \ -subalign | -subwidth | -subfont-blur | -subfont-outline | \ -subfont-autoscale | -subfont-encoding | -subfont-osd-scale | \ -subfont-text-scale) return ;; -channels) COMPREPLY=($(compgen -W '2 4 6 8' -- "$cur")) return ;; -aspect | -monitoraspect) COMPREPLY=($(compgen -W '1:1 3:2 4:3 5:4 14:9 14:10 16:9 16:10 2.35:1' -- "$cur")) __ltrim_colon_completions "$cur" return ;; -lavdopts) COMPREPLY=($(compgen -W 'bitexact bug= debug= ec= er= fast gray idct= lowres= sb= st= skiploopfilter= skipidct= skipframe= threads= vismv= vstats' -- "$cur")) return ;; -lavcopts) COMPREPLY=($(compgen -W 'vcodec= vqmin= vqscale= vqmax= mbqmin= mbqmax= vqdiff= vmax_b_frames= vme= vhq v4mv keyint= vb_strategy= vpass= aspect= vbitrate= vratetol= vrc_maxrate= vrc_minrate= vrc_buf_size= vb_qfactor= vi_qfactor= vb_qoffset= vi_qoffset= vqblur= vqcomp= vrc_eq= vrc_override= vrc_init_cplx= vqsquish= vlelim= vcelim= vstrict= vdpart vpsize= gray vfdct= idct= lumi_mask= dark_mask= tcplx_mask= scplx_mask= naq ildct format= pred qpel precmp= cmp= subcmp= predia= dia= trell last_pred= preme= subq= psnr mpeg_quant aic umv' -- "$cur")) return ;; -ssf) COMPREPLY=($(compgen -W 'lgb= cgb= ls= cs= chs= cvs=' -- "$cur")) return ;; -jpeg) COMPREPLY=($(compgen -W 'noprogressive progressive nobaseline baseline optimize= smooth= quality= outdir=' -- "$cur")) return ;; -xvidopts) COMPREPLY=($(compgen -W 'dr2 nodr2' -- "$cur")) return ;; -xvidencopts) COMPREPLY=($(compgen -W 'pass= bitrate= fixed_quant= me_quality= 4mv rc_reaction_delay_factor= rc_averaging_period= rc_buffer= quant_range= min_key_interval= max_key_interval= mpeg_quant mod_quant lumi_mask hintedme hintfile debug keyframe_boost= kfthreshold= kfreduction=' -- "$cur")) return ;; -divx4opts) COMPREPLY=($(compgen -W 'br= key= deinterlace q= min_quant= max_quant= rc_period= rc_reaction_period= crispness= rc_reaction_ratio= pass= vbrpass= help' -- "$cur")) return ;; -info) COMPREPLY=($(compgen -W 'name= artist= genre= subject= copyright= srcform= comment= help' -- "$cur")) return ;; -lameopts) COMPREPLY=($(compgen -W 'vbr= abr cbr br= q= aq= ratio= vol= mode= padding= fast preset= help' -- "$cur")) return ;; -rawaudio) COMPREPLY=($(compgen -W 'on channels= rate= samplesize= format=' \ -- "$cur")) return ;; -rawvideo) COMPREPLY=($(compgen -W 'on fps= sqcif qcif cif 4cif pal ntsc w= h= y420 yv12 yuy2 y8 format= size=' -- "$cur")) return ;; -aop) COMPREPLY=($(compgen -W 'list= delay= format= fout= volume= mul= softclip' -- "$cur")) return ;; -dxr2) COMPREPLY=($(compgen -W 'ar-mode= iec958-encoded iec958-decoded mute ucode= 75ire bw color interlaced macrovision= norm= square-pixel ccir601-pixel cr-left= cr-right= cr-top= cr-bot= ck-rmin= ck-gmin= ck-bmin= ck-rmax= ck-gmax= ck-bmax= ck-r= ck-g= ck-b= ignore-cache= ol-osd= olh-cor= olw-cor= olx-cor= oly-cor= overlay overlay-ratio= update-cache' -- "$cur")) return ;; -tv) COMPREPLY=($(compgen -W 'on noaudio driver= device= input= freq= outfmt= width= height= buffersize= norm= channel= chanlist= audiorate= forceaudio alsa amode= forcechan= adevice= audioid= volume= bass= treble= balance= fps= channels= immediatemode=' \ -- "$cur")) return ;; -mf) COMPREPLY=($(compgen -W 'on w= h= fps= type=' -- "$cur")) return ;; -cdda) COMPREPLY=($(compgen -W 'speed= paranoia= generic-dev= sector-size= overlap= toc-bias toc-offset= skip noskip' \ -- "$cur")) return ;; -input) COMPREPLY=($(compgen -W 'conf= ar-delay ar-rate keylist cmdlist js-dev file' -- "$cur")) return ;; -af-adv) COMPREPLY=($(compgen -W 'force= list=' -- "$cur")) return ;; -noconfig) COMPREPLY=($(compgen -W 'all gui system user' -- "$cur")) return ;; -*) # Assume arg is required for everything else except options # for which -list-options says Type is Flag or Print. $cmd -noconfig all -list-options 2>/dev/null | while read -r i j k; do if [[ $i == "${prev#-}" ]]; then [[ ${j,,} != @(flag|print) ]] && return 1 break fi done || return ;; esac case $cur in -*) COMPREPLY=($(compgen -W '$($cmd -noconfig all -list-options 2>/dev/null | \ command sed -ne "1,/^[[:space:]]*Name/d" \ -e "s/^[[:space:]]*/-/" -e "s/[[:space:]:].*//" \ -e "/^-\(Total\|.*\*\)\{0,1\}$/!p")' -- "$cur")) ;; *) _filedir '@(m?(j)p?(e)g|M?(J)P?(E)G|wm[av]|WM[AV]|avi|AVI|asf|ASF|vob|VOB|bin|BIN|dat|DAT|vcd|VCD|ps|PS|pes|PES|fl[iv]|FL[IV]|fxm|FXM|viv|VIV|rm?(j)|RM?(J)|ra?(m)|RA?(M)|yuv|YUV|mov|MOV|qt|QT|mp[234]|MP[234]|m?(p)4[av]|M?(P)4[AV]|og[gmavx]|OG[GMAVX]|w?(a)v|W?(A)V|dump|DUMP|mk[av]|MK[AV]|aac|AAC|m2v|M2V|dv|DV|rmvb|RMVB|mid|MID|t[ps]|T[PS]|3g[p2]|3gpp?(2)|mpc|MPC|flac|FLAC|vro|VRO|divx|DIVX|aif?(f)|AIF?(F)|m2t?(s)|M2T?(S)|mts|MTS|vdr|VDR|xvid|XVID|ape|APE|gif|GIF|nut|NUT|bik|BIK|web[am]|WEB[AM]|amr|AMR|awb|AWB|iso|ISO|opus|OPUS|m[eo]d|M[EO]D|xm|XM|it|IT|s[t3]m|S[T3]M|mtm|MTM|w64|W64)?(.@(crdownload|part))' ;; esac } && complete -F _mplayer mplayer mplayer2 mencoder gmplayer kplayer # ex: filetype=sh networkctl 0000644 00000004741 15036124164 0006673 0 ustar 00 # networkctl(1) completion -*- shell-script -*- # SPDX-License-Identifier: LGPL-2.1-or-later # # This file is part of systemd. # # systemd is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version. # # systemd is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with systemd; If not, see <http://www.gnu.org/licenses/>. __contains_word () { local w word=$1; shift for w in "$@"; do [[ $w = "$word" ]] && return done return 1 } __get_links() { networkctl list --no-legend --no-pager --all --full | { while read -r a b c; do echo " $b"; done; }; } _networkctl() { local i verb comps local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} words cword local -A OPTS=( [STANDALONE]='-a --all -h --help --version --no-pager --no-legend -s --stats -l --full' [ARG]='-n --lines --json' ) local -A VERBS=( [STANDALONE]='label reload' [LINKS]='status list lldp delete renew up down forcerenew reconfigure' ) _init_completion || return for ((i=0; i < COMP_CWORD; i++)); do if __contains_word "${COMP_WORDS[i]}" ${VERBS[*]} && ! __contains_word "${COMP_WORDS[i-1]}" ${OPTS[ARG]}; then verb=${COMP_WORDS[i]} break fi done if __contains_word "$prev" ${OPTS[ARG]}; then case $prev in --json) comps=$(networkctl --json=help | sort 2>/dev/null) ;; *) return 0 ;; esac COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 fi if [[ "$cur" = -* ]]; then COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") ) return 0 fi if [[ -z ${verb-} ]]; then comps=${VERBS[*]} elif __contains_word "$verb" ${VERBS[STANDALONE]}; then comps='' elif __contains_word "$verb" ${VERBS[LINKS]}; then comps=$( __get_links ) fi COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 } complete -F _networkctl networkctl _mount 0000644 00000004013 15036124164 0005770 0 ustar 00 # mount(8) completion -*- shell-script -*- # Use of this file is deprecated on Linux. Upstream completion is # available in util-linux >= 2.28, use that instead. if [[ $OSTYPE == *linux* ]]; then . "$BASH_SOURCE.linux" return fi # This will pull a list of possible mounts out of # /etc/{,v}fstab, unless the word being completed contains a ':', which # would indicate the specification of an NFS server. In that case, we # query the server for a list of all available exports and complete on # that instead. # _mount() { local cur prev words cword _init_completion -n : || return local sm host case $prev in -t | --types) _fstypes return ;; 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 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 | command sed -ne '/^[[:blank:]]*Sharename/,/^$/p' | command sed -ne '3,$s|^[^A-Za-z]*\([^[:blank:]]*\).*$|/\1|p')" \ -- "${cur#//$host}")) fi elif [[ -r /etc/vfstab ]]; then # Solaris COMPREPLY=($(compgen -W "$(awk '! /^[ \t]*#/ {if ($3 ~ /\//) print $3}' /etc/vfstab)" -- "$cur")) elif [[ ! -e /etc/fstab ]]; then # probably Cygwin COMPREPLY=($(compgen -W "$($1 | awk '! /^[ \t]*#/ {if ($3 ~ /\//) print $3}')" -- "$cur")) else # probably BSD COMPREPLY=($(compgen -W "$(awk '! /^[ \t]*#/ {if ($2 ~ /\//) print $2}' /etc/fstab)" -- "$cur")) fi } && complete -F _mount -o default -o dirnames mount # ex: filetype=sh ipmitool 0000644 00000013036 15036124164 0006330 0 ustar 00 # bash completion for ipmitool -*- shell-script -*- _ipmitool_singleline_help() { COMPREPLY=($(compgen -W "$($1 $2 2>&1 | command sed -ne 's/[,\r]//g' -e 's/^.*[Cc]ommands://p')" -- "$cur")) } _ipmitool() { local cur prev words cword _init_completion || return case $prev in -*[hVpUekyPmbtBTl]) return ;; -*d) COMPREPLY=($(compgen -W "$( command ls -d /dev/ipmi* /dev/ipmi/* /dev/ipmidev/* \ 2>/dev/null | command sed -ne 's/^[^0-9]*\([0-9]\{1,\}\)/\1/p' )" \ -- "$cur")) return ;; -*I) COMPREPLY=($(compgen -W "$($1 -h 2>&1 | command sed -e '/^Interfaces:/,/^[[:space:]]*$/!d' \ -ne 's/^[[:space:]]\{1,\}\([^[:space:]]\{1,\}\).*/\1/p')" \ -- "$cur")) return ;; -*H) _known_hosts_real -- "$cur" return ;; -*[fSO]) _filedir return ;; -*C) COMPREPLY=($(compgen -W '{0..14}' -- "$cur")) return ;; -*L) COMPREPLY=($(compgen -W 'CALLBACK USER OPERATOR ADMINISTRATOR' \ -- "$cur")) return ;; -*A) COMPREPLY=($(compgen -W 'NONE PASSWORD MD2 MD5 OEM' -- "$cur")) return ;; -*o) COMPREPLY=($(compgen -W "$($1 -o list 2>&1 | awk '/^[ \t]+/ { print $1 }') list" -- "$cur")) return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1" -h)' -- "$cur")) return fi # Find out command and subcommand local cmds=(raw i2c spd lan chassis power event mc sdr sensor fru gendev sel pef sol tsol isol user channel session sunoem kontronoem picmg fwum firewall shell exec set hpm ekanalyzer) local i c cmd subcmd for ((i = 1; i < ${#words[@]} - 1; i++)); do [[ -v cmd ]] && subcmd=${words[i]} && break for c in "${cmds[@]}"; do [[ ${words[i]} == "$c" ]] && cmd=$c && break done done if [[ ! -v cmd ]]; then COMPREPLY=($(compgen -W '${cmds[@]}' -- "$cur")) return fi # Command/subcommand completions case $cmd in shell) ;; \ exec) _filedir ;; chassis | power | kontronoem | fwum) _ipmitool_singleline_help $1 $cmd ;; lan) case $subcmd in print | set) ;; alert) [[ $prev == alert ]] && COMPREPLY=($(compgen -W 'print set' -- "$cur")) ;; stats) [[ $prev == stats ]] && COMPREPLY=($(compgen -W 'print set' -- "$cur")) ;; *) COMPREPLY=($(compgen -W 'print set alert stats' \ -- "$cur")) ;; esac ;; sdr) case $subcmd in get | info | type | list | entity) ;; elist) COMPREPLY=($(compgen -W 'all full compact event mclog fru generic' -- "$cur")) ;; dump) _filedir ;; fill) case $prev in fill) COMPREPLY=($(compgen -W 'sensors file' -- "$cur")) ;; file) _filedir ;; esac ;; *) COMPREPLY=($(compgen -W 'get info type list elist entity dump fill' -- "$cur")) ;; esac ;; sensor) case $subcmd in list | get | thresh) ;; *) COMPREPLY=($(compgen -W 'list get thresh' -- "$cur")) ;; esac ;; sel) case $subcmd in info | clear | list | elist | delete) ;; add | save | writeraw | readraw) _filedir ;; time) [[ $prev == time ]] && COMPREPLY=($(compgen -W 'get set' -- "$cur")) ;; *) COMPREPLY=($(compgen -W 'info clear list elist delete add get save writeraw readraw time' -- "$cur")) ;; esac ;; user) case $subcmd in summary | list | disable | enable | priv | test) ;; set) [[ $prev == set ]] && COMPREPLY=($(compgen -W 'name password' -- "$cur")) ;; *) COMPREPLY=($(compgen -W 'summary list set disable enable priv test' -- "$cur")) ;; esac ;; set) [[ $prev == set ]] && COMPREPLY=($(compgen -W 'hostname username password privlvl authtype localaddr targetaddr port csv verbose' -- "$cur")) ;; esac } && complete -F _ipmitool ipmitool # ex: filetype=sh gpg2 0000644 00000002514 15036124164 0005332 0 ustar 00 # gpg2(1) completion -*- shell-script -*- _gpg2() { local cur prev words cword _init_completion || return case $prev in --homedir) _filedir -d return ;; --sign | --clearsign | --options | --decrypt | -!(-*)s) _filedir return ;; --export | --sign-key | --lsign-key | --nrsign-key | --nrlsign-key | --edit-key) # return list of public keys COMPREPLY=($(compgen -W "$($1 --list-keys 2>/dev/null | command sed -ne \ 's@^pub.*/\([^ ]*\).*$@\1@p' -ne \ 's@^.*\(<\([^>]*\)>\).*$@\2@p')" -- "$cur")) return ;; --recipient | -!(-*)r) COMPREPLY=($(compgen -W "$($1 --list-keys 2>/dev/null | command sed -ne 's@^.*<\([^>]*\)>.*$@\1@p')" -- "$cur")) if [[ -e ~/.gnupg/gpg.conf ]]; then COMPREPLY+=($(compgen -W "$(command sed -ne \ 's@^[ \t]*group[ \t][ \t]*\([^=]*\).*$@\1@p' \ ~/.gnupg/gpg.conf)" -- "$cur")) fi return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$($1 --dump-options)' -- "$cur")) fi } && complete -F _gpg2 -o default gpg2 # ex: filetype=sh freebsd-update 0000644 00000001124 15036124164 0007361 0 ustar 00 # bash completion for FreeBSD update tool - freebsd-update -*- shell-script -*- [[ $OSTYPE == *freebsd* ]] || return 1 _freebsd_update() { local cur prev words cword _init_completion || return case $prev in -b | -d) _filedir -d return ;; -f) _filedir return ;; -k | -r | -s | -t) return ;; esac COMPREPLY=($(compgen -W "fetch cron upgrade install rollback IDS" -- \ $cur)) } && complete -F _freebsd_update freebsd-update # ex: filetype=sh xhost 0000644 00000000572 15036124164 0005642 0 ustar 00 # xhost(1) completion -*- shell-script -*- _xhost() { local cur prev words cword _init_completion || return case $cur in +*) _known_hosts_real -p+ -- "${cur:1}" ;; -*) _known_hosts_real -p- -- "${cur:1}" ;; *) _known_hosts_real -- "$cur" ;; esac } && complete -F _xhost xhost # ex: filetype=sh fio 0000644 00000004502 15036124164 0005247 0 ustar 00 # fio(1) completion -*- shell-script -*- _fio() { local cur prev words cword split _init_completion -s || return case $prev in --help | --version) return ;; --debug) local prefix= [[ $cur == *,* ]] && prefix="${cur%,*}," COMPREPLY=($(compgen -W "process file io mem blktrace verify random parse diskutil job mutex profile time net rate compress steadystate helperthread" -- "${cur##*,}")) ((${#COMPREPLY[@]} == 1)) && COMPREPLY=(${COMPREPLY/#/$prefix}) return ;; --output-format) COMPREPLY=($(compgen -W "terse json json+ normal" -- "$cur")) return ;; --terse-version) COMPREPLY=($(compgen -W "2 3" -- "$cur")) return ;; --cmdhelp) # TODO more commands? COMPREPLY=($(compgen -W "all" -- "$cur")) return ;; --enghelp) # TODO print ioengine help, or list available ioengines # TODO engine,help arg return ;; --eta) COMPREPLY=($(compgen -W "always never auto" -- "$cur")) return ;; --daemonize) _filedir pid return ;; --client) _known_hosts_real -- "$cur" return ;; --remote-config) _filedir job return ;; --idle-prof) COMPREPLY=($(compgen -W "system percpu calibrate" -- "$cur")) return ;; --inflate-log) _filedir log return ;; --trigger-file) _filedir return ;; --trigger | --trigger-remote) compopt -o filenames COMPREPLY=($(compgen -c -- "$cur")) return ;; --aux-path) _filedir -d return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return fi _filedir job } && complete -F _fio fio # ex: filetype=sh pm-is-supported 0000644 00000000520 15036124164 0007536 0 ustar 00 # pm-is-supported(1) completion -*- shell-script -*- _pm_is_supported() { local cur prev words cword _init_completion || return COMPREPLY=($(compgen -W '--help --suspend --hibernate --suspend-hybrid' \ -- "$cur")) } && complete -F _pm_is_supported pm-is-supported # ex: filetype=sh genaliases 0000644 00000000502 15036124164 0006601 0 ustar 00 # mailman genaliases completion -*- shell-script -*- _genaliases() { local cur prev words cword _init_completion || return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '--quiet --help' -- "$cur")) fi } && complete -F _genaliases genaliases # ex: filetype=sh firewall-cmd 0000644 00000024337 15036124164 0007050 0 ustar 00 # bash completion for firewall-cmd -*- shell-script -*- # Copyright (C) 2013 Red Hat, Inc. # # Authors: # Jiri Popelka <jpopelka@redhat.com> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # # TODO: find a way how to get the following options from firewall-cmd OPTIONS_LOCKDOWN="--add-lockdown-whitelist-command= --remove-lockdown-whitelist-command= \ --query-lockdown-whitelist-command= --list-lockdown-whitelist-commands \ --add-lockdown-whitelist-context= --remove-lockdown-whitelist-context= \ --query-lockdown-whitelist-context= --list-lockdown-whitelist-contexts \ --add-lockdown-whitelist-uid= --remove-lockdown-whitelist-uid= \ --query-lockdown-whitelist-uid= --list-lockdown-whitelist-uids \ --add-lockdown-whitelist-user= --remove-lockdown-whitelist-user= \ --query-lockdown-whitelist-user= --list-lockdown-whitelist-users" # can be used as standalone or with --permanent OPTIONS_CONFIG="--get-zones --get-services --get-icmptypes --get-helpers \ ${OPTIONS_LOCKDOWN} --list-all-zones \ --info-zone= --info-service= --info-icmptype= \ --info-ipset= --info-helper=" OPTIONS_ZONE_INTERFACES_SOURCES="\ --add-interface= --remove-interface= --query-interface= \ --list-interfaces --change-interface= --change-zone= \ --add-source= --remove-source= --query-source= \ --change-source= --list-sources" OPTIONS_ZONE_ACTION_ACTION="--add-service= --remove-service= --query-service= \ --add-port= --remove-port= --query-port= \ --add-source-port= --remove-source-port= --query-source-port= \ --add-protocol= --remove-protocol= --query-protocol= \ --add-icmp-block= --remove-icmp-block= --query-icmp-block= \ --add-forward-port= --remove-forward-port= --query-forward-port=" OPTIONS_ZONE_ADAPT_QUERY="--add-rich-rule= --remove-rich-rule= --query-rich-rule= \ --add-icmp-block-inversion --remove-icmp-block-inversion \ --query-icmp-block-inversion \ --add-forward --remove-forward --query-forward \ --add-masquerade --remove-masquerade --query-masquerade \ --list-services --list-ports --list-protocols \ --list-source-ports --list-icmp-blocks \ --list-forward-ports --list-rich-rules --list-all" OPTIONS_ZONE_PERMANENT_ONLY="--get-description --get-short \ --set-description= --set-short=" OPTIONS_IPSET_ACTION_ACTION="--add-entry= --remove-entry= --query-entry= --add-entries-from-file= --remove-entries-from-file" OPTIONS_IPSET_ADAPT_QUERY="--list-entries" # can be used with/without preceding --zone=<zone> OPTIONS_ZONE="${OPTIONS_ZONE_INTERFACES_SOURCES} \ ${OPTIONS_ZONE_ACTION_ACTION} ${OPTIONS_ZONE_ADAPT_QUERY} ${OPTIONS_ZONE_PERMANENT_ONLY}" OPTIONS_IPSET="${OPTIONS_IPSETACTION_ACTION} ${OPTIONS_IPSET_ADAPT_QUERY}" OPTIONS_PERMANENT_ONLY="--new-icmptype= --new-icmptype-from-file= --delete-icmptype= \ --new-service= --new-service-from-file= --delete-service= \ --new-zone= --new-zone-from-file= --delete-zone= \ --new-ipset= --new-helper-from-file= --delete-ipset= \ --new-helper= --new-helper-from-file= --delete-helper= \ --get-target --set-target= \ --path-zone= --path-service= --path-icmptype= \ --path-ipset= --path-helper=" OPTIONS_NEW_IPSET="--type= --option=" OPTIONS_NEW_HELPER="--module= --family=" OPTIONS_HELPER="" # can be used after --permanent OPTIONS_PERMANENT="${OPTIONS_CONFIG} --zone= ${OPTIONS_ZONE} \ ${OPTIONS_PERMANENT_ONLY}" OPTIONS_DIRECT="--passthrough \ --add-chain --remove-chain --query-chain --get-chains --get-all-chains \ --add-rule --remove-rule --remove-rules --query-rule --get-rules --get-all-rules \ --add-passthrough --remove-passthrough \ --query-passthrough --get-passthroughs --get-all-passthroughs" # these all can be used as a "first" option OPTIONS_GENERAL="--help --version \ --state --reload --complete-reload \ --panic-on --panic-off --query-panic \ --get-log-denied --set-log-denied= --get-ipset-types \ --lockdown-on --lockdown-off --query-lockdown \ --get-default-zone --set-default-zone= --get-active-zones \ --get-zone-of-interface= --get-zone-of-interface= \ ${OPTIONS_CONFIG} \ --zone= ${OPTIONS_ZONE} \ --permanent --direct" _firewall_cmd() { local cur prev words cword split _init_completion -s || return case $prev in --*-entries-from-file|--new-*-from-file) _filedir return ;; --new-ipset*) if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W "${OPTIONS_NEW_IPSET}" -- "$cur") ) fi ;; --new-helper*) if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W "${OPTIONS_NEW_HELPER}" -- "$cur") ) fi ;; --new-*) ;; --zone|--set-default-zone|--info-zone|--path-zone) if [[ ${words[@]} == *--permanent* ]]; then COMPREPLY=( $( compgen -W '`firewall-cmd --permanent --get-zones`' -- "$cur" ) ) else COMPREPLY=( $( compgen -W '`firewall-cmd --get-zones`' -- "$cur" ) ) fi ;; --zone=*) COMPREPLY=( $( compgen -W "${OPTIONS_ZONE}" -- "$cur" ) ) ;; --ipset=*) COMPREPLY=( $( compgen -W "${OPTIONS_IPSET}" -- "$cur" ) ) ;; --*-ipset) if [[ ${words[@]} == *--permanent* ]]; then COMPREPLY=( $( compgen -W '`firewall-cmd --permanent --get-ipsets`' -- "$cur" ) ) else COMPREPLY=( $( compgen -W '`firewall-cmd --get-ipsets`' -- "$cur" ) ) fi ;; --*-service) if [[ ${words[@]} == *--permanent* ]]; then COMPREPLY=( $( compgen -W '`firewall-cmd --permanent --get-services`' -- "$cur" ) ) else COMPREPLY=( $( compgen -W '`firewall-cmd --get-services`' -- "$cur" ) ) fi ;; --helper|--info-helper|--path-helper) if [[ ${words[@]} == *--permanent* ]]; then COMPREPLY=( $( compgen -W '`firewall-cmd --permanent --get-helpers`' -- "$cur" ) ) else COMPREPLY=( $( compgen -W '`firewall-cmd --get-helpers`' -- "$cur" ) ) fi ;; --helper=*) COMPREPLY=( $( compgen -W "${OPTIONS_HELPER}" -- "$cur" ) ) ;; --*-icmp-block|--info-icmptype|--path-icmptype) if [[ ${words[@]} == *--permanent* ]]; then COMPREPLY=( $( compgen -W '`firewall-cmd --permanent --get-icmptypes`' -- "$cur" ) ) else COMPREPLY=( $( compgen -W '`firewall-cmd --get-icmptypes`' -- "$cur" ) ) fi ;; --list-services|--add-service=*|--remove-service=*|--query-service=*|\ --list-ports|--add-port=*|--remove-port=*|--query-port=*|\ --list-source-ports|--add-source-port=*|--remove-source-port=*|--query-source-port=*|\ --list-protocols|--add-protocol=*|--remove-protocol=*|--query-protocol=*|\ --list-icmp-blocks|--add-icmp-block=*|--remove-icmp-block=*|--query-icmp-block=*|\ --list-forward-ports|--add-forward-port=*|--remove-forward-port=*|--query-forward-port=*|\ --list-interfaces|--add-interface=*|--remove-interface=*|--query-interface=*|\ --list-sources|--add-source=*|--remove-source=*|--query-source=*|\ --add-forward|--remove-forward|--query-forward|\ --add-masquerade|--remove-masquerade|--query-masquerade|--list-all|\ --get-description|--get-short|--set-description=*|--set-short=*) opts="" # --add and --remove can be used multiple times if [[ ( ${prev} == --add-* ) || ( ${prev} == --remove-* ) ]]; then [[ ${prev} == *=* ]] && opts="${prev%=*}=" || opts="${prev}" fi if [[ ! ${words[@]} == *--permanent* ]]; then opts="${opts} --permanent" [[ ${prev} == --add-* ]] && opts="${opts} --timeout=" fi [[ ! ${words[@]} == *--zone=* ]] && opts="${opts} --zone=" if [ -n "${opts}" ]; then COMPREPLY=( $( compgen -W "${opts}" -- "$cur" ) ) fi ;; --*-interface|--change-zone) _available_interfaces ;; --permanent) [[ ${words[@]} == *--direct* ]] && opts="${OPTIONS_DIRECT}" || opts="${OPTIONS_PERMANENT} --direct" COMPREPLY=( $( compgen -W "${opts}" -- "$cur" ) ) ;; --direct) [[ ${words[@]} == *--permanent* ]] && opts="${OPTIONS_DIRECT}" || opts="${OPTIONS_DIRECT} --permanent" COMPREPLY=( $( compgen -W "${opts}" -- "$cur" ) ) ;; --*-rich-rule) # to not be matched with --*-rule below return 0 ;; --passthrough|--*-chain|--get-chains|--*-rule|--get-rules|--remove-rules) COMPREPLY=( $( compgen -W 'ipv4 ipv6 eb' -- "$cur" ) ) ;; ipv4|ipv6|eb) if [[ ${words[@]} == *--passthrough* ]]; then return 0 else COMPREPLY=( $( compgen -W 'nat filter mangle' -- "$cur" ) ) fi ;; *) if [[ "$cur" == -* ]]; then if [[ ${words[@]} == *--new-ipset* ]]; then COMPREPLY=( $( compgen -W "${OPTIONS_NEW_IPSET}" -- "$cur") ) else COMPREPLY=( $( compgen -W "${OPTIONS_GENERAL}" -- "$cur") ) fi fi ;; esac # do not append a space to words that end with = [[ $COMPREPLY == *= ]] && compopt -o nospace } && complete -F _firewall_cmd firewall-cmd unrar 0000644 00000001147 15036124164 0005623 0 ustar 00 # unrar(1) completion -*- shell-script -*- _unrar() { local cur prev words cword _init_completion || return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '-ad -ap -av- -c- -cfg- -cl -cu -dh -ep -f -idp -ierr -inul -kb -o+ -o- -ow -p -p- -r -ta -tb -tn -to -u -v -ver -vp -x -x@ -y' -- "$cur")) else if ((cword == 1)); then COMPREPLY=($(compgen -W 'e l lb lt p t v vb vt x' -- "$cur")) else _filedir '@(rar|exe)' fi fi } && complete -F _unrar unrar # ex: filetype=sh xzdec 0000644 00000001177 15036124164 0005614 0 ustar 00 # xzdec(1) completion -*- shell-script -*- _xzdec() { local cur prev words cword split _init_completion -s || return case $prev in --memory | -!(-*)M) return ;; --help | --version | -!(-*)[hV]) return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return fi _filedir xz # no lzma support here as of xz 4.999.9beta } && complete -F _xzdec xzdec # ex: filetype=sh wsimport 0000644 00000002146 15036124164 0006360 0 ustar 00 # wsimport(1) completion -*- shell-script -*- _wsimport() { local cur prev words cword _init_completion -n : || return case $prev in -help | -version | -B | -p | -wsdllocation) return ;; -b) _filedir '@(xml|xjb)' return ;; -catalog) _filedir '@(xml|soc|catalog)' return ;; -d | –s) _filedir -d return ;; -target) COMPREPLY=($(compgen -W '2.0 2.1 2.2' -- "$cur")) return ;; -clientjar) _filedir jar return ;; esac if [[ $cur == -httpproxy:* ]]; then _known_hosts_real -- "${cur#-httpproxy:}" return elif [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1" -help)' -- "$cur")) [[ ${COMPREPLY-} == *: ]] && compopt -o nospace __ltrim_colon_completions "$cur" return fi _filedir wsdl } && complete -F _wsimport wsimport # ex: filetype=sh find 0000644 00000007472 15036124164 0005423 0 ustar 00 # bash completion for GNU find -*- shell-script -*- # This makes heavy use of ksh style extended globs and contains Linux specific # code for completing the parameter to the -fstype option. _find() { local cur prev words cword _init_completion || return local i for i in ${!words[*]}; do if [[ ${words[i]} == -@(exec|ok)?(dir) ]]; then _command_offset $((i + 1)) return fi done case $prev in -maxdepth | -mindepth) COMPREPLY=($(compgen -W '{0..9}' -- "$cur")) return ;; -newer | -anewer | -cnewer | -fls | -fprint | -fprint0 | -fprintf | -name | -[il]name | \ -ilname | -wholename | -[il]wholename | -samefile) _filedir return ;; -fstype) _fstypes [[ $OSTYPE == *bsd* ]] && COMPREPLY+=($(compgen -W 'local rdonly' -- "$cur")) return ;; -gid) _gids return ;; -group) COMPREPLY=($(compgen -g -- "$cur" 2>/dev/null)) return ;; -xtype | -type) COMPREPLY=($(compgen -W 'b c d p f l s' -- "$cur")) return ;; -uid) _uids return ;; -user) COMPREPLY=($(compgen -u -- "$cur")) return ;; -[acm]min | -[acm]time | -inum | -path | -ipath | -regex | -iregex | -links | -perm | \ -size | -used | -printf | -context) # do nothing, just wait for a parameter to be given return ;; -regextype) COMPREPLY=($(compgen -W 'emacs posix-awk posix-basic posix-egrep posix-extended' -- "$cur")) return ;; esac local i exprfound=false # set exprfound to true if there is already an expression present for i in "${words[@]}"; do [[ $i == [-\(\),\!]* ]] && exprfound=true && break done # handle case where first parameter is not a dash option if ! $exprfound && [[ $cur != [-\(\),\!]* ]]; then _filedir -d return fi # complete using basic options 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")) if ((${#COMPREPLY[@]} != 0)); then # this removes any options from the list of completions that have # already been specified somewhere on the command line, as long as # these options can only be used once (in a word, "options", in # opposition to "tests" and "actions", as in the find(1) manpage). local -A onlyonce=([-daystart]=1 [-depth]=1 [-follow]=1 [-help]=1 [-ignore_readdir_race]=1 [-maxdepth]=1 [-mindepth]=1 [-mount]=1 [-noignore_readdir_race]=1 [-noleaf]=1 [-nowarn]=1 [-regextype]=1 [-version]=1 [-warn]=1 [-xdev]=1) local j for i in "${words[@]}"; do [[ $i && -v onlyonce["$i"] ]] || continue for j in "${!COMPREPLY[@]}"; do [[ ${COMPREPLY[j]} == "$i" ]] && unset 'COMPREPLY[j]' done done fi _filedir } && complete -F _find find # ex: filetype=sh influx 0000644 00000001565 15036124164 0006005 0 ustar 00 # bash completion for influx(8) -*- shell-script -*- _influx() { local cur prev words cword _init_completion || return case $prev in -version | -port | -database | -password | -username | -execute | -pps) return ;; -host) _known_hosts_real -- "$cur" return ;; -format | -precision | -consistency) local args=$($1 --help 2>&1 | awk "\$1 == \"$prev\" { print \$2 }") COMPREPLY=($( IFS+="\"'|" compgen -W "$args" -- "$cur" )) return ;; -import | -path) _filedir return ;; esac [[ $cur == -* ]] && COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) } && complete -F _influx influx # ex: filetype=sh xmodmap 0000644 00000000665 15036124164 0006145 0 ustar 00 # xmodmap(1) completion -*- shell-script -*- _xmodmap() { local cur prev words cword _init_completion || return case $prev in -display | -e) return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1" -help)' -- "$cur")) return fi _filedir } && complete -F _xmodmap xmodmap # ex: filetype=sh rev 0000644 00000000660 15036124164 0005267 0 ustar 00 _rev_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS="--version --help" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 } complete -F _rev_module rev clone_member 0000644 00000001036 15036124164 0007120 0 ustar 00 # mailman clone_member completion -*- shell-script -*- _clone_member() { local cur prev words cword split _init_completion -s || return case $prev in -l | --listname) _xfunc list_lists _mailman_lists return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '--listname --remove --admin --quiet --nomodify --help' -- "$cur")) fi } && complete -F _clone_member clone_member # ex: filetype=sh look 0000644 00000001253 15036124164 0005436 0 ustar 00 _look_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-t'|'--terminate') COMPREPLY=( $(compgen -W "char" -- $cur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS="--alternative --alphanum --ignore-case --terminate --version --help" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac case $COMP_CWORD in 1) COMPREPLY=( $(compgen -W "$(look "$cur")" -- $cur) ) ;; 2) local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) ;; esac return 0 } complete -F _look_module look gphoto2 0000644 00000002600 15036124164 0006051 0 ustar 00 # bash completion for gphoto2(1) -*- shell-script -*- _gphoto2() { local cur prev words cword split _init_completion -s -n : || return case $prev in --debug-logfile) _filedir return ;; --hook-script) _filedir return ;; --filename) _filedir return ;; -u | --upload-file) _filedir return ;; --port) COMPREPLY=($(compgen -W "$($1 --list-ports 2>/dev/null | awk 'NR>3 { print $1 }')" -- "$cur")) __ltrim_colon_completions "$cur" return ;; --camera) local IFS=$'\n' COMPREPLY=($(compgen -W "$($1 --list-cameras 2>/dev/null | awk -F'"' 'NR>2 { print $2 }')" -- "$cur")) return ;; --get-config | --set-config | --set-config-index | --set-config-value) COMPREPLY=($(compgen -W "$( $1 --list-config 2>/dev/null )" -- "$cur")) return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace fi } && complete -F _gphoto2 gphoto2 # ex: filetype=sh tipc 0000644 00000020132 15036124164 0005426 0 ustar 00 # tipc(8) completion -*- shell-script -*- _tipc_media() { local optind=$1 if ((cword == optind)); then COMPREPLY=($(compgen -W 'media' -- $cur)) return 0 elif ((cword == optind + 1)); then COMPREPLY=($(compgen -W 'udp eth ib' -- $cur)) return 0 fi return 1 } _tipc_bearer() { local optind=$1 local media i if _tipc_media $optind; then return fi for ((i = 0; i < cword; i++)); do if [[ ${words[i]} == 'media' ]]; then media=${words[i + 1]} fi done if ((cword == optind + 2)); then case "$media" in "udp") COMPREPLY=($(compgen -W 'name' -- $cur)) ;; "eth" | "ib") COMPREPLY=($(compgen -W 'device' -- $cur)) ;; esac elif ((cword == optind + 3)); then case "$media" in "udp") local names=$(tipc bearer list 2>/dev/null | awk -F: '/^udp:/ {print $2}') COMPREPLY=($(compgen -W '$names' -- $cur)) ;; "eth") local interfaces=$(command ls /sys/class/net/) COMPREPLY=($(compgen -W '$interfaces' -- $cur)) ;; esac fi } _tipc_link_opts() { COMPREPLY=($(compgen -W 'priority tolerance window' -- $cur)) } _tipc_link() { local optind=$1 local filter=$2 if ((cword == optind)); then COMPREPLY=($(compgen -W 'link' -- $cur)) elif ((cword == optind + 1)); then # awk drops link state and last trailing : local links=$(tipc link list 2>/dev/null | awk '{print substr($1, 0, length($1))}') local -a exclude [[ $filter == peers ]] && exclude=(-X broadcast-link) COMPREPLY=($(compgen "${exclude[@]}" -W '$links' -- $cur)) fi } _tipc() { local cur prev words cword optind i p _init_completion || return optind=1 COMPREPLY=() # Flags can be placed anywhere in the commandline case "$cur" in -*) COMPREPLY=($(compgen -W '-h --help' -- $cur)) return ;; esac if ((cword == 1)); then COMPREPLY=($(compgen -W 'bearer link media nametable node socket' -- $cur)) return fi case "${words[optind]}" in bearer) ((optind++)) if ((cword == optind)); then COMPREPLY=($(compgen -W 'enable disable set get list' -- $cur)) return fi case "${words[optind]}" in enable) local media params ((optind++)) if ((cword < optind + 4)); then _tipc_bearer $optind return fi for ((i = 0; i < cword; i++)); do if [[ ${words[i]} == 'media' ]]; then media=${words[i + 1]} fi done case "$media" in "udp") declare -a params=("localip" "localport" "remoteip" "remoteport" "domain" "priority") ;; "eth" | "ib") declare -a params=("domain" "priority") ;; *) return ;; esac # If the previous word was a known parameter, we assume a value for # that key. Note that this would break if the user attempts to use # a known key as value. for i in "${params[@]}"; do if [[ $prev == "$i" ]]; then return fi done # In order not to print already used options, we remove them for p in "${words[@]}"; do for i in "${params[@]}"; do if [[ $p == "$i" ]]; then params=("${params[@]/$i/}") fi done done COMPREPLY=($(compgen -W '${params[@]}' -- $cur)) ;; disable) ((optind++)) _tipc_bearer $optind ;; get) ((optind++)) if ((cword == optind)); then _tipc_link_opts elif ((cword >= optind + 1)); then _tipc_bearer $((optind + 1)) fi ;; set) ((optind++)) if ((cword == optind)); then _tipc_link_opts elif ((cword >= optind + 2)); then _tipc_bearer $((optind + 2)) fi ;; esac ;; link) ((optind++)) if ((cword == optind)); then COMPREPLY=($(compgen -W 'get set list statistics' -- $cur)) return fi case "${words[optind]}" in get) ((optind++)) if ((cword == optind)); then _tipc_link_opts elif ((cword >= optind + 1)); then _tipc_link $((optind + 1)) "peers" fi ;; set) ((optind++)) if ((cword == optind)); then _tipc_link_opts elif ((cword >= optind + 2)); then _tipc_link $((optind + 2)) "peers" fi ;; statistics) ((optind++)) if ((cword == optind)); then COMPREPLY=($(compgen -W 'show reset' -- $cur)) return fi case "${words[optind]}" in show | reset) _tipc_link $((optind + 1)) ;; esac ;; esac ;; media) ((optind++)) if ((cword == optind)); then COMPREPLY=($(compgen -W 'get set list' -- $cur)) return fi case "${words[optind]}" in get) ((optind++)) if ((cword == optind)); then _tipc_link_opts elif ((cword >= optind + 1)); then _tipc_media $((optind + 1)) fi ;; set) ((optind++)) if ((cword == optind)); then _tipc_link_opts elif ((cword >= optind + 2)); then _tipc_media $((optind + 2)) fi ;; esac ;; nametable) ((optind++)) if ((cword == optind)); then COMPREPLY=($(compgen -W 'show' -- $cur)) fi ;; node) ((optind++)) if ((cword == optind)); then COMPREPLY=($(compgen -W 'list get set' -- $cur)) return fi case "${words[optind]}" in get | set) ((optind++)) if ((cword == optind)); then COMPREPLY=($(compgen -W 'address netid' -- $cur)) fi ;; esac ;; socket) ((optind++)) if ((cword == optind)); then COMPREPLY=($(compgen -W 'list' -- $cur)) fi ;; esac } && complete -F _tipc tipc # ex: filetype=sh cfdisk 0000644 00000001140 15036124164 0005730 0 ustar 00 _cfdisk_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-L'|'--color') COMPREPLY=( $(compgen -W "auto never always" -- $cur) ) return 0 ;; '-V'|'--version'|'h'|'--help') return 0 ;; esac case $cur in -*) OPTS=" --color --zero --lock --help --read-only --version" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac compopt -o bashdefault -o default COMPREPLY=( $(compgen -W "$(lsblk -pnro name)" -- $cur) ) return 0 } complete -F _cfdisk_module cfdisk iwlist 0000644 00000001137 15036124164 0006006 0 ustar 00 # iwlist completion -*- shell-script -*- _iwlist() { local cur prev words cword _init_completion || return if ((cword == 1)); then if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '--help --version' -- "$cur")) else _available_interfaces -w fi else COMPREPLY=($(compgen -W 'scan scanning freq frequency channel rate bit bitrate key enc encryption power txpower retry ap accesspoint peers event' -- "$cur")) fi } && complete -F _iwlist iwlist # ex: filetype=sh complete 0000644 00000002657 15036124164 0006313 0 ustar 00 # bash complete completion -*- shell-script -*- _complete() { local cur prev words cword _init_completion || return case $prev in -*o) COMPREPLY=($(compgen -W 'bashdefault default dirnames filenames nospace plusdirs' -- "$cur")) return ;; -*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 ;; -*C) COMPREPLY=($(compgen -A command -- "$cur")) return ;; -*F) COMPREPLY=($(compgen -A function -- "$cur")) return ;; -*p | -*r) COMPREPLY=($(complete -p | command sed -e 's|.* ||')) COMPREPLY=($(compgen -W '${COMPREPLY[@]}' -- "$cur")) return ;; esac if [[ $cur == -* ]]; then # relevant options completion local opts="-a -b -c -d -e -f -g -j -k -o -s -u -v -A -G -W -P -S -X" [[ $1 != compgen ]] && opts+=" -F -C" COMPREPLY=($(compgen -W "$opts" -- "$cur")) else COMPREPLY=($(compgen -A command -- "$cur")) fi } && complete -F _complete compgen complete # ex: filetype=sh cvsps 0000644 00000002714 15036124164 0005633 0 ustar 00 # bash completion for cvsps -*- shell-script -*- _cvsps() { local cur prev words cword _init_completion -n : || return case $prev in -h | -z | -f | -d | -l | --diff-opts | --debuglvl) return ;; -s) COMPREPLY=($(compgen -W "$($1 2>/dev/null | awk '/^PatchSet:?[ \t]/ { print $2 }')" -- "$cur")) return ;; -a) COMPREPLY=($(compgen -W "$($1 2>/dev/null | awk '/^Author:[ \t]/ { print $2 }')" -- "$cur")) return ;; -b) COMPREPLY=($(compgen -W "$($1 2>/dev/null | awk '/^Branch:[ \t]/ { print $2 }')" -- "$cur")) return ;; -r) COMPREPLY=($(compgen -W "$($1 2>/dev/null | awk '/^Tag:[ \t]+[^(]/ { print $2 }')" -- "$cur")) return ;; -p) _filedir -d return ;; --test-log) _filedir return ;; -Z) COMPREPLY=($(compgen -W '{1..9}' -- "$cur")) return ;; --root) _xfunc cvs _cvs_roots return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1" -h)' -- "$cur")) else _xfunc cvs _cvs_roots fi } && complete -F _cvsps cvsps # ex: filetype=sh svcadm 0000644 00000011772 15036124164 0005756 0 ustar 00 # svcadm completion -*- shell-script -*- # # Copyright 2006 Yann Rouillard <yann@opencsw.org> # # svcadm accept any complete FMRI or abbreviated FMRI # - a complete FMRI is svc:/foo/bar/bar/baz # - abbreviated FMRI are foo/bar/bar/baz, bar/bar/baz, bar/baz or baz # # The goal of this function is to be able to propose all alternatives, # but to not clutter the interface with all completions, we will only # cut every completion alternative at the next slash. # # For example, if the user types <nothing><tab>, we will propose for svc://foo/bar/bar/baz # the following completion: foo/, bar/ and baz # If the user types <b><tab>, we will propose: bar/ and baz # If the user types <bar/><tab>, we will propose: bar/bar/ and bar/baz # # By default, the function proproses only abbreviated completions except if the user already # began to type svc:. In that case we will propose only the complete FMRI beginning with the # pattern # _smf_complete_fmri() { local cur="$1" prefix="$2" local cur_prefix fmri fmri_list="" local exact_mode pattern if [[ $cur == $prefix* ]]; then [[ $cur == "$prefix" ]] && cur+="/" pattern="$cur*" exact_mode=1 else pattern="$prefix*/$cur*" fi cur_prefix="${cur%"${cur##*/}"}" for fmri in $(svcs -H -o FMRI "$pattern" 2>/dev/null); do local fmri_part_list fmri_part if [[ -z $exact_mode ]]; then fmri=${fmri#$prefix/} # we generate all possibles abbrevations for the FMRI # no need to have a generic loop as we will have a finite # number of components local ifs="$IFS" IFS="/" set -- $fmri IFS=$ifs case $# in 1) fmri_part_list=" $1" ;; 2) fmri_part_list=" $2 $1/$2" ;; 3) fmri_part_list=" $3 $2/$3 $1/$2/$3" ;; 4) fmri_part_list=" $4 $3/$4 $2/$3/$4 $1/$2/$3/$4" ;; esac else fmri_part_list="$fmri" fi # Here we make sure the completions begins with the pattern and # we cut them at the first slash for fmri_part in $fmri_part_list; do [[ $fmri_part == $cur* ]] || continue local first_part=${fmri_part#$cur_prefix} first_part=$cur_prefix${first_part%%/*} [[ $first_part != "$fmri_part" ]] && first_part+="/" fmri_list+=" $first_part" done done COMPREPLY=($fmri_list) # here we want to detect if there only one completion proposed and that # it ends with a slash. That means the users will still have to complete # after, so we gain him one tab keystroke by immediately proposing the # next completion alternatives local i=${#COMPREPLY[*]} if [[ $i -gt 0 && ${COMPREPLY[--i]} == */ ]]; then # we have to iterate through the list as we may have duplicate while ((i != 0)); do [[ ${COMPREPLY[i]} != "${COMPREPLY[i - 1]}" ]] && break ((i--)) done if ((i == 0)); then _smf_complete_fmri "${COMPREPLY[0]}" "$prefix" return fi fi # Work-around bash_completion issue where bash interprets a colon # as a separator, borrowed from maven completion code which borrowed # it from darcs completion code :) local colonprefixes=${cur%"${cur##*:}"} local i=${#COMPREPLY[*]} while ((i-- > 0)); do COMPREPLY[i]=${COMPREPLY[i]#"$colonprefixes"} done } _svcadm() { local cur prev words cword _init_completion -n : || return local command_list="enable disable restart refresh clear mark milestone" local command i for ((i = 1; i < cword; i++)); do if [[ ${words[i]} == @(enable|disable|restart|refresh|clear|mark|milestone) ]]; then command=${words[i]} fi done if [[ ! -v command ]]; then if [[ ${cur} == -* ]]; then COMPREPLY=($(compgen -W "-v" -- ${cur})) else COMPREPLY=($(compgen -W "$command_list" -- ${cur})) fi else if [[ ${cur} == -* ]]; then case "$command" in enable) COMPREPLY=($(compgen -W "-r -s -t" -- ${cur})) ;; disable) COMPREPLY=($(compgen -W "-s -t" -- ${cur})) ;; mark) COMPREPLY=($(compgen -W "-I -t" -- ${cur})) ;; milestone) COMPREPLY=($(compgen -W "-d" -- ${cur})) ;; esac else if [[ $command == "mark" ]] && [[ $prev != @(degraded|maintenance) ]]; then COMPREPLY=($(compgen -W "degraded maintenance" -- ${cur})) elif [[ $command == "milestone" ]]; then _smf_complete_fmri "${cur}" "svc:/milestone" else _smf_complete_fmri "${cur}" "svc:" fi fi fi } && complete -F _svcadm svcadm # ex: filetype=sh xxd 0000644 00000000753 15036124164 0005301 0 ustar 00 # xxd(1) completion -*- shell-script -*- _xxd() { local cur prev words cword _init_completion || return case $prev in -h | -help | -c | -cols | -g | -groupsize | -l | -len | -s | -seek | -v | -version) return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1" -h)' -- "$cur")) return fi _filedir } && complete -F _xxd xxd # ex: filetype=sh strings 0000644 00000002205 15036124164 0006161 0 ustar 00 # strings(1) completion -*- shell-script -*- _strings() { local cur prev words cword split _init_completion -s || return case $prev in --help | --version | --bytes | -!(-*)[hvVn]) return ;; --radix | -!(-*)t) COMPREPLY=($(compgen -W 'o d x' -- "$cur")) return ;; --target | -!(-*)T) COMPREPLY=($(compgen -W '$(LC_ALL=C "$1" --help 2>/dev/null | \ command sed -ne "s/: supported targets: \(.*\)/\1/p")' \ -- "$cur")) return ;; --encoding | -!(-*)e) COMPREPLY=($(compgen -W 's S b l B L' -- "$cur")) return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return elif [[ $cur == @* ]]; then cur=${cur:1} _filedir COMPREPLY=("${COMPREPLY[@]/#/@}") return fi _filedir } && complete -F _strings strings # ex: filetype=sh postmap 0000644 00000001674 15036124164 0006164 0 ustar 00 # postalias(1) and postmap(1) completion -*- shell-script -*- _postmap() { local cur prev words cword _init_completion || return case $prev in -c) _filedir -d return ;; -[dq]) return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_usage "$1")' -- "$cur")) return fi if [[ $cur == *:* ]]; then compopt -o filenames COMPREPLY=($(compgen -f -- "${cur#*:}")) else local len=${#cur} pval for pval in $(/usr/sbin/postconf -m 2>/dev/null); do if [[ $cur == "${pval:0:len}" ]]; then COMPREPLY+=("$pval:") fi done if [[ ! ${COMPREPLY-} ]]; then compopt -o filenames COMPREPLY=($(compgen -f -- "$cur")) fi fi } && complete -F _postmap postmap postalias # ex: filetype=sh mokutil 0000644 00000002245 15036124164 0006160 0 ustar 00 # mokutil(1) completion _mokutil() { local cur=${COMP_WORDS[COMP_CWORD]} if [[ "$cur" == -* ]]; then #COMPREPLY=( $( compgen -W "--help --list-enrolled --list-new --list-delete --import --delete --revoke-import --revoke-delete --export --password --clear-password --disable-validation --enable-validation --sb-state --test-key --reset --generate-hash --hash-file --root-pw --simple-hash" -- $cur ) ) COMPREPLY=( $( compgen -W '$( _parse_help "$1" --long-help ) -h -l -N -D -i -d -x -p -c -t -f -g -P -s -X' -- "$cur" ) ) [[ $COMPREPLY == *= ]] && compopt -o nospace return 0 fi case "${COMP_WORDS[COMP_CWORD-1]}" in --import|-i|--delete|-d|--test-key|-t|--hash-file|-f) _filedir return 0 ;; --import-hash|--delete-hash) COMPREPLY=( $( compgen -W "" ) ) return 0 ;; --set-verbosity) COMPREPLY=( $( compgen -W "true false") ) return 0 ;; --set-fallback-verbosity) COMPREPLY=( $( compgen -W "true false") ) return 0 ;; --set-fallback-noreboot) COMPREPLY=( $( compgen -W "true false") ) return 0 ;; --generate-hash|-g) COMPREPLY=( $( compgen -o nospace -P= -W "") ) return 0 ;; *) return 0 ;; esac } complete -F _mokutil mokutil systemd-path 0000644 00000003314 15036124164 0007114 0 ustar 00 # systemd-path(1) completion -*- shell-script -*- # SPDX-License-Identifier: LGPL-2.1-or-later # # This file is part of systemd. # # systemd is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version. # # systemd is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with systemd; If not, see <http://www.gnu.org/licenses/>. __contains_word () { local w word=$1; shift for w in "$@"; do [[ $w = "$word" ]] && return done return 1 } __get_names() { systemd-path | { while IFS=: read -r a b; do echo " $a"; done; } } _systemd_path() { local comps local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} words cword local -A OPTS=( [STANDALONE]='-h --help --version' [ARG]='--suffix' ) _init_completion || return if __contains_word "$prev" ${OPTS[ARG]}; then case $prev in --suffix) comps='' ;; esac COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 fi if [[ "$cur" = -* ]]; then COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") ) return 0 fi comps=$( __get_names ) COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 } complete -F _systemd_path systemd-path removepkg 0000644 00000001055 15036124164 0006471 0 ustar 00 # Slackware Linux removepkg completion -*- shell-script -*- _removepkg() { local cur prev words cword _init_completion || return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '-copy -keep -preserve -warn' -- "$cur")) return fi if [[ $cur == */* ]]; then _filedir return fi local root=${ROOT:-/} COMPREPLY=($( cd "$root/var/log/packages" 2>/dev/null || return 1 compgen -f -- "$cur" )) } && complete -F _removepkg removepkg # ex: filetype=sh yum-arch 0000644 00000000545 15036124164 0006222 0 ustar 00 # yum-arch(8) completion -*- shell-script -*- _yum_arch() { local cur prev words cword _init_completion || return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '-d -v -vv -n -c -z -s -l -q' -- "$cur")) else _filedir -d fi } && complete -F _yum_arch yum-arch # ex: filetype=sh arpspoof 0000644 00000001064 15036124164 0006323 0 ustar 00 # arpspoof completion -*- shell-script -*- _arpspoof() { local cur prev words cword _init_completion || return case $prev in -i) _available_interfaces -a return ;; -t) _known_hosts_real -- "$cur" return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_usage "$1")' -- "$cur")) else _known_hosts_real -- "$cur" fi } && complete -F _arpspoof arpspoof # ex: filetype=sh mr 0000644 00000005103 15036124164 0005106 0 ustar 00 # mr completion -*- shell-script -*- _mr() { local cur prev words cword _init_completion || return local help commands options help="$(PERLDOC_PAGER=cat PERLDOC=-otext "${1}" help 2>/dev/null)" commands="$( printf %s "$help" | while read -r _ options cmd _; do [[ $options != "[options]" ]] || printf "%s\n" "$cmd" done )" # Split [online|offline] and remove `action` placeholder. commands="${commands//@(action|[\[\|\]])/$'\n'}" # Add standard aliases. commands="${commands} ci co ls" # Determine if user has entered an `mr` command. Used to block top-level # (option and command) completions. local cmd i for ((i = 1; i < ${#words[@]} - 1; i++)); do if [[ $commands == *"${words[i]}"* ]]; then cmd="${words[i]}" break fi done # Complete options for specific commands. if [[ -v cmd ]]; then case $cmd in bootstrap) _filedir # Also complete stdin (-) as a potential bootstrap source. if [[ -z ${cur} || $cur == - ]] && [[ $prev != - ]]; then COMPREPLY+=(-) fi return ;; clean) if [[ ${cur} == -* ]]; then COMPREPLY=($(compgen -W '-f' -- "${cur}")) fi return ;; commit | ci | record) if [[ ${cur} == -* ]]; then COMPREPLY=($(compgen -W '-m' -- "${cur}")) fi return ;; run) COMPREPLY=($(compgen -c -- "${cur}")) return ;; *) # Do not complete any other command. return ;; esac fi # Complete top-level options and commands. case $prev in --config | -!(-*)c) _filedir return ;; --directory | -!(-*)d) _filedir -d return ;; esac if [[ $cur == -* ]]; then options="$(printf '%s\n' "$help" | _parse_help -)" # Remove short options (all have compatible long options). options="${options//-[a-z]$'\n'/}" # Remove deprecated options. options="${options//--path/}" COMPREPLY=($(compgen -W "${options}" -- "${cur}")) else COMPREPLY=($(compgen -W "${commands}" -- "${cur}")) fi } && complete -F _mr mr # ex: filetype=sh mcrypt 0000644 00000003457 15036124164 0006020 0 ustar 00 # mcrypt(1) completion -*- shell-script -*- # by Ariel Fermani <the_end@bbs.frc.utn.edu.ar> _mcrypt() { local cur prev words cword _init_completion || return case $prev in -g | --openpgp-z) COMPREPLY=($(compgen -W '{0..9}' -- "$cur")) return ;; -o | --keymode) COMPREPLY=($(compgen -W '$($1 --list-keymodes 2>/dev/null )' \ -- "$cur")) return ;; -m | --mode) COMPREPLY=($(compgen -W "$($1 --list 2>/dev/null | cut -d: -f2-)" \ -- "$cur")) return ;; -a | --algorithm) COMPREPLY=($(compgen -W "$($1 --list 2>/dev/null | awk '{print $1}')" -- "$cur")) return ;; -h | --hash) COMPREPLY=($(compgen -W '$($1 --list-hash 2>/dev/null | \ command sed -e 1d)' -- "$cur")) return ;; -k | -s | --key | --keysize) return ;; -f | -c | --keyfile | --config) _filedir return ;; --algorithms-directory | --modes-directory) _filedir -d return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) elif [[ ${words[0]} == mdecrypt ]]; then _filedir nc else local i decrypt=0 for ((i = 1; i < ${#words[@]} - 1; i++)); do if [[ ${words[i]} == -@(d|-decrypt) ]]; then _filedir nc decrypt=1 break fi done if ((decrypt == 0)); then _filedir fi fi } && complete -F _mcrypt mcrypt mdecrypt # ex: filetype=sh xdg-mime 0000644 00000004262 15036124164 0006204 0 ustar 00 # xdg-mime(1) completion -*- shell-script -*- _xdg_mime_mimetype() { COMPREPLY+=($(compgen -S / -W 'application audio font image message model multipart text video' -- "$cur")) [[ ${COMPREPLY-} == */ ]] && compopt -o nospace } _xdg_mime() { local cur prev words cword _init_completion || return local args _count_args if ((args == 1)); then if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '--help --manual --version' -- "$cur")) return fi COMPREPLY=($(compgen -W \ 'query default install uninstall' -- "$cur")) return fi case ${words[1]} in query) if ((args == 2)); then COMPREPLY=($(compgen -W 'filetype default' -- "$cur")) return fi case ${words[2]} in # TODO and args == 3 (takes only one arg!) filetype) _filedir ;; default) _xdg_mime_mimetype ;; esac ;; default) if ((args == 2)); then local IFS=$' \t\n' reset=$(shopt -p nullglob) shopt -s nullglob local -a desktops=(/usr/share/applications/*.desktop) desktops=("${desktops[@]##*/}") $reset IFS=$'\n' COMPREPLY=($(compgen -W '${desktops[@]}' -- "$cur")) else _xdg_mime_mimetype fi ;; install) if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '--mode --novendor' -- "$cur")) elif [[ $prev == --mode ]]; then COMPREPLY=($(compgen -W 'user system' -- "$cur")) else _filedir xml fi ;; uninstall) if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '--mode' -- "$cur")) elif [[ $prev == --mode ]]; then COMPREPLY=($(compgen -W 'user system' -- "$cur")) else _filedir xml fi ;; esac } && complete -F _xdg_mime xdg-mime # ex: filetype=sh bk 0000644 00000000655 15036124164 0005073 0 ustar 00 # BitKeeper completion -*- shell-script -*- # adapted from code by Bart Trojanowski <bart@jukie.net> _bk() { local cur prev words cword _init_completion || return local BKCMDS="$(bk help topics 2>/dev/null | awk '/^ bk/ { print $2 }' | xargs printf '%s ')" COMPREPLY=($(compgen -W "$BKCMDS" -- "$cur")) _filedir } && complete -F _bk bk # ex: filetype=sh sshfs 0000644 00000001067 15036124164 0005623 0 ustar 00 # sshfs(1) completion -*- shell-script -*- _sshfs() { local cur prev words cword _init_completion -n : || return _expand || return if [[ $cur == *:* ]]; then _xfunc ssh _scp_remote_files -d # unlike scp and rsync, sshfs works with 1 backslash instead of 3 COMPREPLY=("${COMPREPLY[@]//\\\\\\/\\}") return fi [[ $cur == @(*/|[.~])* ]] || _known_hosts_real -c -a -- "$cur" _xfunc ssh _scp_local_files -d } && complete -F _sshfs -o nospace sshfs # ex: filetype=sh newlist 0000644 00000001112 15036124164 0006151 0 ustar 00 # mailman newlist completion -*- shell-script -*- _newlist() { local cur prev words cword split _init_completion -s || return case $prev in -l | --language | -u | --urlhost | -e | --emailhost | --help) return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace else _xfunc list_lists _mailman_lists fi } && complete -F _newlist newlist # ex: filetype=sh mdtool 0000644 00000004112 15036124164 0005765 0 ustar 00 # mdtool completion -*- shell-script -*- _mdtool() { local cur prev words cword _init_completion || return local command i for ((i = 1; i < ${#words[@]} - 1; i++)); do if [[ ${words[i]} == @(build|generate-makefiles|setup) ]]; then command=${words[i]} break fi done if [[ -v command ]]; then case $command in "build") COMPREPLY=($(compgen -W '--f --buildfile --p --project' \ -S":" -- "$cur")) # TODO: This does not work :( #if [[ "$prev" == *: ]]; then # case $prev in # @(--p:|--project:)) # COMPREPLY=( $(compgen -f -G "*.mdp" -- "$cur") ) # ;; # @(--f:|--buildfile:)) # COMPREPLY=( $(compgen -f -G "*.mdp" -G "*.mds" -- "$cur") ) # ;; # esac #fi return ;; "generate-makefiles") compopt -o filenames COMPREPLY=($(compgen -o filenames -G"*.mds" -- "$cur")) if [[ $prev == *mds ]]; then COMPREPLY=($(compgen -W '--simple-makefiles --s --d:' \ -- "$cur")) fi return ;; "setup") # TODO: at least return filenames after these options. COMPREPLY=($(compgen -W 'install i uninstall u check-install ci update up list l list-av la list-update lu rep-add ra rep-remove rr rep-update ru rep-list rl reg-update reg-build rgu info rep-build rb pack p help h dump-file' \ -- "$cur")) return ;; esac fi COMPREPLY=($(compgen -W 'gsetup build dbgen project-export generate-makefiles gettext-update setup -q' -- "$cur")) } && complete -F _mdtool mdtool # ex: filetype=sh tcpkill 0000644 00000000670 15036124164 0006136 0 ustar 00 # tcpkill completion -*- shell-script -*- _tcpkill() { local cur prev words cword _init_completion || return case $prev in -*i) _available_interfaces -a return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '-i -1 -2 -3 -4 -5 -6 -7 -8 -9' -- "$cur")) fi } && complete -F _tcpkill tcpkill # ex: filetype=sh lsmem 0000644 00000002055 15036124164 0005610 0 ustar 00 _lsmem_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-o'|'--output') local prefix realcur OUTPUT_ALL OUTPUT realcur="${cur##*,}" prefix="${cur%$realcur}" OUTPUT_ALL='RANGE SIZE STATE REMOVABLE BLOCK NODE ZONES' for WORD in $OUTPUT_ALL; do if ! [[ $prefix == *"$WORD"* ]]; then OUTPUT="$WORD ${OUTPUT:-""}" fi done compopt -o nospace COMPREPLY=( $(compgen -P "$prefix" -W "$OUTPUT" -S ',' -- "$realcur") ) return 0 ;; '-s'|'--sysroot') local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -o dirnames -- ${cur:-"/"}) ) return 0 ;; '--summary') COMPREPLY=( $(compgen -W "never always only" -- $cur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac OPTS=" --json --pairs --all --bytes --noheadings --output --output-all --raw --sysroot --summary --help --version " COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 } complete -F _lsmem_module lsmem git 0000644 00000231631 15036124164 0005262 0 ustar 00 # bash/zsh completion support for core Git. # # Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org> # Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/). # Distributed under the GNU General Public License, version 2.0. # # The contained completion routines provide support for completing: # # *) local and remote branch names # *) local and remote tag names # *) .git/remotes file names # *) git 'subcommands' # *) git email aliases for git-send-email # *) tree paths within 'ref:path/to/file' expressions # *) file paths within current working directory and index # *) common --long-options # # To use these routines: # # 1) Copy this file to somewhere (e.g. ~/.git-completion.bash). # 2) Add the following line to your .bashrc/.zshrc: # source ~/.git-completion.bash # 3) Consider changing your PS1 to also show the current branch, # see git-prompt.sh for details. # # If you use complex aliases of form '!f() { ... }; f', you can use the null # command ':' as the first command in the function body to declare the desired # completion style. For example '!f() { : git commit ; ... }; f' will # tell the completion to use commit completion. This also works with aliases # of form "!sh -c '...'". For example, "!sh -c ': git commit ; ... '". # # If you have a command that is not part of git, but you would still # like completion, you can use __git_complete: # # __git_complete gl git_log # # Or if it's a main command (i.e. git or gitk): # # __git_complete gk gitk # # Compatible with bash 3.2.57. # # You can set the following environment variables to influence the behavior of # the completion routines: # # GIT_COMPLETION_CHECKOUT_NO_GUESS # # When set to "1", do not include "DWIM" suggestions in git-checkout # and git-switch completion (e.g., completing "foo" when "origin/foo" # exists). # # GIT_COMPLETION_SHOW_ALL # # When set to "1" suggest all options, including options which are # typically hidden (e.g. '--allow-empty' for 'git commit'). case "$COMP_WORDBREAKS" in *:*) : great ;; *) COMP_WORDBREAKS="$COMP_WORDBREAKS:" esac # Discovers the path to the git repository taking any '--git-dir=<path>' and # '-C <path>' options into account and stores it in the $__git_repo_path # variable. __git_find_repo_path () { if [ -n "${__git_repo_path-}" ]; then # we already know where it is return fi if [ -n "${__git_C_args-}" ]; then __git_repo_path="$(git "${__git_C_args[@]}" \ ${__git_dir:+--git-dir="$__git_dir"} \ rev-parse --absolute-git-dir 2>/dev/null)" elif [ -n "${__git_dir-}" ]; then test -d "$__git_dir" && __git_repo_path="$__git_dir" elif [ -n "${GIT_DIR-}" ]; then test -d "$GIT_DIR" && __git_repo_path="$GIT_DIR" elif [ -d .git ]; then __git_repo_path=.git else __git_repo_path="$(git rev-parse --git-dir 2>/dev/null)" fi } # Deprecated: use __git_find_repo_path() and $__git_repo_path instead # __gitdir accepts 0 or 1 arguments (i.e., location) # returns location of .git repo __gitdir () { if [ -z "${1-}" ]; then __git_find_repo_path || return 1 echo "$__git_repo_path" elif [ -d "$1/.git" ]; then echo "$1/.git" else echo "$1" fi } # Runs git with all the options given as argument, respecting any # '--git-dir=<path>' and '-C <path>' options present on the command line __git () { git ${__git_C_args:+"${__git_C_args[@]}"} \ ${__git_dir:+--git-dir="$__git_dir"} "$@" 2>/dev/null } # Removes backslash escaping, single quotes and double quotes from a word, # stores the result in the variable $dequoted_word. # 1: The word to dequote. __git_dequote () { local rest="$1" len ch dequoted_word="" while test -n "$rest"; do len=${#dequoted_word} dequoted_word="$dequoted_word${rest%%[\\\'\"]*}" rest="${rest:$((${#dequoted_word}-$len))}" case "${rest:0:1}" in \\) ch="${rest:1:1}" case "$ch" in $'\n') ;; *) dequoted_word="$dequoted_word$ch" ;; esac rest="${rest:2}" ;; \') rest="${rest:1}" len=${#dequoted_word} dequoted_word="$dequoted_word${rest%%\'*}" rest="${rest:$((${#dequoted_word}-$len+1))}" ;; \") rest="${rest:1}" while test -n "$rest" ; do len=${#dequoted_word} dequoted_word="$dequoted_word${rest%%[\\\"]*}" rest="${rest:$((${#dequoted_word}-$len))}" case "${rest:0:1}" in \\) ch="${rest:1:1}" case "$ch" in \"|\\|\$|\`) dequoted_word="$dequoted_word$ch" ;; $'\n') ;; *) dequoted_word="$dequoted_word\\$ch" ;; esac rest="${rest:2}" ;; \") rest="${rest:1}" break ;; esac done ;; esac done } # The following function is based on code from: # # bash_completion - programmable completion functions for bash 3.2+ # # Copyright © 2006-2008, Ian Macdonald <ian@caliban.org> # © 2009-2010, Bash Completion Maintainers # <bash-completion-devel@lists.alioth.debian.org> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see <http://www.gnu.org/licenses/>. # # The latest version of this software can be obtained here: # # http://bash-completion.alioth.debian.org/ # # RELEASE: 2.x # This function can be used to access a tokenized list of words # on the command line: # # __git_reassemble_comp_words_by_ref '=:' # if test "${words_[cword_-1]}" = -w # then # ... # fi # # The argument should be a collection of characters from the list of # word completion separators (COMP_WORDBREAKS) to treat as ordinary # characters. # # This is roughly equivalent to going back in time and setting # COMP_WORDBREAKS to exclude those characters. The intent is to # make option types like --date=<type> and <rev>:<path> easy to # recognize by treating each shell word as a single token. # # It is best not to set COMP_WORDBREAKS directly because the value is # shared with other completion scripts. By the time the completion # function gets called, COMP_WORDS has already been populated so local # changes to COMP_WORDBREAKS have no effect. # # Output: words_, cword_, cur_. __git_reassemble_comp_words_by_ref() { local exclude i j first # Which word separators to exclude? exclude="${1//[^$COMP_WORDBREAKS]}" cword_=$COMP_CWORD if [ -z "$exclude" ]; then words_=("${COMP_WORDS[@]}") return fi # List of word completion separators has shrunk; # re-assemble words to complete. for ((i=0, j=0; i < ${#COMP_WORDS[@]}; i++, j++)); do # Append each nonempty word consisting of just # word separator characters to the current word. first=t while [ $i -gt 0 ] && [ -n "${COMP_WORDS[$i]}" ] && # word consists of excluded word separators [ "${COMP_WORDS[$i]//[^$exclude]}" = "${COMP_WORDS[$i]}" ] do # Attach to the previous token, # unless the previous token is the command name. if [ $j -ge 2 ] && [ -n "$first" ]; then ((j--)) fi first= words_[$j]=${words_[j]}${COMP_WORDS[i]} if [ $i = $COMP_CWORD ]; then cword_=$j fi if (($i < ${#COMP_WORDS[@]} - 1)); then ((i++)) else # Done. return fi done words_[$j]=${words_[j]}${COMP_WORDS[i]} if [ $i = $COMP_CWORD ]; then cword_=$j fi done } if ! type _get_comp_words_by_ref >/dev/null 2>&1; then _get_comp_words_by_ref () { local exclude cur_ words_ cword_ if [ "$1" = "-n" ]; then exclude=$2 shift 2 fi __git_reassemble_comp_words_by_ref "$exclude" cur_=${words_[cword_]} while [ $# -gt 0 ]; do case "$1" in cur) cur=$cur_ ;; prev) prev=${words_[$cword_-1]} ;; words) words=("${words_[@]}") ;; cword) cword=$cword_ ;; esac shift done } fi # Fills the COMPREPLY array with prefiltered words without any additional # processing. # Callers must take care of providing only words that match the current word # to be completed and adding any prefix and/or suffix (trailing space!), if # necessary. # 1: List of newline-separated matching completion words, complete with # prefix and suffix. __gitcomp_direct () { local IFS=$'\n' COMPREPLY=($1) } # Similar to __gitcomp_direct, but appends to COMPREPLY instead. # Callers must take care of providing only words that match the current word # to be completed and adding any prefix and/or suffix (trailing space!), if # necessary. # 1: List of newline-separated matching completion words, complete with # prefix and suffix. __gitcomp_direct_append () { local IFS=$'\n' COMPREPLY+=($1) } __gitcompappend () { local x i=${#COMPREPLY[@]} for x in $1; do if [[ "$x" == "$3"* ]]; then COMPREPLY[i++]="$2$x$4" fi done } __gitcompadd () { COMPREPLY=() __gitcompappend "$@" } # Generates completion reply, appending a space to possible completion words, # if necessary. # It accepts 1 to 4 arguments: # 1: List of possible completion words. # 2: A prefix to be added to each possible completion word (optional). # 3: Generate possible completion matches for this word (optional). # 4: A suffix to be appended to each possible completion word (optional). __gitcomp () { local cur_="${3-$cur}" case "$cur_" in *=) ;; --no-*) local c i=0 IFS=$' \t\n' for c in $1; do if [[ $c == "--" ]]; then continue fi c="$c${4-}" if [[ $c == "$cur_"* ]]; then case $c in --*=|*.) ;; *) c="$c " ;; esac COMPREPLY[i++]="${2-}$c" fi done ;; *) local c i=0 IFS=$' \t\n' for c in $1; do if [[ $c == "--" ]]; then c="--no-...${4-}" if [[ $c == "$cur_"* ]]; then COMPREPLY[i++]="${2-}$c " fi break fi c="$c${4-}" if [[ $c == "$cur_"* ]]; then case $c in *=|*.) ;; *) c="$c " ;; esac COMPREPLY[i++]="${2-}$c" fi done ;; esac } # Clear the variables caching builtins' options when (re-)sourcing # the completion script. if [[ -n ${ZSH_VERSION-} ]]; then unset ${(M)${(k)parameters[@]}:#__gitcomp_builtin_*} 2>/dev/null else unset $(compgen -v __gitcomp_builtin_) fi # This function is equivalent to # # __gitcomp "$(git xxx --git-completion-helper) ..." # # except that the output is cached. Accept 1-3 arguments: # 1: the git command to execute, this is also the cache key # 2: extra options to be added on top (e.g. negative forms) # 3: options to be excluded __gitcomp_builtin () { # spaces must be replaced with underscore for multi-word # commands, e.g. "git remote add" becomes remote_add. local cmd="$1" local incl="${2-}" local excl="${3-}" local var=__gitcomp_builtin_"${cmd//-/_}" local options eval "options=\${$var-}" if [ -z "$options" ]; then local completion_helper if [ "${GIT_COMPLETION_SHOW_ALL-}" = "1" ]; then completion_helper="--git-completion-helper-all" else completion_helper="--git-completion-helper" fi # leading and trailing spaces are significant to make # option removal work correctly. options=" $incl $(__git ${cmd/_/ } $completion_helper) " || return for i in $excl; do options="${options/ $i / }" done eval "$var=\"$options\"" fi __gitcomp "$options" } # Variation of __gitcomp_nl () that appends to the existing list of # completion candidates, COMPREPLY. __gitcomp_nl_append () { local IFS=$'\n' __gitcompappend "$1" "${2-}" "${3-$cur}" "${4- }" } # Generates completion reply from newline-separated possible completion words # by appending a space to all of them. # It accepts 1 to 4 arguments: # 1: List of possible completion words, separated by a single newline. # 2: A prefix to be added to each possible completion word (optional). # 3: Generate possible completion matches for this word (optional). # 4: A suffix to be appended to each possible completion word instead of # the default space (optional). If specified but empty, nothing is # appended. __gitcomp_nl () { COMPREPLY=() __gitcomp_nl_append "$@" } # Fills the COMPREPLY array with prefiltered paths without any additional # processing. # Callers must take care of providing only paths that match the current path # to be completed and adding any prefix path components, if necessary. # 1: List of newline-separated matching paths, complete with all prefix # path components. __gitcomp_file_direct () { local IFS=$'\n' COMPREPLY=($1) # use a hack to enable file mode in bash < 4 compopt -o filenames +o nospace 2>/dev/null || compgen -f /non-existing-dir/ >/dev/null || true } # Generates completion reply with compgen from newline-separated possible # completion filenames. # It accepts 1 to 3 arguments: # 1: List of possible completion filenames, separated by a single newline. # 2: A directory prefix to be added to each possible completion filename # (optional). # 3: Generate possible completion matches for this word (optional). __gitcomp_file () { local IFS=$'\n' # XXX does not work when the directory prefix contains a tilde, # since tilde expansion is not applied. # This means that COMPREPLY will be empty and Bash default # completion will be used. __gitcompadd "$1" "${2-}" "${3-$cur}" "" # use a hack to enable file mode in bash < 4 compopt -o filenames +o nospace 2>/dev/null || compgen -f /non-existing-dir/ >/dev/null || true } # Execute 'git ls-files', unless the --committable option is specified, in # which case it runs 'git diff-index' to find out the files that can be # committed. It return paths relative to the directory specified in the first # argument, and using the options specified in the second argument. __git_ls_files_helper () { if [ "$2" = "--committable" ]; then __git -C "$1" -c core.quotePath=false diff-index \ --name-only --relative HEAD -- "${3//\\/\\\\}*" else # NOTE: $2 is not quoted in order to support multiple options __git -C "$1" -c core.quotePath=false ls-files \ --exclude-standard $2 -- "${3//\\/\\\\}*" fi } # __git_index_files accepts 1 or 2 arguments: # 1: Options to pass to ls-files (required). # 2: A directory path (optional). # If provided, only files within the specified directory are listed. # Sub directories are never recursed. Path must have a trailing # slash. # 3: List only paths matching this path component (optional). __git_index_files () { local root="$2" match="$3" __git_ls_files_helper "$root" "$1" "${match:-?}" | awk -F / -v pfx="${2//\\/\\\\}" '{ paths[$1] = 1 } END { for (p in paths) { if (substr(p, 1, 1) != "\"") { # No special characters, easy! print pfx p continue } # The path is quoted. p = dequote(p) if (p == "") continue # Even when a directory name itself does not contain # any special characters, it will still be quoted if # any of its (stripped) trailing path components do. # Because of this we may have seen the same directory # both quoted and unquoted. if (p in paths) # We have seen the same directory unquoted, # skip it. continue else print pfx p } } function dequote(p, bs_idx, out, esc, esc_idx, dec) { # Skip opening double quote. p = substr(p, 2) # Interpret backslash escape sequences. while ((bs_idx = index(p, "\\")) != 0) { out = out substr(p, 1, bs_idx - 1) esc = substr(p, bs_idx + 1, 1) p = substr(p, bs_idx + 2) if ((esc_idx = index("abtvfr\"\\", esc)) != 0) { # C-style one-character escape sequence. out = out substr("\a\b\t\v\f\r\"\\", esc_idx, 1) } else if (esc == "n") { # Uh-oh, a newline character. # We cannot reliably put a pathname # containing a newline into COMPREPLY, # and the newline would create a mess. # Skip this path. return "" } else { # Must be a \nnn octal value, then. dec = esc * 64 + \ substr(p, 1, 1) * 8 + \ substr(p, 2, 1) out = out sprintf("%c", dec) p = substr(p, 3) } } # Drop closing double quote, if there is one. # (There is not any if this is a directory, as it was # already stripped with the trailing path components.) if (substr(p, length(p), 1) == "\"") out = out substr(p, 1, length(p) - 1) else out = out p return out }' } # __git_complete_index_file requires 1 argument: # 1: the options to pass to ls-file # # The exception is --committable, which finds the files appropriate commit. __git_complete_index_file () { local dequoted_word pfx="" cur_ __git_dequote "$cur" case "$dequoted_word" in ?*/*) pfx="${dequoted_word%/*}/" cur_="${dequoted_word##*/}" ;; *) cur_="$dequoted_word" esac __gitcomp_file_direct "$(__git_index_files "$1" "$pfx" "$cur_")" } # Lists branches from the local repository. # 1: A prefix to be added to each listed branch (optional). # 2: List only branches matching this word (optional; list all branches if # unset or empty). # 3: A suffix to be appended to each listed branch (optional). __git_heads () { local pfx="${1-}" cur_="${2-}" sfx="${3-}" __git for-each-ref --format="${pfx//\%/%%}%(refname:strip=2)$sfx" \ "refs/heads/$cur_*" "refs/heads/$cur_*/**" } # Lists branches from remote repositories. # 1: A prefix to be added to each listed branch (optional). # 2: List only branches matching this word (optional; list all branches if # unset or empty). # 3: A suffix to be appended to each listed branch (optional). __git_remote_heads () { local pfx="${1-}" cur_="${2-}" sfx="${3-}" __git for-each-ref --format="${pfx//\%/%%}%(refname:strip=2)$sfx" \ "refs/remotes/$cur_*" "refs/remotes/$cur_*/**" } # Lists tags from the local repository. # Accepts the same positional parameters as __git_heads() above. __git_tags () { local pfx="${1-}" cur_="${2-}" sfx="${3-}" __git for-each-ref --format="${pfx//\%/%%}%(refname:strip=2)$sfx" \ "refs/tags/$cur_*" "refs/tags/$cur_*/**" } # List unique branches from refs/remotes used for 'git checkout' and 'git # switch' tracking DWIMery. # 1: A prefix to be added to each listed branch (optional) # 2: List only branches matching this word (optional; list all branches if # unset or empty). # 3: A suffix to be appended to each listed branch (optional). __git_dwim_remote_heads () { local pfx="${1-}" cur_="${2-}" sfx="${3-}" local fer_pfx="${pfx//\%/%%}" # "escape" for-each-ref format specifiers # employ the heuristic used by git checkout and git switch # Try to find a remote branch that cur_es the completion word # but only output if the branch name is unique __git for-each-ref --format="$fer_pfx%(refname:strip=3)$sfx" \ --sort="refname:strip=3" \ "refs/remotes/*/$cur_*" "refs/remotes/*/$cur_*/**" | \ uniq -u } # Lists refs from the local (by default) or from a remote repository. # It accepts 0, 1 or 2 arguments: # 1: The remote to list refs from (optional; ignored, if set but empty). # Can be the name of a configured remote, a path, or a URL. # 2: In addition to local refs, list unique branches from refs/remotes/ for # 'git checkout's tracking DWIMery (optional; ignored, if set but empty). # 3: A prefix to be added to each listed ref (optional). # 4: List only refs matching this word (optional; list all refs if unset or # empty). # 5: A suffix to be appended to each listed ref (optional; ignored, if set # but empty). # # Use __git_complete_refs() instead. __git_refs () { local i hash dir track="${2-}" local list_refs_from=path remote="${1-}" local format refs local pfx="${3-}" cur_="${4-$cur}" sfx="${5-}" local match="${4-}" local fer_pfx="${pfx//\%/%%}" # "escape" for-each-ref format specifiers __git_find_repo_path dir="$__git_repo_path" if [ -z "$remote" ]; then if [ -z "$dir" ]; then return fi else if __git_is_configured_remote "$remote"; then # configured remote takes precedence over a # local directory with the same name list_refs_from=remote elif [ -d "$remote/.git" ]; then dir="$remote/.git" elif [ -d "$remote" ]; then dir="$remote" else list_refs_from=url fi fi if [ "$list_refs_from" = path ]; then if [[ "$cur_" == ^* ]]; then pfx="$pfx^" fer_pfx="$fer_pfx^" cur_=${cur_#^} match=${match#^} fi case "$cur_" in refs|refs/*) format="refname" refs=("$match*" "$match*/**") track="" ;; *) for i in HEAD FETCH_HEAD ORIG_HEAD MERGE_HEAD REBASE_HEAD CHERRY_PICK_HEAD; do case "$i" in $match*) if [ -e "$dir/$i" ]; then echo "$pfx$i$sfx" fi ;; esac done format="refname:strip=2" refs=("refs/tags/$match*" "refs/tags/$match*/**" "refs/heads/$match*" "refs/heads/$match*/**" "refs/remotes/$match*" "refs/remotes/$match*/**") ;; esac __git_dir="$dir" __git for-each-ref --format="$fer_pfx%($format)$sfx" \ "${refs[@]}" if [ -n "$track" ]; then __git_dwim_remote_heads "$pfx" "$match" "$sfx" fi return fi case "$cur_" in refs|refs/*) __git ls-remote "$remote" "$match*" | \ while read -r hash i; do case "$i" in *^{}) ;; *) echo "$pfx$i$sfx" ;; esac done ;; *) if [ "$list_refs_from" = remote ]; then case "HEAD" in $match*) echo "${pfx}HEAD$sfx" ;; esac __git for-each-ref --format="$fer_pfx%(refname:strip=3)$sfx" \ "refs/remotes/$remote/$match*" \ "refs/remotes/$remote/$match*/**" else local query_symref case "HEAD" in $match*) query_symref="HEAD" ;; esac __git ls-remote "$remote" $query_symref \ "refs/tags/$match*" "refs/heads/$match*" \ "refs/remotes/$match*" | while read -r hash i; do case "$i" in *^{}) ;; refs/*) echo "$pfx${i#refs/*/}$sfx" ;; *) echo "$pfx$i$sfx" ;; # symbolic refs esac done fi ;; esac } # Completes refs, short and long, local and remote, symbolic and pseudo. # # Usage: __git_complete_refs [<option>]... # --remote=<remote>: The remote to list refs from, can be the name of a # configured remote, a path, or a URL. # --dwim: List unique remote branches for 'git switch's tracking DWIMery. # --pfx=<prefix>: A prefix to be added to each ref. # --cur=<word>: The current ref to be completed. Defaults to the current # word to be completed. # --sfx=<suffix>: A suffix to be appended to each ref instead of the default # space. # --mode=<mode>: What set of refs to complete, one of 'refs' (the default) to # complete all refs, 'heads' to complete only branches, or # 'remote-heads' to complete only remote branches. Note that # --remote is only compatible with --mode=refs. __git_complete_refs () { local remote= dwim= pfx= cur_="$cur" sfx=" " mode="refs" while test $# != 0; do case "$1" in --remote=*) remote="${1##--remote=}" ;; --dwim) dwim="yes" ;; # --track is an old spelling of --dwim --track) dwim="yes" ;; --pfx=*) pfx="${1##--pfx=}" ;; --cur=*) cur_="${1##--cur=}" ;; --sfx=*) sfx="${1##--sfx=}" ;; --mode=*) mode="${1##--mode=}" ;; *) return 1 ;; esac shift done # complete references based on the specified mode case "$mode" in refs) __gitcomp_direct "$(__git_refs "$remote" "" "$pfx" "$cur_" "$sfx")" ;; heads) __gitcomp_direct "$(__git_heads "$pfx" "$cur_" "$sfx")" ;; remote-heads) __gitcomp_direct "$(__git_remote_heads "$pfx" "$cur_" "$sfx")" ;; *) return 1 ;; esac # Append DWIM remote branch names if requested if [ "$dwim" = "yes" ]; then __gitcomp_direct_append "$(__git_dwim_remote_heads "$pfx" "$cur_" "$sfx")" fi } # __git_refs2 requires 1 argument (to pass to __git_refs) # Deprecated: use __git_complete_fetch_refspecs() instead. __git_refs2 () { local i for i in $(__git_refs "$1"); do echo "$i:$i" done } # Completes refspecs for fetching from a remote repository. # 1: The remote repository. # 2: A prefix to be added to each listed refspec (optional). # 3: The ref to be completed as a refspec instead of the current word to be # completed (optional) # 4: A suffix to be appended to each listed refspec instead of the default # space (optional). __git_complete_fetch_refspecs () { local i remote="$1" pfx="${2-}" cur_="${3-$cur}" sfx="${4- }" __gitcomp_direct "$( for i in $(__git_refs "$remote" "" "" "$cur_") ; do echo "$pfx$i:$i$sfx" done )" } # __git_refs_remotes requires 1 argument (to pass to ls-remote) __git_refs_remotes () { local i hash __git ls-remote "$1" 'refs/heads/*' | \ while read -r hash i; do echo "$i:refs/remotes/$1/${i#refs/heads/}" done } __git_remotes () { __git_find_repo_path test -d "$__git_repo_path/remotes" && ls -1 "$__git_repo_path/remotes" __git remote } # Returns true if $1 matches the name of a configured remote, false otherwise. __git_is_configured_remote () { local remote for remote in $(__git_remotes); do if [ "$remote" = "$1" ]; then return 0 fi done return 1 } __git_list_merge_strategies () { LANG=C LC_ALL=C git merge -s help 2>&1 | sed -n -e '/[Aa]vailable strategies are: /,/^$/{ s/\.$// s/.*:// s/^[ ]*// s/[ ]*$// p }' } __git_merge_strategies= # 'git merge -s help' (and thus detection of the merge strategy # list) fails, unfortunately, if run outside of any git working # tree. __git_merge_strategies is set to the empty string in # that case, and the detection will be repeated the next time it # is needed. __git_compute_merge_strategies () { test -n "$__git_merge_strategies" || __git_merge_strategies=$(__git_list_merge_strategies) } __git_merge_strategy_options="ours theirs subtree subtree= patience histogram diff-algorithm= ignore-space-change ignore-all-space ignore-space-at-eol renormalize no-renormalize no-renames find-renames find-renames= rename-threshold=" __git_complete_revlist_file () { local dequoted_word pfx ls ref cur_="$cur" case "$cur_" in *..?*:*) return ;; ?*:*) ref="${cur_%%:*}" cur_="${cur_#*:}" __git_dequote "$cur_" case "$dequoted_word" in ?*/*) pfx="${dequoted_word%/*}" cur_="${dequoted_word##*/}" ls="$ref:$pfx" pfx="$pfx/" ;; *) cur_="$dequoted_word" ls="$ref" ;; esac case "$COMP_WORDBREAKS" in *:*) : great ;; *) pfx="$ref:$pfx" ;; esac __gitcomp_file "$(__git ls-tree "$ls" \ | sed 's/^.* // s/$//')" \ "$pfx" "$cur_" ;; *...*) pfx="${cur_%...*}..." cur_="${cur_#*...}" __git_complete_refs --pfx="$pfx" --cur="$cur_" ;; *..*) pfx="${cur_%..*}.." cur_="${cur_#*..}" __git_complete_refs --pfx="$pfx" --cur="$cur_" ;; *) __git_complete_refs ;; esac } __git_complete_file () { __git_complete_revlist_file } __git_complete_revlist () { __git_complete_revlist_file } __git_complete_remote_or_refspec () { local cur_="$cur" cmd="${words[__git_cmd_idx]}" local i c=$((__git_cmd_idx+1)) remote="" pfx="" lhs=1 no_complete_refspec=0 if [ "$cmd" = "remote" ]; then ((c++)) fi while [ $c -lt $cword ]; do i="${words[c]}" case "$i" in --mirror) [ "$cmd" = "push" ] && no_complete_refspec=1 ;; -d|--delete) [ "$cmd" = "push" ] && lhs=0 ;; --all) case "$cmd" in push) no_complete_refspec=1 ;; fetch) return ;; *) ;; esac ;; --multiple) no_complete_refspec=1; break ;; -*) ;; *) remote="$i"; break ;; esac ((c++)) done if [ -z "$remote" ]; then __gitcomp_nl "$(__git_remotes)" return fi if [ $no_complete_refspec = 1 ]; then return fi [ "$remote" = "." ] && remote= case "$cur_" in *:*) case "$COMP_WORDBREAKS" in *:*) : great ;; *) pfx="${cur_%%:*}:" ;; esac cur_="${cur_#*:}" lhs=0 ;; +*) pfx="+" cur_="${cur_#+}" ;; esac case "$cmd" in fetch) if [ $lhs = 1 ]; then __git_complete_fetch_refspecs "$remote" "$pfx" "$cur_" else __git_complete_refs --pfx="$pfx" --cur="$cur_" fi ;; pull|remote) if [ $lhs = 1 ]; then __git_complete_refs --remote="$remote" --pfx="$pfx" --cur="$cur_" else __git_complete_refs --pfx="$pfx" --cur="$cur_" fi ;; push) if [ $lhs = 1 ]; then __git_complete_refs --pfx="$pfx" --cur="$cur_" else __git_complete_refs --remote="$remote" --pfx="$pfx" --cur="$cur_" fi ;; esac } __git_complete_strategy () { __git_compute_merge_strategies case "$prev" in -s|--strategy) __gitcomp "$__git_merge_strategies" return 0 ;; -X) __gitcomp "$__git_merge_strategy_options" return 0 ;; esac case "$cur" in --strategy=*) __gitcomp "$__git_merge_strategies" "" "${cur##--strategy=}" return 0 ;; --strategy-option=*) __gitcomp "$__git_merge_strategy_options" "" "${cur##--strategy-option=}" return 0 ;; esac return 1 } __git_all_commands= __git_compute_all_commands () { test -n "$__git_all_commands" || __git_all_commands=$(__git --list-cmds=main,others,alias,nohelpers) } # Lists all set config variables starting with the given section prefix, # with the prefix removed. __git_get_config_variables () { local section="$1" i IFS=$'\n' for i in $(__git config --name-only --get-regexp "^$section\..*"); do echo "${i#$section.}" done } __git_pretty_aliases () { __git_get_config_variables "pretty" } # __git_aliased_command requires 1 argument __git_aliased_command () { local cur=$1 last list= word cmdline while [[ -n "$cur" ]]; do if [[ "$list" == *" $cur "* ]]; then # loop detected return fi cmdline=$(__git config --get "alias.$cur") list=" $cur $list" last=$cur cur= for word in $cmdline; do case "$word" in \!gitk|gitk) cur="gitk" break ;; \!*) : shell command alias ;; -*) : option ;; *=*) : setting env ;; git) : git itself ;; \(\)) : skip parens of shell function definition ;; {) : skip start of shell helper function ;; :) : skip null command ;; \'*) : skip opening quote after sh -c ;; *) cur="$word" break esac done done cur=$last if [[ "$cur" != "$1" ]]; then echo "$cur" fi } # Check whether one of the given words is present on the command line, # and print the first word found. # # Usage: __git_find_on_cmdline [<option>]... "<wordlist>" # --show-idx: Optionally show the index of the found word in the $words array. __git_find_on_cmdline () { local word c="$__git_cmd_idx" show_idx while test $# -gt 1; do case "$1" in --show-idx) show_idx=y ;; *) return 1 ;; esac shift done local wordlist="$1" while [ $c -lt $cword ]; do for word in $wordlist; do if [ "$word" = "${words[c]}" ]; then if [ -n "${show_idx-}" ]; then echo "$c $word" else echo "$word" fi return fi done ((c++)) done } # Similar to __git_find_on_cmdline, except that it loops backwards and thus # prints the *last* word found. Useful for finding which of two options that # supersede each other came last, such as "--guess" and "--no-guess". # # Usage: __git_find_last_on_cmdline [<option>]... "<wordlist>" # --show-idx: Optionally show the index of the found word in the $words array. __git_find_last_on_cmdline () { local word c=$cword show_idx while test $# -gt 1; do case "$1" in --show-idx) show_idx=y ;; *) return 1 ;; esac shift done local wordlist="$1" while [ $c -gt "$__git_cmd_idx" ]; do ((c--)) for word in $wordlist; do if [ "$word" = "${words[c]}" ]; then if [ -n "$show_idx" ]; then echo "$c $word" else echo "$word" fi return fi done done } # Echo the value of an option set on the command line or config # # $1: short option name # $2: long option name including = # $3: list of possible values # $4: config string (optional) # # example: # result="$(__git_get_option_value "-d" "--do-something=" \ # "yes no" "core.doSomething")" # # result is then either empty (no option set) or "yes" or "no" # # __git_get_option_value requires 3 arguments __git_get_option_value () { local c short_opt long_opt val local result= values config_key word short_opt="$1" long_opt="$2" values="$3" config_key="$4" ((c = $cword - 1)) while [ $c -ge 0 ]; do word="${words[c]}" for val in $values; do if [ "$short_opt$val" = "$word" ] || [ "$long_opt$val" = "$word" ]; then result="$val" break 2 fi done ((c--)) done if [ -n "$config_key" ] && [ -z "$result" ]; then result="$(__git config "$config_key")" fi echo "$result" } __git_has_doubledash () { local c=1 while [ $c -lt $cword ]; do if [ "--" = "${words[c]}" ]; then return 0 fi ((c++)) done return 1 } # Try to count non option arguments passed on the command line for the # specified git command. # When options are used, it is necessary to use the special -- option to # tell the implementation were non option arguments begin. # XXX this can not be improved, since options can appear everywhere, as # an example: # git mv x -n y # # __git_count_arguments requires 1 argument: the git command executed. __git_count_arguments () { local word i c=0 # Skip "git" (first argument) for ((i=$__git_cmd_idx; i < ${#words[@]}; i++)); do word="${words[i]}" case "$word" in --) # Good; we can assume that the following are only non # option arguments. ((c = 0)) ;; "$1") # Skip the specified git command and discard git # main options ((c = 0)) ;; ?*) ((c++)) ;; esac done printf "%d" $c } __git_whitespacelist="nowarn warn error error-all fix" __git_patchformat="mbox stgit stgit-series hg mboxrd" __git_showcurrentpatch="diff raw" __git_am_inprogress_options="--skip --continue --resolved --abort --quit --show-current-patch" __git_quoted_cr="nowarn warn strip" _git_am () { __git_find_repo_path if [ -d "$__git_repo_path"/rebase-apply ]; then __gitcomp "$__git_am_inprogress_options" return fi case "$cur" in --whitespace=*) __gitcomp "$__git_whitespacelist" "" "${cur##--whitespace=}" return ;; --patch-format=*) __gitcomp "$__git_patchformat" "" "${cur##--patch-format=}" return ;; --show-current-patch=*) __gitcomp "$__git_showcurrentpatch" "" "${cur##--show-current-patch=}" return ;; --quoted-cr=*) __gitcomp "$__git_quoted_cr" "" "${cur##--quoted-cr=}" return ;; --*) __gitcomp_builtin am "" \ "$__git_am_inprogress_options" return esac } _git_apply () { case "$cur" in --whitespace=*) __gitcomp "$__git_whitespacelist" "" "${cur##--whitespace=}" return ;; --*) __gitcomp_builtin apply return esac } _git_add () { case "$cur" in --chmod=*) __gitcomp "+x -x" "" "${cur##--chmod=}" return ;; --*) __gitcomp_builtin add return esac local complete_opt="--others --modified --directory --no-empty-directory" if test -n "$(__git_find_on_cmdline "-u --update")" then complete_opt="--modified" fi __git_complete_index_file "$complete_opt" } _git_archive () { case "$cur" in --format=*) __gitcomp "$(git archive --list)" "" "${cur##--format=}" return ;; --remote=*) __gitcomp_nl "$(__git_remotes)" "" "${cur##--remote=}" return ;; --*) __gitcomp_builtin archive "--format= --list --verbose --prefix= --worktree-attributes" return ;; esac __git_complete_file } _git_bisect () { __git_has_doubledash && return local subcommands="start bad good skip reset visualize replay log run" local subcommand="$(__git_find_on_cmdline "$subcommands")" if [ -z "$subcommand" ]; then __git_find_repo_path if [ -f "$__git_repo_path"/BISECT_START ]; then __gitcomp "$subcommands" else __gitcomp "replay start" fi return fi case "$subcommand" in bad|good|reset|skip|start) __git_complete_refs ;; *) ;; esac } __git_ref_fieldlist="refname objecttype objectsize objectname upstream push HEAD symref" _git_branch () { local i c="$__git_cmd_idx" only_local_ref="n" has_r="n" while [ $c -lt $cword ]; do i="${words[c]}" case "$i" in -d|-D|--delete|-m|-M|--move|-c|-C|--copy) only_local_ref="y" ;; -r|--remotes) has_r="y" ;; esac ((c++)) done case "$cur" in --set-upstream-to=*) __git_complete_refs --cur="${cur##--set-upstream-to=}" ;; --*) __gitcomp_builtin branch ;; *) if [ $only_local_ref = "y" -a $has_r = "n" ]; then __gitcomp_direct "$(__git_heads "" "$cur" " ")" else __git_complete_refs fi ;; esac } _git_bundle () { local cmd="${words[__git_cmd_idx+1]}" case "$cword" in $((__git_cmd_idx+1))) __gitcomp "create list-heads verify unbundle" ;; $((__git_cmd_idx+2))) # looking for a file ;; *) case "$cmd" in create) __git_complete_revlist ;; esac ;; esac } # Helper function to decide whether or not we should enable DWIM logic for # git-switch and git-checkout. # # To decide between the following rules in decreasing priority order: # - the last provided of "--guess" or "--no-guess" explicitly enable or # disable completion of DWIM logic respectively. # - If checkout.guess is false, disable completion of DWIM logic. # - If the --no-track option is provided, take this as a hint to disable the # DWIM completion logic # - If GIT_COMPLETION_CHECKOUT_NO_GUESS is set, disable the DWIM completion # logic, as requested by the user. # - Enable DWIM logic otherwise. # __git_checkout_default_dwim_mode () { local last_option dwim_opt="--dwim" if [ "${GIT_COMPLETION_CHECKOUT_NO_GUESS-}" = "1" ]; then dwim_opt="" fi # --no-track disables DWIM, but with lower priority than # --guess/--no-guess/checkout.guess if [ -n "$(__git_find_on_cmdline "--no-track")" ]; then dwim_opt="" fi # checkout.guess = false disables DWIM, but with lower priority than # --guess/--no-guess if [ "$(__git config --type=bool checkout.guess)" = "false" ]; then dwim_opt="" fi # Find the last provided --guess or --no-guess last_option="$(__git_find_last_on_cmdline "--guess --no-guess")" case "$last_option" in --guess) dwim_opt="--dwim" ;; --no-guess) dwim_opt="" ;; esac echo "$dwim_opt" } _git_checkout () { __git_has_doubledash && return local dwim_opt="$(__git_checkout_default_dwim_mode)" case "$prev" in -b|-B|--orphan) # Complete local branches (and DWIM branch # remote branch names) for an option argument # specifying a new branch name. This is for # convenience, assuming new branches are # possibly based on pre-existing branch names. __git_complete_refs $dwim_opt --mode="heads" return ;; *) ;; esac case "$cur" in --conflict=*) __gitcomp "diff3 merge" "" "${cur##--conflict=}" ;; --*) __gitcomp_builtin checkout ;; *) # At this point, we've already handled special completion for # the arguments to -b/-B, and --orphan. There are 3 main # things left we can possibly complete: # 1) a start-point for -b/-B, -d/--detach, or --orphan # 2) a remote head, for --track # 3) an arbitrary reference, possibly including DWIM names # if [ -n "$(__git_find_on_cmdline "-b -B -d --detach --orphan")" ]; then __git_complete_refs --mode="refs" elif [ -n "$(__git_find_on_cmdline "--track")" ]; then __git_complete_refs --mode="remote-heads" else __git_complete_refs $dwim_opt --mode="refs" fi ;; esac } __git_sequencer_inprogress_options="--continue --quit --abort --skip" __git_cherry_pick_inprogress_options=$__git_sequencer_inprogress_options _git_cherry_pick () { __git_find_repo_path if [ -f "$__git_repo_path"/CHERRY_PICK_HEAD ]; then __gitcomp "$__git_cherry_pick_inprogress_options" return fi __git_complete_strategy && return case "$cur" in --*) __gitcomp_builtin cherry-pick "" \ "$__git_cherry_pick_inprogress_options" ;; *) __git_complete_refs ;; esac } _git_clean () { case "$cur" in --*) __gitcomp_builtin clean return ;; esac # XXX should we check for -x option ? __git_complete_index_file "--others --directory" } _git_clone () { case "$prev" in -c|--config) __git_complete_config_variable_name_and_value return ;; esac case "$cur" in --config=*) __git_complete_config_variable_name_and_value \ --cur="${cur##--config=}" return ;; --*) __gitcomp_builtin clone return ;; esac } __git_untracked_file_modes="all no normal" _git_commit () { case "$prev" in -c|-C) __git_complete_refs return ;; esac case "$cur" in --cleanup=*) __gitcomp "default scissors strip verbatim whitespace " "" "${cur##--cleanup=}" return ;; --reuse-message=*|--reedit-message=*|\ --fixup=*|--squash=*) __git_complete_refs --cur="${cur#*=}" return ;; --untracked-files=*) __gitcomp "$__git_untracked_file_modes" "" "${cur##--untracked-files=}" return ;; --*) __gitcomp_builtin commit return esac if __git rev-parse --verify --quiet HEAD >/dev/null; then __git_complete_index_file "--committable" else # This is the first commit __git_complete_index_file "--cached" fi } _git_describe () { case "$cur" in --*) __gitcomp_builtin describe return esac __git_complete_refs } __git_diff_algorithms="myers minimal patience histogram" __git_diff_submodule_formats="diff log short" __git_color_moved_opts="no default plain blocks zebra dimmed-zebra" __git_color_moved_ws_opts="no ignore-space-at-eol ignore-space-change ignore-all-space allow-indentation-change" __git_diff_common_options="--stat --numstat --shortstat --summary --patch-with-stat --name-only --name-status --color --no-color --color-words --no-renames --check --color-moved --color-moved= --no-color-moved --color-moved-ws= --no-color-moved-ws --full-index --binary --abbrev --diff-filter= --find-copies-harder --ignore-cr-at-eol --text --ignore-space-at-eol --ignore-space-change --ignore-all-space --ignore-blank-lines --exit-code --quiet --ext-diff --no-ext-diff --no-prefix --src-prefix= --dst-prefix= --inter-hunk-context= --patience --histogram --minimal --raw --word-diff --word-diff-regex= --dirstat --dirstat= --dirstat-by-file --dirstat-by-file= --cumulative --diff-algorithm= --submodule --submodule= --ignore-submodules --indent-heuristic --no-indent-heuristic --textconv --no-textconv --patch --no-patch --anchored= " __git_diff_difftool_options="--cached --staged --pickaxe-all --pickaxe-regex --base --ours --theirs --no-index --relative --merge-base $__git_diff_common_options" _git_diff () { __git_has_doubledash && return case "$cur" in --diff-algorithm=*) __gitcomp "$__git_diff_algorithms" "" "${cur##--diff-algorithm=}" return ;; --submodule=*) __gitcomp "$__git_diff_submodule_formats" "" "${cur##--submodule=}" return ;; --color-moved=*) __gitcomp "$__git_color_moved_opts" "" "${cur##--color-moved=}" return ;; --color-moved-ws=*) __gitcomp "$__git_color_moved_ws_opts" "" "${cur##--color-moved-ws=}" return ;; --*) __gitcomp "$__git_diff_difftool_options" return ;; esac __git_complete_revlist_file } __git_mergetools_common="diffuse diffmerge ecmerge emerge kdiff3 meld opendiff tkdiff vimdiff nvimdiff gvimdiff xxdiff araxis p4merge bc codecompare smerge " _git_difftool () { __git_has_doubledash && return case "$cur" in --tool=*) __gitcomp "$__git_mergetools_common kompare" "" "${cur##--tool=}" return ;; --*) __gitcomp_builtin difftool "$__git_diff_difftool_options" return ;; esac __git_complete_revlist_file } __git_fetch_recurse_submodules="yes on-demand no" _git_fetch () { case "$cur" in --recurse-submodules=*) __gitcomp "$__git_fetch_recurse_submodules" "" "${cur##--recurse-submodules=}" return ;; --filter=*) __gitcomp "blob:none blob:limit= sparse:oid=" "" "${cur##--filter=}" return ;; --*) __gitcomp_builtin fetch return ;; esac __git_complete_remote_or_refspec } __git_format_patch_extra_options=" --full-index --not --all --no-prefix --src-prefix= --dst-prefix= --notes " _git_format_patch () { case "$cur" in --thread=*) __gitcomp " deep shallow " "" "${cur##--thread=}" return ;; --base=*|--interdiff=*|--range-diff=*) __git_complete_refs --cur="${cur#--*=}" return ;; --*) __gitcomp_builtin format-patch "$__git_format_patch_extra_options" return ;; esac __git_complete_revlist } _git_fsck () { case "$cur" in --*) __gitcomp_builtin fsck return ;; esac } _git_gitk () { __gitk_main } # Lists matching symbol names from a tag (as in ctags) file. # 1: List symbol names matching this word. # 2: The tag file to list symbol names from. # 3: A prefix to be added to each listed symbol name (optional). # 4: A suffix to be appended to each listed symbol name (optional). __git_match_ctag () { awk -v pfx="${3-}" -v sfx="${4-}" " /^${1//\//\\/}/ { print pfx \$1 sfx } " "$2" } # Complete symbol names from a tag file. # Usage: __git_complete_symbol [<option>]... # --tags=<file>: The tag file to list symbol names from instead of the # default "tags". # --pfx=<prefix>: A prefix to be added to each symbol name. # --cur=<word>: The current symbol name to be completed. Defaults to # the current word to be completed. # --sfx=<suffix>: A suffix to be appended to each symbol name instead # of the default space. __git_complete_symbol () { local tags=tags pfx="" cur_="${cur-}" sfx=" " while test $# != 0; do case "$1" in --tags=*) tags="${1##--tags=}" ;; --pfx=*) pfx="${1##--pfx=}" ;; --cur=*) cur_="${1##--cur=}" ;; --sfx=*) sfx="${1##--sfx=}" ;; *) return 1 ;; esac shift done if test -r "$tags"; then __gitcomp_direct "$(__git_match_ctag "$cur_" "$tags" "$pfx" "$sfx")" fi } _git_grep () { __git_has_doubledash && return case "$cur" in --*) __gitcomp_builtin grep return ;; esac case "$cword,$prev" in $((__git_cmd_idx+1)),*|*,-*) __git_complete_symbol && return ;; esac __git_complete_refs } _git_help () { case "$cur" in --*) __gitcomp_builtin help return ;; esac if test -n "${GIT_TESTING_ALL_COMMAND_LIST-}" then __gitcomp "$GIT_TESTING_ALL_COMMAND_LIST $(__git --list-cmds=alias,list-guide) gitk" else __gitcomp "$(__git --list-cmds=main,nohelpers,alias,list-guide) gitk" fi } _git_init () { case "$cur" in --shared=*) __gitcomp " false true umask group all world everybody " "" "${cur##--shared=}" return ;; --*) __gitcomp_builtin init return ;; esac } _git_ls_files () { case "$cur" in --*) __gitcomp_builtin ls-files return ;; esac # XXX ignore options like --modified and always suggest all cached # files. __git_complete_index_file "--cached" } _git_ls_remote () { case "$cur" in --*) __gitcomp_builtin ls-remote return ;; esac __gitcomp_nl "$(__git_remotes)" } _git_ls_tree () { case "$cur" in --*) __gitcomp_builtin ls-tree return ;; esac __git_complete_file } # Options that go well for log, shortlog and gitk __git_log_common_options=" --not --all --branches --tags --remotes --first-parent --merges --no-merges --max-count= --max-age= --since= --after= --min-age= --until= --before= --min-parents= --max-parents= --no-min-parents --no-max-parents " # Options that go well for log and gitk (not shortlog) __git_log_gitk_options=" --dense --sparse --full-history --simplify-merges --simplify-by-decoration --left-right --notes --no-notes " # Options that go well for log and shortlog (not gitk) __git_log_shortlog_options=" --author= --committer= --grep= --all-match --invert-grep " __git_log_pretty_formats="oneline short medium full fuller reference email raw format: tformat: mboxrd" __git_log_date_formats="relative iso8601 iso8601-strict rfc2822 short local default raw unix format:" _git_log () { __git_has_doubledash && return __git_find_repo_path local merge="" if [ -f "$__git_repo_path/MERGE_HEAD" ]; then merge="--merge" fi case "$prev,$cur" in -L,:*:*) return # fall back to Bash filename completion ;; -L,:*) __git_complete_symbol --cur="${cur#:}" --sfx=":" return ;; -G,*|-S,*) __git_complete_symbol return ;; esac case "$cur" in --pretty=*|--format=*) __gitcomp "$__git_log_pretty_formats $(__git_pretty_aliases) " "" "${cur#*=}" return ;; --date=*) __gitcomp "$__git_log_date_formats" "" "${cur##--date=}" return ;; --decorate=*) __gitcomp "full short no" "" "${cur##--decorate=}" return ;; --diff-algorithm=*) __gitcomp "$__git_diff_algorithms" "" "${cur##--diff-algorithm=}" return ;; --submodule=*) __gitcomp "$__git_diff_submodule_formats" "" "${cur##--submodule=}" return ;; --no-walk=*) __gitcomp "sorted unsorted" "" "${cur##--no-walk=}" return ;; --*) __gitcomp " $__git_log_common_options $__git_log_shortlog_options $__git_log_gitk_options --root --topo-order --date-order --reverse --follow --full-diff --abbrev-commit --no-abbrev-commit --abbrev= --relative-date --date= --pretty= --format= --oneline --show-signature --cherry-mark --cherry-pick --graph --decorate --decorate= --no-decorate --walk-reflogs --no-walk --no-walk= --do-walk --parents --children --expand-tabs --expand-tabs= --no-expand-tabs $merge $__git_diff_common_options --pickaxe-all --pickaxe-regex " return ;; -L:*:*) return # fall back to Bash filename completion ;; -L:*) __git_complete_symbol --cur="${cur#-L:}" --sfx=":" return ;; -G*) __git_complete_symbol --pfx="-G" --cur="${cur#-G}" return ;; -S*) __git_complete_symbol --pfx="-S" --cur="${cur#-S}" return ;; esac __git_complete_revlist } _git_merge () { __git_complete_strategy && return case "$cur" in --*) __gitcomp_builtin merge return esac __git_complete_refs } _git_mergetool () { case "$cur" in --tool=*) __gitcomp "$__git_mergetools_common tortoisemerge" "" "${cur##--tool=}" return ;; --*) __gitcomp "--tool= --prompt --no-prompt --gui --no-gui" return ;; esac } _git_merge_base () { case "$cur" in --*) __gitcomp_builtin merge-base return ;; esac __git_complete_refs } _git_mv () { case "$cur" in --*) __gitcomp_builtin mv return ;; esac if [ $(__git_count_arguments "mv") -gt 0 ]; then # We need to show both cached and untracked files (including # empty directories) since this may not be the last argument. __git_complete_index_file "--cached --others --directory" else __git_complete_index_file "--cached" fi } _git_notes () { local subcommands='add append copy edit get-ref list merge prune remove show' local subcommand="$(__git_find_on_cmdline "$subcommands")" case "$subcommand,$cur" in ,--*) __gitcomp_builtin notes ;; ,*) case "$prev" in --ref) __git_complete_refs ;; *) __gitcomp "$subcommands --ref" ;; esac ;; *,--reuse-message=*|*,--reedit-message=*) __git_complete_refs --cur="${cur#*=}" ;; *,--*) __gitcomp_builtin notes_$subcommand ;; prune,*|get-ref,*) # this command does not take a ref, do not complete it ;; *) case "$prev" in -m|-F) ;; *) __git_complete_refs ;; esac ;; esac } _git_pull () { __git_complete_strategy && return case "$cur" in --recurse-submodules=*) __gitcomp "$__git_fetch_recurse_submodules" "" "${cur##--recurse-submodules=}" return ;; --*) __gitcomp_builtin pull return ;; esac __git_complete_remote_or_refspec } __git_push_recurse_submodules="check on-demand only" __git_complete_force_with_lease () { local cur_=$1 case "$cur_" in --*=) ;; *:*) __git_complete_refs --cur="${cur_#*:}" ;; *) __git_complete_refs --cur="$cur_" ;; esac } _git_push () { case "$prev" in --repo) __gitcomp_nl "$(__git_remotes)" return ;; --recurse-submodules) __gitcomp "$__git_push_recurse_submodules" return ;; esac case "$cur" in --repo=*) __gitcomp_nl "$(__git_remotes)" "" "${cur##--repo=}" return ;; --recurse-submodules=*) __gitcomp "$__git_push_recurse_submodules" "" "${cur##--recurse-submodules=}" return ;; --force-with-lease=*) __git_complete_force_with_lease "${cur##--force-with-lease=}" return ;; --*) __gitcomp_builtin push return ;; esac __git_complete_remote_or_refspec } _git_range_diff () { case "$cur" in --*) __gitcomp " --creation-factor= --no-dual-color $__git_diff_common_options " return ;; esac __git_complete_revlist } __git_rebase_inprogress_options="--continue --skip --abort --quit --show-current-patch" __git_rebase_interactive_inprogress_options="$__git_rebase_inprogress_options --edit-todo" _git_rebase () { __git_find_repo_path if [ -f "$__git_repo_path"/rebase-merge/interactive ]; then __gitcomp "$__git_rebase_interactive_inprogress_options" return elif [ -d "$__git_repo_path"/rebase-apply ] || \ [ -d "$__git_repo_path"/rebase-merge ]; then __gitcomp "$__git_rebase_inprogress_options" return fi __git_complete_strategy && return case "$cur" in --whitespace=*) __gitcomp "$__git_whitespacelist" "" "${cur##--whitespace=}" return ;; --onto=*) __git_complete_refs --cur="${cur##--onto=}" return ;; --*) __gitcomp_builtin rebase "" \ "$__git_rebase_interactive_inprogress_options" return esac __git_complete_refs } _git_reflog () { local subcommands="show delete expire" local subcommand="$(__git_find_on_cmdline "$subcommands")" if [ -z "$subcommand" ]; then __gitcomp "$subcommands" else __git_complete_refs fi } __git_send_email_confirm_options="always never auto cc compose" __git_send_email_suppresscc_options="author self cc bodycc sob cccmd body all" _git_send_email () { case "$prev" in --to|--cc|--bcc|--from) __gitcomp "$(__git send-email --dump-aliases)" return ;; esac case "$cur" in --confirm=*) __gitcomp " $__git_send_email_confirm_options " "" "${cur##--confirm=}" return ;; --suppress-cc=*) __gitcomp " $__git_send_email_suppresscc_options " "" "${cur##--suppress-cc=}" return ;; --smtp-encryption=*) __gitcomp "ssl tls" "" "${cur##--smtp-encryption=}" return ;; --thread=*) __gitcomp " deep shallow " "" "${cur##--thread=}" return ;; --to=*|--cc=*|--bcc=*|--from=*) __gitcomp "$(__git send-email --dump-aliases)" "" "${cur#--*=}" return ;; --*) __gitcomp_builtin send-email "--annotate --bcc --cc --cc-cmd --chain-reply-to --compose --confirm= --dry-run --envelope-sender --from --identity --in-reply-to --no-chain-reply-to --no-signed-off-by-cc --no-suppress-from --no-thread --quiet --reply-to --signed-off-by-cc --smtp-pass --smtp-server --smtp-server-port --smtp-encryption= --smtp-user --subject --suppress-cc= --suppress-from --thread --to --validate --no-validate $__git_format_patch_extra_options" return ;; esac __git_complete_revlist } _git_stage () { _git_add } _git_status () { local complete_opt local untracked_state case "$cur" in --ignore-submodules=*) __gitcomp "none untracked dirty all" "" "${cur##--ignore-submodules=}" return ;; --untracked-files=*) __gitcomp "$__git_untracked_file_modes" "" "${cur##--untracked-files=}" return ;; --column=*) __gitcomp " always never auto column row plain dense nodense " "" "${cur##--column=}" return ;; --*) __gitcomp_builtin status return ;; esac untracked_state="$(__git_get_option_value "-u" "--untracked-files=" \ "$__git_untracked_file_modes" "status.showUntrackedFiles")" case "$untracked_state" in no) # --ignored option does not matter complete_opt= ;; all|normal|*) complete_opt="--cached --directory --no-empty-directory --others" if [ -n "$(__git_find_on_cmdline "--ignored")" ]; then complete_opt="$complete_opt --ignored --exclude=*" fi ;; esac __git_complete_index_file "$complete_opt" } _git_switch () { local dwim_opt="$(__git_checkout_default_dwim_mode)" case "$prev" in -c|-C|--orphan) # Complete local branches (and DWIM branch # remote branch names) for an option argument # specifying a new branch name. This is for # convenience, assuming new branches are # possibly based on pre-existing branch names. __git_complete_refs $dwim_opt --mode="heads" return ;; *) ;; esac case "$cur" in --conflict=*) __gitcomp "diff3 merge" "" "${cur##--conflict=}" ;; --*) __gitcomp_builtin switch ;; *) # Unlike in git checkout, git switch --orphan does not take # a start point. Thus we really have nothing to complete after # the branch name. if [ -n "$(__git_find_on_cmdline "--orphan")" ]; then return fi # At this point, we've already handled special completion for # -c/-C, and --orphan. There are 3 main things left to # complete: # 1) a start-point for -c/-C or -d/--detach # 2) a remote head, for --track # 3) a branch name, possibly including DWIM remote branches if [ -n "$(__git_find_on_cmdline "-c -C -d --detach")" ]; then __git_complete_refs --mode="refs" elif [ -n "$(__git_find_on_cmdline "--track")" ]; then __git_complete_refs --mode="remote-heads" else __git_complete_refs $dwim_opt --mode="heads" fi ;; esac } __git_config_get_set_variables () { local prevword word config_file= c=$cword while [ $c -gt "$__git_cmd_idx" ]; do word="${words[c]}" case "$word" in --system|--global|--local|--file=*) config_file="$word" break ;; -f|--file) config_file="$word $prevword" break ;; esac prevword=$word c=$((--c)) done __git config $config_file --name-only --list } __git_config_vars= __git_compute_config_vars () { test -n "$__git_config_vars" || __git_config_vars="$(git help --config-for-completion)" } __git_config_sections= __git_compute_config_sections () { test -n "$__git_config_sections" || __git_config_sections="$(git help --config-sections-for-completion)" } # Completes possible values of various configuration variables. # # Usage: __git_complete_config_variable_value [<option>]... # --varname=<word>: The name of the configuration variable whose value is # to be completed. Defaults to the previous word on the # command line. # --cur=<word>: The current value to be completed. Defaults to the current # word to be completed. __git_complete_config_variable_value () { local varname="$prev" cur_="$cur" while test $# != 0; do case "$1" in --varname=*) varname="${1##--varname=}" ;; --cur=*) cur_="${1##--cur=}" ;; *) return 1 ;; esac shift done if [ "${BASH_VERSINFO[0]:-0}" -ge 4 ]; then varname="${varname,,}" else varname="$(echo "$varname" |tr A-Z a-z)" fi case "$varname" in branch.*.remote|branch.*.pushremote) __gitcomp_nl "$(__git_remotes)" "" "$cur_" return ;; branch.*.merge) __git_complete_refs --cur="$cur_" return ;; branch.*.rebase) __gitcomp "false true merges interactive" "" "$cur_" return ;; remote.pushdefault) __gitcomp_nl "$(__git_remotes)" "" "$cur_" return ;; remote.*.fetch) local remote="${varname#remote.}" remote="${remote%.fetch}" if [ -z "$cur_" ]; then __gitcomp_nl "refs/heads/" "" "" "" return fi __gitcomp_nl "$(__git_refs_remotes "$remote")" "" "$cur_" return ;; remote.*.push) local remote="${varname#remote.}" remote="${remote%.push}" __gitcomp_nl "$(__git for-each-ref \ --format='%(refname):%(refname)' refs/heads)" "" "$cur_" return ;; pull.twohead|pull.octopus) __git_compute_merge_strategies __gitcomp "$__git_merge_strategies" "" "$cur_" return ;; color.pager) __gitcomp "false true" "" "$cur_" return ;; color.*.*) __gitcomp " normal black red green yellow blue magenta cyan white bold dim ul blink reverse " "" "$cur_" return ;; color.*) __gitcomp "false true always never auto" "" "$cur_" return ;; diff.submodule) __gitcomp "$__git_diff_submodule_formats" "" "$cur_" return ;; help.format) __gitcomp "man info web html" "" "$cur_" return ;; log.date) __gitcomp "$__git_log_date_formats" "" "$cur_" return ;; sendemail.aliasfiletype) __gitcomp "mutt mailrc pine elm gnus" "" "$cur_" return ;; sendemail.confirm) __gitcomp "$__git_send_email_confirm_options" "" "$cur_" return ;; sendemail.suppresscc) __gitcomp "$__git_send_email_suppresscc_options" "" "$cur_" return ;; sendemail.transferencoding) __gitcomp "7bit 8bit quoted-printable base64" "" "$cur_" return ;; *.*) return ;; esac } # Completes configuration sections, subsections, variable names. # # Usage: __git_complete_config_variable_name [<option>]... # --cur=<word>: The current configuration section/variable name to be # completed. Defaults to the current word to be completed. # --sfx=<suffix>: A suffix to be appended to each fully completed # configuration variable name (but not to sections or # subsections) instead of the default space. __git_complete_config_variable_name () { local cur_="$cur" sfx while test $# != 0; do case "$1" in --cur=*) cur_="${1##--cur=}" ;; --sfx=*) sfx="${1##--sfx=}" ;; *) return 1 ;; esac shift done case "$cur_" in branch.*.*) local pfx="${cur_%.*}." cur_="${cur_##*.}" __gitcomp "remote pushRemote merge mergeOptions rebase" "$pfx" "$cur_" "$sfx" return ;; branch.*) local pfx="${cur_%.*}." cur_="${cur_#*.}" __gitcomp_direct "$(__git_heads "$pfx" "$cur_" ".")" __gitcomp_nl_append $'autoSetupMerge\nautoSetupRebase\n' "$pfx" "$cur_" "${sfx- }" return ;; guitool.*.*) local pfx="${cur_%.*}." cur_="${cur_##*.}" __gitcomp " argPrompt cmd confirm needsFile noConsole noRescan prompt revPrompt revUnmerged title " "$pfx" "$cur_" "$sfx" return ;; difftool.*.*) local pfx="${cur_%.*}." cur_="${cur_##*.}" __gitcomp "cmd path" "$pfx" "$cur_" "$sfx" return ;; man.*.*) local pfx="${cur_%.*}." cur_="${cur_##*.}" __gitcomp "cmd path" "$pfx" "$cur_" "$sfx" return ;; mergetool.*.*) local pfx="${cur_%.*}." cur_="${cur_##*.}" __gitcomp "cmd path trustExitCode" "$pfx" "$cur_" "$sfx" return ;; pager.*) local pfx="${cur_%.*}." cur_="${cur_#*.}" __git_compute_all_commands __gitcomp_nl "$__git_all_commands" "$pfx" "$cur_" "${sfx- }" return ;; remote.*.*) local pfx="${cur_%.*}." cur_="${cur_##*.}" __gitcomp " url proxy fetch push mirror skipDefaultUpdate receivepack uploadpack tagOpt pushurl " "$pfx" "$cur_" "$sfx" return ;; remote.*) local pfx="${cur_%.*}." cur_="${cur_#*.}" __gitcomp_nl "$(__git_remotes)" "$pfx" "$cur_" "." __gitcomp_nl_append "pushDefault" "$pfx" "$cur_" "${sfx- }" return ;; url.*.*) local pfx="${cur_%.*}." cur_="${cur_##*.}" __gitcomp "insteadOf pushInsteadOf" "$pfx" "$cur_" "$sfx" return ;; *.*) __git_compute_config_vars __gitcomp "$__git_config_vars" "" "$cur_" "$sfx" ;; *) __git_compute_config_sections __gitcomp "$__git_config_sections" "" "$cur_" "." ;; esac } # Completes '='-separated configuration sections/variable names and values # for 'git -c section.name=value'. # # Usage: __git_complete_config_variable_name_and_value [<option>]... # --cur=<word>: The current configuration section/variable name/value to be # completed. Defaults to the current word to be completed. __git_complete_config_variable_name_and_value () { local cur_="$cur" while test $# != 0; do case "$1" in --cur=*) cur_="${1##--cur=}" ;; *) return 1 ;; esac shift done case "$cur_" in *=*) __git_complete_config_variable_value \ --varname="${cur_%%=*}" --cur="${cur_#*=}" ;; *) __git_complete_config_variable_name --cur="$cur_" --sfx='=' ;; esac } _git_config () { case "$prev" in --get|--get-all|--unset|--unset-all) __gitcomp_nl "$(__git_config_get_set_variables)" return ;; *.*) __git_complete_config_variable_value return ;; esac case "$cur" in --*) __gitcomp_builtin config ;; *) __git_complete_config_variable_name ;; esac } _git_remote () { local subcommands=" add rename remove set-head set-branches get-url set-url show prune update " local subcommand="$(__git_find_on_cmdline "$subcommands")" if [ -z "$subcommand" ]; then case "$cur" in --*) __gitcomp_builtin remote ;; *) __gitcomp "$subcommands" ;; esac return fi case "$subcommand,$cur" in add,--*) __gitcomp_builtin remote_add ;; add,*) ;; set-head,--*) __gitcomp_builtin remote_set-head ;; set-branches,--*) __gitcomp_builtin remote_set-branches ;; set-head,*|set-branches,*) __git_complete_remote_or_refspec ;; update,--*) __gitcomp_builtin remote_update ;; update,*) __gitcomp "$(__git_remotes) $(__git_get_config_variables "remotes")" ;; set-url,--*) __gitcomp_builtin remote_set-url ;; get-url,--*) __gitcomp_builtin remote_get-url ;; prune,--*) __gitcomp_builtin remote_prune ;; *) __gitcomp_nl "$(__git_remotes)" ;; esac } _git_replace () { case "$cur" in --format=*) __gitcomp "short medium long" "" "${cur##--format=}" return ;; --*) __gitcomp_builtin replace return ;; esac __git_complete_refs } _git_rerere () { local subcommands="clear forget diff remaining status gc" local subcommand="$(__git_find_on_cmdline "$subcommands")" if test -z "$subcommand" then __gitcomp "$subcommands" return fi } _git_reset () { __git_has_doubledash && return case "$cur" in --*) __gitcomp_builtin reset return ;; esac __git_complete_refs } _git_restore () { case "$prev" in -s) __git_complete_refs return ;; esac case "$cur" in --conflict=*) __gitcomp "diff3 merge" "" "${cur##--conflict=}" ;; --source=*) __git_complete_refs --cur="${cur##--source=}" ;; --*) __gitcomp_builtin restore ;; esac } __git_revert_inprogress_options=$__git_sequencer_inprogress_options _git_revert () { __git_find_repo_path if [ -f "$__git_repo_path"/REVERT_HEAD ]; then __gitcomp "$__git_revert_inprogress_options" return fi __git_complete_strategy && return case "$cur" in --*) __gitcomp_builtin revert "" \ "$__git_revert_inprogress_options" return ;; esac __git_complete_refs } _git_rm () { case "$cur" in --*) __gitcomp_builtin rm return ;; esac __git_complete_index_file "--cached" } _git_shortlog () { __git_has_doubledash && return case "$cur" in --*) __gitcomp " $__git_log_common_options $__git_log_shortlog_options --numbered --summary --email " return ;; esac __git_complete_revlist } _git_show () { __git_has_doubledash && return case "$cur" in --pretty=*|--format=*) __gitcomp "$__git_log_pretty_formats $(__git_pretty_aliases) " "" "${cur#*=}" return ;; --diff-algorithm=*) __gitcomp "$__git_diff_algorithms" "" "${cur##--diff-algorithm=}" return ;; --submodule=*) __gitcomp "$__git_diff_submodule_formats" "" "${cur##--submodule=}" return ;; --color-moved=*) __gitcomp "$__git_color_moved_opts" "" "${cur##--color-moved=}" return ;; --color-moved-ws=*) __gitcomp "$__git_color_moved_ws_opts" "" "${cur##--color-moved-ws=}" return ;; --*) __gitcomp "--pretty= --format= --abbrev-commit --no-abbrev-commit --oneline --show-signature --expand-tabs --expand-tabs= --no-expand-tabs $__git_diff_common_options " return ;; esac __git_complete_revlist_file } _git_show_branch () { case "$cur" in --*) __gitcomp_builtin show-branch return ;; esac __git_complete_revlist } _git_sparse_checkout () { local subcommands="list init set disable" local subcommand="$(__git_find_on_cmdline "$subcommands")" if [ -z "$subcommand" ]; then __gitcomp "$subcommands" return fi case "$subcommand,$cur" in init,--*) __gitcomp "--cone" ;; set,--*) __gitcomp "--stdin" ;; *) ;; esac } _git_stash () { local subcommands='push list show apply clear drop pop create branch' local subcommand="$(__git_find_on_cmdline "$subcommands save")" if [ -z "$subcommand" ]; then case "$((cword - __git_cmd_idx)),$cur" in *,--*) __gitcomp_builtin stash_push ;; 1,sa*) __gitcomp "save" ;; 1,*) __gitcomp "$subcommands" ;; esac return fi case "$subcommand,$cur" in list,--*) # NEEDSWORK: can we somehow unify this with the options in _git_log() and _git_show() __gitcomp_builtin stash_list "$__git_log_common_options $__git_diff_common_options" ;; show,--*) __gitcomp_builtin stash_show "$__git_diff_common_options" ;; *,--*) __gitcomp_builtin "stash_$subcommand" ;; branch,*) if [ $cword -eq $((__git_cmd_idx+2)) ]; then __git_complete_refs else __gitcomp_nl "$(__git stash list \ | sed -n -e 's/:.*//p')" fi ;; show,*|apply,*|drop,*|pop,*) __gitcomp_nl "$(__git stash list \ | sed -n -e 's/:.*//p')" ;; esac } _git_submodule () { __git_has_doubledash && return local subcommands="add status init deinit update set-branch set-url summary foreach sync absorbgitdirs" local subcommand="$(__git_find_on_cmdline "$subcommands")" if [ -z "$subcommand" ]; then case "$cur" in --*) __gitcomp "--quiet" ;; *) __gitcomp "$subcommands" ;; esac return fi case "$subcommand,$cur" in add,--*) __gitcomp "--branch --force --name --reference --depth" ;; status,--*) __gitcomp "--cached --recursive" ;; deinit,--*) __gitcomp "--force --all" ;; update,--*) __gitcomp " --init --remote --no-fetch --recommend-shallow --no-recommend-shallow --force --rebase --merge --reference --depth --recursive --jobs " ;; set-branch,--*) __gitcomp "--default --branch" ;; summary,--*) __gitcomp "--cached --files --summary-limit" ;; foreach,--*|sync,--*) __gitcomp "--recursive" ;; *) ;; esac } _git_svn () { local subcommands=" init fetch clone rebase dcommit log find-rev set-tree commit-diff info create-ignore propget proplist show-ignore show-externals branch tag blame migrate mkdirs reset gc " local subcommand="$(__git_find_on_cmdline "$subcommands")" if [ -z "$subcommand" ]; then __gitcomp "$subcommands" else local remote_opts="--username= --config-dir= --no-auth-cache" local fc_opts=" --follow-parent --authors-file= --repack= --no-metadata --use-svm-props --use-svnsync-props --log-window-size= --no-checkout --quiet --repack-flags --use-log-author --localtime --add-author-from --recursive --ignore-paths= --include-paths= $remote_opts " local init_opts=" --template= --shared= --trunk= --tags= --branches= --stdlayout --minimize-url --no-metadata --use-svm-props --use-svnsync-props --rewrite-root= --prefix= $remote_opts " local cmt_opts=" --edit --rmdir --find-copies-harder --copy-similarity= " case "$subcommand,$cur" in fetch,--*) __gitcomp "--revision= --fetch-all $fc_opts" ;; clone,--*) __gitcomp "--revision= $fc_opts $init_opts" ;; init,--*) __gitcomp "$init_opts" ;; dcommit,--*) __gitcomp " --merge --strategy= --verbose --dry-run --fetch-all --no-rebase --commit-url --revision --interactive $cmt_opts $fc_opts " ;; set-tree,--*) __gitcomp "--stdin $cmt_opts $fc_opts" ;; create-ignore,--*|propget,--*|proplist,--*|show-ignore,--*|\ show-externals,--*|mkdirs,--*) __gitcomp "--revision=" ;; log,--*) __gitcomp " --limit= --revision= --verbose --incremental --oneline --show-commit --non-recursive --authors-file= --color " ;; rebase,--*) __gitcomp " --merge --verbose --strategy= --local --fetch-all --dry-run $fc_opts " ;; commit-diff,--*) __gitcomp "--message= --file= --revision= $cmt_opts" ;; info,--*) __gitcomp "--url" ;; branch,--*) __gitcomp "--dry-run --message --tag" ;; tag,--*) __gitcomp "--dry-run --message" ;; blame,--*) __gitcomp "--git-format" ;; migrate,--*) __gitcomp " --config-dir= --ignore-paths= --minimize --no-auth-cache --username= " ;; reset,--*) __gitcomp "--revision= --parent" ;; *) ;; esac fi } _git_tag () { local i c="$__git_cmd_idx" f=0 while [ $c -lt $cword ]; do i="${words[c]}" case "$i" in -d|--delete|-v|--verify) __gitcomp_direct "$(__git_tags "" "$cur" " ")" return ;; -f) f=1 ;; esac ((c++)) done case "$prev" in -m|-F) ;; -*|tag) if [ $f = 1 ]; then __gitcomp_direct "$(__git_tags "" "$cur" " ")" fi ;; *) __git_complete_refs ;; esac case "$cur" in --*) __gitcomp_builtin tag ;; esac } _git_whatchanged () { _git_log } __git_complete_worktree_paths () { local IFS=$'\n' # Generate completion reply from worktree list skipping the first # entry: it's the path of the main worktree, which can't be moved, # removed, locked, etc. __gitcomp_nl "$(git worktree list --porcelain | sed -n -e '2,$ s/^worktree //p')" } _git_worktree () { local subcommands="add list lock move prune remove unlock" local subcommand subcommand_idx subcommand="$(__git_find_on_cmdline --show-idx "$subcommands")" subcommand_idx="${subcommand% *}" subcommand="${subcommand#* }" case "$subcommand,$cur" in ,*) __gitcomp "$subcommands" ;; *,--*) __gitcomp_builtin worktree_$subcommand ;; add,*) # usage: git worktree add [<options>] <path> [<commit-ish>] # Here we are not completing an --option, it's either the # path or a ref. case "$prev" in -b|-B) # Complete refs for branch to be created/reseted. __git_complete_refs ;; -*) # The previous word is an -o|--option without an # unstuck argument: have to complete the path for # the new worktree, so don't list anything, but let # Bash fall back to filename completion. ;; *) # The previous word is not an --option, so it must # be either the 'add' subcommand, the unstuck # argument of an option (e.g. branch for -b|-B), or # the path for the new worktree. if [ $cword -eq $((subcommand_idx+1)) ]; then # Right after the 'add' subcommand: have to # complete the path, so fall back to Bash # filename completion. : else case "${words[cword-2]}" in -b|-B) # After '-b <branch>': have to # complete the path, so fall back # to Bash filename completion. ;; *) # After the path: have to complete # the ref to be checked out. __git_complete_refs ;; esac fi ;; esac ;; lock,*|remove,*|unlock,*) __git_complete_worktree_paths ;; move,*) if [ $cword -eq $((subcommand_idx+1)) ]; then # The first parameter must be an existing working # tree to be moved. __git_complete_worktree_paths else # The second parameter is the destination: it could # be any path, so don't list anything, but let Bash # fall back to filename completion. : fi ;; esac } __git_complete_common () { local command="$1" case "$cur" in --*) __gitcomp_builtin "$command" ;; esac } __git_cmds_with_parseopt_helper= __git_support_parseopt_helper () { test -n "$__git_cmds_with_parseopt_helper" || __git_cmds_with_parseopt_helper="$(__git --list-cmds=parseopt)" case " $__git_cmds_with_parseopt_helper " in *" $1 "*) return 0 ;; *) return 1 ;; esac } __git_have_func () { declare -f -- "$1" >/dev/null 2>&1 } __git_complete_command () { local command="$1" local completion_func="_git_${command//-/_}" if ! __git_have_func $completion_func && __git_have_func _completion_loader then _completion_loader "git-$command" fi if __git_have_func $completion_func then $completion_func return 0 elif __git_support_parseopt_helper "$command" then __git_complete_common "$command" return 0 else return 1 fi } __git_main () { local i c=1 command __git_dir __git_repo_path local __git_C_args C_args_count=0 local __git_cmd_idx while [ $c -lt $cword ]; do i="${words[c]}" case "$i" in --git-dir=*) __git_dir="${i#--git-dir=}" ;; --git-dir) ((c++)) __git_dir="${words[c]}" ;; --bare) __git_dir="." ;; --help) command="help" break ;; -c|--work-tree|--namespace) ((c++)) ;; -C) __git_C_args[C_args_count++]=-C ((c++)) __git_C_args[C_args_count++]="${words[c]}" ;; -*) ;; *) command="$i" __git_cmd_idx="$c" break ;; esac ((c++)) done if [ -z "${command-}" ]; then case "$prev" in --git-dir|-C|--work-tree) # these need a path argument, let's fall back to # Bash filename completion return ;; -c) __git_complete_config_variable_name_and_value return ;; --namespace) # we don't support completing these options' arguments return ;; esac case "$cur" in --*) __gitcomp " --paginate --no-pager --git-dir= --bare --version --exec-path --exec-path= --html-path --man-path --info-path --work-tree= --namespace= --no-replace-objects --help " ;; *) if test -n "${GIT_TESTING_PORCELAIN_COMMAND_LIST-}" then __gitcomp "$GIT_TESTING_PORCELAIN_COMMAND_LIST" else __gitcomp "$(__git --list-cmds=list-mainporcelain,others,nohelpers,alias,list-complete,config)" fi ;; esac return fi __git_complete_command "$command" && return local expansion=$(__git_aliased_command "$command") if [ -n "$expansion" ]; then words[1]=$expansion __git_complete_command "$expansion" fi } __gitk_main () { __git_has_doubledash && return local __git_repo_path __git_find_repo_path local merge="" if [ -f "$__git_repo_path/MERGE_HEAD" ]; then merge="--merge" fi case "$cur" in --*) __gitcomp " $__git_log_common_options $__git_log_gitk_options $merge " return ;; esac __git_complete_revlist } if [[ -n ${ZSH_VERSION-} && -z ${GIT_SOURCING_ZSH_COMPLETION-} ]]; then echo "ERROR: this script is obsolete, please see git-completion.zsh" 1>&2 return fi __git_func_wrap () { local cur words cword prev local __git_cmd_idx=0 _get_comp_words_by_ref -n =: cur words cword prev $1 } ___git_complete () { local wrapper="__git_wrap${2}" eval "$wrapper () { __git_func_wrap $2 ; }" complete -o bashdefault -o default -o nospace -F $wrapper $1 2>/dev/null \ || complete -o default -o nospace -F $wrapper $1 } # Setup the completion for git commands # 1: command or alias # 2: function to call (e.g. `git`, `gitk`, `git_fetch`) __git_complete () { local func if __git_have_func $2; then func=$2 elif __git_have_func __$2_main; then func=__$2_main elif __git_have_func _$2; then func=_$2 else echo "ERROR: could not find function '$2'" 1>&2 return 1 fi ___git_complete $1 $func } ___git_complete git __git_main ___git_complete gitk __gitk_main # The following are necessary only for Cygwin, and only are needed # when the user has tab-completed the executable name and consequently # included the '.exe' suffix. # if [ "$OSTYPE" = cygwin ]; then ___git_complete git.exe __git_main fi uuidgen 0000644 00000001221 15036124164 0006125 0 ustar 00 _uuidgen_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-n'|'--namespace') COMPREPLY=( $(compgen -W "@dns @url @oid @x500 @x.500" -- "$cur") ) return 0 ;; '-N'|'--name') COMPREPLY=( $(compgen -W "name" -- "$cur") ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS=" --random --time --namespace --name --md5 --sha1 --hex --help --version " COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac return 0 } complete -F _uuidgen_module uuidgen col 0000644 00000000714 15036124164 0005250 0 ustar 00 _col_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-l'|'--lines') COMPREPLY=( $(compgen -W "number" -- $cur) ) return 0 ;; '-H'|'--help'|'-V'|'--version') return 0 ;; esac OPTS="--no-backspaces --fine --pass --tabs --spaces --lines --version --help" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 } complete -F _col_module col gnome-screenshot 0000644 00000001452 15036124164 0007753 0 ustar 00 # gnome-screenshot(1) completion -*- shell-script -*- _gnome_screenshot() { local cur prev words cword split _init_completion -s || return case $prev in --help | --help-* | --version | --delay | --display | -!(-*)[hd]) return ;; --border-effect | -!(-*)e) COMPREPLY=($(compgen -W 'shadow border vintage none' -- "$cur")) return ;; --file | -!(-*)f) _filedir '@(jp?(e)|pn)g' return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace fi } && complete -F _gnome_screenshot gnome-screenshot # ex: filetype=sh pycodestyle 0000644 00000001335 15036124164 0007037 0 ustar 00 # pycodestyle completion -*- shell-script -*- _pycodestyle() { local cur prev words cword split _init_completion -s || return case $prev in -h | --help | --version) return ;; --format) COMPREPLY=($(compgen -W 'default pylint' -- "$cur")) return ;; --config) _filedir return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return fi _filedir py } && complete -F _pycodestyle pycodestyle # ex: filetype=sh jarsigner 0000644 00000003241 15036124164 0006455 0 ustar 00 # jarsigner(1) completion -*- shell-script -*- _jarsigner() { local cur prev words cword _init_completion || return case $prev in -keystore) COMPREPLY=($(compgen -W 'NONE' -- "$cur")) _filedir '@(jks|ks|p12|pfx)' return ;; -storepass | -keypass | -sigfile | -digestalg | -sigalg | -tsacert | -tsapolicyid | \ -tsadigestalg | -altsigner | -altsignerpath | -providerName | -providerClass | \ -providerArg) return ;; -certchain | -tsa) _filedir return ;; -storetype) COMPREPLY=($(compgen -W 'JKS PKCS11 PKCS12' -- "$cur")) return ;; -signedjar) _filedir '@(jar|apk)' return ;; esac # Check if a jar was already given. local i jar=false for ((i = 1; i < ${#words[@]} - 1; i++)); do if [[ ${words[i]} == *.@(jar|apk) && \ ${words[i - 1]} != -signedjar ]]; then jar=true break fi done if ! $jar; then if [[ $cur == -* ]]; then # Documented as "should not be used": -internalsf, -sectionsonly COMPREPLY=($(compgen -W '-keystore -storepass -storetype -keypass -sigfile -signedjar -digestalg -sigalg -verify -verbose -certs -tsa -tsacert -altsigner -altsignerpath -protected -providerName -providerClass -providerArg' \ -- "$cur")) fi _filedir '@(jar|apk)' fi } && complete -F _jarsigner jarsigner # ex: filetype=sh gdb 0000644 00000003135 15036124164 0005227 0 ustar 00 # bash completion for gdb -*- shell-script -*- _gdb() { local cur prev words cword i _init_completion || return # gdb [options] --args executable-file [inferior-arguments ...] for ((i = 1; i < cword; i++)); do if [[ ${words[i]} == --args ]]; then _command_offset $((i + 1)) return $? fi done # gdb [options] [executable-file [core-file or process-id]] if ((cword == 1)); then local IFS compopt -o filenames if [[ $cur == */* ]]; then # compgen -c works as expected if $cur contains any slashes. IFS=$'\n' COMPREPLY=($(PATH="$PATH:." compgen -d -c -- "$cur")) else # otherwise compgen -c contains Bash's built-in commands, # functions and aliases. Thus we need to retrieve the program # names manually. IFS=":" local path_array=($( command sed -e 's/:\{2,\}/:/g' -e 's/^://' -e 's/:$//' <<<"$PATH" )) IFS=$'\n' COMPREPLY=($(compgen -d -W '$(find "${path_array[@]}" . \ -mindepth 1 -maxdepth 1 -not -type d -executable \ -printf "%f\\n" 2>/dev/null)' -- "$cur")) fi elif ((cword == 2)); then COMPREPLY=($(compgen -W "$(command ps axo comm,pid | awk '{if ($1 ~ /^'"${prev##*/}"'/) print $2}')" -- "$cur")) compopt -o filenames COMPREPLY+=($(compgen -f -X '!?(*/)core?(.?*)' -o plusdirs \ -- "$cur")) fi } && complete -F _gdb gdb # ex: filetype=sh ipset 0000644 00000204764 15036124164 0005632 0 ustar 00 # ----------------------------------------------------------------- # Programmable completion code for ipset (netfilter.org) # # https://github.com/AllKind/ipset-bash-completion # https://sourceforge.net/projects/ipset-bashcompl # ----------------------------------------------------------------- # Copyright (C) 2013-2016 Mart Frauenlob aka AllKind (AllKind@fastest.cc) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # ----------------------------------------------------------------- # Compatible with ipset versions: 6+ # Tested with ipset versions: # 6.24, 6.27 # ----------------------------------------------------------------- # Requirements: # # bash v4 or greater. # # The bash completion package version 2.0 or greater is recommended. # http://bash-completion.alioth.debian.org/ # Older version are not supported. # # If the package is not available, things might not be so reliable. # Also the colon (if there) is removed from COMP_WORDBREAKS. # This alteration is globally, which might affect other completions, # if they don't take care of it themselves. # # ----------------------------------------------------------------- # Installation (quote from bash-completion README): # # Install it in one of the directories pointed to by # bash-completion's pkgconfig file variables. There are two # alternatives: the recommended one is 'completionsdir' (get it with # "pkg-config --variable=completionsdir bash-completion") from which # completions are loaded on demand based on invoked commands' names, # so be sure to name your completion file accordingly, and to include # for example symbolic links in case the file provides completions # for more than one command. The other one which is present for # backwards compatibility reasons is 'compatdir' (get it with # "pkg-config --variable=compatdir bash-completion") from which files # are loaded when bash_completion is loaded. # # For packages using GNU autotools the installation can be handled # for example like this in configure.ac: # # PKG_CHECK_VAR(bashcompdir, [bash-completion], [completionsdir], , # bashcompdir="${sysconfdir}/bash_completion.d") # AC_SUBST(bashcompdir) # # ...accompanied by this in Makefile.am: # # bashcompdir = @bashcompdir@ # dist_bashcomp_DATA = # completion files go here # # For cmake we ship the bash-completion-config.cmake and # bash-completion-config-version.cmake files. Example usage: # # find_package(bash-completion) # if(BASH_COMPLETION_FOUND) # message(STATUS # "Using bash completion dir ${BASH_COMPLETION_COMPLETIONSDIR}") # else() # set (BASH_COMPLETION_COMPLETIONSDIR "/etc/bash_completion.d") # message (STATUS # "Using fallback bash completion dir ${BASH_COMPLETION_COMPLETIONSDIR}") # endif() # # install(FILES your-completion-file DESTINATION # ${BASH_COMPLETION_COMPLETIONSDIR}) # # For backwards compatibility it is still possible to put it into # ~/.bash_completion or /etc/bash_completion.d/. # # ----------------------------------------------------------------- # # Version 2.9.2 # # ----------------------------------------------------------------- shopt -s extglob # ----------------------------------------------------------------- # Functions # ----------------------------------------------------------------- _ipset_is_set() { local -i idx ((${#arr_sets[@]})) || arr_sets=( $( ( "${words[0]}" list -n ) 2>/dev/null ) ) for idx in ${!arr_sets[@]}; do if [[ ${arr_sets[idx]} = $1 ]]; then return 0 fi done return 1 } _ipset_get_set_type() { local n d while read n d; do [[ $n = Type: ]] && printf '%s\n' $d && break done < <( ( "${words[0]}" -t list "$1" ) 2>/dev/null) } _ipset_set_has_option() { while read -r; do [[ $REPLY = Header:*$1* ]] && return 0 done < <( ( "${words[0]}" -t list "$2" ) 2>/dev/null) return 1 } _ipset_get_supported_types() { ((${#arr_types[@]})) && return local -i i=0 x while read -r; do [[ $REPLY = "Supported set types:"* ]] && ((!i)) && i=1 && continue ((i)) || continue if [[ $REPLY = *:* ]]; then set -- $REPLY for x in ${!arr_types[@]}; do # check if already registered if [[ $1 = ${arr_types[x]} ]]; then continue 2 fi done arr_types+=("$1") # register type fi done < <( ( "${words[0]}" help ) 2>/dev/null ) } _ipset_get_members() { local -i in_list=0 no=0 arr_members=() if [[ $1 = --names-only ]]; then no=1 shift fi while read -r; do [[ $REPLY = Members:* ]] && in_list=1 && continue ((in_list)) || continue if ((no)); then arr_members+=("${REPLY%% *}") else arr_members+=("$REPLY") fi done < <( ( "${words[0]}" list "$1" ) 2>/dev/null) } _ipset_get_set_family() { while read -r; do [[ $REPLY = Header:*"family inet6"* ]] && printf "v6\n" && return [[ $REPLY = Header:*"family inet "* ]] && printf "v4\n" && return [[ $REPLY = Header:*"range "*.*.*.* ]] && printf "v4\n" && return done < <( ( "${words[0]}" -t list "$1" ) 2>/dev/null) } _ipset_dedupe_cmd_opts() { local str_opt local -i idx for str_opt; do for idx in ${!arr_dupe_cmd_opts[@]}; do if [[ $str_opt = ${arr_dupe_cmd_opts[idx]} ]]; then if [[ $_DEBUG_NF_COMPLETION ]]; then printf "removing dupe option str_opt: %s\n" \ "${arr_dupe_cmd_opts[idx]}" fi continue 2 fi done printf "%s\n" "$str_opt" done } _ipset_get_options() { local str_list local -i idx oidx ridx if ((got_action)); then if [[ $str_action = @(rename|e|swap|w|test|flush|destroy|x) ]]; then str_list='-q -quiet' elif [[ $str_action = save ]]; then str_list='-f -file -q -quiet -o -output' elif [[ $str_action = @(create|n|add|del) ]]; then str_list='-! -exist -q -quiet' elif [[ $str_action = restore ]]; then str_list='-! -exist -f -file -q -quiet' elif [[ $str_action = list ]]; then str_list='-f -file -q -quiet' if ((names_only || headers_only)); then str_list+=' -o -output' elif ((res_sort)); then str_list+=' -o -output -r -resolve -s -sorted' elif ((save_format == 1)); then str_list+=' -r -resolve -s -sorted -t -terse' elif ((save_format == 3)); then str_list+=' -r -resolve -s -sorted' else str_list+=' -n -name -o -output -r -resolve -s -sorted -t -terse' fi fi else str_list='-f -file -q -quiet' if ((names_only || headers_only)) && ((save_format == 1)); then : elif ((names_only || headers_only)); then str_list+=' -o -output' elif ((res_sort)); then str_list+=' -o -output -r -resolve -s -sorted' elif ((save_format == 1)); then str_list+=' -r -resolve -s -sorted -t -terse' elif ((save_format == 3)); then str_list+=' -r -resolve -s -sorted' elif ((ignore_errors)); then : elif ((use_file)); then str_list="-! -exist -n -name -o -output -q -quiet -r \ -resolve -s -sorted -t -terse" else str_list='- ${arr_opts[@]}' fi fi COMPREPLY=( $( compgen -W "$str_list" -- "$cur" ) ) ((${#COMPREPLY[@]})) || return 0 # post process the reply if [[ ${_IPSET_COMPL_OPT_FORMAT:=long} = long ]]; then # choose on env var for ridx in ${!COMPREPLY[@]}; do # remove short version of options [[ ${COMPREPLY[ridx]} = -? ]] && unset COMPREPLY[ridx] done elif [[ ${_IPSET_COMPL_OPT_FORMAT} = short ]]; then for ridx in ${!COMPREPLY[@]}; do # remove short version of options [[ ${COMPREPLY[ridx]} = -??* ]] && unset COMPREPLY[ridx] done fi for idx in ${!arr_used_opts[@]}; do # if the user supplied the short form of an option previously, # and now requests the long form, remove the corresponding long option, # vice versa for short options for oidx in ${!arr_opts[@]}; do # cycle through main options set -- ${arr_opts[oidx]} # $1 = short , $2 = long option [[ $1 = $cur ]] && continue [[ ${arr_used_opts[idx]} =~ ^($1|$2)$ ]] || continue for ridx in ${!COMPREPLY[@]}; do # compare with compreply if [[ ${COMPREPLY[ridx]} = ${BASH_REMATCH[1]} ]]; then if [[ $_DEBUG_NF_COMPLETION ]]; then printf "removing option alias COMPREPLY[$ridx]: %s\n" \ "${COMPREPLY[ridx]}" fi unset COMPREPLY[ridx] break 2 fi done done for ridx in ${!COMPREPLY[@]}; do # de-dupe options if [[ ${arr_used_opts[idx]} = ${COMPREPLY[ridx]} && \ ${COMPREPLY[ridx]} != $cur ]]; then if [[ $_DEBUG_NF_COMPLETION ]]; then printf "removing dupe option COMPREPLY[$ridx]: %s\n" \ "${COMPREPLY[ridx]}" fi unset COMPREPLY[ridx] break fi done done } _ipset_get_networks() { local foo str_net rest [[ -r /etc/networks ]] || return 0 [[ ${_IPSET_COMP_NETWORKS-1} ]] || return 0 while read -r foo str_net rest; do [[ $foo = @(""|*([[:blank:]])#*) ]] && continue [[ $str_net = *([[:blank:]])#* ]] && continue printf "%s\n" "$str_net" done < /etc/networks } _ipset_get_protocols() { local str_name rest while read -r str_name rest; do if [[ $str_name = @(""|*([[:blank:]])#*) ]]; then continue elif [[ $str_name = *-* ]]; then str_name="[$str_name]" fi printf "%s\n" "$str_name" done < /etc/protocols } _ipset_get_svnum() { # find service num to set offset local str_name str_num str_p=all rest local _str_p _str_o="" while (($#)); do if [[ $1 = -p ]]; then _str_p="${2:-all}" shift elif [[ $1 = -o && ${2:-"-no"} != -* ]]; then # second part of range will have offset = first_part_of_range+1 _str_o="$2" shift fi shift done if [[ $_str_o && $_str_o != +([[:digit:]]) ]]; then while read str_name str_num rest; do if [[ $str_name = *([[:blank:]])#* ]]; then continue elif [[ $_str_p != all && ${str_num#*/} != $_str_p ]]; then continue fi [[ $str_name = $_str_o ]] && printf "%s\n" ${str_num%/*} && return done < /etc/services else printf "%s\n" "$_str_o" fi } _ipset_get_services() { local str_offset="" str_name str_num str_p=all rest while (($#)); do if [[ $1 = -p ]]; then str_p="${2:-all}" shift elif [[ $1 = -o && ${2:-"-no"} != -* ]]; then # second part of range will have offset = first_part_of_range+1 str_offset="${2}" shift fi shift done # find service num to set offset if [[ $str_offset && $str_offset != +([[:digit:]]) ]]; then str_offset=$(_ipset_get_svnum -p "$str_p" -o "$str_offset") [[ $str_offset = +([[:digit:]]) ]] || str_offset="" # we failed fi # identify and print the services while read -r str_name str_num rest; do if [[ $str_name = @(""|*([[:blank:]])#*) ]]; then continue elif [[ $str_p != all && ${str_num#*/} != $str_p ]]; then continue elif [[ $str_offset && $str_num && $str_num = +([[:digit:]])/* ]] && \ ((${str_num%/*} <= $str_offset)); then continue elif [[ $str_name = *-* ]]; then str_name="[$str_name]" fi printf "%s\n" "$str_name" done < /etc/services } _ipset_get_ifnames() { while read -r; do REPLY="${REPLY#*: }" printf "%s\n" ${REPLY%%:*} done < <(PATH=${PATH}:/sbin ( command ip -o link show ) 2>/dev/null) } _ipset_get_iplist() { # if a file with ip addresses is in env var, load em local str_ip rest if [[ $1 = v4 ]]; then str_regex='^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(/([3][0-2]|[1-2]?[0-9]))?$' elif [[ $1 = v6 ]]; then str_regex='^([0-9a-fA-F]{1,4}(:[0-9a-fA-F]{1,4}){7}|([0-9a-fA-F]{1,4}:){1}(:[0-9a-fA-F]{1,4}){1,6}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,6}(:[0-9a-fA-F]{1,4}){1})(/([1][0-2][0-9]|[1-9]?[0-9]))?$' else return 0 fi [[ $_IPSET_IPLIST_FILE && -r $_IPSET_IPLIST_FILE ]] || return 0 while read -r str_ip rest; do [[ $str_ip = *([[:blank:]])\#* ]] && continue str_ip="${str_ip//\#*/}" [[ $str_ip =~ $str_regex ]] && printf "%s\n" "$str_ip" done < "${_IPSET_IPLIST_FILE}" } _ipset_complete_elements() { local lcur="$1" str_lprefix="" local -i no_range=0 shift while (($#)); do [[ $1 = --no-range ]] && no_range=1 shift done if [[ $lcur = *-[[]+([!]]) ]]; then # incomplete range - host/port with dash str_lprefix="${lcur%\-[*}-" lcur="${lcur#"$str_lprefix"}" elif [[ $lcur = \[*\]-* ]]; then # first part of host/portname range str_lprefix="${lcur%\]-*}]-" lcur="${lcur##*\]-}" elif [[ $lcur = *-* ]]; then str_lprefix="${lcur%-*}-" lcur="${lcur##*-}" elif [[ $lcur =~ (tcp|udp):.* ]]; then # proto:port (bitmap:port) str_lprefix="${BASH_REMATCH[1]}:" lcur="${lcur#*:}" no_range=0 # workaround fi if [[ $str_lprefix ]]; then [[ $str_lprefix = */* ]] && return 1 ((no_range)) && return 1 _ipset_get_members --names-only "$str_setname" COMPREPLY+=( $( compgen -P "$str_lprefix" -W '${arr_members[@]/*\/*/}' -- "$lcur" ) ) else _ipset_get_members --names-only "$str_setname" COMPREPLY+=( $( compgen -W '${arr_members[@]}' -- "$lcur" ) ) fi } _ipset_complete_portrange() { # complete port ranges local lcur="$1" local str_lprefix="$lcur" str_p="" str_var=0 str_glob='[^[]*-*' if [[ $lcur = *:* ]]; then # look for `proto:' ((got_bp_proto)) || return 0 # supported since ipset v6.20 # only tcp/udp is valid as PROTO spec [[ ${lcur%%:*} = @(tcp|udp) ]] || return 0 str_p=${lcur%%:*} lcur="${lcur#$str_p:}" fi if [[ $lcur = \[*-*\]-* ]]; then # spec with bracket str_var="${lcur#\[}" str_var="${str_var%%\]*}" lcur="${lcur#*\]-}" str_lprefix=${str_lprefix%"$lcur"} elif [[ $lcur = $str_glob ]]; then # spec without bracket str_var="${lcur%%-*}" lcur="${lcur#*-}" str_lprefix=${str_lprefix%"$lcur"} else # no prefix str_lprefix="" compopt -o nospace fi if [[ $str_p ]]; then # we have a proto spec COMPREPLY=( $(compgen -P "$str_p:$str_lprefix" \ -W '$(_ipset_get_services -o $str_var -p $str_p)' -- "$lcur" ) ) __ltrim_colon_completions "$str_p:$str_lprefix$lcur" else if [[ $str_lprefix ]]; then COMPREPLY=( $(compgen -P "$str_lprefix" \ -W '$(_ipset_get_services -o $str_var)' -- "$lcur" ) ) else if ((got_bp_proto)); then # supported since ipset v6.20 COMPREPLY=( $(compgen \ -W 'tcp: udp: $(_ipset_get_services)' -- "$lcur" ) ) else # only tcp services prior to ipset v6.20 COMPREPLY=( $(compgen \ -W '$(_ipset_get_services -p tcp)' -- "$lcur" ) ) fi fi fi } _ipset_complete_hostnames() { local -i idx got_bracket=0 local lcur="${1//@(\[|\])}" [[ $lcur = $1 ]] || got_bracket=1 if ((got_bashcompl)); then _ipset_known_hosts -F "$_IPSET_SSH_CONFIGS" -- "$lcur" else if [[ ${COMP_KNOWN_HOSTS_WITH_HOSTFILE-1} ]]; then COMPREPLY+=( $( compgen -A hostname -- "$lcur" ) ) fi fi for idx in ${!COMPREPLY[@]}; do if [[ ${COMPREPLY[idx]} = *-* ]]; then COMPREPLY[idx]="[${COMPREPLY[idx]}]" else ((got_bracket)) && unset COMPREPLY[idx] fi done } _ipset_complete_iface_spec() { local lcur="$1" str_lprefix="" if [[ $lcur != *,* ]]; then str_lprefix="" str_glob='+([![])-*' compopt -o nospace if [[ x$str_action != xtest ]]; then if [[ $lcur = \[*-*\]-* ]]; then # hostrange spec str_lprefix="${lcur%\]-*}]-" lcur="${lcur#*\]-}" elif [[ $lcur = *-[[]+([!]]) ]]; then # incomplete range - host with dash str_lprefix="${lcur%-\[*}-" lcur="${lcur#"$str_lprefix"}" elif [[ $lcur = $str_glob ]]; then # range spec str_lprefix="${lcur%-*}-" lcur="${lcur#*-}" fi fi # ip-list from file COMPREPLY+=( $( compgen -W \ '$(_ipset_get_iplist "$(_ipset_get_set_family "$str_setname")")' \ -- "$lcur" ) ) # networks COMPREPLY+=( $( compgen -W '$(_ipset_get_networks)' -- "$lcur" ) ) # hostnames _ipset_complete_hostnames "$lcur" if [[ $str_lprefix ]]; then # range spec COMPREPLY=( $( compgen -P "$str_lprefix" -W '${COMPREPLY[@]//*\/*/}' \ -- "$lcur" ) ) else COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$lcur" ) ) fi if ((${#COMPREPLY[@]} == 1)); then if [[ $str_lprefix || x$str_action = xtest ]]; then COMPREPLY=( ${COMPREPLY[*]}, ) else COMPREPLY=( ${COMPREPLY[*]}, ${COMPREPLY[*]}- ) fi fi __ltrim_colon_completions "$str_lprefix$lcur" elif [[ $lcur = *,* ]]; then str_lprefix="${lcur}" lcur="${lcur#*,}" str_var="" str_lprefix="${str_lprefix%"$lcur"}" if [[ $lcur = physdev:* ]]; then lcur="${lcur#physdev:}" str_lprefix="${str_lprefix}physdev:" else str_var="physdev:" fi COMPREPLY+=( $( compgen -P "$str_lprefix" -W \ '${str_var} $(_ipset_get_ifnames)' -- "$lcur" ) ) [[ ${COMPREPLY[0]} = *physdev: ]] && compopt -o nospace __ltrim_colon_completions "$str_lprefix" fi } _ipset_complete_host_spec() { local lcur="$1" str_lprefix="" str_lsuffix="" local -i no_range=0 v4_only=0 if [[ $lcur = *,* && $str_type = hash:ip,mark ]]; then return 0 fi shift compopt -o nospace while (($#)); do [[ $1 = --no-range ]] && no_range=1 [[ $1 = --v4 ]] && v4_only=1 shift done # range spec if [[ $lcur = @(""|+([[:word:]])) ]]; then # empty or [:word:] str_lsuffix="-" elif [[ $lcur = [[]*-*[]] ]]; then # host with hyphen str_lsuffix="-" elif [[ $lcur = [[]*([!]]) ]]; then # incomplete host with dash str_lsuffix="-" elif [[ $lcur = *-[[]+([!]]) ]]; then # incomplete range - host with dash str_lprefix="${lcur%\-[*}-" lcur="${lcur#"$str_lprefix"}" elif [[ $lcur = \[*\]-* ]]; then # first part of hostname range str_lprefix="${lcur%\]-*}]-" lcur="${lcur##*\]-}" elif [[ $lcur != *-* ]]; then # no hypen str_lsuffix="-" else # ip-range str_lprefix="${lcur%-*}-" lcur="${lcur##*-}" fi if [[ $str_lprefix ]]; then # range not valid ((no_range)) && return 1 # range not valid if first part is ip/cidr [[ $str_lprefix = */* ]] && return 1 fi # ip-list from file if [[ $str_lprefix ]]; then # only ipv4 range supported COMPREPLY+=( $( compgen -W '$(_ipset_get_iplist v4)' -- "$lcur" ) ) elif ((v4_only)); then # this type only supports ipv4 COMPREPLY+=( $( compgen -W '$(_ipset_get_iplist v4)' -- "$lcur" ) ) else # we gather the family type COMPREPLY+=( $( compgen -W \ '$(_ipset_get_iplist "$(_ipset_get_set_family "$str_setname")")' \ -- "$lcur" ) ) __ltrim_colon_completions "$lcur" fi _ipset_complete_hostnames "$lcur" if [[ $str_lprefix ]]; then # if the prefix is defined add it to compreply COMPREPLY=( $( compgen -P "$str_lprefix" -W '${COMPREPLY[@]}' -- "$lcur" ) ) else # add networks for hash:net?(,net), hash:ip,mark, or bitmap:ip for add/del action if [[ $str_type = hash:@(net?(,net)|ip,mark) ]] || \ [[ $str_type = bitmap:* && $str_action = @(add|create|del) ]] then COMPREPLY+=( $( compgen -W '$(_ipset_get_networks)' -- "$lcur" ) ) fi fi if ((${#COMPREPLY[@]} == 1)); then if [[ $str_lprefix ]]; then # we can add a space, if it's a range (not with hash:net,net or hash:ip,mark) if [[ $str_type != hash:@(net,net|ip,mark) ]]; then compopt +o nospace fi fi fi } _ipset_complete_hostport_spec() { # complete on host,proto:port[,host] spec local str_proto str_glob2 str_lprefix lcur str_lprefix2 lcur2 local lcur="$1" if [[ $str_type = hash:@(ip|net),port,@(ip|net) ]]; then str_suffix=',' else str_suffix='' fi str_regex='^[^,]+,([^,]+)?$' if [[ $lcur != *,* ]]; then str_lprefix="" str_suffix="" compopt -o nospace if [[ $str_type = hash:@(ip,port|net,port|ip,port,ip|ip,port,net|net,port,net) && \ $str_action = @(add|del|test) ]] then # range spec if [[ $lcur = @(""|+([[:word:]])) ]]; then # empty or [:word:] str_suffix="-" elif [[ $lcur = [[]*-*[]] ]]; then # host with hyphen str_suffix="-" elif [[ $lcur = [[]*([!]]) ]]; then # incomplete host with dash str_suffix="-" elif [[ $lcur = *-[[]+([!]]) ]]; then # incomplete range - host with dash str_lprefix="${lcur%\-[*}-" lcur="${lcur#"$str_lprefix"}" elif [[ $lcur = \[*\]-* ]]; then # first part of hostname range str_lprefix="${lcur%\]-*}]-" lcur="${lcur##*\]-}" elif [[ $lcur != *-* ]]; then # no hypen str_suffix="-" else # ip-range str_lprefix="${lcur%-*}-" lcur="${lcur##*-}" fi fi # ip-list from file COMPREPLY+=( $( compgen -W \ '$(_ipset_get_iplist "$(_ipset_get_set_family "$str_setname")")' \ -- "$lcur" ) ) if [[ $str_type = hash:net,port?(,net) ]]; then COMPREPLY+=( $( compgen -W '$(_ipset_get_networks)' -- "$lcur" ) ) __ltrim_colon_completions "$lcur" fi _ipset_complete_hostnames "$lcur" if [[ $str_lprefix ]]; then # range spec COMPREPLY=( $( compgen -P "$str_lprefix" -W '${COMPREPLY[@]}' -- "$lcur" ) ) fi if ((${#COMPREPLY[@]} == 1)); then if [[ $str_suffix = - ]]; then COMPREPLY=( $( compgen -W '${COMPREPLY[*]}, ${COMPREPLY[*]}-' -- "$lcur" ) ) else COMPREPLY=( ${COMPREPLY[*]}, ) fi fi __ltrim_colon_completions "$str_lprefix$lcur" elif [[ $lcur =~ $str_regex ]]; then compopt -o nospace str_glob='[^[]*-' # otherwise messes up my vim syntax highlightning str_regex='.*,(icmp|icmp6|tcp|sctp|udp|udplite):.*' # for compat put regex in var if [[ $lcur != *icmp* && \ $lcur = *,@(?(tcp:|sctp:|udp:|udplite:)@(+([[:word:]])-|\[*-*\]-)|\[*-*\]-)* ]] then # range spec str_lprefix="$lcur" str_glob='*[[]*' str_glob2='*,*-\[*' str_proto="tcp" str_var="" [[ $lcur =~ .*(tcp|sctp|udp|udplite):.* ]] && str_proto=${BASH_REMATCH[1]} if [[ $lcur = *,*\[*-*\]-* ]]; then str_var="${lcur#*,*[}" lcur="${lcur##*\]-}" str_lprefix=${str_lprefix%"$lcur"} str_var="${str_var%\]*}" elif [[ $lcur = $str_glob2 ]]; then str_var="${lcur#*,}" lcur="${lcur##*-}" str_var="${str_var#${BASH_REMATCH[1]}:}" str_lprefix=${str_lprefix%"$lcur"} str_var="${str_var%%-*}" else str_var="${lcur#*,}" lcur="${lcur##*-}" str_var="${str_var#${BASH_REMATCH[1]}:}" str_lprefix=${str_lprefix%"$lcur"} str_var="${str_var%-*}" fi COMPREPLY+=( $( compgen -P "$str_lprefix" -S "$str_suffix" -W \ '$(_ipset_get_services -p "$str_proto" -o "$str_var")' -- "$lcur") ) if [[ $str_lprefix = *:* ]]; then str_lprefix="${str_lprefix%:*}:" fi __ltrim_colon_completions "${str_lprefix}" if ((${#COMPREPLY[@]} == 1)); then if [[ $str_lprefix && $str_type != hash:@(ip|net),port,@(ip|net) ]]; then compopt +o nospace fi fi elif [[ $lcur =~ $str_regex ]]; then # icmp[6] and services with (tcp|udp|sctp|udplite): prefix str_var=${BASH_REMATCH[1]} str_lprefix="${lcur}" lcur="${lcur#*,}" str_lprefix="${str_lprefix%"$lcur"}" lcur="${lcur#${BASH_REMATCH[1]}:}" str_lprefix="${str_lprefix}${BASH_REMATCH[1]}:" if [[ $str_var = icmp ]]; then COMPREPLY+=( $( compgen -P "$str_lprefix" -S "$str_suffix" -W \ '${arr_icmp_types[@]}' -- "$lcur" ) ) elif [[ $str_var = icmp6 ]]; then COMPREPLY+=( $( compgen -P "$str_lprefix" -S "$str_suffix" -W \ '${arr_icmp6_types[@]}' -- "$lcur" ) ) elif [[ $str_var = @(tcp|udp|sctp|udplite) ]]; then COMPREPLY+=( $( compgen -P "$str_lprefix" -W \ '$(_ipset_get_services -p $str_var)' -- "$lcur" ) ) fi __ltrim_colon_completions "$str_lprefix" elif [[ $lcur = *,* ]]; then # first attempt :/ long list str_lprefix="${lcur%,*}," lcur="${lcur#*,}" str_var="tcp: udp: sctp: udplite: icmp: icmp6:" # add the services COMPREPLY+=( $( compgen -P "$str_lprefix" -W \ '$str_var $(_ipset_get_services)' -- "$lcur" ) ) # add the protocols COMPREPLY+=( $( compgen -P "$str_lprefix" -S ":0$str_suffix" -W \ '$(_ipset_get_protocols)' -- "$lcur" ) ) __ltrim_colon_completions "$str_lprefix$lcur" compopt -o nospace fi elif [[ $lcur = *,*,* && $str_type = hash:@(ip,port,@(ip|net)|net,port,net) ]]; then str_lprefix2="${lcur}" lcur2="${lcur##*,}" str_lprefix2="${str_lprefix2%"$lcur2"}" lcur="$lcur2" # ip-list from file COMPREPLY+=( $( compgen -W \ '$(_ipset_get_iplist "$(_ipset_get_set_family "$str_setname")")' \ -- "$lcur2" ) ) if [[ $str_type = hash:@(ip|net),port,net && x$str_action != xtest ]]; then # range spec if [[ $lcur = @(""|+([[:word:]])) ]]; then # empty or [:word:] str_suffix="-" elif [[ $lcur = [[]*-*[]] ]]; then # host with hyphen str_suffix="-" elif [[ $lcur = [[]+([!]]) ]]; then # incomplete host with dash str_suffix="-" elif [[ $lcur = *-[[]+([!]]) ]]; then # incomplete range - host with dash str_lprefix="${lcur%\-[*}-" lcur="${lcur#"$str_lprefix"}" elif [[ $lcur = \[*\]-* ]]; then # first part of hostname range str_lprefix="${lcur%\]-*}]-" lcur="${lcur##*\]-}" elif [[ $lcur != *-* ]]; then # no hypen str_suffix="-" else # ip-range str_lprefix="${lcur%-*}-" lcur="${lcur##*-}" fi # networks COMPREPLY+=( $( compgen -W '$(_ipset_get_networks)' -- "$lcur" ) ) fi _ipset_complete_hostnames "$lcur" if [[ $str_lprefix ]]; then COMPREPLY=( $( compgen -P "$str_lprefix" \ -W '${COMPREPLY[@]}' -- "$lcur" ) ) fi if [[ $str_lprefix2 ]]; then COMPREPLY=( $( compgen -P "$str_lprefix2" \ -W '${COMPREPLY[@]}' -- "$lcur2" ) ) fi __ltrim_colon_completions "$str_lprefix2$lcur2" if ((${#COMPREPLY[@]} == 1)); then if [[ $str_type = hash:@(ip|net),port,net && \ ${COMPREPLY[*]##*,} != */* ]] then compopt -o nospace fi fi fi } _ipset_complete_netnet_spec() { # complete hash:net,net sets local lcur="$1" if [[ $lcur = *,* ]]; then str_lprefix="$lcur" lcur="${lcur#*,}" str_lprefix="${str_lprefix%,*}," _ipset_complete_host_spec "$lcur" compopt -o nospace COMPREPLY+=( $( compgen -P "$str_lprefix" -W '${COMPREPLY[@]}' -- "$lcur" ) ) if ((${#COMPREPLY[@]} == 1 )); then str_glob='@(*/*|\[*\]-*|+([![])-*)' [[ ${COMPREPLY[0]#*,} = $str_glob ]] && compopt +o nospace fi else _ipset_complete_host_spec "$lcur" compopt -o nospace if ((${#COMPREPLY[@]} == 1 )); then str_glob='@(*/*|\[*\]-\[*\]|+([![])-+([![])|\[*\]-+([![])|+([![])-\[*\])' if [[ ${COMPREPLY[0]} = $str_glob ]]; then COMPREPLY=( ${COMPREPLY[*]}, ) else COMPREPLY=( ${COMPREPLY[*]}- ${COMPREPLY[*]}, ) fi fi fi } _ipset_complete_mac_spec() { local lcur="$1" mac rest a b addr str_tmp local str_regex='^([[:xdigit:]]{2})(:[[:xdigit:]]{2}){5}$' local -i x=y=0 if [[ ${_IPSET_MAC_COMPL_MODE:=both} = both ]]; then x=1 y=1 elif [[ $_IPSET_MAC_COMPL_MODE = file ]]; then x=1 elif [[ $_IPSET_MAC_COMPL_MODE = system ]]; then y=1 fi if ((x)); then if [[ $_IPSET_MACLIST_FILE && -r $_IPSET_MACLIST_FILE ]]; then # if a file with mac addresses is in env var, load em while read -r mac rest; do [[ $mac = *([[:blank:]])\#* ]] && continue mac="${mac//\#*/}" [[ $mac =~ $str_regex ]] && printf "%s\n" "$mac" done < "${_IPSET_MACLIST_FILE}" fi fi if ((y)); then # read arp cache, addresses of local interfaces and /etc/ethers str_tmp=$(while read a b addr rest; do [[ $addr =~ $str_regex ]] && printf "%s\n" "$addr" done < <(PATH=$PATH:/sbin command arp -n 2>/dev/null)) str_tmp+=" $(while read -r; do [[ $REPLY = *link/loopback* ]] && continue REPLY=${REPLY#*link/*+([[:blank:]])} REPLY=${REPLY%+([[:blank:]])brd*} [[ $REPLY =~ $str_regex ]] && printf "%s\n" "$REPLY" done < <(PATH=$PATH:/sbin command ip -o link show 2>/dev/null))" if [[ -r /etc/ethers ]]; then str_tmp+=" $(while read -r addr rest; do [[ $addr =~ $str_regex ]] && printf "%s\n" "$addr" done < /etc/ethers)" fi printf "%s\n" "$str_tmp" fi } # ----------------------------------------------------------------- # Main # ----------------------------------------------------------------- _ipset_complete() { # at least bash 4 is required ((${BASH_VERSINFO[0]} < 4)) && return 0 local cur prev cword words ips_version local str_action str_setname str_type str_filename local str_glob str_regex str_prefix str_suffix local str_tmp="" str_var="" local str_timeout="timeout" str_order="before after" str_forceadd="" local str_counters="" str_bp_counters="" str_comment="" str_markmask="" local str_skbinfo="" str_skbflags="" local -i i=x=y=0 local -i got_bashcompl=got_action=action_index=order_index=set_has_timeout=0 local -i got_bp_proto=0 local -i ignore_errors=use_file=names_only=headers_only=save_format=res_sort=0 local arr_sets=() arr_types=() arr_members=() local arr_dupe_cmd_opts=() arr_used_opts=() arr_tmp=() local arr_opts=( "-! -exist" "-o -output" "-q -quiet" "-r -resolve" "-s -sorted" "-n -name" "-t -terse" "-f -file" ) local arr_icmp_types=( echo-reply pong network-unreachable host-unreachable protocol-unreachable port-unreachable fragmentation-needed source-route-failed network-unknown host-unknown network-prohibited host-prohibited TOS-network-unreachable TOS-host-unreachable communication-prohibited host-precedence-violation precedence-cutoff source-quench network-redirect host-redirect TOS-network-redirect TOS-host-redirect echo-request ping router-advertisement router-solicitation ttl-zero-during-transit ttl-zero-during-reassembly ip-header-bad required-option-missing timestamp-request timestamp-reply address-mask-request address-mask-reply ) local arr_icmp6_types=( no-route communication-prohibited address-unreachable port-unreachable packet-too-big ttl-zero-during-transit ttl-zero-during-reassembly bad-header unknown-header-type unknown-option echo-request ping echo-reply pong router-solicitation router-advertisement neighbour-solicitation neigbour-solicitation neighbour-advertisement neigbour-advertisement redirect ) COMPREPLY=() # expecting _get_comp_words_by_ref() to exist from bash_completion if declare -f _get_comp_words_by_ref &>/dev/null; then got_bashcompl=1 _get_comp_words_by_ref -n : cur prev cword words || return else got_bashcompl=0 # not so neat, but a workaround COMP_WORDBREAKS="${COMP_WORDBREAKS//:/}" cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" cword=$COMP_CWORD for i in ${!COMP_WORDS[@]}; do words[i]="${COMP_WORDS[i]}"; done fi # ipset version check 6.x upwards (to v?) is supported # All calls of ipset should be done in a subshell with stderr # pointing to /dev/null, to avoid printing of # `-bash command ipset not found' errors i=0 # for safety if ((UID != 0)); then # not root user "${words[0]}" version &>/dev/null # can we retrieve the version? i=$? fi if ((i == 0)); then ips_version="$("${words[0]}" version)" ips_version="${ips_version#ipset v}" ips_version="${ips_version%,+([[:blank:]])protocol*}" read -a ips_version <<< ${ips_version//./ } [[ ${ips_version[0]} = +([[:digit:]]) ]] || return 1 else # assume we have no permissions to run ipset # set version to 6.22 = show all features # though many things won't work, as of missing permissions ips_version=( 6 22 ) fi ((ips_version[0] < 6)) && return 1 # ipset -ge v6.19 has counters flag # ipset -ge v6.20 has comment flag # ipset -ge v6.21 has hash:ip,mark markmask flag # ipset -ge v6.22 has skbinfo flag if ((ips_version[0] > 6)); then str_counters="counters" str_bp_counters="bytes packets" str_comment="comment" str_markmask="markmask" str_skbinfo="skbinfo" str_skbflags="skbmark skbprio skbqueue" got_bp_proto=1 elif ((ips_version[0] == 6)); then if ((ips_version[1] >= 22)); then str_comment="comment" str_markmask="markmask" str_forceadd="forceadd" str_skbinfo="skbinfo" str_skbflags="skbmark skbprio skbqueue" got_bp_proto=1 elif ((ips_version[1] >= 21)); then str_comment="comment" str_markmask="markmask" str_forceadd="forceadd" got_bp_proto=1 elif ((ips_version[1] >= 20)); then str_comment="comment" got_bp_proto=1 elif ((ips_version[1] >= 19)); then str_counters="counters" str_bp_counters="bytes packets" fi else # ipset versions -lt 6 are not supported return 0 fi # construct own known_hosts function from origin # just remove the __ltrim_colon_completions call # to avoid unwanted ltrim if we need to work with the list of hosts # ugly hack - gimme better ;p if ((got_bashcompl)); then if ! declare -F _ipset_known_hosts &>/dev/null; then eval '_ipset_known_hosts() { '$(declare -f _known_hosts_real | \ grep -v __ltrim_colon_completions | \ grep -Ev "^_known_hosts_real.*$" | grep -Ev "^(\{|\})")' }' fi fi if [[ $_DEBUG_NF_COMPLETION ]]; then printf "\nCOMP_WORDBREAKS: <%s>\n" "$COMP_WORDBREAKS" printf "COMP_LINE: <%s>\n" "$COMP_LINE" printf "COMP_TYPE: <%s>\n" "$COMP_TYPE" printf "COMP_POINT: <%s>\n" "$COMP_POINT" printf "COMP_KEY: <%s>\n" "$COMP_KEY" printf "COMP_CWORD: <%s>\n" "$COMP_CWORD" printf "cword: <%s>\n" "$cword" printf "cur: <%s> prev: <%s>\n" "$cur" "$prev" printf "words:\n" "<%s>\n" "${words[@]}" fi # collect information about used options for ((i=1; i < ${#words[@]}-1; i++)); do if [[ ${words[i]} = @(create|n|add|del|test|destroy|x|list|save|restore|flush|rename|e|swap|w|help|version) ]] then [[ ${words[i-1]} = @(-f|-file) ]] && continue # could be a file named like a command if ! ((got_action)); then if [[ ${words[i]} != save ]]; then got_action=1 action_index=$i str_action=${words[i]} elif [[ ${words[i-1]} != @(-o|-output) ]]; then got_action=1 action_index=$i str_action=${words[i]} fi if [[ $str_action = @(create|n|add|del|test|destroy|x|list|save|restore|flush|rename|e|swap|w) ]] then str_setname=${words[i+1]} # register the set name fi fi elif [[ ${words[i]} = @(-\!|-exist) ]]; then if [[ ${words[i-1]} != @(-f|-file) ]]; then ignore_errors=1 arr_used_opts+=(${words[i]}) fi elif [[ ${words[i]} = @(-f|-file) ]]; then if [[ ${words[i-1]} != @(-f|-file) ]]; then use_file=1 str_filename="${words[i+1]}" arr_used_opts+=(${words[i]}) fi elif [[ ${words[i]} = @(-n|-name) ]]; then if [[ ${words[i-1]} != @(-f|-file) ]]; then names_only=1 arr_used_opts+=(${words[i]}) fi elif [[ ${words[i]} = @(-t|-terse) ]]; then if [[ ${words[i-1]} != @(-f|-file) ]]; then headers_only=1 arr_used_opts+=(${words[i]}) fi elif [[ ${words[i]} = @(-o|-output) ]]; then if [[ ${words[i-1]} != @(-f|-file) ]]; then arr_used_opts+=(${words[i]}) if [[ $prev = @(-o|-output) ]]; then save_format=2 # expecting opt-arg elif [[ ${words[i+1]} = save ]]; then save_format=3 # no -n/-t with -o save else save_format=1 fi fi elif [[ ${words[i]} = @(-r|-resolve|-s|-sorted) ]]; then if [[ ${words[i-1]} != @(-f|-file) ]]; then res_sort=1 arr_used_opts+=(${words[i]}) fi elif [[ ${words[i]} = @(-q|-quiet) ]]; then arr_used_opts+=(${words[i]}) elif [[ ${words[i]} = @(before|after) ]]; then if ((got_action && ! order_index && i == action_index+3)); then order_index=$i str_order="" fi elif [[ ${words[i]} = @(timeout|range|maxelem|family|hashsize|size|netmask|nomatch|counters|bytes|packets|comment|markmask|forceadd|skbinfo|skbmark|skbprio|skbqueue) ]] then if ((got_action && i > action_index+2)); then str_tmp="$COMP_LINE" [[ $str_setname = ${words[i]} ]] && str_tmp="${str_tmp/${words[i]}/}" [[ $str_filename = ${words[i]} ]] && str_tmp="${str_tmp/${words[i]}/}" [[ $str_tmp = *${words[i]}* ]] && arr_dupe_cmd_opts[${#arr_dupe_cmd_opts[@]}]="${words[i]}" fi fi done if [[ $_DEBUG_NF_COMPLETION ]]; then printf "\ngot_action: <%s>\n" "$got_action" printf "str_action: <%s>\n" "$str_action" printf "action_index: <%s>\n" "$action_index" printf "order_index: <%s>\n" "$order_index" printf "str_setname: <%s>\n" "$str_setname" printf "str_filename: <%s>\n" "$str_filename" printf "save_format: <%s>\n" "$save_format" printf "ignore_errors: <%s>\n" "$ignore_errors" printf "names_only: <%s>\n" "$names_only" printf "headers_only: <%s>\n" "$headers_only" printf "arr_used_opts: <%s>\n" "${arr_used_opts[@]}" printf "arr_dupe_cmd_opts: <%s>\n" "${arr_dupe_cmd_opts[@]}" fi # invalid combination of options if ((names_only && headers_only)); then return 0 elif ((names_only || headers_only)); then if ((res_sort || ignore_errors)) || ((save_format == 3)); then return 0 fi elif ((ignore_errors)); then if ((res_sort || save_format)); then return 0 fi fi # catch variables and command substitution if [[ $cur == \$\(* ]]; then # command substitution COMPREPLY=( $(compgen -c -P '$(' ${cur#??}) ) return 0 elif [[ $cur == \$\{* ]]; then # variables with a leading `${' COMPREPLY=( $(compgen -v -P '${' -S '}' ${cur#??}) ) return 0 elif [[ $cur == \$* ]]; then # variables with a leading `$' COMPREPLY=( $(compgen -v -P '$' ${cur#?} ) ) return 0 fi # depend on previous option if [[ $prev = @(-o|-output) ]]; then # make sure it's not a filename named -o or -output if [[ $str_filename != $prev ]]; then if ((names_only || headers_only)); then COMPREPLY=( $( compgen -W 'plain xml' -- "$cur" ) ) else COMPREPLY=( $( compgen -W 'plain save xml' -- "$cur" ) ) fi return 0 fi elif [[ $prev = @(-f|-file|\<|\>) ]]; then if ((got_bashcompl)); then _filedir else compopt -o nospace COMPREPLY=( $( compgen -f -- "$cur" ) ) fi return 0 fi if ((got_action)); then # we got the main action # Disallow sets with names of options starting with a hyphen if [[ $str_setname = -?* && $cur != -?* && \ $str_action = @(create|n|add|del|test|rename|e|swap|w) ]] then for x in ${!arr_opts[@]}; do set -- ${arr_opts[x]} [[ $str_setname = @($1|$2) ]] && return 0 done fi if ((cword == action_index+1)) && [[ $str_action = $prev ]]; then # depend on previous option which should be the action # create|n|version - take no aktion if [[ $str_action = help ]]; then _ipset_get_supported_types COMPREPLY=( $( compgen -W '${arr_types[@]}' -- "$cur" ) ) __ltrim_colon_completions "$cur" elif [[ $str_action = @(add|del|rename|e|swap|w|test) ]]; then COMPREPLY=( $( compgen -W '$( ( "${words[0]}" list -n ) 2>/dev/null )' -- "$cur" ) ) __ltrim_colon_completions "$cur" elif [[ $str_action = @(list|flush|save|destroy|x) ]]; then # we don't know if its an option request, could also be a set # named `-*', if the latter is true, show sets and options if [[ $cur = -* ]]; then _ipset_get_options if _ipset_is_set "${cur}*"; then COMPREPLY=( $( compgen -W '${arr_sets[@]}' -- "$cur" ) ) __ltrim_colon_completions "$cur" fi else COMPREPLY=( $( compgen -W '$( ( "${words[0]}" list -n ) 2>/dev/null )' -- "$cur" ) ) __ltrim_colon_completions "$cur" fi elif [[ $str_action = restore ]]; then if [[ $cur = -* ]]; then _ipset_get_options elif ! [[ $str_filename ]]; then # don't show redirector if we have option -f COMPREPLY=( \< ) fi fi elif ((cword == action_index+2)) && [[ $str_setname = $prev ]]; then # rename|e - take no aktion if [[ $str_action = @(save|restore|list|flush|destroy|x) ]]; then if [[ $cur = -* ]]; then _ipset_get_options fi elif [[ $str_action = @(create|n) ]]; then _ipset_get_supported_types COMPREPLY=( $( compgen -W '${arr_types[@]}' -- "$cur" ) ) __ltrim_colon_completions "$cur" elif [[ $str_action = @(swap|w) ]]; then # list two sets COMPREPLY=( $( compgen -W '$( ( "${words[0]}" list -n ) 2>/dev/null )' -- "$cur" ) ) for i in ${!COMPREPLY[@]}; do # remove the dupe setname from the list [[ ${COMPREPLY[i]} = $str_setname ]] && unset COMPREPLY[i] && break done __ltrim_colon_completions "$cur" elif [[ $str_action = add ]]; then str_type=$(_ipset_get_set_type "$str_setname") if [[ $str_type = bitmap:ip ]]; then _ipset_complete_host_spec "$cur" --v4 __ltrim_colon_completions "$cur" elif [[ $str_type = @(hash:ip|hash:net|hash:ip,mark) ]]; then _ipset_complete_host_spec "$cur" __ltrim_colon_completions "$cur" elif [[ $str_type = hash:net,iface ]]; then _ipset_complete_iface_spec "$cur" elif [[ $str_type = hash:@(ip,port|ip,port,ip|ip,port,net|net,port|net,port,net) ]] then _ipset_complete_hostport_spec "$cur" elif [[ $str_type = hash:net,net ]]; then _ipset_complete_netnet_spec "$cur" __ltrim_colon_completions "$cur" elif [[ $str_type = hash:mac ]]; then COMPREPLY=( $( compgen -W '$(_ipset_complete_mac_spec)' -- "$cur" ) ) __ltrim_colon_completions "$cur" elif [[ $str_type = bitmap:ip,mac ]]; then if [[ $cur = *,* ]]; then str_prefix="$cur" cur="${cur#*,}" str_prefix="${str_prefix%$cur}" COMPREPLY+=( $( compgen -P "$str_prefix" -W '$(_ipset_complete_mac_spec)' \ -- "$cur" ) ) __ltrim_colon_completions "$str_prefix$cur" else compopt -o nospace _ipset_complete_host_spec "$cur" --v4 --no-range __ltrim_colon_completions "$cur" if ((${#COMPREPLY[@]} == 1)); then COMPREPLY=( ${COMPREPLY[*]}, ) fi fi elif [[ $str_type = bitmap:port ]]; then # complete port [range] _ipset_complete_portrange "$cur" elif [[ $str_type = list:* ]]; then # show sets if the set to add is of type list:set arr_tmp=() arr_sets=( $( ( "${words[0]}" list -n ) 2>/dev/null ) ) _ipset_get_members --names-only "$str_setname" for x in ${!arr_sets[@]}; do [[ ${arr_sets[x]} = $str_setname ]] && continue for y in ${!arr_members[@]}; do [[ ${arr_sets[x]} = ${arr_members[y]} ]] && continue 2 done arr_tmp+=("${arr_sets[x]}") done COMPREPLY=( $( compgen -W '${arr_tmp[@]}' -- "$cur" ) ) __ltrim_colon_completions "$cur" fi elif [[ $str_action = del ]]; then str_type=$(_ipset_get_set_type "$str_setname") if [[ $str_type = bitmap:ip ]]; then str_prefix="" if [[ ${_IPSET_COMPL_DEL_MODE:=both} = members ]]; then _ipset_complete_elements "$cur" elif [[ ${_IPSET_COMPL_DEL_MODE} = spec ]]; then _ipset_complete_host_spec "$cur" --v4 __ltrim_colon_completions "$cur" else _ipset_complete_host_spec "$cur" --v4 _ipset_complete_elements "$cur" __ltrim_colon_completions "$cur" fi elif [[ $str_type = bitmap:port ]]; then str_prefix="" if [[ ${_IPSET_COMPL_DEL_MODE:=both} = members ]]; then _ipset_complete_elements "$cur" elif [[ ${_IPSET_COMPL_DEL_MODE} = spec ]]; then _ipset_complete_portrange "$cur" else _ipset_complete_portrange "$cur" _ipset_get_members --names-only "$str_setname" str_glob='?(tcp:|udp:)@([![]*-*|\[?*\]-*)' if [[ $cur = $str_glob ]]; then str_var="${cur#?(tcp:|udp:)}" # offset str_tmp="${cur%"$str_var"}" # proto # identify service number by name, to find the offset if [[ $str_var != +([[:digit:]]) ]]; then if [[ $str_var = \[+([![])\]-* ]]; then str_var="${str_var%%\]*}" str_var="${str_var#\[}" elif [[ $str_var = *-* ]]; then str_var="${str_var%%-*}" fi str_var=$(_ipset_get_svnum -p "${str_tmp:-all}" -o "$str_var") fi if [[ $str_var = +([[:digit:]]) ]]; then for i in ${!arr_members[@]}; do ((${arr_members[i]} <= $str_var)) && \ unset arr_members[i] || break done fi str_prefix="${cur%-*}-" cur="${cur##*-}" fi COMPREPLY+=( $( compgen -P "$str_prefix" -W '${arr_members[@]}' -- "$cur" ) ) fi elif [[ $str_type = bitmap:ip,mac ]]; then str_prefix="" if [[ ${_IPSET_COMPL_DEL_MODE:=both} = members ]]; then _ipset_complete_elements "$cur" --no-range __ltrim_colon_completions "$cur" elif [[ ${_IPSET_COMPL_DEL_MODE} = spec ]]; then _ipset_complete_host_spec "$cur" --v4 --no-range __ltrim_colon_completions "$cur" else _ipset_complete_host_spec "$cur" --v4 --no-range _ipset_complete_elements "$cur" --no-range __ltrim_colon_completions "$cur" fi elif [[ $str_type = hash:@(ip?(,mark)|net) ]]; then str_prefix="" if [[ ${_IPSET_COMPL_DEL_MODE:=both} = members ]]; then _ipset_complete_elements "$cur" __ltrim_colon_completions "$cur" elif [[ ${_IPSET_COMPL_DEL_MODE} = spec ]]; then _ipset_complete_host_spec "$cur" __ltrim_colon_completions "$cur" else _ipset_complete_host_spec "$cur" _ipset_complete_elements "$cur" __ltrim_colon_completions "$cur" fi elif [[ $str_type = hash:net,net ]]; then if [[ ${_IPSET_COMPL_DEL_MODE:=both} = members ]]; then _ipset_complete_elements "$cur" __ltrim_colon_completions "$cur" elif [[ ${_IPSET_COMPL_DEL_MODE} = spec ]]; then _ipset_complete_netnet_spec "$cur" __ltrim_colon_completions "$cur" else _ipset_complete_netnet_spec "$cur" _ipset_complete_elements "$cur" __ltrim_colon_completions "$cur" fi elif [[ $str_type = hash:@(ip,port|ip,port,ip|ip,port,net|net,port|net,port,net) ]] then if [[ ${_IPSET_COMPL_DEL_MODE:=both} = members ]]; then _ipset_complete_elements "$cur" --no-range __ltrim_colon_completions "$cur" elif [[ ${_IPSET_COMPL_DEL_MODE} = spec ]]; then _ipset_complete_hostport_spec "$cur" else _ipset_complete_elements "$cur" --no-range _ipset_complete_hostport_spec "$cur" __ltrim_colon_completions "$cur" fi elif [[ $str_type = hash:net,iface ]]; then if [[ ${_IPSET_COMPL_TEST_MODE:=both} = members ]]; then _ipset_complete_elements "$cur" --no-range __ltrim_colon_completions "$cur" elif [[ ${_IPSET_COMPL_TEST_MODE} = spec ]]; then _ipset_complete_iface_spec "$cur" else _ipset_complete_elements "$cur" --no-range _ipset_complete_iface_spec "$cur" __ltrim_colon_completions "$cur" fi else _ipset_complete_elements "$cur" --no-range __ltrim_colon_completions "$cur" fi elif [[ $str_action = test ]]; then str_type=$(_ipset_get_set_type "$str_setname") if [[ $str_type = bitmap:ip ]]; then if [[ ${_IPSET_COMPL_TEST_MODE:=both} = members ]]; then _ipset_complete_elements "$cur" --no-range elif [[ ${_IPSET_COMPL_TEST_MODE} = spec ]]; then _ipset_complete_host_spec "$cur" --no-range --v4 else _ipset_complete_elements "$cur" --no-range if ! _ipset_complete_host_spec "$cur" --no-range --v4; then COMPREPLY=() fi fi elif [[ $str_type = hash:ip?(,mark) ]]; then if [[ ${_IPSET_COMPL_TEST_MODE:=both} = members ]]; then _ipset_complete_elements "$cur" --no-range __ltrim_colon_completions "$cur" elif [[ ${_IPSET_COMPL_TEST_MODE} = spec ]]; then _ipset_complete_host_spec "$cur" --no-range __ltrim_colon_completions "$cur" else _ipset_complete_elements "$cur" --no-range if ! _ipset_complete_host_spec "$cur" --no-range; then COMPREPLY=() fi __ltrim_colon_completions "$cur" fi elif [[ $str_type = hash:net ]]; then if [[ ${_IPSET_COMPL_TEST_MODE:=both} = members ]]; then _ipset_complete_elements "$cur" --no-range __ltrim_colon_completions "$cur" elif [[ ${_IPSET_COMPL_TEST_MODE} = spec ]]; then _ipset_complete_host_spec "$cur" __ltrim_colon_completions "$cur" else _ipset_complete_elements "$cur" --no-range if ! _ipset_complete_host_spec "$cur"; then COMPREPLY=() fi __ltrim_colon_completions "$cur" fi elif [[ $str_type = hash:@(ip,port|ip,port,ip|ip,port,net|net,port|net,port,net) ]] then if [[ ${_IPSET_COMPL_TEST_MODE:=both} = members ]]; then _ipset_complete_elements "$cur" --no-range __ltrim_colon_completions "$cur" elif [[ ${_IPSET_COMPL_TEST_MODE} = spec ]]; then _ipset_complete_hostport_spec "$cur" else _ipset_complete_elements "$cur" --no-range _ipset_complete_hostport_spec "$cur" __ltrim_colon_completions "$cur" fi elif [[ $str_type = hash:net,iface ]]; then if [[ ${_IPSET_COMPL_TEST_MODE:=both} = members ]]; then _ipset_complete_elements "$cur" --no-range __ltrim_colon_completions "$cur" elif [[ ${_IPSET_COMPL_TEST_MODE} = spec ]]; then _ipset_complete_iface_spec "$cur" else _ipset_complete_elements "$cur" --no-range _ipset_complete_iface_spec "$cur" __ltrim_colon_completions "$cur" fi elif [[ $str_type = bitmap:port ]]; then str_prefix="" str_tmp="$cur" if [[ $cur = @(tcp|udp):* ]]; then ((got_bp_proto)) || return 0 # supported since ipset v6.20 str_prefix="${cur%:*}" str_tmp="${str_tmp#${str_prefix}:}" fi if [[ ${_IPSET_COMPL_TEST_MODE:=both} = members ]]; then _ipset_complete_elements "$cur" --no-range __ltrim_colon_completions "$cur" elif [[ ${_IPSET_COMPL_TEST_MODE} = spec ]]; then if ((got_bp_proto)); then # supported since ipset v6.20 COMPREPLY=( $(compgen -W \ 'tcp: udp: $(_ipset_get_services -p "$str_prefix")' -- "$str_tmp" ) ) [[ ${COMPREPLY[*]} = @(tcp|udp): ]] && compopt -o nospace __ltrim_colon_completions "$cur" else # only tcp services prior to ipset v6.20 COMPREPLY=( $(compgen \ -W '$(_ipset_get_services -p tcp)' -- "$cur" ) ) fi else if ((got_bp_proto)); then # supported since ipset v6.20 COMPREPLY=( $(compgen -W \ 'tcp: udp: $(_ipset_get_services -p "$str_prefix")' -- "$str_tmp" ) ) [[ ${COMPREPLY[*]} = @(tcp|udp): ]] && compopt -o nospace __ltrim_colon_completions "$cur" else # only tcp services prior to ipset v6.20 COMPREPLY=( $(compgen -W '$(_ipset_get_services -p tcp)' -- "$cur" ) ) fi _ipset_complete_elements "$cur" --no-range __ltrim_colon_completions "$cur" fi else _ipset_complete_elements "$cur" --no-range __ltrim_colon_completions "$cur" fi fi elif ((cword == action_index+3)) && [[ $cur != -* ]]; then if [[ $str_action = add ]]; then str_type=$(_ipset_get_set_type "$str_setname") if _ipset_set_has_option timeout "$str_setname"; then str_timeout=timeout else str_timeout="" fi if ! _ipset_set_has_option counters "$str_setname"; then str_bp_counters="" fi if ! _ipset_set_has_option comment "$str_setname"; then str_comment="" fi if ! _ipset_set_has_option skbinfo "$str_setname"; then str_skbflags="" fi if [[ $str_type = hash:*net* ]]; then COMPREPLY=( $( compgen -W \ '$(_ipset_dedupe_cmd_opts $str_timeout $str_bp_counters $str_comment $str_skbflags nomatch)' \ -- "$cur" ) ) elif [[ $str_type = @(hash:*!(net)*|bitmap:*) ]]; then COMPREPLY=( $( compgen -W \ '$(_ipset_dedupe_cmd_opts $str_timeout $str_bp_counters $str_skbflags $str_comment)' \ -- "$cur" ) ) elif [[ $str_type = list:* ]]; then COMPREPLY=( $( compgen -W \ '$(_ipset_dedupe_cmd_opts $str_order $str_timeout $str_bp_counters $str_skbflags $str_comment)' \ -- "$cur" ) ) fi elif [[ $str_action = @(create|n) ]]; then if [[ $prev = hash:ip,mark ]]; then COMPREPLY=( $( compgen -W \ '$(_ipset_dedupe_cmd_opts family hashsize timeout maxelem $str_counters $str_skbinfo $str_markmask $str_comment $str_forceadd)' \ -- "$cur" ) ) elif [[ $prev = hash:* ]]; then COMPREPLY=( $( compgen -W \ '$(_ipset_dedupe_cmd_opts family hashsize timeout maxelem $str_counters $str_skbinfo $str_comment $str_forceadd)' \ -- "$cur" ) ) elif [[ $prev = bitmap:ip ]]; then COMPREPLY=( $( compgen -W \ '$(_ipset_dedupe_cmd_opts range netmask timeout $str_counters $str_skbinfo $str_comment)' \ -- "$cur" ) ) elif [[ $prev = bitmap:!(ip)?* ]]; then COMPREPLY=( $( compgen -W \ '$(_ipset_dedupe_cmd_opts range timeout $str_counters $str_skbinfo $str_comment)' \ -- "$cur" ) ) elif [[ $prev = list:* ]]; then COMPREPLY=( $( compgen -W \ '$(_ipset_dedupe_cmd_opts size timeout $str_counters $str_skbinfo $str_comment)' \ -- "$cur" ) ) fi elif [[ $str_action = @(del|test) ]]; then str_type=$(_ipset_get_set_type "$str_setname") if [[ $str_type = list:* ]]; then COMPREPLY=( $( compgen -W '$str_order' -- "$cur" ) ) elif [[ $str_action = test && $str_type = hash:*net* ]]; then COMPREPLY=( $( compgen -W 'nomatch' -- "$cur" ) ) fi fi elif ((cword == action_index+3)) && [[ $cur = -* ]]; then _ipset_get_options elif ((cword >= action_index+4)) && [[ $cur = -* ]]; then # add all following hyphen options if [[ $prev != @(timeout|hashsize|size|family|maxelem|range|netmask|before|after|bytes|packets|comment|markmask|skbmark|skbprio|skbqueue) ]] then _ipset_get_options fi elif ((cword >= action_index+4)); then # add all following non-hyphen options if [[ $str_action = add ]]; then str_type=$(_ipset_get_set_type "$str_setname") if _ipset_set_has_option timeout "$str_setname"; then str_timeout=timeout else str_timeout="" fi if ! _ipset_set_has_option counters "$str_setname"; then str_bp_counters="" fi if ! _ipset_set_has_option comment "$str_setname"; then str_comment="" fi if ! _ipset_set_has_option skbinfo "$str_setname"; then str_skbflags="" fi # validate option argument values if [[ $_IPSET_VALIDATE_INPUT ]]; then for ((x=$action_index+3; x < ${#words[@]}; x++)); do if [[ ${words[x]} = @(timeout|bytes|packets) ]]; then [[ ${words[x+1]} = @(+([[:digit:]])|0[xX]+([[:xdigit:]])) ]] || return 0 elif [[ ${words[x]} = skbmark ]]; then if [[ ${words[x+1]} = 0[xX]+([[:xdigit:]])?(/0[xX]+([[:xdigit:]])) ]]; then (( ${words[x+1]%/*} >= 0 && ${words[x+1]%/*} <= 0xFFFFFFFF )) || return 0 (( ${words[x+1]#*/} >= 0 && ${words[x+1]#*/} <= 0xFFFFFFFF )) || return 0 else return 0 fi elif [[ ${words[x]} = skbprio ]]; then [[ ${words[x+1]} = +([[:xdigit:]]):?(+([[:xdigit:]])) ]] || return 0 elif [[ ${words[x]} = skbqueue ]]; then [[ ${words[x+1]} = +([[:digit:]]) ]] || return 0 fi done fi if [[ $str_type = hash:*net* ]]; then if [[ $prev != @(timeout|bytes|packets|comment|skbmark|skbprio|skbqueue) ]]; then COMPREPLY=( $( compgen -W \ '$(_ipset_dedupe_cmd_opts $str_timeout $str_bp_counters $str_comment $str_skbflags nomatch)' \ -- "$cur" ) ) fi elif [[ $str_type = @(hash:*!(net)*|bitmap:*) ]]; then if [[ $prev != @(timeout|bytes|packets|comment|skbmark|skbprio|skbqueue) ]]; then COMPREPLY=( $( compgen -W \ '$(_ipset_dedupe_cmd_opts $str_timeout $str_bp_counters $str_comment $str_skbflags)' \ -- "$cur" ) ) fi elif [[ $str_type = list:* ]]; then if [[ $prev = @(before|after) ]] && ((cword-1 == order_index)); then _ipset_complete_elements "$cur" __ltrim_colon_completions "$cur" elif [[ $prev != @(timeout|bytes|packets|skbmark|skbprio|skbqueue) ]]; then COMPREPLY=( $( compgen -W \ '$(_ipset_dedupe_cmd_opts $str_order $str_timeout $str_bp_counters $str_comment $str_skbflags)' \ -- "$cur" ) ) fi fi elif [[ $str_action = @(create|n) ]]; then # validate option argument values if [[ $_IPSET_VALIDATE_INPUT ]]; then for ((x=$action_index+3; x < ${#words[@]}; x++)); do if [[ ${words[x+1]} && ${words[x+1]} != $cur ]]; then if [[ ${words[x]} = @(hashsize|timeout|size|maxelem|markmask) ]]; then [[ ${words[x+1]} != @(+([[:digit:]])|0[xX]+([[:xdigit:]])) ]] && return 0 elif [[ ${words[x]} = family ]]; then [[ ${words[x+1]} != inet?(6) ]] && return 0 elif [[ ${words[x]} = range ]]; then if [[ $str_type = bitmap:port ]]; then [[ ${words[x+1]} != *-* ]] && return 0 else [[ ${words[x+1]} != @(*-*|*/+([[:digit:]])) ]] && return 0 fi fi fi done fi if [[ ${words[action_index+2]} = hash:ip,mark ]]; then # must be the set type if [[ $prev = family ]]; then COMPREPLY=( $( compgen -W '$(_ipset_dedupe_cmd_opts inet inet6)' \ -- "$cur" ) ) elif [[ $prev != @(hashsize|timeout|maxelem|markmask) ]]; then COMPREPLY=( $( compgen -W \ '$(_ipset_dedupe_cmd_opts family hashsize timeout maxelem $str_counters $str_markmask $str_comment $str_forceadd $str_skbinfo)' \ -- "$cur" ) ) fi elif [[ ${words[action_index+2]} = hash:* ]]; then if [[ $prev = family ]]; then COMPREPLY=( $( compgen -W '$(_ipset_dedupe_cmd_opts inet inet6)' \ -- "$cur" ) ) elif [[ $prev != @(hashsize|timeout|maxelem) ]]; then COMPREPLY=( $( compgen -W \ '$(_ipset_dedupe_cmd_opts family hashsize timeout maxelem $str_counters $str_comment $str_forceadd $str_skbinfo)' \ -- "$cur" ) ) fi elif [[ ${words[action_index+2]} = bitmap:ip ]]; then if [[ $prev != @(range|netmask|timeout) ]]; then COMPREPLY=( $( compgen -W \ '$(_ipset_dedupe_cmd_opts range netmask timeout $str_counters $str_comment $str_skbinfo)' \ -- "$cur" ) ) fi elif [[ ${words[action_index+2]} = bitmap:!(ip)?* ]]; then if [[ $prev != @(range|timeout) ]]; then COMPREPLY=( $( compgen -W \ '$(_ipset_dedupe_cmd_opts range timeout $str_counters $str_comment $str_skbinfo)' \ -- "$cur" ) ) fi elif [[ ${words[action_index+2]} = list:* ]]; then if [[ $prev != @(size|timeout) ]]; then COMPREPLY=( $( compgen -W \ '$(_ipset_dedupe_cmd_opts size timeout $str_counters $str_comment $str_skbinfo)' \ -- "$cur" ) ) fi fi if [[ ${words[action_index+2]} = bitmap:port && $prev = range ]]; then # complete port ranges _ipset_complete_portrange "$cur" elif [[ ${words[action_index+2]} = bitmap:* && $prev = range ]]; then str_prefix="" if [[ $cur = @(""|+([[:word:]])) ]]; then # empty or [:word:] : elif [[ $cur = [\[]*-*[\]] ]]; then # host with hyphen : elif [[ $cur = [[]*([!]]) ]]; then # incomplete host with dash : elif [[ $cur = *-[[]+([!]]) ]]; then # incomplete range - host with dash str_prefix="${cur%\-[*}-" elif [[ $cur = \[*\]-* ]]; then # first part of hostname range str_prefix="${cur%\]-*}]-" elif [[ $cur != *-* ]]; then # no hypen : else # ip-range str_prefix="${cur%-*}-" fi _ipset_complete_host_spec "$cur" --v4 if ((${#COMPREPLY[@]} == 1)); then if [[ -z $str_prefix && ${COMPREPLY[*]} != */* ]]; then compopt -o nospace COMPREPLY=( $( compgen -W '${COMPREPLY[*]}/ ${COMPREPLY[*]}-' -- "$cur" ) ) fi fi fi elif [[ $str_action = @(del|test) ]]; then str_type=$(_ipset_get_set_type "$str_setname") if [[ $str_type = list:* ]]; then arr_tmp=() _ipset_get_members --names-only "$str_setname" if [[ $prev = @(before|after) ]] && ((cword-1 == order_index)) then if [[ $prev = before ]]; then for x in ${!arr_members[@]}; do if [[ ${arr_members[x]} = ${words[action_index+2]} ]] then if [[ ${arr_members[x+1]} ]]; then arr_tmp+=(${arr_members[x+1]}) break fi fi done elif [[ $prev = after ]]; then for x in ${!arr_members[@]}; do if [[ ${arr_members[x]} = ${words[action_index+2]} ]] then if ((x>0)) && [[ ${arr_members[x-1]} ]]; then arr_tmp+=(${arr_members[x-1]}) break fi fi done fi COMPREPLY=( $( compgen -W '${arr_tmp[@]}' -- "$cur" ) ) __ltrim_colon_completions "$cur" fi fi fi fi else # we don't have the main action yet if [[ $prev = - ]] && ((cword == 2)); then return 0 # interactive mode, don't complete on anything further fi if [[ $cur = -* ]]; then # any option is requested _ipset_get_options else # we don't have the action yet, check options to display appropiate actions if ((save_format && !headers_only && !names_only)); then COMPREPLY=( $( compgen -W 'list save' -- "$cur" ) ) elif ((save_format || names_only || headers_only)); then COMPREPLY=( $( compgen -W 'list' -- "$cur" ) ) elif ((res_sort)); then COMPREPLY=( $( compgen -W 'list save' -- "$cur" ) ) elif ((ignore_errors && use_file)); then COMPREPLY=( $( compgen -W 'restore' -- "$cur" ) ) elif ((ignore_errors)); then COMPREPLY=( $( compgen -W 'create n add del restore' -- "$cur" ) ) elif ((use_file)); then COMPREPLY=( $( compgen -W 'list save restore' -- "$cur" ) ) else COMPREPLY=( $( compgen -W 'create n add del test destroy x list save \ restore flush rename e swap w help version' -- "$cur" ) ) fi fi fi if [[ $_DEBUG_NF_COMPLETION ]]; then printf "COMPREPLY:\n" printf "<%s>\n" "${COMPREPLY[@]}" fi } complete -F _ipset_complete ipset blockdev 0000644 00000001370 15036124164 0006263 0 ustar 00 _blockdev_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" DEVS="$(lsblk -pnro name)" OPTS="-h -V -q --report --getsz --setro --setrw --getro --getdiscardzeroes --getss --getpbsz --getiomin --getioopt --getalignoff --getmaxsect --getbsz --setbsz --getsize64 --setra --getra --setfra --getfra --flushbufs --rereadpt $DEVS" case $prev in '--setbsz') COMPREPLY=( $(compgen -W "bytes" -- $cur) ) return 0 ;; '--setra'|'--setfra') COMPREPLY=( $(compgen -W "sectors" -- $cur) ) return 0 ;; esac compopt -o bashdefault -o default COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 } complete -F _blockdev_module blockdev xmllint 0000644 00000002366 15036124164 0006167 0 ustar 00 # bash completion for xmllint(1) -*- shell-script -*- _xmllint() { local cur prev words cword _init_completion || return case $prev in -o | --output) _filedir return ;; --path | --dtdvalidfpi | --maxmem | --pattern | --xpath) # argument required but no completions available return ;; --dtdvalid) _filedir 'dtd?(.gz)' return ;; --relaxng) _filedir 'rng?(.gz)' return ;; --schema) _filedir 'xsd?(.gz)' return ;; --schematron) _filedir 'sch?(.gz)' return ;; --encode) _xfunc iconv _iconv_charsets return ;; --pretty) COMPREPLY=($(compgen -W '{0..2}' -- "$cur")) return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) COMPREPLY=("${COMPREPLY[@]%:}") return fi _filedir '@(*ml|htm|svg?(z)|xs[dl]|rng|wsdl|jnlp|tld|dbk|docbook|page)?(.gz)' } && complete -F _xmllint xmllint # ex: filetype=sh gpgv 0000644 00000002131 15036124164 0005431 0 ustar 00 # gpgv(1) completion -*- shell-script -*- _gpgv() { local cur prev words cword _init_completion || return case $prev in --help | --version | --weak-digest | --*-fd | -!(-*)[?h]*) return ;; --keyring) _filedir "@(gpg|kbx)" return ;; --homedir) _filedir -d return ;; esac local args _count_args "" "--@(weak-digest|*-fd|keyring|homedir)" if [[ $cur == -* && $args -eq 1 ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) return fi if ((args > 1)); then if [[ ${COMP_LINE,,} == *.@(asc|sig|sign)\ * ]]; then # Detached signature, only complete one arbitrary file arg and - if ((args == 2)); then COMPREPLY=($(compgen -W '-' -- "$cur")) _filedir fi else _filedir gpg fi else _filedir "@(asc|gpg|sig|sign)" fi } && complete -F _gpgv gpgv gpgv2 # ex: filetype=sh umount 0000644 00000003256 15036124164 0006026 0 ustar 00 _umount_points_list() { # List of characters to escape shamelessly stolen from "scp" completion local escape_chars='[][(){}<>\",:;^&!$=?`|\\'\'' \t\f\n\r\v]' findmnt -lno TARGET | awk '{ if ($0 ~ "^"ENVIRON["HOME"]) { homeless = $0 sub("^"ENVIRON["HOME"], "~", homeless) gsub("'"$escape_chars"'", "\\\\&", homeless) print homeless " " } if ($0 ~ "^"ENVIRON["PWD"]) { reldir = $0 sub("^"ENVIRON["PWD"]"/?", "", reldir) gsub("'"$escape_chars"'", "\\\\&", reldir) print "./" reldir " " print reldir " " } gsub("'"$escape_chars"'", "\\\\&") print $0 " " }' } _umount_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-t'|'--types') local TYPES TYPES=" $(\ls /lib/modules/$(uname -r)/kernel/fs | awk '{print $1, "no" $1}') $(awk '{print $NF, "no" $NF}' /proc/filesystems) " COMPREPLY=( $(compgen -W "$TYPES" -- $cur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; '-N'|'--namespace') local NAMESPACE NAMESPACE="$(lsns --type mnt --output PATH --noheadings)" COMPREPLY=( $(compgen -W "$NAMESPACE" -- $cur) ) return 0 ;; esac case $cur in -*) OPTS=" --all --all-targets --no-canonicalize --detach-loop --fake --force --internal-only --namespace --no-mtab --lazy --test-opts --recursive --read-only --types --quiet --verbose --help --version" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac local IFS=$'\n' COMPREPLY=( $( compgen -W '$( _umount_points_list )' -- "$cur" ) ) } complete -F _umount_module -o nospace umount _svnlook 0000644 00000003704 15036124164 0006327 0 ustar 00 # svnlook completion -*- shell-script -*- # Use of this file is deprecated. Upstream completion is available in # subversion >= 0.12.0, use that instead. _svnlook() { local cur prev words cword _init_completion || return local commands commands='author cat changed date diff dirs-changed help ? h history info lock log propget pget pg proplist plist pl tree uuid youngest' if ((cword == 1)); then if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '--version' -- "$cur")) else COMPREPLY=($(compgen -W "$commands" -- "$cur")) fi else local command=${words[1]} if [[ $cur == -* ]]; then # possible options for the command local options case $command in author | cat | date | dirs-changed | info | log) options='--revision --transaction' ;; changed) options='--revision --transaction --copy-info' ;; diff) options='--revision --transaction --no-diff-deleted --no-diff-added --diff-copy-from' ;; history) options='--revision --show-ids' ;; propget | proplist) options='--revision --transaction --revprop' ;; tree) options='--revision --transaction --show-ids --full-paths' ;; esac options+=" --help" COMPREPLY=($(compgen -W "$options" -- "$cur")) else if [[ $command == @(help|[h?]) ]]; then COMPREPLY=($(compgen -W "$commands" -- "$cur")) else _filedir fi fi fi } && complete -F _svnlook -o default svnlook # ex: filetype=sh nsupdate 0000644 00000001561 15036124164 0006317 0 ustar 00 # bash completion for nsupdate(1) -*- shell-script -*- _nsupdate() { local cur prev words cword _init_completion || return case $prev in -*[VLprtu]) return ;; -*k) _filedir key return ;; -*R) cur=${cur:=/dev/} _filedir return ;; -*y) if [[ $cur == h* ]]; then COMPREPLY=($(compgen -W "hmac-{md5,sha{1,224,256,384,512}}" \ -S : -- "$cur")) [[ ${COMPREPLY-} == *: ]] && compopt -o nospace fi return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_usage "$1")' -- "$cur")) return fi _filedir } && complete -F _nsupdate nsupdate # ex: filetype=sh tune2fs 0000644 00000003330 15036124164 0006056 0 ustar 00 # tune2fs(8) completion -*- shell-script -*- _tune2fs() { local cur prev words cword _init_completion || return case $prev in -*[cCEiJLmrT]) return ;; -*e) COMPREPLY=($(compgen -W 'continue remount-ro panic' -- "$cur")) return ;; -*g) _gids COMPREPLY=($(compgen -g -W '${COMPREPLY[@]}' -- "$cur")) return ;; -*M) _filedir -d return ;; -*o) local -a opts=(^debug ^bsdgroups ^user_xattr ^acl ^uid16 ^journal_data ^journal_data_ordered ^journal_data_writeback ^nobarrier ^block_validity ^discard ^nodelalloc) COMPREPLY=($(compgen -W '${opts[@]} ${opts[@]#^}' -- "$cur")) return ;; -*O) local -a opts=(^dir_index ^dir_nlink ^encrypt ^extent ^extra_isize ^filetype ^flex_bg ^has_journal ^huge_file ^large_file ^metadata_csum ^mmp ^project ^quota ^read-only ^resize_inode ^sparse_super ^uninit_bg) COMPREPLY=($(compgen -W '${opts[@]} ${opts[@]#^}' -- "$cur")) return ;; -*u) _uids COMPREPLY=($(compgen -u -W '${COMPREPLY[@]}' -- "$cur")) return ;; -*U) COMPREPLY=($(compgen -W 'clear random time' -- "$cur")) return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_usage "$1")' -- "$cur")) return fi cur=${cur:=/dev/} _filedir } && complete -F _tune2fs tune2fs # ex: filetype=sh su 0000644 00000001574 15036124164 0005127 0 ustar 00 _su_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-'|'-u'|'--user') COMPREPLY=( $(compgen -u -- $cur) ) return 0 ;; '-g'|'--group'|'-G'|'--supp-group') COMPREPLY=( $(compgen -g -- $cur) ) return 0 ;; '-s'|'--shell') COMPREPLY=( $(compgen -W "$(chsh -l)" -- $cur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS=" --user --preserve-environment --whitelist-environment --group --supp-group --login --command --session-command --fast --shell --help --version" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 } complete -F _su_module su complete -F _su_module runuser ncftp 0000644 00000001163 15036124164 0005604 0 ustar 00 # bash completion for ncftp -*- shell-script -*- _ncftp() { local cur prev words cword _init_completion || return case $prev in -u | -p | -P | -j | -F) return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1" -h)' -- "$cur")) return fi if [[ $cword -eq 1 && -f ~/.ncftp/bookmarks ]]; then COMPREPLY=($(compgen -W '$(command sed -ne "s/^\([^,]\{1,\}\),.*$/\1/p" \ ~/.ncftp/bookmarks)' -- "$cur")) fi } && complete -F _ncftp -o default ncftp # ex: filetype=sh wall 0000644 00000001172 15036124164 0005431 0 ustar 00 _wall_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-t'|'--timeout') COMPREPLY=( $(compgen -W "seconds" -- $cur) ) return 0 ;; '-g'|'--group') COMPREPLY=( $(compgen -A 'group' -- $cur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS="--group --nobanner --timeout --version --help" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 } complete -F _wall_module wall iftop 0000644 00000001000 15036124164 0005601 0 ustar 00 # iftop(8) completion -*- shell-script -*- _iftop() { local cur prev words cword _init_completion || return case $prev in -h | -f | -F | -m) return ;; -i) _available_interfaces -a return ;; -c) _filedir return ;; esac COMPREPLY=($(compgen -W '$(_parse_help "$1" -h)' -- "$cur")) } && complete -F _iftop iftop # ex: filetype=sh pgrep 0000644 00000003157 15036124164 0005614 0 ustar 00 # pgrep(1) and pkill(1) completion -*- shell-script -*- _pgrep() { local cur prev words cword _init_completion || return case $prev in --delimiter | --pgroup | --session | --terminal | -!(-*)[cdgJMNstTz]) return ;; --signal) _signals return ;; --pidfile | -!(-*)F) _filedir return ;; --group | -!(-*)G) _gids return ;; -j) COMPREPLY=($(compgen -W 'any none' -- "$cur")) return ;; --parent | --ns | -!(-*)P) _pids return ;; --euid | --uid | -!(-*)[uU]) _uids return ;; --nslist) local prefix= [[ $cur == *,* ]] && prefix="${cur%,*}," COMPREPLY=( $(IFS="$IFS," compgen -W '$($1 --help 2>&1 | command sed -ne "s/^[[:space:]]*Available namespaces://p")' \ -- "${cur##*,}")) ((${#COMPREPLY[@]} == 1)) && COMPREPLY=(${COMPREPLY/#/$prefix}) return ;; esac if [[ $cur == -* ]]; then local help=$(_parse_help "$1") [[ $help ]] || help='$("$1" --usage 2>&1 | command sed -e "s/\[-signal\]//" -e "s/\[-SIGNAL\]//" | _parse_usage -)' COMPREPLY=($(compgen -W "$help" -- "$cur")) [[ $cword -eq 1 && $1 == *pkill ]] && _signals - return fi _pnames -s } && complete -F _pgrep pgrep pkill # ex: filetype=sh ecryptfs-migrate-home 0000644 00000000763 15036124164 0010712 0 ustar 00 # ecryptfs-migrate-home(8) completion -*- shell-script -*- _ecryptfs_migrate_home() { local cur prev words cword _init_completion || return case $prev in --help) return ;; --user | -u) COMPREPLY=($(compgen -u -- "$cur")) return ;; esac COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) } && complete -F _ecryptfs_migrate_home ecryptfs-migrate-home # ex: filetype=sh iwconfig 0000644 00000005320 15036124164 0006276 0 ustar 00 # iwconfig completion -*- shell-script -*- _iwconfig() { local cur prev words cword _init_completion || return case $prev in mode) COMPREPLY=($(compgen -W 'managed ad-hoc master repeater secondary monitor' -- "$cur")) return ;; essid) COMPREPLY=($(compgen -W 'on off any' -- "$cur")) if [[ -n ${COMP_IWLIST_SCAN:-} ]]; then COMPREPLY+=($(compgen -W \ "$(iwlist ${words[1]} scan | awk -F'\"' '/ESSID/ {print $2}')" -- "$cur")) fi return ;; nwid) COMPREPLY=($(compgen -W 'on off' -- "$cur")) return ;; channel) COMPREPLY=($(compgen -W "$(iwlist ${words[1]} channel | awk '/^[ \t]*Channel/ {print $2}')" -- "$cur")) return ;; freq) COMPREPLY=($(compgen -W "$(iwlist ${words[1]} channel | awk '/^[ \t]*Channel/ {print $4"G"}')" -- "$cur")) return ;; ap) COMPREPLY=($(compgen -W 'on off any' -- "$cur")) if [[ -n ${COMP_IWLIST_SCAN:-} ]]; then COMPREPLY+=($(compgen -W \ "$(iwlist ${words[1]} scan | awk -F ': ' '/Address/ {print $2}')" -- "$cur")) fi return ;; rate) COMPREPLY=($(compgen -W 'auto fixed' -- "$cur")) COMPREPLY+=($(compgen -W \ "$(iwlist ${words[1]} rate | awk '/^[ \t]*[0-9]/ {print $1"M"}')" -- "$cur")) return ;; rts | frag) COMPREPLY=($(compgen -W 'auto fixed off' -- "$cur")) return ;; key | enc) COMPREPLY=($(compgen -W 'off on open restricted' -- "$cur")) return ;; power) COMPREPLY=($(compgen -W 'period timeout off on' -- "$cur")) return ;; txpower) COMPREPLY=($(compgen -W 'off on auto' -- "$cur")) return ;; retry) COMPREPLY=($(compgen -W 'limit lifetime' -- "$cur")) return ;; esac if ((cword == 1)); then if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '--help --version' -- "$cur")) else _available_interfaces -w fi else COMPREPLY=($(compgen -W 'essid nwid mode freq channel sens mode ap nick rate rts frag enc key power txpower commit' -- "$cur")) fi } && complete -F _iwconfig iwconfig # ex: filetype=sh mmsitepass 0000644 00000000510 15036124164 0006652 0 ustar 00 # mailman mmsitepass completion -*- shell-script -*- _mmsitepass() { local cur prev words cword _init_completion || return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '--listcreator --help' -- "$cur")) fi } && complete -F _mmsitepass mmsitepass # ex: filetype=sh valgrind 0000644 00000006657 15036124164 0006315 0 ustar 00 # valgrind(1) completion -*- shell-script -*- _valgrind() { local cur prev words cword split _init_completion -s || return local i # Note: intentionally using COMP_WORDS and COMP_CWORD instead of # words and cword here due to splitting on = causing index differences # (_command_offset assumes the former). for ((i = 1; i <= COMP_CWORD; i++)); do if [[ ${COMP_WORDS[i]} != @([-=])* && ${COMP_WORDS[i - 1]} != = ]]; then _command_offset $i return fi done local word tool for word in "${words[@]:1}"; do if [[ $word == --tool=?* ]]; then tool=$word break fi done case $prev in -h | --help | --help-debug | --version) return ;; --tool) # Tools seem to be named e.g. like memcheck-amd64-linux from which # we want to grab memcheck. COMPREPLY=($(compgen -W '$( for f in /usr{,/local}/lib{,64,exec}{/*-linux-gnu,}/valgrind/* do [[ $f != *.so && -x $f && $f =~ ^.*/(.*)-[^-]+-[^-]+ ]] && printf "%s\n" "${BASH_REMATCH[1]}" done)' -- "$cur")) return ;; --sim-hints) COMPREPLY=($(compgen -W 'lax-ioctls enable-outer' -- "$cur")) return ;; --soname-synonyms) COMPREPLY=($(compgen -W 'somalloc' -S = -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return ;; --kernel-variant) COMPREPLY=($(compgen -W 'bproc' -- "$cur")) return ;; # callgrind: --callgrind-out-file) _filedir return ;; # exp-dhat: --sort-by) COMPREPLY=($(compgen -W 'max-bytes-live tot-bytes-allocd max-blocks-live' -- "$cur")) return ;; # massif: --time-unit) COMPREPLY=($(compgen -W 'i ms B' -- "$cur")) return ;; # generic cases parsed from --help output --+([-A-Za-z0-9_])) local value=$($1 --help-debug ${tool-} 2>/dev/null | command sed -ne "s|^[[:blank:]]*$prev=\([^[:blank:]]\{1,\}\).*|\1|p") case $value in \<file*\>) _filedir return ;; \<command\>) compopt -o filenames COMPREPLY=($(compgen -c -- "$cur")) return ;; \<+([0-9])..+([0-9])\>) COMPREPLY=($(compgen -W "{${value:1:${#value}-2}}" \ -- "$cur")) return ;; # "yes", "yes|no", etc (but not "string", "STR", # "hint1,hint2,...") yes | +([-a-z0-9])\|+([-a-z0-9\|])) COMPREPLY=($(IFS='|' compgen -W '$value' -- "$cur")) return ;; esac ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1" "--help ${tool-}")' \ -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return fi } && complete -F _valgrind valgrind # ex: filetype=sh whereis 0000644 00000001027 15036124164 0006137 0 ustar 00 _whereis_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-B'|'-M'|'-S') local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -o dirnames -- ${cur:-"/"}) ) return 0 ;; '-h'|'-V') return 0 ;; esac case $cur in -*) OPTS="-b -B -m -M -s -S -f -u -l" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac COMPREPLY=( $(compgen -W "file" -- $cur) ) return 0 } complete -F _whereis_module whereis ccache 0000644 00000002004 15036124164 0005673 0 ustar 00 # ccache(1) completion -*- shell-script -*- _ccache() { local cur prev words cword split _init_completion -s || return local i for ((i = 1; i <= COMP_CWORD; i++)); do if [[ ${COMP_WORDS[i]} != -* ]]; then _command_offset $i return fi [[ ${COMP_WORDS[i]} == -*[oFM] ]] && ((i++)) done case $prev in --help | --version | --max-files | --max-size | -!(-*)[hVFM]) return ;; --set-config | -!(-*)o) if [[ $cur != *=* ]]; then COMPREPLY=($(compgen -S = -W "$($1 -p 2>/dev/null | awk '$3 = "=" { print $2 }')" -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace fi return ;; esac $split && return COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace } && complete -F _ccache ccache # ex: filetype=sh rpm 0000644 00000024167 15036124164 0005301 0 ustar 00 # bash completion for rpm -*- shell-script -*- # helper functions _rpm_installed_packages() { if [[ -r /var/log/rpmpkgs && \ /var/log/rpmpkgs -nt /var/lib/rpm/Packages ]]; then # using RHL 7.2 or later - this is quicker than querying the DB COMPREPLY=($(compgen -W "$(command sed -ne \ 's|^\([^[:space:]]\{1,\}\)-[^[:space:]-]\{1,\}-[^[:space:]-]\{1,\}\.rpm$|\1|p' \ /var/log/rpmpkgs)" -- "$cur")) elif type rpmqpack &>/dev/null; then # SUSE's rpmqpack is faster than rpm -qa COMPREPLY=($(compgen -W '$(rpmqpack)' -- "$cur")) else COMPREPLY=($(${1:-rpm} -qa --nodigest --nosignature \ --queryformat='%{NAME} ' "$cur*" 2>/dev/null)) fi } _rpm_groups() { local IFS=$'\n' COMPREPLY=($(compgen -W "$(${1:-rpm} -qa --nodigest --nosignature \ --queryformat='%{GROUP}\n' 2>/dev/null)" -- "$cur")) } _rpm_macros() { # get a list of macros COMPREPLY=($(compgen -W "$(${1:-rpm} --showrc | command sed -ne \ 's/^-\{0,1\}[0-9]\{1,\}[:=][[:space:]]\{1,\}\([^[:space:](]\{3,\}\).*/%\1/p')" \ -- "$cur")) } _rpm_buildarchs() { COMPREPLY=($(compgen -W "$(${1:-rpm} --showrc | command sed -ne \ 's/^\s*compatible\s\s*build\s\s*archs\s*:\s*\(.*\)/\1/ p')" \ -- "$cur")) } # rpm(8) completion # _rpm() { local cur prev words cword split _init_completion -s || return if ((cword == 1)); then # first parameter on line case $cur in --*) COMPREPLY=($(compgen -W '--help --version --initdb --checksig --addsign --delsign --rebuilddb --showrc --setperms --setugids --eval --install --upgrade --query --freshen --erase --verify --querytags --import' \ -- "$cur")) ;; *) COMPREPLY=($(compgen -W '-e -E -F -i -q -t -U -V' -- "$cur")) ;; esac return fi case $prev in --dbpath | --excludepath | --prefix | --relocate | --root | -!(-*)r) _filedir -d return ;; --eval | -!(-*)E) _rpm_macros $1 return ;; --pipe) compopt -o filenames COMPREPLY=($(compgen -c -- "$cur")) return ;; --rcfile) _filedir return ;; --specfile) # complete on .spec files _filedir spec return ;; --whatenhances | --whatprovides | --whatrecommends | --whatrequires | \ --whatsuggests | --whatsupplements) if [[ $cur == */* ]]; then _filedir else # complete on capabilities local IFS=$'\n' fmt case $prev in *enhances) fmt="%{ENHANCENAME}" ;; *provides) fmt="%{PROVIDENAME}" ;; *recommends) fmt="%{RECOMMENDNAME}" ;; *requires) fmt="%{REQUIRENAME}" ;; *suggests) fmt="%{SUGGESTNAME}" ;; *supplements) fmt="%{SUPPLEMENTNAME}" ;; esac COMPREPLY=($(compgen -W "$($1 -qa --nodigest --nosignature \ --queryformat=\"$fmt\\n\" 2>/dev/null | command grep -vF '(none)')" -- "$cur")) fi return ;; --define | --fileid | --hdrid | --pkgid | -!(-*)D) # argument required but no completions available return ;; esac $split && return # options common to all modes local opts="--define= --eval= --macros= --nodigest --nosignature --rcfile= --quiet --pipe --verbose" case ${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 $1 fi ;; -q* | --query) # options common to all query types opts+=" --changelog --configfiles --conflicts --docfiles --dump --enhances --filesbypkg --filecaps --fileclass --filecolor --fileprovide --filerequire --filesbypkg --info --list --obsoletes --pipe --provides --queryformat= --requires --scripts --suggests --triggers --xml --recommends --supplements --filetriggers --licensefiles" if [[ ${words[*]} == *\ -@(*([^ -])f|-file )* ]]; then # -qf completion if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W "$opts --dbpath --fscontext --last --root --state" -- "$cur")) else _filedir fi elif [[ ${words[*]} == *\ -@(*([^ -])g|-group )* ]]; then # -qg completion _rpm_groups $1 elif [[ ${words[*]} == *\ -@(*([^ -])p|-package )* ]]; then # -qp; uninstalled package completion if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W "$opts --ftpport --ftpproxy --httpport --httpproxy --nomanifest" -- "$cur")) else _filedir '[rs]pm' fi else # -q; installed package completion if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W "$opts --all --file --fileid --dbpath --fscontext --ftswalk --group --hdrid --last --package --pkgid --root= --specfile --state --triggeredby --whatenhances --whatprovides --whatrecommends --whatrequires --whatsuggests --whatsupplements" \ -- "$cur")) elif [[ ${words[*]} != *\ -@(*([^ -])a|-all )* ]]; then _rpm_installed_packages $1 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 --whatenhances --whatprovides --whatrecommends --whatrequires --whatsuggests --whatsupplements" \ -- "$cur")) # check whether we're doing file completion elif [[ ${words[*]} == *\ -@(*([^ -])f|-file )* ]]; then _filedir elif [[ ${words[*]} == *\ -@(*([^ -])g|-group )* ]]; then _rpm_groups $1 elif [[ ${words[*]} == *\ -@(*([^ -])p|-package )* ]]; then _filedir '[rs]pm' else _rpm_installed_packages $1 fi ;; --resign | --addsign | --delsign) _filedir '[rs]pm' ;; --setperms | --setgids) _rpm_installed_packages $1 ;; --import | --dbpath | --root) if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '--import --dbpath --root=' \ -- "$cur")) else _filedir fi ;; esac [[ ${COMPREPLY-} == *= ]] && compopt -o nospace } && complete -F _rpm rpm _rpmbuild() { local cur prev words cword split _init_completion -s || return local rpm="${1%build*}" [[ $rpm == "$1" ]] || ! type $rpm &>/dev/null && rpm= case $prev in --buildroot | --root | --dbpath | -!(-*)r) _filedir -d return ;; --target) _rpm_buildarchs $rpm return ;; --eval | -!(-*)E) _rpm_macros $rpm return ;; --macros | --rcfile) _filedir return ;; --buildpolicy) local cfgdir=$($rpm --eval '%{_rpmconfigdir}' 2>/dev/null) if [[ $cfgdir ]]; then COMPREPLY=($(compgen -W "$(command ls $cfgdir 2>/dev/null | command sed -ne 's/^brp-//p')" -- "$cur")) fi ;; --define | --with | --without | -!(-*)D) return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W "$(_parse_help "$1")" -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return fi # Figure out file extensions to complete local word ext for word in "${words[@]}"; do case $word in -b? | --clean | --nobuild) ext=spec break ;; -t? | --tarbuild) ext='@(t?(ar.)@([gx]z|bz?(2))|tar?(.@(lzma|Z)))' break ;; --rebuild | --recompile) ext='@(?(no)src.r|s)pm' break ;; esac done [[ -n $ext ]] && _filedir $ext } && complete -F _rpmbuild rpmbuild rpmbuild-md5 # ex: filetype=sh fsfreeze 0000644 00000001014 15036124164 0006276 0 ustar 00 _fsfreeze_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS="--freeze --unfreeze --help --version" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac local MPOINT MPOINT="$(findmnt -t ext2,ext3,ext4,reiserfs,jfs,xfs -o TARGET -n -r)" COMPREPLY=( $(compgen -W "$MPOINT" -- $cur) ) return 0 } complete -F _fsfreeze_module fsfreeze luseradd 0000644 00000002036 15036124164 0006275 0 ustar 00 # luseradd(1) and lusermod(1) completion -*- shell-script -*- _luseradd() { local cur prev words cword split _init_completion -s || return case $prev in --help | --usage | --gecos | --uid | --login | --plainpassword | --password | \ --commonname | --givenname | --surname | --roomnumber | --telephonenumber | \ --homephone | -!(-*)@([culPp]|[?]*)) return ;; --directory | --skeleton | -!(-*)[dk]) _filedir -d return ;; --shell | -!(-*)s) _shells return ;; --gid | -!(-*)g) _gids return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return fi [[ ${1##*/} == luseradd ]] || COMPREPLY=($(compgen -u -- "$cur")) } && complete -F _luseradd luseradd lusermod # ex: filetype=sh last 0000644 00000001665 15036124164 0005444 0 ustar 00 _last_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-f'|'--file') local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 ;; '-n'|'--limit') COMPREPLY=( $(compgen -W "number" -- $cur) ) return 0 ;; '-s'|'--since'|'-t'|'--until'|'-p'|'--present') COMPREPLY=( $(compgen -W "number" -- $cur) ) return 0 ;; '--time-format') COMPREPLY=( $(compgen -W "notime short full iso" -- $cur) ) return 0 ;; esac case $cur in -*) OPTS=" --hostlast --dns --file --fulltimes --ip --limit --nohostname --since --until --present --fullnames --system --time-format --help --version " COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac COMPREPLY=( $(compgen -u -- $cur) ) return 0 } complete -F _last_module last uuidparse 0000644 00000001327 15036124164 0006475 0 ustar 00 _uuidparse_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-o'|'--output') local prefix realcur OUTPUT realcur="${cur##*,}" prefix="${cur%$realcur}" for WORD in "UUID VARIANT TYPE TIME"; do if ! [[ $prefix == *"$WORD"* ]]; then OUTPUT="$WORD ${OUTPUT:-""}" fi done compopt -o nospace COMPREPLY=( $(compgen -P "$prefix" -W "$OUTPUT" -S ',' -- $realcur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac OPTS=" --json --noheadings --output --raw --help --version " COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 } complete -F _uuidparse_module uuidparse script 0000644 00000002045 15036124164 0005776 0 ustar 00 _script_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-c'|'--command') compopt -o bashdefault COMPREPLY=( $(compgen -c -- $cur) ) return 0 ;; '-E'|'--echo') COMPREPLY=( $(compgen -W "auto always never" -- $cur) ) return 0 ;; '-o'|'--output-limit') COMPREPLY=( $(compgen -W "size" -- $cur) ) return 0 ;; '-m'|'--logging-format') COMPREPLY=( $(compgen -W "classic advanced" -- $cur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in '=') cur=${cur#=} ;; -*) OPTS="--append --command --echo --log-in --log-out --log-io --log-timing --logging-format --return --flush --force --quiet --output-limit --timing= --version --help" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 } complete -F _script_module script op 0000644 00000002745 15036124164 0005117 0 ustar 00 # op (1Password CLI) completion -*- shell-script -*- _op_commands() { "$@" --help 2>/dev/null | awk '/^(Available |Sub)commands/{flag=1;next}/^ /&&flag{print $1}' } _op_command_options() { case $cur in -*) for i in "${!words[@]}"; do [[ ${words[i]} == -* || $i -eq 0 ]] && unset "words[i]" done COMPREPLY=($(compgen -W \ '$(_parse_usage "$1" "${words[*]} --help") --help' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return 0 ;; esac return 1 } _op() { local cur prev words cword split _init_completion -s || return local command i for ((i = 1; i < cword; i++)); do case ${words[i]} in --help | --version) return ;; -*) ;; *) command=${words[i]} break ;; esac done if [[ ! -v command && $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return fi [[ -v command ]] && _op_command_options "$1" && return if [[ ! -v command || $command == "$prev" ]]; then COMPREPLY=($(compgen -W '$(_op_commands "$1" ${command-})' -- "$cur")) [[ ${COMPREPLY-} ]] && return fi # TODO specific command and subcommand completions } && complete -F _op op # ex: filetype=sh systemd-cgls 0000644 00000004146 15036124164 0007114 0 ustar 00 # systemd-cgls(1) completion -*- shell-script -*- # SPDX-License-Identifier: LGPL-2.1-or-later # # This file is part of systemd. # # systemd is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version. # # systemd is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with systemd; If not, see <http://www.gnu.org/licenses/>. __contains_word() { local w word=$1; shift for w in "$@"; do [[ $w = "$word" ]] && return done } __get_machines() { local a b machinectl list --full --no-legend --no-pager | { while read a b; do echo " $a"; done; }; } __get_units_have_cgroup() { systemctl $1 --full --no-legend --no-pager --plain list-units | { while read -r a b c d; do [[ $c == "active" && ${a##*.} =~ (service|socket|mount|swap|slice|scope) ]] && echo " $a" done }; } _systemd_cgls() { local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} words cword local i verb comps local -A OPTS=( [STANDALONE]='-h --help --version --all -l --full -k --no-pager' [ARG]='-M --machine -u --unit --user-unit' ) _init_completion || return if __contains_word "$prev" ${OPTS[ARG]}; then case $prev in --machine|-M) comps=$( __get_machines ) ;; --unit|-u) comps=$( __get_units_have_cgroup --system ) ;; --user-unit) comps=$( __get_units_have_cgroup --user ) ;; esac COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 fi COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") ) } complete -F _systemd_cgls systemd-cgls xgamma 0000644 00000004016 15036124164 0005744 0 ustar 00 # bash completion for xgamma(1) -*- shell-script -*- _xgamma() { local cur prev words cword _init_completion -n : || return case "$prev" in -screen) local screens=$(xrandr --query 2>/dev/null | command sed -n \ '/^Screen /s|^Screen \{1,\}\(.*\):.*$|\1|p' 2>/dev/null) COMPREPLY=($(compgen -W "$screens" -- "$cur")) return ;; -gamma | -rgamma | -ggamma | -bgamma) # expect f.f if [[ $cur && $cur != *.* ]]; then COMPREPLY=(.) fi COMPREPLY+=($(compgen -W "{0..9}")) compopt -o nospace return ;; -display) # expect hostname:displaynumber.screennumber if [[ $cur == :* && $cur != :*.* ]]; then # FIXME: where to get local display numbers? local display=${cur#:} COMPREPLY=($(compgen -W "${display:-0}.")) compopt -o nospace elif [[ $cur == :*.* ]]; then # local screen numbers local t screens=$(xrandr --query 2>/dev/null | command sed -ne \ '/^Screen /s|^Screen \{1,\}\(.*\):.*$|\1|p' 2>/dev/null) t="${cur#:}" COMPREPLY=($(compgen -P "${t%.*}." -W "$screens" -- \ "${cur##*.}")) elif [[ $cur != *:* ]]; then # complete hostnames _known_hosts_real -c -- "$cur" if [[ ! $cur ]]; then COMPREPLY+=(:) fi compopt -o nospace fi # no display completion for remote hosts return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1" -help)' -- "$cur")) if [[ ${COMPREPLY-} ]]; then [[ $COMPREPLY == *= ]] && compopt -o nospace return fi fi } && complete -F _xgamma xgamma # ex: filetype=sh xdg-settings 0000644 00000001365 15036124164 0007116 0 ustar 00 # xdg-settings completion -*- shell-script -*- _xdg_settings() { local cur prev words cword _init_completion || return case $prev in --help | --list | --manual | --version) return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$("$1" --help | tr "{|" "\n" | _parse_help -)' -- "$cur")) return fi local args _count_args if ((args == 1)); then COMPREPLY=($(compgen -W "get check set" -- "$cur")) elif ((args == 2)); then COMPREPLY=($(compgen -W \ '$("$1" --list | awk "!/^Known/ { print \$1 }")' -- "$cur")) fi } && complete -F _xdg_settings xdg-settings # ex: filetype=sh chpasswd 0000644 00000001270 15036124164 0006305 0 ustar 00 # chpasswd(8) completion -*- shell-script -*- _chpasswd() { local cur prev words cword split _init_completion -s || return case $prev in --crypt | -!(-*)c) COMPREPLY=($(compgen -W 'DES MD5 NONE SHA256 SHA512' \ -- "$cur")) return ;; --sha-rounds | -!(-*)s) return ;; --root | -!(-*)R) _filedir -d return ;; esac $split && return COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace } && complete -F _chpasswd chpasswd # ex: filetype=sh pkg-config 0000644 00000002436 15036124164 0006522 0 ustar 00 # bash completion for pkgconfig -*- shell-script -*- _pkg_config() { local cur prev words cword split _init_completion -s || return case $prev in --define-variable | --atleast-version | --atleast-pkgconfig-version | \ --exact-version | --max-version) # argument required but no completions available return ;; --variable) local word for word in "${words[@]:1}"; do if [[ $word != -* ]]; then COMPREPLY=($(compgen -W \ '$("$1" $word --print-variables 2>/dev/null)' \ -- "$cur")) break fi done return ;; -\? | --help | --version | --usage) # all other arguments are noop with these return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace else COMPREPLY=($(compgen -W "$($1 --list-all \ 2>/dev/null | awk '{print $1}')" -- "$cur")) _filedir pc fi } && complete -F _pkg_config pkg-config # ex: filetype=sh btdownloadheadless.py 0000644 00000002050 15036124164 0010763 0 ustar 00 # btdownloadheadless(1) completion -*- shell-script -*- _btdownload() { local cur prev words cword _init_completion || return case $prev in --responsefile | --saveas) _filedir return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '--max_uploads --keepalive_interval --download_slice_size --request_backlog --max_message_length --ip --minport --maxport --responsefile --url --saveas --timeout --timeout_check_interval --max_slice_length --max_rate_period --bind --upload_rate_fudge --display_interval --rerequest_interval --min_peers --http_timeout --max_initiate --max_allow_in --check_hashes --max_upload_rate --snub_time --spew --rarest_first_cutoff --min_uploads --report_hash_failures' \ -- "$cur")) else _filedir fi } && complete -F _btdownload btdownloadheadless.py btdownloadcurses.py \ btdownloadgui.py # ex: filetype=sh file 0000644 00000001363 15036124164 0005413 0 ustar 00 # file(1) completion -*- shell-script -*- _file() { local cur prev words cword _init_completion || return case $prev in --help | --version | --separator | -!(-*)[vF]) return ;; --magic-file | --files-from | -!(-*)[mf]) _filedir return ;; --exclude | -!(-*)e) COMPREPLY=($(compgen -W 'apptype ascii cdf compress elf encoding soft tar text tokens troff' -- "$cur")) return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) return fi _filedir } && complete -F _file file # ex: filetype=sh locale-gen 0000644 00000001313 15036124164 0006475 0 ustar 00 # locale-gen(8) completion -*- shell-script -*- _locale_gen() { local cur prev words cword split _init_completion -s || return case $prev in --help | -h) return ;; --aliases) _filedir alias return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return fi COMPREPLY=($(compgen -W \ '$(awk "{ print \$1 }" /usr/share/i18n/SUPPORTED 2>/dev/null)' \ -- "$cur")) } && complete -F _locale_gen locale-gen # ex: filetype=sh fbgs 0000644 00000003067 15036124164 0005420 0 ustar 00 # bash completion for fbgs(1) -*- shell-script -*- _fbgs() { local cur prev words cword _init_completion || return case "$prev" in -f | --font) local IFS=$'\n' COMPREPLY=($(compgen -W '$(fc-list 2>/dev/null)' -- "$cur")) return ;; -m | --mode) COMPREPLY=($(compgen -W '$(command sed \ -n "/^mode/{s/^mode \{1,\}\"\([^\"]\{1,\}\)\"/\1/g;p}" \ /etc/fb.modes 2>/dev/null)' -- "$cur")) return ;; -d | --device) COMPREPLY=($(compgen -f -d -- "${cur:-/dev/}")) return ;; -fp | --firstpage | -lp | --lastpage | -r | --resolution | -s | --scroll | -t | \ --timeout) # expect integer value COMPREPLY+=($(compgen -W '{0..9}')) compopt -o nospace return ;; -T | --vt | -p | --password | -g | --gamma) # argument required but no completions available return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '--bell --help --password -fp --firstpage -lp --lastpage --color -l -xl -xxl --resolution --autozoom --{,no}autoup --{,no}autodown --{,no}fitwidth --{,no}verbose --{,no}random --vt --scroll --timeout --{,no}once --gamma --font --device --mode' -- "$cur")) [[ ${COMPREPLY-} ]] && return fi _filedir '?(e)ps|pdf' } && complete -F _fbgs fbgs # ex: filetype=sh tshark 0000644 00000010173 15036124164 0005767 0 ustar 00 # tshark(1) completion -*- shell-script -*- _tshark() { local cur prev words cword prefix _init_completion -n : || return case $cur in -o*) prefix=-o ;; -X*) prefix=-X ;; esac case ${prefix:-$prev} in --*) # Fallback to completion of long options below. ;; -o*) if [[ $cur == *:* ]]; then cur=${cur#*:} _filedir else [[ -v _tshark_prefs ]] || _tshark_prefs="$("$1" -G defaultprefs 2>/dev/null | command sed -ne 's/^#\{0,1\}\([a-z0-9_.-]\{1,\}:\).*/\1/p' | tr '\n' ' ')" : ${prefix:=} COMPREPLY=($(compgen -P "$prefix" -W "$_tshark_prefs" \ -- "${cur:${#prefix}}")) [[ ${COMPREPLY-} == *: ]] && compopt -o nospace fi return ;; -*[fsBDLcRNdCeEzhvoK]) return ;; -*i) COMPREPLY=($(compgen -W \ "$("$1" -D 2>/dev/null | awk '{print $2}')" -- "$cur")) return ;; -*y) local opts i for ((i = ${#words[@]} - 1; i > 0; i--)); do if [[ ${words[i]} == -i ]]; then opts+="-i ${words[i + 1]}" break fi done COMPREPLY=($(compgen -W "$("$1" $opts -L 2>/dev/null | awk '/^ / { print $1 }')" -- "$cur")) return ;; -*[ab]) COMPREPLY=($(compgen -W 'duration: filesize: files:' -- "$cur")) [[ ${COMPREPLY-} == *: ]] && compopt -o nospace return ;; -*[rH]) # -r accepts a lot of different file types _filedir return ;; -*w) _filedir [[ $cur == @(|-) ]] && COMPREPLY+=(-) return ;; -*F) COMPREPLY=($(compgen -W "$("$1" -F 2>&1 | awk '/^ / { print $1 }')" -- "$cur")) return ;; -*O) local prefix= [[ $cur == *,* ]] && prefix="${cur%,*}," [[ -v _tshark_protocols ]] || _tshark_protocols="$("$1" -G protocols 2>/dev/null | cut -f 3 | tr '\n' ' ')" COMPREPLY=($(compgen -W "$_tshark_protocols" -- "${cur##*,}")) ((${#COMPREPLY[@]} == 1)) && COMPREPLY=(${COMPREPLY/#/$prefix}) return ;; -*T) # Parse from: tshark -T . 2>&1 | awk -F \" '/^\t*"/ { print $2 }' COMPREPLY=($(compgen -W \ 'pdml ps psml json jsonraw ek tabs text fields' -- "$cur")) return ;; -*t) # Parse from: tshark -t . 2>&1 | awk -F \" '/^\t*"/ { print $2 }' COMPREPLY=($(compgen -W \ 'a ad adoy d dd e r u ud udoy' -- "$cur")) return ;; -*u) # TODO: could be parsed from "-u ." output COMPREPLY=($(compgen -W 's hms' -- "$cur")) return ;; -*W) COMPREPLY=($(compgen -W 'n' -- "$cur")) return ;; -*X) if [[ ${cur:${#prefix}} == lua_script:* ]]; then cur=${cur#*:} _filedir lua else COMPREPLY=($(compgen -P "$prefix" -W 'lua_script:' -- \ "${cur:${#prefix}}")) [[ ${COMPREPLY-} == *: ]] && compopt -o nospace fi return ;; -*G) COMPREPLY=($(compgen -W "$("$1" -G \? 2>/dev/null | awk '/^[ \t]*-G / \ { sub("^[[]","",$2); sub("[]]$","",$2); print $2 }')" \ -- "$cur")) return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1" -h 2>/dev/null)' \ -- "$cur")) return fi } && complete -F _tshark tshark # ex: filetype=sh monodevelop 0000644 00000000675 15036124164 0007030 0 ustar 00 # monodevelop completion -*- shell-script -*- _monodevelop() { local cur prev words cword split _init_completion -s || return $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1" -h)' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace else _filedir fi } && complete -F _monodevelop monodevelop # ex: filetype=sh gnokii 0000644 00000015625 15036124164 0005762 0 ustar 00 # gnokii(1) completion -*- shell-script -*- _gnokii_memory_type() { # TODO: reduce the number of choices COMPREPLY=($(compgen -W "IN OU SM ME MT" -- "$cur")) } _gnokii() { local cur prev words cword pprev tprev fprev _init_completion || return case $prev in --config) _filedir return ;; --phone) local config_file for config_file in "$XDG_CONFIG_HOME/gnokii/config" \ "$HOME/.config/gnokii/config" "$HOME/.gnokiirc" \ "$XDG_CONFIG_DIRS/gnokii/config" /etc/gnokiirc; do [[ -f $config_file ]] && break done [[ ! -f $config_file ]] && return COMPREPLY=($(compgen -W \ "$(command sed -n 's/^\[phone_\(.*\)\]/\1/p' $config_file)" \ -- "$cur")) return ;; --help) COMPREPLY=($(compgen -W 'all monitor sms mms phonebook calendar todo dial profile settings wap logo ringtone security file other' -- "$cur")) return ;; --version | --shell | ping) return ;; # MONITOR --monitor) COMPREPLY=($(compgen -W 'delay once' -- "$cur")) return ;; --getdisplaystatus | --displayoutput) return ;; --netmonitor) COMPREPLY=($(compgen -W 'reset off field devel next nr' \ -- "$cur")) return ;; # SMS --sendsms) # (how)TODO ? return ;; --savesms) COMPREPLY=($(compgen -W '--sender --smsc --smscno --folder --location --sent --read --deliver --datetime' -- "$cur")) return ;; --memory-type | --memory | --getsms | --deletesms | --getmms | --deletemms | \ --getphonebook | --deletephonebook) _gnokii_memory_type return ;; --getsmsc | --getcalendarnote | --deletecalendarnote | --gettodo | \ --getspeeddial) # TODO: grab a specific entry ID return ;; --setsmsc | --smsreader | --createsmsfolder | --deletealltodos | \ --showsmsfolderstatus) return ;; --deletesmsfolder | --folder) # TODO: folderid return ;; --writephonebook) COMPREPLY=($(compgen -W '--overwrite --find-free --memory-type --location --vcard --ldif' -- "$cur")) return ;; --writecalendarnote | --writetodo) _filedir vcf return ;; # DIAL --setspeeddial | --dialvoice | --senddtmf | --answercall | --hangup) # TODO return ;; --divert) COMPREPLY=($(compgen -W '--op' -- "$cur")) return ;; # PROFILE --getprofile | --setactiveprofile) # TODO return ;; --setprofile | --getactiveprofile) return ;; # SETTINGS --reset) COMPREPLY=($(compgen -W 'soft hard' -- "$cur")) return ;; --setdatetime | --setalarm) # TODO return ;; --getdatetime | --getalarm) return ;; # WAP --getwapbookmark | --writewapbookmark | --deletewapbookmark | \ --getwapsetting | --writewapsetting | --activatewapsetting) return ;; # LOGOS --sendlogo) COMPREPLY=($(compgen -W 'caller op picture' -- "$cur")) return ;; --setlogo | --getlogo) COMPREPLY=($(compgen -W 'op startup caller dealer text' \ -- "$cur")) return ;; --viewlogo) # TODO: logofile return ;; --entersecuritycode) COMPREPLY=($(compgen -W 'PIN PIN2 PUK PUK2 SEC' -- "$cur")) return ;; # TODO: RINGTONES esac # second level completion if [[ $((cword - 2)) -ge 1 && ${words[cword - 2]} =~ --* ]]; then pprev=${words[cword - 2]} case $pprev in --setspeeddial) _gnokii_memory_type return ;; --getsms | --deletesms | --getmms | --deletemms | --getphonebook | \ --writetodo | --writecalendarnote) # TODO: start number return ;; --gettodo | --getcalendarnote) COMPREPLY=($(compgen -W '{1..9} end --vCal' -- "$cur")) return ;; --deletecalendarnote) COMPREPLY=($(compgen -W '{1..9} end' -- "$cur")) return ;; --divert) COMPREPLY=($(compgen -W 'register enable query disable erasure' -- "$cur")) return ;; esac fi # third level completion if [[ $((cword - 3)) -ge 1 && ${words[cword - 3]} =~ --* ]]; then tprev=${words[cword - 3]} case $tprev in --deletesms | --deletemms) COMPREPLY=($(compgen -W 'end' -- "$cur")) return ;; --getphonebook | --writetodo | --writecalendarnote) COMPREPLY=($(compgen -W '{1..9} end' -- "$cur")) return ;; --gettodo | --getcalendarnote) [[ ${words[cword - 1]} == end ]] && COMPREPLY=($(compgen -W '--vCal' -- "$cur")) return ;; --divert) COMPREPLY=($(compgen -W '--type' -- "$cur")) return ;; esac fi # fourth level completion if [[ $((cword - 4)) -ge 1 && ${words[cword - 4]} =~ --* ]]; then fprev=${words[cword - 4]} case $fprev in --getphonebook) COMPREPLY=($(compgen -W '--raw --vcard --ldif' -- "$cur")) return ;; --divert) COMPREPLY=($(compgen -W 'all busy noans outofreach notavail' \ -- "$cur")) return ;; esac fi # safer to use LANG=C local all_cmd="$(LANG=C _parse_help $1 "--help all")" # these 2 below are allowed in combination with others local main_cmd=$(command grep -v -- '--config\|--phone' <<<"$all_cmd") # don't provide main command completions if one is # already on the command line [[ $COMP_LINE =~ $(tr ' ' '\b|' <<<$main_cmd) ]] && return COMPREPLY=($(compgen -W "$all_cmd" -- "$cur")) } && complete -F _gnokii gnokii # ex: filetype=sh cryptsetup 0000644 00000005773 15036124164 0006727 0 ustar 00 # bash completion for cryptsetup -*- shell-script -*- _cryptsetup_name() { COMPREPLY=($(compgen -X control -W '$(command ls /dev/mapper)' -- "$cur")) } _cryptsetup_device() { cur=${cur:=/dev/} _filedir } _cryptsetup() { local cur prev words cword split _init_completion -s || return case $prev in --help | --version | --cipher | --hash | --*-size | --key-slot | --size | --offset | \ --skip | --iter-time | --timeout | --tries | -!(-*)[chslSbopitT]) return ;; --key-file | --master-key-file | --header-backup-file | -!(-*)d) _filedir return ;; --type | -!(-*)M) COMPREPLY=($(compgen -W "luks plain loopaes tcrypt" -- "$cur")) return ;; esac $split && return local arg _get_first_arg if [[ -z $arg ]]; then if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace else COMPREPLY=($(compgen -W 'open close resize status benchmark repair erase luksFormat luksAddKey luksRemoveKey luksChangeKey luksKillSlot luksUUID isLuks luksDump tcryptDump luksSuspend luksResume luksHeaderBackup luksHeaderRestore' -- "$cur")) fi else local args _count_args "" "-!(-*)[chslSbopitTdM]" case $arg in open | create | luksOpen | loopaesOpen | tcryptOpen) case $args in 2) _cryptsetup_device ;; 3) _cryptsetup_name ;; esac ;; close | remove | luksClose | loopaesClose | tcryptClose | status | resize | \ luksSuspend | luksResume) case $args in 2) _cryptsetup_name ;; esac ;; luksFormat | luksAddKey | luksRemoveKey | luksChangeKey) case $args in 2) _cryptsetup_device ;; 3) _filedir ;; 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 } && complete -F _cryptsetup cryptsetup # ex: filetype=sh passwd 0000644 00000001047 15036124164 0005774 0 ustar 00 # passwd(1) completion -*- shell-script -*- _passwd() { local cur prev words cword _init_completion || return case $prev in --minimum | --maximum | --warning | --inactive | --help | --usage | -!(-*)[nxwi?]) return ;; esac if [[ $cur == -* ]]; then local opts=$(_parse_help "$1") COMPREPLY=($(compgen -W '${opts:-$(_parse_usage "$1")}' -- "$cur")) return fi _allowed_users } && complete -F _passwd passwd # ex: filetype=sh pidof 0000644 00000001022 15036124164 0005565 0 ustar 00 # pidof(8) completion -*- shell-script -*- _pidof() { local cur prev words cword _init_completion || return case $prev in --help | -V | --version | -!(-*)[hV]*) return ;; --omit-pid | -!(-*)o) _pids return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) return fi _pnames } && complete -F _pidof pidof # ex: filetype=sh systemd-analyze 0000644 00000012363 15036124164 0007627 0 ustar 00 # systemd-analyze(1) completion -*- shell-script -*- # SPDX-License-Identifier: LGPL-2.1-or-later # # This file is part of systemd. # # Copyright © 2010 Ran Benita # # systemd is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version. # # systemd is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with systemd; If not, see <http://www.gnu.org/licenses/>. __contains_word () { local w word=$1; shift for w in "$@"; do [[ $w = "$word" ]] && return done } __get_machines() { local a b machinectl list --full --no-legend --no-pager | { while read a b; do echo " $a"; done; }; } __get_services() { systemctl list-units --no-legend --no-pager --plain -t service --all $1 | \ { while read -r a b c; do [[ $b == "loaded" ]]; echo " $a"; done } } __get_syscall_sets() { local line systemd-analyze syscall-filter --no-pager | while IFS= read -r line; do if [[ $line == @* ]]; then printf '%s\n' "$line" fi done } _systemd_analyze() { local i verb comps mode local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} words cword local -A OPTS=( [STANDALONE]='-h --help --version --system --user --global --order --require --no-pager --man=no --generators=yes' [ARG]='-H --host -M --machine --fuzz --from-pattern --to-pattern --root' ) local -A VERBS=( [STANDALONE]='time blame plot dump unit-paths exit-status condition calendar timestamp timespan' [CRITICAL_CHAIN]='critical-chain' [DOT]='dot' [VERIFY]='verify' [SECCOMP_FILTER]='syscall-filter' [CAT_CONFIG]='cat-config' [SECURITY]='security' ) local CONFIGS='systemd/bootchart.conf systemd/coredump.conf systemd/journald.conf systemd/journal-remote.conf systemd/journal-upload.conf systemd/logind.conf systemd/resolved.conf systemd/networkd.conf systemd/resolved.conf systemd/sleep.conf systemd/system.conf systemd/timedated.conf systemd/timesyncd.conf systemd/user.conf udev/udev.conf' _init_completion || return for ((i=0; i < COMP_CWORD; i++)); do if __contains_word "${COMP_WORDS[i]}" ${VERBS[*]} && ! __contains_word "${COMP_WORDS[i-1]}" ${OPTS[ARG]}; then verb=${COMP_WORDS[i]} break fi done if __contains_word "$prev" ${OPTS[ARG]}; then case $prev in --host|-H) comps=$(compgen -A hostname) ;; --machine|-M) comps=$( __get_machines ) ;; esac COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 fi if [[ -z ${verb-} && $cur = -* ]]; then COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") ) return 0 fi if [[ -z ${verb-} ]]; then comps=${VERBS[*]} elif __contains_word "$verb" ${VERBS[STANDALONE]}; then if [[ $cur = -* ]]; then comps='--help --version --system --user --global --no-pager' fi elif __contains_word "$verb" ${VERBS[CRITICAL_CHAIN]}; then if [[ $cur = -* ]]; then comps='--help --version --system --user --fuzz --no-pager' fi elif __contains_word "$verb" ${VERBS[DOT]}; then if [[ $cur = -* ]]; then comps='--help --version --system --user --global --from-pattern --to-pattern --order --require' fi elif __contains_word "$verb" ${VERBS[SECCOMP_FILTER]}; then if [[ $cur = -* ]]; then comps='--help --version --no-pager' else comps=$( __get_syscall_sets ) fi elif __contains_word "$verb" ${VERBS[VERIFY]}; then if [[ $cur = -* ]]; then comps='--help --version --system --user --global --man=no --generators=yes' else comps=$( compgen -A file -- "$cur" ) compopt -o filenames fi elif __contains_word "$verb" ${VERBS[CAT_CONFIG]}; then if [[ $cur = -* ]]; then comps='--help --version --root --no-pager' elif [[ -z $cur ]]; then comps="$CONFIGS" compopt -o filenames else comps="$CONFIGS $( compgen -A file -- "$cur" )" compopt -o filenames fi elif __contains_word "$verb" ${VERBS[SECURITY]}; then if [[ $cur = -* ]]; then comps='--help --version --no-pager --system --user -H --host -M --machine' else if __contains_word "--user" ${COMP_WORDS[*]}; then mode=--user else mode=--system fi comps=$( __get_services $mode ) fi fi COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 } complete -F _systemd_analyze systemd-analyze route 0000644 00000001415 15036124164 0005630 0 ustar 00 # Linux route(8) completion -*- shell-script -*- [[ $OSTYPE == *linux* ]] || return 1 _route() { local cur prev words cword _init_completion || return if [[ $prev == dev ]]; then _available_interfaces return fi # Remove already given options from completions local opt found i 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 < ${#words[@]} - 1; i++)); do [[ ${words[i]} == "$opt" ]] && found=true && break done $found || COMPREPLY+=("$opt") done COMPREPLY=($(compgen -W '"${COMPREPLY[@]}"' -- "$cur")) } && complete -F _route route # ex: filetype=sh sysctl 0000644 00000001455 15036124164 0006017 0 ustar 00 # bash completion for sysctl -*- shell-script -*- _sysctl() { local cur prev words cword _init_completion || return case $prev in --help | --version | --pattern | -!(-*)[hVr]) return ;; --load | -!(-*)[pf]) _filedir conf return ;; esac if [[ $cur == -* ]]; then local opts="$(_parse_help "$1")" COMPREPLY=($(compgen -W '${opts:-$(_parse_usage "$1")}' -- "$cur")) else local suffix= [[ $prev == -w ]] && suffix="=" COMPREPLY=($(compgen -S "$suffix" -W \ "$(PATH="$PATH:/sbin" $1 -N -a 2>/dev/null)" -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace fi } && complete -F _sysctl sysctl # ex: filetype=sh chage 0000644 00000001235 15036124164 0005541 0 ustar 00 # chage(1) completion -*- shell-script -*- _chage() { local cur prev words cword split _init_completion -s || return case $prev in --lastday | --expiredate | --help | --inactive | --mindays | --maxdays | \ --warndays | -!(-*)[dEhImMW]) return ;; --root | -!(-*)R) _filedir -d return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) return fi COMPREPLY=($(compgen -u -- "$cur")) } && complete -F _chage chage # ex: filetype=sh fsck.cramfs 0000644 00000001276 15036124164 0006677 0 ustar 00 _fsck.cramfs_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-b'|'--blocksize') COMPREPLY=( $(compgen -W "size" -- $cur) ) return 0 ;; '--extract') local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -o dirnames -- ${cur:-"/"}) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) COMPREPLY=( $(compgen -W "--verbose --blocksize --extract --help --version" -- $cur) ) return 0 ;; esac compopt -o bashdefault -o default COMPREPLY=( $(compgen -W "$(lsblk -pnro name)" -- $cur) ) return 0 } complete -F _fsck.cramfs_module fsck.cramfs ktutil 0000644 00000005673 15036124164 0006020 0 ustar 00 # ktutil completion -*- shell-script -*- _heimdal_principals() { COMPREPLY=($(compgen -W "$(kadmin -l dump 2>/dev/null | awk '{print $1}')" -- "$cur")) } _heimdal_realms() { COMPREPLY=($(compgen -W "$(kadmin -l dump 2>/dev/null | awk '{print $1}' | awk -F@ '{print $2}')" -- "$cur")) } _heimdal_encodings() { COMPREPLY=($(compgen -W 'des-cbc-mcrc des-cbc-md4 des-cbc-md5 des3-cbc-sha1 arcfour-hmac-md5 aes128-cts-hmac-sha1-96 aes256-cts-hmac-sha1-96' -- "$cur")) } _ktutil() { local cur prev words cword split _init_completion -s || return local command commands i options case $prev in -p | --principal) _heimdal_principals return ;; -e | --enctype) _heimdal_encodings return ;; -a | --admin-server) _known_hosts_real -- "$cur" return ;; -r | --realm) _heimdal_realms return ;; -s | -k | --srvtab | --keytab) _filedir return ;; esac $split && return commands='add change copy get list remove rename purge srvconvert srv2keytab srvcreate key2srvtab' for ((i = 1; i < cword; i++)); do case ${words[i]} in -k | --keytab) ((i++)) ;; -*) ;; *) command=${words[i]} break ;; esac done if [[ $cur == -* ]]; then case ${command-} in add) options='-p --principal -V -e --enctype -w --password -r --random -s --no-salt -h --hex' ;; change) options='-r --realm -a --admin-server -s --server-port' ;; get) options='-p --principal -e --enctype -r --realm -a --admin-server -s server --server-port' ;; list) options='--keys --timestamp' ;; remove) options='-p --principal -V --kvno -e --enctype' ;; purge) options='--age' ;; srv2keytab | key2srvtab) options='-s --srvtab' ;; *) options='-k --keytab -v --verbose --version -v --help' ;; esac COMPREPLY=($(compgen -W "$options" -- "$cur")) else case ${command-} in copy) _filedir ;; get) _heimdal_principals ;; rename) _heimdal_principals ;; *) COMPREPLY=($(compgen -W "$commands" -- "$cur")) ;; esac fi } && complete -F _ktutil ktutil # ex: filetype=sh sync_members 0000644 00000001337 15036124164 0007163 0 ustar 00 # mailman sync_members completion -*- shell-script -*- _sync_members() { local cur prev words cword split _init_completion -s || return case $prev in -w | -g | -d | --welcome-msg | --goodbye-msg | --digest) COMPREPLY=($(compgen -W 'y n' -- "$cur")) return ;; --file) _filedir return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '--no-change --welcome-msg --goodbye-msg --digest --notifyadmin --file --help' -- "$cur")) else _xfunc list_lists _mailman_lists fi } && complete -F _sync_members sync_members # ex: filetype=sh fstrim 0000644 00000001347 15036124164 0006002 0 ustar 00 _fstrim_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-o'|'--offset'|'-l'|'--length'|'-m'|'--minimum') COMPREPLY=( $(compgen -W "num" -- $cur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS="--all --fstab --listed-in --quiet-unsupported --offset --length --minimum --verbose --dry-run --help --version" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac local MPOINTS MPOINTS=$(findmnt -rno SOURCE,TARGET | awk '/^\/dev/{print $2}') COMPREPLY=( $(compgen -W "$MPOINTS" -- $cur) ) return 0 } complete -F _fstrim_module fstrim update-rc.d 0000644 00000003564 15036124164 0006607 0 ustar 00 # update-rc.d(8) completion -*- shell-script -*- # # Copyright (C) 2004 Servilio Afre Puentes <servilio@gmail.com> _update_rc_d() { local cur prev words cword _init_completion || return local sysvdir services options [[ -d /etc/rc.d/init.d ]] && sysvdir=/etc/rc.d/init.d || sysvdir=/etc/init.d services=($(printf '%s ' $sysvdir/!(README*|*.sh|$_backup_glob))) services=(${services[@]#$sysvdir/}) options=(-f -n) if [[ $cword -eq 1 || $prev == -* ]]; then COMPREPLY=($(compgen -W '${options[@]} ${services[@]}' \ -X '$(tr " " "|" <<<${words[@]})' -- "$cur")) elif [[ $prev == ?($(tr " " "|" <<<"${services[*]}")) ]]; then COMPREPLY=($(compgen -W 'remove defaults start stop' -- "$cur")) elif [[ $prev == defaults && $cur == [0-9] ]]; then COMPREPLY=(0 1 2 3 4 5 6 7 8 9) elif [[ $prev == defaults && $cur == [sk]?([0-9]) ]]; then COMPREPLY=(0 1 2 3 4 5 6 7 8 9) elif [[ $prev == defaults && -z $cur ]]; then COMPREPLY=(0 1 2 3 4 5 6 7 8 9 s k) elif [[ $prev == ?(start|stop) ]]; then if [[ $cur == [0-9] || -z $cur ]]; then COMPREPLY=(0 1 2 3 4 5 6 7 8 9) elif [[ $cur == [0-9][0-9] ]]; then COMPREPLY=($cur) else COMPREPLY=() fi elif [[ $prev == ?([0-9][0-9]|[0-6S]) ]]; then if [[ -z $cur ]]; then if [[ $prev == [0-9][0-9] ]]; then COMPREPLY=(0 1 2 3 4 5 6 S) else COMPREPLY=(0 1 2 3 4 5 6 S .) fi elif [[ $cur == [0-6S.] ]]; then COMPREPLY=($cur) else COMPREPLY=() fi elif [[ $prev == "." ]]; then COMPREPLY=($(compgen -W "start stop" -- "$cur")) else COMPREPLY=() fi } && complete -F _update_rc_d update-rc.d # ex: filetype=sh groupmems 0000644 00000001143 15036124164 0006506 0 ustar 00 # groupmems(8) completion -*- shell-script -*- _groupmems() { local cur prev words cword _init_completion || return case $prev in -a | --add | -d | --delete) COMPREPLY=($(compgen -u -- "$cur")) return ;; -g | --group) COMPREPLY=($(compgen -g -- "$cur")) return ;; -R | --root) _filedir -d return ;; esac COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) } && complete -F _groupmems groupmems # ex: filetype=sh lsns 0000644 00000002247 15036124164 0005455 0 ustar 00 _lsns_module() { local cur prev OPTS LSNS_COLS_ALL COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" LSNS_COLS_ALL=" NS TYPE PATH NPROCS PID PPID COMMAND UID USER " case $prev in '-o'|'--output') local prefix realcur LSNS_COLS realcur="${cur##*,}" prefix="${cur%$realcur}" for WORD in $LSNS_COLS_ALL; do if ! [[ $prefix == *"$WORD"* ]]; then LSNS_COLS="$WORD ${LSNS_COLS:-""}" fi done compopt -o nospace COMPREPLY=( $(compgen -P "$prefix" -W "$LSNS_COLS" -S ',' -- $realcur) ) return 0 ;; '-p'|'--task') COMPREPLY=( $(compgen -W "$(cd /proc && echo [0-9]*)" -- $cur) ) return 0 ;; '-t'|'--type') COMPREPLY=( $(compgen -W "mnt net ipc user pid uts cgroup" -- $cur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) COMPREPLY=( $(compgen -W " --json --list --noheadings --output --output-all --task --raw --notruncate --type --help --version " -- $cur) ) return 0 ;; esac COMPREPLY=( $(compgen -W "mnt net pid uts ipc user" -- $cur ) ) return 0 } complete -F _lsns_module lsns pkgtool 0000644 00000001516 15036124164 0006153 0 ustar 00 # Slackware Linux pkgtool completion -*- shell-script -*- _pkgtool() { local cur prev words cword _init_completion || return case "$prev" in --source_dir | --target_dir) _filedir -d return ;; --sets) # argument required but no completions available return ;; --source_device) COMPREPLY=($(compgen -f -d -- "${cur:-/dev/}")) return ;; --tagfile) _filedir return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '--sets --ignore-tagfiles --tagfile --source-mounted --source_dir --target_dir --source_device' \ -- "$cur")) fi } && complete -F _pkgtool pkgtool # ex: filetype=sh dumpe2fs 0000644 00000001006 15036124164 0006213 0 ustar 00 # dumpe2fs(8) completion -*- shell-script -*- _dumpe2fs() { local cur prev words cword _init_completion || return case $prev in -*[oV]) return ;; -*i) _filedir return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_usage "$1")' -- "$cur")) return fi cur=${cur:=/dev/} _filedir } && complete -F _dumpe2fs dumpe2fs # ex: filetype=sh radvdump 0000644 00000000764 15036124164 0006322 0 ustar 00 # radvdump(8) completion -*- shell-script -*- _radvdump() { local cur prev words cword _init_completion || return case $prev in -h | --help | -v | --version) return ;; -d | --debug) COMPREPLY=($(compgen -W '{1..4}' -- "$cur")) return ;; esac COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) } && complete -F _radvdump radvdump # ex: filetype=sh fincore 0000644 00000001624 15036124164 0006121 0 ustar 00 _fincore_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-o'|'--output') local prefix realcur OUTPUT_ALL OUTPUT realcur="${cur##*,}" prefix="${cur%$realcur}" OUTPUT_ALL='PAGES SIZE FILE RES' for WORD in $OUTPUT_ALL; do if ! [[ $prefix == *"$WORD"* ]]; then OUTPUT="$WORD ${OUTPUT:-""}" fi done compopt -o nospace COMPREPLY=( $(compgen -P "$prefix" -W "$OUTPUT" -S ',' -- "$realcur") ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS=" --json --bytes --noheadings --output --raw --help --version " COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- ${cur:-"/"}) ) return 0 } complete -F _fincore_module fincore sysbench 0000644 00000010012 15036124164 0006301 0 ustar 00 # bash completion for sysbench -*- shell-script -*- _sysbench() { local cur prev words cword split _init_completion -s || return case $prev in --num-threads | --max-requests | --max-time | --thread-stack-size | \ --help | --version | help | version) return ;; --init-rng | --debug | --validate) COMPREPLY=($(compgen -W 'on off' -- "$cur")) return ;; --test) COMPREPLY=($(compgen -W 'fileio cpu memory threads mutex oltp' \ -- "$cur")) return ;; --cpu-max-prime) return ;; --file-test-mode) COMPREPLY=($(compgen -W 'seqwr seqrewr seqrd rndrd rndwr rndrw' \ -- "$cur")) return ;; --file-io-mode) COMPREPLY=($(compgen -W 'sync async fastmmap slowmmap' -- "$cur")) return ;; --file-extra-flags) COMPREPLY=($(compgen -W 'sync dsync direct' -- "$cur")) return ;; --file-fsync-all | --file-fsync-end) COMPREPLY=($(compgen -W 'on off' -- "$cur")) return ;; --file-fsync-mode) COMPREPLY=($(compgen -W 'fsync fdatasync' -- "$cur")) return ;; --memory-scope) COMPREPLY=($(compgen -W 'global local' -- "$cur")) return ;; --memory-hugetlb) COMPREPLY=($(compgen -W 'on off' -- "$cur")) return ;; --memory-oper) COMPREPLY=($(compgen -W 'read write none' -- "$cur")) return ;; --memory-access-mode) COMPREPLY=($(compgen -W 'seq rnd' -- "$cur")) return ;; --oltp-test-mode) COMPREPLY=($(compgen -W 'simple complex nontrx sp' -- "$cur")) return ;; --oltp-read-only | --oltp-skip-trx | --oltp-quto-inc | --mysql-ssl) COMPREPLY=($(compgen -W 'on off' -- "$cur")) return ;; --oltp-nontrx-mode) COMPREPLY=($(compgen -W 'select update_key update_nokey insert delete' -- "$cur")) return ;; --oltp-dist-type) COMPREPLY=($(compgen -W 'uniform gaussian special' -- "$cur")) return ;; --db-driver) COMPREPLY=($(compgen -W "$($1 --test=oltp help 2>/dev/null | command sed -e '/^.*database drivers:/,/^$/!d' \ -ne 's/^ *\([^ ]*\) .*/\1/p')" -- "$cur")) return ;; --db-ps-mode) COMPREPLY=($(compgen -W 'auto disable' -- "$cur")) return ;; --mysql-socket) _filedir sock return ;; --mysql-table-engine) COMPREPLY=($(compgen -W 'myisam innodb bdb heap ndbcluster federated' -- "$cur")) return ;; --mysql-engine-trx) COMPREPLY=($(compgen -W 'yes no auto' -- "$cur")) return ;; --*) $split && return ;; esac # find out which test we're running local i test for ((i = 1; i < ${#words[@]} - 1; i++)); do # TODO --test= is deprecated, bare test name preferred if [[ ${words[i]} == --test* ]]; then test=${words[i]#*=} break fi done local opts=$(_parse_help "$1") if [[ -v test ]]; then local help=($(_parse_help "$1" "--test=$test help")) opts="${opts/--test=/} ${help[*]} prepare run cleanup help version" fi if [[ $cur == -* || ! -v test ]]; then COMPREPLY=($(compgen -W "$opts" -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace else COMPREPLY=($(compgen -W "prepare run cleanup help version" -- "$cur")) fi } && complete -F _sysbench sysbench # ex: filetype=sh flock 0000644 00000001552 15036124164 0005572 0 ustar 00 _flock_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-w'|'--timeout') COMPREPLY=( $(compgen -W "seconds" -- $cur) ) return 0 ;; '-E'|'--conflict-exit-code') COMPREPLY=( $(compgen -W "{0..255}" -- $cur) ) return 0 ;; '-c'|'--command') compopt -o bashdefault COMPREPLY=( $(compgen -c -- $cur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS="--shared --exclusive --unlock --nonblock --timeout --conflict-exit-code --close --command --no-fork --help --version" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- ${cur:-"/"}) ) return 0 } complete -F _flock_module flock gnatmake 0000644 00000001767 15036124164 0006273 0 ustar 00 # Gnatmake completion -*- shell-script -*- # by Ralf_Schroth@t-online.de (Ralf Schroth) _gnatmake() { local cur prev words cword _init_completion || return if [[ $cur == -* ]]; then # relevant (and less relevant ;-) )options completion COMPREPLY=($(compgen -W '-a -c -f -i -j -k -m -M -n -o -q -s -v -z -aL -A -aO -aI -I -I- -L -nostdinc -nostdlib -cargs -bargs -largs -fstack-check -fno-inline -g -O1 -O0 -O2 -O3 -gnata -gnatA -gnatb -gnatc -gnatd -gnatD -gnate -gnatE -gnatf -gnatF -gnatg -gnatG -gnath -gnati -gnatk -gnatl -gnatL -gnatm -gnatn -gnato -gnatO -gnatp -gnatP -gnatq -gnatR -gnats -gnatt -gnatT -gnatu -gnatU -gnatv -gnatws -gnatwe -gnatwl -gnatwu -gnatW -gnatx -gnatX -gnaty -gnatz -gnatZ -gnat83' -- "$cur")) else # source file completion _filedir '@(adb|ads)' fi } && complete -F _gnatmake gnatmake # ex: filetype=sh xrandr 0000644 00000004273 15036124164 0005775 0 ustar 00 # bash completion for xrandr -*- shell-script -*- _xrandr() { local cur prev words cword _init_completion || return case "$prev" in -display | -d | -help | -s | --size | -r | --rate | --refresh | --screen | --fb | --fbmm | \ --dpi | --pos | --set | --scale | --transform | --crtc | --panning | --gamma | \ --newmode | --rmmode | --addmode | --delmode) return ;; --output | --left-of | --right-of | --above | --below | --same-as) local outputs=$("$1" | awk '/connected/ {print $1}') COMPREPLY=($(compgen -W "$outputs" -- "$cur")) return ;; --mode) local i output for ((i = 1; i < cword; i++)); do if [[ ${words[i]} == --output ]]; then output=${words[i + 1]} break fi done if [[ -v output ]]; then local modes=$("$1" | command sed -e "1,/^$output / d" \ -e "/connected/,$ d" \ -e "s/\([^[:space:]]\)[[:space:]].*/\1/") COMPREPLY=($(compgen -W "$modes" -- "$cur")) fi return ;; -o | --orientation) COMPREPLY=($(compgen -W 'normal inverted left right 0 1 2 3' -- \ "$cur")) return ;; --reflect) COMPREPLY=($(compgen -W 'normal x y xy' -- "$cur")) return ;; --rotate) COMPREPLY=($(compgen -W 'normal inverted left right' -- "$cur")) return ;; --setprovideroutputsource | --setprovideroffloadsink) local providers=$("$1" --listproviders 2>/dev/null | command sed -ne 's/.* name:\([^ ]*\).*/\1/p') COMPREPLY=($(compgen -W "$providers" -- "$cur")) # TODO 2nd arg needed, is that a provider as well? return ;; esac COMPREPLY=($(compgen -W '$("$1" -help 2>&1 | command sed -e "s/ or / /g" -e "s/<[^>]*>]//g" | _parse_help -)' \ -- "$cur")) } && complete -F _xrandr xrandr # ex: filetype=sh feh 0000644 00000010312 15036124164 0005230 0 ustar 00 # bash completion for feh(1) -*- shell-script -*- _feh() { local cur prev words cword split _init_completion -s || return case "$prev" in --image-bg | -B) COMPREPLY=($(compgen -W 'checks white black' -- "$cur")) return ;; --filelist | --output | --output-only | --start-at | -!(-*)[foO\|]) _filedir return ;; --caption-path | --fontpath | --output-dir | -!(-*)[KCj]) _filedir -d return ;; --font | --menu-font | --title-font | -!(-*)[eM@]) # expect string like "dejavu.ttf/12" if [[ $cur == */* ]]; then # expect integer value COMPREPLY=($(compgen -P "$cur" -W '{0..9}')) compopt -o nospace return fi local font_path # font_path="$(imlib2-config --prefix 2>/dev/null)/share/imlib2/data/fonts" # COMPREPLY=( $(cd "$font_path" 2>/dev/null; compgen -f \ # -X "!*.@([tT][tT][fF])" -S / -- "$cur") ) for ((i = ${#words[@]} - 1; i > 0; i--)); do if [[ ${words[i]} == -@(C|-fontpath) ]]; then font_path="${words[i + 1]}" COMPREPLY+=($( cd "$font_path" 2>/dev/null compgen -f \ -X "!*.@([tT][tT][fF])" -S / -- "$cur" )) fi done compopt -o nospace return ;; --theme | -!(-*)T) local conf_path=~/.config/feh/themes local theme_name theme_opts [[ -r $conf_path ]] || return while read theme_name theme_opts; do if [[ $theme_name == '#'* || $theme_name == "" ]]; then continue fi COMPREPLY+=($(compgen -W "$theme_name" -- "$cur")) done <"$conf_path" return ;; --sort | -!(-*)S) COMPREPLY=($(compgen -W 'name filename mtime width height pixels size format' -- "$cur")) return ;; --reload | --limit-height | --limit-width | --thumb-height | --thumb-width | \ --thumb-redraw | --magick-timeout | -!(-*)[RHWEyJ]) # expect integer value COMPREPLY+=($(compgen -W '{0..9}')) compopt -o nospace return ;; --zoom) # expect integer value or "max", "fill" COMPREPLY=($(compgen -W 'max fill' -- "$cur")) if [[ ! $cur || ! ${COMPREPLY-} ]]; then COMPREPLY+=($(compgen -W '{0..9}')) compopt -o nospace fi return ;; --alpha | -!(-*)a) COMPREPLY=($(compgen -W '{0..255}' -- "$cur")) return ;; --bg | -!(-*)b) _filedir COMPREPLY+=($(compgen -W 'trans' -- "$cur")) return ;; --geometry | --max-dimension | --min-dimension | -!(-*)g) # expect string like 640x480 if [[ $cur && $cur != *x* ]]; then COMPREPLY=(x) fi COMPREPLY+=($(compgen -W "{0..9}")) compopt -o nospace return ;; --customlist | --index-info | --info | --slideshow-delay | --thumb-title | \ --title | -!(-*)[LD~^]) # argument required but no completions available return ;; esac $split && return if [[ $cur == -* ]]; then # Some versions of feh just output "See 'man feh'" for --help :( COMPREPLY=($(compgen -W '$(_parse_help "$1" --help)' -- "$cur")) if [[ ${COMPREPLY-} ]]; then [[ $COMPREPLY == *= ]] && compopt -o nospace return fi fi # FIXME: It is hard to determine correct supported extensions. # feh can handle any format that imagemagick can plus some others _filedir 'xpm|tif?(f)|png|p[npgba]m|iff|?(i)lbm|jp?(e)g|jfi?(f)|gif|bmp|arg?(b)|tga|xcf|ani|ico|?(e)ps|pdf|dvi|txt|svg?(z)|cdr|[ot]tf' } && complete -F _feh feh # ex: filetype=sh sbopkg 0000644 00000003350 15036124164 0005757 0 ustar 00 # bash completion for sbopkg(8) -*- shell-script -*- _sbopkg() { local cur prev words cword _init_completion || return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1" -h)' -- "$cur")) [[ ${COMPREPLY-} ]] && return fi case "$prev" in -e) COMPREPLY=($(compgen -W 'ask continue stop' -- "$cur")) return ;; -f) _filedir return ;; -d) _filedir -d return ;; -V) COMPREPLY=($(compgen -W "? $(sbopkg -V '?' 2>&1 | cut -s -f1)" -- "$cur")) return ;; -i | -b) ;; *) return ;; esac local i config config="/etc/sbopkg/sbopkg.conf" for ((i = ${#words[@]} - 1; i > 0; i--)); do if [[ ${words[i]} == -f ]]; then config="${words[i + 1]}" __expand_tilde_by_ref config break fi done [[ -r $config ]] || return . $config for ((i = 1; i < ${#words[@]}; i++)); do case "${words[i]}" in -V) REPO_NAME="${words[i + 1]%%/*}" REPO_BRANCH="${words[i + 1]#*/}" ;; -d) REPO_ROOT="${words[i + 1]}" ;; esac done [[ -r $REPO_ROOT/$REPO_NAME/$REPO_BRANCH/SLACKBUILDS.TXT ]] || return COMPREPLY=($(command sed -ne "/^SLACKBUILD NAME: $cur/{s/^SLACKBUILD NAME: //;p}" \ $REPO_ROOT/$REPO_NAME/$REPO_BRANCH/SLACKBUILDS.TXT) $( cd $QUEUEDIR compgen -f -X "!*.sqf" -- "$cur" )) } && complete -F _sbopkg sbopkg # ex: filetype=sh e2freefrag 0000644 00000000714 15036124164 0006503 0 ustar 00 # e2freefrag(8) completion -*- shell-script -*- _e2freefrag() { local cur prev words cword _init_completion || return case $prev in -c | -h) return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_usage "$1" -h)' -- "$cur")) return fi cur=${cur:=/dev/} _filedir } && complete -F _e2freefrag e2freefrag # ex: filetype=sh change_pw 0000644 00000001023 15036124164 0006420 0 ustar 00 # mailman change_pw completion -*- shell-script -*- _change_pw() { local cur prev words cword split _init_completion -s || return case $prev in -l | --listname) _xfunc list_lists _mailman_lists return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '--all --domain --listname --password --quiet --help' -- "$cur")) fi } && complete -F _change_pw change_pw # ex: filetype=sh lastlog 0000644 00000001110 15036124164 0006127 0 ustar 00 # lastlog(8) completion -*- shell-script -*- _lastlog() { local cur prev words cword split _init_completion -s || return case $prev in --before | --help | --time | -!(-*)@([bt]|h*)) return ;; --user | -!(-*)u) COMPREPLY=($(compgen -u -- "$cur")) return ;; esac $split && return COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace } && complete -F _lastlog lastlog # ex: filetype=sh netplan 0000644 00000005336 15036124164 0006141 0 ustar 00 # netplan(5) completion -*- shell-script -*- _netplan_completions_filter() { local words="$1" local cur=${COMP_WORDS[COMP_CWORD]} local result=() if [[ "${cur:0:1}" == "-" ]]; then echo "$words" else for word in $words; do [[ "${word:0:1}" != "-" ]] && result+=("$word") done echo "${result[*]}" fi } _netplan_completions() { local cur=${COMP_WORDS[COMP_CWORD]} local compwords=("${COMP_WORDS[@]:1:$COMP_CWORD-1}") local compline="${compwords[*]}" case "$compline" in 'ip leases'*) while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_netplan_completions_filter "-h --help --debug --root-dir")" -- "$cur" ) ;; 'generate'*) while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_netplan_completions_filter "-h --help --debug --root-dir --mapping")" -- "$cur" ) ;; 'rebind'*) while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_netplan_completions_filter "-h --help --debug")" -- "$cur" ) ;; 'status'*) while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_netplan_completions_filter "-h --help --debug -a --all -f --format $(ls /sys/class/net 2> /dev/null)")" -- "$cur" ) ;; 'apply'*) while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_netplan_completions_filter "-h --help --debug --sriov-only --only-ovs-cleanup --state")" -- "$cur" ) ;; 'help'*) while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_netplan_completions_filter "-h --help")" -- "$cur" ) ;; 'info'*) while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_netplan_completions_filter "-h --help --debug --json --yaml")" -- "$cur" ) ;; 'get'*) while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_netplan_completions_filter "-h --help --debug --root-dir")" -- "$cur" ) ;; 'set'*) while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_netplan_completions_filter "-h --help --debug --origin-hint")" -- "$cur" ) ;; 'try'*) while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_netplan_completions_filter "-h --help --debug --config-file --timeout --state")" -- "$cur" ) ;; 'ip'*) while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_netplan_completions_filter "-h --help --debug help leases")" -- "$cur" ) ;; *) while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_netplan_completions_filter "-h --help --debug help apply generate get info ip set rebind status try")" -- "$cur" ) ;; esac } && complete -F _netplan_completions netplan # ex: filetype=sh alias 0000644 00000000752 15036124164 0005566 0 ustar 00 # bash alias completion -*- shell-script -*- _alias() { local cur prev words cword _init_completion -n = || return case ${words[@]} in *[^=]) COMPREPLY=($(compgen -A alias -- "$cur")) ;; *=) COMPREPLY=("$(alias ${cur%=} 2>/dev/null | command sed \ -e 's|^alias '"$cur"'\(.*\)$|\1|')") ;; esac } && complete -F _alias -o nospace alias # ex: filetype=sh systemd-cgtop 0000644 00000003554 15036124164 0007302 0 ustar 00 # systemd-cgtop(1) completion -*- shell-script -*- # SPDX-License-Identifier: LGPL-2.1-or-later # # This file is part of systemd. # # systemd is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version. # # systemd is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with systemd; If not, see <http://www.gnu.org/licenses/>. __contains_word() { local w word=$1; shift for w in "$@"; do [[ $w = "$word" ]] && return done } __get_machines() { local a b machinectl list --full --no-legend --no-pager | { while read a b; do echo " $a"; done; }; } _systemd_cgtop() { local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} words cword local comps local -A OPTS=( [STANDALONE]='-h --help --version -p -t -c -m -i -b --batch -r --raw -k -P' [ARG]='--cpu --depth -M --machine --recursive -n --iterations -d --delay --order' ) _init_completion || return if __contains_word "$prev" ${OPTS[ARG]}; then case $prev in --machine|-M) comps=$( __get_machines ) ;; --recursive) comps='yes no' ;; --order) comps='path tasks cpu memory io' ;; esac COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 fi COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") ) } complete -F _systemd_cgtop systemd-cgtop rtcwake 0000644 00000002071 15036124164 0006131 0 ustar 00 _rtcwake_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-A'|'--adjfile') local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 ;; '-d'|'--device') local RTC_DEVS RTC_DEVS=$(cd /sys/class/rtc/ && echo *) COMPREPLY=( $(compgen -W "$RTC_DEVS" -- $cur) ) return 0 ;; '-m'|'--mode') COMPREPLY=( $(compgen -W "$(rtcwake --list-modes)" -- $cur) ) return 0 ;; '-s'|'--seconds') COMPREPLY=( $(compgen -W "seconds" -- $cur) ) return 0 ;; '-t'|'--time') COMPREPLY=( $(compgen -W "time_t" -- $cur) ) return 0 ;; '--date') COMPREPLY=( $(compgen -W "YYYYMMDDhhmmss" -- $cur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac OPTS=" --auto --adjfile --date --device --dry-run --local --list-modes --mode --seconds --time --utc --verbose --help --version " COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 } complete -F _rtcwake_module rtcwake inject 0000644 00000000776 15036124164 0005757 0 ustar 00 # mailman inject completion -*- shell-script -*- _inject() { local cur prev words cword split _init_completion -s || return case $prev in -l | --listname) _xfunc list_lists _mailman_lists return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '--listname --queue --help' -- "$cur")) else _filedir fi } && complete -F _inject inject # ex: filetype=sh wine 0000644 00000001027 15036124164 0005433 0 ustar 00 # bash completion for wine(1) -*- shell-script -*- _wine() { local cur prev words cword _init_completion || return if ((cword == 1)); then if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '--help --version' -- "$cur")) [[ ${COMPREPLY-} ]] && return fi _filedir '@([eE][xX][eE]?(.[sS][oO])|[cC][oO][mM]|[sS][cC][rR]|[mM][sS][iI])' else _filedir fi } && complete -F _wine wine wine-development wine-stable # ex: filetype=sh pkcon 0000755 00000005261 15036124164 0005612 0 ustar 00 # # bash completion support for PackageKit's console commands. # # Copyright (C) 2007 James Bowes <jbowes@dangerouslyinc.com> # Copyright (C) 2010 Richard Hughes <richard@hughsie.com> # # Licensed under the GNU General Public License Version 2 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # To use the completion: # 1. Copy this file somewhere (e.g. ~/.pk-completion.sh). # 2. Add the following line to your .bashrc: # source ~/.pk-completion.sh __pkcon_commandlist=" accept-eula backend-details get-roles depends-on get-details get-distro-upgrades get-files get-filters get-groups get-packages download required-by get-time get-transactions get-update-detail get-updates get-categories install install-local list-create offline-get-prepared offline-status offline-trigger refresh remove repo-disable repo-enable repo-list repo-set-data resolve search quit update upgrade-system repair " __pkconcomp () { local all c s=$'\n' IFS=' '$'\t'$'\n' local cur="${COMP_WORDS[COMP_CWORD]}" if [ $# -gt 2 ]; then cur="$3" fi for c in $1; do case "$c$4" in *.) all="$all$c$4$s" ;; *) all="$all$c$4 $s" ;; esac done IFS=$s COMPREPLY=($(compgen -P "$2" -W "$all" -- "$cur")) return } _pkcon_search () { local i c=1 command while [ $c -lt $COMP_CWORD ]; do i="${COMP_WORDS[c]}" case "$i" in name|details|group|file) command="$i" break ;; esac c=$((++c)) done if [ $c -eq $COMP_CWORD -a -z "$command" ]; then __pkconcomp "name details group file" fi return } _pkcon () { local i c=1 command while [ $c -lt $COMP_CWORD ]; do i="${COMP_WORDS[c]}" case "$i" in --version|--help|--verbose|--nowait|-v|-n|-h|-?) ;; *) command="$i"; break ;; esac c=$((++c)) done if [ $c -eq $COMP_CWORD -a -z "$command" ]; then case "${COMP_WORDS[COMP_CWORD]}" in --*=*) COMPREPLY=() ;; --*) __pkconcomp " --version --filter --verbose --help --nowait " ;; -*) __pkconcomp " -v -n -h -? --version --verbose --help --filter --nowait " ;; *) __pkconcomp "$__pkcon_commandlist" ;; esac return fi case "$command" in search) _pkcon_search ;; *) COMPREPLY=() ;; esac } complete -o default -o nospace -F _pkcon pkcon evince 0000644 00000001720 15036124164 0005742 0 ustar 00 # evince(1) completion -*- shell-script -*- _evince() { local cur prev words cword split _init_completion -s || return case $prev in --help* | --sm-client-id | --class | --name | --screen | --gdk-debug | \ --gdk-no-debug | --gtk-module | --gtk-debug | --gtk-no-debug | --page-label | \ --page-index | --find | --display | -!(-*)[hpil]) return ;; --sm-client-state-file) _filedir return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1" --help-all)' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return fi _filedir '@(@(?(e)ps|?(E)PS|[pf]df|[PF]DF|dvi|DVI)?(.gz|.GZ|.bz2|.BZ2|.xz|.XZ)|cb[rz]|djv?(u)|gif|jp?(e)g|miff|tif?(f)|pn[gm]|p[bgp]m|bmp|xpm|ico|xwd|tga|pcx)' } && complete -F _evince evince # ex: filetype=sh _ionice 0000644 00000002351 15036124164 0006077 0 ustar 00 # ionice(1) completion -*- shell-script -*- # Use of this file is deprecated. Upstream completion is available in # util-linux >= 2.23, use that instead. _ionice() { local cur prev words cword _init_completion || return local offset=0 i for ((i = 1; i <= cword; i++)); do case ${words[i]} in -h) return ;; -p) offset=0 break ;; -c | -n) ((i++)) continue ;; -*) continue ;; esac offset=$i break done if ((offset > 0)); then _command_offset $offset return fi case $prev in -c) COMPREPLY=($(compgen -W '{0..3}' -- "$cur")) return ;; -n) COMPREPLY=($(compgen -W '{0..7}' -- "$cur")) return ;; -p) _pids return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1" -h)' -- "$cur")) return fi } && complete -F _ionice ionice # ex: filetype=sh configure 0000644 00000002264 15036124164 0006456 0 ustar 00 # bash completion for configure -*- shell-script -*- _configure() { local cur prev words cword split _init_completion -s || return case $prev in -h | --help | -V | --version | --program-prefix | --program-suffix | \ --program-transform-name) return ;; --*file) _filedir return ;; --*prefix | --*dir) _filedir -d return ;; esac $split && return # if $COMP_CONFIGURE_HINTS is not null, then completions of the form # --option=SETTING will include 'SETTING' as a contextual hint [[ $cur != -* ]] && return if [[ ${COMP_CONFIGURE_HINTS-} ]]; then COMPREPLY=($(compgen -W "$($1 --help 2>&1 | awk '/^ --[A-Za-z]/ { print $1; \ if ($2 ~ /--[A-Za-z]/) print $2 }' | command sed -e 's/[[,].*//g')" \ -- "$cur")) [[ ${COMPREPLY-} == *=* ]] && compopt -o nospace else COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace fi } && complete -F _configure configure # ex: filetype=sh postfix 0000644 00000001371 15036124164 0006167 0 ustar 00 # postfix(1) completion -*- shell-script -*- _postfix() { local cur prev words cword _init_completion || return case $prev in -c) _filedir -d return ;; -D) COMPREPLY=($(compgen -W 'start' -- "$cur")) return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($( compgen -W \ '$(_bashcomp_try_faketty "$1" --help 2>&1 | _parse_usage -)' \ -- "$cur" )) return fi COMPREPLY=($(compgen -W 'check start stop abort flush reload status set-permissions upgrade-configuration' -- "$cur")) } && complete -F _postfix postfix # ex: filetype=sh dhclient 0000644 00000001270 15036124164 0006263 0 ustar 00 # bash completion for dhclient -*- shell-script -*- _dhclient() { local cur prev words cword _init_completion || return case $prev in -p | -e) return ;; -D) COMPREPLY=($(compgen -W 'LL LLT' -- "$cur")) return ;; -*f) _filedir return ;; -s) _known_hosts_real -- "$cur" return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_usage "$1")' -- "$cur")) else _available_interfaces fi } && complete -F _dhclient dhclient # ex: filetype=sh opera 0000644 00000002614 15036124164 0005602 0 ustar 00 # opera(1) completion -*- shell-script -*- _opera() { local cur prev words cword _init_completion || return case "$prev" in ?(-)-widget | ?(-)-urllist | ?(-)-uiparserlog | ?(-)-uiwidgetsparserlog | \ ?(-)-profilinglog) _filedir return ;; ?(-)-[psb]d) _filedir -d return ;; ?(-)-remote) COMPREPLY=($(compgen -W 'openURL\\( openFile\\( openM2\\( openComposer\\( addBookmark\\( raise\\(\\) lower\\(\\)' \ -- "$cur")) [[ ${COMPREPLY-} == *\( ]] && compopt -o nospace return ;; ?(-)-windowname) COMPREPLY=($(compgen -W 'first last opera{1..9}' -- "$cur")) return ;; ?(-)-geometry | ?(-)-window | ?(-)-display | ?(-)-urllistloadtimeout | \ ?(-)-delaycustomizations | ?(-)-dialogtest | ?(-)-inidialogtest | \ ?(-)-gputest) # argument required but no completions available return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1" -help)' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return fi _filedir '@(?([xX]|[sS])[hH][tT][mM]?([lL]))' } && complete -F _opera opera # ex: filetype=sh chcpu 0000644 00000002762 15036124164 0005602 0 ustar 00 _chcpu_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-e'|'--enable') local prefix realcur CPULIST_ALL CPULIST realcur="${cur##*,}" prefix="${cur%$realcur}" CPULIST_ALL=$(sed 's/^/{/; s/-/../g; s/,/} {/g; s/$/}/' /sys/devices/system/cpu/offline) for WORD in $(eval echo $CPULIST_ALL); do if ! [[ $prefix == *"$WORD"* ]]; then CPULIST="$WORD ${CPULIST:-""}" fi done compopt -o nospace COMPREPLY=( $(compgen -P "$prefix" -W "$CPULIST" -S ',' -- $realcur) ) return 0 ;; '-d'|'--disable') local prefix realcur CPULIST_ALL CPULIST realcur="${cur##*,}" prefix="${cur%$realcur}" CPULIST_ALL=$(sed 's/^/{/; s/-/../g; s/,/} {/g; s/$/}/' /sys/devices/system/cpu/online) for WORD in $(eval echo $CPULIST_ALL); do if ! [[ $prefix == *"$WORD"* ]]; then CPULIST="$WORD ${CPULIST:-""}" fi done compopt -o nospace COMPREPLY=( $(compgen -P "$prefix" -W "$CPULIST" -S ',' -- $realcur) ) return 0 ;; '-c'|'--configure'|'-g'|'--deconfigure') COMPREPLY=( $(compgen -W "cpu-list" -- $cur) ) return 0 ;; '-p'|'--dispatch') COMPREPLY=( $(compgen -W "horizontal vertical" -- $cur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac OPTS="--help --enable --disable --configure --deconfigure --dispatch --rescan --version" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 } complete -F _chcpu_module chcpu rrdtool 0000644 00000000664 15036124164 0006164 0 ustar 00 # bash completion for rrdtool -*- shell-script -*- _rrdtool() { local cur prev words cword _init_completion || return if ((${#words[@]} == 2)); then COMPREPLY=($(compgen -W 'create update updatev graph dump restore last lastupdate first info fetch tune resize xport' -- "$cur")) else _filedir rrd fi } && complete -F _rrdtool rrdtool # ex: filetype=sh sudo 0000644 00000002740 15036124164 0005446 0 ustar 00 # bash completion for sudo(8) -*- shell-script -*- _sudo() { local cur prev words cword split _init_completion -s || return local i mode=normal [[ $1 == *sudoedit ]] && mode=edit [[ $mode == normal ]] && for ((i = 1; i <= cword; i++)); do if [[ ${words[i]} != -* ]]; then local PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin local root_command=${words[i]} _command_offset $i return fi if [[ ${words[i]} == -@(!(-*)e*|-edit) ]]; then mode=edit break fi [[ ${words[i]} == \ -@(user|other-user|group|close-from|prompt|!(-*)[uUgCp]) ]] && ((i++)) done case "$prev" in --user | --other-user | -!(-*)[uU]) COMPREPLY=($(compgen -u -- "$cur")) return ;; --group | -!(-*)g) COMPREPLY=($(compgen -g -- "$cur")) return ;; --close-from | --prompt | -!(-*)[Cp]) return ;; esac $split && return if [[ $cur == -* ]]; then local opts=$(_parse_help "$1") COMPREPLY=($(compgen -W '${opts:-$(_parse_usage "$1")}' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return fi if [[ $mode == edit ]]; then _filedir fi } && complete -F _sudo sudo sudoedit # ex: filetype=sh _modules 0000644 00000004752 15036124164 0006310 0 ustar 00 # module completion by Ted Stern <stern@cray.com> -*- shell-script -*- # # Use of this file is deprecated, upstream completion is available in # modules >= 3.2.7, use that instead. # # Completion for Environment Modules `module' alias. # # See https://sourceforge.net/projects/modules/ # https://modules.sourceforge.net/ # # There are several versions of modules that are commonly used. Older # Cray UNICOS systems and many other sites use 2.2.2b. The latest GPL'd # version is 3.1.6. But the module alias is somewhat self-documenting # via the `module help' command, so use that to print the options. # # Programmable completion might be more difficult under tcsh since the # module command is an alias, and the `module avail' command returns # its output as stderr. # Test for existence of /etc/profile.d/modules.sh too because we may end up # being sourced before it and thus before the `module' alias has been defined. [ -f /etc/profile.d/modules.sh ] || return 1 _module_list() { local modules="$(command sed 's/:/ /g' <<<$LOADEDMODULES | sort)" compgen -W "$modules" -- $1 } _module_path() { local modules="$(command sed 's/:/ /g' <<<$MODULEPATH | sort)" compgen -W "$modules" -- $1 } _module_avail() { local modules="$( module avail 2>&1 | command grep -E -v '^(-|$)' | xargs printf '%s\n' | command sed -e 's/(default)//g' | sort )" compgen -W "$modules" -- $1 } # A completion function for the module alias _module() { local cur prev words cword _init_completion || return if ((cword == 1)); then # First parameter on line -- we expect it to be a mode selection local options options="$(module help 2>&1 | command grep -E '^[[:space:]]*\+' | awk '{print $2}' | command sed -e 's/|/ /g' | sort)" COMPREPLY=($(compgen -W "$options" -- "$cur")) elif ((cword == 2)); then case $prev in add | display | help | load | show | whatis) COMPREPLY=($(_module_avail "$cur")) ;; rm | switch | swap | unload | update) COMPREPLY=($(_module_list "$cur")) ;; unuse) COMPREPLY=($(_module_path "$cur")) ;; esac elif ((cword == 3)); then case ${words[1]} in swap | switch) COMPREPLY=($(_module_avail "$cur")) ;; esac fi } && complete -F _module -o default module # ex: filetype=sh pydocstyle 0000644 00000001507 15036124164 0006673 0 ustar 00 # bash completion for pydocstyle -*- shell-script -*- _pydocstyle() { local cur prev words cword split _init_completion -s || return case $prev in --help | --version | --match | --ignore-decorators | --select | --ignore | \ --add-select | --add-ignore | -!(-*)h) return ;; --config) _filedir xml return ;; --convention) COMPREPLY=($(compgen -W "pep257 numpy" -- "$cur")) return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return fi _filedir py } && complete -F _pydocstyle pydocstyle # ex: filetype=sh chrpath 0000644 00000001030 15036124164 0006114 0 ustar 00 # chrpath(1) completion -*- shell-script -*- _chrpath() { local cur prev words cword _init_completion || return case $prev in --version | --help | -!(-*)[vh]) return ;; --replace | -!(-*)r) _filedir -d return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) return fi _filedir } && complete -F _chrpath chrpath # ex: filetype=sh json_xs 0000644 00000001537 15036124164 0006162 0 ustar 00 # json_xs completion -*- shell-script -*- _json_xs() { local cur prev words cword _init_completion || return case $prev in -*f) COMPREPLY=($(compgen -W 'json cbor storable storable-file bencode clzf eval yaml string none' -- "$cur")) return ;; -*t) COMPREPLY=($(compgen -W 'json json-utf-8 json-pretty json-utf-16le json-utf-16be json-utf-32le json-utf-32be cbor storable storable-file bencode clzf yaml dump dumper string none' -- "$cur")) return ;; -*e) return ;; esac [[ $cur == -* ]] && COMPREPLY=($(compgen -W '$(_parse_usage "$1") -f' -- "$cur")) } && complete -F _json_xs json_xs # ex: filetype=sh rmmod 0000644 00000001017 15036124164 0005606 0 ustar 00 # Linux rmmod(8) completion. -*- shell-script -*- # This completes on a list of all currently installed kernel modules. _rmmod() { local cur prev words cword _init_completion || return case $prev in -h | --help | -V | --version) return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) return fi _installed_modules "$cur" } && complete -F _rmmod rmmod # ex: filetype=sh desktop-file-validate 0000644 00000000732 15036124164 0010650 0 ustar 00 # desktop-file-validate completion -*- shell-script -*- _desktop_file_validate() { local cur prev words cword _init_completion || return case $prev in --help) return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) return fi _filedir desktop } && complete -F _desktop_file_validate desktop-file-validate # ex: filetype=sh pro 0000644 00000003677 15036124164 0005306 0 ustar 00 # bash completion for ubuntu-pro-client . /etc/os-release # For VERSION_ID API_ENDPOINTS=$(/usr/bin/python3 -c 'from uaclient.api.api import VALID_ENDPOINTS; print(" ".join(VALID_ENDPOINTS))') SERVICES="anbox-cloud cc-eal cis esm-apps esm-infra fips fips-updates landscape livepatch realtime-kernel ros ros-updates usg" SUBCMDS="--debug --help --version api attach auto-attach collect-logs config detach disable enable fix help refresh security-status status system version" _ua_complete() { local cur_word prev_word cur_word="${COMP_WORDS[COMP_CWORD]}" prev_word="${COMP_WORDS[COMP_CWORD-1]}" case ${COMP_CWORD} in 1) # shellcheck disable=SC2207 COMPREPLY=($(compgen -W "$SUBCMDS" -- $cur_word)) ;; 2) case ${prev_word} in disable) # shellcheck disable=SC2207 COMPREPLY=($(compgen -W "$SERVICES" -- $cur_word)) ;; enable) # shellcheck disable=SC2207 COMPREPLY=($(compgen -W "$SERVICES" -- $cur_word)) ;; api) # shellcheck disable=SC2207 COMPREPLY=($(compgen -W "$API_ENDPOINTS" -- $cur_word)) ;; esac ;; *) local subcmd subcmd="${COMP_WORDS[1]}" case ${subcmd} in disable) # shellcheck disable=SC2207 COMPREPLY=($(compgen -W "$SERVICES" -- $cur_word)) ;; enable) # shellcheck disable=SC2207 COMPREPLY=($(compgen -W "$SERVICES" -- $cur_word)) ;; *) COMPREPLY=() ;; esac ;; esac } complete -F _ua_complete ua complete -F _ua_complete pro # vi: syntax=sh expandtab ionice 0000644 00000002211 15036124164 0005733 0 ustar 00 _ionice_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-c'|'--class') COMPREPLY=( $(compgen -W "{0..3} none realtime best-effort idle" -- $cur) ) return 0 ;; '-n'|'--classdata') COMPREPLY=( $(compgen -W "{0..7}" -- $cur) ) return 0 ;; '-P'|'--pgid') local PGID PGID="$(awk '{print $5}' /proc/*/stat 2>/dev/null | sort -u)" COMPREPLY=( $(compgen -W "$PGID" -- $cur) ) return 0 ;; '-p'|'--pid') local PIDS PIDS=$(for I in /proc/[0-9]*; do echo ${I##"/proc/"}; done) COMPREPLY=( $(compgen -W "$PIDS" -- $cur) ) return 0 ;; '-u'|'--uid') local UIDS UIDS="$(stat --format='%u' /proc/[0-9]* | sort -u)" COMPREPLY=( $(compgen -W "$UIDS" -- $cur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS="--class --classdata --pid --pgid --ignore --uid --version --help" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 } complete -F _ionice_module ionice colcrt 0000644 00000000744 15036124164 0005764 0 ustar 00 _colcrt_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS=" --no-underlining --half-lines --version --help" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 } complete -F _colcrt_module colcrt printenv 0000644 00000000722 15036124164 0006337 0 ustar 00 # printenv(1) completion -*- shell-script -*- _printenv() { local cur prev words cword _init_completion || return case $prev in --help | --version) return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) return fi COMPREPLY=($(compgen -v -- "$cur")) } && complete -F _printenv printenv # ex: filetype=sh systemd-run 0000644 00000012501 15036124164 0006762 0 ustar 00 # systemd-run(1) completion -*- shell-script -*- # SPDX-License-Identifier: LGPL-2.1-or-later # # This file is part of systemd. # # systemd is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version. # # systemd is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with systemd; If not, see <http://www.gnu.org/licenses/>. __systemctl() { local mode=$1; shift 1 systemctl $mode --full --no-legend --no-pager --plain "$@" } __get_slice_units () { __systemctl $1 list-units --all -t slice \ | { while read -r a b c d; do echo " $a"; done; }; } __get_machines() { local a b machinectl list --full --no-legend --no-pager | { while read a b; do echo " $a"; done; }; } _systemd_run() { local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} local OPTS='--no-ask-password --scope -u --unit -p --property --description --slice --slice-inherit -r --remain-after-exit --send-sighup --service-type --uid --gid --nice --working-directory -d --same-dir -E --setenv -t --pty -P --pipe -S --shell -q --quiet --on-active --on-boot --on-startup --on-unit-active --on-unit-inactive --on-calendar --on-clock-change --on-timezone-change --path-property --socket-property --timer-property --no-block --wait -G --collect --user --system -H --host -M --machine -h --help --version' local mode=--system local i local opts_with_values=( --unit -p --property --slice --description --service-type --uid --gid --nice --working-directory -E --setenv --on-active --on-boot --on-startup --on-unit-active --on-unit-inactive --on-calendar --path-property --socket-property --timer-property -H --host -M --machine ) for (( i=1; i <= COMP_CWORD; i++ )); do if [[ ${COMP_WORDS[i]} != -* ]]; then local root_command=${COMP_WORDS[i]} _command_offset $i return fi [[ ${COMP_WORDS[i]} == "--user" ]] && mode=--user [[ $i -lt $COMP_CWORD && " ${opts_with_values[@]} " =~ " ${COMP_WORDS[i]} " ]] && ((i++)) done case "$prev" in --unit|--description|--on-active|--on-boot|--on-startup|--on-unit-active|--on-unit-inactive|--on-calendar) # argument required but no completions available return ;; --slice) local comps=$(__get_slice_units $mode) COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 ;; --service-type) local comps='simple forking oneshot dbus notify idle' COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 ;; -p|--property) local comps='CPUAccounting= MemoryAccounting= BlockIOAccounting= SendSIGHUP= SendSIGKILL= MemoryLimit= CPUShares= BlockIOWeight= User= Group= DevicePolicy= KillMode= DeviceAllow= BlockIOReadBandwidth= BlockIOWriteBandwidth= BlockIODeviceWeight= Nice= Environment= KillSignal= RestartKillSignal= FinalKillSignal= LimitCPU= LimitFSIZE= LimitDATA= LimitSTACK= LimitCORE= LimitRSS= LimitNOFILE= LimitAS= LimitNPROC= LimitMEMLOCK= LimitLOCKS= LimitSIGPENDING= LimitMSGQUEUE= LimitNICE= LimitRTPRIO= LimitRTTIME= PrivateTmp= PrivateDevices= PrivateNetwork= NoNewPrivileges= WorkingDirectory= RootDirectory= TTYPath= SyslogIdentifier= SyslogLevelPrefix= SyslogLevel= SyslogFacility= TimerSlackNSec= OOMScoreAdjust= ReadWritePaths= ReadOnlyPaths= InaccessiblePaths= EnvironmentFile= ProtectSystem= ProtectHome= RuntimeDirectory= PassEnvironment=' COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 ;; -H|--host) local comps=$(compgen -A hostname) COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 ;; -M|--machine) local comps=$( __get_machines ) COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 ;; --timer-property) local comps='AccuracySec= WakeSystem=' COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 ;; --working-directory) local comps if [[ -z $cur ]]; then comps=$(compgen -A directory -- "/" ) else comps=$(compgen -A directory -- "$cur" ) fi compopt -o filenames COMPREPLY=( $(compgen -W '$comps' -- "$cur" ) ) return 0 ;; esac COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") ) return 0 } complete -F _systemd_run systemd-run systemd-resolve 0000644 00000005247 15036124164 0007646 0 ustar 00 # systemd-resolve(1) completion -*- shell-script -*- # SPDX-License-Identifier: LGPL-2.1-or-later # # This file is part of systemd. # # systemd is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version. # # systemd is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with systemd; If not, see <http://www.gnu.org/licenses/>. __contains_word () { local w word=$1; shift for w in "$@"; do [[ $w = "$word" ]] && return done } __get_interfaces(){ local name for name in $(cd /sys/class/net && ls); do [[ "$name" != "lo" ]] && echo "$name" done } _systemd-resolve() { local i comps local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} local -A OPTS=( [STANDALONE]='-h --help --version --no-pager -4 -6 --service --openpgp --tlsa --status --statistics --reset-statistics --service-address=no --service-txt=no --cname=no --search=no --legend=no --flush-caches --reset-server-features --revert' [ARG]='-i --interface -p --protocol -t --type -c --class --raw --set-dns --set-domain --set-llmnr --set-mdns --set-dnssec --set-nta' ) if __contains_word "$prev" ${OPTS[ARG]}; then case $prev in --interface|-i) comps=$( __get_interfaces ) ;; --protocol|-p|--type|-t|--class|-c) comps=$( systemd-resolve --legend=no "$prev" help; echo help ) ;; --raw) comps="payload packet" ;; --set-dns|--set-domain|--set-nta) comps="" ;; --set-llmnr|--set-mdns) comps="yes no resolve" ;; --set-dnssec) comps="yes no allow-downgrade" ;; --set-dnsovertls) comps="yes no opportunistic" ;; esac COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 fi if [[ "$cur" = -* ]] || [[ -z ${comps-} ]]; then COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") ) return 0 fi } complete -F _systemd-resolve systemd-resolve lpq 0000644 00000001116 15036124164 0005264 0 ustar 00 # lpq(1) completion -*- shell-script -*- _lpq() { local cur prev words cword _init_completion || return case $prev in -P) COMPREPLY=($(compgen -W "$(lpstat -a 2>/dev/null | cut -d' ' -f1)" -- "$cur")) return ;; -U) COMPREPLY=($(compgen -u -- "$cur")) return ;; esac if [[ $cur == - ]]; then COMPREPLY=($(compgen -W '-E -P -U -a -h -l' -- "$cur")) return fi _filedir } && complete -F _lpq lpq # ex: filetype=sh groupdel 0000644 00000001032 15036124164 0006306 0 ustar 00 # groupdel(8) completion -*- shell-script -*- _groupdel() { local cur prev words cword _init_completion || return case $prev in -h | --help) return ;; -R | --root) _filedir -d return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) return fi COMPREPLY=($(compgen -g -- "$cur")) } && complete -F _groupdel groupdel # ex: filetype=sh chronyc 0000644 00000003043 15036124164 0006136 0 ustar 00 # chronyc(1) completion -*- shell-script -*- _chronyc_command_args() { local -a args args=($(compgen -W "$($1 help 2>/dev/null | awk '/^'$prev'\s[^ []/ { gsub("\\|", " ", $2); print $2 }')")) case $args in \<address\>) _known_hosts_real -- "$cur" ;; \<*) ;; *) COMPREPLY+=($(compgen -W '${args[@]}' -- "$cur")) ;; esac } _chronyc() { local cur prev words cword _init_completion || return case $prev in --help | -*p) return ;; -*h) _known_hosts_real -- "$cur" return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_usage "$1") -6' -- "$cur")) return fi local i args args=0 for ((i = 1; i < cword; i++)); do [[ ${words[i]} != -* && ${words[i - 1]} != @(-p|-h) ]] && ((args++)) done case $args in 0) COMPREPLY=($(compgen -W "$($1 help 2>/dev/null | awk '!/(^ |: *$)/ { sub("\\|", " ", $1); print $1 }')" \ -- "$cur")) ;; 1) _chronyc_command_args "$1" if [[ ! ${COMPREPLY-} && $prev == sources?(tats) ]]; then # [-v] not handled by _chronyc_command_args yet COMPREPLY=($(compgen -W '-v' -- "$cur")) fi ;; 2) [[ $prev == @(peer|server) ]] && _known_hosts_real -- "$cur" ;; esac } && complete -F _chronyc chronyc # ex: filetype=sh loginctl 0000644 00000007762 15036124164 0006320 0 ustar 00 # loginctl(1) completion -*- shell-script -*- # SPDX-License-Identifier: LGPL-2.1-or-later # # This file is part of systemd. # # Copyright © 2010 Ran Benita # # systemd is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version. # # systemd is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with systemd; If not, see <http://www.gnu.org/licenses/>. __contains_word () { local w word=$1; shift for w in "$@"; do [[ $w = "$word" ]] && return done } __get_all_sessions () { loginctl --no-legend list-sessions | { while read -r a b; do printf "%s\n" "$a"; done; } ; } __get_all_users () { loginctl --no-legend list-users | { while read -r a b; do printf "%s\n" "$b"; done; } ; } __get_all_seats () { loginctl --no-legend list-seats | { while read -r a b; do printf "%s\n" "$a"; done; } ; } __get_machines() { local a b machinectl list --full --no-legend --no-pager 2>/dev/null | { while read a b; do echo " $a"; done; }; } _loginctl () { local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} local i verb comps local -A OPTS=( [STANDALONE]='--all -a --help -h --no-pager --version --no-legend --no-ask-password -l --full --value' [ARG]='--host -H --kill-who --property -p --signal -s -M --machine -n --lines -o --output -P' ) if __contains_word "$prev" ${OPTS[ARG]}; then case $prev in --signal|-s) _signals return ;; --kill-who) comps='all leader' ;; --host|-H) comps=$(compgen -A hostname) ;; --machine|-M) comps=$( __get_machines ) ;; --property|-p|-P) comps='' ;; --output|-o) comps=$( loginctl --output=help 2>/dev/null ) ;; esac COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 fi if [[ "$cur" = -* ]]; then COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") ) return 0 fi local -A VERBS=( [SESSIONS]='session-status show-session activate lock-session unlock-session terminate-session kill-session' [USERS]='user-status show-user enable-linger disable-linger terminate-user kill-user' [SEATS]='seat-status show-seat terminate-seat' [STANDALONE]='list-sessions lock-sessions unlock-sessions list-users list-seats flush-devices' [ATTACH]='attach' ) for ((i=0; i < COMP_CWORD; i++)); do if __contains_word "${COMP_WORDS[i]}" ${VERBS[*]} && ! __contains_word "${COMP_WORDS[i-1]}" ${OPTS[ARG]}; then verb=${COMP_WORDS[i]} break fi done if [[ -z ${verb-} ]]; then comps="${VERBS[*]}" elif __contains_word "$verb" ${VERBS[SESSIONS]}; then comps=$( __get_all_sessions ) elif __contains_word "$verb" ${VERBS[USERS]}; then comps=$( __get_all_users ) elif __contains_word "$verb" ${VERBS[SEATS]}; then comps=$( __get_all_seats ) elif __contains_word "$verb" ${VERBS[STANDALONE]}; then comps='' elif __contains_word "$verb" ${VERBS[ATTACH]}; then if [[ $prev = $verb ]]; then comps=$( __get_all_seats ) else comps=$(compgen -A file -- "$cur" ) compopt -o filenames fi fi COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 } complete -F _loginctl loginctl eatmydata 0000644 00000000037 15036124164 0006442 0 ustar 00 complete -F _command eatmydata a2x 0000644 00000001634 15036124164 0005167 0 ustar 00 # a2x(1) completion -*- shell-script -*- _a2x() { local cur prev words cword split _init_completion -s || return case $prev in --attribute | --asciidoc-opts | --dblatex-opts | --fop-opts | --help | \ --version | --xsltproc-opts | -!(-*)[ah]) return ;; --destination-dir | --icons-dir | -!(-*)D) _filedir -d return ;; --doctype | -!(-*)d) _xfunc asciidoc _asciidoc_doctype return ;; --stylesheet) _filedir css return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1" --help)' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return fi _filedir } && complete -F _a2x a2x # ex: filetype=sh svk 0000644 00000021174 15036124164 0005301 0 ustar 00 # svk(1) completion -*- shell-script -*- _svk() { local cur prev words cword _init_completion || return local commands options command commands='add admin annotate ann blame praise cat checkout co cleanup cmerge cm commit ci copy cp delete del remove rm depotmap depot describe desc diff di help h ? import info list ls log merge mirror mi mkdir move mv ren rename patch propdel pd pdel propedit pe pedit propget pg pget proplist pl plist propset ps pset pull push resolved revert smerge sm status st stat switch sw sync sy update up verify' if ((cword == 1)); then if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '--version' -- "$cur")) else COMPREPLY=($(compgen -W "$commands" -- "$cur")) fi else case $prev in -F | --file | --targets) _filedir return ;; --encoding) _xfunc iconv _iconv_charsets return ;; esac command=${words[1]} if [[ $cur == -* ]]; then # possible options for the command case $command in add) options=' --non-recursive -N -q --quiet' ;; blame | annotate | ann | praise) options='-r --revisions -x --cross' ;; cat) options='-r --revision' ;; checkout | co) options='-r --revision -q --quiet -N --non-recursive -l --list -d --detach --export --relocate --purge' ;; cleanup) options='-a --all' ;; cmerge | cm) options='-c --change -l --log -r --revision -a --auto --verbatim --no-ticket -m --message -F --file --template --encoding -P --patch -S --sign -C --check-only --direct' ;; commit | ci) options='--import -m --message -F --file --encoding --template -P --patch -S --sign -C --check-only -N --non-recursive --direct' ;; copy | cp) options='-r --revision -p --parent -q --quiet -m --message -F --file --template --encoding -P --patch -S --sign -C --check-only --direct' ;; delete | del | remove | rm) options='-k --keep-local -m --message -F --file --encoding --template -P --patch -S --sign -C --check-only --direct' ;; depotmap | depot) options='-i --init -l --list -d --detach --relocate' ;; diff | di) options='-r --revision -s --summarize -b --verbose -N --non-recursive' ;; import) options='-f --from-checkout -t --to-checkout -m --message -F --file --template --encoding -P --patch -S --sign -C --check-only -N --non-recursive --direct' ;; list | ls) options='-r --revision -v --verbose -R --recursive -d --depth -f --full-path' ;; log) options='-r --revision -l --limit -q --quiet -x --cross -v --verbose' ;; merge) options='-r --revision -c --change -I --incremental -a --auto -l --log -s --sync -t --to -f --from --verbatim --no-ticket --track-rename -m --message -F --file --template --encoding -P --patch -S --sign -C --check-only --direct' ;; mirror | mi) options='-l --list -d --detach --relocate --recover --unlock --upgrade' ;; mkdir) options='-p --parent -m --message -F --file --template --encoding -P --patch -S --sign -C --check-only --direct' ;; move | mv | rename | ren) options='-r --revision -p --parent -q --quiet -m --message -F --file --encoding --template -P --patch -S --sign -C --check-only --direct' ;; patch) options='--depot' ;; propdel | propset | pdel | pset | pd | ps) options='-R --recursive -r --revision --revprop -m --message -F --file --template --encoding -P --patch -S --sign -C --check-only -q --quiet --direct' ;; propedit | pedit | pe) options='-R --recursive -r --revision --revprop -m --message -F --file --template --encoding -P --patch -S --sign -C --check-only --direct' ;; propget | pget | pg) options='-R --recursive -r --revision --revprop --strict' ;; proplist | plist | pl) options='-R --recursive -v --verbose -r --revision --revprop' ;; pull) options='-a --all -l --lump' ;; push) options='-f --from -l --lump -C --check -P --patch -S --sign --verbatim' ;; resolved) options='-R --recursive' ;; revert) options='-R --recursive -q --quiet' ;; smerge | sm) options='-I --incremental -l --log -B --baseless -b --base -s --sync -t --to -f --from --verbatim --no-ticket --track-rename --host --remoterev -m --message -F --file --template --encoding -P --patch -S --sign -C --check-only --direct' ;; status | stat | st) options='-q --quiet --no-ignore -N --non-recursive -v --verbose' ;; switch | sw) options='-r --revision -d --detach -q --quiet' ;; sync | sy) options='-a --all -s --skipto -t --torev' ;; update | up) options='-r --revision -N --non-recursive -C --check-only -s --sync -m --merge -q --quiet' ;; esac options+=" --help -h" COMPREPLY=($(compgen -W "$options" -- "$cur")) else case $command in help | h | \?) COMPREPLY=($(compgen -W "$commands environment commands intro" -- "$cur")) ;; admin) COMPREPLY=($(compgen -W 'help deltify dump hotcopy list-dblogs list-unused-dblogs load lstxns recover rmtxns setlog verify rmcache' -- "$cur")) ;; patch) COMPREPLY=($(compgen -W '--ls --list --cat --view --regen --regenerate --up --update --apply --rm --delete' -- "$cur")) ;; sync) COMPREPLY=($(compgen -W "$($1 mirror --list \ 2>/dev/null | awk '/^\//{print $1}')" -- "$cur")) ;; co | checkout | push | pull) if [[ $cur == //*/* ]]; then path=${cur%/*}/ else path=// fi COMPREPLY=($(compgen -W "$($1 list $path 2>/dev/null | command sed -e 's|\(.*\)|'$path'\1|')" -- "$cur")) ;; *) _filedir ;; esac fi fi } && complete -F _svk svk # ex: filetype=sh devlink 0000644 00000061024 15036124164 0006130 0 ustar 00 # bash completion for devlink(8) -*- shell-script -*- # Get all the optional commands for devlink _devlink_get_optional_commands() { local object=$1; shift local filter_options="" local options="$(devlink $object help 2>&1 \ | command sed -n -e "s/^.*devlink $object //p" \ | cut -d " " -f 1)" # Remove duplicate options from "devlink $OBJECT help" command local opt for opt in $options; do if [[ $filter_options =~ $opt ]]; then continue else filter_options="$filter_options $opt" fi done echo $filter_options } # Complete based on given word, for when an argument or an option name has # but a few possible arguments. _devlink_direct_complete() { local dev port region value case $1 in dev) value=$(devlink dev show 2>/dev/null) ;; param_name) dev=${words[4]} value=$(devlink -j dev param show 2>/dev/null \ | jq ".param[\"$dev\"][].name") ;; port) value=$(devlink -j port show 2>/dev/null \ | jq '.port as $ports | $ports | keys[] as $key | ($ports[$key].netdev // $key)') ;; region) value=$(devlink -j region show 2>/dev/null \ | jq '.regions' | jq 'keys[]') ;; snapshot) region=${words[3]} value=$(devlink -j region show 2>/dev/null \ | jq ".regions[\"$region\"].snapshot[]") ;; trap) dev=${words[3]} value=$(devlink -j trap show 2>/dev/null \ | jq ".trap[\"$dev\"][].name") ;; trap_group) dev=${words[4]} value=$(devlink -j trap group show 2>/dev/null \ | jq ".trap_group[\"$dev\"][].name") ;; trap_policer) dev=${words[4]} value=$(devlink -j trap policer show 2>/dev/null \ | jq ".trap_policer[\"$dev\"][].policer") ;; health_dev) value=$(devlink -j health show 2>/dev/null | jq '.health' \ | jq 'keys[]') ;; reporter) dev=${words[cword - 2]} value=$(devlink -j health show 2>/dev/null \ | jq ".health[\"$dev\"][].reporter") ;; pool) dev=$pprev value=$(devlink -j sb pool show 2>/dev/null \ | jq ".pool[\"$dev\"][].pool") ;; port_pool) port=${words[5]} value=$(devlink -j sb port pool show 2>/dev/null \ | jq ".port_pool[\"$port\"][].pool") ;; tc) port=$pprev value=$(devlink -j sb tc bind show 2>/dev/null \ | jq ".tc_bind[\"$port\"][].tc") ;; esac COMPREPLY+=( $( compgen -W "$value" -- "$cur" ) ) # Remove colon containing prefix from COMPREPLY items in order to avoid # wordbreaks with colon. __ltrim_colon_completions "$cur" } # Completion for devlink dev eswitch set _devlink_dev_eswitch_set() { local -A settings=( [mode]=notseen [inline-mode]=notseen [encap-mode]=notseen ) if [[ $cword -eq 5 ]]; then COMPREPLY=( $( compgen -W "mode inline-mode encap-mode" -- "$cur" ) ) fi # Mark seen settings local word for word in "${words[@]:5:${#words[@]}-1}"; do if [[ -n $word ]]; then if [[ "${settings[$word]}" ]]; then settings[$word]=seen fi fi done case $prev in mode) COMPREPLY=( $( compgen -W "legacy switchdev" -- "$cur" ) ) return ;; inline-mode) COMPREPLY=( $( compgen -W "none link network transport" -- \ "$cur" ) ) return ;; encap-mode) COMPREPLY=( $( compgen -W "none basic" -- "$cur" ) ) return ;; esac local -a comp_words=() # Add settings not seen to completions local setting for setting in "${!settings[@]}"; do if [ "${settings[$setting]}" = notseen ]; then comp_words+=( "$setting" ) fi done COMPREPLY=( $( compgen -W "${comp_words[*]}" -- "$cur" ) ) } # Completion for devlink dev eswitch _devlink_dev_eswitch() { case "$cword" in 3) COMPREPLY=( $( compgen -W "show set" -- "$cur" ) ) return ;; 4) _devlink_direct_complete "dev" return ;; esac case "${words[3]}" in set) _devlink_dev_eswitch_set return ;; show) return ;; esac } # Completion for devlink dev param set _devlink_dev_param_set() { case $cword in 7) COMPREPLY=( $( compgen -W "value" -- "$cur" ) ) return ;; 8) # String argument return ;; 9) COMPREPLY=( $( compgen -W "cmode" -- "$cur" ) ) return ;; 10) COMPREPLY=( $( compgen -W "runtime driverinit permanent" -- \ "$cur" ) ) return ;; esac } # Completion for devlink dev param _devlink_dev_param() { case "$cword" in 3) COMPREPLY=( $( compgen -W "show set" -- "$cur" ) ) return ;; 4) _devlink_direct_complete "dev" return ;; 5) COMPREPLY=( $( compgen -W "name" -- "$cur" ) ) return ;; 6) _devlink_direct_complete "param_name" return ;; esac if [[ "${words[3]}" == "set" ]]; then _devlink_dev_param_set fi } # Completion for devlink dev reload _devlink_dev_reload() { case "$cword" in 4) COMPREPLY=( $( compgen -W "netns" -- "$cur" ) ) return ;; 5) local nslist=$( ip netns list 2>/dev/null ) COMPREPLY=( $( compgen -W "$nslist" -- "$cur" ) ) return ;; esac } # Completion for devlink dev flash _devlink_dev_flash() { case "$cword" in 4) COMPREPLY=( $( compgen -W "file" -- "$cur" ) ) return ;; 5) _filedir return ;; 6) COMPREPLY=( $( compgen -W "component" -- "$cur" ) ) return ;; esac } # Completion for devlink dev _devlink_dev() { case $command in show|reload|info|flash) if [[ $cword -le 3 ]]; then _devlink_direct_complete "dev" elif [[ $command == "reload" || $command == "flash" ]];then _devlink_dev_$command fi return ;; eswitch|param) _devlink_dev_$command return ;; esac } # Completion for devlink port set _devlink_port_set() { case "$cword" in 3) _devlink_direct_complete "port" return ;; 4) COMPREPLY=( $( compgen -W "type" -- "$cur" ) ) return ;; 5) COMPREPLY=( $( compgen -W "eth ib auto" -- "$cur" ) ) return ;; esac } # Completion for devlink port split _devlink_port_split() { case "$cword" in 3) _devlink_direct_complete "port" return ;; 4) COMPREPLY=( $( compgen -W "count" -- "$cur" ) ) return ;; 5) # Integer argument return ;; esac } # Completion for devlink port param set _devlink_port_param_set() { case $cword in 7) COMPREPLY=( $( compgen -W "value" -- "$cur" ) ) return ;; 8) # String argument return ;; 9) COMPREPLY=( $( compgen -W "cmode" -- "$cur" ) ) return ;; 10) COMPREPLY=( $( compgen -W "runtime driverinit permanent" -- \ "$cur" ) ) return ;; esac } # Completion for devlink port param _devlink_port_param() { case "$cword" in 3) COMPREPLY=( $( compgen -W "show set" -- "$cur" ) ) return ;; 4) _devlink_direct_complete "port" return ;; 5) COMPREPLY=( $( compgen -W "name" -- "$cur" ) ) return ;; 6) _devlink_direct_complete "param_name" return ;; esac if [[ "${words[3]}" == "set" ]]; then _devlink_port_param_set fi } # Completion for devlink port _devlink_port() { case $command in set) _devlink_port_set return ;; split) _devlink_port_split return ;; param) _devlink_port_param return ;; show|unsplit) if [[ $cword -eq 3 ]]; then _devlink_direct_complete "port" fi return ;; esac } # Completion for devlink dpipe _devlink_dpipe() { local options="$(devlink dpipe help 2>&1 \ | command sed -e '/OBJECT-LIST := /!d' \ -e 's/.*{ //' -e 's/}.*//' -e 's/|//g' )" if [[ $cword -eq 2 ]]; then COMPREPLY+=( $( compgen -W "$options" -- "$cur" ) ) fi } # Completion for devlink monitor _devlink_monitor() { local options="$(devlink monitor help 2>&1 \ | command sed -e '/OBJECT-LIST := /!d' \ -e 's/.*{ //' -e 's/}.*//' -e 's/|//g' )" if [[ $cword -eq 2 ]]; then COMPREPLY+=( $( compgen -W "all $options" -- "$cur" ) ) fi } # Completion for the rest of devlink sb $command _devlink_sb_command_options() { local subcmd case $command in pool) subcmd=${words[3]} if [[ $cword -eq 5 ]]; then COMPREPLY=( $( compgen -W "pool" -- "$cur" ) ) fi if [[ $subcmd == "set" ]]; then case $cword in 7) COMPREPLY+=( $( compgen -W "size" -- "$cur" ) ) ;; 9) COMPREPLY+=( $( compgen -W "thtype" -- "$cur" ) ) ;; esac fi ;; port) subcmd=${words[4]} if [[ $cword -eq 6 ]]; then COMPREPLY+=( $( compgen -W "pool" -- "$cur" ) ) fi if [[ $subcmd == "set" ]]; then case $cword in 8) COMPREPLY+=( $( compgen -W "th" -- "$cur" ) ) ;; esac fi ;; tc) subcmd=${words[4]} case $cword in 6) COMPREPLY+=( $( compgen -W "tc" -- "$cur" ) ) ;; 8) COMPREPLY+=( $( compgen -W "type" -- "$cur" ) ) ;; esac if [[ $subcmd == "set" ]]; then case $cword in 10) COMPREPLY+=( $( compgen -W "pool" -- "$cur" ) ) ;; 12) COMPREPLY+=( $( compgen -W "th" -- "$cur" ) ) ;; esac fi ;; esac } # Completion for devlink sb _devlink_sb() { case $prev in bind) COMPREPLY=( $( compgen -W "set show" -- "$cur" ) ) ;; occupancy) COMPREPLY=( $( compgen -W "show snapshot clearmax" -- "$cur" ) ) ;; pool) if [[ $cword -eq 3 || $cword -eq 4 ]]; then COMPREPLY=( $( compgen -W "set show" -- "$cur" ) ) elif [[ $command == "port" || $command == "tc" ]]; then _devlink_direct_complete "port_pool" else _devlink_direct_complete "pool" fi ;; port) if [[ $cword -eq 3 ]]; then COMPREPLY=( $( compgen -W "pool" -- "$cur" ) ) fi ;; show|set|snapshot|clearmax) case $command in show|pool|occupancy) _devlink_direct_complete "dev" if [[ $command == "occupancy" && $prev == "show" ]];then _devlink_direct_complete "port" fi ;; port|tc) _devlink_direct_complete "port" ;; esac ;; size) # Integer argument ;; thtype) COMPREPLY=( $( compgen -W "static dynamic" -- "$cur" ) ) ;; th) # Integer argument ;; tc) if [[ $cword -eq 3 ]]; then COMPREPLY=( $( compgen -W "bind" -- "$cur" ) ) else _devlink_direct_complete "tc" fi ;; type) COMPREPLY=( $( compgen -W "ingress egress" -- "$cur" ) ) ;; esac _devlink_sb_command_options return } # Completion for devlink resource set path argument _devlink_resource_path() { local path parents parent all_path local dev=${words[3]} local -a path local all_path=$( devlink resource show $dev \ | sed -E '# Of resource lines, keep only the name itself. s/name ([^ ]*) .*/\1/ # Drop headers. /:$/d # First layer is not aligned enough, align it. s/^/ / # Use slashes as unary code for resource depth. s, ,/,g # Separate tally count from resource name. s,/*,&\t,' \ | while read d name; do while ((${#path[@]} > ${#d})); do unset path[$((${#path[@]} - 1))] done path[$((${#d} - 1))]=$name echo ${path[@]} done \ | sed '# Convert paths to slash-separated s,^,/,;s, ,/,g;s,$,/,' ) COMPREPLY=( ${COMPREPLY[@]:-} $( compgen -W "$all_path" -- "$cur" ) ) } # Completion for devlink resource set _devlink_resource_set() { case "$cword" in 3) _devlink_direct_complete "dev" return ;; 4) COMPREPLY=( $( compgen -W "path" -- "$cur" ) ) return ;; 5) _devlink_resource_path return ;; 6) COMPREPLY=( $( compgen -W "size" -- "$cur" ) ) return ;; 7) # Integer argument return ;; esac } # Completion for devlink resource _devlink_resource() { case $command in show) if [[ $cword -eq 3 ]]; then _devlink_direct_complete "dev" fi return ;; set) _devlink_resource_set return ;; esac } # Completion for devlink region read _devlink_region_read() { case "$cword" in 6) COMPREPLY=( $( compgen -W "address" -- "$cur" ) ) return ;; 7) # Address argument, for example: 0x10 return ;; 8) COMPREPLY=( $( compgen -W "length" -- "$cur" ) ) return ;; 9) # Integer argument return ;; esac } # Completion for devlink region _devlink_region() { if [[ $cword -eq 3 && $command != "help" ]]; then _devlink_direct_complete "region" fi case $command in show) return ;; del|dump|read) case "$cword" in 4) COMPREPLY=( $( compgen -W "snapshot" -- "$cur" ) ) ;; 5) _devlink_direct_complete "snapshot" ;; esac if [[ $command == "read" ]]; then _devlink_region_read fi return ;; esac } # Completion reporter for devlink health _devlink_health_reporter() { local i=$1; shift case $cword in $((3 + $i))) _devlink_direct_complete "health_dev" ;; $((4 + $i))) COMPREPLY=( $( compgen -W "reporter" -- "$cur" ) ) ;; $((5 + $i))) _devlink_direct_complete "reporter" ;; esac } # Completion for devlink health _devlink_health() { case $command in show|recover|diagnose|set|test) _devlink_health_reporter 0 if [[ $command == "set" ]]; then case $cword in 6) COMPREPLY=( $( compgen -W "grace_period auto_recover" \ -- "$cur" ) ) ;; 7) case $prev in grace_period) # Integer argument- msec ;; auto_recover) COMPREPLY=( $( compgen -W "true false" -- \ "$cur" ) ) ;; esac esac fi return ;; dump) if [[ $cword -eq 3 ]]; then COMPREPLY=( $( compgen -W "show clear" -- "$cur" ) ) fi _devlink_health_reporter 1 return ;; esac } # Completion for action in devlink trap set _devlink_trap_set_action() { local i=$1; shift case $cword in $((6 + $i))) COMPREPLY=( $( compgen -W "action" -- "$cur" ) ) ;; $((7 + $i))) COMPREPLY=( $( compgen -W "trap drop mirror" -- "$cur" ) ) ;; esac } # Completion for devlink trap group set _devlink_trap_group_set() { local -A settings=( [action]=notseen [policer]=notseen [nopolicer]=notseen ) if [[ $cword -eq 7 ]]; then COMPREPLY=( $( compgen -W "action policer nopolicer" -- "$cur" ) ) fi # Mark seen settings local word for word in "${words[@]:7:${#words[@]}-1}"; do if [[ -n $word ]]; then if [[ "${settings[$word]}" ]]; then settings[$word]=seen fi fi done case $prev in action) COMPREPLY=( $( compgen -W "trap drop mirror" -- "$cur" ) ) return ;; policer) _devlink_direct_complete "trap_policer" return ;; esac local -a comp_words=() # Add settings not seen to completions local setting for setting in "${!settings[@]}"; do if [ "${settings[$setting]}" = notseen ]; then comp_words+=( "$setting" ) fi done COMPREPLY=( $( compgen -W "${comp_words[*]}" -- "$cur" ) ) } # Completion for devlink trap group _devlink_trap_group() { case $cword in 3) COMPREPLY=( $( compgen -W "set show" -- "$cur" ) ) return ;; 4) _devlink_direct_complete "dev" return ;; 5) COMPREPLY=( $( compgen -W "group" -- "$cur" ) ) return ;; 6) _devlink_direct_complete "trap_group" return ;; esac if [[ ${words[3]} == "set" ]]; then _devlink_trap_group_set fi } # Completion for devlink trap policer set _devlink_trap_policer_set() { local -A settings=( [rate]=notseen [burst]=notseen ) if [[ $cword -eq 7 ]]; then COMPREPLY=( $( compgen -W "rate burst" -- "$cur" ) ) fi # Mark seen settings local word for word in "${words[@]:7:${#words[@]}-1}"; do if [[ -n $word ]]; then if [[ "${settings[$word]}" ]]; then settings[$word]=seen fi fi done case $prev in rate) # Integer argument return ;; burst) # Integer argument return ;; esac local -a comp_words=() # Add settings not seen to completions local setting for setting in "${!settings[@]}"; do if [ "${settings[$setting]}" = notseen ]; then comp_words+=( "$setting" ) fi done COMPREPLY=( $( compgen -W "${comp_words[*]}" -- "$cur" ) ) } # Completion for devlink trap policer _devlink_trap_policer() { case $cword in 3) COMPREPLY=( $( compgen -W "set show" -- "$cur" ) ) return ;; 4) _devlink_direct_complete "dev" return ;; 5) COMPREPLY=( $( compgen -W "policer" -- "$cur" ) ) return ;; 6) _devlink_direct_complete "trap_policer" return ;; esac if [[ ${words[3]} == "set" ]]; then _devlink_trap_policer_set fi } # Completion for devlink trap _devlink_trap() { case $command in show|set) case $cword in 3) _devlink_direct_complete "dev" ;; 4) COMPREPLY=( $( compgen -W "trap" -- "$cur" ) ) ;; 5) _devlink_direct_complete "trap" ;; esac if [[ $command == "set" ]]; then _devlink_trap_set_action 0 fi return ;; group) _devlink_trap_$command return ;; policer) _devlink_trap_$command return ;; esac } # Complete any devlink command _devlink() { local cur prev words cword local opt='--Version --no-nice-names --json --pretty --verbose \ --statistics --force --Netns --batch' local objects="$(devlink help 2>&1 | command sed -e '/OBJECT := /!d' \ -e 's/.*{//' -e 's/}.*//' -e \ 's/|//g' )" _init_completion || return # Gets the word-to-complete without considering the colon as word breaks _get_comp_words_by_ref -n : cur prev words cword if [[ $cword -eq 1 ]]; then case $cur in -*) COMPREPLY=( $( compgen -W "$opt" -- "$cur" ) ) return 0 ;; *) COMPREPLY=( $( compgen -W "$objects" -- "$cur" ) ) return 0 ;; esac fi # Deal with options if [[ $prev == -* ]]; then case $prev in -V|--Version) return 0 ;; -b|--batch) _filedir return 0 ;; --force) COMPREPLY=( $( compgen -W "--batch" -- "$cur" ) ) return 0 ;; -N|--Netns) local nslist=$( ip netns list 2>/dev/null ) COMPREPLY=( $( compgen -W "$nslist" -- "$cur" ) ) return 0 ;; -j|--json) COMPREPLY=( $( compgen -W "--pretty $objects" -- "$cur" ) ) return 0 ;; *) COMPREPLY=( $( compgen -W "$objects" -- "$cur" ) ) return 0 ;; esac fi # Remove all options so completions don't have to deal with them. local i for (( i=1; i < ${#words[@]}; )); do if [[ ${words[i]::1} == - ]]; then words=( "${words[@]:0:i}" "${words[@]:i+1}" ) [[ $i -le $cword ]] && cword=$(( cword - 1 )) else i=$(( ++i )) fi done local object=${words[1]} local command=${words[2]} local pprev=${words[cword - 2]} if [[ $objects =~ $object ]]; then if [[ $cword -eq 2 ]]; then COMPREPLY=( $( compgen -W "help" -- "$cur") ) if [[ $object != "monitor" && $object != "dpipe" ]]; then COMPREPLY+=( $( compgen -W \ "$(_devlink_get_optional_commands $object)" -- "$cur" ) ) fi fi "_devlink_$object" fi } && complete -F _devlink devlink # ex: ts=4 sw=4 et filetype=sh resolvconf 0000644 00000000654 15036124164 0006656 0 ustar 00 # bash completion for resolvconf -*- shell-script -*- _resolvconf() { local cur prev words cword _init_completion || return case $prev in -a | -d) _available_interfaces return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '-a -d -u' -- "$cur")) fi } && complete -F _resolvconf resolvconf # ex: filetype=sh hddtemp 0000644 00000001572 15036124164 0006123 0 ustar 00 # hddtemp(8) completion -*- shell-script -*- _hddtemp() { local cur prev words cword split _init_completion -s || return case $prev in --file | -!(-*)f) _filedir db return ;; --listen | -!(-*)l) _ip_addresses return ;; --unit | -!(-*)u) COMPREPLY=($(compgen -W 'C F' -- "$cur")) return ;; --port | --separator | --syslog | --version | --help | -!(-*)[psSvh?]) return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1") --help' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace else cur=${cur:=/dev/} _filedir fi } && complete -F _hddtemp hddtemp # ex: filetype=sh apt-cache 0000644 00000004211 15036124164 0006314 0 ustar 00 # Debian apt-cache(8) completion -*- shell-script -*- # List APT binary packages _apt_cache_packages() { apt-cache --no-generate pkgnames "$cur" 2>/dev/null || : } # List APT source packages _apt_cache_sources() { compgen -W "$(apt-cache dumpavail | awk '$1 == "Source:" { print $2 }' | sort -u)" -- "$1" } # List APT source packages _apt_cache_src_packages() { compgen -W '$(_apt_cache_sources "$cur")' -- "$cur" } _apt_cache() { local cur prev words cword _init_completion || return local special ispecial if [[ $cur != show ]]; then for ((ispecial = 1; ispecial < ${#words[@]} - 1; ispecial++)); do if [[ ${words[ispecial]} == @(add|depends|dotty|madison|policy|rdepends|show?(pkg|src|)) ]]; then special=${words[ispecial]} break fi done fi if [[ -v special && $ispecial -lt $cword ]]; then case $special in add) _filedir ;; showsrc) COMPREPLY=($(_apt_cache_sources "$cur")) ;; *) COMPREPLY=($(_apt_cache_packages)) ;; esac return fi case $prev in --config-file | --pkg-cache | --src-cache | -!(-*)[cps]) _filedir return ;; search) if [[ $cur != -* ]]; then return fi ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '-h -v -p -s -q -i -f -a -g -c -o --help --version --pkg-cache --src-cache --quiet --important --full --all-versions --no-all-versions --generate --no-generate --names-only --all-names --recurse --config-file --option --installed' -- "$cur")) elif [[ ! -v special ]]; then COMPREPLY=($(compgen -W 'add gencaches show showpkg showsrc stats dump dumpavail unmet search search depends rdepends pkgnames dotty xvcg policy madison' -- "$cur")) fi } && complete -F _apt_cache apt-cache # ex: filetype=sh lintian 0000644 00000012373 15036124164 0006135 0 ustar 00 # bash completion for lintian(1) and lintian-info(1) -*- shell-script -*- _lintian_tags() { local match search tags tags=$(awk '/^Tag/ { print $2 }' /usr/share/lintian/checks/*.desc) if [[ $cur == *, ]]; then search=${cur//,/ } for item in $search; do match=$(command grep -nE "^Tag: $item$" \ /usr/share/lintian/checks/*.desc | cut -d: -f1) tags=$(command sed -e "s/\<$item\>//g" <<<$tags) done COMPREPLY+=($(compgen -W "$tags")) elif [[ $cur == *,* ]]; then COMPREPLY+=($(compgen -P "${cur%,*}," -W "$tags" -- "${cur##*,}")) else COMPREPLY+=($(compgen -W "$tags" -- "$cur")) fi } _lintian_checks() { local match search todisable checks checks=$(awk '/^(Check-Script|Abbrev)/ { print $2 }' \ /usr/share/lintian/checks/*.desc) if [[ $cur == *, ]]; then search=${cur//,/ } for item in $search; do match=$(command grep -nE "^(Check-Script|Abbrev): $item$" \ /usr/share/lintian/checks/*.desc | cut -d: -f1) todisable=$(awk '/^(Check-Script|Abbrev)/ { print $2 }' $match) for name in $todisable; do checks=$(command sed -e "s/\<$name\>//g" <<<$checks) done done COMPREPLY+=($(compgen -W "$checks")) elif [[ $cur == *,* ]]; then COMPREPLY+=($(compgen -P "${cur%,*}," -W "$checks" -- "${cur##*,}")) else COMPREPLY+=($(compgen -W "$checks" -- "$cur")) fi } _lintian_infos() { local match search infos infos=$(awk '/^Collector/ { print $2 }' \ /usr/share/lintian/collection/*.desc) if [[ $cur == *, ]]; then search=${cur//,/ } for item in $search; do match=$(command grep -nE "^Collector: $item$" \ /usr/share/lintian/collection/*.desc | cut -d: -f1) infos=$(command sed -e "s/\<$item\>//g" <<<$infos) done COMPREPLY+=($(compgen -W "$infos")) elif [[ $cur == *,* ]]; then COMPREPLY+=($(compgen -P "${cur%,*}," -W "$infos" -- "${cur##*,}")) else COMPREPLY+=($(compgen -W "$infos" -- "$cur")) fi } _lintian() { local cur prev words cword _init_completion || return local lint_actions general_opts behaviour_opts configuration_opts lint_actions="--setup-lab --remove-lab --check --check-part --tags --tags-from-file --ftp-master-rejects --dont-check-part --unpack --remove" general_opts="--help --version --print-version --verbose --debug --quiet" behaviour_opts="--info --display-info --display-experimental --pedantic --display-level --suppress-tags --suppress-tags-from-file --no-override --show-overrides --color --unpack-info --md5sums --checksums --allow-root --fail-on-warnings --keep-lab" configuration_opts="--cfg --lab --archivedir --dist --area --section --arch --root" if [[ $prev == -* ]]; then case $prev in -C | --check-part | -X | --dont-check-part) _lintian_checks ;; -T | --tags | --suppress-tags) _lintian_tags ;; --tags-from-file | --suppress-tags-from-file | --cfg | -p | \ --packages-file) _filedir ;; --lab | --archivedir | --dist | --root) _filedir -d ;; --color) COMPREPLY=($(compgen -W "never always auto html" -- "$cur")) ;; -U | --unpack-info) _lintian_infos ;; --area | --section) COMPREPLY=($(compgen -W "main contrib non-free" -- "$cur")) ;; --arch) ;; esac fi case "$cur" in --*) COMPREPLY=($(compgen -W "$lint_actions $general_opts $behaviour_opts $configuration_opts" -- "$cur")) ;; *,) # If we're here, the user is trying to complete on # --action tag,tag,<TAB> # Only few actions permit that, re-complete them now. case "$prev" in -C | --check-part | -X | --dont-check-part) _lintian_checks ;; -T | --tags | --suppress-tags) _lintian_tags ;; -U | --unpack-info) _lintian_infos ;; esac ;; *) # in Ubuntu, dbgsym packages end in .ddeb, lintian >= 2.57.0 groks _filedir '@(?(u|d)deb|changes|dsc|buildinfo)' ;; esac return 0 } && complete -F _lintian lintian _lintian_info() { local cur prev words cword _init_completion || return case "$prev" in --help | --profile) return ;; -t | --tags) _lintian_tags return ;; --include-dir) _filedir -d return ;; esac case "$cur" in --*) COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) ;; *) _filedir ;; esac return 0 } && complete -F _lintian_info lintian-info # ex: filetype=sh _runuser 0000644 00000000361 15036124164 0006333 0 ustar 00 # runuser(1) completion -*- shell-script -*- # Use of this file is deprecated on Linux. Upstream completion is # available in util-linux >= 2.23, use that instead. complete -u runuser # ex: filetype=sh mount 0000644 00000004064 15036124164 0005637 0 ustar 00 _mount_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-t'|'--types') local prefix realcur TYPES TYPES=" $(\ls /lib/modules/$(uname -r)/kernel/fs | awk '{print $1, "no" $1}') $(awk '{print $NF, "no" $NF}' /proc/filesystems) " realcur="${cur##*,}" prefix="${cur%$realcur}" for WORD in $TYPES; do if ! [[ $prefix == *"$WORD"* ]]; then TYPE_COLS="$WORD ${TYPE_COLS:-""}" fi done compopt -o nospace COMPREPLY=( $(compgen -P "$prefix" -W "$TYPE_COLS" -S ',' -- $realcur) ) return 0 ;; '-L'|'--label') local LABELS LABELS="$(lsblk -o LABEL -nr)" COMPREPLY=( $(compgen -W "$LABELS" -- $cur) ) return 0 ;; '-U'|'--uuid') local UUIDS UUIDS="$(lsblk -o UUID -nr)" COMPREPLY=( $(compgen -W "$UUIDS" -- $cur) ) return 0 ;; '-N'|'--namespace') local NAMESPACE NAMESPACE="$(lsns --type mnt --output PATH --noheadings)" COMPREPLY=( $(compgen -W "$NAMESPACE" -- $cur) ) return 0 ;; '--options-mode') COMPREPLY=( $(compgen -W "ignore append prepend replace" -- $cur) ) return 0 ;; '--options-source') COMPREPLY=( $(compgen -W "fstab mtab disable" -- $cur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS=" --all --no-canonicalize --fake --fork --fstab --help --internal-only --show-labels --no-mtab --options --options-mode --options-source --options-source-force --test-opts --read-only --types --source --target --verbose --version --read-write --namespace --label --uuid --bind --move --rbind --make-shared --make-slave --make-private --make-unbindable --make-rshared --make-rslave --make-rprivate --make-runbindable" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 } complete -F _mount_module mount cfagent 0000644 00000000645 15036124164 0006105 0 ustar 00 # cfagent completion -*- shell-script -*- _cfagent() { local cur prev words cword _init_completion || return case $prev in -f | --file) _filedir return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) fi } && complete -F _cfagent cfagent # ex: filetype=sh bind 0000644 00000001472 15036124164 0005411 0 ustar 00 # bash bind completion -*- shell-script -*- _bind() { local cur prev words cword _init_completion || return case $prev in -*[lpPsSvVrxX]) return ;; -*m) COMPREPLY=($(compgen -W "emacs emacs-standard emacs-meta emacs-ctlx vi vi-move vi-command vi-insert" -- "$cur")) return ;; -*f) _filedir return ;; -*[qu]) COMPREPLY=($(compgen -W '$("$1" -l)' -- "$cur")) return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_usage "$1")' -- "$cur")) return fi COMPREPLY=($(compgen -A binding -- "$cur")) } && complete -F _bind bind # ex: filetype=sh gnome-mplayer 0000644 00000001667 15036124164 0007257 0 ustar 00 # gnome-mplayer(1) completion -*- shell-script -*- _gnome_mplayer() { local cur prev words cword split _init_completion -s || return case $prev in -'?' | --help | --help-all | --help-gtk) return ;; --showcontrols | --showsubtitles | --autostart) COMPREPLY=($(compgen -w '0 1' -- "$cur")) return ;; --subtitle) _filedir '@(srt|sub|txt|utf|rar|mpsub|smi|js|ssa|ass)' return ;; --tvdriver) COMPREPLY=($(compgen -W 'v4l v4l2' -- "$cur")) return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1" --help-all)' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return fi _filedir } && complete -F _gnome_mplayer gnome-mplayer # ex: filetype=sh gsettings 0000644 00000005415 15036124164 0006505 0 ustar 00 # Check for bash [ -z "$BASH_VERSION" ] && return #################################################################################################### __gsettings() { local choices coffset schemadir if [ ${COMP_CWORD} -gt 2 ]; then if [ ${COMP_WORDS[1]} = --schemadir ]; then # this complexity is needed to perform correct tilde expansion schemadir=$(eval "echo --schemadir ${COMP_WORDS[2]}") coffset=2 else coffset=0 fi else coffset=0 fi case "$((${COMP_CWORD}-$coffset))" in 1) choices=$'--schemadir\n--version\nhelp \nlist-schemas\nlist-relocatable-schemas\nlist-keys \nlist-children \nlist-recursively \nget \nrange \nset \nreset \nreset-recursively \nwritable \nmonitor \ndescribe ' ;; 2) case "${COMP_WORDS[$(($coffset+1))]}" in --schemadir) COMPREPLY=($(compgen -o dirnames -- ${COMP_WORDS[${COMP_CWORD}]})) return 0 ;; help) choices=$'list-schemas\nlist-relocatable-schemas\nlist-keys\nlist-children\nlist-recursively\nget\nrange\nset\nreset\nreset-recursively\nwritable\nmonitor' ;; list-keys|list-children|list-recursively|reset-recursively) choices="$(gsettings $schemadir list-schemas 2> /dev/null)"$'\n'"$(gsettings $schemadir list-relocatable-schemas 2> /dev/null | sed -e 's.$.:/.')" ;; list-schemas) COMPREPLY=($(compgen -W "--print-paths" -- ${COMP_WORDS[${COMP_CWORD}]})) return 0 ;; get|range|set|reset|writable|monitor|describe) choices="$(gsettings $schemadir list-schemas 2> /dev/null | sed -e 's.$. .')"$'\n'"$(gsettings $schemadir list-relocatable-schemas 2> /dev/null | sed -e 's.$.:/.')" ;; esac ;; 3) case "${COMP_WORDS[$(($coffset+1))]}" in set) choices="$(gsettings $schemadir list-keys ${COMP_WORDS[$(($coffset+2))]} 2> /dev/null | sed -e 's.$. .')" ;; get|range|reset|writable|monitor|describe) choices="$(gsettings $schemadir list-keys ${COMP_WORDS[$(($coffset+2))]} 2> /dev/null)" ;; esac ;; 4) case "${COMP_WORDS[$(($coffset+2))]}" in set) range=($(gsettings $schemadir range ${COMP_WORDS[$(($coffset+2))]} ${COMP_WORDS[$(($coffset+3))]} 2> /dev/null)) case "${range[0]}" in enum) unset range[0] ;; *) unset range ;; esac local IFS=$'\n' choices="${range[*]}" ;; esac ;; esac local IFS=$'\n' COMPREPLY=($(compgen -W "${choices}" -- "${COMP_WORDS[${COMP_CWORD}]}")) } #################################################################################################### complete -o nospace -F __gsettings gsettings mussh 0000644 00000002243 15036124164 0005631 0 ustar 00 # mussh(1) completion -*- shell-script -*- _mussh() { local cur prev words cword _init_completion || return case $prev in --help | -V | -m | -t) return ;; -d) COMPREPLY=($(compgen -W '{0..2}' -- "$cur")) return ;; -v) COMPREPLY=($(compgen -W '{0..3}' -- "$cur")) return ;; -i | -H | -C) _filedir return ;; -o | -po) _xfunc ssh _ssh_options return ;; -l | -L) COMPREPLY=($(compgen -u -- "$cur")) return ;; -s) _shells return ;; -p | -h) [[ $cur == *@* ]] && _user_at_host || _known_hosts_real -a -- "$cur" return ;; -c) compopt -o filenames COMPREPLY+=($(compgen -c -- "$cur")) return ;; esac [[ $cur != -* ]] || COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) } && complete -F _mussh mussh # ex: filetype=sh pack200 0000644 00000004323 15036124164 0005633 0 ustar 00 # pack200(1) completion -*- shell-script -*- _pack200() { local cur prev words cword split _init_completion -s || return case $prev in -S | --segment-limit | -P | --pass-file | -C | --class-attribute | \ -F | --field-attribute | -M | --method-attribute | -D | --code-attribute | \ '-?' | -h | --help | -V | --version | -J) return ;; -E | --effort) COMPREPLY=($(compgen -W '{0..9}' -- "$cur")) return ;; -H | --deflate-hint) COMPREPLY=($(compgen -W 'true false keep' -- "$cur")) return ;; -m | --modification-time) COMPREPLY=($(compgen -W 'latest keep' -- "$cur")) return ;; -U | --unknown-attribute) COMPREPLY=($(compgen -W 'error strip pass' -- "$cur")) return ;; -f | --config-file) _filedir properties return ;; -l | --log-file) COMPREPLY=($(compgen -W '-' -- "$cur")) _filedir log return ;; -r | --repack) _filedir jar return ;; esac $split && return # Check if a pack or a jar was already given. local i pack=false jar=false for ((i = 1; i < ${#words[@]} - 1; i++)); do case ${words[i]} in *.pack | *.pack.gz) pack=true ;; *.jar) jar=true ;; esac done if ! $pack; then if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '--no-gzip --gzip --strip-debug --no-keep-file-order --segment-limit= --effort= --deflate-hint= --modification-time= --pass-file= --unknown-attribute= --class-attribute= --field-attribute= --method-attribute= --code-attribute= --config-file= --verbose --quiet --log-file= --help --version -J --repack' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace else _filedir 'pack?(.gz)' fi elif ! $jar; then _filedir jar fi } && complete -F _pack200 pack200 # ex: filetype=sh partx 0000644 00000002425 15036124164 0005632 0 ustar 00 _partx_module() { local cur prev OPTS OUTPUT_ALL COMPREPLY=() OUTPUT_ALL="NR START END SECTORS SIZE NAME UUID TYPE FLAGS SCHEME" cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-n'|'--nr') return 0 ;; '-o'|'--output') local realcur prefix OUTPUT realcur="${cur##*,}" prefix="${cur%$realcur}" for WORD in $OUTPUT_ALL; do if ! [[ $prefix == *"$WORD"* ]]; then OUTPUT="$WORD ${OUTPUT:-""}" fi done compopt -o nospace COMPREPLY=( $(compgen -P "$prefix" -W "$OUTPUT" -S ',' -- $realcur) ) return 0 ;; '-S'|'--sector-size') COMPREPLY=( $(compgen -W "size" -- $cur) ) return 0 ;; '-t'|'--type') COMPREPLY=( $(compgen -W "$(partx --list-types)" -- $cur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS=" --add --delete --update --show --bytes --noheadings --nr --output --output-all --pairs --raw --sector-size --type --list-types --verbose --help --version " COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac compopt -o bashdefault -o default COMPREPLY=( $(compgen -W "$(lsblk -pnro name)" -- $cur) ) return 0 } complete -F _partx_module partx screen 0000644 00000006456 15036124164 0005763 0 ustar 00 # bash completion for screen -*- shell-script -*- _screen_sessions() { local sessions=($(command screen -ls | command sed -ne \ 's|^\t\{1,\}\([0-9]\{1,\}\.[^\t]\{1,\}\).*'"$1"'.*$|\1|p')) if [[ $cur == +([0-9])?(.*) ]]; then # Complete sessions including pid prefixes COMPREPLY=($(compgen -W '${sessions[@]}' -- "$cur")) else # Create unique completions, dropping pids where possible local -A res local i tmp for i in "${sessions[@]}"; do res[${i/#+([0-9])./}]+=" $i" done for i in "${!res[@]}"; do [[ ${res[i]} == \ *\ * ]] && tmp+=" ${res[i]}" || tmp+=" $i" done COMPREPLY=($(compgen -W '$tmp' -- "$cur")) fi } && _screen() { local cur prev words cword _init_completion || return if ((cword == 1)); then if [[ $cur == /dev* ]]; then COMPREPLY=($(compgen -W "$( shopt -s nullglob printf '%s\n' \ /dev/serial/by-id/* /dev/ttyUSB* /dev/ttyACM* 2>/dev/null )" \ -- "$cur")) return fi if [[ $cur == //* ]]; then COMPREPLY=($(compgen -W '//telnet' -- "$cur")) return fi fi case ${words[1]} in /dev*) if ((cword == 2)); then COMPREPLY=($(compgen -W '110 300 600 1200 2400 4800 9600 \ 14400 19200 38400 57600 115200 128000 256000' -- "$cur")) # TODO more, comma separated options fi return ;; //telnet) ((cword == 2)) && _known_hosts_real -- "$cur" return ;; esac if ((cword > 2)); then case ${words[cword - 2]} in -*[dD]) _screen_sessions return ;; esac fi local i for ((i = 1; i <= cword; i++)); do case ${words[i]} in -*[rRdDxscTehpSt]) ((i++)) continue ;; -*) continue ;; esac _command_offset $i return done case $prev in -*[rR]) # list detached _screen_sessions 'Detached' return ;; -*[dD]) # list attached _screen_sessions 'Attached' return ;; -*x) # list both _screen_sessions return ;; -*s) _shells return ;; -*c) _filedir return ;; -T) _terms return ;; -*[ehpSt]) return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) fi } && complete -F _screen screen # ex: filetype=sh bootctl 0000644 00000006173 15036124164 0006146 0 ustar 00 # bootctl(1) completion -*- shell-script -*- # SPDX-License-Identifier: LGPL-2.1-or-later # # This file is part of systemd. # # systemd is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version. # # systemd is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with systemd; If not, see <http://www.gnu.org/licenses/>. __contains_word () { local w word=$1; shift for w in "$@"; do [[ $w = "$word" ]] && return done } __get_entry_ids() { bootctl --no-pager list 2>/dev/null | { while read -r a b; do [[ $a == 'id:' ]] && echo " $b"; done } } _bootctl() { local i verb comps local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} local -A OPTS=( [STANDALONE]='-h --help -p --print-esp-path -x --print-boot-path --version --no-variables --no-pager --graceful' [ARG]='--esp-path --boot-path' ) if __contains_word "$prev" ${OPTS[ARG]}; then case $prev in --esp-path|--boot-path) if [[ -z $cur ]]; then comps=$(compgen -A directory -- "/" ) else comps=$(compgen -A directory -- "$cur" ) fi compopt -o filenames ;; esac COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 fi if [[ "$cur" = -* ]]; then COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") ) return 0 fi local -A VERBS=( # systemd-efi-options takes an argument, but it is free-form, so we cannot complete it [STANDALONE]='help status install update remove is-installed random-seed systemd-efi-options list' [BOOTENTRY]='set-default set-oneshot' [BOOLEAN]='reboot-to-firmware' ) for ((i=0; i < COMP_CWORD; i++)); do if __contains_word "${COMP_WORDS[i]}" ${VERBS[*]}; then verb=${COMP_WORDS[i]} break fi done if [[ -z ${verb-} ]]; then comps=${VERBS[*]} elif __contains_word "$verb" ${VERBS[STANDALONE]}; then comps='' elif __contains_word "$verb" ${VERBS[BOOTENTRY]}; then name= for ((i++; i < COMP_CWORD; i++)); do if ! __contains_word "${COMP_WORDS[i]}" ${OPTS[*]} ${VERBS[*]} && ! __contains_word "${COMP_WORDS[i-1]}" ${OPTS[ARG]}; then name=${COMP_WORDS[i]} break; fi done if [[ -z $name ]]; then comps=$( __get_entry_ids ) else comps='' fi elif __contains_word "$verb" ${VERBS[BOOLEAN]}; then comps="yes no" fi COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 } complete -F _bootctl bootctl arch 0000644 00000002303 15036124164 0005404 0 ustar 00 # mailman arch completion -*- shell-script -*- # Try to detect whether this is the mailman "arch" to avoid installing # it for the coreutils/util-linux-ng one. _have mailmanctl && _arch() { local cur prev words cword split _init_completion -s || return case $prev in -w | -g | -d | --welcome-msg | --goodbye-msg | --digest) COMPREPLY=($(compgen -W 'y n' -- "$cur")) return ;; --file) _filedir return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) else local args=$cword for ((i = 1; i < cword; i++)); do if [[ ${words[i]} == -* ]]; then ((args--)) fi done case $args in 1) _xfunc list_lists _mailman_lists ;; 2) _filedir ;; esac fi } && complete -F _arch arch # ex: filetype=sh perlcritic 0000644 00000002514 15036124164 0006633 0 ustar 00 # perlcritic(1) completion -*- shell-script -*- _perlcritic() { local cur prev words cword _init_completion || return case $prev in --help | --version | --top | --include | --exclude | --single-policy | \ --colo?(u)r-severity-* | --program-extensions | -[?HVs]) return ;; --severity) COMPREPLY=($(compgen -W "{1..5} brutal cruel harsh stern gentle" \ -- "$cur")) return ;; --profile | -p) _filedir perlcriticrc return ;; --theme) COMPREPLY=($(compgen -W '$("$1" --list-themes 2>/dev/null)' \ -- "$cur")) return ;; --profile-strictness) COMPREPLY=($(compgen -W 'warn fatal quiet' -- "$cur")) return ;; --verbose) COMPREPLY=($(compgen -W '{1..11}' -- "$cur")) return ;; --pager) compopt -o filenames COMPREPLY=($(compgen -c -- "$cur")) return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_usage "$1")' -- "$cur")) return fi _filedir 'p[lm]' } && complete -F _perlcritic perlcritic # ex: filetype=sh ipcmk 0000644 00000001100 15036124164 0005564 0 ustar 00 _ipcmk_module() { local cur prev COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-M'|'--shmem') COMPREPLY=( $(compgen -W "size" -- $cur) ) return 0 ;; '-S'|'--semaphore') COMPREPLY=( $(compgen -W "number" -- $cur) ) return 0 ;; '-p'|'--mode') COMPREPLY=( $(compgen -W "mode" -- $cur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac COMPREPLY=( $(compgen -W "--shmem --semaphore --queue --mode --help --version" -- $cur) ) return 0 } complete -F _ipcmk_module ipcmk resolvectl 0000644 00000013345 15036124164 0006661 0 ustar 00 # resolvectl(1) completion -*- shell-script -*- # SPDX-License-Identifier: LGPL-2.1-or-later # # This file is part of systemd. # # systemd is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version. # # systemd is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with systemd; If not, see <http://www.gnu.org/licenses/>. __contains_word () { local w word=$1; shift for w in "$@"; do [[ $w = "$word" ]] && return done } __get_interfaces(){ local name for name in $(cd /sys/class/net && ls); do [[ "$name" != "lo" ]] && echo "$name" done } _resolvectl() { local i comps verb name local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} local -A OPTS=( [STANDALONE]='-h --help --version --no-pager -4 -6 --service-address=no --service-txt=no --cname=no --search=no --legend=no' [ARG]='-i --interface -p --protocol -t --type -c --class --raw' ) local -A VERBS=( [DOMAIN]='query service openpgp' [FAMILY]='tlsa' [STATUS]='status' [LINK]='revert dns domain nta' [RESOLVE]='llmnr mdns' [DNSSEC]='dnssec' [DNSOVERTLS]='dnsovertls' [STANDALONE]='statistics reset-statistics flush-caches reset-server-features' [LOG_LEVEL]='log-level' ) local -A ARGS=( [FAMILY]='tcp udp sctp' [RESOLVE]='yes no resolve' [DNSSEC]='yes no allow-downgrade' [DNSOVERTLS]='yes no opportunistic' ) local interfaces=$( __get_interfaces ) if __contains_word "$prev" ${OPTS[ARG]}; then case $prev in --interface|-i) comps="$interfaces" ;; --protocol|-p|--type|-t|--class|-c) comps=$( resolvectl --legend=no "$prev" help; echo help ) ;; --raw) comps="payload packet" ;; esac COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 fi if [[ "$cur" = -* ]]; then COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") ) return 0 fi for ((i=0; i < COMP_CWORD; i++)); do if __contains_word "${COMP_WORDS[i]}" ${VERBS[*]} && ! __contains_word "${COMP_WORDS[i-1]}" ${OPTS[ARG]}; then verb=${COMP_WORDS[i]} break fi done if [[ -z ${verb-} ]]; then comps="${VERBS[*]}" elif __contains_word "$verb" ${VERBS[STANDALONE]} ${VERBS[DOMAIN]}; then comps='' elif __contains_word "$verb" ${VERBS[STATUS]}; then comps="$interfaces" elif __contains_word "$verb" ${VERBS[LOG_LEVEL]}; then comps='debug info notice warning err crit alert emerg' elif __contains_word "$verb" ${VERBS[FAMILY]}; then for ((i++; i < COMP_CWORD; i++)); do if __contains_word "${COMP_WORDS[i]}" ${ARGS[FAMILY]} && ! __contains_word "${COMP_WORDS[i-1]}" ${OPTS[ARG]}; then name=${COMP_WORDS[i]} break; fi done if [[ -z $name ]]; then comps=${ARGS[FAMILY]} else comps="" fi elif __contains_word "$verb" ${VERBS[LINK]} ${VERBS[RESOLVE]} ${VERBS[DNSSEC]} ${VERBS[DNSOVERTLS]}; then for ((i++; i < COMP_CWORD; i++)); do if __contains_word "${COMP_WORDS[i]}" $interfaces && ! __contains_word "${COMP_WORDS[i-1]}" ${OPTS[ARG]}; then name=${COMP_WORDS[i]} break; fi done if [[ -z $name ]]; then comps="$interfaces" elif __contains_word "$verb" ${VERBS[RESOLVE]}; then name= for ((i++; i < COMP_CWORD; i++)); do if __contains_word "${COMP_WORDS[i]}" ${ARGS[RESOLVE]} && ! __contains_word "${COMP_WORDS[i-1]}" ${OPTS[ARG]}; then name=${COMP_WORDS[i]} break; fi done if [[ -z $name ]]; then comps=${ARGS[RESOLVE]} else comps='' fi elif __contains_word "$verb" ${VERBS[DNSSEC]}; then name= for ((i++; i < COMP_CWORD; i++)); do if __contains_word "${COMP_WORDS[i]}" ${ARGS[DNSSEC]} && ! __contains_word "${COMP_WORDS[i-1]}" ${OPTS[ARG]}; then name=${COMP_WORDS[i]} break; fi done if [[ -z $name ]]; then comps=${ARGS[DNSSEC]} else comps='' fi elif __contains_word "$verb" ${VERBS[DNSOVERTLS]}; then name= for ((i++; i < COMP_CWORD; i++)); do if __contains_word "${COMP_WORDS[i]}" ${ARGS[DNSOVERTLS]} && ! __contains_word "${COMP_WORDS[i-1]}" ${OPTS[ARG]}; then name=${COMP_WORDS[i]} break; fi done if [[ -z $name ]]; then comps=${ARGS[DNSOVERTLS]} else comps='' fi else comps='' fi fi COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 } complete -F _resolvectl resolvectl vpnc 0000644 00000004422 15036124164 0005441 0 ustar 00 # bash completion for vpnc -*- shell-script -*- _vpnc() { local cur prev words cword _init_completion || return case $prev in --help | --long-help | --version | --id | --username | --domain | --ifname | \ --application-version | --local-addr | --local-port | --udp-port | --dpd-idle | \ --target-network | --ifmtu) return ;; --gateway) _known_hosts_real -- "$cur" return ;; --vendor) COMPREPLY=($(compgen -W 'cisco netscreen' -- "$cur")) return ;; --natt-mode) COMPREPLY=($(compgen -W 'natt none force-natt cisco-udp' \ -- "$cur")) return ;; --script | --pid-file | --ca-file) _filedir return ;; --dh) COMPREPLY=($(compgen -W 'dh1 dh2 dh5' -- "$cur")) return ;; --pfs) COMPREPLY=($(compgen -W 'nopfs dh1 dh2 dh5 server' -- "$cur")) return ;; --ifmode) COMPREPLY=($(compgen -W 'tun tap' -- "$cur")) return ;; --debug) COMPREPLY=($(compgen -W '0 1 2 3 99' -- "$cur")) return ;; --auth-mode) COMPREPLY=($(compgen -W 'psk cert hybrid' -- "$cur")) return ;; --ca-dir) _filedir -d return ;; --password-helper) compopt -o filenames COMPREPLY=($(compgen -c -- "$cur")) return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1" --long-help)' -- "$cur")) elif [[ $cur == */* ]]; then # explicit filename _filedir conf else # config name, /etc/vpnc/<name>.conf local IFS=$' \t\n' reset=$(shopt -p nullglob) shopt -s nullglob local -a configs=(/etc/vpnc/*.conf) configs=("${configs[@]##*/}") configs=("${configs[@]%.conf}") $reset IFS=$'\n' compopt -o filenames COMPREPLY=($(compgen -W '${configs[@]}' -- "$cur")) fi } && complete -F _vpnc vpnc # ex: filetype=sh whiptail 0000644 00000000531 15036124164 0006311 0 ustar 00 complete -W "--msgbox --yesno --infobox --inputbox --passwordbox --textbox --menu --checklist \ --radiochecklist --gauge --clear --defaultno --default-item \ --fb --nocancel --yes-button --no-button --ok-button \ --cancel-button -noitem --separate-output --output-fd \ --title --backtitle -scrolltext --toplefti \ --help" -f whiptail mkswap 0000644 00000001554 15036124164 0006000 0 ustar 00 _mkswap_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-p'|'--pagesize') COMPREPLY=( $(compgen -W "bytes" -- $cur) ) return 0 ;; '-L'|'--label') COMPREPLY=( $(compgen -W "label" -- $cur) ) return 0 ;; '-v'|'--swapversion') COMPREPLY=( $(compgen -W "1" -- $cur) ) return 0 ;; '-U'|'--uuid') COMPREPLY=( $(compgen -W "$(uuidgen -r)" -- $cur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS="--check --force --pagesize --lock --label --swapversion --uuid --verbose --version --help" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac compopt -o bashdefault -o default COMPREPLY=( $(compgen -W "$(lsblk -pnro name)" -- $cur) ) return 0 } complete -F _mkswap_module mkswap gcl 0000644 00000001147 15036124164 0005241 0 ustar 00 # -*- shell-script -*- # bash programmable completion for various Common Lisp implementations by # Nikodemus Siivola <nikodemus@random-state.net> _gcl() { local cur prev words cword _init_completion || return # completing an option (may or may not be separated by a space) if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '-eval -load -f -batch -dir -libdir -compile -o-file -c-file -h-file -data-file -system-p' -- "$cur")) else _filedir fi } && complete -F _gcl -o default gcl # ex: filetype=sh isosize 0000644 00000001021 15036124164 0006150 0 ustar 00 _isosize_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-d'|'--divisor') COMPREPLY=( $(compgen -W "number" -- $cur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) COMPREPLY=( $(compgen -W "--divisor --sectors --help --version" -- $cur) ) return 0 ;; esac local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 } complete -F _isosize_module isosize systemd-id128 0000644 00000004143 15036124164 0007010 0 ustar 00 # networkctl(1) completion -*- shell-script -*- # SPDX-License-Identifier: LGPL-2.1-or-later # # This file is part of systemd. # # systemd is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version. # # systemd is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with systemd; If not, see <http://www.gnu.org/licenses/>. __contains_word () { local w word=$1; shift for w in "$@"; do [[ $w = "$word" ]] && return done return 1 } _systemd_id128() { local i verb comps local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} words cword local -A OPTS=( [STANDALONE]='-h --help --version -p --pretty' [ARG]='-a --app-specific' ) local -A VERBS=( [STANDALONE]='new machine-id boot-id invocation-id help' ) _init_completion || return if __contains_word "$prev" ${OPTS[ARG]}; then case $prev in --app-specific|-a) comps="" ;; esac COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 fi if [[ "$cur" = -* ]]; then COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") ) return 0 fi for ((i=0; i < COMP_CWORD; i++)); do if __contains_word "${COMP_WORDS[i]}" ${VERBS[*]} && ! __contains_word "${COMP_WORDS[i-1]}" ${OPTS[ARG]}; then verb=${COMP_WORDS[i]} break fi done if [[ -z ${verb-} ]]; then comps=${VERBS[*]} elif __contains_word "$verb" ${VERBS[STANDALONE]}; then comps='' fi COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 } complete -F _systemd_id128 systemd-id128 interdiff 0000644 00000001406 15036124164 0006444 0 ustar 00 # interdiff(1) completion -*- shell-script -*- _interdiff() { local cur prev words cword split _init_completion -s || return case $prev in --unified | --strip-match | --drop-context | -!(-*)[Upd]) return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return fi local exts='@(?(d)patch|dif?(f))' word for word in "${words[@]}"; do if [[ $word == -@(z|-decompress) ]]; then exts+='?(.@(gz|bz2))' break fi done _filedir "$exts" } && complete -F _interdiff interdiff # ex: filetype=sh ss 0000644 00000002156 15036124164 0005122 0 ustar 00 # ss(8) completion -*- shell-script -*- _ss() { local cur prev words cword split _init_completion -s || return case $prev in --help | --version | -!(-*)[hV]) return ;; --family | -!(-*)f) COMPREPLY=($(compgen -W 'unix inet inet6 link netlink' \ -- "$cur")) return ;; --query | -!(-*)A) local prefix= [[ $cur == *,* ]] && prefix="${cur%,*}," COMPREPLY=($(compgen -W '$("$1" --help | \ command sed -e "s/|/ /g" -ne "s/.*QUERY := {\([^}]*\)}.*/\1/p")' \ -- "${cur##*,}")) ((${#COMPREPLY[@]} == 1)) && COMPREPLY=(${COMPREPLY/#/$prefix}) return ;; --diag | --filter | -!(-*)[DF]) _filedir return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace fi } && complete -F _ss ss # ex: filetype=sh javaws 0000644 00000001433 15036124164 0005765 0 ustar 00 # javaws(1) completion -*- shell-script -*- _javaws() { local cur prev words cword _init_completion -n = || return case $prev in -help | -license | -about | -viewer | -arg | -param | -property | -update | -umask) return ;; -basedir | -codebase) _filedir -d return ;; -uninstall | -import) _filedir jnlp return ;; esac if [[ $cur == *= ]]; then return elif [[ $cur == -* ]]; then COMPREPLY=($(compgen -W "$(_parse_help "$1" -help) " -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return fi _filedir jnlp } && complete -F _javaws javaws # ex: filetype=sh k3b 0000644 00000002242 15036124164 0005150 0 ustar 00 # bash completion for k3b -*- shell-script -*- _k3b() { local cur prev words cword _init_completion || return case $prev in --help* | --author | -v | --version | --license | --lang) return ;; --datacd | --audiocd | --videocd | --mixedcd | --emovixcd | --videodvd) _filedir return ;; --copydvd | --formatdvd | --videodvdrip) _dvd_devices return ;; --copycd | --erasecd | --cddarip | --videocdrip) _cd_devices _dvd_devices return ;; --cdimage | --image) _filedir '@(cue|iso|toc)' return ;; --dvdimage) _filedir iso return ;; --ao) COMPREPLY=($(compgen -W 'alsa arts' -- "$cur")) return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W "$(_parse_help "$1")" -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace else _filedir fi } && complete -F _k3b k3b # ex: filetype=sh _adb 0000644 00000003366 15036124164 0005366 0 ustar 00 # adb completion -*- shell-script -*- # Use of this file is deprecated. Upstream completion is available in # the Android SDK, use that instead. _adb_command_usage() { COMPREPLY=($(compgen -W \ '$("$1" help 2>&1 | command grep "^ *\(adb \)\? *$2 " \ | command sed -e "s/[]|[]/\n/g" | _parse_help -)' -- "$cur")) } _adb() { local cur prev words cword _init_completion || return case $prev in -s | -p | --algo | --key | --iv) return ;; -f) _filedir return ;; esac local cmd i for ((i = 1; i < cword; i++)); do if [[ ${words[i]} != -* && ${words[i - 1]} != -[sp] ]]; then cmd="${words[i]}" break fi done if [[ ! -v cmd ]]; then local tmp=() if [[ ! $cur || $cur == -* ]]; then tmp+=($(compgen -W '$(_parse_help "$1" help)' -- "$cur")) fi if [[ ! $cur || $cur != -* ]]; then tmp+=($($1 help 2>&1 | awk '$1 == "adb" { print $2 }')) tmp+=(devices connect disconnect sideload) fi COMPREPLY=($(compgen -W '${tmp[@]}' -- "$cur")) return fi # TODO: more and better command completions _adb_command_usage "$1" $cmd case $cmd in push | restore | sideload) _filedir ;; forward) COMPREPLY=($(compgen -W \ '$("$1" help 2>&1 | command sed -ne "s/^ *adb *forward *-/-/p" | \ _parse_help -)' -- "$cur")) ;; reboot) COMPREPLY=($(compgen -W 'bootloader recovery' -- "$cur")) ;; esac } && complete -F _adb adb # ex: filetype=sh scrub 0000644 00000001565 15036124164 0005616 0 ustar 00 # scrub(1) completion -*- shell-script -*- _scrub() { local cur prev words cword split _init_completion -s || return case $prev in --version | --help | --blocksize | --device-size | --dirent | -!(-*)[vhbsD]) return ;; --pattern | -!(-*)p) COMPREPLY=($(compgen -W '$("$1" --help 2>&1 | awk "/^Available/{flag=1;next}/^ /&&flag{print \$1}")' \ -- "$cur")) return ;; --freespace | -!(-*)X) _filedir -d return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return fi _filedir } && complete -F _scrub scrub # ex: filetype=sh lsipc 0000644 00000002436 15036124164 0005610 0 ustar 00 _lsipc_module() { local cur prev OPTS ARG COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-i'|'--id') COMPREPLY=( $(compgen -W "id" -- $cur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; '--time-format') COMPREPLY=( $(compgen -W "short full iso" -- $cur) ) return 0 ;; '-o'|'--output') local prefix realcur OUTPUT_ALL OUTPUT realcur="${cur##*,}" prefix="${cur%$realcur}" OUTPUT_ALL=" KEY ID OWNER PERMS CUID CUSER CGID CGROUP UID USER GID GROUP CTIME SIZE NATTCH STATUS ATTACH DETACH COMMAND CPID LPID USEDBYTES MSGS SEND RECV LSPID LRPID NSEMS OTIME RESOURCE DESCRIPTION LIMIT USED USE% " for WORD in $OUTPUT_ALL; do if ! [[ $prefix == *"$WORD"* ]]; then OUTPUT="$WORD ${OUTPUT:-""}" fi done compopt -o nospace COMPREPLY=( $(compgen -P "$prefix" -W "$OUTPUT" -S ',' -- $realcur) ) return 0 ;; esac OPTS=" --shmems --queues --semaphores --global --id --noheadings --notruncate --time-format --bytes --creator --export --json --newline --list --output --numeric-perms --raw --time --help --version " COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 } complete -F _lsipc_module lsipc swapoff 0000644 00000001347 15036124164 0006143 0 ustar 00 _swapoff_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-a'|'--all') return 0 ;; '-U'|'UUID=') COMPREPLY=( $(compgen -W "$(swapon --show=UUID --noheading)" -- $cur) ) return 0 ;; '-L'|'LABEL=') COMPREPLY=( $(compgen -W "$(swapon --show=LABEL --noheading)" -- $cur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS="-L -U --all --verbose --help --version" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac COMPREPLY=( $(compgen -W "$(swapon --show=NAME --raw --noheading)" -- $cur) ) return 0 } complete -F _swapoff_module swapoff luserdel 0000644 00000000735 15036124164 0006315 0 ustar 00 # luserdel(1) completion -*- shell-script -*- _luserdel() { local cur prev words cword _init_completion || return case $prev in --help | --usage | -!(-*)[?]*) return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) return fi COMPREPLY=($(compgen -u -- "$cur")) } && complete -F _luserdel luserdel # ex: filetype=sh setterm 0000644 00000005037 15036124164 0006161 0 ustar 00 _setterm_module() { local bright cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '--term') local TERM_LIST I TERM_LIST='' for I in /usr/share/terminfo/?/*; do TERM_LIST+="${I##*/} " done COMPREPLY=( $(compgen -W "$TERM_LIST" -- $cur) ) return 0 ;; '--foreground'|'--background') COMPREPLY=( $(compgen -W "black blue cyan default green magenta red white yellow" -- $cur) ) return 0 ;; '--ulcolor'|'--hbcolor'|'bright') if [ $prev != 'bright' ]; then bright='bright black grey' else bright='' fi COMPREPLY=( $(compgen -W "$bright blue cyan green magenta red white yellow" -- $cur) ) return 0 ;; '--cursor'|'--repeat'|'--appcursorkeys'|'--linewrap'|'--inversescreen'|'--bold'|'--half-bright'|'--blink'|'--reverse'|'--underline'|'--msg') COMPREPLY=( $(compgen -W "off on" -- $cur) ) return 0 ;; '--clear') COMPREPLY=( $(compgen -W "all rest" -- $cur) ) return 0 ;; '--tabs'|'--clrtabs') COMPREPLY=( $(compgen -W "tab1 tab2 tab3 tab160" -- $cur) ) return 0 ;; '--regtabs') COMPREPLY=( $(compgen -W "{1..160}" -- $cur) ) return 0 ;; '--blank') COMPREPLY=( $(compgen -W "{0..60} force poke" -- $cur) ) return 0 ;; '--dump'|'--append') local NUM_CONS NUM_CONS=(/dev/vcsa?*) COMPREPLY=( $(compgen -W "{1..${#NUM_CONS[*]}}" -- $cur) ) return 0 ;; '--file') local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 ;; '--msglevel') COMPREPLY=( $(compgen -W "{0..8}" -- $cur) ) return 0 ;; '--powersave') COMPREPLY=( $(compgen -W "on vsync hsync powerdown off" -- $cur) ) return 0 ;; '--powerdown') COMPREPLY=( $(compgen -W "{0..60}" -- $cur) ) return 0 ;; '--blength') COMPREPLY=( $(compgen -W "0-2000" -- $cur) ) return 0 ;; '--bfreq') COMPREPLY=( $(compgen -W "freqnumber" -- $cur) ) return 0 ;; '--help'|'--version') return 0 ;; esac OPTS=" --term --reset --resize --initialize --cursor --repeat --appcursorkeys --linewrap --default --foreground --background --ulcolor --hbcolor --ulcolor --hbcolor --inversescreen --bold --half-bright --blink --reverse --underline --store --clear --tabs --clrtabs --regtabs --blank --dump --append --file --msg --msglevel --powersave --powerdown --blength --bfreq --version --help" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 } complete -F _setterm_module setterm uuidd 0000644 00000001536 15036124164 0005610 0 ustar 00 _uuidd_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-p'|'--pid'|'-s'|'--socket') local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 ;; '-T'|'--timeout') local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -W "timeout" -- $cur) ) return 0 ;; '-n'|'--uuids') local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -W "number" -- $cur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS="--pid --socket --timeout --kill --random --time --uuids --no-pid --no-fork --socket-activation --debug --quiet --version --help" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac return 0 } complete -F _uuidd_module uuidd cancel 0000644 00000001053 15036124164 0005715 0 ustar 00 # cancel(1) completion -*- shell-script -*- _cancel() { local cur prev words cword _init_completion || return case $prev in -h) _known_hosts_real -- "$cur" return ;; -U) return ;; -u) COMPREPLY=($(compgen -u -- "$cur")) return ;; esac COMPREPLY=($(compgen -W \ "$(lpstat 2>/dev/null | cut -d' ' -f1)" -- "$cur")) } && complete -F _cancel cancel # ex: filetype=sh brctl 0000644 00000002024 15036124164 0005575 0 ustar 00 # bash completion for brctl -*- shell-script -*- _brctl() { local cur prev words cword _init_completion || return local command=${words[1]} case $cword in 1) COMPREPLY=($(compgen -W "addbr delbr addif delif setageing setbridgeprio setfd sethello setmaxage setpathcost setportprio show showmacs showstp stp" -- "$cur")) ;; 2) case $command in show) ;; *) COMPREPLY=($(compgen -W "$($1 show | awk 'NR>1 {print $1}')" -- "$cur")) ;; esac ;; 3) case $command in addif | delif) _configured_interfaces ;; stp) COMPREPLY=($(compgen -W 'on off' -- "$cur")) ;; esac ;; esac } && complete -F _brctl -o default brctl # ex: filetype=sh uclampset 0000644 00000001231 15036124164 0006463 0 ustar 00 _uclampset_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS=" --all-tasks --help --pid --system --reset-on-fork --verbose --version " COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac local i for i in ${COMP_WORDS[*]}; do case $i in '-p'|'--pid') COMPREPLY=( $(compgen -W "$(cd /proc && echo [0-9]*)" -- $cur) ) return 0 ;; esac done COMPREPLY=( $(compgen -c -- $cur) ) return 0 } complete -F _uclampset_module uclampset mkfs 0000644 00000001223 15036124164 0005427 0 ustar 00 _mkfs_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-t'|'--type') FSTYPES=$(for I in /sbin/mkfs.* /usr/sbin/mkfs.*; do if [ -e $I ]; then echo ${I##*mkfs.}; fi; done) COMPREPLY=( $(compgen -W "$FSTYPES" -- $cur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS='--type --verbose --help --version' COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac compopt -o bashdefault -o default COMPREPLY=( $(compgen -W "$(lsblk -pnro name)" -- $cur) ) return 0 } complete -F _mkfs_module mkfs ccze 0000644 00000002303 15036124164 0005413 0 ustar 00 # ccze(1) completion -*- shell-script -*- _ccze() { local cur prev words cword split _init_completion -s || return case $prev in -'?' | --help | --usage | -V | --version) return ;; --argument | --color | -!(-*)[ac]) # TODO? return ;; --rcfile | -!(-*)F) _filedir return ;; --mode | -!(-*)m) COMPREPLY=($(compgen -W "curses ansi html" -- "$cur")) return ;; --option | -!(-*)o) local -a opts=(scroll wordcolor lookups transparent cssfile) COMPREPLY=($(compgen -W '${opts[@]} ${opts[@]/#/no}' -- "$cur")) return ;; --plugin | -!(-*)p) COMPREPLY=($(compgen -W '$("$1" --list-plugins | command \ sed -ne "s/^\([a-z0-9]\{1,\}\)[[:space:]]\{1,\}|.*/\1/p")' \ -- "$cur")) return ;; esac $split && return COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace } && complete -F _ccze ccze # ex: filetype=sh nproc 0000644 00000000763 15036124164 0005620 0 ustar 00 # nproc(1) completion -*- shell-script -*- _nproc() { local cur prev words cword split _init_completion -s || return case $prev in --help | --version | --ignore) return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace fi } && complete -F _nproc nproc # ex: filetype=sh kernel-install 0000644 00000003227 15036124164 0007421 0 ustar 00 # kernel-install(8) completion -*- shell-script -*- # SPDX-License-Identifier: LGPL-2.1-or-later # # This file is part of systemd. # # systemd is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version. # # systemd is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with systemd; If not, see <http://www.gnu.org/licenses/>. _kernel_install() { local comps local MACHINE_ID local cur=${COMP_WORDS[COMP_CWORD]} case $COMP_CWORD in 1) comps="add remove" ;; 2) comps=$(cd /lib/modules; echo [0-9]*) if [[ ${COMP_WORDS[1]} == "remove" ]] && [[ -f /etc/machine-id ]]; then read MACHINE_ID < /etc/machine-id if [[ $MACHINE_ID ]] && ( [[ -d /boot/$MACHINE_ID ]] || [[ -L /boot/$MACHINE_ID ]] ); then comps=$(cd "/boot/$MACHINE_ID"; echo [0-9]*) fi fi ;; 3) [[ "$cur" ]] || cur=/lib/modules/${COMP_WORDS[2]}/vmlinuz comps=$(compgen -f -- "$cur") compopt -o filenames ;; esac COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 } complete -F _kernel_install kernel-install lscpu 0000644 00000002052 15036124164 0005616 0 ustar 00 _lscpu_module() { local cur OPTS_ALL COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '--extended='|'=') local prefix realcur OPTS cur=${cur#=} realcur="${cur##*,}" prefix="${cur%$realcur}" OPTS_ALL="CPU CORE SOCKET NODE BOOK DRAWER CACHE POLARIZATION ADDRESS CONFIGURED ONLINE MAXMHZ MINMHZ" for WORD in $OPTS_ALL; do if ! [[ $prefix == *"$WORD"* ]]; then OPTS="$WORD ${OPTS:-""}" fi done compopt -o nospace COMPREPLY=( $(compgen -P "$prefix" -W "$OPTS" -S ',' -- $realcur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS_ALL="--all --online --bytes --caches --offline --json --extended= --parse= --sysroot --hex --physical --output-all --help --version" COMPREPLY=( $(compgen -W "${OPTS_ALL[*]}" -- $cur) ) return 0 ;; esac local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 } complete -F _lscpu_module lscpu systemd-detect-virt 0000644 00000002460 15036124164 0010413 0 ustar 00 # systemd-detect-virt(1) completion -*- shell-script -*- # SPDX-License-Identifier: LGPL-2.1-or-later # # This file is part of systemd. # # systemd is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version. # # systemd is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with systemd; If not, see <http://www.gnu.org/licenses/>. __contains_word() { local w word=$1; shift for w in "$@"; do [[ $w = "$word" ]] && return done } _systemd_detect_virt() { local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} words cword local i verb comps local -A OPTS=( [STANDALONE]='-h --help --version -c --container -v --vm -q --quiet --private-users' ) _init_completion || return COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") ) } complete -F _systemd_detect_virt systemd-detect-virt growisofs 0000644 00000001577 15036124164 0006525 0 ustar 00 # growisofs(1) completion -*- shell-script -*- _growisofs() { local cur prev words cword _init_completion || return case $prev in -version | -speed) return ;; -Z | -M) compopt -o nospace _dvd_devices return ;; /?(r)dev/*) if [[ $cur == =* ]]; then # e.g. /dev/dvd=foo.iso, /dev/dvdrw=/dev/zero cur="${cur#=}" _filedir return fi ;; esac if [[ $cur == -* ]]; then # TODO: mkisofs options COMPREPLY=($(compgen -W '-dvd-compat -overburn -speed= -Z -M' \ -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return fi _filedir } && complete -F _growisofs growisofs # ex: filetype=sh strace 0000644 00000006351 15036124164 0005757 0 ustar 00 # bash completion for strace -*- shell-script -*- _strace() { local cur prev words cword _init_completion -n = || return # check if we're still completing strace local offset=0 i for ((i = 1; i <= cword; i++)); do case ${words[i]} in -o | -e | -p) ((i++)) continue ;; -*) continue ;; esac offset=$i break done if ((offset > 0)); then _command_offset $offset else case $prev in -*e) if [[ $cur == *=* ]]; then prev=${cur/=*/} cur=${cur/*=/} case $prev in trace) # Import arch-specific syscalls #+ -- not foolproof IMHO --David Paleino local define syscall rest local -A syscalls while read -r define syscall rest; do [[ $define == "#define" && \ $syscall =~ ^__NR_(.+) ]] && syscalls[${BASH_REMATCH[1]}]=1 done 2>/dev/null </usr/include/asm/unistd.h if [[ ! $syscalls ]]; then local unistd arch=$(command uname -m) if [[ $arch == *86 ]]; then unistd=/usr/include/asm/unistd_32.h else unistd=/usr/include/asm/unistd_64.h fi while read -r define syscall rest; do [[ $define == "#define" && \ $syscall =~ ^__NR_(.+) ]] && syscalls[${BASH_REMATCH[1]}]=1 done 2>/dev/null <$unistd fi COMPREPLY=($(compgen -W '${!syscalls[@]} file process network signal ipc desc all none' \ -- "$cur")) return ;; esac else compopt -o nospace COMPREPLY=($(compgen -S"=" -W 'trace abbrev verbose raw signal read write' -- "$cur")) fi return ;; -*o) _filedir return ;; -*p) _pids return ;; -*S) COMPREPLY=($(compgen -W 'time calls name nothing' -- "$cur")) return ;; -*u) _allowed_users return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1" -h)' -- "$cur")) else COMPREPLY=($(compgen -c -- "$cur")) fi fi } && complete -F _strace -o default strace # ex: filetype=sh htpasswd 0000644 00000001632 15036124164 0006330 0 ustar 00 # htpasswd(1) completion -*- shell-script -*- _htpasswd() { local cur prev words cword _init_completion || return local i o=0 # $o is index of first non-option argument for ((i = 1; i <= cword; i++)); do case ${words[i]} in -*n*) return ;; -*) ;; *) o=$i break ;; esac done if ((o == 0 || o == cword)); then if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) return fi # Password file (first non-option argument) _filedir elif ((o == cword - 1)); then # Username (second non-option argument) COMPREPLY=($(compgen -W \ '$(cut -d: -f1 "${words[o]}" 2>/dev/null)' -- "$cur")) fi } && complete -F _htpasswd htpasswd # ex: filetype=sh lisp 0000644 00000001201 15036124164 0005432 0 ustar 00 # -*- shell-script -*- # bash programmable completion for various Common Lisp implementations by # Nikodemus Siivola <nikodemus@random-state.net> _lisp() { local cur prev words cword _init_completion || return # completing an option (may or may not be separated by a space) if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '-core -lib -batch -quit -edit -eval -init -dynamic-space-size -hinit -noinit -nositeinit -load -slave' \ -- "$cur")) else _filedir fi } && complete -F _lisp -o default lisp # ex: filetype=sh unpack200 0000644 00000002335 15036124164 0006177 0 ustar 00 # unpack200(1) completion -*- shell-script -*- _unpack200() { local cur prev words cword split _init_completion -s || return case $prev in --help | --version | -!(-*)[?hVJ]) return ;; --deflate-hint | -!(-*)H) COMPREPLY=($(compgen -W 'true false keep' -- "$cur")) return ;; --log-file | -!(-*)l) COMPREPLY=($(compgen -W '-' -- "$cur")) _filedir log return ;; esac $split && return # Check if a pack or a jar was already given. local word pack=false jar=false for word in "${words[@]:1}"; do case $word in *.pack | *.pack.gz) pack=true ;; *.jar) jar=true ;; esac done if ! $pack; then if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '--deflate-hint= --remove-pack-file --verbose --quiet --log-file= --help --version' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace else _filedir 'pack?(.gz)' fi elif ! $jar; then _filedir jar fi } && complete -F _unpack200 unpack200 # ex: filetype=sh pv 0000644 00000001363 15036124164 0005121 0 ustar 00 # pv(1) completion -*- shell-script -*- _pv() { local cur prev words cword _init_completion || return case $prev in --help | --version | --last-written | --format | --delay-start | --interval | \ --width | --height | --name | --rate-limit | --buffer-size | -!(-*)[hVAFDiwHNLB]) return ;; --remote | -!(-*)R) _pids return ;; --pidfile | --watchfd | -!(-*)[Pd]) _filedir pid return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) else _filedir fi } && complete -F _pv pv # ex: filetype=sh jsonschema 0000644 00000001202 15036124164 0006616 0 ustar 00 # bash completion for jsonschema -*- shell-script -*- _jsonschema() { local cur prev words cword _init_completion || return case $prev in --help | --error-format | --validator | -[hFV]) return ;; --instance | -i) _filedir json return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) return fi local args _count_args "" "-*" ((args == 1)) || return _filedir '@(json|schema)' } && complete -F _jsonschema jsonschema # ex: filetype=sh ri 0000644 00000007225 15036124164 0005111 0 ustar 00 # ri completion for Ruby documentation -*- shell-script -*- # by Ian Macdonald <ian@caliban.org> _ri_get_methods() { local regex if [[ $ri_version == integrated ]]; then if [[ -z $separator ]]; then regex="(Instance|Class)" elif [[ $separator == "#" ]]; then regex=Instance else regex=Class fi COMPREPLY+=( "$(ri "${classes[@]}" 2>/dev/null | ruby -ane \ 'if /^'"$regex"' methods:/.../^------------------|^$/ and \ /^ / then print $_.split(/, |,$/).grep(/^[^\[]*$/).join("\n"); \ end' 2>/dev/null | sort -u)") else # older versions of ri didn't distinguish between class/module and # instance methods COMPREPLY+=( "$(ruby -W0 $ri_path "${classes[@]}" 2>/dev/null | ruby -ane \ 'if /^-/.../^-/ and ! /^-/ and ! /^ +(class|module): / then \ print $_.split(/, |,$| +/).grep(/^[^\[]*$/).join("\n"); \ end' | sort -u)") fi COMPREPLY=($(compgen $prefix -W '${COMPREPLY[@]}' -- $method)) } # needs at least Ruby 1.8.0 in order to use -W0 _ri() { local cur prev words cword split _init_completion -s -n : || return case $prev in --help | --width | -!(-*)[hw]) return ;; --format | -!(-*)f) COMPREPLY=($(compgen -W 'ansi bs html rdoc' -- "$cur")) return ;; --doc-dir | -!(-*)d) _filedir -d return ;; --dump) _filedir ri return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return fi local class method prefix ri_path ri_version ri_major separator IFS local -a classes ri_path=$(type -p ri) # which version of ri are we using? # -W0 is required here to stop warnings from older versions of ri # from being captured when used with Ruby 1.8.1 and later ri_version="$(ruby -W0 $ri_path -v 2>&1)" || ri_version=integrated [[ $ri_version != "${ri_version%200*}" ]] && ri_version=integrated [[ $ri_version =~ ri[[:space:]]v?([0-9]+) ]] && ri_major=${BASH_REMATCH[1]} # need to also split on commas IFS=$', \n\t' if [[ $cur == [A-Z]*[#.]* ]]; then [[ $cur == *#* ]] && separator=# || separator=. # we're completing on class and method class=${cur%$separator*} method=${cur#*$separator} classes=($class) prefix="-P $class$separator" _ri_get_methods return fi if [[ $ri_version == integrated ]]; then # integrated ri from Ruby 1.9 classes=($(ri -c 2>/dev/null | ruby -ne 'if /^\s*$/..$stdin.eof then \ if /^ +[A-Z]/ then print; end; end' 2>/dev/null)) elif [[ $ri_major && $ri_major -ge 3 ]]; then classes=($(ri -l 2>/dev/null)) elif [[ $ri_version == "ri 1.8a" ]]; then classes=($(ruby -W0 $ri_path | ruby -ne 'if /^'"'"'ri'"'"' has/..$stdin.eof then \ if /^ .*[A-Z]/ then print; end; end')) else classes=($(ruby -W0 $ri_path | ruby -ne 'if /^I have/..$stdin.eof then \ if /^ .*[A-Z]/ then print; end; end')) fi COMPREPLY=($(compgen -W '${classes[@]}' -- "$cur")) __ltrim_colon_completions "$cur" if [[ $cur == [A-Z]* ]]; then # we're completing on class or module alone return fi # we're completing on methods method=$cur _ri_get_methods } && complete -F _ri ri # ex: filetype=sh sh 0000644 00000001557 15036124164 0005113 0 ustar 00 # POSIX sh(1) completion -*- shell-script -*- _sh() { local cur prev words cword _init_completion || return case $prev in -c) return ;; -o | +o) COMPREPLY=($(compgen -W 'allexport errexit ignoreeof monitor noclobber noglob noexec nolog notify nounset verbose vi xtrace' -- "$cur")) return ;; 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 elif [[ $cur == +* ]]; then COMPREPLY=($(compgen -W "${opts//-/+}" -- "$cur")) return fi local args ext= _count_args "" "@(-c|[-+]o)" ((args == 1)) && ext="sh" _filedir $ext } && complete -F _sh sh # ex: filetype=sh systemctl 0000644 00000033473 15036124164 0006532 0 ustar 00 # systemctl(1) completion -*- shell-script -*- # SPDX-License-Identifier: LGPL-2.1-or-later # # This file is part of systemd. # # Copyright © 2010 Ran Benita __systemctl() { local mode=$1; shift 1 systemctl $mode --full --legend=no --no-pager --plain "$@" 2>/dev/null } __systemd_properties() { /lib/systemd/systemd --dump-bus-properties } __contains_word () { local w word=$1; shift for w in "$@"; do [[ $w = "$word" ]] && return done } __filter_units_by_properties () { local mode=$1 properties=$2; shift 2 local units=("$@") local props i p n local names= count=0 IFS=$',' read -r -a p < <(echo "Names,$properties") n=${#p[*]} readarray -t props < \ <(__systemctl $mode show --property "Names,$properties" -- "${units[@]}") for ((i=0; i < ${#props[*]}; i++)); do if [[ -z ${props[i]} ]]; then if (( count == n )) && [[ -n $names ]]; then echo $names fi names= count=0 else (( count++ )) if [[ ${props[i]%%=*} == 'Names' ]]; then names=${props[i]#*=} fi fi done if (( count == n )) && [[ -n $names ]]; then echo $names fi } __get_all_units () { { __systemctl $1 list-unit-files "$2*"; __systemctl $1 list-units --all "$2*"; } \ | { while read -r a b; do echo " $a"; done; }; } __get_non_template_units() { { __systemctl $1 list-unit-files "$2*"; __systemctl $1 list-units --all "$2*"; } \ | { while read -r a b; do [[ $a =~ @\. ]] || echo " $a"; done; }; } __get_template_names () { __systemctl $1 list-unit-files "$2*" \ | { while read -r a b; do [[ $a =~ @\. ]] && echo " ${a%%@.*}@"; done; }; } __get_active_units () { __systemctl $1 list-units "$2*" \ | { while read -r a b; do echo " $a"; done; }; } __get_not_masked_unit_files() { # filter out masked, not-found, or template units. __systemctl $1 list-unit-files --state enabled,enabled-runtime,linked,linked-runtime,static,indirect,disabled,generated,transient "$2*" | \ { while read -r a b; do [[ $a =~ @\. ]] || echo " $a"; done; } } __get_startable_units () { __filter_units_by_properties $1 ActiveState=inactive,CanStart=yes $( { __get_not_masked_unit_files $1 $2 # get inactive template units __systemctl $1 list-units --state inactive,failed "$2*" | \ { while read -r a b c; do [[ $b == "loaded" ]] && echo " $a"; done; } } | sort -u ) } __get_restartable_units () { # filter out masked and not-found __filter_units_by_properties $1 CanStart=yes $( { __get_not_masked_unit_files $1 $2 __get_active_units $1 $2 } | sort -u ) } __get_stoppable_units () { # filter out masked and not-found local units=$( { __get_not_masked_unit_files $1 $2 __get_active_units $1 $2 } | sort -u ) __filter_units_by_properties $1 ActiveState=active,CanStop=yes $units __filter_units_by_properties $1 ActiveState=reloading,CanStop=yes $units __filter_units_by_properties $1 ActiveState=activating,CanStop=yes $units } __get_reloadable_units () { # filter out masked and not-found __filter_units_by_properties $1 ActiveState=active,CanReload=yes $( { __get_not_masked_unit_files $1 $2 __get_active_units $1 $2 } | sort -u ) } __get_failed_units () { __systemctl $1 list-units "$2*" \ | { while read -r a b c d; do [[ $c == "failed" ]] && echo " $a"; done; }; } __get_enabled_units () { __systemctl $1 list-unit-files "$2*" \ | { while read -r a b c ; do [[ $b == "enabled" ]] && echo " $a"; done; }; } __get_disabled_units () { __systemctl $1 list-unit-files "$2*" \ | { while read -r a b c ; do [[ $b == "disabled" ]] && echo " $a"; done; }; } __get_masked_units () { __systemctl $1 list-unit-files "$2*" \ | { while read -r a b c ; do [[ $b == "masked" ]] && echo " $a"; done; }; } __get_all_unit_files () { { __systemctl $1 list-unit-files "$2*"; } | { while read -r a b; do echo " $a"; done; }; } __get_machines() { local a b { machinectl list-images --full --no-legend --no-pager; machinectl list --full --no-legend --no-pager; } | \ { while read a b; do echo " $a"; done; } } _systemctl () { local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} local i verb comps mode cur_orig local -A OPTS=( [STANDALONE]='--all -a --reverse --after --before --defaults --force -f --full -l --global --help -h --no-ask-password --no-block --legend=no --no-pager --no-reload --no-wall --now --quiet -q --system --user --version --runtime --recursive -r --firmware-setup --show-types --plain --failed --value --fail --dry-run --wait' [ARG]='--host -H --kill-who --property -p --signal -s --type -t --state --job-mode --root --preset-mode -n --lines -o --output -M --machine --message --timestamp --check-inhibitors' ) if __contains_word "--user" ${COMP_WORDS[*]}; then mode=--user elif __contains_word "--global" ${COMP_WORDS[*]}; then mode=--user else mode=--system fi if __contains_word "$prev" ${OPTS[ARG]}; then case $prev in --signal|-s) _signals return ;; --type|-t) comps=$(__systemctl $mode -t help) ;; --state) comps=$(__systemctl $mode --state=help) ;; --job-mode) comps='fail replace replace-irreversibly isolate ignore-dependencies ignore-requirements flush' ;; --kill-who) comps='all control main' ;; --root) comps=$(compgen -A directory -- "$cur" ) compopt -o filenames ;; --host|-H) comps=$(compgen -A hostname) ;; --property|-p) comps=$(__systemd_properties) ;; --preset-mode) comps='full enable-only disable-only' ;; --output|-o) comps=$( systemctl --output=help 2>/dev/null ) ;; --machine|-M) comps=$( __get_machines ) ;; --timestamp) comps='pretty us µs utc us+utc µs+utc' ;; --check-inhibitors) comps='auto yes no' ;; esac COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 fi if [[ "$cur" = -* ]]; then COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") ) return 0 fi local -A VERBS=( [ALL_UNITS]='cat mask' [NONTEMPLATE_UNITS]='is-active is-failed is-enabled status show preset help list-dependencies edit set-property revert' [ENABLED_UNITS]='disable' [DISABLED_UNITS]='enable' [REENABLABLE_UNITS]='reenable' [FAILED_UNITS]='reset-failed' [STARTABLE_UNITS]='start' [STOPPABLE_UNITS]='stop condstop kill try-restart condrestart' [ISOLATABLE_UNITS]='isolate' [RELOADABLE_UNITS]='reload condreload try-reload-or-restart force-reload' [RESTARTABLE_UNITS]='restart reload-or-restart' [TARGET_AND_UNITS]='add-wants add-requires' [MASKED_UNITS]='unmask' [JOBS]='cancel' [ENVS]='set-environment unset-environment import-environment' [STANDALONE]='daemon-reexec daemon-reload default emergency exit halt hibernate hybrid-sleep suspend-then-hibernate kexec list-jobs list-sockets list-timers list-units list-unit-files poweroff reboot rescue show-environment suspend get-default is-system-running preset-all' [FILE]='link switch-root bind mount-image' [TARGETS]='set-default' [MACHINES]='list-machines' [LOG_LEVEL]='log-level' [LOG_TARGET]='log-target' [SERVICE_WATCHDOGS]='service-watchdogs' ) for ((i=0; i < COMP_CWORD; i++)); do if __contains_word "${COMP_WORDS[i]}" ${VERBS[*]} && ! __contains_word "${COMP_WORDS[i-1]}" ${OPTS[ARG]}; then verb=${COMP_WORDS[i]} break fi done # When trying to match a unit name with certain special characters in its name (i.e # foo\x2dbar:01) they get (un)escaped by bash along the way, thus causing any possible # match to fail. # The following condition solves two cases: # 1) We're trying to complete an already escaped unit name part, # i.e foo\\x2dba. In this case we need to unescape the name, so it # gets properly matched with the systemctl output (i.e. foo\x2dba). # However, we need to keep the original escaped name as well for the # final match, as the completion machinery does the unescaping # automagically. # 2) We're trying to complete an unescaped (literal) unit name part, # i.e. foo\x2dba. That means we don't have to do the unescaping # required for correct matching with systemctl's output, however, # we need to escape the name for the final match, where the completion # expects the string to be escaped. cur_orig=$cur if [[ $cur =~ '\\' ]]; then cur="$(echo $cur | xargs echo)" else cur_orig="$(printf '%q' $cur)" fi if [[ -z ${verb-} ]]; then comps="${VERBS[*]}" elif __contains_word "$verb" ${VERBS[ALL_UNITS]}; then comps=$( __get_all_units $mode "$cur" ) compopt -o filenames elif __contains_word "$verb" ${VERBS[NONTEMPLATE_UNITS]}; then comps=$( __get_non_template_units $mode "$cur" ) compopt -o filenames elif __contains_word "$verb" ${VERBS[ENABLED_UNITS]}; then comps=$( __get_enabled_units $mode "$cur" ) compopt -o filenames elif __contains_word "$verb" ${VERBS[DISABLED_UNITS]}; then comps=$( __get_disabled_units $mode "$cur"; __get_template_names $mode "$cur") compopt -o filenames elif __contains_word "$verb" ${VERBS[REENABLABLE_UNITS]}; then comps=$( __get_disabled_units $mode "$cur"; __get_enabled_units $mode "$cur"; __get_template_names $mode "$cur") compopt -o filenames elif __contains_word "$verb" ${VERBS[STARTABLE_UNITS]}; then comps=$( __get_startable_units $mode "$cur" ) compopt -o filenames elif __contains_word "$verb" ${VERBS[RESTARTABLE_UNITS]}; then comps=$( __get_restartable_units $mode "$cur" ) compopt -o filenames elif __contains_word "$verb" ${VERBS[STOPPABLE_UNITS]}; then comps=$( __get_stoppable_units $mode "$cur" ) compopt -o filenames elif __contains_word "$verb" ${VERBS[RELOADABLE_UNITS]}; then comps=$( __get_reloadable_units $mode "$cur" ) compopt -o filenames elif __contains_word "$verb" ${VERBS[ISOLATABLE_UNITS]}; then comps=$( __filter_units_by_properties $mode AllowIsolate=yes \ $( __get_non_template_units $mode "$cur" ) ) compopt -o filenames elif __contains_word "$verb" ${VERBS[FAILED_UNITS]}; then comps=$( __get_failed_units $mode "$cur" ) compopt -o filenames elif __contains_word "$verb" ${VERBS[MASKED_UNITS]}; then comps=$( __get_masked_units $mode "$cur" ) compopt -o filenames elif __contains_word "$verb" ${VERBS[TARGET_AND_UNITS]}; then if __contains_word "$prev" ${VERBS[TARGET_AND_UNITS]} \ || __contains_word "$prev" ${OPTS[STANDALONE]}; then comps=$( __systemctl $mode list-unit-files --type target --all "$cur*" \ | { while read -r a b; do echo " $a"; done; } ) else comps=$( __get_all_unit_files $mode "$cur" ) fi compopt -o filenames elif __contains_word "$verb" ${VERBS[STANDALONE]}; then comps='' elif __contains_word "$verb" ${VERBS[JOBS]}; then comps=$( __systemctl $mode list-jobs | { while read -r a b; do echo " $a"; done; } ) elif [ "$verb" = 'unset-environment' ]; then comps=$( __systemctl $mode show-environment \ | while read -r line; do echo " ${line%%=*}"; done ) compopt -o nospace elif [ "$verb" = 'set-environment' ]; then comps=$( __systemctl $mode show-environment \ | while read -r line; do echo " ${line%%=*}="; done ) compopt -o nospace elif [ "$verb" = 'import-environment' ]; then COMPREPLY=( $(compgen -A variable -- "$cur_orig") ) return 0 elif __contains_word "$verb" ${VERBS[FILE]}; then comps=$( compgen -A file -- "$cur" ) compopt -o filenames elif __contains_word "$verb" ${VERBS[TARGETS]}; then comps=$( __systemctl $mode list-unit-files --type target --full --all "$cur*" \ | { while read -r a b; do echo " $a"; done; } ) elif __contains_word "$verb" ${VERBS[LOG_LEVEL]}; then comps='debug info notice warning err crit alert emerg' elif __contains_word "$verb" ${VERBS[LOG_TARGET]}; then comps='console journal kmsg journal-or-kmsg null' elif __contains_word "$verb" ${VERBS[SERVICE_WATCHDOGS]}; then comps='on off' fi COMPREPLY=( $(compgen -o filenames -W '$comps' -- "$cur_orig") ) return 0 } complete -F _systemctl systemctl iperf 0000644 00000004073 15036124164 0005602 0 ustar 00 # iperf(1) completion -*- shell-script -*- _iperf() { local cur prev words cword split _init_completion -s -n : || return case $prev in --help | --version | --interval | --len | --port | --window | --mss | --bandwidth | \ --num | --time | --listenport | --parallel | --ttl | --linux-congestion | --omit | \ --congestion | --bytes | --blockcount | --cport | --set-mss | --flowlabel | \ --title | --tos | --affinity | -!(-*)[hvilpwMbntLPTZCkOSA]) return ;; --format | -!(-*)f) COMPREPLY=($(compgen -W 'k m g K M G' -- "$cur")) return ;; --output | --fileinput | -!(-*)[oF]) _filedir return ;; --bind | -!(-*)B) _available_interfaces -a _ip_addresses -a __ltrim_colon_completions "$cur" return ;; --client | -!(-*)c) _known_hosts_real -- "$cur" return ;; --reportexclude | -!(-*)x) COMPREPLY=($(compgen -W 'C D M S V' -- "$cur")) return ;; --reportstyle | -!(-*)y) COMPREPLY=($(compgen -W 'C' -- "$cur")) return ;; --logfile) _filedir log return ;; esac $split && return # Filter mode specific options local i filter=cat for i in "${words[@]}"; do case $i in -s | --server) filter='command sed -e /^Client.specific/,/^\(Server.specific.*\)\?$/d' ;; -c | --client) filter='command sed -e /^Server.specific/,/^\(Client.specific.*\)\?$/d' ;; esac done [[ $filter != cat ]] && filter+=' -e /--client/d -e /--server/d' COMPREPLY=($(compgen -W \ '$("$1" --help 2>&1 | $filter | _parse_help -)' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace } && complete -F _iperf iperf iperf3 # ex: filetype=sh tcpdump 0000644 00000003175 15036124164 0006153 0 ustar 00 # bash completion for tcpdump -*- shell-script -*- _tcpdump() { local cur prev words cword split _init_completion -s || return case $prev in -!(-*)[rwFV]) _filedir return ;; --interface | -!(-*)i) _available_interfaces -a return ;; -!(-*)m) _filedir mib return ;; -!(-*)T) COMPREPLY=($(compgen -W 'aodv carp cnfp lmp pgm pgm_zmtp1 radius resp rpc rtcp rtp rtcp snmp tftp vat vxlan wb zmtp1' \ -- "$cur")) return ;; -!(-*)z) compopt -o filenames COMPREPLY=($(compgen -c -- "$cur")) return ;; --relinquish-privileges | -!(-*)Z) _allowed_users return ;; -!(-*)[BcCDEGMsWy]) return ;; --time-stamp-type | -!(-*)j) COMPREPLY=($(compgen -W 'host host_lowprec host_hiprec adapter adapter_unsynced' -- "$cur")) return ;; --direction | -!(-*)Q) COMPREPLY=($(compgen -W 'in out inout' -- "$cur")) return ;; --time-stamp-precision) COMPREPLY=($(compgen -W 'micro nano' -- "$cur")) return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_usage "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace fi } && complete -F _tcpdump tcpdump # ex: filetype=sh usermod 0000644 00000002565 15036124164 0006157 0 ustar 00 # usermod(8) completion -*- shell-script -*- _usermod() { local cur prev words cword split _init_completion -s || return # TODO: if -o/--non-unique is given, could complete on existing uids # with -u/--uid case $prev in --comment | --home | --expiredate | --inactive | --help | --login | --password | \ --uid | --selinux-user | -!(-*)[cdefhlpuZ]) return ;; --gid | -!(-*)g) _gids COMPREPLY=($(compgen -W '${COMPREPLY[@]} $(compgen -g)' \ -- "$cur")) return ;; --groups | -!(-*)G) local prefix= [[ $cur == *,* ]] && prefix="${cur%,*}," COMPREPLY=($(compgen -g -- "${cur##*,}")) ((${#COMPREPLY[@]} == 1)) && COMPREPLY=(${COMPREPLY/#/$prefix}) return ;; --root | -!(-*)R) _filedir -d return ;; --shell | -!(-*)s) _shells return ;; esac $split && return if [[ $cur == -* ]]; then # TODO: -U/--unlock, -p/--password, -L/--lock mutually exclusive COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) return fi COMPREPLY=($(compgen -u -- "$cur")) } && complete -F _usermod usermod # ex: filetype=sh genisoimage 0000644 00000001556 15036124164 0006767 0 ustar 00 # bash completion for mkisofs/genisoimage -*- shell-script -*- _mkisofs() { local cur prev words cword _init_completion || return case $prev in -o | -abstract | -biblio | -check-session | -copyright | -log-file | \ -root-info | -prep-boot | -*-list) _filedir return ;; -*-charset) COMPREPLY=($(compgen -W '$(mkisofs -input-charset \ help 2>&1 | tail -n +3)' -- "$cur")) return ;; -uid) _uids return ;; -gid) _gids return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1" -help)' -- "$cur")) else _filedir fi } && complete -F _mkisofs mkisofs genisoimage # ex: filetype=sh blkzone 0000644 00000001766 15036124164 0006147 0 ustar 00 _blkzone_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-o'|'--offset') COMPREPLY=( $(compgen -W "sector" -- $cur) ) return 0 ;; '-l'|'--length') COMPREPLY=( $(compgen -W "size" -- $cur) ) return 0 ;; '-c'|'--count') COMPREPLY=( $(compgen -W "number" -- $cur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) case $prev in 'report'|'reset') OPTS="--verbose --offset --length --count --force" ;; *) OPTS="--help --version" ;; esac COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; *) case $prev in 'report'|'reset') ;; *) OPTS="report reset" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) ;; esac return 0 ;; esac compopt -o bashdefault -o default COMPREPLY=( $(compgen -W "$(lsblk -pnro name)" -- $cur) ) return 0 } complete -F _blkzone_module blkzone journalctl 0000644 00000014174 15036124164 0006655 0 ustar 00 # journalctl(1) completion -*- shell-script -*- # SPDX-License-Identifier: LGPL-2.1-or-later # # This file is part of systemd. # # Copyright © 2010 Ran Benita # # systemd is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version. # # systemd is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with systemd; If not, see <http://www.gnu.org/licenses/>. __contains_word () { local w word=$1; shift for w in "$@"; do [[ $w = "$word" ]] && return done } __get_machines() { local a b (machinectl list-images --full --no-legend --no-pager; machinectl list --full --no-legend --no-pager; echo ".host") | \ { while read a b; do echo " $a"; done; } | sort -u; } __syslog_priorities=(emerg alert crit err warning notice info debug) __syslog_facilities=(kern user mail daemon auth syslog lpr news uucp cron authpriv ftp local0 local1 local2 local3 local4 local5 local6 local7) _journalctl() { local field_vals= cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} local -A OPTS=( [STANDALONE]='-a --all --full --system --user --disk-usage -f --follow --header -h --help -l --local -m --merge --no-pager --no-tail -q --quiet --setup-keys --verify --version --list-catalog --update-catalog --list-boots --show-cursor --dmesg -k --pager-end -e -r --reverse --utc -x --catalog --no-full --force --dump-catalog --flush --rotate --sync --no-hostname -N --fields' [ARG]='-b --boot -D --directory --file -F --field -t --identifier --facility -M --machine -o --output -u --unit --user-unit -p --priority --root --case-sensitive' [ARGUNKNOWN]='-c --cursor --interval -n --lines -S --since -U --until --after-cursor --cursor-file --verify-key -g --grep --vacuum-size --vacuum-time --vacuum-files --output-fields' ) # Use the default completion for shell redirect operators if __contains_word "$prev" '>' '>>' '&>'; then compopt -o filenames COMPREPLY=( $(compgen -f -- "$cur") ) return 0; fi if __contains_word "$prev" ${OPTS[ARG]} ${OPTS[ARGUNKNOWN]}; then case $prev in --boot|-b) comps=$(journalctl -F '_BOOT_ID' 2>/dev/null) ;; --directory|-D|--root) comps=$(compgen -d -- "$cur") compopt -o filenames ;; --file) comps=$(compgen -f -- "$cur") compopt -o filenames ;; --output|-o) comps=$( journalctl --output=help 2>/dev/null ) ;; --field|-F) comps=$(journalctl --fields | sort 2>/dev/null) ;; --machine|-M) comps=$( __get_machines ) ;; --facility) comps=${__syslog_facilities[*]} ;; --priority|-p) comps=${__syslog_priorities[*]} compopt -o nosort ;; --unit|-u) comps=$(journalctl -F '_SYSTEMD_UNIT' 2>/dev/null) # Similarly to systemctl, we need to distinguish between # escaped and unescaped names in order to be able to correctly # complete them. In this particular case, if the name we're # trying to complete is unescaped (i.e. foo\x2dbaz), escape # it first, so the compgen below works as expected. For more # information about these shenanigans see the systemctl # completion file if ! [[ $cur =~ '\\' ]]; then cur="$(printf '%q' $cur)" fi compopt -o filenames ;; --user-unit) comps=$(journalctl -F '_SYSTEMD_USER_UNIT' 2>/dev/null) ;; --identifier|-t) comps=$(journalctl -F 'SYSLOG_IDENTIFIER' 2>/dev/null) ;; --case-sensitive) comps='yes no' ;; *) return 0 ;; esac COMPREPLY=( $(compgen -o filenames -W '$comps' -- "$cur") ) return 0 fi if [[ $cur = -* ]]; then COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") ) return 0 elif [[ $cur = *=* ]]; then mapfile -t field_vals < <(journalctl -F "${prev%=}" 2>/dev/null) COMPREPLY=( $(compgen -W '${field_vals[*]}' -- "${cur#=}") ) elif [[ $cur = /dev* ]]; then compopt -o filenames COMPREPLY=( $(compgen -f -- "${cur}") ) elif [[ $cur = /* ]]; then # Append /dev/ to the list of completions, so that # after typing /<TAB><TAB> the user sees /dev/ as one # of the alternatives. Later on the rule above will # take care of showing device files in /dev/. mapfile -t field_vals < <(journalctl -F "_EXE" 2>/dev/null; echo '/dev/') COMPREPLY=( $(compgen -W '${field_vals[*]}' -- "${cur}") ) if [[ "${COMPREPLY[@]}" = '/dev/' ]]; then compopt -o filenames COMPREPLY=( $(compgen -f -- "${cur}") ) fi elif [[ $prev = '=' ]]; then mapfile -t field_vals < <(journalctl -F "${COMP_WORDS[COMP_CWORD-2]}" 2>/dev/null) COMPREPLY=( $(compgen -W '${field_vals[*]}' -- "$cur") ) else mapfile -t field_vals < <(journalctl --fields 2>/dev/null) compopt -o nospace COMPREPLY=( $(compgen -W '${field_vals[*]}' -S= -- "$cur") ) fi } complete -F _journalctl journalctl lpr 0000644 00000001605 15036124164 0005270 0 ustar 00 # lpr(1) completion -*- shell-script -*- _lpr() { local cur prev words cword _init_completion || return case $prev in -P) COMPREPLY=($(compgen -W "$(lpstat -a 2>/dev/null | cut -d' ' -f1)" -- "$cur")) return ;; -U) COMPREPLY=($(compgen -u -- "$cur")) return ;; -o) COMPREPLY=($(compgen -W "media= landscape orientation-requested= sides= fitplot number-up= scaling= cpi= lpi= page-bottom= page-top= page-left= page-right=" -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return ;; esac if [[ $cur == - ]]; then COMPREPLY=($(compgen -W '-E -H -C -J -T -P -U -h -l -m -o -p -q -r' -- "$cur")) return fi _filedir } && complete -F _lpr lpr # ex: filetype=sh timedatectl 0000644 00000005570 15036124164 0006777 0 ustar 00 # timedatectl(1) completion -*- shell-script -*- # SPDX-License-Identifier: LGPL-2.1-or-later # # This file is part of systemd. # # Copyright © 2010 Ran Benita # # systemd is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version. # # systemd is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with systemd; If not, see <http://www.gnu.org/licenses/>. __contains_word () { local w word=$1; shift for w in "$@"; do [[ $w = "$word" ]] && return done } __get_machines() { local a b machinectl list --full --no-legend --no-pager | { while read a b; do echo " $a"; done; }; } __get_interfaces(){ local name for name in $(cd /sys/class/net && ls); do [[ "$name" != "lo" ]] && echo "$name" done } _timedatectl() { local i verb comps local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} local OPTS='-h --help --version --adjust-system-clock --no-pager --no-ask-password -H --host -M --machine --monitor -p --property -a --all --value' if __contains_word "$prev" $OPTS; then case $prev in --host|-H) comps=$(compgen -A hostname) ;; --machine|-M) comps=$( __get_machines ) ;; esac COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 fi if [[ $cur = -* ]]; then COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") ) return 0 fi local -A VERBS=( [BOOLEAN]='set-local-rtc set-ntp' [STANDALONE]='status show list-timezones timesync-status show-timesync' [TIMEZONES]='set-timezone' [TIME]='set-time' [IFNAME]='ntp-servers revert' ) for ((i=0; i < COMP_CWORD; i++)); do if __contains_word "${COMP_WORDS[i]}" ${VERBS[*]}; then verb=${COMP_WORDS[i]} break fi done if [[ -z ${verb-} ]]; then comps=${VERBS[*]} elif __contains_word "$verb" ${VERBS[BOOLEAN]}; then comps='true false' elif __contains_word "$verb" ${VERBS[TIMEZONES]}; then comps=$(command timedatectl list-timezones) elif __contains_word "$verb" ${VERBS[STANDALONE]} ${VERBS[TIME]}; then comps='' elif __contains_word "$verb" ${VERBS[TIMEZONES]}; then comps=$( __get_interfaces ) fi COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 } complete -F _timedatectl timedatectl hostname 0000644 00000000753 15036124164 0006314 0 ustar 00 # hostname(1) completion -*- shell-script -*- _hostname() { local cur prev words cword _init_completion || return case $prev in --help | --version | -!(-*)[hV]) return ;; --file | -!(-*)F) _filedir return ;; esac [[ $cur == -* ]] && COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) } && complete -F _hostname hostname # ex: filetype=sh tc 0000644 00000065505 15036124164 0005112 0 ustar 00 # tc(8) completion -*- shell-script -*- # Copyright 2016 6WIND S.A. # Copyright 2016 Quentin Monnet <quentin.monnet@6wind.com> QDISC_KIND=' choke codel bfifo pfifo pfifo_head_drop fq fq_codel gred hhf \ mqprio multiq netem pfifo_fast pie fq_pie red rr sfb sfq tbf atm \ cbq drr dsmark hfsc htb prio qfq ' FILTER_KIND=' basic bpf cgroup flow flower fw route rsvp tcindex u32 matchall ' ACTION_KIND=' gact mirred bpf sample ' # Takes a list of words in argument; each one of them is added to COMPREPLY if # it is not already present on the command line. Returns no value. _tc_once_attr() { local w subcword found for w in $*; do found=0 for (( subcword=3; subcword < ${#words[@]}-1; subcword++ )); do if [[ $w == ${words[subcword]} ]]; then found=1 break fi done [[ $found -eq 0 ]] && \ COMPREPLY+=( $( compgen -W "$w" -- "$cur" ) ) done } # Takes a list of words in argument; each one of them is added to COMPREPLY if # it is not already present on the command line from the provided index. Returns # no value. _tc_once_attr_from() { local w subcword found from=$1 shift for w in $*; do found=0 for (( subcword=$from; subcword < ${#words[@]}-1; subcword++ )); do if [[ $w == ${words[subcword]} ]]; then found=1 break fi done [[ $found -eq 0 ]] && \ COMPREPLY+=( $( compgen -W "$w" -- "$cur" ) ) done } # Takes a list of words in argument; adds them all to COMPREPLY if none of them # is already present on the command line. Returns no value. _tc_one_of_list() { local w subcword for w in $*; do for (( subcword=3; subcword < ${#words[@]}-1; subcword++ )); do [[ $w == ${words[subcword]} ]] && return 1 done done COMPREPLY+=( $( compgen -W "$*" -- "$cur" ) ) } # Takes a list of words in argument; adds them all to COMPREPLY if none of them # is already present on the command line from the provided index. Returns no # value. _tc_one_of_list_from() { local w subcword from=$1 shift for w in $*; do for (( subcword=$from; subcword < ${#words[@]}-1; subcword++ )); do [[ $w == ${words[subcword]} ]] && return 1 done done COMPREPLY+=( $( compgen -W "$*" -- "$cur" ) ) } # Returns "$cur ${cur}arg1 ${cur}arg2 ..." _tc_expand_units() { [[ $cur =~ ^[0-9]+ ]] || return 1 local value=${cur%%[^0-9]*} [[ $cur == $value ]] && echo $cur echo ${@/#/$value} } # Complete based on given word, usually $prev (or possibly the word before), # for when an argument or an option name has but a few possible arguments (so # tc does not take particular commands into account here). # Returns 0 is completion should stop after running this function, 1 otherwise. _tc_direct_complete() { case $1 in # Command options dev) _available_interfaces return 0 ;; classid) return 0 ;; estimator) local list=$( _tc_expand_units 'secs' 'msecs' 'usecs' ) COMPREPLY+=( $( compgen -W "$list" -- "$cur" ) ) return 0 ;; handle) return 0 ;; parent|flowid) local i iface ids cmd for (( i=3; i < ${#words[@]}-2; i++ )); do [[ ${words[i]} == dev ]] && iface=${words[i+1]} break done for cmd in qdisc class; do if [[ -n $iface ]]; then ids+=$( tc $cmd show dev $iface 2>/dev/null | \ cut -d\ -f 3 )" " else ids+=$( tc $cmd show 2>/dev/null | cut -d\ -f 3 ) fi done [[ $ids != " " ]] && \ COMPREPLY+=( $( compgen -W "$ids" -- "$cur" ) ) return 0 ;; protocol) # list comes from lib/ll_proto.c COMPREPLY+=( $( compgen -W ' 802.1Q 802.1ad 802_2 802_3 LLDP aarp \ all aoe arp atalk atmfate atmmpoa ax25 bpq can control cust \ ddcmp dec diag dna_dl dna_rc dna_rt econet ieeepup ieeepupat \ ip ipv4 ipv6 ipx irda lat localtalk loop mobitex ppp_disc \ ppp_mp ppp_ses ppptalk pup pupat rarp sca snap tipc tr_802_2 \ wan_ppp x25' -- "$cur" ) ) return 0 ;; prio) return 0 ;; stab) COMPREPLY+=( $( compgen -W 'mtu tsize mpu overhead linklayer' -- "$cur" ) ) ;; # Qdiscs and classes options alpha|bands|beta|buckets|corrupt|debug|decrement|default|\ default_index|depth|direct_qlen|divisor|duplicate|ewma|flow_limit|\ flows|hh_limit|increment|indices|linklayer|non_hh_weight|num_tc|\ penalty_burst|penalty_rate|prio|priomap|probability|queues|r2q|\ reorder|vq|vqs) return 0 ;; setup) COMPREPLY+=( $( compgen -W 'vqs' -- "$cur" ) ) return 0 ;; hw) COMPREPLY+=( $( compgen -W '1 0' -- "$cur" ) ) return 0 ;; distribution) COMPREPLY+=( $( compgen -W 'uniform normal pareto paretonormal' -- "$cur" ) ) return 0 ;; loss) COMPREPLY+=( $( compgen -W 'random state gmodel' -- "$cur" ) ) return 0 ;; # Qdiscs and classes options options gap|gmodel|state) return 0 ;; # Filters options map) COMPREPLY+=( $( compgen -W 'key' -- "$cur" ) ) return 0 ;; hash) COMPREPLY+=( $( compgen -W 'keys' -- "$cur" ) ) return 0 ;; indev) _available_interfaces return 0 ;; eth_type) COMPREPLY+=( $( compgen -W 'ipv4 ipv6' -- "$cur" ) ) return 0 ;; ip_proto) COMPREPLY+=( $( compgen -W 'tcp udp' -- "$cur" ) ) return 0 ;; # Filters options options key|keys) [[ ${words[@]} =~ graft ]] && return 1 COMPREPLY+=( $( compgen -W 'src dst proto proto-src proto-dst iif \ priority mark nfct nfct-src nfct-dst nfct-proto-src \ nfct-proto-dst rt-classid sk-uid sk-gid vlan-tag rxhash' -- \ "$cur" ) ) return 0 ;; # BPF options - used for filters, actions, and exec export|bytecode|bytecode-file|object-file) _filedir return 0 ;; object-pinned|graft) # Pinned object is probably under /sys/fs/bpf/ [[ -n "$cur" ]] && _filedir && return 0 COMPREPLY=( $( compgen -G "/sys/fs/bpf/*" -- "$cur" ) ) || _filedir compopt -o nospace return 0 ;; section) if (type objdump > /dev/null 2>&1) ; then local fword objfile section_list for (( fword=3; fword < ${#words[@]}-3; fword++ )); do if [[ ${words[fword]} == object-file ]]; then objfile=${words[fword+1]} break fi done section_list=$( objdump -h $objfile 2>/dev/null | \ sed -n 's/^ *[0-9]\+ \([^ ]*\) *.*/\1/p' ) COMPREPLY+=( $( compgen -W "$section_list" -- "$cur" ) ) fi return 0 ;; import|run) _filedir return 0 ;; type) COMPREPLY+=( $( compgen -W 'cls act' -- "$cur" ) ) return 0 ;; # Actions options random) _tc_one_of_list 'netrand determ' return 0 ;; # Units for option arguments bandwidth|maxrate|peakrate|rate) local list=$( _tc_expand_units 'bit' \ 'kbit' 'kibit' 'kbps' 'kibps' \ 'mbit' 'mibit' 'mbps' 'mibps' \ 'gbit' 'gibit' 'gbps' 'gibps' \ 'tbit' 'tibit' 'tbps' 'tibps' ) COMPREPLY+=( $( compgen -W "$list" -- "$cur" ) ) ;; admit_bytes|avpkt|burst|cell|initial_quantum|limit|max|min|mtu|mpu|\ overhead|quantum|redflowlist) local list=$( _tc_expand_units \ 'b' 'kbit' 'k' 'mbit' 'm' 'gbit' 'g' ) COMPREPLY+=( $( compgen -W "$list" -- "$cur" ) ) ;; db|delay|evict_timeout|interval|latency|perturb|rehash|reset_timeout|\ target|tupdate) local list=$( _tc_expand_units 'secs' 'msecs' 'usecs' ) COMPREPLY+=( $( compgen -W "$list" -- "$cur" ) ) ;; esac return 1 } # Complete with options names for qdiscs. Each qdisc has its own set of options # and it seems we cannot really parse it from anywhere, so we add it manually # in this function. # Returns 0 is completion should stop after running this function, 1 otherwise. _tc_qdisc_options() { case $1 in choke) _tc_once_attr 'limit bandwidth ecn min max burst' return 0 ;; codel) _tc_once_attr 'limit target interval' _tc_one_of_list 'ecn noecn' return 0 ;; bfifo|pfifo|pfifo_head_drop) _tc_once_attr 'limit' return 0 ;; fq) _tc_once_attr 'limit flow_limit quantum initial_quantum maxrate \ buckets' _tc_one_of_list 'pacing nopacing' return 0 ;; fq_codel) _tc_once_attr 'limit flows target interval quantum' _tc_one_of_list 'ecn noecn' return 0 ;; gred) _tc_once_attr 'setup vqs default grio vq prio limit min max avpkt \ burst probability bandwidth ecn harddrop' return 0 ;; hhf) _tc_once_attr 'limit quantum hh_limit reset_timeout admit_bytes \ evict_timeout non_hh_weight' return 0 ;; mqprio) _tc_once_attr 'num_tc map queues hw' return 0 ;; netem) _tc_once_attr 'delay distribution corrupt duplicate loss ecn \ reorder rate' return 0 ;; pie) _tc_once_attr 'limit target tupdate alpha beta' _tc_one_of_list 'bytemode nobytemode' _tc_one_of_list 'ecn noecn' _tc_one_of_list 'dq_rate_estimator no_dq_rate_estimator' return 0 ;; fq_pie) _tc_once_attr 'limit flows target tupdate \ alpha beta quantum memory_limit ecn_prob' _tc_one_of_list 'ecn noecn' _tc_one_of_list 'bytemode nobytemode' _tc_one_of_list 'dq_rate_estimator no_dq_rate_estimator' return 0 ;; red) _tc_once_attr 'limit min max avpkt burst adaptive probability \ bandwidth ecn harddrop' return 0 ;; rr|prio) _tc_once_attr 'bands priomap multiqueue' return 0 ;; sfb) _tc_once_attr 'rehash db limit max target increment decrement \ penalty_rate penalty_burst' return 0 ;; sfq) _tc_once_attr 'limit perturb quantum divisor flows depth headdrop \ redflowlimit min max avpkt burst probability ecn harddrop' return 0 ;; tbf) _tc_once_attr 'limit burst rate mtu peakrate latency overhead \ linklayer' return 0 ;; cbq) _tc_once_attr 'bandwidth avpkt mpu cell ewma' return 0 ;; dsmark) _tc_once_attr 'indices default_index set_tc_index' return 0 ;; hfsc) _tc_once_attr 'default' return 0 ;; htb) _tc_once_attr 'default r2q direct_qlen debug' return 0 ;; multiq|pfifo_fast|atm|drr|qfq) return 0 ;; esac return 1 } # Complete with options names for BPF filters or actions. # Returns 0 is completion should stop after running this function, 1 otherwise. _tc_bpf_options() { [[ ${words[${#words[@]}-3]} == object-file ]] && \ _tc_once_attr 'section export' [[ ${words[${#words[@]}-5]} == object-file ]] && \ [[ ${words[${#words[@]}-3]} =~ (section|export) ]] && \ _tc_once_attr 'section export' _tc_one_of_list 'bytecode bytecode-file object-file object-pinned' _tc_once_attr 'verbose index direct-action action classid' return 0 } # Complete with options names for filter actions. # This function is recursive, thus allowing multiple actions statement to be # parsed. # Returns 0 is completion should stop after running this function, 1 otherwise. _tc_filter_action_options() { for ((acwd=$1; acwd < ${#words[@]}-1; acwd++)); do if [[ action == ${words[acwd]} ]]; then _tc_filter_action_options $((acwd+1)) && return 0 fi done local action acwd for ((acwd=$1; acwd < ${#words[@]}-1; acwd++)); do if [[ $ACTION_KIND =~ ' '${words[acwd]}' ' ]]; then _tc_one_of_list_from $acwd action _tc_action_options $acwd && return 0 fi done _tc_one_of_list_from $acwd $ACTION_KIND return 0 } # Complete with options names for filters. # Returns 0 is completion should stop after running this function, 1 otherwise. _tc_filter_options() { for ((acwd=$1; acwd < ${#words[@]}-1; acwd++)); do if [[ action == ${words[acwd]} ]]; then _tc_filter_action_options $((acwd+1)) && return 0 fi done filter=${words[$1]} case $filter in basic) _tc_once_attr 'match action classid' return 0 ;; bpf) _tc_bpf_options return 0 ;; cgroup) _tc_once_attr 'match action' return 0 ;; flow) local i for (( i=5; i < ${#words[@]}-1; i++ )); do if [[ ${words[i]} =~ ^keys?$ ]]; then _tc_direct_complete 'key' COMPREPLY+=( $( compgen -W 'or and xor rshift addend' -- \ "$cur" ) ) break fi done _tc_once_attr 'map hash divisor baseclass match action' return 0 ;; matchall) _tc_once_attr 'action classid skip_sw skip_hw' return 0 ;; flower) _tc_once_attr 'action classid indev dst_mac src_mac eth_type \ ip_proto dst_ip src_ip dst_port src_port' return 0 ;; fw) _tc_once_attr 'action classid' return 0 ;; route) _tc_one_of_list 'from fromif' _tc_once_attr 'to classid action' return 0 ;; rsvp) _tc_once_attr 'ipproto session sender classid action tunnelid \ tunnel flowlabel spi/ah spi/esp u8 u16 u32' [[ ${words[${#words[@]}-3]} == tunnel ]] && \ COMPREPLY+=( $( compgen -W 'skip' -- "$cur" ) ) [[ ${words[${#words[@]}-3]} =~ u(8|16|32) ]] && \ COMPREPLY+=( $( compgen -W 'mask' -- "$cur" ) ) [[ ${words[${#words[@]}-3]} == mask ]] && \ COMPREPLY+=( $( compgen -W 'at' -- "$cur" ) ) return 0 ;; tcindex) _tc_once_attr 'hash mask shift classid action' _tc_one_of_list 'pass_on fall_through' return 0 ;; u32) _tc_once_attr 'match link classid action offset ht hashkey sample' COMPREPLY+=( $( compgen -W 'ip ip6 udp tcp icmp u8 u16 u32 mark \ divisor' -- "$cur" ) ) return 0 ;; esac return 1 } # Complete with options names for actions. # Returns 0 is completion should stop after running this function, 1 otherwise. _tc_action_options() { local from=$1 local action=${words[from]} case $action in bpf) _tc_bpf_options return 0 ;; mirred) _tc_one_of_list_from $from 'ingress egress' _tc_one_of_list_from $from 'mirror redirect' _tc_once_attr_from $from 'index dev' return 0 ;; sample) _tc_once_attr_from $from 'rate' _tc_once_attr_from $from 'trunc' _tc_once_attr_from $from 'group' return 0 ;; gact) _tc_one_of_list_from $from 'reclassify drop continue pass' _tc_once_attr_from $from 'random' return 0 ;; esac return 1 } # Complete with options names for exec. # Returns 0 is completion should stop after running this function, 1 otherwise. _tc_exec_options() { case $1 in import) [[ ${words[${#words[@]}-3]} == import ]] && \ _tc_once_attr 'run' return 0 ;; graft) COMPREPLY+=( $( compgen -W 'key type' -- "$cur" ) ) [[ ${words[${#words[@]}-3]} == object-file ]] && \ _tc_once_attr 'type' _tc_bpf_options return 0 ;; esac return 1 } # Main completion function # Logic is as follows: # 1. Check if previous word is a global option; if so, propose arguments. # 2. Check if current word is a global option; if so, propose completion. # 3. Check for the presence of a main command (qdisc|class|filter|...). If # there is one, first call _tc_direct_complete to see if previous word is # waiting for a particular completion. If so, propose completion and exit. # 4. Extract main command and -- if available -- its subcommand # (add|delete|show|...). # 5. Propose completion based on main and sub- command in use. Additional # functions may be called for qdiscs, classes or filter options. _tc() { local cur prev words cword _init_completion || return case $prev in -V|-Version) return 0 ;; -b|-batch|-cf|-conf) _filedir return 0 ;; -force) COMPREPLY=( $( compgen -W '-batch' -- "$cur" ) ) return 0 ;; -nm|name) [[ -r /etc/iproute2/tc_cls ]] || \ COMPREPLY=( $( compgen -W '-conf' -- "$cur" ) ) return 0 ;; -n|-net|-netns) local nslist=$( ip netns list 2>/dev/null ) COMPREPLY+=( $( compgen -W "$nslist" -- "$cur" ) ) return 0 ;; -tshort) _tc_once_attr '-statistics' COMPREPLY+=( $( compgen -W 'monitor' -- "$cur" ) ) return 0 ;; -timestamp) _tc_once_attr '-statistics -tshort' COMPREPLY+=( $( compgen -W 'monitor' -- "$cur" ) ) return 0 ;; esac # Search for main commands 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]} != -@(n?(et?(ns))|c?(on)f) ]] && \ cmd=${words[subcword]} done if [[ -z $cmd ]]; then case $cur in -*) local c='-Version -statistics -details -raw -pretty \ -iec -graphe -batch -name -netns -timestamp' [[ $cword -eq 1 ]] && c+=' -force' COMPREPLY=( $( compgen -W "$c" -- "$cur" ) ) return 0 ;; *) COMPREPLY=( $( compgen -W "help $( tc help 2>&1 | \ command sed \ -e '/OBJECT := /!d' \ -e 's/.*{//' \ -e 's/}.*//' \ -e \ 's/|//g' )" -- "$cur" ) ) return 0 ;; esac fi [[ $subcmd == help ]] && return 0 # For this set of commands we may create COMPREPLY just by analysing the # previous word, if it expects for a specific list of options or values. if [[ $cmd =~ (qdisc|class|filter|action|exec) ]]; then _tc_direct_complete $prev && return 0 if [[ ${words[${#words[@]}-3]} == estimator ]]; then local list=$( _tc_expand_units 'secs' 'msecs' 'usecs' ) COMPREPLY+=( $( compgen -W "$list" -- "$cur" ) ) && return 0 fi fi # Completion depends on main command and subcommand in use. case $cmd in qdisc) case $subcmd in add|change|replace|link|del|delete) if [[ $(($cword-$subcword)) -eq 1 ]]; then COMPREPLY=( $( compgen -W 'dev' -- "$cur" ) ) return 0 fi local qdisc qdwd for ((qdwd=$subcword; qdwd < ${#words[@]}-1; qdwd++)); do if [[ $QDISC_KIND =~ ' '${words[qdwd]}' ' ]]; then qdisc=${words[qdwd]} _tc_qdisc_options $qdisc && return 0 fi done _tc_one_of_list $QDISC_KIND _tc_one_of_list 'root ingress parent clsact' _tc_once_attr 'handle estimator stab' ;; show) _tc_once_attr 'dev' _tc_one_of_list 'ingress clsact' _tc_once_attr '-statistics -details -raw -pretty -iec \ -graph -name' ;; help) return 0 ;; *) [[ $cword -eq $subcword ]] && \ COMPREPLY=( $( compgen -W 'help add delete change \ replace link show' -- "$cur" ) ) ;; esac ;; class) case $subcmd in add|change|replace|del|delete) if [[ $(($cword-$subcword)) -eq 1 ]]; then COMPREPLY=( $( compgen -W 'dev' -- "$cur" ) ) return 0 fi local qdisc qdwd for ((qdwd=$subcword; qdwd < ${#words[@]}-1; qdwd++)); do if [[ $QDISC_KIND =~ ' '${words[qdwd]}' ' ]]; then qdisc=${words[qdwd]} _tc_qdisc_options $qdisc && return 0 fi done _tc_one_of_list $QDISC_KIND _tc_one_of_list 'root parent' _tc_once_attr 'classid' ;; show) _tc_once_attr 'dev' _tc_one_of_list 'root parent' _tc_once_attr '-statistics -details -raw -pretty -iec \ -graph -name' ;; help) return 0 ;; *) [[ $cword -eq $subcword ]] && \ COMPREPLY=( $( compgen -W 'help add delete change \ replace show' -- "$cur" ) ) ;; esac ;; filter) case $subcmd in add|change|replace|del|delete) if [[ $(($cword-$subcword)) -eq 1 ]]; then COMPREPLY=( $( compgen -W 'dev' -- "$cur" ) ) return 0 fi local filter fltwd for ((fltwd=$subcword; fltwd < ${#words[@]}-1; fltwd++)); do if [[ $FILTER_KIND =~ ' '${words[fltwd]}' ' ]]; then _tc_filter_options $fltwd && return 0 fi done _tc_one_of_list $FILTER_KIND _tc_one_of_list 'root ingress egress parent' _tc_once_attr 'handle estimator pref protocol' ;; show) _tc_once_attr 'dev' _tc_one_of_list 'root ingress egress parent' _tc_once_attr '-statistics -details -raw -pretty -iec \ -graph -name' ;; help) return 0 ;; *) [[ $cword -eq $subcword ]] && \ COMPREPLY=( $( compgen -W 'help add delete change \ replace show' -- "$cur" ) ) ;; esac ;; action) case $subcmd in add|change|replace) local action acwd for ((acwd=$subcword; acwd < ${#words[@]}-1; acwd++)); do if [[ $ACTION_KIND =~ ' '${words[acwd]}' ' ]]; then _tc_action_options $acwd && return 0 fi done _tc_one_of_list $ACTION_KIND ;; get|del|delete) _tc_once_attr 'index' ;; lst|list|flush|show) _tc_one_of_list $ACTION_KIND ;; *) [[ $cword -eq $subcword ]] && \ COMPREPLY=( $( compgen -W 'help add delete change \ replace show list flush action' -- "$cur" ) ) ;; esac ;; monitor) COMPREPLY=( $( compgen -W 'help' -- "$cur" ) ) ;; exec) case $subcmd in bpf) local excmd exwd EXEC_KIND=' import debug graft ' for ((exwd=$subcword; exwd < ${#words[@]}-1; exwd++)); do if [[ $EXEC_KIND =~ ' '${words[exwd]}' ' ]]; then excmd=${words[exwd]} _tc_exec_options $excmd && return 0 fi done _tc_one_of_list $EXEC_KIND ;; *) [[ $cword -eq $subcword ]] && \ COMPREPLY=( $( compgen -W 'bpf' -- "$cur" ) ) ;; esac ;; esac } && complete -F _tc tc # ex: ts=4 sw=4 et filetype=sh iwspy 0000644 00000000736 15036124164 0005652 0 ustar 00 # iwspy completion -*- shell-script -*- _iwspy() { local cur prev words cword _init_completion || return if ((cword == 1)); then if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '--help --version' -- "$cur")) else _available_interfaces -w fi else COMPREPLY=($(compgen -W 'setthr getthr off' -- "$cur")) fi } && complete -F _iwspy iwspy # ex: filetype=sh logger 0000644 00000003021 15036124164 0005744 0 ustar 00 _logger_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-f'|'--file'|'--journald') local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 ;; '-n'|'--server') COMPREPLY=( $(compgen -A hostname -- $cur) ) return 0 ;; '-P'|'--port') COMPREPLY=( $(compgen -W "$(awk '$1 ~ /^syslog$/ {split($2, a, "/"); print a[1]}' /etc/services)" -- $cur) ) return 0 ;; '-p'|'--priority') COMPREPLY=( $(compgen -W "{auth,authpriv,cron,daemon,ftp,lpr,mail,news,security}.{alert,crit,debug,emerg,err,error}" -- $cur) ) return 0 ;; '-t'|'--tag') COMPREPLY=( $(compgen -W "tag" -- $cur) ) return 0 ;; '-u'|'--socket') COMPREPLY=( $(compgen -W "$(awk '$NF ~ /^\// {print $NF}' /proc/net/unix)" -- $cur) ) return 0 ;; '--socket-errors') COMPREPLY=( $(compgen -W "on off auto" -- $cur) ) return 0 ;; '--msgid') COMPREPLY=( $(compgen -W "msgid" -- $cur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS=" --file --help --id --journald --msgid --no-act --octet-count --port --prio-prefix --priority --rfc3164 --rfc5424 --server --size --skip-empty --socket --socket-errors --stderr --tag --tcp --udp --version " COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac return 0 } complete -F _logger_module logger xmlwf 0000644 00000001266 15036124164 0005633 0 ustar 00 # bash completion for xmlwf(1) -*- shell-script -*- _xmlwf() { local cur prev words cword _init_completion || return case $prev in -*d) _filedir -d return ;; -*e) COMPREPLY=($(compgen -W 'US-ASCII UTF-8 UTF-16 ISO-8859-1' \ -- "$cur")) return ;; -*v) return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_usage "$1")' -- "$cur")) return fi _filedir '@(*ml|htm|svg|xs[dl]|rng|wsdl|jnlp|tld|dbk|docbook|page)' } && complete -F _xmlwf xmlwf # ex: filetype=sh pkgutil 0000644 00000007555 15036124164 0006164 0 ustar 00 # pkgutil completion -*- shell-script -*- # Copyright 2006 Yann Rouillard <yann@opencsw.org> _pkgutil_url2catalog() { local filename="$1" filename="${filename##*://}" filename="${filename//\//_}" filename="/var/opt/csw/pkgutil/catalog.${filename}_$(uname -p)_$(uname -r)" echo "$filename" } _pkgutil() { local cur prev words cword _init_completion -n : || return local command catalog_files configuration_files declare -a configuration_files=("/opt/csw/etc/pkgutil.conf" "/etc/opt/csw/pkgutil.conf") declare -a catalog_files=() local i=$cword while ((i-- > 1)); do if [[ ${words[i]} == -@(t|-temp) ]]; then local url="${words[i + 1]}" local catalog=$(_pkgutil_url2catalog "$url") catalog_files=("$catalog") elif [[ ${words[i]} == --config ]]; then configuration_files=("$(dequote ${words[i + 1]})") elif [[ ${words[i]} == -@([iurdacUS]|-install|-upgrade|-remove|-download|-available|-compare|-catalog|-stream) ]]; then command="${words[i]}" fi done if [[ $prev == -@([WPR]|-workdir|-pkgdir|-rootpath) ]]; then _filedir -d return fi if [[ $prev == -@(o|-output|-config) ]]; then _filedir return fi if [[ $prev == -@(p|-param) ]]; then compopt -o nospace COMPREPLY=($(compgen -W "mirror: pkgaddopts: pkgrmopts: wgetopts: use_gpg: use_md5: pkgliststyle: maxpkglist: noncsw: stop_on_hook_soft_error: exclude_pattern: gpg_homedir: root_path: deptree_filter_common: show_current: catalog_not_cached: catalog_update:" -- $cur)) return fi if [[ $prev == @(-T|--target) ]]; then # Work-around bash_completion issue where bash interprets a colon # as a separator, borrowed from maven completion code which borrowed # it from darcs completion code :) local colonprefixes=${cur%"${cur##*:}"} COMPREPLY=($(compgen -W "sparc:5.9 sparc:5.10 sparc:5.11 i386:5.9 i386:5.10 i386:5.11" -- $cur)) local i=${#COMPREPLY[*]} while ((i-- > 0)); do COMPREPLY[i]=${COMPREPLY[i]#"$colonprefixes"} done return fi if [[ -v command && $cur != -* ]]; then local mirrors mirror_url mirrors=$(awk -F= ' $1 ~ /^ *mirror *$/ { print $2 }' "${configuration_files[@]}") mirrors=${mirrors:-http://mirror.opencsw.org/opencsw/testing} for mirror_url in $mirrors; do local catalog=$(_pkgutil_url2catalog "$mirror_url") catalog_files=("${catalog_files[@]}" "$catalog") done if [[ $command == -@([dius]|-download|-install|-upgrade|-stream) ]]; then local packages_list=$(awk ' $0 ~ /BEGIN PGP SIGNATURE/ { exit } $1 ~ /^Hash:/ || $1 ~ /^ *(-|#|$)/ { next } { print $1 }' "${catalog_files[@]}") COMPREPLY=($(compgen -W "${packages_list}" -- $cur)) elif [[ $command == @(-r|--remove) ]]; then local packages_list=$(pkginfo | awk ' $2 ~ /^CSW/ { printf ("%s|",$2) }') packages_list=${packages_list%|} packages_list=$(nawk " \$3 ~ /^$packages_list\$/ { print \$1 }" "${catalog_files[@]}") COMPREPLY=($(compgen -W "${packages_list}" -- $cur)) fi return fi local commands="-i --install -u --upgrade -r --remove -d --download -U --catalog -a --available --describe -c --compare -C --compare-diff -A --compare-avail -e --email -t --temp -x --exclude -W --workdir -P --pkgdir -R --rootpath --config -y --yes -f --force -n --nomod -N --nodeps -D --debug --trace -h --help -v --version -V --syscheck -l --list -L --listfile -F --findfile --deptree --extract -s --stream -o --output -T --target --single -p --param --parse --cleanup --catinfo" COMPREPLY=($(compgen -W "${commands}" -- $cur)) } && complete -F _pkgutil pkgutil # ex: filetype=sh _udevadm 0000644 00000004175 15036124164 0006264 0 ustar 00 # udevadm(8) completion -*- shell-script -*- # Use of this file is deprecated. Upstream completion is available in # systemd >= 196, use that instead. _udevadm() { local cur prev words cword split _init_completion -s || return local i udevcmd for ((i = 1; i < cword; i++)); do if [[ ${words[i]} != -* ]]; then udevcmd=${words[i]} break fi done case $prev in --help | --version | --property | --children-max | --timeout | --seq-start | \ --seq-end | --attr-match | --attr-nomatch | --parent-match | --property-match | \ --tag-match | --subsystem-match | --subsystem-nomatch | --sysname-match | \ --path) return ;; --log-priority) COMPREPLY=($(compgen -W 'err info debug' -- "$cur")) return ;; --query) COMPREPLY=($(compgen -W 'name symlink path property all' \ -- "$cur")) return ;; --name) cur=${cur:=/dev/} _filedir return ;; --device-id-of-file | --exit-if-exists) _filedir return ;; --action) COMPREPLY=($(compgen -W 'add change remove' -- "$cur")) return ;; --type) COMPREPLY=($(compgen -W 'devices subsystems failed' -- "$cur")) return ;; esac $split && return if [[ ! -v udevcmd ]]; then case $cur in -*) COMPREPLY=($(compgen -W '--help --version --debug' -- "$cur")) ;; *) COMPREPLY=($(compgen -W "$("$1" --help 2>/dev/null | awk '/^[ \t]/ { print $1 }')" -- "$cur")) ;; esac return fi if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W \ '$("$1" ${udevcmd-} --help 2>/dev/null | _parse_help -)' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace fi } && complete -F _udevadm udevadm # ex: filetype=sh lzop 0000644 00000002711 15036124164 0005456 0 ustar 00 # lzop(1) completion -*- shell-script -*- _lzop() { local cur prev words cword _init_completion || return case $prev in --output | -!(-*)o) _filedir return ;; --path) _filedir -d return ;; --suffix | -!(-*)S) return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '-1 -2 -3 -4 -5 -6 -7 -8 -9 -P --fast --best --decompress --extract --test --list --ls --info --sysinfo --license --help --version --stdout --output --path --force --no-checksum --no-name --name --no-mode --no-time --suffix --keep --delete --crc32 --no-warn --ignore-warn --quiet --verbose --no-stdin --filter --checksum --no-color --mono --color' \ -- "$cur")) return fi local xspec="*.?(t)lzo" case $prev in --decompress | --uncompress | --extract | --list | --ls | --info | --test) xspec="!"$xspec ;; --force) xspec= ;; --*) ;; -*f*) xspec= ;; -*[dltx]*) xspec="!"$xspec ;; esac _tilde "$cur" || return local IFS=$'\n' compopt -o filenames COMPREPLY=($(compgen -f -X "$xspec" -- "$cur") $(compgen -d -- "$cur")) } && complete -F _lzop lzop # ex: filetype=sh grpck 0000644 00000000762 15036124164 0005604 0 ustar 00 # grpck(8) completion -*- shell-script -*- _grpck() { local cur prev words cword _init_completion || return case $prev in --root | -!(-*)R) _filedir return ;; esac if [[ $cur == -* ]]; then local opts=$(_parse_help "$1") COMPREPLY=($(compgen -W '${opts:-$(_parse_usage "$1")}' -- "$cur")) return fi _filedir } && complete -F _grpck grpck # ex: filetype=sh scriptlive 0000644 00000001372 15036124164 0006660 0 ustar 00 _scriptlive_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-c'|'--command') compopt -o bashdefault COMPREPLY=( $(compgen -c -- $cur) ) return 0 ;; '-d'|'--divisor'|'-m'|'--maxdelay') COMPREPLY=( $(compgen -W "digit" -- $cur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS="--timing --log-in --log-io --log-timing --command --divisor --maxdelay --version --help" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 } complete -F _scriptlive_module scriptlive xfreerdp 0000644 00000004064 15036124164 0006314 0 ustar 00 # xfreerdp completion -*- shell-script -*- _xfreerdp() { local cur prev words cword _init_completion -n : || return case $prev in # old/dash syntax -k) COMPREPLY=($(compgen -W '$("$1" --kbd-list | awk "/^0x/ { print \$1 }")' -- "$cur")) return ;; -a) COMPREPLY=($(compgen -W '8 15 16 24 32' -- "$cur")) return ;; -x) COMPREPLY=($(compgen -W 'broadband modem lan' -- "$cur")) return ;; --plugin) COMPREPLY=($(compgen -W 'cliprdr rdpsnd rdpdr' -- "$cur")) return ;; esac case $cur in # new/slash syntax /kbd:*) COMPREPLY=($(compgen -W '$("$1" /kbd-list | awk "/^0x/ { print \$1 }")' -- "${cur#/kbd:}")) return ;; /bpp:*) COMPREPLY=($(compgen -W '8 15 16 24 32' -- "${cur#/bpp:}")) return ;; /*:* | /help | /version | -h | --help | --version) return ;; esac if [[ $cur == /* ]]; then COMPREPLY=($(compgen -W '$("$1" --help | awk "\$1 ~ /^\\// && \$1 !~ /^.(flag\$|option:)/ { sub(\":.*\",\":\",\$1); print \$1 }")' \ -- "$cur")) [[ ${COMPREPLY-} == *: ]] && compopt -o nospace elif [[ $cur == [+-]* ]]; then local char=${cur:0:1} local help="$($1 --help)" if [[ $help == */help* ]]; then # new/slash syntax COMPREPLY=($(compgen -W '$(awk " \$1 ~ /^[+-]/ && \$1 !~ /^.toggle\$/ { sub(\"^.\",\"$char\",\$1); print \$1 } " <<<"$help")' -- "$cur")) else # old/dash syntax COMPREPLY=($(_parse_help - <<<"$help")) COMPREPLY=($(compgen -W '${COMPREPLY[@]%:}' -- "$cur")) fi else COMPREPLY=($(compgen -W "$(awk '{print $1}' ~/.freerdp/known_hosts \ 2>/dev/null)" -- "$cur")) fi } && complete -F _xfreerdp xfreerdp # ex: filetype=sh urlsnarf 0000644 00000000773 15036124164 0006334 0 ustar 00 # urlsnarf completion -*- shell-script -*- _urlsnarf() { local cur prev words cword _init_completion || return case $prev in -*i) _available_interfaces -a return ;; -*p) _filedir pcap return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_usage "$1")' -- "$cur")) fi } && complete -F _urlsnarf urlsnarf # ex: filetype=sh abook 0000644 00000002305 15036124164 0005564 0 ustar 00 # abook(1) completion -*- shell-script -*- _abook() { local cur prev words cword _init_completion || return # abook only takes options, tabbing after command name adds a single dash [[ $cword -eq 1 && -z $cur ]] && { compopt -o nospace COMPREPLY=("-") return } case $cur in -*) _longopt "$1" return ;; esac case $prev in --informat) COMPREPLY=($(compgen -W "$($1 --formats | command sed -n -e 's/^'$'\t''\([a-z]*\).*/\1/p' -e '/^$/q')" \ -- "$cur")) ;; --outformat) COMPREPLY=($(compgen -W "$($1 --formats | command sed -n -e '/^$/,$s/^'$'\t''\([a-z]*\).*/\1/p')" \ -- "$cur")) ;; --infile) COMPREPLY=($(compgen -W stdin -- "$cur")) _filedir ;; --outfile) COMPREPLY=($(compgen -W stdout -- "$cur")) _filedir ;; --config | --datafile) _filedir ;; esac } && complete -F _abook abook # ex: filetype=sh isql 0000644 00000000540 15036124164 0005440 0 ustar 00 # isql completion -*- shell-script -*- # by Victor Bogado da Silva Lins <victor@bogado.net> _isql() { local cur prev words cword _init_completion || return [[ -f $ODBCINI ]] && COMPREPLY=($(command grep "\[$cur" "$ODBCINI" | tr -d \[\])) } && complete -F _isql isql # ex: filetype=sh ethtool 0000644 00000057013 15036124164 0006155 0 ustar 00 # bash completion for ethtool(8) -*- shell-script -*- # shellcheck shell=bash disable=SC2207 # Complete a word representing a set of characters. # @param $@ chars Characters which may be present in completed set. _ethtool_compgen_letterset() { local char for char; do case "$cur" in *"$char"*) # $cur already contains $char ;; *) COMPREPLY+=( "$cur$char" ) ;; esac done } # Generate completions for words matched case-insensitively # @param $@ choices Completion choices. _ethtool_compgen_nocase() { local reset reset=$( shopt -p nocasematch ) shopt -s nocasematch local choice for choice; do case "$choice" in "$cur"*) COMPREPLY+=( "$choice" ) ;; esac done $reset } # Gets names from a section of ethtool output. # @param $1 section_bre POSIX BRE matching section heading (without : at end). # @param $@ ethtool arguments _ethtool_get_names_in_section() { local section_bre="$1" shift PATH="$PATH:/sbin:/usr/sbin:/usr/local/sbin" \ ethtool "$@" 2>/dev/null | command sed -n " # Line is section heading iff it ends with : # From requested section heading to next section heading /^$section_bre:$/,/:$/ { # If line is section heading, ignore it /:$/d # Remove value and separator, if present s/[[:space:]]*:.*// # Remove leading space, if present s/^[[:space:]]*// # Print the line p }" } # Complete an RSS Context ID _ethtool_context() { COMPREPLY=( $(PATH="$PATH:/sbin:/usr/sbin:/usr/local/sbin" \ ethtool --show-nfc "${words[2]}" 2>/dev/null | command sed -n 's/^[[:space:]]*RSS Context ID:[[:space:]]*\([0-9]*\)$/\1/p' | sort -u) ) } # Complete a network flow traffic type # Available OPTIONS: # --hash Complete only types suitable for rx hashing _ethtool_flow_type() { local types='ah4 ah6 esp4 esp6 ether sctp4 sctp6 tcp4 tcp6 udp4 udp6' if [ "${1-}" != --hash ]; then types="$types ip4 ip6" fi COMPREPLY=( $( compgen -W "$types" -- "$cur" ) ) } # Completion for ethtool --change _ethtool_change() { local -A settings=( [advertise]=notseen [autoneg]=notseen [duplex]=notseen [mdix]=notseen [msglvl]=notseen [port]=notseen [phyad]=notseen [speed]=notseen [wol]=notseen [xcvr]=notseen [lanes]=notseen ) local -A msgtypes=( [drv]=notseen [hw]=notseen [ifdown]=notseen [ifup]=notseen [intr]=notseen [link]=notseen [pktdata]=notseen [probe]=notseen [rx_err]=notseen [rx_status]=notseen [timer]=notseen [tx_done]=notseen [tx_err]=notseen [tx_queued]=notseen [wol]=notseen ) # Mark seen settings and msgtypes, and whether in msglvl sub-command local in_msglvl= local word for word in "${words[@]:3:${#words[@]}-4}"; do if [ "$in_msglvl" ] && [ "${msgtypes[$word]+set}" ]; then msgtypes[$word]=seen elif [ "${settings[$word]+set}" ]; then settings[$word]=seen if [ "$word" = msglvl ]; then in_msglvl=1 else in_msglvl= fi fi done if [ "$in_msglvl" ] && [ "${msgtypes[$prev]+set}" ]; then # All msgtypes take an on/off argument COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) ) return fi case "$prev" in advertise) # Hex number return ;; autoneg) COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) ) return ;; duplex) COMPREPLY=( $( compgen -W 'half full' -- "$cur" ) ) return ;; mdix) COMPREPLY=( $( compgen -W 'auto on off' -- "$cur" ) ) return ;; msglvl) # Unsigned integer or msgtype COMPREPLY=( $( compgen -W "${!msgtypes[*]}" -- "$cur" ) ) return ;; port) COMPREPLY=( $( compgen -W 'aui bnc fibre mii tp' -- "$cur" ) ) return ;; phyad) # Integer return ;; sopass) _mac_addresses return ;; speed) # Number return ;; wol) # $cur is a set of wol type characters. _ethtool_compgen_letterset p u m b a g s f d return ;; xcvr) COMPREPLY=( $( compgen -W 'internal external' -- "$cur" ) ) return ;; lanes) # Number return ;; esac local -a comp_words=() # Add settings not seen to completions local setting for setting in "${!settings[@]}"; do if [ "${settings[$setting]}" = notseen ]; then comp_words+=( "$setting" ) fi done # Add settings not seen to completions if [ "$in_msglvl" ]; then local msgtype for msgtype in "${!msgtypes[@]}"; do if [ "${msgtypes[$msgtype]}" = notseen ]; then comp_words+=( "$msgtype" ) fi done fi COMPREPLY=( $( compgen -W "${comp_words[*]}" -- "$cur" ) ) } # Completion for ethtool --change-eeprom _ethtool_change_eeprom() { local -A settings=( [length]=1 [magic]=1 [offset]=1 [value]=1 ) if [ "${settings[$prev]+set}" ]; then # All settings take an unsigned integer argument return fi # Remove settings which have been seen local word for word in "${words[@]:3:${#words[@]}-4}"; do unset "settings[$word]" done COMPREPLY=( $( compgen -W "${!settings[*]}" -- "$cur" ) ) } # Completion for ethtool --coalesce _ethtool_coalesce() { local -A settings=( [adaptive-rx]=1 [adaptive-tx]=1 [pkt-rate-high]=1 [pkt-rate-low]=1 [rx-frames]=1 [rx-frames-high]=1 [rx-frames-irq]=1 [rx-frames-low]=1 [rx-usecs]=1 [rx-usecs-high]=1 [rx-usecs-irq]=1 [rx-usecs-low]=1 [sample-interval]=1 [stats-block-usecs]=1 [tx-frames]=1 [tx-frames-high]=1 [tx-frames-irq]=1 [tx-frames-low]=1 [tx-usecs]=1 [tx-usecs-high]=1 [tx-usecs-irq]=1 [tx-usecs-low]=1 ) case "$prev" in adaptive-rx|\ adaptive-tx) COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) ) return ;; esac if [ "${settings[$prev]+set}" ]; then # Unsigned integer return fi # Remove settings which have been seen local word for word in "${words[@]:3:${#words[@]}-4}"; do unset "settings[$word]" done COMPREPLY=( $( compgen -W "${!settings[*]}" -- "$cur" ) ) } # Completion for ethtool --config-nfc <devname> flow-type _ethtool_config_nfc_flow_type() { if [ "$cword" -eq 4 ]; then _ethtool_flow_type --spec return fi case "$prev" in context) _ethtool_context return ;; dst|\ dst-mac|\ src) # TODO: Complete only local for dst and remote for src _mac_addresses return ;; dst-ip) # Note: RX classification, so dst is usually local case "${words[4]}" in *4) _ip_addresses -4 return ;; *6) _ip_addresses -6 return ;; esac return ;; src-ip) # Note: RX classification, so src is usually remote # TODO: Remote IP addresses (ARP cache + /etc/hosts + ?) return ;; m|\ *-mask) # MAC, IP, or integer bitmask return ;; esac local -A settings=( [action]=1 [context]=1 [loc]=1 [queue]=1 [vf]=1 ) if [ "${settings[$prev]+set}" ]; then # Integer return fi case "${words[4]}" in ah4|\ esp4) local -A fields=( [dst-ip]=1 [dst-mac]=1 [spi]=1 [src-ip]=1 [tos]=1 [user-def]=1 [vlan-etype]=1 [vlan]=1 ) ;; ah6|\ esp6) local -A fields=( [dst-ip]=1 [dst-mac]=1 [spi]=1 [src-ip]=1 [tclass]=1 [user-def]=1 [vlan-etype]=1 [vlan]=1 ) ;; ether) local -A fields=( [dst]=1 [proto]=1 [src]=1 [user-def]=1 [vlan-etype]=1 [vlan]=1 ) ;; ip4) local -A fields=( [dst-ip]=1 [dst-mac]=1 [dst-port]=1 [l4data]=1 [l4proto]=1 [spi]=1 [src-ip]=1 [src-port]=1 [tos]=1 [user-def]=1 [vlan-etype]=1 [vlan]=1 ) ;; ip6) local -A fields=( [dst-ip]=1 [dst-mac]=1 [dst-port]=1 [l4data]=1 [l4proto]=1 [spi]=1 [src-ip]=1 [src-port]=1 [tclass]=1 [user-def]=1 [vlan-etype]=1 [vlan]=1 ) ;; sctp4|\ tcp4|\ udp4) local -A fields=( [dst-ip]=1 [dst-mac]=1 [dst-port]=1 [src-ip]=1 [src-port]=1 [tos]=1 [user-def]=1 [vlan-etype]=1 [vlan]=1 ) ;; sctp6|\ tcp6|\ udp6) local -A fields=( [dst-ip]=1 [dst-mac]=1 [dst-port]=1 [src-ip]=1 [src-port]=1 [tclass]=1 [user-def]=1 [vlan-etype]=1 [vlan]=1 ) ;; *) return ;; esac if [ "${fields[$prev]+set}" ]; then # Integer return fi # If the previous 2 words were a field+value, suggest a mask local mask= if [ "${fields[${words[$cword-2]}]+set}" ]; then mask="m ${words[$cword-2]}-mask" fi # Remove fields and settings which have been seen local word for word in "${words[@]:5:${#words[@]}-6}"; do unset "fields[$word]" "settings[$word]" done # Remove mutually-exclusive options if ! [ "${settings[action]+set}" ]; then unset 'settings[queue]' 'settings[vf]' fi if ! [ "${settings[queue]+set}" ]; then unset 'settings[action]' fi if ! [ "${settings[vf]+set}" ]; then unset 'settings[action]' fi COMPREPLY=( $( compgen -W "$mask ${!fields[*]} ${!settings[*]}" -- "$cur" ) ) } # Completion for ethtool --config-nfc _ethtool_config_nfc() { if [ "$cword" -eq 3 ]; then COMPREPLY=( $( compgen -W 'delete flow-type rx-flow-hash' -- "$cur" ) ) return fi case "${words[3]}" in delete) # Unsigned integer return ;; flow-type) _ethtool_config_nfc_flow_type return ;; rx-flow-hash) case "$cword" in 4) _ethtool_flow_type --hash return ;; 5) _ethtool_compgen_letterset m v t s d f n r return ;; 6) COMPREPLY=( $( compgen -W context -- "$cur" ) ) return ;; 7) _ethtool_context return ;; esac return ;; esac } # Completion for ethtool --eeprom-dump _ethtool_eeprom_dump() { local -A settings=( [length]=1 [offset]=1 [raw]=1 ) if [ "$prev" = raw ]; then COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) ) return fi if [ "${settings[$prev]+set}" ]; then # Unsigned integer argument return fi # Remove settings which have been seen local word for word in "${words[@]:3:${#words[@]}-4}"; do unset "settings[$word]" done COMPREPLY=( $( compgen -W "${!settings[*]}" -- "$cur" ) ) } # Completion for ethtool --features _ethtool_features() { local -A abbreviations=( [generic-receive-offload]=gro [generic-segmentation-offload]=gso [large-receive-offload]=lro [ntuple-filters]=ntuple [receive-hashing]=rxhash [rx-checksumming]=rx [rx-vlan-offload]=rxvlan [scatter-gather]=sg [tcp-segmentation-offload]=tso [tx-checksumming]=tx [tx-vlan-offload]=txvlan [udp-fragmentation-offload]=ufo ) local -A features=() local feature status fixed # shellcheck disable=SC2034 while read -r feature status fixed; do if [ -z "$feature" ]; then # Ignore blank line from empty expansion in here-document continue fi if [ "$feature" = Features ]; then # Ignore heading continue fi if [ "$fixed" = '[fixed]' ]; then # Fixed features can't be changed continue fi feature=${feature%:} if [ "${abbreviations[$feature]+set}" ]; then features[${abbreviations[$feature]}]=1 else features[$feature]=1 fi done <<ETHTOOL_FEATURES $(PATH="$PATH:/sbin:/usr/sbin:/usr/local/sbin" \ ethtool --show-features "${words[2]}" 2>/dev/null) ETHTOOL_FEATURES if [ "${features[$prev]+set}" ]; then COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) ) return fi # Remove features which have been seen local word for word in "${words[@]:3:${#words[@]}-4}"; do unset "features[$word]" done COMPREPLY=( $( compgen -W "${!features[*]}" -- "$cur" ) ) } # Complete the current word as a kernel firmware file (for request_firmware) # See https://www.kernel.org/doc/html/latest/driver-api/firmware/core.html _ethtool_firmware() { local -a firmware_paths=( /lib/firmware/updates/ /lib/firmware/ ) local release if release=$( uname -r 2>/dev/null ); then firmware_paths+=( "/lib/firmware/updates/$release/" "/lib/firmware/$release/" ) fi local fw_path_para if fw_path_para=$( cat /sys/module/firmware_class/parameters/path 2>/dev/null ) \ && [ -n "$fw_path_para" ]; then firmware_paths+=( "$fw_path_para" ) fi local -A firmware_files=() local firmware_path for firmware_path in "${firmware_paths[@]}"; do local firmware_file for firmware_file in "$firmware_path"*; do if [ -f "$firmware_file" ]; then firmware_files[${firmware_file##*/}]=1 fi done done local IFS=' ' COMPREPLY=( $( compgen -W "${!firmware_files[*]}" -- "$cur" ) ) } # Completion for ethtool --flash _ethtool_flash() { if [ "$cword" -eq 3 ]; then _ethtool_firmware return fi } # Completion for ethtool --get-dump _ethtool_get_dump() { case "$cword" in 3) COMPREPLY=( $( compgen -W data -- "$cur" ) ) return ;; 4) # Output filename local IFS=' ' COMPREPLY=( $( compgen -f -- "$cur" ) ) return ;; esac } # Completion for ethtool --get-phy-tunable _ethtool_get_phy_tunable() { if [ "$cword" -eq 3 ]; then COMPREPLY=( $( compgen -W downshift -- "$cur" ) ) return fi } # Completion for ethtool --module-info _ethtool_module_info() { local -A settings=( [hex]=1 [length]=1 [offset]=1 [raw]=1 ) case "$prev" in hex|\ raw) COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) ) return ;; esac if [ "${settings[$prev]+set}" ]; then # Unsigned integer argument return fi # Remove settings which have been seen local word for word in "${words[@]:3:${#words[@]}-4}"; do unset "settings[$word]" done COMPREPLY=( $( compgen -W "${!settings[*]}" -- "$cur" ) ) } # Completion for ethtool --pause _ethtool_pause() { local -A settings=( [autoneg]=1 [rx]=1 [tx]=1 ) if [ "${settings[$prev]+set}" ]; then COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) ) return fi # Remove settings which have been seen local word for word in "${words[@]:3:${#words[@]}-4}"; do unset "settings[$word]" done COMPREPLY=( $( compgen -W "${!settings[*]}" -- "$cur" ) ) } # Completion for ethtool --per-queue _ethtool_per_queue() { local -a subcommands=( --coalesce --show-coalesce ) if [ "$cword" -eq 3 ]; then COMPREPLY=( $( compgen -W "queue_mask ${subcommands[*]}" -- "$cur" ) ) return fi local sc_start=3 if [ "${words[3]}" = queue_mask ] ; then case "$cword" in 4) # Hex number return ;; 5) COMPREPLY=( $( compgen -W "${subcommands[*]}" -- "$cur" ) ) return ;; esac sc_start=5 fi case "${words[$sc_start]}" in --coalesce) # Remove --per-queue args to match normal --coalesce invocation local words=( "${words[0]}" --coalesce "${words[2]}" "${words[@]:$sc_start+1:${#words[@]}-$sc_start-1}" ) _ethtool_coalesce return ;; --show-coalesce) # No args return ;; esac } # Completion for ethtool --register-dump _ethtool_register_dump() { local -A settings=( [file]=1 [hex]=1 [raw]=1 ) case "$prev" in hex|\ raw) COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) ) return ;; file) local IFS=' ' COMPREPLY=( $( compgen -f -- "$cur" ) ) return ;; esac # Remove settings which have been seen local word for word in "${words[@]:3:${#words[@]}-4}"; do unset "settings[$word]" done COMPREPLY=( $( compgen -W "${!settings[*]}" -- "$cur" ) ) } # Completion for ethtool --reset _ethtool_reset() { if [ "$prev" = flags ]; then # Unsigned integer return fi local -A flag_names=( [ap]=1 [dma]=1 [filter]=1 [irq]=1 [mac]=1 [mgmt]=1 [offload]=1 [phy]=1 [ram]=1 ) local -A all_flag_names=() local flag_name for flag_name in "${!flag_names[@]}"; do all_flag_names[$flag_name]=1 all_flag_names[$flag_name-shared]=1 done # Remove all_flag_names which have been seen local any_dedicated= local word for word in "${words[@]:3:${#words[@]}-4}"; do case "$word" in all) # Flags are always additive. # Nothing to add after "all". return ;; dedicated) any_dedicated=1 # "dedicated" sets all non-shared flags for flag_name in "${!flag_names[@]}"; do unset "all_flag_names[$flag_name]" done continue ;; esac if [ "${flag_names[$word]+set}" ]; then any_dedicated=1 fi unset "all_flag_names[$word]" done COMPREPLY=( $( compgen -W "${!all_flag_names[*]}" -- "$cur" ) ) # Although it is permitted to mix named and un-named flags or duplicate # flags with "all" or "dedicated", it's not likely intentional. # Reconsider if a real use-case (or good consistency argument) is found. if [ "$cword" -eq 3 ]; then COMPREPLY+=( all dedicated flags ) elif [ -z "$any_dedicated" ]; then COMPREPLY+=( dedicated ) fi } # Completion for ethtool --rxfh _ethtool_rxfh() { local -A settings=( [context]=1 [default]=1 [delete]=1 [equal]=1 [hfunc]=1 [hkey]=1 [weight]=1 ) case "$prev" in context) _ethtool_context # "new" to create a new context COMPREPLY+=( new ) return ;; equal) # Positive integer return ;; hfunc) # Complete available RSS hash functions COMPREPLY=( $(_ethtool_get_names_in_section 'RSS hash function' \ --show-rxfh "${words[2]}") ) return ;; hkey) # Pairs of hex digits separated by : return ;; weight) # Non-negative integer return ;; esac local word for word in "${words[@]:3:${#words[@]}-4}"; do # Remove settings which have been seen unset "settings[$word]" # Remove settings which are mutually-exclusive with seen settings case "$word" in context) unset 'settings[default]' ;; default) unset \ 'settings[context]' \ 'settings[delete]' \ 'settings[equal]' \ 'settings[weight]' ;; delete) unset \ 'settings[default]' \ 'settings[equal]' \ 'settings[hkey]' \ 'settings[weight]' ;; equal) unset \ 'settings[default]' \ 'settings[delete]' \ 'settings[weight]' ;; hkey) unset 'settings[delete]' ;; weight) unset \ 'settings[default]' \ 'settings[delete]' \ 'settings[equal]' ;; esac done COMPREPLY=( $( compgen -W "${!settings[*]}" -- "$cur" ) ) } # Completion for ethtool --set-channels _ethtool_set_channels() { local -A settings=( [combined]=1 [other]=1 [rx]=1 [tx]=1 ) if [ "${settings[$prev]+set}" ]; then # Unsigned integer argument return fi # Remove settings which have been seen local word for word in "${words[@]:3:${#words[@]}-4}"; do unset "settings[$word]" done COMPREPLY=( $( compgen -W "${!settings[*]}" -- "$cur" ) ) } # Completion for ethtool --set-eee _ethtool_set_eee() { local -A settings=( [advertise]=1 [eee]=1 [tx-lpi]=1 [tx-timer]=1 ) case "$prev" in advertise|\ tx-timer) # Unsigned integer return ;; eee|\ tx-lpi) COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) ) return ;; esac # Remove settings which have been seen local word for word in "${words[@]:3:${#words[@]}-4}"; do unset "settings[$word]" done COMPREPLY=( $( compgen -W "${!settings[*]}" -- "$cur" ) ) } # Completion for ethtool --set-fec _ethtool_set_fec() { if [ "$cword" -eq 3 ]; then COMPREPLY=( $( compgen -W encoding -- "$cur" ) ) return fi local -A modes=( [auto]=auto [rs]=RS [off]=off [baser]=BaseR ) # Remove modes which have been seen local word for word in "${words[@]:3:${#words[@]}-4}"; do # ethtool recognizes modes case-insensitively unset "modes[${word,,}]" done _ethtool_compgen_nocase "${modes[@]}" } # Completion for ethtool --set-phy-tunable _ethtool_set_phy_tunable() { case "$cword" in 3) COMPREPLY=( $( compgen -W downshift -- "$cur" ) ) return ;; 4) COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) ) return ;; 5) COMPREPLY=( $( compgen -W count -- "$cur" ) ) return ;; esac } # Completion for ethtool --set-priv-flags _ethtool_set_priv_flags() { if [ $(( cword % 2 )) -eq 0 ]; then COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) ) return fi # Get available private flags local -A flags=() local flag while IFS= read -r flag; do # Ignore blank line from empty here-document if [ -n "$flag" ]; then flags[$flag]=1 fi done <<ETHTOOL_PRIV_FLAGS $(_ethtool_get_names_in_section \ 'Private flags for [[:graph:]]*' --show-priv-flags "${words[2]}") ETHTOOL_PRIV_FLAGS # Remove flags which have been seen local word for word in "${words[@]:3:${#words[@]}-4}"; do unset "flags[$word]" done COMPREPLY=( $( compgen -W "${!flags[*]}" -- "$cur" ) ) } # Completion for ethtool --set-ring _ethtool_set_ring() { local -A settings=( [rx-jumbo]=1 [rx-mini]=1 [rx]=1 [tx]=1 ) if [ "${settings[$prev]+set}" ]; then # Unsigned integer argument return fi # Remove settings which have been seen local word for word in "${words[@]:3:${#words[@]}-4}"; do unset "settings[$word]" done COMPREPLY=( $( compgen -W "${!settings[*]}" -- "$cur" ) ) } # Completion for ethtool --show-nfc _ethtool_show_nfc() { if [ "$cword" -eq 3 ]; then COMPREPLY=( $( compgen -W 'rule rx-flow-hash' -- "$cur" ) ) return fi case "${words[3]}" in rule) if [ "$cword" -eq 4 ]; then COMPREPLY=( $(PATH="$PATH:/sbin:/usr/sbin:/usr/local/sbin" \ ethtool --show-nfc "${words[2]}" 2>/dev/null | command sed -n 's/^Filter:[[:space:]]*\([0-9]*\)$/\1/p') ) fi return ;; rx-flow-hash) case "$cword" in 4) _ethtool_flow_type --hash return ;; 5) COMPREPLY=( $( compgen -W context -- "$cur" ) ) return ;; 6) _ethtool_context return ;; esac ;; esac } # Completion for ethtool --show-rxfh _ethtool_show_rxfh() { case "$cword" in 3) COMPREPLY=( $( compgen -W context -- "$cur" ) ) return ;; 4) _ethtool_context return ;; esac } # Completion for ethtool --test _ethtool_test() { if [ "$cword" -eq 3 ]; then COMPREPLY=( $( compgen -W 'external_lb offline online' -- "$cur" ) ) return fi } # Complete any ethtool command _ethtool() { local cur prev words cword _init_completion || return # Per "Contributing to bash-completion", complete non-duplicate long opts local -A suggested_funcs=( [--change-eeprom]=change_eeprom [--change]=change [--coalesce]=coalesce [--config-nfc]=config_nfc [--driver]=devname [--dump-module-eeprom]=module_info [--eeprom-dump]=eeprom_dump [--features]=features [--flash]=flash [--get-dump]=get_dump [--get-phy-tunable]=get_phy_tunable [--identify]=devname [--module-info]=module_info [--negotiate]=devname [--offload]=features [--pause]=pause [--per-queue]=per_queue [--phy-statistics]=devname [--register-dump]=register_dump [--reset]=reset [--set-channels]=set_channels [--set-dump]=devname [--set-eee]=set_eee [--set-fec]=set_fec [--set-phy-tunable]=set_phy_tunable [--set-priv-flags]=set_priv_flags [--set-ring]=set_ring [--set-rxfh-indir]=rxfh [--show-channels]=devname [--show-coalesce]=devname [--show-eee]=devname [--show-features]=devname [--show-fec]=devname [--show-nfc]=show_nfc [--show-offload]=devname [--show-pause]=devname [--show-permaddr]=devname [--show-priv-flags]=devname [--show-ring]=devname [--show-rxfh]=show_rxfh [--show-time-stamping]=devname [--statistics]=devname [--test]=test ) local -A other_funcs=( [--config-ntuple]=config_nfc [--rxfh]=rxfh [--show-ntuple]=show_nfc [--show-rxfh-indir]=devname [-A]=pause [-C]=coalesce [-E]=change_eeprom [-G]=set_ring [-K]=features [-L]=set_channels [-N]=config_nfc [-P]=devname [-Q]=per_queue [-S]=devname [-T]=devname [-U]=config_nfc [-W]=devname [-X]=rxfh [-a]=devname [-c]=devname [-d]=register_dump [-e]=eeprom_dump [-f]=flash [-g]=devname [-i]=devname [-k]=devname [-l]=devname [-m]=module_info [-n]=show_nfc [-p]=devname [-r]=devname [-s]=change [-t]=test [-u]=show_nfc [-w]=get_dump [-x]=devname ) if [ "$cword" -le 1 ]; then _available_interfaces COMPREPLY+=( $( compgen -W "--help --version ${!suggested_funcs[*]}" -- "$cur" ) ) return fi local func=${suggested_funcs[${words[1]}]-${other_funcs[${words[1]}]-}} if [ "$func" ]; then # All sub-commands have devname as their first argument if [ "$cword" -eq 2 ]; then _available_interfaces return fi if [ "$func" != devname ]; then "_ethtool_$func" fi fi } && complete -F _ethtool ethtool # ex: filetype=sh sts=8 sw=8 ts=8 noet synclient 0000644 00000001120 15036124164 0006473 0 ustar 00 # bash completion for synclient(1) -*- shell-script -*- _synclient() { local cur prev words cword _init_completion -n = || return case $prev in -\? | -h | -V) return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_usage "$1")' -- "$cur")) elif [[ $cur != *=?* ]]; then COMPREPLY=($(compgen -S = -W '$($1 -l 2>/dev/null | \ awk "/^[ \t]/ { print \$1 }")' -- "$cur")) compopt -o nospace fi } && complete -F _synclient synclient # ex: filetype=sh xvfb-run 0000644 00000001566 15036124164 0006250 0 ustar 00 # bash completion for xvfb-run -*- shell-script -*- _xvfb_run() { local cur prev words cword split _init_completion -s || return local i for ((i = 1; i <= COMP_CWORD; i++)); do if [[ ${COMP_WORDS[i]} != -* ]]; then _command_offset $i return fi [[ ${COMP_WORDS[i]} == -!(-*)[npsef] ]] && ((i++)) done case $prev in --help | --server-num | --xauth-protocol | --server-args | -!(-*)[hnps]) return ;; --error-file | --auth-file | -!(-*)[ef]) _filedir return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace fi } && complete -F _xvfb_run xvfb-run # ex: filetype=sh crontab 0000644 00000002247 15036124164 0006126 0 ustar 00 # crontab(1) completion -*- shell-script -*- _crontab() { local cur prev words cword _init_completion || return case $prev in -*u) _allowed_users return ;; esac local -A opts=([-u]="" [-l]="" [-r]="" [-e]="") [[ $OSTYPE == *linux* ]] && opts[-i]= [[ -d /sys/fs/selinux || -d /selinux ]] && opts[-s]= local i for i in "${!words[@]}"; do [[ ${words[i]} && $i -ne $cword ]] && unset "opts[${words[i]}]" case "${words[i]}" in -l) unset 'opts[-r]' 'opts[-e]' 'opts[-i]' 'opts[-s]' ;; -e) unset 'opts[-l]' 'opts[-r]' 'opts[-i]' ;; -r) unset 'opts[-l]' 'opts[-e]' ;; -u) unset 'opts[-i]' ;; esac done if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '${!opts[@]}' -- "$cur")) return fi # do filenames only if we did not have -l, -r, or -e [[ ${words[*]} == *\ -[lre]* ]] || _filedir } && complete -F _crontab crontab # ex: filetype=sh nslookup 0000644 00000003742 15036124164 0006351 0 ustar 00 # bash completion for nslookup -*- shell-script -*- _bind_queryclass() { COMPREPLY+=($(compgen -W 'IN CH HS ANY' -- "$cur")) } _bind_querytype() { # https://en.wikipedia.org/wiki/List_of_DNS_record_types COMPREPLY+=($(compgen -W 'A AAAA AFSDB APL CERT CNAME DHCID DLV DNAME DNSKEY DS HIP IPSECKEY KEY KX LOC MX NAPTR NS NSEC NSEC3 NSEC3PARAM PTR RRSIG RP SIG SOA SPF SRV SSHFP TXT' -- "$cur")) } _nslookup() { local cur prev words cword _init_completion -n = || return case $cur in -class=* | -cl=*) cur=${cur#*=} _bind_queryclass return ;; -querytype=* | -type=* | -q=* | -ty=*) cur=${cur#*=} _bind_querytype return ;; -?*=*) return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '-all -class= -debug -nodebug -d2 -nod2 -domain= -search -nosearch -port= -querytype= -recurse -norecurse -retry= -timeout= -vc -novc -fail -nofail' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return fi local args _count_args = if ((args <= 2)); then _known_hosts_real -- "$cur" [[ $args -eq 1 && $cur == @(|-) ]] && COMPREPLY+=(-) fi } && complete -F _nslookup nslookup _host() { local cur prev words cword _init_completion || return case $prev in -c) _bind_queryclass return ;; -t) _bind_querytype return ;; -m) COMPREPLY=($(compgen -W 'trace record usage' -- "$cur")) return ;; -N | -R | -W) return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_usage "$1")' -- "$cur")) return fi _known_hosts_real -- "$cur" } && complete -F _host host # ex: filetype=sh pwck 0000644 00000000602 15036124164 0005433 0 ustar 00 # pwck(8) completion -*- shell-script -*- _pwck() { local cur prev words cword _init_completion || return if [[ $cur == -* ]]; then local opts=$(_parse_help "$1") COMPREPLY=($(compgen -W '${opts:-$(_parse_usage "$1")}' -- "$cur")) return fi _filedir } && complete -F _pwck pwck # ex: filetype=sh wdctl 0000644 00000002533 15036124164 0005611 0 ustar 00 _wdctl_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-f'|'--flags') local FLAGS FLAGS="ALARMONLY CARDRESET EXTERN1 EXTERN2 FANFAULT KEEPALIVEPING MAGICCLOSE OVERHEAT POWEROVER POWERUNDER PRETIMEOUT SETTIMEOUT" COMPREPLY=( $(compgen -W "$FLAGS" -- $cur) ) return 0 ;; '-o'|'--output') local prefix realcur OUTPUT_ALL OUTPUT realcur="${cur##*,}" prefix="${cur%$realcur}" OUTPUT_ALL="FLAG DESCRIPTION STATUS BOOT-STATUS DEVICE" for WORD in $OUTPUT_ALL; do if ! [[ $prefix == *"$WORD"* ]]; then OUTPUT="$WORD ${OUTPUT:-""}" fi done compopt -o nospace COMPREPLY=( $(compgen -P "$prefix" -W "$OUTPUT" -S ',' -- $realcur) ) return 0 ;; '-s'|'--settimeout') COMPREPLY=( $(compgen -W "seconds" -- $cur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS="--flags --noflags --noident --noheadings --oneline --output --raw --notimeouts --settimeout --flags-only --help --version" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- ${cur:-"/dev/"}) ) return 0 } complete -F _wdctl_module wdctl cpan2dist 0000644 00000002302 15036124164 0006355 0 ustar 00 # bash completion for cpan2dist -*- shell-script -*- _cpan2dist() { local cur prev words cword _init_completion || return case $prev in --format) # should remove ":" from COMP_WORDBREAKS, but doesn't work (?) COMPREPLY=($(compgen -W '$(perl -MCPANPLUS::Dist -e \ "print map { \"\$_\n\" } CPANPLUS::Dist->dist_types")' \ -- "$cur")) return ;; --banlist | --ignorelist | --modulelist | --logfile) _filedir return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) else local cpandirs=("$HOME/.cpanplus/" "$HOME/.cpan/source/modules/") local packagelist for dir in "${cpandirs[@]}"; do [[ -d $dir && -r "$dir/02packages.details.txt.gz" ]] && packagelist="$dir/02packages.details.txt.gz" done [[ -v packagelist ]] && COMPREPLY=($(zgrep "^${cur//-/::}" \ $packagelist 2>/dev/null | awk '{print $1}' | command sed -e 's/::/-/g')) fi } && complete -F _cpan2dist -o default cpan2dist # ex: filetype=sh cloud-init 0000644 00000006617 15036124164 0006552 0 ustar 00 # Copyright (C) 2018 Canonical Ltd. # # This file is part of cloud-init. See LICENSE file for license information. # bash completion for cloud-init cli _cloudinit_complete() { local cur_word prev_word cur_word="${COMP_WORDS[COMP_CWORD]}" prev_word="${COMP_WORDS[COMP_CWORD-1]}" subcmds="analyze clean collect-logs devel dhclient-hook features init modules query schema single status" base_params="--help --file --version --debug --force" case ${COMP_CWORD} in 1) COMPREPLY=($(compgen -W "$base_params $subcmds" -- $cur_word)) ;; 2) case ${prev_word} in analyze) COMPREPLY=($(compgen -W "--help blame dump show" -- $cur_word)) ;; clean) COMPREPLY=($(compgen -W "--help --logs --reboot --seed" -- $cur_word)) ;; collect-logs) COMPREPLY=($(compgen -W "--help --tarfile --include-userdata" -- $cur_word)) ;; devel) COMPREPLY=($(compgen -W "--help hotplug-hook net-convert" -- $cur_word)) ;; dhclient-hook) COMPREPLY=($(compgen -W "--help up down" -- $cur_word)) ;; features) COMPREPLY=($(compgen -W "--help" -- $cur_word)) ;; init) COMPREPLY=($(compgen -W "--help --local" -- $cur_word)) ;; modules) COMPREPLY=($(compgen -W "--help --mode" -- $cur_word)) ;; query) COMPREPLY=($(compgen -W "--all --help --instance-data --list-keys --user-data --vendor-data --debug" -- $cur_word));; schema) COMPREPLY=($(compgen -W "--help --config-file --docs --annotate --system" -- $cur_word)) ;; single) COMPREPLY=($(compgen -W "--help --name --frequency --report" -- $cur_word)) ;; status) COMPREPLY=($(compgen -W "--help --long --wait" -- $cur_word)) ;; esac ;; 3) case ${prev_word} in blame|dump) COMPREPLY=($(compgen -W "--help --infile --outfile" -- $cur_word)) ;; --mode) COMPREPLY=($(compgen -W "--help init config final" -- $cur_word)) ;; --frequency) COMPREPLY=($(compgen -W "--help instance always once" -- $cur_word)) ;; hotplug-hook) COMPREPLY=($(compgen -W "--help" -- $cur_word)) ;; net-convert) COMPREPLY=($(compgen -W "--help --network-data --kind --directory --output-kind" -- $cur_word)) ;; render) COMPREPLY=($(compgen -W "--help --instance-data --debug" -- $cur_word));; show) COMPREPLY=($(compgen -W "--help --format --infile --outfile" -- $cur_word)) ;; esac ;; *) COMPREPLY=() ;; esac } complete -F _cloudinit_complete cloud-init # vi: syntax=sh expandtab check_db 0000644 00000000566 15036124164 0006222 0 ustar 00 # mailman check_db completion -*- shell-script -*- _check_db() { local cur prev words cword _init_completion || return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '--all --verbose --help' -- "$cur")) else _xfunc list_lists _mailman_lists fi } && complete -F _check_db check_db # ex: filetype=sh ctrlaltdel 0000644 00000000517 15036124164 0006626 0 ustar 00 _ctrlaltdel_module() { local cur prev COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-h'|'--help'|'-V'|'--version') return 0 ;; esac if [ $COMP_CWORD -eq 1 ]; then COMPREPLY=( $(compgen -W "hard soft" -- $cur) ) fi return 0 } complete -F _ctrlaltdel_module ctrlaltdel chgrp 0000644 00000001654 15036124164 0005602 0 ustar 00 # chgrp(1) completion -*- shell-script -*- _chgrp() { local cur prev words cword split _init_completion -s || return cur=${cur//\\\\/} if [[ $prev == --reference ]]; then _filedir return fi $split && return # options completion if [[ $cur == -* ]]; then local w opts for w in "${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 fi # first parameter on line or first since an option? if [[ $cword -eq 1 && $cur != -* || $prev == -* ]]; then _allowed_groups "$cur" else _filedir fi } && complete -F _chgrp chgrp # ex: filetype=sh iconv 0000644 00000001637 15036124164 0005616 0 ustar 00 # iconv(1) completion -*- shell-script -*- _iconv_charsets() { COMPREPLY+=($(compgen -X ... -W '$(${1:-iconv} -l | \ command sed -e "s@/*\$@@" -e "s/[,()]//g")' -- "$cur")) } _iconv() { local cur prev words cword split _init_completion -s || return case $prev in --help | --usage | --version | --unicode-subst | --byte-subst | \ --widechar-subst | -!(-*)[?V]) return ;; --from-code | --to-code | -!(-*)[ft]) _iconv_charsets $1 return ;; --output | -!(-*)o) _filedir return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace fi } && complete -F _iconv -o default iconv # ex: filetype=sh mc 0000644 00000001261 15036124164 0005070 0 ustar 00 # bash completion for mc -*- shell-script -*- _mc() { local cur prev words cword split _init_completion -s || return case $prev in --edit | --view | --ftplog | --printwd | -!(-*)[evlP]) _filedir return ;; --help | --help-* | --version | --colors | --debuglevel | -!(-*)[hVCD]) return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1" --help-all)' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace else _filedir -d fi } && complete -F _mc mc # ex: filetype=sh rsync 0000644 00000006747 15036124164 0005645 0 ustar 00 # bash completion for rsync -*- shell-script -*- _rsync() { local cur prev words cword split _init_completion -s -n : || return case $prev in --config | --password-file | --include-from | --exclude-from | --files-from | \ --log-file | --write-batch | --only-write-batch | --read-batch) compopt +o nospace _filedir return ;; --temp-dir | --compare-dest | --backup-dir | --partial-dir | --copy-dest | \ --link-dest | -!(-*)T) compopt +o nospace _filedir -d return ;; --rsh | -!(-*)e) compopt +o nospace COMPREPLY=($(compgen -W 'rsh ssh' -- "$cur")) return ;; --compress-level) compopt +o nospace COMPREPLY=($(compgen -W '{1..9}' -- "$cur")) return ;; esac $split && return _expand || return 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")) [[ ${COMPREPLY-} == *= ]] || compopt +o nospace ;; *:*) # find which remote shell is used local i shell=ssh for ((i = 1; i < cword; i++)); do if [[ ${words[i]} == -@(e|-rsh) ]]; then shell=${words[i + 1]} break fi done [[ $shell == ssh ]] && _xfunc ssh _scp_remote_files ;; *) _known_hosts_real -c -a -- "$cur" _xfunc ssh _scp_local_files ;; esac } && complete -F _rsync -o nospace rsync # ex: filetype=sh _repomanage 0000644 00000001136 15036124164 0006747 0 ustar 00 # bash completion for repomanage -*- shell-script -*- # Use of this file is deprecated. Upstream completion is available in # yum-utils >= 1.1.24, use that instead. _repomanage() { local cur prev words cword split _init_completion -s || return [[ $prev == -@([hk]|-help|-keep) ]] && return $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace else _filedir -d fi } && complete -F _repomanage repomanage # ex: filetype=sh portsnap 0000644 00000000762 15036124164 0006344 0 ustar 00 # bash completion for Portsnap -*- shell-script -*- [[ $OSTYPE == *freebsd* ]] || return 1 _portsnap() { local cur prev words cword _init_completion || return case $prev in -d | -p) _filedir -d return ;; -l | -f) _filedir return ;; esac COMPREPLY=($(compgen -W "fetch cron extract update" -- $cur)) } && complete -F _portsnap portsnap # ex: filetype=sh autoconf 0000644 00000001706 15036124164 0006313 0 ustar 00 # autoconf(1) completion -*- shell-script -*- _autoconf() { local cur prev words cword split _init_completion -s || return case "$prev" in --help | -h | --version | -V | --trace | -t) return ;; --output | -o) _filedir return ;; --warnings | -W) local cats=(cross obsolete syntax) COMPREPLY=($(compgen -W \ '${cats[@]} ${cats[@]/#/no-} all none error' -- "$cur")) return ;; --prepend-include | -B | --include | -I) _filedir -d return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return fi _filedir '@(ac|in)' } && complete -F _autoconf autoconf # ex: filetype=sh ssh-keygen 0000644 00000007430 15036124164 0006552 0 ustar 00 # ssh-keygen(1) completion -*- shell-script -*- _ssh_keygen() { local cur prev words cword _init_completion -n := || return case $prev in -*[aCIJjMNPSVWz]) return ;; -*b) local -a sizes case "${words[*]}" in *" -t dsa"?( *)) sizes=(1024) ;; *" -t ecdsa"?( *)) sizes=(256 384 521) ;; *" -t rsa"?( *)) sizes=(1024 2048 3072 4096) ;; esac COMPREPLY=($(compgen -W '${sizes[@]}' -- "$cur")) return ;; -*E) COMPREPLY=($(compgen -W 'md5 sha256' -- "$cur")) return ;; -*[FR]) # TODO: trim this down to actual entries in known hosts files _known_hosts_real -- "$cur" return ;; -*[Dw]) _filedir so return ;; -*[fGKsT]) _filedir return ;; -*m) COMPREPLY=($(compgen -W 'PEM PKCS8 RFC4716' -- "$cur")) return ;; -*n) [[ ${words[*]} != *\ -*Y\ * ]] || return local prefix= [[ $cur == *,* ]] && prefix="${cur%,*}," if [[ ${words[*]} == *\ -*h\ * ]]; then _known_hosts_real -- "${cur##*,}" else COMPREPLY=($(compgen -u -- "${cur##*,}")) fi ((${#COMPREPLY[@]} == 1)) && COMPREPLY=(${COMPREPLY/#/$prefix}) return ;; -*O) if [[ $cur != *=* ]]; then COMPREPLY=($(compgen -W ' clear critical: extension: force-command= no-agent-forwarding no-port-forwarding no-pty no-user-rc no-x11-forwarding permit-agent-forwarding permit-port-forwarding permit-pty permit-user-rc permit-X11-forwarding no-touch-required source-address= lines= start-line= checkpoint= memory= start= generator= application challenge= device resident user write-attestation-path ' -- "$cur")) [[ ${COMPREPLY-} == *[:=] ]] && compopt -o nospace __ltrim_colon_completions "$cur" else case $cur in force-command=*) compopt -o filenames COMPREPLY=($(compgen -c -- "${cur#*=}")) ;; checkpoint=* | challenge=*) cur=${cur#*=} _filedir ;; esac fi return ;; -*r) [[ ${words[*]} != *\ -*Y\ * ]] || _filedir return ;; -*t) local protocols=$(_xfunc ssh _ssh_query "$1" protocol-version) local types='dsa ecdsa ecdsa-sk ed25519 ed25519-sk rsa' if [[ $protocols == *1* ]]; then types+=' rsa1' fi COMPREPLY=($(compgen -W "$types" -- "$cur")) return ;; -*Y) COMPREPLY=($(compgen -W 'find-principals check-novalidate sign verify' -- "$cur")) return ;; esac if [[ $cur == -* ]]; then local opts=$(_parse_usage "$1" "-?") [[ -z $opts ]] && opts=$(_parse_help "$1" "-?") # OpenSSH < 7 COMPREPLY=($(compgen -W "$opts" -- "$cur")) fi if [[ ${words[*]} == *\ -*s\ * ]]; then _filedir pub fi } && complete -F _ssh_keygen ssh-keygen # ex: filetype=sh pwdx 0000644 00000000751 15036124164 0005456 0 ustar 00 # pwdx(1) completion -*- shell-script -*- _pwdx() { local cur prev words cword _init_completion || return case $prev in -h | --help | -V | --version) return ;; esac if [[ $cur == -* ]]; then local help='$(_parse_help "$1")' [[ $help ]] || help=-V COMPREPLY=($(compgen -W "$help" -- "$cur")) else _pids fi } && complete -F _pwdx pwdx # ex: filetype=sh systemd-delta 0000644 00000003375 15036124164 0007260 0 ustar 00 # systemd-delta(1) completion -*- shell-script -*- # SPDX-License-Identifier: LGPL-2.1-or-later # # This file is part of systemd. # # systemd is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version. # # systemd is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with systemd; If not, see <http://www.gnu.org/licenses/>. __contains_word() { local w word=$1; shift for w in "$@"; do [[ $w = "$word" ]] && return done } _systemd-delta() { local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} words cword local comps local -A OPTS=( [STANDALONE]='--help -h --no-pager --version' [ARG]='--diff --type -t' ) _init_completion || return if __contains_word "$prev" ${OPTS[ARG]}; then case $prev in --diff) comps='yes no' ;; --type|-t) comps='masked equivalent redirected overridden unchanged extended default' ;; esac COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 fi if [[ "$cur" = -* ]] || [[ -z ${comps-} ]]; then COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") ) return 0 fi COMPREPLY=( $(compgen -W '${comps-}' -- "$cur") ) return 0 } complete -F _systemd-delta systemd-delta wvdial 0000644 00000002377 15036124164 0005770 0 ustar 00 # bash completion for wvdial -*- shell-script -*- _wvdial() { local cur prev words cword split _init_completion -s || return case $prev in --config) _filedir return ;; esac $split && return local config i IFS=$'\n' case $cur in -*) COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace ;; *) # start with global and personal config files config="/etc/wvdial.conf"$'\n'"$HOME/.wvdialrc" # replace with command line config file if present for ((i = 1; i < cword; i++)); do if [[ ${words[i]} == "--config" ]]; then config=${words[i + 1]} break fi done # parse config files for sections and # remove default section COMPREPLY=($(command sed -ne "s|^\[Dialer \($cur.*\)\]$|\1|p" $config \ 2>/dev/null | command grep -v '^Defaults$')) # escape spaces COMPREPLY=(${COMPREPLY[@]// /\\ }) ;; esac } && complete -F _wvdial wvdial # ex: filetype=sh _svn 0000644 00000021262 15036124164 0005441 0 ustar 00 # svn completion -*- shell-script -*- # Use of this file is deprecated. Upstream completion is available in # subversion >= 0.12.0, use that instead. _svn() { local cur prev words cword _init_completion || return local commands 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 ((cword == 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 ;; -F | --file | --targets) _filedir return ;; --encoding) _xfunc iconv _iconv_charsets return ;; --editor-cmd | --diff-cmd | --diff3-cmd) compopt -o filenames COMPREPLY=($(compgen -c -- "$cur")) return ;; esac local command=${words[1]} if [[ $cur == -* ]]; then # possible options for the command local options case $command in add) options='--auto-props --no-auto-props --force --targets --no-ignore --non-recursive --quiet' ;; blame | annotate | ann | praise) options='--revision --username --password --no-auth-cache --non-interactive --verbose --incremental --xml' ;; cat) options='--revision --username --password --no-auth-cache --non-interactive' ;; checkout | co) options='--revision --quiet --non-recursive --username --password --no-auth-cache --non-interactive --ignore-externals' ;; cleanup) options='--diff3-cmd' ;; commit | ci) options='--message --file --encoding --force-log --quiet --non-recursive --targets --editor-cmd --username --password --no-auth-cache --non-interactive --no-unlock' ;; copy | cp) options='--message --file --encoding --force-log --revision --quiet --editor-cmd -username --password --no-auth-cache --non-interactive' ;; delete | del | remove | rm) options='--force --message --file --encoding --force-log --quiet --targets --editor-cmd --username --password --no-auth-cache --non-interactive' ;; diff | di) options='--revision --extensions --diff-cmd --no-diff-deleted --non-recursive --username --password --no-auth-cache --non-interactive --force --old --new --notice-ancestry' ;; export) options='--revision --quiet --username --password --no-auth-cache --non-interactive --non-recursive --force --native-eol --ignore-externals' ;; import) options='--auto-props --no-auto-props --message --file --encoding --force-log --quiet --non-recursive --no-ignore --editor-cmd --username --password --no-auth-cache --non-interactive' ;; info) options='--username --password --no-auth-cache --non-interactive --revision --xml --targets --recursive --incremental' ;; list | ls) options='--revision --verbose --recursive --username --password --no-auth-cache --non-interactive --incremental --xml' ;; lock) options='--message --file --encoding --force-log --targets --force --username --password --no-auth-cache --non-interactive' ;; log) options='--revision --verbose --targets --username --password --no-auth-cache --non-interactive --stop-on-copy --incremental --xml --quiet --limit' ;; merge) options='--revision --non-recursive --quiet --force --dry-run --diff3-cmd --username --password --no-auth-cache --non-interactive --ignore-ancestry' ;; mkdir) options='--message --file --encoding --force-log --quiet --editor-cmd --username --password --no-auth-cache --non-interactive' ;; move | mv | rename | ren) options='--message --file --encoding --force-log --revision --quiet --force --editor-cmd --username --password --no-auth-cache --non-interactive' ;; propdel | pdel | pd) options='--quiet --recursive --revision --revprop --username --password --no-auth-cache --non-interactive' ;; propedit | pedit | pe) options='--revision --revprop --encoding --editor-cmd --username --password --no-auth-cache --non-interactive --force' ;; propget | pget | pg) options='--recursive --revision --revprop --strict --username --password --no-auth-cache --non-interactive' ;; proplist | plist | pl) options='--verbose --recursive --revision --revprop --quiet --username --password --no-auth-cache --non-interactive' ;; propset | pset | ps) options='--file --quiet --targets --recursive --revprop --encoding --username --password --no-auth-cache --non-interactive --revision --force' ;; resolved) options='--targets --recursive --quiet' ;; revert) options='--targets --recursive --quiet' ;; status | stat | st) options='--show-updates --verbose --non-recursive --quiet --username --password --no-auth-cache --non-interactive --no-ignore --ignore-externals --incremental --xml' ;; switch | sw) options='--relocate --revision --non-recursive --quiet --username --password --no-auth-cache --non-interactive --diff3-cmd' ;; unlock) options='--targets --force --username --password --no-auth-cache --non-interactive' ;; update | up) options='--revision --non-recursive --quiet --username --password --no-auth-cache --non-interactive --diff3-cmd --ignore-externals' ;; esac options+=" --help --config-dir" COMPREPLY=($(compgen -W "$options" -- "$cur")) else if [[ $command == @(help|[h?]) ]]; then COMPREPLY=($(compgen -W "$commands" -- "$cur")) else _filedir fi fi fi } && complete -F _svn svn # ex: filetype=sh _mount.linux 0000644 00000025446 15036124164 0007143 0 ustar 00 # mount(8) completion -*- shell-script -*- # Use of this file is deprecated on Linux. Upstream completion is # available in util-linux >= 2.28, use that instead. _mount() { local cur prev words cword _init_completion -n =: || return local split=false case "$prev" in -t | --types) # find /lib/modules/$(uname -r)/ -type f -path '*/fs/*.ko' -printf '%f\n' | cut -d. -f1 # FIXME: no<fstype> if [[ $cur == ?*,* ]]; then prev="${cur%,*}" cur="${cur##*,}" split=true fi COMPREPLY=($(compgen -W 'auto adfs affs autofs btrfs cifs coda cramfs davfs debugfs devpts efs ext2 ext3 ext4 fuse hfs hfsplus hpfs iso9660 jffs2 jfs minix msdos ncpfs nfs nfs4 ntfs ntfs-3g proc qnx4 ramfs reiserfs romfs squashfs smbfs sysv tmpfs ubifs udf ufs umsdos usbfs vfat xfs' -- "$cur")) _fstypes $split && COMPREPLY=(${COMPREPLY[@]/#/$prev,}) return ;; --bind | -B | --rbind | -R) _filedir -d return ;; -p | --pass-fd) COMPREPLY=($(compgen -W '{0..9}')) compopt -o nospace return ;; -L) COMPREPLY=($( cd "/dev/disk/by-label/" 2>/dev/null || return compgen -f -- "$cur" )) return ;; -U) COMPREPLY=($( cd "/dev/disk/by-uuid/" 2>/dev/null || return compgen -f -- "$cur" )) return ;; -O | --test-opts) # argument required but no completions available return ;; -o | --options) local fstype=auto # default fstype for ((i = ${#words[@]} - 1; i > 0; i--)); do if [[ ${words[i]} == -@(t|-types)* ]]; then if [[ ${words[i]} == *=* ]]; then [[ ${words[i]} == ?*,* ]] && break fstype="${words[i]#-*=}" else [[ ${words[i + 1]} == ?*,* ]] && break fstype="${words[i + 1]}" fi break fi done # no<fstype> is not a real fstype, reset to "auto" [[ $fstype == no?* ]] && fstype=auto # split options list if [[ $cur == ?*,* ]]; then prev="${cur%,*}" cur="${cur##*,}" split=true fi # no completion if $cur is opt=smth [[ $cur == *=* ]] && return # mount options COMPREPLY=($(compgen -W 'loop {,a}sync {,no}atime {,no}auto {,fs,def,root}context= defaults {,no}dev {,no}diratime dirsync {,no}exec group {,no}iversion {,no}mand _netdev nofail {,no}relatime {,no}strictatime {,no}suid owner remount ro rw {,no}user users' -- "$cur")) case "$fstype" in adfs | auto) COMPREPLY+=($(compgen -W '{u,g}id= {own,oth}mask=' -- "$cur")) ;;& affs | auto) COMPREPLY+=($(compgen -W '{u,g}id= set{u,g}id= mode= protect usemp verbose prefix= volume= reserved= root= bs= {,no,usr,grp}quota' -- "$cur")) ;;& btrfs | auto) COMPREPLY+=($(compgen -W 'degraded subvol= subvolid= device= nodatasum nodatacow nobarrier max_inline= alloc_start= thread_pool= compress= compress-force= ssd noacl notreelog flushoncommit metadata_ratio= {,no}space_cache clear_cache user_subvol_rm_allowed autodefrag inode_cache' -- "$cur")) ;;& cifs | auto) COMPREPLY+=($(compgen -W 'user= password= credentials= {u,g}id= force{u,g}id port= servern= netbiosname= {file,dir}_mode= ip= domain= guest iocharset {,no}setuids {,no,dyn}perm directio {,no}mapchars {,no}intr hard soft noacl nocase sec= nobrl sfu {,no}serverino nounix nouser_xattr {r,w}size= rwpidforward backup{u,g}id cache=' -- "$cur")) ;;& davfs | auto) COMPREPLY+=($(compgen -W 'conf= {file,dir}_mode= {u,g}id= username=' -- "$cur")) ;;& ext[2-4] | auto) COMPREPLY+=($(compgen -W '{,no}acl bsddf minixdf check= debug errors= {,no}grpid {bsd,sysv}groups {,no,usr,grp}quota nobh nouid32 oldalloc orlov res{u,g}id= sb= {,no}user_xattr' -- "$cur")) ;;& ext[34] | auto) COMPREPLY+=($(compgen -W 'journal= journal_dev= norecovery noload data= barrier= commit=' -- "$cur")) ;;& ext4 | auto) COMPREPLY+=($(compgen -W 'journal_checksum journal_async_commit nobarrier inode_readahead= stripe= {,no}delalloc abort {max,min}_batch_time= journal_ioprio= {,no}auto_da_alloc {,no}discard nouid32 resize {,no}block_validity dioread_{,no}lock max_dir_size_kb= i_version' -- "$cur")) ;;& msdos | umsdos | vfat | auto) COMPREPLY+=($(compgen -W 'blocksize= {u,g}id= {u,d,f}mask= allow_utime= check= codepage= conv= cvf_format= cvf_option= debug fat= iocharset= tz= quiet showexec sys_immutable flush usefree {,no}dots dotsOK=' -- "$cur")) ;;& vfat | auto) COMPREPLY+=($(compgen -W 'uni_xlate posix nonumtail utf8 shortname=' -- "$cur")) ;;& iso9660 | auto) COMPREPLY+=($(compgen -W 'norock nojoliet check= {u,g}id= map= mode= unhide block= conv= cruft session= sbsector= iocharset= utf8' -- "$cur")) ;;& jffs2 | auto) COMPREPLY+=($(compgen -W 'compr= rp_size=' -- "$cur")) ;;& jfs | auto) COMPREPLY+=($(compgen -W 'iocharset= resize= {,no}integrity errors= {,no,usr,grp}quota' -- "$cur")) ;;& nfs | nfs4 | auto) COMPREPLY+=($(compgen -W 'soft hard timeo= retrans= {r,w}size= {,no}ac acreg{min,max}= acdir{min,max}= actimeo= bg fg retry= sec= {,no}sharecache {,no}resvport lookupcache= proto= port= {,no}intr {,no}cto {,nfs}vers= ' -- "$cur")) ;;& nfs | auto) COMPREPLY+=($(compgen -W 'udp tcp rdma mount{port,proto,host}= mountvers= namlen={,no}lock {,no}acl {,no}rdirplus {,no}fsc' -- "$cur")) ;;& nfs4 | auto) COMPREPLY+=($(compgen -W 'clientaddr= {,no}migration' \ -- "$cur")) ;;& ntfs-3g) COMPREPLY+=($(compgen -W '{u,g}id= {u,f,d}mask= usermapping= permissions inherit locale= force {,no}recover ignore_case remove_hiberfile show_sys_files hide_{hid,dot}_files windows_names allow_other max_read= silent no_def_opts streams_interface= user_xattr efs_raw {,no}compression debug no_detach' -- "$cur")) ;;& proc | auto) COMPREPLY+=($(compgen -W '{u,g}id=' -- "$cur")) ;;& reiserfs | auto) COMPREPLY+=($(compgen -W 'conv hash= {,no_un}hashed_relocation noborder nolog notail replayonly resize= user_xattr acl barrier=' -- "$cur")) ;;& tmpfs | auto) COMPREPLY+=($(compgen -W 'size= nr_blocks= nr_inodes= mode= {u,g}id= mpol=' -- "$cur")) ;;& udf | auto) COMPREPLY+=($(compgen -W '{u,g}id= umask= unhide undelete nostrict iocharset bs= novrs session= anchor= volume= partition= lastblock= fileset= rootdir=' -- "$cur")) ;;& usbfs | auto) COMPREPLY+=($(compgen -W 'dev{u,g}id= devmode= bus{u,g}id= busmode= list{u,g}id= listmode=' -- "$cur")) ;;& xfs | auto) COMPREPLY+=($(compgen -W 'allocsize= {,no}attr2 barrier dmapi {,no}grpid {bsd,sysv}groups ihashsize= {,no}ikeep inode{32,64} {,no}largeio logbufs= logbsize= logdev= rtdev= mtpt= noalign norecovery nouuid osyncisosync {u,g,p}qnoenforce {,u,usr,g,grp,p,prj}quota sunit= swidth= swalloc' -- "$cur")) ;;& esac # COMP_WORDBREAKS is a real pain in the ass prev="${prev##*[$COMP_WORDBREAKS]}" $split && COMPREPLY=(${COMPREPLY[@]/#/"$prev,"}) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '--version --help --verbose --all --fork --fake --internal-only -l --no-mtab --no-canonicalize --pass-fd -s --read-only --rw -L -U --types --test-opts --options --bind --rbind --move' -- "$cur")) [[ ${COMPREPLY-} ]] && return fi [[ $cur == \\ ]] && cur="/" local sm host 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 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 | command sed -ne '/^[[:blank:]]*Sharename/,/^$/p' | command sed -ne '3,$s|^[^A-Za-z]*\([^[:blank:]]*\).*$|/\1|p')" \ -- "${cur#//$host}")) fi fi _filedir } && complete -F _mount mount # ex: filetype=sh gpasswd 0000644 00000001132 15036124164 0006136 0 ustar 00 # gpasswd(1) completion -*- shell-script -*- _gpasswd() { local cur prev words cword _init_completion || return case $prev in --add | --delete | --administrators | --members | -!(-*)[adAM]) COMPREPLY=($(compgen -u -- "$cur")) return ;; esac if [[ $cur == -* ]]; then # TODO: only -A and -M can be combined COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) return fi COMPREPLY=($(compgen -g -- "$cur")) } && complete -F _gpasswd gpasswd # ex: filetype=sh filefrag 0000644 00000000536 15036124164 0006254 0 ustar 00 # filefrag(8) completion -*- shell-script -*- _filefrag() { local cur prev words cword _init_completion || return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_usage "$1")' -- "$cur")) return fi _filedir } && complete -F _filefrag filefrag # ex: filetype=sh swapon 0000644 00000003727 15036124164 0006011 0 ustar 00 _swapon_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-p'|'--priority') # Priority range is -1 to 32767. Perhaps these # few are enough. COMPREPLY=( $(compgen -W "{-1..9} 32767" -- $cur) ) return 0 ;; '--show') local prefix realcur OUTPUT_ALL OUTPUT realcur="${cur##*,}" prefix="${cur%$realcur}" OUTPUT_ALL="NAME TYPE SIZE USED PRIO UUID LABEL" for WORD in $OUTPUT_ALL; do if ! [[ $prefix == *"$WORD"* ]]; then OUTPUT="$WORD ${OUTPUT:-""}" fi done compopt -o nospace COMPREPLY=( $(compgen -P "$prefix" -W "$OUTPUT" -S ',' -- $realcur) ) return 0 ;; '-U'|'UUID=') local UUIDS UUIDS="$(lsblk -nrp -o FSTYPE,UUID | awk '$1 ~ /swap/ { print $2 }')" COMPREPLY=( $(compgen -W "$UUIDS" -- $cur) ) return 0 ;; '-L'|'LABEL=') local LABELS LABELS="$(lsblk -nrp -o FSTYPE,LABEL | awk '$1 ~ /swap/ { print $2 }')" COMPREPLY=( $(compgen -W "$LABELS" -- $cur) ) return 0 ;; 'PARTUUID=') local PARTUUIDS PARTUUIDS="$(lsblk -nrp -o FSTYPE,PARTUUID | awk '$1 ~ /swap/ { print $2 }')" COMPREPLY=( $(compgen -W "$PARTUUIDS" -- $cur) ) return 0 ;; 'PARTLABEL=') local PARTLABELS PARTLABELS="$(lsblk -nrp -o FSTYPE,PARTLABEL | awk '$1 ~ /swap/ { print $2 }')" COMPREPLY=( $(compgen -W "$PARTLABELS" -- $cur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS="--all --discard --ifexists --fixpgsz --priority --summary --show --output-all --noheadings --raw --bytes --verbose -L -U --help --version" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac local DEVS DEVS="$(lsblk -nrp -o FSTYPE,NAME | awk '$1 ~ /swap/ { print $2 }')" compopt -o nospace COMPREPLY=( $(compgen -fW "$DEVS LABEL= UUID= PARTLABEL= PARTUUID=" -- $cur) ) return 0 } complete -F _swapon_module swapon _reptyr 0000644 00000001045 15036124164 0006155 0 ustar 00 # bash completion for reptyr(1) -*- shell-script -*- # Use of this file is deprecated. Upstream completion is available in # reptyr > 0.6.2, use that instead. _reptyr() { local cur prev words cword _init_completion || return case $prev in -l) return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) return fi [[ $prev != +([0-9]) ]] && _pids } && complete -F _reptyr reptyr # ex: filetype=sh mesg 0000644 00000000634 15036124164 0005427 0 ustar 00 _mesg_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS="--verbose --version --help" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac COMPREPLY=( $(compgen -W "y n" -- $cur) ) return 0 } complete -F _mesg_module mesg _chsh 0000644 00000001272 15036124164 0005557 0 ustar 00 # chsh(1) completion -*- shell-script -*- # Use of this file is deprecated on Linux. Upstream completion is # available in util-linux >= 2.23, use that instead. _chsh() { local cur prev words cword _init_completion || return case $prev in --list-shells | --help | -v | --version) return ;; -s | --shell) _shells return ;; esac if [[ $cur == -* ]]; then local opts=$(_parse_help "$1") COMPREPLY=($(compgen -W '${opts:-$(_parse_usage "$1")}' -- "$cur")) else _allowed_users fi } && complete -F _chsh chsh # ex: filetype=sh flake8 0000644 00000001750 15036124164 0005646 0 ustar 00 # flake8 completion -*- shell-script -*- _flake8() { local cur prev words cword split _init_completion -s || return case $prev in --help | --version | -!(-*)h) return ;; --format) COMPREPLY=($(compgen -W 'default pylint' -- "$cur")) return ;; --jobs | -!(-*)j) COMPREPLY=($(compgen -W "auto {1..$(_ncpus)}" -- "$cur")) return ;; --output-file | --append-config | --config) _filedir return ;; --include-in-doctest | --exclude-from-doctest) _filedir py return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return fi _filedir py } && complete -F _flake8 flake8 # ex: filetype=sh gprof 0000644 00000002501 15036124164 0005604 0 ustar 00 # gprof(1) completion -*- shell-script -*- _gprof() { local cur prev words cword split _init_completion -s || return case $cur in -A* | -C* | -J* | -p* | -P* | -q* | -Q* | -n* | -N* | -d*) return ;; -S*) cur=${cur:2} _filedir COMPREPLY=("${COMPREPLY[@]/#/-S}") return ;; -O*) cur=${cur:2} COMPREPLY=($(compgen -P -O -W 'auto bsd 4.4bsd magic prof' \ -- "$cur")) return ;; esac case $prev in -I | --directory-path) _filedir -d return ;; -R | --file-ordering | --external-symbol-table) _filedir return ;; -w | --width | -k | -m | --min-count | -h | --help | -e | -E | -f | -F) return ;; --file-format) COMPREPLY=($(compgen -W 'auto bsd 4.4bsd magic prof' -- "$cur")) return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_usage "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return fi _filedir } && complete -F _gprof gprof # ex: filetype=sh fsck.minix 0000644 00000000642 15036124164 0006544 0 ustar 00 _fsck.minix_module() { local cur OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" case $cur in -*) OPTS="--list --auto --repair --verbose --super --uncleared --force --help --version" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac compopt -o bashdefault -o default COMPREPLY=( $(compgen -W "$(lsblk -pnro name)" -- $cur) ) return 0 } complete -F _fsck.minix_module fsck.minix apt-get 0000644 00000007512 15036124164 0006037 0 ustar 00 # Debian apt-get(8) completion -*- shell-script -*- _apt_get() { local cur prev words cword package _init_completion -n ':=' || return local special i for ((i = 1; i < ${#words[@]} - 1; i++)); do if [[ ${words[i]} == @(install|remove|autoremove|purge|source|build-dep|download|changelog) ]]; then special=${words[i]} break fi done if [[ -v special ]]; then case $special in remove | autoremove | purge) if [[ -f /etc/debian_version ]]; then # Debian system COMPREPLY=($( _xfunc dpkg _comp_dpkg_installed_packages $cur )) else # assume RPM based _xfunc rpm _rpm_installed_packages fi ;; source) COMPREPLY=($(_xfunc apt-cache _apt_cache_packages) $(compgen -W "$(apt-cache dumpavail | awk '$1 == "Source:" { print $2 }' | sort -u)" -- "$cur")) ;; install) if [[ $cur == */* ]]; then _filedir deb return elif [[ $cur == *=* ]]; then package="${cur%%=*}" cur="${cur#*=}" COMPREPLY=($(IFS=$'\n' compgen -W "$( apt-cache --no-generate madison "$package" 2>/dev/null | while IFS=' |' read -r _ version _; do echo "$version" done )" \ -- "$cur")) __ltrim_colon_completions "$cur" return fi ;;& build-dep) _filedir -d [[ $cur != */* ]] || return ;;& *) COMPREPLY+=($(_xfunc apt-cache _apt_cache_packages)) ;; esac return fi case $prev in --help | --version | --option | -!(-*)[hvo]) return ;; --config-file | -!(-*)c) _filedir return ;; --target-release | --default-release | -!(-*)t) COMPREPLY=($(compgen -W "$(apt-cache policy | command sed -ne \ 's/^ *release.*[ ,]o=\(Debian\|Ubuntu\),a=\(\w*\).*/\2/p')" \ -- "$cur")) return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '--no-install-recommends --install-suggests --download-only --fix-broken --ignore-missing --fix-missing --no-download --quiet --simulate --just-print --dry-run --recon --no-act --yes --assume-yes --assume-no --no-show-upgraded --verbose-versions --host-architecture --build-profiles --compile --build --ignore-hold --with-new-pkgs --no-upgrade --only-upgrade --allow-downgrades --allow-remove-essential --allow-change-held-packages --force-yes --print-uris --purge --reinstall --list-cleanup --target-release --default-release --trivial-only --no-remove --auto-remove --autoremove --only-source --diff-only --dsc-only --tar-only --arch-only --indep-only --allow-unauthenticated --no-allow-insecure-repositories --allow-releaseinfo-change --show-progress --with-source --help --version --config-file --option' -- "$cur")) else COMPREPLY=($(compgen -W 'update upgrade dist-upgrade dselect-upgrade install remove purge source build-dep check download clean autoclean autoremove changelog indextargets' \ -- "$cur")) fi } && complete -F _apt_get apt-get # ex: filetype=sh openssl 0000644 00000011612 15036124164 0006155 0 ustar 00 # bash completion for openssl -*- shell-script -*- _openssl_sections() { local config f # check if a specific configuration file is used for ((i = 2; i < cword; i++)); do if [[ ${words[i]} == -config ]]; then config=${words[i + 1]} break fi done # if no config given, check some usual default locations 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 COMPREPLY=($(compgen -W "$(awk '/\[.*\]/ {print $2}' $config)" -- "$cur")) } _openssl_digests() { "$1" dgst -h 2>&1 | awk '/^-.*[ \t]to use the .* message digest algorithm/ { print $1 }' local -a digests=($("$1" help 2>&1 | command sed -ne '/^Message Digest commands/,/^[[:space:]]*$/p' | command sed -e 1d)) printf "%s\n" "${digests[@]/#/-}" } _openssl() { local cur prev words cword _init_completion || return local commands command options formats 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 sha224 sha256 sha384 sha512 genpkey pkey pkeyparam pkeyutl' if ((cword == 1)); then COMPREPLY=($(compgen -W "$commands" -- "$cur")) else command=${words[1]} case $prev in -CA | -CAfile | -CAkey | -CAserial | -cert | -certfile | -config | -content | \ -dcert | -dkey | -dhparam | -extfile | -in | -inkey | -kfile | -key | -keyout | \ -out | -oid | -paramfile | -peerkey | -prvrify | -rand | -recip | -revoke | \ -sess_in | -sess_out | -spkac | -sigfile | -sign | -signkey | -signer | \ -signature | -ss_cert | -untrusted | -verify | -writerand) _filedir return ;; -outdir | -CApath) _filedir -d return ;; -name | -crlexts | -extensions) _openssl_sections return ;; -inform | -outform | -keyform | -certform | -CAform | -CAkeyform | -dkeyform | \ -dcertform | -peerform) formats='DER PEM' case $command in x509) formats+=" NET" ;; smime) formats+=" SMIME" ;; pkeyutl) formats+=" ENGINE" ;; esac COMPREPLY=($(compgen -W "$formats" -- "$cur")) return ;; -connect) _known_hosts_real -- "$cur" return ;; -starttls) COMPREPLY=($(compgen -W ' smtp pop3 imap ftp xmpp xmpp-server telnet irc mysql postgres lmtp nntp sieve ldap ' -- "$cur")) return ;; -cipher) COMPREPLY=($(IFS=: compgen -W "$($1 ciphers)" -- "$cur")) return ;; -kdf) COMPREPLY=($(compgen -W 'TLS1-PRF HKDF' -- "$cur")) return ;; esac if [[ $cur == -* ]]; then # possible options for the command options=$(_parse_help "$1" "$command -help" 2>/dev/null) case $command in dgst | req | x509) options+=" $(_openssl_digests $1)" ;; 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 } && complete -F _openssl -o default openssl # ex: filetype=sh lsof 0000644 00000002603 15036124164 0005435 0 ustar 00 # lsof(8) completion -*- shell-script -*- _lsof() { local cur prev words cword _init_completion || return case $prev in -'?' | -h | +c | -c | -d | -F | -i | +r | -r | -s | -S | -T) return ;; -A | -k | -m | +m | -o) _filedir return ;; +d | +D) _filedir -d return ;; -D) COMPREPLY=($(compgen -W '? b i r u' -- "$cur")) return ;; -f) COMPREPLY=($(compgen -W 'c f g G n' -- "$cur")) return ;; -g) # TODO: handle ^foo exclusions, comma separated lists _pgids return ;; -p) # TODO: handle ^foo exclusions, comma separated lists _pids return ;; -u) # TODO: handle ^foo exclusions, comma separated lists COMPREPLY=($(compgen -u -- "$cur")) return ;; 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 fi _filedir } && complete -F _lsof lsof # ex: filetype=sh ul 0000644 00000001217 15036124164 0005112 0 ustar 00 _ul_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-t'|'--terminal') local TERM_LIST I TERM_LIST='' for I in /usr/share/terminfo/?/*; do TERM_LIST+="${I##*/} " done COMPREPLY=( $(compgen -W "$TERM_LIST" -- $cur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS="--terminal --indicated --version --help" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 } complete -F _ul_module ul ssh-copy-id 0000644 00000001254 15036124164 0006632 0 ustar 00 # ssh-copy-id(1) completion -*- shell-script -*- _ssh_copy_id() { local cur prev words cword _init_completion || return _xfunc ssh _ssh_suboption_check "$1" && return case $prev in -i) _xfunc ssh _ssh_identityfile pub return ;; -p) return ;; -o) _xfunc ssh _ssh_options return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) else _known_hosts_real -a -- "$cur" fi } && complete -F _ssh_copy_id ssh-copy-id # ex: filetype=sh rdesktop 0000644 00000003143 15036124164 0006325 0 ustar 00 # bash completion for rdesktop -*- shell-script -*- _rdesktop() { local cur prev words cword _init_completion -n : || return case $prev in -*k) COMPREPLY=($(command ls \ /usr/share/rdesktop/keymaps 2>/dev/null | command grep -E -v '(common|modifiers)')) COMPREPLY+=($(command ls $HOME/.rdesktop/keymaps 2>/dev/null)) COMPREPLY+=($(command ls ./keymaps 2>/dev/null)) COMPREPLY=($(compgen -W '${COMPREPLY[@]}' -- "$cur")) return ;; -*a) COMPREPLY=($(compgen -W '8 15 16 24' -- "$cur")) return ;; -*x) COMPREPLY=($(compgen -W 'broadband modem lan' -- "$cur")) return ;; -*r) case $cur in sound:*) COMPREPLY=($(compgen -W 'local off remote' \ -- "${cur#sound:}")) ;; *:*) ;; *) COMPREPLY=($(compgen -W 'comport: disk: lptport: printer: sound: lspci scard' -- "$cur")) [[ ${COMPREPLY-} == *: ]] && compopt -o nospace ;; esac return ;; -*[udscpngSTX]) return ;; esac if [[ $cur == -* ]]; then local opts=($(_parse_help "$1")) COMPREPLY=($(compgen -W '${opts[@]%:}' -- "$cur")) else _known_hosts_real -- "$cur" fi } && complete -F _rdesktop rdesktop # ex: filetype=sh apache2ctl 0000644 00000000574 15036124164 0006505 0 ustar 00 # apache2ctl(1) completion -*- shell-script -*- _apache2ctl() { local cur prev words cword _init_completion || return local APWORDS APWORDS=$($1 2>&1 >/dev/null | awk 'NR<2 { print $3; exit }' | tr "|" " ") COMPREPLY=($(compgen -W "$APWORDS" -- "$cur")) } && complete -F _apache2ctl apache2ctl # ex: filetype=sh querybts 0000644 00000002354 15036124164 0006353 0 ustar 00 # querybts completion -*- shell-script -*- _querybts() { local cur prev words cword split _init_completion -s || return case $prev in --bts | -!(-*)B) COMPREPLY=($(compgen -W "debian guug kde mandrake help" \ -- "$cur")) return ;; --ui | --interface | -!(-*)u) COMPREPLY=($(compgen -W "newt text gnome" -- "$cur")) return ;; --mbox-reader-cmd) compopt -o filenames COMPREPLY=($(compgen -c -- "$cur")) return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace else COMPREPLY=($(compgen -W 'wnpp boot-floppies kernel bugs.debian.org cdimage.debian.org general installation-reports listarchives lists.debian.org mirrors nm.debian.org press project qa.debian.org release-notes security.debian.org tech-ctte upgrade-reports www.debian.org $(_xfunc apt-cache _apt_cache_packages)' -- "$cur")) fi } && complete -F _querybts querybts # ex: filetype=sh mdadm 0000644 00000010647 15036124164 0005563 0 ustar 00 # bash completion for mdadm -*- shell-script -*- _mdadm_raid_level() { local mode for ((i = 1; i < cword; i++)); do case ${words[i]} in -!(-*)C* | --create) mode=create break ;; -!(-*)B* | --build) mode=build break ;; esac done case $mode in create) COMPREPLY=($(compgen -W 'linear raid0 0 stripe raid1 1 mirror raid4 4 raid5 5 raid6 6 raid10 10 multipath mp faulty' \ -- "$cur")) ;; build) COMPREPLY=($(compgen -W 'linear stripe raid0 0 raid1 multipath mp faulty' -- "$cur")) ;; esac } _mdadm_raid_layout() { local level for ((i = 1; i < cword; i++)); do if [[ ${words[i]} == -@(l|-level) ]]; then level=${words[i + 1]} break fi done case $level in raid5) COMPREPLY=($(compgen -W 'left-asymmetric left-symmetric right-asymmetric right-symmetric la ra ls rs' -- "$cur")) ;; raid10) COMPREPLY=($(compgen -W 'n o p' -- "$cur")) ;; faulty) COMPREPLY=($(compgen -W 'write-transient wt read-transient rt write-persistent wp read-persistent rp write-all read-fixable rf clear flush none' -- "$cur")) ;; esac } _mdadm_auto_flag() { COMPREPLY=($(compgen -W 'no yes md mdp part p' -- "$cur")) } _mdadm_update_flag() { COMPREPLY=($(compgen -W 'sparc2.2 summaries uuid name homehost resync byteorder super-minor' -- "$cur")) } _mdadm() { local cur prev words cword split _init_completion -s || return case $prev in --config | --bitmap | --backup-file | -!(-*)[cb]) _filedir return ;; --level | -!(-*)l) _mdadm_raid_level return ;; --layout | --parity | -!(-*)p) _mdadm_raid_layout return ;; --auto | -!(-*)a) _mdadm_auto_flag return ;; --update | -!(-*)U) _mdadm_update_flag return ;; esac $split && return local options='--help --help-options --version --verbose --quiet --brief --force --config= --scan --metadata= --homehost=' if [[ $cur == -* ]]; then if ((cword == 1)); then COMPREPLY=($(compgen -W "$options --assemble --build --create --monitor --grow" -- "$cur")) else case ${words[cword - 1]} in --assemble | -!(-*)A*) COMPREPLY=($(compgen -W "$options --uuid= --super-minor= --name= --force --run --no-degraded --auto= --bitmap= --backup-file= --update= --auto-update-homehost" \ -- "$cur")) ;; --build | --create | --grow | -!(-*)[BCG]*) COMPREPLY=($(compgen -W "$options --raid-devices= --spare-devices= --size= --chunk= --rounding= --level= --layout= --parity= --bitmap= --bitmap-chunk= --write-mostly --write-behind= --assume-clean --backup-file= --name= --run --force --auto=" \ -- "$cur")) ;; --follow | --monitor | -!(-*)F) COMPREPLY=($(compgen -W "$options --mail --program --alert --syslog --delay --daemonise --pid-file --oneshot --test" -- "$cur")) ;; /dev/* | --add | --fail | --remove) COMPREPLY=($(compgen -W "$options --add --re-add --remove --fail --set-faulty" -- "$cur")) ;; *) COMPREPLY=($(compgen -W "$options --query --detail --examine --sparc2.2 --examine-bitmap --run --stop --readonly --readwrite --zero-superblock --test" \ -- "$cur")) ;; esac fi [[ ${COMPREPLY-} == *= ]] && compopt -o nospace else cur=${cur:=/dev/} _filedir fi } && complete -F _mdadm mdadm # ex: filetype=sh findmnt 0000644 00000006173 15036124164 0006137 0 ustar 00 _findmnt_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-p'|'--poll') COMPREPLY=( $(compgen -W "=list" -- $cur) ) return 0 ;; '-w'|'--timeout') COMPREPLY=( $(compgen -W "timeout" -- $cur) ) return 0 ;; '-d'|'--direction') COMPREPLY=( $(compgen -W "forward backward" -- $cur) ) return 0 ;; '-F'|'--tab-file') local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 ;; '-N'|'--task') local TID='' I ARR for I in /proc/*/mountinfo; do IFS=/ read -ra ARR <<< "$I"; TID+="${ARR[2]} "; done COMPREPLY=( $(compgen -W "$TID" -- $cur) ) return 0 ;; '-O'|'--options') local MTAB_3RD I declare -a TMP_ARR declare -A MNT_OPTS while read MTAB_3RD; do IFS=',' read -ra TMP_ARR <<<"$MTAB_3RD" for I in ${TMP_ARR[@]}; do MNT_OPTS[$I]='1' done done < <($1 -rno OPTIONS) COMPREPLY=( $(compgen -W "${!MNT_OPTS[@]}" -- $cur) ) return 0 ;; '-o'|'--output') local prefix realcur OUTPUT_ALL OUTPUT realcur="${cur##*,}" prefix="${cur%$realcur}" OUTPUT_ALL="SOURCE TARGET FSTYPE OPTIONS VFS-OPTIONS FS-OPTIONS LABEL UUID PARTLABEL PARTUUID MAJ\:MIN ACTION OLD-TARGET OLD-OPTIONS SIZE AVAIL USED USE% FSROOT TID ID OPT-FIELDS PROPAGATION FREQ PASSNO" for WORD in $OUTPUT_ALL; do if ! [[ $prefix == *"$WORD"* ]]; then OUTPUT="$WORD ${OUTPUT:-""}" fi done compopt -o nospace COMPREPLY=( $(compgen -P "$prefix" -W "$OUTPUT" -S ',' -- $realcur) ) return 0 ;; '-t'|'--types') local TYPES TYPES="adfs affs autofs cifs coda coherent cramfs debugfs devpts efs ext2 ext3 ext4 hfs hfsplus hpfs iso9660 jfs minix msdos ncpfs nfs nfs4 ntfs proc qnx4 ramfs reiserfs romfs squashfs smbfs sysv tmpfs ubifs udf ufs umsdos usbfs vfat xenix xfs" COMPREPLY=( $(compgen -W "$TYPES" -- $cur) ) return 0 ;; '-S'|'--source') local DEV_MPOINT DEV_MPOINT=$($1 -rno SOURCE | grep ^/dev) COMPREPLY=( $(compgen -W "$DEV_MPOINT" -- $cur) ) return 0 ;; '-T'|'--target') local DEV_MPOINT DEV_MPOINT=$($1 -rno TARGET) COMPREPLY=( $(compgen -W "$DEV_MPOINT" -- $cur) ) return 0 ;; '-M'|'--mountpoint') local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -o dirnames -- ${cur:-"/"}) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS="--fstab --mtab --kernel --poll --timeout --all --ascii --canonicalize --df --direction --evaluate --tab-file --first-only --invert --json --list --task --noheadings --notruncate --options --output --output-all --pairs --raw --types --nofsroot --submounts --source --target --mountpoint --help --tree --real --pseudo --version" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac local DEV_MPOINT DEV_MPOINT=$($1 -rno TARGET,SOURCE) COMPREPLY=( $(compgen -W "$DEV_MPOINT" -- $cur) ) return 0 } complete -F _findmnt_module findmnt _svnadmin 0000644 00000004404 15036124164 0006451 0 ustar 00 # svnadmin completion -*- shell-script -*- # Use of this file is deprecated. Upstream completion is available in # subversion >= 0.12.0, use that instead. _svnadmin() { local cur prev words cword _init_completion || return local commands commands='create deltify dump help ? hotcopy list-dblogs list-unused-dblogs load lslocks lstxns recover rmlocks rmtxns setlog verify' if ((cword == 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 ;; --fs-type) COMPREPLY=($(compgen -W 'fsfs bdb' -- "$cur")) return ;; esac local command=${words[1]} if [[ $cur == -* ]]; then # possible options for the command local options case $command in create) options='--bdb-txn-nosync --bdb-log-keep --config-dir --fs-type' ;; deltify) options='--revision --quiet' ;; dump) options='--revision --incremental --quiet --deltas' ;; hotcopy) options='--clean-logs' ;; load) options='--ignore-uuid --force-uuid --parent-dir --quiet --use-pre-commit-hook --use-post-commit-hook' ;; rmtxns) options='--quiet' ;; setlog) options='--revision --bypass-hooks' ;; esac options+=" --help" COMPREPLY=($(compgen -W "$options" -- "$cur")) else if [[ $command == @(help|[h?]) ]]; then COMPREPLY=($(compgen -W "$commands" -- "$cur")) else _filedir fi fi fi } && complete -F _svnadmin -o default svnadmin # ex: filetype=sh pivot_root 0000644 00000000603 15036124164 0006674 0 ustar 00 _pivot_root_module() { local cur prev COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $COMP_CWORD in 1|2) local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -o dirnames -- ${cur:-"/"}) ) ;; esac return 0 } complete -F _pivot_root_module pivot_root modprobe 0000644 00000007763 15036124164 0006315 0 ustar 00 # Linux modprobe(8) completion -*- shell-script -*- _modprobe() { local cur prev words cword split _init_completion -s || return case "$prev" in --help | --version | -!(-*)[hV]) return ;; --config | -!(-*)C) _filedir return ;; --dirname | --type | -!(-*)[dt]) _filedir -d return ;; --set-version | -!(-*)S) _kernel_versions return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) if [[ ! ${COMPREPLY-} ]]; then COMPREPLY=($(compgen -W '-a --all -b --use-blacklist -C --config -c --showconfig --dump-modversions -d --dirname --first-time --force-vermagic --force-modversion -f --force -i --ignore-install --ignore-remove -l --list -n --dry-run -q --quiet -R --resolve-alias -r --remove -S --set-version --show-depends -s --syslog -t --type -V --version -v --verbose' -- "$cur")) fi [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return fi local i mode=insert module="" version=$(uname -r) for ((i = 1; i < cword; i++)); do case "${words[i]}" in --remove | -!(-*)r*) mode=remove ;; --list | -!(-*)l*) mode=list ;; --dump-modversions) mode="file" ;; --set-version | -!(-*)S) version=${words[i + 1]} # -S is not $prev and not $cur ;; --config | --dirname | --type | -!(-*)[Cdt]) ((i++)) # skip option and its argument ;; -*) # skip all other options ;; *) [[ -z $module ]] && module=${words[i]} ;; esac done case $mode in remove) _installed_modules "$cur" ;; list) # no completion available ;; file) _filedir ;; insert) # do filename completion if we're giving a path to a module if [[ $cur == @(*/|[.~])* ]]; then _filedir '@(?(k)o?(.[gx]z))' elif [[ -n $module ]]; then # do module parameter completion if [[ $cur == *=* ]]; then prev=${cur%%=*} cur=${cur#*=} if PATH="$PATH:/sbin" modinfo -p "$module" 2>/dev/null | command grep -q "^$prev:.*(bool)"; then local choices="on off" [[ $cur ]] && choices="1 0 y Y n N on off" COMPREPLY=($(compgen -W "$choices" -- "$cur")) fi else COMPREPLY=($(compgen -S = -W "$(PATH="$PATH:/sbin" \ modinfo -p "$module" 2>/dev/null | awk -F: '!/^[ \t]/ { print $1 }')" -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace fi else _modules $version if [[ ${COMPREPLY-} ]]; then # filter out already installed modules local -a mods=("${COMPREPLY[@]}") _installed_modules "$cur" for i in "${!mods[@]}"; do for module in "${COMPREPLY[@]}"; do if [[ ${mods[i]} == "$module" ]]; then unset 'mods[i]' break fi done done COMPREPLY=("${mods[@]}") fi fi ;; esac } && complete -F _modprobe modprobe # ex: filetype=sh chkconfig 0000644 00000001607 15036124164 0006430 0 ustar 00 # chkconfig(8) completion -*- shell-script -*- _chkconfig() { local cur prev words cword split _init_completion -s || return case $prev in --level=[1-6] | [1-6] | --list | --add | --del | --override) _services _xinetd_services return ;; --level) COMPREPLY=($(compgen -W '{1..6}' -- "$cur")) return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '--list --add --del --override --level' \ -- "$cur")) else if ((cword == 2 || cword == 4)); then COMPREPLY=($(compgen -W 'on off reset resetpriorities' \ -- "$cur")) else _services _xinetd_services fi fi } && complete -F _chkconfig chkconfig # ex: filetype=sh munin-update 0000644 00000001214 15036124164 0007075 0 ustar 00 # munin-update completion -*- shell-script -*- _munin_update() { local cur prev words cword _init_completion || return case $prev in --config) _filedir return ;; --host) _known_hosts_real -- "$cur" return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '--force-root --noforce-root --service --host --config --help --debug --nodebug --fork --nofork --stdout --nostdout --timeout' -- "$cur")) fi } && complete -F _munin_update munin-update # ex: filetype=sh losetup 0000644 00000003312 15036124164 0006163 0 ustar 00 _losetup_module() { local cur prev OPTS ARG COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-d'|'--detach') ARG="$($1 --output NAME | awk '{if (1 < NR) {print}}')" COMPREPLY=( $(compgen -W "$ARG" -- $cur) ) return 0 ;; '-j'|'--associated') ARG="$($1 --output BACK-FILE | awk '{if (1 < NR) {print}}')" COMPREPLY=( $(compgen -W "$ARG" -- $cur) ) return 0 ;; '-c'|'--set-capacity') ARG="$(for I in /dev/loop[0-9]*; do if [ -e $I ]; then echo $I; fi; done)" COMPREPLY=( $(compgen -W "$ARG" -- $cur) ) return 0 ;; '-o'|'--offset'|'--sizelimit') COMPREPLY=( $(compgen -W "number" -- $cur) ) return 0 ;; '-O'|'--output') local prefix realcur OUTPUT_ALL OUTPUT realcur="${cur##*,}" prefix="${cur%$realcur}" OUTPUT_ALL="NAME AUTOCLEAR BACK-FILE BACK-INO BACK-MAJ:MIN MAJ:MIN OFFSET PARTSCAN RO SIZELIMIT DIO" for WORD in $OUTPUT_ALL; do if ! [[ $prefix == *"$WORD"* ]]; then OUTPUT="$WORD ${OUTPUT:-""}" fi done compopt -o nospace COMPREPLY=( $(compgen -P "$prefix" -W "$OUTPUT" -S ',' -- $realcur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS="--all --detach --detach-all --find --set-capacity --associated --nooverlap --offset --sizelimit --partscan --read-only --show --verbose --json --list --noheadings --output --output-all --raw --help --version" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 } complete -F _losetup_module losetup wtf 0000644 00000001651 15036124164 0005274 0 ustar 00 # wtf completion -*- shell-script -*- # Raphael Droz, 25/09/2009 _wtf() { local cur prev words cword addf _init_completion || return [[ $prev == -f ]] && _filedir && return [[ ${words[*]} == *\ -f* ]] && addf= || addf=-f if [[ $cur == -* ]]; then COMPREPLY=($addf) return fi local db set -- "${words[@]}" while (($# > 0)); do if [[ $1 == -f ]]; then shift db=$1 break fi shift done if [[ ! -v db ]]; then local f for f in "${ACRONYMDB-}" /usr/share/misc/acronyms \ /usr/share/games/bsdgames/acronyms; do [[ -f $f ]] && db="$f" && break done [[ -v db ]] || return fi COMPREPLY=($(compgen -W "$(cut -f 1 -s $db* 2>/dev/null) $addf" \ -- "${cur^^}")) } && complete -F _wtf wtf # ex: filetype=sh _renice 0000644 00000001402 15036124164 0006072 0 ustar 00 # renice(8) completion -*- shell-script -*- # Use of this file is deprecated on Linux. Upstream completion is # available in util-linux >= 2.23, use that instead. _renice() { local cur prev words cword _init_completion || return local command=$1 curopt i=0 # walk back through command line and find last option while ((i <= cword && ${#COMPREPLY[@]} == 0)); do curopt=${words[cword - i]} case "$curopt" in -u) _allowed_users ;; -g) _pgids ;; -p | "$command") _pids ;; esac ((i++)) done } && complete -F _renice renice # ex: filetype=sh dnssec-keygen 0000644 00000002170 15036124164 0007230 0 ustar 00 # bash completion for dnssec-keygen(8) -*- shell-script -*- _dnssec_keygen_optarg() { local args=$("$1" -h 2>&1 | command sed -e 's/|/ /g' -e 's/(.*//' \ -ne '/^[[:space:]]*'$2'/,/^[[:space:]]*[(-]/p' | command sed -e 's/^[[:space:]]*'$2'.*://' -e '/^[[:space:]]*-/d') COMPREPLY+=($(compgen -W '$args' -- "$cur")) } _dnssec_keygen() { local cur prev words cword _init_completion || return case $prev in -[hbEgLpsPARIDSi]) return ;; -K) _filedir -d return ;; -[ancdfTtm]) _dnssec_keygen_optarg "$1" $prev return ;; -r) cur=${cur:=/dev/} _filedir return ;; -v) COMPREPLY=($(compgen -W '{0..10}' -- "$cur")) return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1" | \ command sed -e "s/:\$//")' -- "$cur")) return fi } && complete -F _dnssec_keygen dnssec-keygen # ex: filetype=sh zopfli 0000644 00000001245 15036124164 0005776 0 ustar 00 # bash completion for zopfli -*- shell-script -*- _zopfli() { local cur prev words cword _init_completion || return case $prev in -h) return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W \ '$(_parse_help "$1" -h | command sed -e "s/#$//")' -- "$cur")) [[ ${COMPREPLY-} == --i ]] && compopt -o nospace return fi _tilde "$cur" || return local IFS=$'\n' xspec="*.@(gz|t[ag]z)" compopt -o filenames COMPREPLY=($(compgen -f -X "$xspec" -- "$cur") $(compgen -d -- "$cur")) } && complete -F _zopfli zopfli # ex: filetype=sh secret-tool 0000644 00000002664 15036124164 0006741 0 ustar 00 # bash completion for secret-tool(1) -*- shell-script -*- _secret_tool() { local cur prev words cword split _init_completion -s || return $split && return local -i i local mode word for i in ${!words[*]}; do if [[ $i -gt 0 && ${words[i]} != -* ]]; then ((i != cword)) && mode=${words[i]} break fi done if [[ ! -v mode ]]; then local -a modes modes=($("$1" nonexistent-mode 2>&1 | while read -r first second third rest; do if [[ $first == "${1##*/}" ]]; then printf "%s\n" "$second" elif [[ $first == usage: && $second == "${1##*/}" ]]; then printf "%s\n" "$third" fi done)) COMPREPLY=($(compgen -W '${modes[@]}' -- "$cur")) return fi case $mode in store) if [[ ${words[*]} != *\ --label[\ =]* ]]; then COMPREPLY=($(compgen -W "--label=" -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace fi ;; search) local -A opts=([--all]="" [--unlock]="") for word in "${words[@]:2}"; do [[ $word ]] && unset opts["$word"] done COMPREPLY=($(compgen -W '${opts[@]}' -- "$cur")) ;; esac } && complete -F _secret_tool secret-tool # ex: filetype=sh eject 0000644 00000002340 15036124164 0005562 0 ustar 00 _eject_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-a'|'--auto'|'-i'|'--manualeject') COMPREPLY=( $(compgen -W "off on" -- $cur) ) return 0 ;; '-c'|'--changerslot') # FIXME: there must be way to determine slots COMPREPLY=( $(compgen -W "slot" -- $cur) ) return 0 ;; '-x'|'--cdspeed') COMPREPLY=( $(compgen -W "$(eject --listspeed 2>/dev/null)" -- $cur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS="--auto --changerslot --default --floppy --force --manualeject --no-unmount --no-partitions-unmount --noop --proc --tape --cdrom --scsi --trayclose --traytoggle --verbose --cdspeed --listspeed --help --version" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac local DEVS DEVS="$(for I in /sys/class/block/*/removable; do if [ $(cat $I) -ne 0 ]; then OLD_IFS=$IFS IFS='/'; ARR=($I) echo "/dev/${ARR[4]}" IFS=$OLD_IFS fi done)" compopt -o bashdefault -o default COMPREPLY=( $(compgen -W "$DEVS" $cur) ) return 0 } complete -F _eject_module eject groupmod 0000644 00000001262 15036124164 0006326 0 ustar 00 # groupmod(8) completion -*- shell-script -*- _groupmod() { local cur prev words cword split _init_completion -s || return # TODO: if -o/--non-unique is given, could complete on existing gids # with -g/--gid case $prev in --gid | --help | --new-name | --password | -!(-*)[ghnp]) return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return fi COMPREPLY=($(compgen -g -- "$cur")) } && complete -F _groupmod groupmod # ex: filetype=sh nmap 0000644 00000003116 15036124164 0005425 0 ustar 00 # bash completion for nmap -*- shell-script -*- _nmap() { local cur prev words cword split _init_completion -s || return case $prev in -iL | -oN | -oX | -oS | -oG | ---excludefile | --resume | --stylesheet) _filedir return ;; -oA | --datadir) _filedir -d return ;; -e) _available_interfaces -a return ;; -b | --dns-servers) _known_hosts_real -- "$cur" return ;; esac $split && return if [[ $cur == -* ]]; then # strip everything following a :, inclusive # strip everything following a =, exclusive # expand -X; -Y to -X -Y # expand -X/-Y/-Z to -X -Y -Z # expand -X/Y/Z to -X -Y -Z # expand --foo/bar to --foo --bar # strip everything following a non-option name or = char # TODO: should expand -T<0-5> to -T0 ... -T5 COMPREPLY=($(compgen -W "$( "$1" --help 2>&1 | command sed \ -e "s/:.*$//" \ -e "s/=.*$/=/" \ -e "s/;[[:space:]]*-/ -/g" \ -e "s/\/-/ -/g" \ -e "/^[[:space:]]*-[^-]/s/\/\([^-]\)/ -\1/g" \ -e "/^[[:space:]]*--/s/\/\([^-]\)/ --\1/g" \ -e "s/[^[:space:]a-zA-Z0-9=-].*$//" )" \ -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace else _known_hosts_real -- "$cur" fi } && complete -F _nmap nmap # ex: filetype=sh mountpoint 0000644 00000000762 15036124164 0006712 0 ustar 00 _mountpoint_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS="--quiet --nofollow --fs-devno --devno --help --version" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- ${cur:-"/"}) ) return 0 } complete -F _mountpoint_module mountpoint hunspell 0000644 00000002001 15036124164 0006314 0 ustar 00 # hunspell(1) completion -*- shell-script -*- _hunspell() { local cur prev words cword _init_completion || return case $prev in --help | --version | -vv | -[hPv]) return ;; -d) local IFS=$' \t\n' reset=$(shopt -p nullglob) shopt -s nullglob local -a dicts=(/usr/share/hunspell/*.dic /usr/local/share/hunspell/*.dic) dicts=("${dicts[@]##*/}") dicts=("${dicts[@]%.dic}") $reset IFS=$'\n' COMPREPLY=($(compgen -W '${dicts[@]}' -- "$cur")) return ;; -i) _xfunc iconv _iconv_charsets return ;; -p) _filedir return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) return fi _filedir } && complete -F _hunspell hunspell # ex: filetype=sh mysql 0000644 00000005147 15036124164 0005645 0 ustar 00 # mysql(1) completion -*- shell-script -*- _mysql_character_sets() { local IFS=$' \t\n' reset=$(shopt -p failglob) shopt -u failglob local -a charsets=(/usr/share/m{ariadb,ysql}/charsets/*.xml) $reset charsets=("${charsets[@]##*/}") charsets=("${charsets[@]%%?(Index|\*).xml}" utf8) COMPREPLY+=($(compgen -W '${charsets[@]}' -- "$cur")) } _mysql() { local cur prev words cword split _init_completion -s || return case $prev in --user | -!(-*)u) COMPREPLY=($(compgen -u -- "$cur")) return ;; --database | -!(-*)D) COMPREPLY=($(compgen -W "$(mysqlshow 2>/dev/null | command sed -ne '2d' -e 's/^|.\([^|]*\)|.*/\1/p')" -- "$cur")) return ;; --host | -!(-*)h) _known_hosts_real -- "$cur" return ;; --default-character-set) _mysql_character_sets return ;; --character-sets-dir | --ssl-capath) _filedir -d return ;; --socket | -!(-*)S) _filedir sock return ;; --protocol) COMPREPLY=($(compgen -W 'tcp socket pipe memory' -- "$cur")) return ;; --defaults-file | --defaults-extra-file | --tee) _filedir return ;; --ssl-ca | --ssl-cert) _filedir '@(pem|cer|c?(e)rt)' return ;; --ssl-key) _filedir '@(pem|key)' return ;; --port | --set-variable | --ssl-cipher | --connect_timeout | \ --max_allowed_packet | --prompt | --net_buffer_length | --select_limit | \ --max_join_size | --server-arg | --debug | --delimiter | --execute | --pager | \ -!(-*)[Pe]) return ;; --help | --version | -!(-*)[?IV]) return ;; esac $split && return case $cur in --*) local help=$(_parse_help "$1") help+=" --skip-comments --skip-ssl" COMPREPLY=($(compgen -W "$help" -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return ;; # only complete long options -) compopt -o nospace COMPREPLY=(--) return ;; esac COMPREPLY=($(compgen -W \ "$(mysqlshow 2>/dev/null | command sed -ne '2d' -e 's/^|.\([^|]*\)|.*/\1/p')" \ -- "$cur")) } && complete -F _mysql mysql # ex: filetype=sh mkfs.bfs 0000644 00000001245 15036124164 0006204 0 ustar 00 _mkfs.bfs_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-N'|'--inodes') COMPREPLY=( $(compgen -W "number" -- $cur) ) return 0 ;; '-V'|'--vname'|'-F'|'--fname') COMPREPLY=( $(compgen -W "name" -- $cur) ) return 0 ;; '-h'|'--help'|'--version') return 0 ;; esac case $cur in -*) OPTS='--inodes --vname --fname --verbose --help --version' COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac compopt -o bashdefault -o default COMPREPLY=( $(compgen -W "$(lsblk -pnro name)" -- $cur) ) return 0 } complete -F _mkfs.bfs_module mkfs.bfs postconf 0000644 00000001453 15036124164 0006327 0 ustar 00 # postconf(1) completion -*- shell-script -*- _postconf() { local cur prev words cword _init_completion || return local eqext case $prev in -b | -t) _filedir return ;; -c) _filedir -d return ;; -e) cur=${cur#[\"\']} eqext='=' ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_usage "$1")' -- "$cur")) return fi local len=${#cur} pval for pval in $(/usr/sbin/postconf 2>/dev/null | cut -d ' ' -f 1); do if [[ $cur == "${pval:0:len}" ]]; then COMPREPLY+=("$pval${eqext-}") fi done } && complete -F _postconf postconf # ex: filetype=sh kldunload 0000644 00000000564 15036124164 0006453 0 ustar 00 # FreeBSD kldunload completion -*- shell-script -*- [[ $OSTYPE == *freebsd* ]] || return 1 _kldunload() { local cur prev words cword _init_completion || return COMPREPLY=($(compgen -W '$(kldstat)' -X 'kernel' -X '!*.ko' -- "$cur")) COMPREPLY=(${COMPREPLY[@]%.ko}) } && complete -F _kldunload kldunload # ex: filetype=sh cvs 0000644 00000027377 15036124164 0005304 0 ustar 00 # cvs(1) completion -*- shell-script -*- _cvs_entries() { local prefix=${cur%/*}/ IFS=$'\n' [[ -e ${prefix:-}CVS/Entries ]] || prefix="" entries=($(cut -d/ -f2 -s ${prefix:-}CVS/Entries 2>/dev/null)) if [[ $entries ]]; then entries=("${entries[@]/#/${prefix:-}}") compopt -o filenames fi } _cvs_modules() { if [[ -n $prefix ]]; then COMPREPLY=($(command ls -d ${cvsroot}/${prefix}/!(CVSROOT))) else COMPREPLY=($(command ls -d ${cvsroot}/!(CVSROOT))) fi } _cvs_commands() { cvs --help-commands 2>&1 | awk '/^( *|\t)/ { print $1 }' } _cvs_command_options() { COMPREPLY=($(compgen -W '$(_parse_help "$1" "--help $2")' -- "$cur")) } _cvs_kflags() { COMPREPLY=($(compgen -W 'kv kvl k o b v' -- "$cur")) } _cvs_roots() { local -a cvsroots [[ -v CVSROOT ]] && cvsroots=("$CVSROOT") [[ -r ~/.cvspass ]] && cvsroots+=($(awk '{ print $2 }' ~/.cvspass)) [[ -r CVS/Root ]] && mapfile -tO ${#cvsroots[@]} cvsroots <CVS/Root COMPREPLY=($(compgen -W '${cvsroots[@]}' -- "$cur")) __ltrim_colon_completions "$cur" } _cvs() { local cur prev words cword _init_completion -n : || return local count mode i cvsroot cvsroots pwd local -a flags files entries changed newremoved count=0 for i in "${words[@]}"; do ((count == cword)) && break # Last parameter was the CVSROOT, now go back to mode selection if [[ ${words[count]} == "${cvsroot-}" && ${mode-} == cvsroot ]]; then mode="" fi if [[ ! -v mode ]]; then case $i in --help | -!(-*)H) COMPREPLY=($(compgen -W "$(_cvs_commands)" -- "$cur")) return ;; -!(-*)d) mode=cvsroot cvsroot=${words[count + 1]} ;; add | ad | new) mode=add ;; admin | adm | rcs) mode="admin" ;; annotate | ann | blame | rannotate | rann | ra) mode=annotate ;; checkout | co | get) mode=checkout ;; commit | ci | com) mode=commit ;; diff | di | dif) mode="diff" ;; export | ex | exp) mode="export" ;; edit | unedit | editors | logout | pserver | server | watch | watchers) mode=$i ;; history | hi | his) mode=history ;; import | im | imp) mode=import ;; log | lo | rlog | rl) mode=log ;; login | logon | lgn) mode=login ;; rdiff | patch | pa) mode=rdiff ;; release | re | rel) mode=release ;; remove | rm | delete) mode=remove ;; rtag | rt | rfreeze) mode=rtag ;; status | st | stat) mode=status ;; tag | ta | freeze) mode=tag ;; update | up | upd) mode=update ;; version | ve | ver) mode=version ;; esac elif [[ $i == -* ]]; then flags+=($i) fi ((count++)) done case ${mode-} in add) case $prev in --*) ;; -*m) return ;; -*k) _cvs_kflags return ;; esac if [[ $cur != -* ]]; then _cvs_entries [[ -z $cur ]] && files=(!(CVS)) || files=($(command ls -d ${cur}* 2>/dev/null)) local f for i in "${!files[@]}"; do if [[ ${files[i]} == ?(*/)CVS ]]; then unset 'files[i]' else for f in "${entries[@]}"; do if [[ ${files[i]} == "$f" && ! -d $f ]]; then unset 'files[i]' break fi done fi done COMPREPLY=($(compgen -X "$_backup_glob" -W '${files[@]}' \ -- "$cur")) else _cvs_command_options "$1" $mode fi ;; admin) case $prev in --*) ;; -*@([aAbcelmnNosu]|t-)) return ;; -*t) _filedir return ;; -*k) _cvs_kflags return ;; esac if [[ $cur == -* ]]; then _cvs_command_options "$1" $mode else _cvs_entries COMPREPLY=($(compgen -W '${entries[@]}' -- "$cur")) fi ;; annotate) [[ $prev == -[rD] ]] && return if [[ $cur == -* ]]; then _cvs_command_options "$1" $mode else _cvs_entries COMPREPLY=($(compgen -W '${entries[@]}' -- "$cur")) fi ;; checkout) case $prev in --*) ;; -*[rDj]) return ;; -*d) _filedir -d return ;; -*k) _cvs_kflags return ;; esac if [[ $cur != -* ]]; then [[ ! -v cvsroot ]] && cvsroot=${CVSROOT-} COMPREPLY=($(cvs -d "$cvsroot" co -c 2>/dev/null | awk '{print $1}')) COMPREPLY=($(compgen -W '${COMPREPLY[@]}' -- "$cur")) else _cvs_command_options "$1" $mode fi ;; commit) case $prev in --*) ;; -*[mr]) return ;; -*F) _filedir return ;; esac if [[ $cur != -* ]]; then # if $COMP_CVS_REMOTE is not null, 'cvs commit' will # complete on remotely checked-out files (requires # passwordless access to the remote repository if [[ -n ${COMP_CVS_REMOTE:-} ]]; then # this is the least computationally intensive way found so # far, but other changes (something other than # changed/removed/new) may be missing changed=($(cvs -q diff --brief 2>&1 | command sed -ne 's/^Files [^ ]* and \([^ ]*\) differ$/\1/p')) newremoved=($(cvs -q diff --brief 2>&1 | command sed -ne 's/^cvs diff: \([^ ]*\) .*, no comparison available$/\1/p')) COMPREPLY=($(compgen -W '${changed[@]:-} \ ${newremoved[@]:-}' -- "$cur")) else _cvs_entries COMPREPLY=($(compgen -W '${entries[@]}' -- "$cur")) fi else _cvs_command_options "$1" $mode fi ;; cvsroot) _cvs_roots ;; diff | log) if [[ $cur == -* ]]; then _cvs_command_options "$1" $mode [[ ${COMPREPLY-} == *= ]] && compopt -o nospace else _cvs_entries COMPREPLY=($(compgen -W '${entries[@]:-}' -- "$cur")) fi ;; editors | watchers) if [[ $cur == -* ]]; then _cvs_command_options "$1" $mode else _cvs_entries COMPREPLY=($(compgen -W '${entries[@]}' -- "$cur")) fi ;; export) case $prev in --*) ;; -*[rD]) return ;; -*d) _filedir -d return ;; -*k) _cvs_kflags return ;; esac if [[ $cur != -* ]]; then [[ ! -v cvsroot ]] && cvsroot=${CVSROOT-} COMPREPLY=($(cvs -d "$cvsroot" co -c | awk '{print $1}')) COMPREPLY=($(compgen -W '${COMPREPLY[@]}' -- "$cur")) else _cvs_command_options "$1" $mode fi ;; import) case $prev in --*) ;; -*[IbmW]) return ;; -*k) _cvs_kflags return ;; esac if [[ $cur != -* ]]; then # starts with same algorithm as checkout [[ ! -v cvsroot ]] && cvsroot=${CVSROOT-} local prefix=${cur%/*} if [[ -r ${cvsroot}/${prefix} ]]; then _cvs_modules COMPREPLY=(${COMPREPLY[@]#$cvsroot}) COMPREPLY=(${COMPREPLY[@]#\/}) fi pwd=$(pwd) pwd=${pwd##*/} COMPREPLY=($(compgen -W '${COMPREPLY[@]} $pwd' -- "$cur")) else _cvs_command_options "$1" $mode fi ;; remove) if [[ $cur != -* ]]; then _cvs_entries if [[ $prev != -f ]]; then # find out what files are missing for i in "${!entries[@]}"; do [[ -r ${entries[i]} ]] && unset 'entries[i]' done fi COMPREPLY=($(compgen -W '${entries[@]:-}' -- "$cur")) else _cvs_command_options "$1" $mode fi ;; update) case $prev in --*) ;; -*[rDjIW]) return ;; -*k) _cvs_kflags return ;; esac if [[ $cur == -* ]]; then _cvs_command_options "$1" $mode else _cvs_entries COMPREPLY=($(compgen -W '${entries[@]}' -- "$cur")) fi ;; "") case $prev in --*) ;; -*T) _filedir -d return ;; -*[es]) return ;; -*z) COMPREPLY=($(compgen -W '{1..9}' -- "$cur")) return ;; esac COMPREPLY=($(compgen -W '$(_cvs_commands) $(_parse_help "$1" --help-options) --help --help-commands --help-options --version' -- "$cur")) ;; esac } && complete -F _cvs cvs # ex: filetype=sh mkfs.minix 0000644 00000001355 15036124164 0006560 0 ustar 00 _mkfs.minix_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-i'|'--inodes') COMPREPLY=( $(compgen -W "inodes" -- $cur) ) return 0 ;; '-l'|'--badblocks') compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 ;; '-n'|'--namelength') COMPREPLY=( $(compgen -W "14 30 60" -- $cur) ) return 0 ;; esac case $cur in -*) OPTS="--namelength --inodes --check --badblocks --help --version -1 -2 -3" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac compopt -o bashdefault -o default COMPREPLY=( $(compgen -W "$(lsblk -pnro name)" -- $cur) ) return 0 } complete -F _mkfs.minix_module mkfs.minix list_members 0000644 00000001526 15036124164 0007162 0 ustar 00 # mailman list_members completion -*- shell-script -*- _list_members() { local cur prev words cword split _init_completion -s || return case $prev in -o | --output) _filedir return ;; -d | --digest) COMPREPLY=($(compgen -W 'mime plain' -- "$cur")) return ;; -n | --nomail) COMPREPLY=($(compgen -W 'byadmin byuser bybounce unknown' \ -- "$cur")) return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '--output --regular --digest --nomail --fullnames --preserve --help' -- "$cur")) else _xfunc list_lists _mailman_lists fi } && complete -F _list_members list_members # ex: filetype=sh zopflipng 0000644 00000001630 15036124164 0006501 0 ustar 00 # bash completion for zopflipng -*- shell-script -*- _zopflipng() { local cur prev words cword split _init_completion -s || return case $prev in -h | --help) return ;; --splitting) COMPREPLY=($(compgen -W '{0..3}' -- "$cur")) return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(_parse_help "$1" -h)) COMPREPLY=($(compgen -W '${COMPREPLY[@]%:}' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return fi if [[ ${words[*]} != *\ --prefix=* ]]; then # 2 png args only if --prefix not given local args _count_args ((args < 3)) && _filedir png else # otherwise arbitrary number of png args _filedir png fi } && complete -F _zopflipng zopflipng # ex: filetype=sh qrunner 0000644 00000000607 15036124164 0006166 0 ustar 00 # mailman qrunner completion -*- shell-script -*- _qrunner() { local cur prev words cword split _init_completion -s || return $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '--runner --once --list --verbose --subproc --help' -- "$cur")) fi } && complete -F _qrunner qrunner # ex: filetype=sh ngrep 0000644 00000001521 15036124164 0005603 0 ustar 00 # ngrep(8) completion -*- shell-script -*- _ngrep() { local cur prev words cword _init_completion || return case $prev in -h | -V | -n | -A | -s | -S | -c | -P) return ;; -I | -O) _filedir 'pcap?(ng)' return ;; -d) _available_interfaces -a COMPREPLY+=($(compgen -W 'any' -- "$cur")) return ;; -W) COMPREPLY=($(compgen -W 'normal byline single none' -- "$cur")) return ;; -F) _filedir return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1" -h)' -- "$cur")) return fi } && complete -F _ngrep ngrep # ex: filetype=sh wget 0000644 00000014753 15036124164 0005451 0 ustar 00 # wget(1) completion -*- shell-script -*- _wget() { local cur prev words cword split _init_completion -s || return case $prev in --version | --help | -!(-*)[hV]) return ;; --progress) COMPREPLY=($(compgen -W 'bar dot' -- "$cur")) return ;; --bind-address) _ip_addresses return ;; --domains | --exclude-domains | -!(-*)D) _known_hosts_real -- "$cur" return ;; --restrict-file-names) local excludes=() case $cur in *unix* | *windows*) excludes=(windows unix) ;;& *lowercase* | *uppercase*) excludes+=(lowercase uppercase) ;;& *nocontrol*) excludes+=(nocontrol) ;;& *ascii*) excludes+=(ascii) ;; esac local excludes_str=$( export IFS='|' echo "${excludes[*]}" ) # prevopt is the previous options string used as a prefix # to avoid COMPREPLY replacing them with the $lastopt completion local lastopt=${cur/*,/} prevopt= [[ $cur == *,* ]] && prevopt=${cur%,*}, COMPREPLY=($(compgen -P "$prevopt" -X "@($excludes_str)" \ -W 'unix windows nocontrol ascii lowercase uppercase' \ -- "$lastopt")) # +o nospace when no more valid option is possible (= append a space) local opt_as_arr=(${COMPREPLY[0]//,/ }) ((${#opt_as_arr[@]} < 4)) && compopt -o nospace return ;; --prefer-family) COMPREPLY=($(compgen -W 'IPv4 IPv6 none' -- "$cur")) return ;; --directory-prefix | --ca-directory | --warc-tempdir | -!(-*)P) _filedir -d return ;; --output-file | --append-output | --config | --load-cookies | --save-cookies | \ --post-file | --certificate | --ca-certificate | --private-key | \ --random-file | --egd-file | --warc-file | --warc-dedup | -!(-*)[oa]) _filedir return ;; --output-document | --input-file | -!(-*)[Oi]) _filedir && [[ $cur == - || -z $cur ]] && COMPREPLY+=(-) return ;; --secure-protocol) COMPREPLY=($(compgen -W 'auto SSLv2 SSLv3 TLSv1' -- "$cur")) return ;; --certificate-type | --private-key-type) COMPREPLY=($(compgen -W 'PEM DER' -- "$cur")) return ;; --follow-tags | --ignore-tags) local lastopt=${cur/*,/} prevopt= [[ $cur == *,* ]] && prevopt=${cur%,*}, COMPREPLY=($(compgen -P "$prevopt" -W 'a abbr acronym address applet area b base basefont bdo big blockquote body br button caption center cite code col colgroup dd del dir div dfn dl dt em fieldset font form frame frameset h6 head hr html i iframe img input ins isindex kbd label legend li link map menu meta noframes noscript object ol optgroup option p param pre q s samp script select small span strike strong style sub sup table tbody td textarea tfoot th thead title tr tt u ul var xmp' \ -- "$lastopt")) return ;; --tries | --timeout | --dns-timeout | --connect-timeout | --read-timeout | \ --wait | --waitretry | --cut-dirs | --max-redirect | --level | -!(-*)[tTwl]) # expect integer number COMPREPLY+=($(compgen -P "$cur" -W "{0..9}")) compopt -o nospace return ;; --quota | --limit-rate | --warc-max-size | -!(-*)Q) # expect size if [[ $cur == *[km] ]]; then COMPREPLY=($(compgen -W "$cur")) elif [[ $cur ]]; then COMPREPLY=($(compgen -P "$cur" -W "{0..9} k m")) compopt -o nospace else COMPREPLY=($(compgen -W "{0..9}")) compopt -o nospace fi return ;; --user | --http-user | --proxy-user | --ftp-user) COMPREPLY=($(compgen -W "$(command sed -n \ '/^login/s/^[[:blank:]]*login[[:blank:]]//p' ~/.netrc \ 2>/dev/null)" -- "$cur")) return ;; --header) COMPREPLY=($(compgen -W 'Accept Accept-Charset Accept-Encoding Accept-Language Accept-Ranges Age Allow Authorization Cache-Control Connection Content-Encoding Content-Language Content-Length Content-Location Content-MD5 Content-Range Content-Type Date ETag Expect Expires From Host If-Match If-Modified-Since If-None-Match If-Range If-Unmodified-Since Last-Modified Location Max-Forwards Pragma Proxy-Authenticate Proxy-Authorization Range Referer Retry-After Server TE Trailer Transfer-Encoding Upgrade User-Agent Vary Via Warning WWW-Authenticate' -- "$cur")) compopt -o nospace return ;; --local-encoding | --remote-encoding) type -P xauth &>/dev/null && _xfunc iconv _iconv_charsets return ;; --execute | -!(-*)e) return # TODO base=STR ;; --report-speed) COMPREPLY=($(compgen -W 'bits' -- "$cur")) return ;; --regex-type) COMPREPLY=($(compgen -W 'posix' -- "$cur")) return ;; --base | --password | --ftp-password | --http-password | --proxy-password | \ --default-page | --referer | --user-agent | --post-data | --warc-header | \ --accept | --reject | --accept-regex | --reject-regex | --include-directories | \ --exclude-directories | -!(-*)[BUARIX]) # argument required but no completions available return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace fi } && complete -F _wget wget # ex: filetype=sh restic 0000644 00000211770 15036124164 0005772 0 ustar 00 # bash completion for restic -*- shell-script -*- __restic_debug() { if [[ -n ${BASH_COMP_DEBUG_FILE:-} ]]; then echo "$*" >> "${BASH_COMP_DEBUG_FILE}" fi } # Homebrew on Macs have version 1.3 of bash-completion which doesn't include # _init_completion. This is a very minimal version of that function. __restic_init_completion() { COMPREPLY=() _get_comp_words_by_ref "$@" cur prev words cword } __restic_index_of_word() { local w word=$1 shift index=0 for w in "$@"; do [[ $w = "$word" ]] && return index=$((index+1)) done index=-1 } __restic_contains_word() { local w word=$1; shift for w in "$@"; do [[ $w = "$word" ]] && return done return 1 } __restic_handle_go_custom_completion() { __restic_debug "${FUNCNAME[0]}: cur is ${cur}, words[*] is ${words[*]}, #words[@] is ${#words[@]}" local shellCompDirectiveError=1 local shellCompDirectiveNoSpace=2 local shellCompDirectiveNoFileComp=4 local shellCompDirectiveFilterFileExt=8 local shellCompDirectiveFilterDirs=16 local out requestComp lastParam lastChar comp directive args # Prepare the command to request completions for the program. # Calling ${words[0]} instead of directly restic allows to handle aliases args=("${words[@]:1}") requestComp="${words[0]} __completeNoDesc ${args[*]}" lastParam=${words[$((${#words[@]}-1))]} lastChar=${lastParam:$((${#lastParam}-1)):1} __restic_debug "${FUNCNAME[0]}: lastParam ${lastParam}, lastChar ${lastChar}" if [ -z "${cur}" ] && [ "${lastChar}" != "=" ]; then # If the last parameter is complete (there is a space following it) # We add an extra empty parameter so we can indicate this to the go method. __restic_debug "${FUNCNAME[0]}: Adding extra empty parameter" requestComp="${requestComp} \"\"" fi __restic_debug "${FUNCNAME[0]}: calling ${requestComp}" # Use eval to handle any environment variables and such out=$(eval "${requestComp}" 2>/dev/null) # Extract the directive integer at the very end of the output following a colon (:) directive=${out##*:} # Remove the directive out=${out%:*} if [ "${directive}" = "${out}" ]; then # There is not directive specified directive=0 fi __restic_debug "${FUNCNAME[0]}: the completion directive is: ${directive}" __restic_debug "${FUNCNAME[0]}: the completions are: ${out[*]}" if [ $((directive & shellCompDirectiveError)) -ne 0 ]; then # Error code. No completion. __restic_debug "${FUNCNAME[0]}: received error from custom completion go code" return else if [ $((directive & shellCompDirectiveNoSpace)) -ne 0 ]; then if [[ $(type -t compopt) = "builtin" ]]; then __restic_debug "${FUNCNAME[0]}: activating no space" compopt -o nospace fi fi if [ $((directive & shellCompDirectiveNoFileComp)) -ne 0 ]; then if [[ $(type -t compopt) = "builtin" ]]; then __restic_debug "${FUNCNAME[0]}: activating no file completion" compopt +o default fi fi fi if [ $((directive & shellCompDirectiveFilterFileExt)) -ne 0 ]; then # File extension filtering local fullFilter filter filteringCmd # Do not use quotes around the $out variable or else newline # characters will be kept. for filter in ${out[*]}; do fullFilter+="$filter|" done filteringCmd="_filedir $fullFilter" __restic_debug "File filtering command: $filteringCmd" $filteringCmd elif [ $((directive & shellCompDirectiveFilterDirs)) -ne 0 ]; then # File completion for directories only local subdir # Use printf to strip any trailing newline subdir=$(printf "%s" "${out[0]}") if [ -n "$subdir" ]; then __restic_debug "Listing directories in $subdir" __restic_handle_subdirs_in_dir_flag "$subdir" else __restic_debug "Listing directories in ." _filedir -d fi else while IFS='' read -r comp; do COMPREPLY+=("$comp") done < <(compgen -W "${out[*]}" -- "$cur") fi } __restic_handle_reply() { __restic_debug "${FUNCNAME[0]}" local comp case $cur in -*) if [[ $(type -t compopt) = "builtin" ]]; then compopt -o nospace fi local allflags if [ ${#must_have_one_flag[@]} -ne 0 ]; then allflags=("${must_have_one_flag[@]}") else allflags=("${flags[*]} ${two_word_flags[*]}") fi while IFS='' read -r comp; do COMPREPLY+=("$comp") done < <(compgen -W "${allflags[*]}" -- "$cur") if [[ $(type -t compopt) = "builtin" ]]; then [[ "${COMPREPLY[0]}" == *= ]] || compopt +o nospace fi # complete after --flag=abc if [[ $cur == *=* ]]; then if [[ $(type -t compopt) = "builtin" ]]; then compopt +o nospace fi local index flag flag="${cur%=*}" __restic_index_of_word "${flag}" "${flags_with_completion[@]}" COMPREPLY=() if [[ ${index} -ge 0 ]]; then PREFIX="" cur="${cur#*=}" ${flags_completion[${index}]} if [ -n "${ZSH_VERSION:-}" ]; then # zsh completion needs --flag= prefix eval "COMPREPLY=( \"\${COMPREPLY[@]/#/${flag}=}\" )" fi fi fi if [[ -z "${flag_parsing_disabled}" ]]; then # If flag parsing is enabled, we have completed the flags and can return. # If flag parsing is disabled, we may not know all (or any) of the flags, so we fallthrough # to possibly call handle_go_custom_completion. return 0; fi ;; esac # check if we are handling a flag with special work handling local index __restic_index_of_word "${prev}" "${flags_with_completion[@]}" if [[ ${index} -ge 0 ]]; then ${flags_completion[${index}]} return fi # we are parsing a flag and don't have a special handler, no completion if [[ ${cur} != "${words[cword]}" ]]; then return fi local completions completions=("${commands[@]}") if [[ ${#must_have_one_noun[@]} -ne 0 ]]; then completions+=("${must_have_one_noun[@]}") elif [[ -n "${has_completion_function}" ]]; then # if a go completion function is provided, defer to that function __restic_handle_go_custom_completion fi if [[ ${#must_have_one_flag[@]} -ne 0 ]]; then completions+=("${must_have_one_flag[@]}") fi while IFS='' read -r comp; do COMPREPLY+=("$comp") done < <(compgen -W "${completions[*]}" -- "$cur") if [[ ${#COMPREPLY[@]} -eq 0 && ${#noun_aliases[@]} -gt 0 && ${#must_have_one_noun[@]} -ne 0 ]]; then while IFS='' read -r comp; do COMPREPLY+=("$comp") done < <(compgen -W "${noun_aliases[*]}" -- "$cur") fi if [[ ${#COMPREPLY[@]} -eq 0 ]]; then if declare -F __restic_custom_func >/dev/null; then # try command name qualified custom func __restic_custom_func else # otherwise fall back to unqualified for compatibility declare -F __custom_func >/dev/null && __custom_func fi fi # available in bash-completion >= 2, not always present on macOS if declare -F __ltrim_colon_completions >/dev/null; then __ltrim_colon_completions "$cur" fi # If there is only 1 completion and it is a flag with an = it will be completed # but we don't want a space after the = if [[ "${#COMPREPLY[@]}" -eq "1" ]] && [[ $(type -t compopt) = "builtin" ]] && [[ "${COMPREPLY[0]}" == --*= ]]; then compopt -o nospace fi } # The arguments should be in the form "ext1|ext2|extn" __restic_handle_filename_extension_flag() { local ext="$1" _filedir "@(${ext})" } __restic_handle_subdirs_in_dir_flag() { local dir="$1" pushd "${dir}" >/dev/null 2>&1 && _filedir -d && popd >/dev/null 2>&1 || return } __restic_handle_flag() { __restic_debug "${FUNCNAME[0]}: c is $c words[c] is ${words[c]}" # if a command required a flag, and we found it, unset must_have_one_flag() local flagname=${words[c]} local flagvalue="" # if the word contained an = if [[ ${words[c]} == *"="* ]]; then flagvalue=${flagname#*=} # take in as flagvalue after the = flagname=${flagname%=*} # strip everything after the = flagname="${flagname}=" # but put the = back fi __restic_debug "${FUNCNAME[0]}: looking for ${flagname}" if __restic_contains_word "${flagname}" "${must_have_one_flag[@]}"; then must_have_one_flag=() fi # if you set a flag which only applies to this command, don't show subcommands if __restic_contains_word "${flagname}" "${local_nonpersistent_flags[@]}"; then commands=() fi # keep flag value with flagname as flaghash # flaghash variable is an associative array which is only supported in bash > 3. if [[ -z "${BASH_VERSION:-}" || "${BASH_VERSINFO[0]:-}" -gt 3 ]]; then if [ -n "${flagvalue}" ] ; then flaghash[${flagname}]=${flagvalue} elif [ -n "${words[ $((c+1)) ]}" ] ; then flaghash[${flagname}]=${words[ $((c+1)) ]} else flaghash[${flagname}]="true" # pad "true" for bool flag fi fi # skip the argument to a two word flag if [[ ${words[c]} != *"="* ]] && __restic_contains_word "${words[c]}" "${two_word_flags[@]}"; then __restic_debug "${FUNCNAME[0]}: found a flag ${words[c]}, skip the next argument" c=$((c+1)) # if we are looking for a flags value, don't show commands if [[ $c -eq $cword ]]; then commands=() fi fi c=$((c+1)) } __restic_handle_noun() { __restic_debug "${FUNCNAME[0]}: c is $c words[c] is ${words[c]}" if __restic_contains_word "${words[c]}" "${must_have_one_noun[@]}"; then must_have_one_noun=() elif __restic_contains_word "${words[c]}" "${noun_aliases[@]}"; then must_have_one_noun=() fi nouns+=("${words[c]}") c=$((c+1)) } __restic_handle_command() { __restic_debug "${FUNCNAME[0]}: c is $c words[c] is ${words[c]}" local next_command if [[ -n ${last_command} ]]; then next_command="_${last_command}_${words[c]//:/__}" else if [[ $c -eq 0 ]]; then next_command="_restic_root_command" else next_command="_${words[c]//:/__}" fi fi c=$((c+1)) __restic_debug "${FUNCNAME[0]}: looking for ${next_command}" declare -F "$next_command" >/dev/null && $next_command } __restic_handle_word() { if [[ $c -ge $cword ]]; then __restic_handle_reply return fi __restic_debug "${FUNCNAME[0]}: c is $c words[c] is ${words[c]}" if [[ "${words[c]}" == -* ]]; then __restic_handle_flag elif __restic_contains_word "${words[c]}" "${commands[@]}"; then __restic_handle_command elif [[ $c -eq 0 ]]; then __restic_handle_command elif __restic_contains_word "${words[c]}" "${command_aliases[@]}"; then # aliashash variable is an associative array which is only supported in bash > 3. if [[ -z "${BASH_VERSION:-}" || "${BASH_VERSINFO[0]:-}" -gt 3 ]]; then words[c]=${aliashash[${words[c]}]} __restic_handle_command else __restic_handle_noun fi else __restic_handle_noun fi __restic_handle_word } _restic_backup() { last_command="restic_backup" command_aliases=() commands=() flags=() two_word_flags=() local_nonpersistent_flags=() flags_with_completion=() flags_completion=() flags+=("--exclude=") two_word_flags+=("--exclude") two_word_flags+=("-e") local_nonpersistent_flags+=("--exclude") local_nonpersistent_flags+=("--exclude=") local_nonpersistent_flags+=("-e") flags+=("--exclude-caches") local_nonpersistent_flags+=("--exclude-caches") flags+=("--exclude-file=") two_word_flags+=("--exclude-file") local_nonpersistent_flags+=("--exclude-file") local_nonpersistent_flags+=("--exclude-file=") flags+=("--exclude-if-present=") two_word_flags+=("--exclude-if-present") local_nonpersistent_flags+=("--exclude-if-present") local_nonpersistent_flags+=("--exclude-if-present=") flags+=("--exclude-larger-than=") two_word_flags+=("--exclude-larger-than") local_nonpersistent_flags+=("--exclude-larger-than") local_nonpersistent_flags+=("--exclude-larger-than=") flags+=("--files-from=") two_word_flags+=("--files-from") local_nonpersistent_flags+=("--files-from") local_nonpersistent_flags+=("--files-from=") flags+=("--files-from-raw=") two_word_flags+=("--files-from-raw") local_nonpersistent_flags+=("--files-from-raw") local_nonpersistent_flags+=("--files-from-raw=") flags+=("--files-from-verbatim=") two_word_flags+=("--files-from-verbatim") local_nonpersistent_flags+=("--files-from-verbatim") local_nonpersistent_flags+=("--files-from-verbatim=") flags+=("--force") flags+=("-f") local_nonpersistent_flags+=("--force") local_nonpersistent_flags+=("-f") flags+=("--host=") two_word_flags+=("--host") two_word_flags+=("-H") local_nonpersistent_flags+=("--host") local_nonpersistent_flags+=("--host=") local_nonpersistent_flags+=("-H") flags+=("--iexclude=") two_word_flags+=("--iexclude") local_nonpersistent_flags+=("--iexclude") local_nonpersistent_flags+=("--iexclude=") flags+=("--iexclude-file=") two_word_flags+=("--iexclude-file") local_nonpersistent_flags+=("--iexclude-file") local_nonpersistent_flags+=("--iexclude-file=") flags+=("--ignore-ctime") local_nonpersistent_flags+=("--ignore-ctime") flags+=("--ignore-inode") local_nonpersistent_flags+=("--ignore-inode") flags+=("--one-file-system") flags+=("-x") local_nonpersistent_flags+=("--one-file-system") local_nonpersistent_flags+=("-x") flags+=("--parent=") two_word_flags+=("--parent") local_nonpersistent_flags+=("--parent") local_nonpersistent_flags+=("--parent=") flags+=("--stdin") local_nonpersistent_flags+=("--stdin") flags+=("--stdin-filename=") two_word_flags+=("--stdin-filename") local_nonpersistent_flags+=("--stdin-filename") local_nonpersistent_flags+=("--stdin-filename=") flags+=("--tag=") two_word_flags+=("--tag") local_nonpersistent_flags+=("--tag") local_nonpersistent_flags+=("--tag=") flags+=("--time=") two_word_flags+=("--time") local_nonpersistent_flags+=("--time") local_nonpersistent_flags+=("--time=") flags+=("--with-atime") local_nonpersistent_flags+=("--with-atime") flags+=("--cacert=") two_word_flags+=("--cacert") flags+=("--cache-dir=") two_word_flags+=("--cache-dir") flags+=("--cleanup-cache") flags+=("--json") flags+=("--key-hint=") two_word_flags+=("--key-hint") flags+=("--limit-download=") two_word_flags+=("--limit-download") flags+=("--limit-upload=") two_word_flags+=("--limit-upload") flags+=("--no-cache") flags+=("--no-lock") flags+=("--option=") two_word_flags+=("--option") two_word_flags+=("-o") flags+=("--password-command=") two_word_flags+=("--password-command") flags+=("--password-file=") two_word_flags+=("--password-file") two_word_flags+=("-p") flags+=("--quiet") flags+=("-q") flags+=("--repo=") two_word_flags+=("--repo") two_word_flags+=("-r") flags+=("--repository-file=") two_word_flags+=("--repository-file") flags+=("--tls-client-cert=") two_word_flags+=("--tls-client-cert") flags+=("--verbose") flags+=("-v") must_have_one_flag=() must_have_one_noun=() noun_aliases=() } _restic_cache() { last_command="restic_cache" command_aliases=() commands=() flags=() two_word_flags=() local_nonpersistent_flags=() flags_with_completion=() flags_completion=() flags+=("--cleanup") local_nonpersistent_flags+=("--cleanup") flags+=("--max-age=") two_word_flags+=("--max-age") local_nonpersistent_flags+=("--max-age") local_nonpersistent_flags+=("--max-age=") flags+=("--no-size") local_nonpersistent_flags+=("--no-size") flags+=("--cacert=") two_word_flags+=("--cacert") flags+=("--cache-dir=") two_word_flags+=("--cache-dir") flags+=("--cleanup-cache") flags+=("--json") flags+=("--key-hint=") two_word_flags+=("--key-hint") flags+=("--limit-download=") two_word_flags+=("--limit-download") flags+=("--limit-upload=") two_word_flags+=("--limit-upload") flags+=("--no-cache") flags+=("--no-lock") flags+=("--option=") two_word_flags+=("--option") two_word_flags+=("-o") flags+=("--password-command=") two_word_flags+=("--password-command") flags+=("--password-file=") two_word_flags+=("--password-file") two_word_flags+=("-p") flags+=("--quiet") flags+=("-q") flags+=("--repo=") two_word_flags+=("--repo") two_word_flags+=("-r") flags+=("--repository-file=") two_word_flags+=("--repository-file") flags+=("--tls-client-cert=") two_word_flags+=("--tls-client-cert") flags+=("--verbose") flags+=("-v") must_have_one_flag=() must_have_one_noun=() noun_aliases=() } _restic_cat() { last_command="restic_cat" command_aliases=() commands=() flags=() two_word_flags=() local_nonpersistent_flags=() flags_with_completion=() flags_completion=() flags+=("--cacert=") two_word_flags+=("--cacert") flags+=("--cache-dir=") two_word_flags+=("--cache-dir") flags+=("--cleanup-cache") flags+=("--json") flags+=("--key-hint=") two_word_flags+=("--key-hint") flags+=("--limit-download=") two_word_flags+=("--limit-download") flags+=("--limit-upload=") two_word_flags+=("--limit-upload") flags+=("--no-cache") flags+=("--no-lock") flags+=("--option=") two_word_flags+=("--option") two_word_flags+=("-o") flags+=("--password-command=") two_word_flags+=("--password-command") flags+=("--password-file=") two_word_flags+=("--password-file") two_word_flags+=("-p") flags+=("--quiet") flags+=("-q") flags+=("--repo=") two_word_flags+=("--repo") two_word_flags+=("-r") flags+=("--repository-file=") two_word_flags+=("--repository-file") flags+=("--tls-client-cert=") two_word_flags+=("--tls-client-cert") flags+=("--verbose") flags+=("-v") must_have_one_flag=() must_have_one_noun=() noun_aliases=() } _restic_check() { last_command="restic_check" command_aliases=() commands=() flags=() two_word_flags=() local_nonpersistent_flags=() flags_with_completion=() flags_completion=() flags+=("--check-unused") local_nonpersistent_flags+=("--check-unused") flags+=("--read-data") local_nonpersistent_flags+=("--read-data") flags+=("--read-data-subset=") two_word_flags+=("--read-data-subset") local_nonpersistent_flags+=("--read-data-subset") local_nonpersistent_flags+=("--read-data-subset=") flags+=("--with-cache") local_nonpersistent_flags+=("--with-cache") flags+=("--cacert=") two_word_flags+=("--cacert") flags+=("--cache-dir=") two_word_flags+=("--cache-dir") flags+=("--cleanup-cache") flags+=("--json") flags+=("--key-hint=") two_word_flags+=("--key-hint") flags+=("--limit-download=") two_word_flags+=("--limit-download") flags+=("--limit-upload=") two_word_flags+=("--limit-upload") flags+=("--no-cache") flags+=("--no-lock") flags+=("--option=") two_word_flags+=("--option") two_word_flags+=("-o") flags+=("--password-command=") two_word_flags+=("--password-command") flags+=("--password-file=") two_word_flags+=("--password-file") two_word_flags+=("-p") flags+=("--quiet") flags+=("-q") flags+=("--repo=") two_word_flags+=("--repo") two_word_flags+=("-r") flags+=("--repository-file=") two_word_flags+=("--repository-file") flags+=("--tls-client-cert=") two_word_flags+=("--tls-client-cert") flags+=("--verbose") flags+=("-v") must_have_one_flag=() must_have_one_noun=() noun_aliases=() } _restic_copy() { last_command="restic_copy" command_aliases=() commands=() flags=() two_word_flags=() local_nonpersistent_flags=() flags_with_completion=() flags_completion=() flags+=("--host=") two_word_flags+=("--host") two_word_flags+=("-H") local_nonpersistent_flags+=("--host") local_nonpersistent_flags+=("--host=") local_nonpersistent_flags+=("-H") flags+=("--key-hint2=") two_word_flags+=("--key-hint2") local_nonpersistent_flags+=("--key-hint2") local_nonpersistent_flags+=("--key-hint2=") flags+=("--password-command2=") two_word_flags+=("--password-command2") local_nonpersistent_flags+=("--password-command2") local_nonpersistent_flags+=("--password-command2=") flags+=("--password-file2=") two_word_flags+=("--password-file2") local_nonpersistent_flags+=("--password-file2") local_nonpersistent_flags+=("--password-file2=") flags+=("--path=") two_word_flags+=("--path") local_nonpersistent_flags+=("--path") local_nonpersistent_flags+=("--path=") flags+=("--repo2=") two_word_flags+=("--repo2") local_nonpersistent_flags+=("--repo2") local_nonpersistent_flags+=("--repo2=") flags+=("--repository-file2=") two_word_flags+=("--repository-file2") local_nonpersistent_flags+=("--repository-file2") local_nonpersistent_flags+=("--repository-file2=") flags+=("--tag=") two_word_flags+=("--tag") local_nonpersistent_flags+=("--tag") local_nonpersistent_flags+=("--tag=") flags+=("--cacert=") two_word_flags+=("--cacert") flags+=("--cache-dir=") two_word_flags+=("--cache-dir") flags+=("--cleanup-cache") flags+=("--json") flags+=("--key-hint=") two_word_flags+=("--key-hint") flags+=("--limit-download=") two_word_flags+=("--limit-download") flags+=("--limit-upload=") two_word_flags+=("--limit-upload") flags+=("--no-cache") flags+=("--no-lock") flags+=("--option=") two_word_flags+=("--option") two_word_flags+=("-o") flags+=("--password-command=") two_word_flags+=("--password-command") flags+=("--password-file=") two_word_flags+=("--password-file") two_word_flags+=("-p") flags+=("--quiet") flags+=("-q") flags+=("--repo=") two_word_flags+=("--repo") two_word_flags+=("-r") flags+=("--repository-file=") two_word_flags+=("--repository-file") flags+=("--tls-client-cert=") two_word_flags+=("--tls-client-cert") flags+=("--verbose") flags+=("-v") must_have_one_flag=() must_have_one_noun=() noun_aliases=() } _restic_diff() { last_command="restic_diff" command_aliases=() commands=() flags=() two_word_flags=() local_nonpersistent_flags=() flags_with_completion=() flags_completion=() flags+=("--metadata") local_nonpersistent_flags+=("--metadata") flags+=("--cacert=") two_word_flags+=("--cacert") flags+=("--cache-dir=") two_word_flags+=("--cache-dir") flags+=("--cleanup-cache") flags+=("--json") flags+=("--key-hint=") two_word_flags+=("--key-hint") flags+=("--limit-download=") two_word_flags+=("--limit-download") flags+=("--limit-upload=") two_word_flags+=("--limit-upload") flags+=("--no-cache") flags+=("--no-lock") flags+=("--option=") two_word_flags+=("--option") two_word_flags+=("-o") flags+=("--password-command=") two_word_flags+=("--password-command") flags+=("--password-file=") two_word_flags+=("--password-file") two_word_flags+=("-p") flags+=("--quiet") flags+=("-q") flags+=("--repo=") two_word_flags+=("--repo") two_word_flags+=("-r") flags+=("--repository-file=") two_word_flags+=("--repository-file") flags+=("--tls-client-cert=") two_word_flags+=("--tls-client-cert") flags+=("--verbose") flags+=("-v") must_have_one_flag=() must_have_one_noun=() noun_aliases=() } _restic_dump() { last_command="restic_dump" command_aliases=() commands=() flags=() two_word_flags=() local_nonpersistent_flags=() flags_with_completion=() flags_completion=() flags+=("--archive=") two_word_flags+=("--archive") two_word_flags+=("-a") local_nonpersistent_flags+=("--archive") local_nonpersistent_flags+=("--archive=") local_nonpersistent_flags+=("-a") flags+=("--host=") two_word_flags+=("--host") two_word_flags+=("-H") local_nonpersistent_flags+=("--host") local_nonpersistent_flags+=("--host=") local_nonpersistent_flags+=("-H") flags+=("--path=") two_word_flags+=("--path") local_nonpersistent_flags+=("--path") local_nonpersistent_flags+=("--path=") flags+=("--tag=") two_word_flags+=("--tag") local_nonpersistent_flags+=("--tag") local_nonpersistent_flags+=("--tag=") flags+=("--cacert=") two_word_flags+=("--cacert") flags+=("--cache-dir=") two_word_flags+=("--cache-dir") flags+=("--cleanup-cache") flags+=("--json") flags+=("--key-hint=") two_word_flags+=("--key-hint") flags+=("--limit-download=") two_word_flags+=("--limit-download") flags+=("--limit-upload=") two_word_flags+=("--limit-upload") flags+=("--no-cache") flags+=("--no-lock") flags+=("--option=") two_word_flags+=("--option") two_word_flags+=("-o") flags+=("--password-command=") two_word_flags+=("--password-command") flags+=("--password-file=") two_word_flags+=("--password-file") two_word_flags+=("-p") flags+=("--quiet") flags+=("-q") flags+=("--repo=") two_word_flags+=("--repo") two_word_flags+=("-r") flags+=("--repository-file=") two_word_flags+=("--repository-file") flags+=("--tls-client-cert=") two_word_flags+=("--tls-client-cert") flags+=("--verbose") flags+=("-v") must_have_one_flag=() must_have_one_noun=() noun_aliases=() } _restic_find() { last_command="restic_find" command_aliases=() commands=() flags=() two_word_flags=() local_nonpersistent_flags=() flags_with_completion=() flags_completion=() flags+=("--blob") local_nonpersistent_flags+=("--blob") flags+=("--host=") two_word_flags+=("--host") two_word_flags+=("-H") local_nonpersistent_flags+=("--host") local_nonpersistent_flags+=("--host=") local_nonpersistent_flags+=("-H") flags+=("--ignore-case") flags+=("-i") local_nonpersistent_flags+=("--ignore-case") local_nonpersistent_flags+=("-i") flags+=("--long") flags+=("-l") local_nonpersistent_flags+=("--long") local_nonpersistent_flags+=("-l") flags+=("--newest=") two_word_flags+=("--newest") two_word_flags+=("-N") local_nonpersistent_flags+=("--newest") local_nonpersistent_flags+=("--newest=") local_nonpersistent_flags+=("-N") flags+=("--oldest=") two_word_flags+=("--oldest") two_word_flags+=("-O") local_nonpersistent_flags+=("--oldest") local_nonpersistent_flags+=("--oldest=") local_nonpersistent_flags+=("-O") flags+=("--pack") local_nonpersistent_flags+=("--pack") flags+=("--path=") two_word_flags+=("--path") local_nonpersistent_flags+=("--path") local_nonpersistent_flags+=("--path=") flags+=("--show-pack-id") local_nonpersistent_flags+=("--show-pack-id") flags+=("--snapshot=") two_word_flags+=("--snapshot") two_word_flags+=("-s") local_nonpersistent_flags+=("--snapshot") local_nonpersistent_flags+=("--snapshot=") local_nonpersistent_flags+=("-s") flags+=("--tag=") two_word_flags+=("--tag") local_nonpersistent_flags+=("--tag") local_nonpersistent_flags+=("--tag=") flags+=("--tree") local_nonpersistent_flags+=("--tree") flags+=("--cacert=") two_word_flags+=("--cacert") flags+=("--cache-dir=") two_word_flags+=("--cache-dir") flags+=("--cleanup-cache") flags+=("--json") flags+=("--key-hint=") two_word_flags+=("--key-hint") flags+=("--limit-download=") two_word_flags+=("--limit-download") flags+=("--limit-upload=") two_word_flags+=("--limit-upload") flags+=("--no-cache") flags+=("--no-lock") flags+=("--option=") two_word_flags+=("--option") two_word_flags+=("-o") flags+=("--password-command=") two_word_flags+=("--password-command") flags+=("--password-file=") two_word_flags+=("--password-file") two_word_flags+=("-p") flags+=("--quiet") flags+=("-q") flags+=("--repo=") two_word_flags+=("--repo") two_word_flags+=("-r") flags+=("--repository-file=") two_word_flags+=("--repository-file") flags+=("--tls-client-cert=") two_word_flags+=("--tls-client-cert") flags+=("--verbose") flags+=("-v") must_have_one_flag=() must_have_one_noun=() noun_aliases=() } _restic_forget() { last_command="restic_forget" command_aliases=() commands=() flags=() two_word_flags=() local_nonpersistent_flags=() flags_with_completion=() flags_completion=() flags+=("--keep-last=") two_word_flags+=("--keep-last") two_word_flags+=("-l") local_nonpersistent_flags+=("--keep-last") local_nonpersistent_flags+=("--keep-last=") local_nonpersistent_flags+=("-l") flags+=("--keep-hourly=") two_word_flags+=("--keep-hourly") two_word_flags+=("-H") local_nonpersistent_flags+=("--keep-hourly") local_nonpersistent_flags+=("--keep-hourly=") local_nonpersistent_flags+=("-H") flags+=("--keep-daily=") two_word_flags+=("--keep-daily") two_word_flags+=("-d") local_nonpersistent_flags+=("--keep-daily") local_nonpersistent_flags+=("--keep-daily=") local_nonpersistent_flags+=("-d") flags+=("--keep-weekly=") two_word_flags+=("--keep-weekly") two_word_flags+=("-w") local_nonpersistent_flags+=("--keep-weekly") local_nonpersistent_flags+=("--keep-weekly=") local_nonpersistent_flags+=("-w") flags+=("--keep-monthly=") two_word_flags+=("--keep-monthly") two_word_flags+=("-m") local_nonpersistent_flags+=("--keep-monthly") local_nonpersistent_flags+=("--keep-monthly=") local_nonpersistent_flags+=("-m") flags+=("--keep-yearly=") two_word_flags+=("--keep-yearly") two_word_flags+=("-y") local_nonpersistent_flags+=("--keep-yearly") local_nonpersistent_flags+=("--keep-yearly=") local_nonpersistent_flags+=("-y") flags+=("--keep-within=") two_word_flags+=("--keep-within") local_nonpersistent_flags+=("--keep-within") local_nonpersistent_flags+=("--keep-within=") flags+=("--keep-within-hourly=") two_word_flags+=("--keep-within-hourly") local_nonpersistent_flags+=("--keep-within-hourly") local_nonpersistent_flags+=("--keep-within-hourly=") flags+=("--keep-within-daily=") two_word_flags+=("--keep-within-daily") local_nonpersistent_flags+=("--keep-within-daily") local_nonpersistent_flags+=("--keep-within-daily=") flags+=("--keep-within-weekly=") two_word_flags+=("--keep-within-weekly") local_nonpersistent_flags+=("--keep-within-weekly") local_nonpersistent_flags+=("--keep-within-weekly=") flags+=("--keep-within-monthly=") two_word_flags+=("--keep-within-monthly") local_nonpersistent_flags+=("--keep-within-monthly") local_nonpersistent_flags+=("--keep-within-monthly=") flags+=("--keep-within-yearly=") two_word_flags+=("--keep-within-yearly") local_nonpersistent_flags+=("--keep-within-yearly") local_nonpersistent_flags+=("--keep-within-yearly=") flags+=("--keep-tag=") two_word_flags+=("--keep-tag") local_nonpersistent_flags+=("--keep-tag") local_nonpersistent_flags+=("--keep-tag=") flags+=("--host=") two_word_flags+=("--host") local_nonpersistent_flags+=("--host") local_nonpersistent_flags+=("--host=") flags+=("--tag=") two_word_flags+=("--tag") local_nonpersistent_flags+=("--tag") local_nonpersistent_flags+=("--tag=") flags+=("--path=") two_word_flags+=("--path") local_nonpersistent_flags+=("--path") local_nonpersistent_flags+=("--path=") flags+=("--compact") flags+=("-c") local_nonpersistent_flags+=("--compact") local_nonpersistent_flags+=("-c") flags+=("--group-by=") two_word_flags+=("--group-by") two_word_flags+=("-g") local_nonpersistent_flags+=("--group-by") local_nonpersistent_flags+=("--group-by=") local_nonpersistent_flags+=("-g") flags+=("--dry-run") flags+=("-n") local_nonpersistent_flags+=("--dry-run") local_nonpersistent_flags+=("-n") flags+=("--prune") local_nonpersistent_flags+=("--prune") flags+=("--max-unused=") two_word_flags+=("--max-unused") local_nonpersistent_flags+=("--max-unused") local_nonpersistent_flags+=("--max-unused=") flags+=("--max-repack-size=") two_word_flags+=("--max-repack-size") local_nonpersistent_flags+=("--max-repack-size") local_nonpersistent_flags+=("--max-repack-size=") flags+=("--repack-cacheable-only") local_nonpersistent_flags+=("--repack-cacheable-only") flags+=("--cacert=") two_word_flags+=("--cacert") flags+=("--cache-dir=") two_word_flags+=("--cache-dir") flags+=("--cleanup-cache") flags+=("--json") flags+=("--key-hint=") two_word_flags+=("--key-hint") flags+=("--limit-download=") two_word_flags+=("--limit-download") flags+=("--limit-upload=") two_word_flags+=("--limit-upload") flags+=("--no-cache") flags+=("--no-lock") flags+=("--option=") two_word_flags+=("--option") two_word_flags+=("-o") flags+=("--password-command=") two_word_flags+=("--password-command") flags+=("--password-file=") two_word_flags+=("--password-file") two_word_flags+=("-p") flags+=("--quiet") flags+=("-q") flags+=("--repo=") two_word_flags+=("--repo") two_word_flags+=("-r") flags+=("--repository-file=") two_word_flags+=("--repository-file") flags+=("--tls-client-cert=") two_word_flags+=("--tls-client-cert") flags+=("--verbose") flags+=("-v") must_have_one_flag=() must_have_one_noun=() noun_aliases=() } _restic_generate() { last_command="restic_generate" command_aliases=() commands=() flags=() two_word_flags=() local_nonpersistent_flags=() flags_with_completion=() flags_completion=() flags+=("--bash-completion=") two_word_flags+=("--bash-completion") local_nonpersistent_flags+=("--bash-completion") local_nonpersistent_flags+=("--bash-completion=") flags+=("--fish-completion=") two_word_flags+=("--fish-completion") local_nonpersistent_flags+=("--fish-completion") local_nonpersistent_flags+=("--fish-completion=") flags+=("--help") flags+=("-h") local_nonpersistent_flags+=("--help") local_nonpersistent_flags+=("-h") flags+=("--man=") two_word_flags+=("--man") local_nonpersistent_flags+=("--man") local_nonpersistent_flags+=("--man=") flags+=("--zsh-completion=") two_word_flags+=("--zsh-completion") local_nonpersistent_flags+=("--zsh-completion") local_nonpersistent_flags+=("--zsh-completion=") flags+=("--cacert=") two_word_flags+=("--cacert") flags+=("--cache-dir=") two_word_flags+=("--cache-dir") flags+=("--cleanup-cache") flags+=("--json") flags+=("--key-hint=") two_word_flags+=("--key-hint") flags+=("--limit-download=") two_word_flags+=("--limit-download") flags+=("--limit-upload=") two_word_flags+=("--limit-upload") flags+=("--no-cache") flags+=("--no-lock") flags+=("--option=") two_word_flags+=("--option") two_word_flags+=("-o") flags+=("--password-command=") two_word_flags+=("--password-command") flags+=("--password-file=") two_word_flags+=("--password-file") two_word_flags+=("-p") flags+=("--quiet") flags+=("-q") flags+=("--repo=") two_word_flags+=("--repo") two_word_flags+=("-r") flags+=("--repository-file=") two_word_flags+=("--repository-file") flags+=("--tls-client-cert=") two_word_flags+=("--tls-client-cert") flags+=("--verbose") flags+=("-v") must_have_one_flag=() must_have_one_noun=() noun_aliases=() } _restic_help() { last_command="restic_help" command_aliases=() commands=() flags=() two_word_flags=() local_nonpersistent_flags=() flags_with_completion=() flags_completion=() flags+=("--cacert=") two_word_flags+=("--cacert") flags+=("--cache-dir=") two_word_flags+=("--cache-dir") flags+=("--cleanup-cache") flags+=("--json") flags+=("--key-hint=") two_word_flags+=("--key-hint") flags+=("--limit-download=") two_word_flags+=("--limit-download") flags+=("--limit-upload=") two_word_flags+=("--limit-upload") flags+=("--no-cache") flags+=("--no-lock") flags+=("--option=") two_word_flags+=("--option") two_word_flags+=("-o") flags+=("--password-command=") two_word_flags+=("--password-command") flags+=("--password-file=") two_word_flags+=("--password-file") two_word_flags+=("-p") flags+=("--quiet") flags+=("-q") flags+=("--repo=") two_word_flags+=("--repo") two_word_flags+=("-r") flags+=("--repository-file=") two_word_flags+=("--repository-file") flags+=("--tls-client-cert=") two_word_flags+=("--tls-client-cert") flags+=("--verbose") flags+=("-v") must_have_one_flag=() must_have_one_noun=() has_completion_function=1 noun_aliases=() } _restic_init() { last_command="restic_init" command_aliases=() commands=() flags=() two_word_flags=() local_nonpersistent_flags=() flags_with_completion=() flags_completion=() flags+=("--copy-chunker-params") local_nonpersistent_flags+=("--copy-chunker-params") flags+=("--key-hint2=") two_word_flags+=("--key-hint2") local_nonpersistent_flags+=("--key-hint2") local_nonpersistent_flags+=("--key-hint2=") flags+=("--password-command2=") two_word_flags+=("--password-command2") local_nonpersistent_flags+=("--password-command2") local_nonpersistent_flags+=("--password-command2=") flags+=("--password-file2=") two_word_flags+=("--password-file2") local_nonpersistent_flags+=("--password-file2") local_nonpersistent_flags+=("--password-file2=") flags+=("--repo2=") two_word_flags+=("--repo2") local_nonpersistent_flags+=("--repo2") local_nonpersistent_flags+=("--repo2=") flags+=("--repository-file2=") two_word_flags+=("--repository-file2") local_nonpersistent_flags+=("--repository-file2") local_nonpersistent_flags+=("--repository-file2=") flags+=("--cacert=") two_word_flags+=("--cacert") flags+=("--cache-dir=") two_word_flags+=("--cache-dir") flags+=("--cleanup-cache") flags+=("--json") flags+=("--key-hint=") two_word_flags+=("--key-hint") flags+=("--limit-download=") two_word_flags+=("--limit-download") flags+=("--limit-upload=") two_word_flags+=("--limit-upload") flags+=("--no-cache") flags+=("--no-lock") flags+=("--option=") two_word_flags+=("--option") two_word_flags+=("-o") flags+=("--password-command=") two_word_flags+=("--password-command") flags+=("--password-file=") two_word_flags+=("--password-file") two_word_flags+=("-p") flags+=("--quiet") flags+=("-q") flags+=("--repo=") two_word_flags+=("--repo") two_word_flags+=("-r") flags+=("--repository-file=") two_word_flags+=("--repository-file") flags+=("--tls-client-cert=") two_word_flags+=("--tls-client-cert") flags+=("--verbose") flags+=("-v") must_have_one_flag=() must_have_one_noun=() noun_aliases=() } _restic_key() { last_command="restic_key" command_aliases=() commands=() flags=() two_word_flags=() local_nonpersistent_flags=() flags_with_completion=() flags_completion=() flags+=("--host=") two_word_flags+=("--host") local_nonpersistent_flags+=("--host") local_nonpersistent_flags+=("--host=") flags+=("--new-password-file=") two_word_flags+=("--new-password-file") local_nonpersistent_flags+=("--new-password-file") local_nonpersistent_flags+=("--new-password-file=") flags+=("--user=") two_word_flags+=("--user") local_nonpersistent_flags+=("--user") local_nonpersistent_flags+=("--user=") flags+=("--cacert=") two_word_flags+=("--cacert") flags+=("--cache-dir=") two_word_flags+=("--cache-dir") flags+=("--cleanup-cache") flags+=("--json") flags+=("--key-hint=") two_word_flags+=("--key-hint") flags+=("--limit-download=") two_word_flags+=("--limit-download") flags+=("--limit-upload=") two_word_flags+=("--limit-upload") flags+=("--no-cache") flags+=("--no-lock") flags+=("--option=") two_word_flags+=("--option") two_word_flags+=("-o") flags+=("--password-command=") two_word_flags+=("--password-command") flags+=("--password-file=") two_word_flags+=("--password-file") two_word_flags+=("-p") flags+=("--quiet") flags+=("-q") flags+=("--repo=") two_word_flags+=("--repo") two_word_flags+=("-r") flags+=("--repository-file=") two_word_flags+=("--repository-file") flags+=("--tls-client-cert=") two_word_flags+=("--tls-client-cert") flags+=("--verbose") flags+=("-v") must_have_one_flag=() must_have_one_noun=() noun_aliases=() } _restic_list() { last_command="restic_list" command_aliases=() commands=() flags=() two_word_flags=() local_nonpersistent_flags=() flags_with_completion=() flags_completion=() flags+=("--cacert=") two_word_flags+=("--cacert") flags+=("--cache-dir=") two_word_flags+=("--cache-dir") flags+=("--cleanup-cache") flags+=("--json") flags+=("--key-hint=") two_word_flags+=("--key-hint") flags+=("--limit-download=") two_word_flags+=("--limit-download") flags+=("--limit-upload=") two_word_flags+=("--limit-upload") flags+=("--no-cache") flags+=("--no-lock") flags+=("--option=") two_word_flags+=("--option") two_word_flags+=("-o") flags+=("--password-command=") two_word_flags+=("--password-command") flags+=("--password-file=") two_word_flags+=("--password-file") two_word_flags+=("-p") flags+=("--quiet") flags+=("-q") flags+=("--repo=") two_word_flags+=("--repo") two_word_flags+=("-r") flags+=("--repository-file=") two_word_flags+=("--repository-file") flags+=("--tls-client-cert=") two_word_flags+=("--tls-client-cert") flags+=("--verbose") flags+=("-v") must_have_one_flag=() must_have_one_noun=() noun_aliases=() } _restic_ls() { last_command="restic_ls" command_aliases=() commands=() flags=() two_word_flags=() local_nonpersistent_flags=() flags_with_completion=() flags_completion=() flags+=("--host=") two_word_flags+=("--host") two_word_flags+=("-H") local_nonpersistent_flags+=("--host") local_nonpersistent_flags+=("--host=") local_nonpersistent_flags+=("-H") flags+=("--long") flags+=("-l") local_nonpersistent_flags+=("--long") local_nonpersistent_flags+=("-l") flags+=("--path=") two_word_flags+=("--path") local_nonpersistent_flags+=("--path") local_nonpersistent_flags+=("--path=") flags+=("--recursive") local_nonpersistent_flags+=("--recursive") flags+=("--tag=") two_word_flags+=("--tag") local_nonpersistent_flags+=("--tag") local_nonpersistent_flags+=("--tag=") flags+=("--cacert=") two_word_flags+=("--cacert") flags+=("--cache-dir=") two_word_flags+=("--cache-dir") flags+=("--cleanup-cache") flags+=("--json") flags+=("--key-hint=") two_word_flags+=("--key-hint") flags+=("--limit-download=") two_word_flags+=("--limit-download") flags+=("--limit-upload=") two_word_flags+=("--limit-upload") flags+=("--no-cache") flags+=("--no-lock") flags+=("--option=") two_word_flags+=("--option") two_word_flags+=("-o") flags+=("--password-command=") two_word_flags+=("--password-command") flags+=("--password-file=") two_word_flags+=("--password-file") two_word_flags+=("-p") flags+=("--quiet") flags+=("-q") flags+=("--repo=") two_word_flags+=("--repo") two_word_flags+=("-r") flags+=("--repository-file=") two_word_flags+=("--repository-file") flags+=("--tls-client-cert=") two_word_flags+=("--tls-client-cert") flags+=("--verbose") flags+=("-v") must_have_one_flag=() must_have_one_noun=() noun_aliases=() } _restic_migrate() { last_command="restic_migrate" command_aliases=() commands=() flags=() two_word_flags=() local_nonpersistent_flags=() flags_with_completion=() flags_completion=() flags+=("--force") flags+=("-f") local_nonpersistent_flags+=("--force") local_nonpersistent_flags+=("-f") flags+=("--cacert=") two_word_flags+=("--cacert") flags+=("--cache-dir=") two_word_flags+=("--cache-dir") flags+=("--cleanup-cache") flags+=("--json") flags+=("--key-hint=") two_word_flags+=("--key-hint") flags+=("--limit-download=") two_word_flags+=("--limit-download") flags+=("--limit-upload=") two_word_flags+=("--limit-upload") flags+=("--no-cache") flags+=("--no-lock") flags+=("--option=") two_word_flags+=("--option") two_word_flags+=("-o") flags+=("--password-command=") two_word_flags+=("--password-command") flags+=("--password-file=") two_word_flags+=("--password-file") two_word_flags+=("-p") flags+=("--quiet") flags+=("-q") flags+=("--repo=") two_word_flags+=("--repo") two_word_flags+=("-r") flags+=("--repository-file=") two_word_flags+=("--repository-file") flags+=("--tls-client-cert=") two_word_flags+=("--tls-client-cert") flags+=("--verbose") flags+=("-v") must_have_one_flag=() must_have_one_noun=() noun_aliases=() } _restic_mount() { last_command="restic_mount" command_aliases=() commands=() flags=() two_word_flags=() local_nonpersistent_flags=() flags_with_completion=() flags_completion=() flags+=("--allow-other") local_nonpersistent_flags+=("--allow-other") flags+=("--host=") two_word_flags+=("--host") two_word_flags+=("-H") local_nonpersistent_flags+=("--host") local_nonpersistent_flags+=("--host=") local_nonpersistent_flags+=("-H") flags+=("--no-default-permissions") local_nonpersistent_flags+=("--no-default-permissions") flags+=("--owner-root") local_nonpersistent_flags+=("--owner-root") flags+=("--path=") two_word_flags+=("--path") local_nonpersistent_flags+=("--path") local_nonpersistent_flags+=("--path=") flags+=("--snapshot-template=") two_word_flags+=("--snapshot-template") local_nonpersistent_flags+=("--snapshot-template") local_nonpersistent_flags+=("--snapshot-template=") flags+=("--tag=") two_word_flags+=("--tag") local_nonpersistent_flags+=("--tag") local_nonpersistent_flags+=("--tag=") flags+=("--cacert=") two_word_flags+=("--cacert") flags+=("--cache-dir=") two_word_flags+=("--cache-dir") flags+=("--cleanup-cache") flags+=("--json") flags+=("--key-hint=") two_word_flags+=("--key-hint") flags+=("--limit-download=") two_word_flags+=("--limit-download") flags+=("--limit-upload=") two_word_flags+=("--limit-upload") flags+=("--no-cache") flags+=("--no-lock") flags+=("--option=") two_word_flags+=("--option") two_word_flags+=("-o") flags+=("--password-command=") two_word_flags+=("--password-command") flags+=("--password-file=") two_word_flags+=("--password-file") two_word_flags+=("-p") flags+=("--quiet") flags+=("-q") flags+=("--repo=") two_word_flags+=("--repo") two_word_flags+=("-r") flags+=("--repository-file=") two_word_flags+=("--repository-file") flags+=("--tls-client-cert=") two_word_flags+=("--tls-client-cert") flags+=("--verbose") flags+=("-v") must_have_one_flag=() must_have_one_noun=() noun_aliases=() } _restic_prune() { last_command="restic_prune" command_aliases=() commands=() flags=() two_word_flags=() local_nonpersistent_flags=() flags_with_completion=() flags_completion=() flags+=("--dry-run") flags+=("-n") local_nonpersistent_flags+=("--dry-run") local_nonpersistent_flags+=("-n") flags+=("--max-repack-size=") two_word_flags+=("--max-repack-size") local_nonpersistent_flags+=("--max-repack-size") local_nonpersistent_flags+=("--max-repack-size=") flags+=("--max-unused=") two_word_flags+=("--max-unused") local_nonpersistent_flags+=("--max-unused") local_nonpersistent_flags+=("--max-unused=") flags+=("--repack-cacheable-only") local_nonpersistent_flags+=("--repack-cacheable-only") flags+=("--cacert=") two_word_flags+=("--cacert") flags+=("--cache-dir=") two_word_flags+=("--cache-dir") flags+=("--cleanup-cache") flags+=("--json") flags+=("--key-hint=") two_word_flags+=("--key-hint") flags+=("--limit-download=") two_word_flags+=("--limit-download") flags+=("--limit-upload=") two_word_flags+=("--limit-upload") flags+=("--no-cache") flags+=("--no-lock") flags+=("--option=") two_word_flags+=("--option") two_word_flags+=("-o") flags+=("--password-command=") two_word_flags+=("--password-command") flags+=("--password-file=") two_word_flags+=("--password-file") two_word_flags+=("-p") flags+=("--quiet") flags+=("-q") flags+=("--repo=") two_word_flags+=("--repo") two_word_flags+=("-r") flags+=("--repository-file=") two_word_flags+=("--repository-file") flags+=("--tls-client-cert=") two_word_flags+=("--tls-client-cert") flags+=("--verbose") flags+=("-v") must_have_one_flag=() must_have_one_noun=() noun_aliases=() } _restic_rebuild-index() { last_command="restic_rebuild-index" command_aliases=() commands=() flags=() two_word_flags=() local_nonpersistent_flags=() flags_with_completion=() flags_completion=() flags+=("--read-all-packs") local_nonpersistent_flags+=("--read-all-packs") flags+=("--cacert=") two_word_flags+=("--cacert") flags+=("--cache-dir=") two_word_flags+=("--cache-dir") flags+=("--cleanup-cache") flags+=("--json") flags+=("--key-hint=") two_word_flags+=("--key-hint") flags+=("--limit-download=") two_word_flags+=("--limit-download") flags+=("--limit-upload=") two_word_flags+=("--limit-upload") flags+=("--no-cache") flags+=("--no-lock") flags+=("--option=") two_word_flags+=("--option") two_word_flags+=("-o") flags+=("--password-command=") two_word_flags+=("--password-command") flags+=("--password-file=") two_word_flags+=("--password-file") two_word_flags+=("-p") flags+=("--quiet") flags+=("-q") flags+=("--repo=") two_word_flags+=("--repo") two_word_flags+=("-r") flags+=("--repository-file=") two_word_flags+=("--repository-file") flags+=("--tls-client-cert=") two_word_flags+=("--tls-client-cert") flags+=("--verbose") flags+=("-v") must_have_one_flag=() must_have_one_noun=() noun_aliases=() } _restic_recover() { last_command="restic_recover" command_aliases=() commands=() flags=() two_word_flags=() local_nonpersistent_flags=() flags_with_completion=() flags_completion=() flags+=("--cacert=") two_word_flags+=("--cacert") flags+=("--cache-dir=") two_word_flags+=("--cache-dir") flags+=("--cleanup-cache") flags+=("--json") flags+=("--key-hint=") two_word_flags+=("--key-hint") flags+=("--limit-download=") two_word_flags+=("--limit-download") flags+=("--limit-upload=") two_word_flags+=("--limit-upload") flags+=("--no-cache") flags+=("--no-lock") flags+=("--option=") two_word_flags+=("--option") two_word_flags+=("-o") flags+=("--password-command=") two_word_flags+=("--password-command") flags+=("--password-file=") two_word_flags+=("--password-file") two_word_flags+=("-p") flags+=("--quiet") flags+=("-q") flags+=("--repo=") two_word_flags+=("--repo") two_word_flags+=("-r") flags+=("--repository-file=") two_word_flags+=("--repository-file") flags+=("--tls-client-cert=") two_word_flags+=("--tls-client-cert") flags+=("--verbose") flags+=("-v") must_have_one_flag=() must_have_one_noun=() noun_aliases=() } _restic_restore() { last_command="restic_restore" command_aliases=() commands=() flags=() two_word_flags=() local_nonpersistent_flags=() flags_with_completion=() flags_completion=() flags+=("--exclude=") two_word_flags+=("--exclude") two_word_flags+=("-e") local_nonpersistent_flags+=("--exclude") local_nonpersistent_flags+=("--exclude=") local_nonpersistent_flags+=("-e") flags+=("--host=") two_word_flags+=("--host") two_word_flags+=("-H") local_nonpersistent_flags+=("--host") local_nonpersistent_flags+=("--host=") local_nonpersistent_flags+=("-H") flags+=("--iexclude=") two_word_flags+=("--iexclude") local_nonpersistent_flags+=("--iexclude") local_nonpersistent_flags+=("--iexclude=") flags+=("--iinclude=") two_word_flags+=("--iinclude") local_nonpersistent_flags+=("--iinclude") local_nonpersistent_flags+=("--iinclude=") flags+=("--include=") two_word_flags+=("--include") two_word_flags+=("-i") local_nonpersistent_flags+=("--include") local_nonpersistent_flags+=("--include=") local_nonpersistent_flags+=("-i") flags+=("--path=") two_word_flags+=("--path") local_nonpersistent_flags+=("--path") local_nonpersistent_flags+=("--path=") flags+=("--tag=") two_word_flags+=("--tag") local_nonpersistent_flags+=("--tag") local_nonpersistent_flags+=("--tag=") flags+=("--target=") two_word_flags+=("--target") two_word_flags+=("-t") local_nonpersistent_flags+=("--target") local_nonpersistent_flags+=("--target=") local_nonpersistent_flags+=("-t") flags+=("--verify") local_nonpersistent_flags+=("--verify") flags+=("--cacert=") two_word_flags+=("--cacert") flags+=("--cache-dir=") two_word_flags+=("--cache-dir") flags+=("--cleanup-cache") flags+=("--json") flags+=("--key-hint=") two_word_flags+=("--key-hint") flags+=("--limit-download=") two_word_flags+=("--limit-download") flags+=("--limit-upload=") two_word_flags+=("--limit-upload") flags+=("--no-cache") flags+=("--no-lock") flags+=("--option=") two_word_flags+=("--option") two_word_flags+=("-o") flags+=("--password-command=") two_word_flags+=("--password-command") flags+=("--password-file=") two_word_flags+=("--password-file") two_word_flags+=("-p") flags+=("--quiet") flags+=("-q") flags+=("--repo=") two_word_flags+=("--repo") two_word_flags+=("-r") flags+=("--repository-file=") two_word_flags+=("--repository-file") flags+=("--tls-client-cert=") two_word_flags+=("--tls-client-cert") flags+=("--verbose") flags+=("-v") must_have_one_flag=() must_have_one_noun=() noun_aliases=() } _restic_self-update() { last_command="restic_self-update" command_aliases=() commands=() flags=() two_word_flags=() local_nonpersistent_flags=() flags_with_completion=() flags_completion=() flags+=("--output=") two_word_flags+=("--output") local_nonpersistent_flags+=("--output") local_nonpersistent_flags+=("--output=") flags+=("--cacert=") two_word_flags+=("--cacert") flags+=("--cache-dir=") two_word_flags+=("--cache-dir") flags+=("--cleanup-cache") flags+=("--json") flags+=("--key-hint=") two_word_flags+=("--key-hint") flags+=("--limit-download=") two_word_flags+=("--limit-download") flags+=("--limit-upload=") two_word_flags+=("--limit-upload") flags+=("--no-cache") flags+=("--no-lock") flags+=("--option=") two_word_flags+=("--option") two_word_flags+=("-o") flags+=("--password-command=") two_word_flags+=("--password-command") flags+=("--password-file=") two_word_flags+=("--password-file") two_word_flags+=("-p") flags+=("--quiet") flags+=("-q") flags+=("--repo=") two_word_flags+=("--repo") two_word_flags+=("-r") flags+=("--repository-file=") two_word_flags+=("--repository-file") flags+=("--tls-client-cert=") two_word_flags+=("--tls-client-cert") flags+=("--verbose") flags+=("-v") must_have_one_flag=() must_have_one_noun=() noun_aliases=() } _restic_snapshots() { last_command="restic_snapshots" command_aliases=() commands=() flags=() two_word_flags=() local_nonpersistent_flags=() flags_with_completion=() flags_completion=() flags+=("--compact") flags+=("-c") local_nonpersistent_flags+=("--compact") local_nonpersistent_flags+=("-c") flags+=("--group-by=") two_word_flags+=("--group-by") two_word_flags+=("-g") local_nonpersistent_flags+=("--group-by") local_nonpersistent_flags+=("--group-by=") local_nonpersistent_flags+=("-g") flags+=("--host=") two_word_flags+=("--host") two_word_flags+=("-H") local_nonpersistent_flags+=("--host") local_nonpersistent_flags+=("--host=") local_nonpersistent_flags+=("-H") flags+=("--latest=") two_word_flags+=("--latest") local_nonpersistent_flags+=("--latest") local_nonpersistent_flags+=("--latest=") flags+=("--path=") two_word_flags+=("--path") local_nonpersistent_flags+=("--path") local_nonpersistent_flags+=("--path=") flags+=("--tag=") two_word_flags+=("--tag") local_nonpersistent_flags+=("--tag") local_nonpersistent_flags+=("--tag=") flags+=("--cacert=") two_word_flags+=("--cacert") flags+=("--cache-dir=") two_word_flags+=("--cache-dir") flags+=("--cleanup-cache") flags+=("--json") flags+=("--key-hint=") two_word_flags+=("--key-hint") flags+=("--limit-download=") two_word_flags+=("--limit-download") flags+=("--limit-upload=") two_word_flags+=("--limit-upload") flags+=("--no-cache") flags+=("--no-lock") flags+=("--option=") two_word_flags+=("--option") two_word_flags+=("-o") flags+=("--password-command=") two_word_flags+=("--password-command") flags+=("--password-file=") two_word_flags+=("--password-file") two_word_flags+=("-p") flags+=("--quiet") flags+=("-q") flags+=("--repo=") two_word_flags+=("--repo") two_word_flags+=("-r") flags+=("--repository-file=") two_word_flags+=("--repository-file") flags+=("--tls-client-cert=") two_word_flags+=("--tls-client-cert") flags+=("--verbose") flags+=("-v") must_have_one_flag=() must_have_one_noun=() noun_aliases=() } _restic_stats() { last_command="restic_stats" command_aliases=() commands=() flags=() two_word_flags=() local_nonpersistent_flags=() flags_with_completion=() flags_completion=() flags+=("--host=") two_word_flags+=("--host") two_word_flags+=("-H") local_nonpersistent_flags+=("--host") local_nonpersistent_flags+=("--host=") local_nonpersistent_flags+=("-H") flags+=("--mode=") two_word_flags+=("--mode") local_nonpersistent_flags+=("--mode") local_nonpersistent_flags+=("--mode=") flags+=("--path=") two_word_flags+=("--path") local_nonpersistent_flags+=("--path") local_nonpersistent_flags+=("--path=") flags+=("--tag=") two_word_flags+=("--tag") local_nonpersistent_flags+=("--tag") local_nonpersistent_flags+=("--tag=") flags+=("--cacert=") two_word_flags+=("--cacert") flags+=("--cache-dir=") two_word_flags+=("--cache-dir") flags+=("--cleanup-cache") flags+=("--json") flags+=("--key-hint=") two_word_flags+=("--key-hint") flags+=("--limit-download=") two_word_flags+=("--limit-download") flags+=("--limit-upload=") two_word_flags+=("--limit-upload") flags+=("--no-cache") flags+=("--no-lock") flags+=("--option=") two_word_flags+=("--option") two_word_flags+=("-o") flags+=("--password-command=") two_word_flags+=("--password-command") flags+=("--password-file=") two_word_flags+=("--password-file") two_word_flags+=("-p") flags+=("--quiet") flags+=("-q") flags+=("--repo=") two_word_flags+=("--repo") two_word_flags+=("-r") flags+=("--repository-file=") two_word_flags+=("--repository-file") flags+=("--tls-client-cert=") two_word_flags+=("--tls-client-cert") flags+=("--verbose") flags+=("-v") must_have_one_flag=() must_have_one_noun=() noun_aliases=() } _restic_tag() { last_command="restic_tag" command_aliases=() commands=() flags=() two_word_flags=() local_nonpersistent_flags=() flags_with_completion=() flags_completion=() flags+=("--add=") two_word_flags+=("--add") local_nonpersistent_flags+=("--add") local_nonpersistent_flags+=("--add=") flags+=("--host=") two_word_flags+=("--host") two_word_flags+=("-H") local_nonpersistent_flags+=("--host") local_nonpersistent_flags+=("--host=") local_nonpersistent_flags+=("-H") flags+=("--path=") two_word_flags+=("--path") local_nonpersistent_flags+=("--path") local_nonpersistent_flags+=("--path=") flags+=("--remove=") two_word_flags+=("--remove") local_nonpersistent_flags+=("--remove") local_nonpersistent_flags+=("--remove=") flags+=("--set=") two_word_flags+=("--set") local_nonpersistent_flags+=("--set") local_nonpersistent_flags+=("--set=") flags+=("--tag=") two_word_flags+=("--tag") local_nonpersistent_flags+=("--tag") local_nonpersistent_flags+=("--tag=") flags+=("--cacert=") two_word_flags+=("--cacert") flags+=("--cache-dir=") two_word_flags+=("--cache-dir") flags+=("--cleanup-cache") flags+=("--json") flags+=("--key-hint=") two_word_flags+=("--key-hint") flags+=("--limit-download=") two_word_flags+=("--limit-download") flags+=("--limit-upload=") two_word_flags+=("--limit-upload") flags+=("--no-cache") flags+=("--no-lock") flags+=("--option=") two_word_flags+=("--option") two_word_flags+=("-o") flags+=("--password-command=") two_word_flags+=("--password-command") flags+=("--password-file=") two_word_flags+=("--password-file") two_word_flags+=("-p") flags+=("--quiet") flags+=("-q") flags+=("--repo=") two_word_flags+=("--repo") two_word_flags+=("-r") flags+=("--repository-file=") two_word_flags+=("--repository-file") flags+=("--tls-client-cert=") two_word_flags+=("--tls-client-cert") flags+=("--verbose") flags+=("-v") must_have_one_flag=() must_have_one_noun=() noun_aliases=() } _restic_unlock() { last_command="restic_unlock" command_aliases=() commands=() flags=() two_word_flags=() local_nonpersistent_flags=() flags_with_completion=() flags_completion=() flags+=("--remove-all") local_nonpersistent_flags+=("--remove-all") flags+=("--cacert=") two_word_flags+=("--cacert") flags+=("--cache-dir=") two_word_flags+=("--cache-dir") flags+=("--cleanup-cache") flags+=("--json") flags+=("--key-hint=") two_word_flags+=("--key-hint") flags+=("--limit-download=") two_word_flags+=("--limit-download") flags+=("--limit-upload=") two_word_flags+=("--limit-upload") flags+=("--no-cache") flags+=("--no-lock") flags+=("--option=") two_word_flags+=("--option") two_word_flags+=("-o") flags+=("--password-command=") two_word_flags+=("--password-command") flags+=("--password-file=") two_word_flags+=("--password-file") two_word_flags+=("-p") flags+=("--quiet") flags+=("-q") flags+=("--repo=") two_word_flags+=("--repo") two_word_flags+=("-r") flags+=("--repository-file=") two_word_flags+=("--repository-file") flags+=("--tls-client-cert=") two_word_flags+=("--tls-client-cert") flags+=("--verbose") flags+=("-v") must_have_one_flag=() must_have_one_noun=() noun_aliases=() } _restic_version() { last_command="restic_version" command_aliases=() commands=() flags=() two_word_flags=() local_nonpersistent_flags=() flags_with_completion=() flags_completion=() flags+=("--cacert=") two_word_flags+=("--cacert") flags+=("--cache-dir=") two_word_flags+=("--cache-dir") flags+=("--cleanup-cache") flags+=("--json") flags+=("--key-hint=") two_word_flags+=("--key-hint") flags+=("--limit-download=") two_word_flags+=("--limit-download") flags+=("--limit-upload=") two_word_flags+=("--limit-upload") flags+=("--no-cache") flags+=("--no-lock") flags+=("--option=") two_word_flags+=("--option") two_word_flags+=("-o") flags+=("--password-command=") two_word_flags+=("--password-command") flags+=("--password-file=") two_word_flags+=("--password-file") two_word_flags+=("-p") flags+=("--quiet") flags+=("-q") flags+=("--repo=") two_word_flags+=("--repo") two_word_flags+=("-r") flags+=("--repository-file=") two_word_flags+=("--repository-file") flags+=("--tls-client-cert=") two_word_flags+=("--tls-client-cert") flags+=("--verbose") flags+=("-v") must_have_one_flag=() must_have_one_noun=() noun_aliases=() } _restic_root_command() { last_command="restic" command_aliases=() commands=() commands+=("backup") commands+=("cache") commands+=("cat") commands+=("check") commands+=("copy") commands+=("diff") commands+=("dump") commands+=("find") commands+=("forget") commands+=("generate") commands+=("help") commands+=("init") commands+=("key") commands+=("list") commands+=("ls") commands+=("migrate") commands+=("mount") commands+=("prune") commands+=("rebuild-index") commands+=("recover") commands+=("restore") commands+=("self-update") commands+=("snapshots") commands+=("stats") commands+=("tag") commands+=("unlock") commands+=("version") flags=() two_word_flags=() local_nonpersistent_flags=() flags_with_completion=() flags_completion=() flags+=("--cacert=") two_word_flags+=("--cacert") flags+=("--cache-dir=") two_word_flags+=("--cache-dir") flags+=("--cleanup-cache") flags+=("--json") flags+=("--key-hint=") two_word_flags+=("--key-hint") flags+=("--limit-download=") two_word_flags+=("--limit-download") flags+=("--limit-upload=") two_word_flags+=("--limit-upload") flags+=("--no-cache") flags+=("--no-lock") flags+=("--option=") two_word_flags+=("--option") two_word_flags+=("-o") flags+=("--password-command=") two_word_flags+=("--password-command") flags+=("--password-file=") two_word_flags+=("--password-file") two_word_flags+=("-p") flags+=("--quiet") flags+=("-q") flags+=("--repo=") two_word_flags+=("--repo") two_word_flags+=("-r") flags+=("--repository-file=") two_word_flags+=("--repository-file") flags+=("--tls-client-cert=") two_word_flags+=("--tls-client-cert") flags+=("--verbose") flags+=("-v") must_have_one_flag=() must_have_one_noun=() noun_aliases=() } __start_restic() { local cur prev words cword split declare -A flaghash 2>/dev/null || : declare -A aliashash 2>/dev/null || : if declare -F _init_completion >/dev/null 2>&1; then _init_completion -s || return else __restic_init_completion -n "=" || return fi local c=0 local flag_parsing_disabled= local flags=() local two_word_flags=() local local_nonpersistent_flags=() local flags_with_completion=() local flags_completion=() local commands=("restic") local command_aliases=() local must_have_one_flag=() local must_have_one_noun=() local has_completion_function="" local last_command="" local nouns=() local noun_aliases=() __restic_handle_word } if [[ $(type -t compopt) = "builtin" ]]; then complete -o default -F __start_restic restic else complete -o default -o nospace -F __start_restic restic fi # ex: ts=4 sw=4 et filetype=sh gapplication 0000644 00000002555 15036124164 0007152 0 ustar 00 # Check for bash [ -z "$BASH_VERSION" ] && return #################################################################################################### __app() { case "${COMP_CWORD}" in 1) COMPREPLY=($(compgen -W "help version list-apps launch action list-actions" -- "${COMP_WORDS[1]}")) return 0 ;; 2) case "${COMP_WORDS[1]}" in launch|action|list-actions) COMPREPLY=($(compgen -W "`gapplication list-apps`" -- "${COMP_WORDS[2]}")) return 0 ;; *) COMPREPLY=() return 0 ;; esac ;; esac # Otherwise, what we will do is based on the command in ${COMP_WORDS[1]} case "${COMP_WORDS[1]}" in action) # Word 3 is the action name. This is the only one we can help with. if [ "${COMP_CWORD}" == 3 ]; then COMPREPLY=($(compgen -W "`gapplication list-actions "${COMP_WORDS[2]}"`" -- "${COMP_WORDS[3]}")) return 0 else COMPREPLY=() return 0 fi ;; launch) # Filenames... COMPREPLY=($(compgen -A file "${COMP_WORDS[COMP_CWORD]}")) return 0 ;; *) # Nothing else should be out this far... COMPREPLY=() return 0 esac } #################################################################################################### complete -F __app gapplication dumpdb 0000644 00000000563 15036124164 0005750 0 ustar 00 # mailman dumpdb completion -*- shell-script -*- _dumpdb() { local cur prev words cword _init_completion || return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '--marshal --pickle --noprint --help' \ -- "$cur")) else _filedir fi } && complete -F _dumpdb dumpdb # ex: filetype=sh sitecopy 0000644 00000002451 15036124164 0006332 0 ustar 00 # sitecopy(1) completion -*- shell-script -*- # Copyright 2003 Eelco Lempsink <eelcolempsink@gmx.net> # 2011 Raphaël Droz <raphael.droz+floss@gmail.com> # License: GNU GPL v2 or later _sitecopy() { local cur prev words cword split _init_completion -s || return case $prev in --debug | -!(-*)d) COMPREPLY=($(compgen -W "socket files rcfile ftp http httpbody rsh sftp xml xmlparse cleartext" -- "$cur")) compopt -o nospace return ;; --logfile | --rcfile | -!(-*)[gr]) _filedir return ;; --storepath | -!(-*)p) _filedir -d return ;; esac case $cur in --*) COMPREPLY=($(compgen -W "$(_parse_help $1)" -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return ;; # only complete long options -) compopt -o nospace COMPREPLY=(--) return ;; esac if [[ -r ~/.sitecopyrc ]]; then COMPREPLY=($(compgen -W "$($1 -v | command sed -n '/^Site:/s/Site: //p')" -- "$cur")) fi } && complete -F _sitecopy -o default sitecopy # ex: filetype=sh mtr 0000644 00000003634 15036124164 0005301 0 ustar 00 _mtr_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-F'|'--filename') local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- "$cur") ) return 0 ;; '-a'|'--address') COMPREPLY=( $(compgen -W "ADDRESS" -- "$cur") ) return 0 ;; '-f'|'--first-ttl'|'-m'|'--max-ttl'|'-U'|'--max-unknown'|'-B'|'--bitpattern'|'-Q'|'--tos'|'-c'|'--report-cycles') COMPREPLY=( $(compgen -W "NUMBER" -- "$cur") ) return 0 ;; '-P'|'--port'|'-L'|'--localport') COMPREPLY=( $(compgen -W "PORT" -- "$cur") ) return 0 ;; '-s'|'--psize') COMPREPLY=( $(compgen -W "SIZE" -- "$cur") ) return 0 ;; '-i'|'--interval'|'-G'|'--gracetime'|'-Z'|'--timeout') COMPREPLY=( $(compgen -W "SECONDS" -- "$cur") ) return 0 ;; '-M'|'--mark') COMPREPLY=( $(compgen -W "MARK" -- "$cur") ) return 0 ;; '--displaymode') COMPREPLY=( $(compgen -W "{0..2}" -- "$cur") ) return 0 ;; '-y'|'--ipinfo') COMPREPLY=( $(compgen -W "{0..4}" -- "$cur") ) return 0 ;; '-o'|'--order') COMPREPLY=( $(compgen -W "LDRSNBAWVGJMXI" -- "$cur") ) return 0 ;; esac case $cur in -*) OPTS=' --filename --inet --inet6 --udp --tcp --address --first-ttl --max-ttl --max-unknown --port --localport --psize --bitpattern --interval --gracetime --tos --mpls --timeout --mark --report --report-wide --report-cycles --json --xml --csv --raw --split --curses --displaymode --gtk --no-dns --show-ips --order --ipinfo --aslookup --help --version ' COMPREPLY=( $(compgen -W "${OPTS[*]}" -- "$cur") ) return 0 ;; esac COMPREPLY=( $(compgen -W "ip_address hostname" -- "$cur") ) return 0 } complete -F _mtr_module mtr hostnamectl 0000644 00000005277 15036124164 0007025 0 ustar 00 # hostnamectl(1) completion -*- shell-script -*- # SPDX-License-Identifier: LGPL-2.1-or-later # # This file is part of systemd. # # Copyright © 2010 Ran Benita # # systemd is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version. # # systemd is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with systemd; If not, see <http://www.gnu.org/licenses/>. __contains_word () { local w word=$1; shift for w in "$@"; do [[ $w = "$word" ]] && return done } __get_machines() { local a b machinectl list --full --no-legend --no-pager 2>/dev/null | { while read a b; do echo " $a"; done; }; } _hostnamectl() { local i verb comps local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} local -A OPTS=( [STANDALONE]='-h --help --version --transient --static --pretty --no-ask-password' [ARG]='-H --host -M --machine --json' ) if __contains_word "$prev" ${OPTS[ARG]}; then case $prev in --host|-H) comps=$(compgen -A hostname) ;; --machine|-M) comps=$( __get_machines ) ;; --json) comps=$( hostnamectl --json=help 2>/dev/null ) ;; *) return 0 ;; esac COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 fi if [[ $cur = -* ]]; then COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") ) return 0 fi local -A VERBS=( [STANDALONE]='status' [ICONS]='icon-name' [NAME]='hostname deployment location' [CHASSIS]='chassis' ) for ((i=0; i < COMP_CWORD; i++)); do if __contains_word "${COMP_WORDS[i]}" ${VERBS[*]}; then verb=${COMP_WORDS[i]} break fi done if [[ -z ${verb-} ]]; then comps=${VERBS[*]} elif __contains_word "$verb" ${VERBS[CHASSIS]}; then comps='desktop laptop convertible server tablet handset watch embedded vm container' elif __contains_word "$verb" ${VERBS[STANDALONE]} ${VERBS[ICONS]} ${VERBS[NAME]}; then comps='' fi COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 } complete -F _hostnamectl hostnamectl lftpget 0000644 00000000462 15036124164 0006140 0 ustar 00 # lftpget(1) completion -*- shell-script -*- _lftpget() { local cur prev words cword _init_completion || return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '-c -d -v' -- "$cur")) fi } && complete -F _lftpget lftpget # ex: filetype=sh cardctl 0000644 00000000572 15036124164 0006111 0 ustar 00 # Linux cardctl(8) completion -*- shell-script -*- _cardctl() { local cur prev words cword _init_completion || return if ((cword == 1)); then COMPREPLY=($(compgen -W 'status config ident suspend resume reset eject insert scheme' -- "$cur")) fi } && complete -F _cardctl cardctl pccardctl # ex: filetype=sh apt-build 0000644 00000002710 15036124164 0006352 0 ustar 00 # Debian apt-build(1) completion -*- shell-script -*- _apt_build() { local cur prev words cword _init_completion || return local special i for ((i = 1; i < ${#words[@]} - 1; i++)); do if [[ ${words[i]} == @(install|remove|source|info|clean) ]]; then special=${words[i]} break fi done if [[ -v special ]]; then case $special in install | source | info) COMPREPLY=($(_xfunc apt-cache _apt_cache_packages)) ;; remove) COMPREPLY=( $(_xfunc dpkg _comp_dpkg_installed_packages "$cur")) ;; esac return fi case $prev in --patch | --build-dir | --repository-dir) _filedir return ;; -h | --help) return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '--help --show-upgraded -u --build-dir --repository-dir --build-only --build-command --reinstall --rebuild --remove-builddep --no-wrapper --purge --patch --patch-strip -p --yes -y --version -v --no-source' -- "$cur")) else COMPREPLY=($(compgen -W 'update upgrade install remove source dist-upgrade world clean info clean-build update-repository' \ -- "$cur")) fi } && complete -F _apt_build apt-build # ex: filetype=sh setarch 0000644 00000001426 15036124164 0006125 0 ustar 00 _setarch_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-h'|'--help'|'-V'|'--version') return 0 ;; esac if [ $COMP_CWORD -eq 1 ]; then COMPREPLY=( $(compgen -W "$($1 --list)" -- $cur) ) return 0 fi case $cur in -*) OPTS=" --32bit --fdpic-funcptrs --short-inode --addr-compat-layout --addr-no-randomize --whole-seconds --sticky-timeouts --read-implies-exec --mmap-page-zero --3gb --4gb --uname-2.6 --verbose --list --help --version " COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac compopt -o bashdefault COMPREPLY=( $(compgen -c -- $cur) ) return 0 } complete -F _setarch_module setarch postsuper 0000644 00000003012 15036124164 0006531 0 ustar 00 # postsuper(1) completion -*- shell-script -*- _postsuper() { local cur prev words cword _init_completion || return local pval len case $prev in -c) _filedir -d return ;; -[dr]) len=${#cur} for pval in ALL $(mailq 2>/dev/null | command sed -e '1d; $d; /^[^0-9A-Z]/d; /^$/d; s/[* !].*$//'); do if [[ $cur == "${pval:0:len}" ]]; then COMPREPLY+=($pval) fi done return ;; -h) len=${#cur} for pval in ALL $(mailq 2>/dev/null | command sed -e '1d; $d; /^[^0-9A-Z]/d; /^$/d; s/[* ].*$//; /!$/d'); do if [[ $cur == "${pval:0:len}" ]]; then COMPREPLY+=($pval) fi done return ;; -H) len=${#cur} for pval in ALL $(mailq 2>/dev/null | command sed -e '1d; $d; /^[^0-9A-Z]/d; /^$/d; /^[0-9A-Z]*[* ]/d; s/!.*$//'); do if [[ $cur == "${pval:0:len}" ]]; then COMPREPLY+=($pval) fi done return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) return fi COMPREPLY=($(compgen -W 'hold incoming active deferred' -- "$cur")) } && complete -F _postsuper postsuper # ex: filetype=sh slackpkg 0000644 00000006640 15036124164 0006276 0 ustar 00 # bash completion for slackpkg(8) -*- shell-script -*- # options list is based on `grep '\-.*\=.*)' /usr/sbin/slackpkg | cut -f1 -d\)` _slackpkg() { local cur prev words cword _init_completion -n = || return local split=false if [[ $cur == -?*=* ]]; then prev="${cur%%?(\\)=*}" cur="${cur#*=}" split=true fi case "$prev" in -delall | -checkmd5 | -checkgpg | -checksize | -postinst | -onoff | -download_all | \ -dialog | -batch | -only_new_dotnew | -use_includes | -spinning) COMPREPLY=($(compgen -W 'on off' -- "$cur")) return ;; -default_answer) COMPREPLY=($(compgen -W 'yes no' -- "$cur")) return ;; -dialog_maxargs | -mirror) # argument required but no completions available return ;; esac $split && return if [[ $cur == -* ]]; then compopt -o nospace COMPREPLY=($(compgen -W '-delall= -checkmd5= -checkgpg= -checksize= -postinst= -onoff= -download_all= -dialog= -dialog_maxargs= -batch= -only_new_dotnew= -use_includes= -spinning= -default_answer= -mirror=' -- "$cur")) return fi local confdir="/etc/slackpkg" local config="$confdir/slackpkg.conf" [[ -r $config ]] || return . "$config" local i action for ((i = 1; i < ${#words[@]}; i++)); do if [[ ${words[i]} != -* ]]; then action="${words[i]}" break fi done case "$action" in generate-template | search | file-search) # argument required but no completions available return ;; install-template | remove-template) if [[ -e $confdir/templates ]]; then COMPREPLY=($( cd "$confdir/templates" compgen -f -X "!*.template" -- "$cur" )) COMPREPLY=(${COMPREPLY[@]%.template}) fi return ;; remove) _filedir COMPREPLY+=($(compgen -W 'a ap d e f k kde kdei l n t tcl x xap xfce y' -- "$cur")) COMPREPLY+=($( cd /var/log/packages compgen -f -- "$cur" )) return ;; install | reinstall | upgrade | blacklist | download) _filedir COMPREPLY+=($(compgen -W 'a ap d e f k kde kdei l n t tcl x xap xfce y' -- "$cur")) COMPREPLY+=($(cut -f 6 -d\ "${WORKDIR}/pkglist" 2>/dev/null | command grep "^$cur")) return ;; info) COMPREPLY=($(cut -f 6 -d\ "${WORKDIR}/pkglist" 2>/dev/null | command grep "^$cur")) return ;; update) # we should complete the same as the next `list` + "gpg" COMPREPLY=($(compgen -W 'gpg' -- "$cur")) ;& *) COMPREPLY+=($(compgen -W 'install reinstall upgrade remove blacklist download update install-new upgrade-all clean-system new-config check-updates help generate-template install-template remove-template search file-search info' -- \ "$cur")) return ;; esac } && complete -F _slackpkg slackpkg # ex: filetype=sh xmms 0000644 00000001267 15036124164 0005463 0 ustar 00 # bash completion for xmms -*- shell-script -*- _xmms() { local cur prev words cword split _init_completion -s || return case $prev in --help | --version | -!(-*)[hv]) return ;; --toggle-shuffle | --toggle-repeat | --toggle-advance | -!(-*)[SRA]) COMPREPLY=($(compgen -W 'on off' -- "$cur")) return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) else _filedir '@(mp[23]|ogg|wav|pls|m3u|xm|mod|s[3t]m|it|mtm|ult|flac)' fi } && complete -F _xmms xmms # ex: filetype=sh clisp 0000644 00000001234 15036124164 0005603 0 ustar 00 # -*- shell-script -*- # bash brogrammable completion for various Common Lisp implementations by # Nikodemus Siivola <nikodemus@random-state.net> _clisp() { local cur prev words cword _init_completion || return # completing an option (may or may not be separated by a space) if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '-h --help --version --license -B -K -M -m -L -N -E -q --quiet --silent -w -I -ansi -traditional -p -C -norc -i -c -l -o -x ' -- "$cur")) else _filedir fi } && complete -F _clisp -o default clisp # ex: filetype=sh curl 0000644 00000006355 15036124164 0005447 0 ustar 00 # curl(1) completion -*- shell-script -*- _curl() { local cur prev words cword _init_completion || return case $prev in --ciphers | --connect-timeout | --continue-at | --form | --form-string | \ --ftp-account | --ftp-alternative-to-user | --ftp-port | --header | --help | \ --hostpubmd5 | --keepalive-time | --krb | --limit-rate | --local-port | \ --mail-from | --mail-rcpt | --max-filesize | --max-redirs | --max-time | --pass | \ --proto | --proto-redir | --proxy-user | --proxy1.0 | --quote | --range | \ --request | --retry | --retry-delay | --retry-max-time | \ --socks5-gssapi-service | --telnet-option | --tftp-blksize | --time-cond | \ --url | --user | --user-agent | --version | --write-out | --resolve | --tlsuser | \ --tlspassword | -!(-*)[CFPHhmQrXtzuAVw]) return ;; --config | --cookie | --cookie-jar | --dump-header | --egd-file | \ --key | --libcurl | --output | --random-file | --upload-file | --trace | \ --trace-ascii | --netrc-file | -!(-*)[KbcDoT]) _filedir return ;; --cacert | --cert | -!(-*)E) _filedir '@(c?(e)rt|cer|pem|der)' return ;; --capath) _filedir -d return ;; --cert-type | --key-type) COMPREPLY=($(compgen -W 'DER PEM ENG' -- "$cur")) return ;; --crlfile) _filedir crl return ;; --data | --data-ascii | --data-binary | --data-urlencode | -!(-*)d) if [[ $cur == \@* ]]; then cur=${cur:1} _filedir if [[ ${#COMPREPLY[@]} -eq 1 && -d ${COMPREPLY[0]} ]]; then COMPREPLY[0]+=/ compopt -o nospace fi COMPREPLY=("${COMPREPLY[@]/#/@}") fi return ;; --delegation) COMPREPLY=($(compgen -W 'none policy always' -- "$cur")) return ;; --engine) COMPREPLY=($(compgen -W 'list' -- "$cur")) return ;; --ftp-method) COMPREPLY=($(compgen -W 'multicwd nocwd singlecwd' -- "$cur")) return ;; --ftp-ssl-ccc-mode) COMPREPLY=($(compgen -W 'active passive' -- "$cur")) return ;; --interface) _available_interfaces -a return ;; --proxy | --socks4 | --socks4a | --socks5 | --socks5-hostname | -!(-*)x) _known_hosts_real -- "$cur" return ;; --pubkey) _xfunc ssh _ssh_identityfile pub return ;; --stderr) COMPREPLY=($(compgen -W '-' -- "$cur")) _filedir return ;; --tlsauthtype) COMPREPLY=($(compgen -W 'SRP' -- "$cur")) return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) fi } && complete -F _curl curl # ex: filetype=sh iscsiadm 0000644 00000003573 15036124164 0006275 0 ustar 00 # iscsiadm(1) completion -*- shell-script -*- _iscsiadm() { local cur prev words cword split _init_completion -s || return case $prev in --mode | -!(-*)m) COMPREPLY=($(compgen -W 'discovery node session iface fw host' \ -- "$cur")) return ;; --op | -!(-*)o) COMPREPLY=($(compgen -W 'new delete update show' -- "$cur")) return ;; --type | -!(-*)t) COMPREPLY=($(compgen -W 'sendtargets st slp isns fw' -- "$cur")) return ;; --loginall | --logoutall | -!(-*)[LU]) COMPREPLY=($(compgen -W 'all manual automatic' -- "$cur")) return ;; esac $split && return local options if ((cword > 1)); then case ${words[2]} in discovery) options='--help --version --debug --print --interface --type \ --portal --login --op --name --value' ;; node) options='--help --version --debug --print --loginall \ --logoutall--show -T --portal --interface --login \ --logout --rescan --stats --op --name --value' ;; session) options='--help --version --debug --print --sid --logout \ --rescan --stats' ;; iface) options='--help --version --debug --print --interface --op \ --name --value' ;; fw) options='--login' ;; host) options='--print -H' ;; esac else options='--mode' fi COMPREPLY=($(compgen -W "$options" -- "$cur")) } && complete -F _iscsiadm iscsiadm # ex: filetype=sh postcat 0000644 00000001545 15036124164 0006153 0 ustar 00 # postcat(1) completion -*- shell-script -*- _postcat() { local cur prev words cword _init_completion || return case $prev in -c) _filedir -d return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_usage "$1")' -- "$cur")) return fi local idx qfile=0 for idx in "${words[@]}"; do [[ $idx == -q ]] && qfile=1 && break done if ((qfile == 1)); then local len=${#cur} pval for pval in $(mailq 2>/dev/null | command sed -e '1d; $d; /^[^0-9A-Z]/d; /^$/d; s/[* !].*$//'); do if [[ $cur == "${pval:0:len}" ]]; then COMPREPLY+=($pval) fi done return fi _filedir } && complete -F _postcat postcat # ex: filetype=sh protoc 0000644 00000002740 15036124164 0006002 0 ustar 00 # protoc completion -*- shell-script -*- _protoc() { local cur prev words cword split _init_completion -s || return case $prev in --version | -h | --help | --encode | --decode) return ;; --descriptor_set_out) _filedir return ;; --error_format) COMPREPLY=($(compgen -W 'gcc msvs' -- "$cur")) return ;; --plugin) if [[ $cur != *=* ]]; then compopt -o filenames COMPREPLY=($(compgen -c -- "$cur")) fi return ;; --proto_path | --*_out) _filedir -d return ;; esac $split && return case $cur in -o*) cur=${cur:2} _filedir COMPREPLY=("${COMPREPLY[@]/#/-o}") return ;; -I*) cur=${cur:2} _filedir -d COMPREPLY=("${COMPREPLY[@]/#/-I}") return ;; -*) COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) local i for i in "${!COMPREPLY[@]}"; do [[ ${COMPREPLY[i]} == -oFILE ]] && unset 'COMPREPLY[i]' done [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return ;; esac _filedir proto } && complete -F _protoc protoc # ex: filetype=sh explodepkg 0000644 00000000230 15036124164 0006626 0 ustar 00 # Slackware Linux explodepkg completion -*- shell-script -*- complete -o plusdirs -f -X '!*.t[bglx]z' explodepkg # ex: filetype=sh swaplabel 0000644 00000001173 15036124164 0006445 0 ustar 00 _swaplabel_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-L'|'--label') COMPREPLY=( $(compgen -W "label" -- $cur) ) return 0 ;; '-U'|'--uuid') COMPREPLY=( $(compgen -W '$(uuidgen)' -- $cur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS="--label --uuid --help --version" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 } complete -F _swaplabel_module swaplabel portupgrade 0000644 00000000725 15036124164 0007031 0 ustar 00 # bash completion for FreeBSD portupgrade -*- shell-script -*- _portupgrade() { local cur prev words cword _init_completion || return [[ $prev == -l || $prev == -L || $prev == -o ]] && return local pkgdir=${PKG_DBDIR:-/var/db/pkg}/ COMPREPLY=($(compgen -d -- "$pkgdir$cur")) COMPREPLY=(${COMPREPLY[@]#$pkgdir}) COMPREPLY=(${COMPREPLY[@]%-*}) } && complete -F _portupgrade -o dirnames portupgrade # ex: filetype=sh gssdp-discover 0000644 00000001632 15036124164 0007427 0 ustar 00 # bash completion for gssdp-discover -*- shell-script -*- _gssdp_discover() { local cur prev words cword split _init_completion -s || return case $prev in --help | --target | --timeout | --rescan-interval | -[htnr]) return ;; --interface | -i) _available_interfaces -a return ;; --message-type | -m) local types=$($1 --help 2>&1 | command sed -ne 's/^.*--message-type=.*(\([^)]*\))$/\1/p') COMPREPLY=($( IFS+=, compgen -W "$types" -- "$cur" )) return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace fi } && complete -F _gssdp_discover gssdp-discover # ex: filetype=sh setpriv 0000644 00000005426 15036124164 0006174 0 ustar 00 _setpriv_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '--ambient-caps'|'--inh-caps'|'--bounding-set') local prefix realcur INHERIT_ALL INHERIT realcur="${cur##*,}" prefix="${cur%$realcur}" INHERIT_ALL=$($1 --list-caps| awk '{print $1, "-" $1}') for WORD in $INHERIT_ALL; do if ! [[ $prefix == *"$WORD"* ]]; then INHERIT="$WORD ${INHERIT:-""}" fi done compopt -o nospace COMPREPLY=( $(compgen -P "$prefix" -W "$INHERIT" -S ',' -- $realcur) ) return 0 ;; '--ruid'|'--euid'|'--reuid') local UIDS UIDS=$(getent passwd | awk -F: '{print $1}') COMPREPLY=( $(compgen -W "$UIDS" -- $cur) ) return 0 ;; '--rgid'|'--egid'|'--regid') local GIDS GIDS=$(getent group | awk -F: '{print $1}') COMPREPLY=( $(compgen -W "$GIDS" -- $cur) ) return 0 ;; '--groups') local prefix realcur GIDS_ALL GIDS realcur="${cur##*,}" prefix="${cur%$realcur}" GIDS_ALL=$(getent group | awk -F: '{print $3}') for WORD in $GIDS_ALL; do if ! [[ $prefix == *"$WORD"* ]]; then GIDS="$WORD ${GIDS:-""}" fi done compopt -o nospace COMPREPLY=( $(compgen -P "$prefix" -W "$GIDS" -S ',' -- $realcur) ) return 0 ;; '--securebits') local prefix realcur SBITS_ALL SBITS WORD realcur="${cur##*,}" prefix="${cur%$realcur}" SBITS_ALL=" {+,-}keep_caps_locked {+,-}noroot {+,-}noroot_locked {+,-}no_setuid_fixup {+,-}no_setuid_fixup_locked " for WORD in $SBITS_ALL; do if ! [[ $prefix == *"$WORD"* ]]; then SBITS="$WORD ${SBITS:-""}" fi done compopt -o nospace COMPREPLY=( $(compgen -P "$prefix" -W "$SBITS" -S ',' -- $realcur) ) return 0 ;; '--pdeathsig') local i signals for i in $(kill -l); do case $i in SIG*) signals+="$i " ;; esac done COMPREPLY=( $(compgen -W "keep clear $signals" -- $cur) ) return 0 ;; '--selinux-label') # FIXME: how to list selinux labels? COMPREPLY=( $(compgen -W "label" -- $cur) ) return 0 ;; '--apparmor-profile') # FIXME: how to list apparmor profiles? COMPREPLY=( $(compgen -W "profile" -- $cur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS="--dump --no-new-privs --ambient-caps --inh-caps --bounding-set --ruid --euid --rgid --egid --reuid --regid --clear-groupsclear --keep-groupskeep --groups --securebits --pdeathsig --reset-env --selinux-label --apparmor-profile --help --version" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac compopt -o bashdefault COMPREPLY=( $(compgen -c -- $cur) ) return 0 } complete -F _setpriv_module setpriv sshmitm 0000644 00000000554 15036124164 0006161 0 ustar 00 # sshmitm completion -*- shell-script -*- _sshmitm() { local cur prev words cword _init_completion || return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_usage "$1")' -- "$cur")) else _known_hosts_real -- "$cur" fi } && complete -F _sshmitm sshmitm # ex: filetype=sh _dmesg 0000644 00000001641 15036124164 0005731 0 ustar 00 # dmesg(1) completion -*- shell-script -*- # Use of this file is deprecated on Linux. Upstream completion is # available in util-linux >= 2.23, use that instead. _dmesg() { [[ $OSTYPE == *solaris* ]] && return # no args there local cur prev words cword _init_completion || return case $prev in -h | --help | -V | --version | -s | --buffer-size | -M | -N) return ;; -f | --facility) COMPREPLY=($(compgen -W 'kern user mail daemon auth syslog lpr news' -- "$cur")) return ;; -l | --level | -n | --console-level) COMPREPLY=($(compgen -W '{1..8}' -- "$cur")) return ;; esac local opts=$(_parse_help "$1") COMPREPLY=($(compgen -W '${opts:-$(_parse_usage "$1")}' -- "$cur")) } && complete -F _dmesg dmesg # ex: filetype=sh larch 0000644 00000003675 15036124164 0005575 0 ustar 00 # larch(1) completion -*- shell-script -*- # by Alex Shinn <foof@synthcode.com> _larch() { local cur prev words cword _init_completion || return if [[ $cword -eq 1 || $prev == -* ]]; then COMPREPLY=($(compgen -W ' \ my-id my-default-archive register-archive whereis-archive archives \ init-tree tree-root tree-version set-tree-version inventory \ tagging-method tree-lint missing-tags add delete \ move explicit-default set-manifest manifest check-manifest mkpatch \ dopatch patch-report empty-patch make-archive make-category \ make-branch make-version categories branches versions revisions \ cat-archive-log archive-cache-revision archive-cached-revisions \ archive-uncache-revision category-readme branch-readme \ version-readme make-log logs add-log log-ls cat-log \ log-header-field changelog log-for-merge merge-points \ new-on-branch import commit get get-patch lock-branch \ lock-revision push-mirror build-config update-config replay-config \ record-config show-config config-history update replay delta-patch \ star-merge tag prepare-branch finish-branch join-branch \ whats-missing what-changed file-diffs pristines lock-pristine \ my-revision-library library-find library-add library-remove \ library-archives library-categories library-branches \ library-versions library-revisions library-log library-file \ touched-files-prereqs patch-set-web update-distributions \ distribution-name notify my-notifier mail-new-categories \ mail-new-branches mail-new-versions mail-new-revisions \ notify-library notify-browser push-new-revisions sendmail-mailx' \ "$cur")) fi } && complete -F _larch -o default larch # ex: filetype=sh reportbug 0000644 00000006504 15036124164 0006507 0 ustar 00 # bash completion for (Debian) reportbug -*- shell-script -*- _reportbug() { local cur prev words cword split _init_completion -s || return case $prev in --class | --header | --pseudo-header | --mirror | --list-cc | --subject | \ --http_proxy | --proxy | --email | --realname | --smtpuser | --smtppasswd | \ --replyto | --reply-to | --justification | --package-version | --body | \ --body-file | --timeout | --max-attachment-size | --envelope-from | \ -!(-*)[CHPsjV]) return ;; --filename | --include | --mta | --output | --attach | -[fioA]) _filedir return ;; --keyid | -!(-*)K) COMPREPLY=($(compgen -W '$(IFS=: ; \ gpg --list-keys --with-colons 2>/dev/null \ | while read -ra row ; do [[ "${row[0]}" == [ps]ub && ${row[11]} == *s* ]] && \ printf "%s\n" "${row[4]}" done)' -- "$cur")) return ;; --bts | -!(-*)B) COMPREPLY=($(compgen -W "debian guug kde mandrake help" -- \ "$cur")) return ;; --editor | --mua | --mbox-reader-cmd | -!(-*)e) compopt -o filenames COMPREPLY=($(compgen -c -- "$cur")) return ;; --mode) COMPREPLY=($(compgen -W "novice standard expert" -- "$cur")) return ;; --severity | -!(-*)S) COMPREPLY=($(compgen -W "grave serious important normal minor wishlist" -- "$cur")) return ;; --ui | --interface | -!(-*)u) COMPREPLY=($(compgen -W "newt text gnome" -- "$cur")) return ;; --type | -!(-*)t) COMPREPLY=($(compgen -W "gnats debbugs" -- "$cur")) return ;; --tag | -!(-*)T) COMPREPLY=($(compgen -W "none woody potato sarge sarge-ignore etch etch-ignore lenny lenny-ignore sid experimental confirmed d-i fixed fixed-in-experimental fixed-upstream help l10n moreinfo patch pending security unreproducible upstream wontfix ipv6 lfs" -- "$cur")) return ;; --from-buildd) COMPREPLY=($(compgen -S "_" -W '$(apt-cache dumpavail | \ command grep "^Source: $cur" | sort -u | cut -f2 -d" ")')) return ;; --smtphost) _known_hosts_real -- "$cur" return ;; --draftpath) _filedir -d return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == -*= ]] && compopt -o nospace return fi COMPREPLY=($(compgen -W 'wnpp boot-floppies kernel bugs.debian.org cdimage.debian.org general installation-reports listarchives lists.debian.org mirrors nm.debian.org press project qa.debian.org release-notes security.debian.org tech-ctte upgrade-reports www.debian.org $(_xfunc apt-cache _apt_cache_packages)' -- "$cur")) _filedir } && complete -F _reportbug reportbug # ex: filetype=sh installpkg 0000644 00000001333 15036124164 0006641 0 ustar 00 # Slackware Linux installpkg completion -*- shell-script -*- _installpkg() { local cur prev words cword _init_completion || return case "$prev" in --root) _filedir -d return ;; --priority) COMPREPLY=($(compgen -W 'ADD REC OPT SKP' -- "$cur")) return ;; --tagfile) _filedir return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '--warn --md5sum --root --infobox --terse --menu --ask --priority --tagfile' -- "$cur")) return fi _filedir 't[bglx]z' } && complete -F _installpkg installpkg # ex: filetype=sh slapt-get 0000644 00000004706 15036124164 0006400 0 ustar 00 # slapt-get(8) completion -*- shell-script -*- _slapt_get() { local cur prev words cword _init_completion || return case "$prev" in --config | -c) _filedir return ;; --retry | --search) # argument required but no completions available return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1" --help)' -- "$cur")) if [[ ${COMPREPLY-} ]]; then [[ $COMPREPLY == *= ]] && compopt -o nospace return fi fi local i t # search for last action (--install|--install-set|--remove|--show|--filelist) for ((i = ${#words[@]} - 1; i > 0; i--)); do if [[ ${words[i]} == --show ]]; then t="all" break elif [[ ${words[i]} == -@(i|-install) ]]; then t="avl" break elif [[ ${words[i]} == --install-set ]]; then t="set" break elif [[ ${words[i]} == --@(remove|filelist) ]]; then t="ins" break fi done local config="/etc/slapt-get/slapt-getrc" # default config location # search for config for ((i = ${#words[@]} - 1; i > 0; i--)); do if [[ ${words[i]} == -@(c|-config) ]]; then config="${words[i + 1]}" __expand_tilde_by_ref config break fi done [[ -r $config ]] || return case $t in all) # --show # slapt-get will fail to search for "^name-version" # it can search for names only local name=${cur%%-*} COMPREPLY=($(LC_ALL=C "$1" -c "$config" --search "^$name" \ 2>/dev/null | LC_ALL=C command sed -ne "/^$cur/{s/ .*$//;p}")) return ;; avl) # --install|-i| COMPREPLY=($(LC_ALL=C "$1" -c "$config" --available \ 2>/dev/null | LC_ALL=C command sed -ne "/^$cur/{s/ .*$//;p}")) return ;; ins) # --remove|--filelist COMPREPLY=($( cd /var/log/packages compgen -f -- "$cur" )) return ;; set) # --install-set COMPREPLY=($(compgen -W 'a ap d e f k kde kdei l n t tcl x xap xfce y' -- "$cur")) return ;; esac } && complete -F _slapt_get slapt-get # ex: filetype=sh _eject 0000644 00000001455 15036124164 0005727 0 ustar 00 # bash completion for eject(1) -*- shell-script -*- # Use of this file is deprecated on Linux. Upstream completion is # available in util-linux >= 2.23, use that instead. _eject() { local cur prev words cword _init_completion || return case $prev in -h | --help | -V | --version | -c | --changerslot | -x | --cdspeed) return ;; -a | --auto | -i | --manualeject) COMPREPLY=($(compgen -W 'on off' -- "$cur")) return ;; esac if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) return elif [[ $prev == @(-d|--default) ]]; then return fi _cd_devices _dvd_devices } && complete -F _eject eject # ex: filetype=sh pwgen 0000644 00000001133 15036124164 0005607 0 ustar 00 # pwgen(1) completion -*- shell-script -*- _pwgen() { local cur prev words cword split _init_completion -s || return case $prev in --num-passwords | --help | -!(-*)[Nh]) return ;; --sha1 | -!(-*)H) _filedir return ;; esac $split && return if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return fi } && complete -F _pwgen pwgen # ex: filetype=sh
| ver. 1.4 |
Github
|
.
| PHP 8.2.28 | Generation time: 0.05 |
proxy
|
phpinfo
|
Settings