diff options
Diffstat (limited to 'completions')
103 files changed, 977 insertions, 221 deletions
diff --git a/completions/.gitignore b/completions/.gitignore index 60a2d949..c0b4c044 100644 --- a/completions/.gitignore +++ b/completions/.gitignore @@ -4,6 +4,7 @@ alpine alternatives animate apropos +aptitude-curses arm-koji asciidoc.py autoheader @@ -50,6 +51,7 @@ g4 g77 g95 gcj +geoiplookup6 gfortran gkrellm2 gmake @@ -137,6 +139,7 @@ pvscan pxz py.test-[23] pydoc3 +pylint-[23] python2 python3 pypy diff --git a/completions/Makefile.am b/completions/Makefile.am index f04d7c36..e442a9e6 100644 --- a/completions/Makefile.am +++ b/completions/Makefile.am @@ -37,6 +37,7 @@ bashcomp_DATA = 2to3 \ cancel \ cardctl \ ccache \ + ccze \ cfagent \ cfrun \ chage \ @@ -85,6 +86,7 @@ bashcomp_DATA = 2to3 \ dumpe2fs \ e2freefrag \ e2label \ + ebtables \ _eject \ eog \ ether-wake \ @@ -113,6 +115,8 @@ bashcomp_DATA = 2to3 \ genaliases \ gendiff \ genisoimage \ + geoiplookup \ + getconf \ getent \ gkrellm \ gm \ @@ -198,6 +202,8 @@ bashcomp_DATA = 2to3 \ lpr \ lrzip \ lsof \ + lsscsi \ + lsusb \ lua \ luac \ luseradd \ @@ -251,8 +257,10 @@ bashcomp_DATA = 2to3 \ ngrep \ nmap \ _nmcli \ + nproc \ nslookup \ ntpdate \ + oggdec \ openssl \ opera \ optipng \ @@ -262,6 +270,7 @@ bashcomp_DATA = 2to3 \ patch \ pdftotext \ perl \ + perltidy \ pgrep \ pidof \ pine \ @@ -291,11 +300,13 @@ bashcomp_DATA = 2to3 \ protoc \ psql \ puppet \ + pv \ pwck \ pwd \ pwdx \ pwgen \ py.test \ + pycodestyle \ pydoc \ pyflakes \ pylint \ @@ -306,6 +317,7 @@ bashcomp_DATA = 2to3 \ qrunner \ querybts \ quota \ + radvdump \ rcs \ rdesktop \ remove_members \ @@ -315,7 +327,7 @@ bashcomp_DATA = 2to3 \ reportbug \ _reptyr \ resolvconf \ - rfkill \ + _rfkill \ ri \ rmlist \ rmmod \ @@ -367,6 +379,7 @@ bashcomp_DATA = 2to3 \ tcpnice \ timeout \ tipc \ + tox \ tracepath \ tshark \ tune2fs \ @@ -400,6 +413,8 @@ bashcomp_DATA = 2to3 \ wsimport \ wtf \ wvdial \ + xdg-mime \ + xdg-settings \ xfreerdp \ xgamma \ xhost \ @@ -434,6 +449,7 @@ CLEANFILES = \ alternatives \ animate \ apropos \ + aptitude-curses \ arm-koji \ asciidoc.py \ autoheader \ @@ -485,6 +501,7 @@ CLEANFILES = \ g77 \ g95 \ gcj \ + geoiplookup6 \ gfortran \ gkrellm2 \ gmake \ @@ -573,6 +590,8 @@ CLEANFILES = \ py.test-2 \ py.test-3 \ pydoc3 \ + pylint-2 \ + pylint-3 \ pypy \ pypy3 \ python2 \ @@ -655,6 +674,10 @@ symlinks: $(targetdir) $(DATA) rm -f $(targetdir)/$$file && \ $(LN_S) ant $(targetdir)/$$file ; \ done + for file in aptitude-curses ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) aptitude $(targetdir)/$$file ; \ + done for file in asciidoc.py ; do \ rm -f $(targetdir)/$$file && \ $(LN_S) asciidoc $(targetdir)/$$file ; \ @@ -733,6 +756,10 @@ symlinks: $(targetdir) $(DATA) rm -f $(targetdir)/$$file && \ $(LN_S) genisoimage $(targetdir)/$$file ; \ done + for file in geoiplookup6 ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) geoiplookup $(targetdir)/$$file ; \ + done for file in gkrellm2 ; do \ rm -f $(targetdir)/$$file && \ $(LN_S) gkrellm $(targetdir)/$$file ; \ @@ -881,6 +908,10 @@ symlinks: $(targetdir) $(DATA) rm -f $(targetdir)/$$file && \ $(LN_S) pydoc $(targetdir)/$$file ; \ done + for file in pylint-2 pylint-3 ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) pylint $(targetdir)/$$file ; \ + done for file in pypy pypy3 python2 python3 micropython ; do \ rm -f $(targetdir)/$$file && \ $(LN_S) python $(targetdir)/$$file ; \ diff --git a/completions/rfkill b/completions/_rfkill index a3741d22..e807d976 100644 --- a/completions/rfkill +++ b/completions/_rfkill @@ -1,5 +1,8 @@ # 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 diff --git a/completions/alias b/completions/alias index de2a57e8..e90dff60 100644 --- a/completions/alias +++ b/completions/alias @@ -3,7 +3,7 @@ _alias() { local cur prev words cword - _init_completion || return + _init_completion -n = || return case ${words[@]} in *[^=]) diff --git a/completions/apt-get b/completions/apt-get index ce951050..32c4bcf8 100644 --- a/completions/apt-get +++ b/completions/apt-get @@ -30,8 +30,12 @@ _apt_get() command grep "^Source: $cur" | sort -u | cut -f2 -d" " ) ) ;; *) - COMPREPLY=( $( apt-cache --no-generate pkgnames "$cur" \ - 2> /dev/null ) ) + if [[ $special == install && $cur == */* ]]; then + _filedir deb + else + COMPREPLY=( $( apt-cache --no-generate pkgnames "$cur" \ + 2>/dev/null ) ) + fi ;; esac return diff --git a/completions/aptitude b/completions/aptitude index 32c1dacf..a8b88737 100644 --- a/completions/aptitude +++ b/completions/aptitude @@ -77,11 +77,11 @@ _aptitude() 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-all build-dep add-user-tag + show forbid-version changelog keep keep-all build-dep add-user-tag remove-user-tag versions' -- "$cur" ) ) fi } && -complete -F _aptitude -o default aptitude +complete -F _aptitude -o default aptitude aptitude-curses # ex: filetype=sh diff --git a/completions/arping b/completions/arping index a719e916..2f544353 100644 --- a/completions/arping +++ b/completions/arping @@ -24,7 +24,7 @@ _arping() return fi - _known_hosts_real "$cur" + _known_hosts_real -- "$cur" } && complete -F _arping arping diff --git a/completions/arpspoof b/completions/arpspoof index 7b515edb..e31288fc 100644 --- a/completions/arpspoof +++ b/completions/arpspoof @@ -11,7 +11,7 @@ _arpspoof() return ;; -t) - _known_hosts_real "$cur" + _known_hosts_real -- "$cur" return ;; esac @@ -19,7 +19,7 @@ _arpspoof() if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) else - _known_hosts_real "$cur" + _known_hosts_real -- "$cur" fi } && diff --git a/completions/bzip2 b/completions/bzip2 index 8362a595..f45e29f2 100644 --- a/completions/bzip2 +++ b/completions/bzip2 @@ -32,7 +32,7 @@ _bzip2() [[ "$prev" == -*z* ]] && xspec= fi - _expand || return + _tilde "$cur" || return compopt -o filenames COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \ diff --git a/completions/ccze b/completions/ccze new file mode 100644 index 00000000..c803408b --- /dev/null +++ b/completions/ccze @@ -0,0 +1,43 @@ +# ccze(1) completion -*- shell-script -*- + +_ccze() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + -'?'|--help|--usage|-V|--version) + return + ;; + -a|--argument|-c|--color) + # TODO? + return + ;; + -F|--rcfile) + _filedir + return + ;; + -m|--mode) + COMPREPLY=( $( compgen -W "curses ansi html" -- "$cur" ) ) + return + ;; + -o|--option) + local -a opts=(scroll wordcolor lookups transparent cssfile) + COMPREPLY=( $( compgen -W '${opts[@]} ${opts[@]/#/no}' -- "$cur" ) ) + return + ;; + -p|--plugin) + COMPREPLY=( $( compgen -W '$( "$1" --list-plugins | + 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 diff --git a/completions/chronyc b/completions/chronyc index ede6bb09..fae9d2e4 100644 --- a/completions/chronyc +++ b/completions/chronyc @@ -5,7 +5,7 @@ _chronyc_command_args() local -a args=( $( compgen -W "$( $1 help 2>/dev/null | \ awk '/^'$prev'\s[^ []/ { gsub("\\|", " ", $2); print $2 }' )" ) ) case $args in - \<address\>) _known_hosts_real "$cur" ;; + \<address\>) _known_hosts_real -- "$cur" ;; \<*) ;; *) COMPREPLY+=( $( compgen -W '${args[@]}' -- "$cur" ) ) ;; esac @@ -21,7 +21,7 @@ _chronyc() return ;; -h) - _known_hosts_real "$cur" + _known_hosts_real -- "$cur" return ;; esac @@ -50,7 +50,7 @@ _chronyc() fi ;; 2) - [[ $prev == @(peer|server) ]] && _known_hosts_real "$cur" + [[ $prev == @(peer|server) ]] && _known_hosts_real -- "$cur" ;; esac } && diff --git a/completions/cryptsetup b/completions/cryptsetup index 9411ad7a..570b27ef 100644 --- a/completions/cryptsetup +++ b/completions/cryptsetup @@ -33,26 +33,27 @@ _cryptsetup() COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) [[ $COMPREPLY == *= ]] && compopt -o nospace else - COMPREPLY=( $( compgen -W 'create remove status resize luksFormat - luksOpen luksClose luksSuspend luksResume luksAddKey - luksRemoveKey luksKillSlot luksDelKey luksUUID isLuks - luksDump luksHeaderBackup luksHeaderRestore' -- "$cur" ) ) + 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 case $arg in - create) + open|create|luksOpen|loopaesOpen|tcryptOpen) case $args in 2) - _cryptsetup_name + _cryptsetup_device ;; 3) - _cryptsetup_device + _cryptsetup_name ;; esac ;; - remove|status|resize|luksClose|luksSuspend|luksResume) + close|remove|luksClose|loopaesClose|tcryptClose|status|resize|\ + luksSuspend|luksResume) case $args in 2) _cryptsetup_name @@ -69,16 +70,6 @@ _cryptsetup() ;; esac ;; - luksOpen) - case $args in - 2) - _cryptsetup_device - ;; - 3) - _cryptsetup_name - ;; - esac - ;; luksKillSlot|luksDelKey|luksUUID|isLuks|luksDump) case $args in 2) diff --git a/completions/curl b/completions/curl index 8251674c..c28a8ccd 100644 --- a/completions/curl +++ b/completions/curl @@ -68,7 +68,7 @@ _curl() return ;; -x|--proxy|--socks4|--socks4a|--socks5|--socks5-hostname) - _known_hosts_real + _known_hosts_real -- "$cur" return ;; --pubkey) diff --git a/completions/dd b/completions/dd index daaebbe1..b2647bca 100644 --- a/completions/dd +++ b/completions/dd @@ -32,12 +32,11 @@ _dd() ;; esac - _expand || return - 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 -o nospace dd +complete -F _dd dd # ex: filetype=sh diff --git a/completions/dhclient b/completions/dhclient index 8b44f6c3..24270c7e 100644 --- a/completions/dhclient +++ b/completions/dhclient @@ -11,7 +11,7 @@ _dhclient() return ;; -s) - _known_hosts_real "$cur" + _known_hosts_real -- "$cur" return ;; esac diff --git a/completions/dpkg b/completions/dpkg index 725542a7..76dd5b01 100644 --- a/completions/dpkg +++ b/completions/dpkg @@ -32,7 +32,7 @@ _comp_dpkg_purgeable_packages() } } -# Debian dpkg(8) completion +# Debian dpkg(1) completion # _dpkg() { @@ -50,9 +50,9 @@ _dpkg() fi case $prev in - -c|-i|-A|-I|-f|-e|-x|-X|-W|--install|--unpack|--record-avail| \ + -c|-i|-A|-I|-f|-e|-x|-W|--install|--unpack|--record-avail| \ --contents|--info|--fsys-tarfile|--field|--control|--extract| \ - --show) + --vextract) _filedir '?(u|d)deb' return ;; @@ -60,7 +60,7 @@ _dpkg() _filedir -d return ;; - -s|-p|-l|--status|--print-avail|--list) + -s|-p|-l|-W|--status|--print-avail|--list|--show) COMPREPLY=( $( apt-cache pkgnames "$cur" 2>/dev/null ) ) return ;; @@ -68,7 +68,7 @@ _dpkg() _filedir return ;; - -r|--remove) + -r|-V|--remove|--verify) COMPREPLY=( $( _comp_dpkg_installed_packages "$cur" ) ) return ;; diff --git a/completions/ebtables b/completions/ebtables new file mode 100644 index 00000000..05af7e39 --- /dev/null +++ b/completions/ebtables @@ -0,0 +1,83 @@ +# 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' + + if [[ ${words[@]} == *-t\ *filter* ]]; then + table="-t filter" + elif [[ ${words[@]} == *-t\ *nat* ]]; then + table="-t nat" + elif [[ ${words[@]} == *-t\ *mangle* ]]; then + table="-t mangle" + fi + + 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 diff --git a/completions/file-roller b/completions/file-roller index 3c627585..efa73bb1 100644 --- a/completions/file-roller +++ b/completions/file-roller @@ -5,7 +5,7 @@ _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]|lzh|?(t)lrz|lzma|lzo|wim|swm|rpm|sit|zoo)' + 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) diff --git a/completions/find b/completions/find index 39029345..4451d059 100644 --- a/completions/find +++ b/completions/find @@ -62,8 +62,6 @@ _find() ;; esac - _expand || return - local i exprfound=false # set exprfound to true if there is already an expression present for i in ${words[@]}; do diff --git a/completions/flake8 b/completions/flake8 index 60ad9e2b..6f0be12f 100644 --- a/completions/flake8 +++ b/completions/flake8 @@ -6,18 +6,25 @@ _flake8() _init_completion -s || return case $prev in - -h|--help|--version|--exclude|--filename|--select|--ignore|\ - --max-line-length|--max-complexity|--builtins) + -h|--help|--version) return ;; --format) COMPREPLY=( $( compgen -W 'default pylint' -- "$cur" ) ) return ;; - --config) + -j|--jobs) + 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 diff --git a/completions/freeciv-gtk2 b/completions/freeciv-gtk2 index 246d4f20..953b829a 100644 --- a/completions/freeciv-gtk2 +++ b/completions/freeciv-gtk2 @@ -15,7 +15,7 @@ _civclient() return ;; -s|--server) - _known_hosts_real "$cur" + _known_hosts_real -- "$cur" return ;; esac diff --git a/completions/gcc b/completions/gcc index 174e0718..b93a33f2 100644 --- a/completions/gcc +++ b/completions/gcc @@ -13,8 +13,6 @@ _gcc() local cur prev words cword _init_completion || return - _expand || return - local cc backend case $1 in diff --git a/completions/geoiplookup b/completions/geoiplookup new file mode 100644 index 00000000..0c92548a --- /dev/null +++ b/completions/geoiplookup @@ -0,0 +1,33 @@ +# 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 diff --git a/completions/getconf b/completions/getconf new file mode 100644 index 00000000..80be667c --- /dev/null +++ b/completions/getconf @@ -0,0 +1,30 @@ +# 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 diff --git a/completions/gkrellm b/completions/gkrellm index cfe65429..52d2a651 100644 --- a/completions/gkrellm +++ b/completions/gkrellm @@ -15,7 +15,7 @@ _gkrellm() return ;; -s|--server) - _known_hosts_real "$cur" + _known_hosts_real -- "$cur" return ;; -l|--logfile) diff --git a/completions/groupdel b/completions/groupdel index 91ba3583..867b1741 100644 --- a/completions/groupdel +++ b/completions/groupdel @@ -1,5 +1,27 @@ # groupdel(8) completion -*- shell-script -*- -complete -g groupdel +_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 diff --git a/completions/gzip b/completions/gzip index 8093e41e..59818d92 100644 --- a/completions/gzip +++ b/completions/gzip @@ -33,7 +33,7 @@ _gzip() [[ "$prev" == -*f* ]] && xspec= fi - _expand || return + _tilde "$cur" || return compopt -o filenames COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \ diff --git a/completions/hping2 b/completions/hping2 index 9d454622..6344ed73 100644 --- a/completions/hping2 +++ b/completions/hping2 @@ -11,7 +11,7 @@ _hping2() return ;; -a|--spoof) - _known_hosts_real "$cur" + _known_hosts_real -- "$cur" return ;; -o|--tos) @@ -27,7 +27,7 @@ _hping2() if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) else - _known_hosts_real "$cur" + _known_hosts_real -- "$cur" fi } && complete -F _hping2 hping hping2 hping3 diff --git a/completions/info b/completions/info index f71cbf5b..ba2cf4cb 100644 --- a/completions/info +++ b/completions/info @@ -5,8 +5,6 @@ _info() local cur prev words cword split _init_completion -s || return - _expand || return - # default completion if parameter looks like a path if [[ "$cur" == @(*/|[.~])* ]]; then _filedir @@ -49,6 +47,8 @@ _info() infopath=$INFOPATH fi + _expand || return + infopath=$infopath: if [[ -n $cur ]]; then infopath="${infopath//://$cur* }" diff --git a/completions/iperf b/completions/iperf index 4652879c..712ab946 100644 --- a/completions/iperf +++ b/completions/iperf @@ -25,7 +25,7 @@ _iperf() return ;; -c|--client) - _known_hosts_real "$cur" + _known_hosts_real -- "$cur" return ;; -x|--reportexclude) diff --git a/completions/ipmitool b/completions/ipmitool index 8e2637c7..5a660733 100644 --- a/completions/ipmitool +++ b/completions/ipmitool @@ -30,7 +30,7 @@ _ipmitool() return ;; -H) - _known_hosts_real "$cur" + _known_hosts_real -- "$cur" return ;; -f|-S|-O) diff --git a/completions/iptables b/completions/iptables index 0ecb1ebd..5ef81037 100644 --- a/completions/iptables +++ b/completions/iptables @@ -17,7 +17,7 @@ _iptables() case $prev in -*[AIDRPFXLZ]) - COMPREPLY=( $( compgen -W '`iptables $table -nL | \ + COMPREPLY=( $( compgen -W '`"$1" $table -nL 2>/dev/null | \ command sed -ne "s/^Chain \([^ ]\{1,\}\).*$/\1/p"`' -- "$cur" ) ) ;; -*t) @@ -26,30 +26,26 @@ _iptables() -j) if [[ "$table" == "-t filter" || -z "$table" ]]; then COMPREPLY=( $( compgen -W 'ACCEPT DROP LOG ULOG REJECT - `iptables $table -nL | command sed -ne "$chain" \ + `"$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 `iptables $table -nL | \ + 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 - `iptables $table -nL | command sed -ne "$chain" \ + `"$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 '--in-interface --out-interface --source - --destination --protocol --fragment --match --append --delete - --insert --replace --list --flush --zero --new --delete-chain - --policy --rename-chain --proto --source --destination - --in-interface --jump --match --numeric --out-interface --table - --verbose --line-numbers --exact --fragment --modprobe - --set-counters --version' -- "$cur" ) ) + COMPREPLY=( $( compgen -W '$( "$1" --help 2>&1 | + command sed -e "s/^\[\!\]//" | _parse_help - )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace fi ;; esac diff --git a/completions/java b/completions/java index 7d1cf1fe..e8d81fb4 100644 --- a/completions/java +++ b/completions/java @@ -217,7 +217,7 @@ _java() else if [[ "$prev" == -jar ]]; then # jar file completion - _filedir jar + _filedir '[jw]ar' else # classes completion _java_classes diff --git a/completions/jps b/completions/jps index 42f8d1a5..e46c9f16 100644 --- a/completions/jps +++ b/completions/jps @@ -17,7 +17,7 @@ _jps() COMPREPLY=( $( compgen -W "-q -m -l -v -V -J -help" -- "$cur" ) ) [[ $COMPREPLY == -J* ]] && compopt -o nospace else - _known_hosts_real "$cur" + _known_hosts_real -- "$cur" fi } && complete -F _jps jps diff --git a/completions/kcov b/completions/kcov index 7e9aa1e0..5d067778 100644 --- a/completions/kcov +++ b/completions/kcov @@ -33,9 +33,12 @@ _kcov() if [[ "$cur" == ?*,* ]]; then prev="${cur%,*}" cur="${cur##*,}" - COMPREPLY=( $( compgen -P "$prev," -W "{0..100}" -- "$cur" ) ) + COMPREPLY=( $( compgen -W "{0..100}" -- "$cur" ) ) + [[ ${#COMPREPLY[@]} -eq 1 ]] && \ + COMPREPLY=( ${COMPREPLY/#/$prev,} ) else COMPREPLY=( $( compgen -W "{0..100}" -- "$cur" ) ) + [[ ${#COMPREPLY[@]} -eq 1 ]] && COMPREPLY=( ${COMPREPLY/%/,} ) compopt -o nospace fi return diff --git a/completions/kldunload b/completions/kldunload index 82770189..52634c1e 100644 --- a/completions/kldunload +++ b/completions/kldunload @@ -7,8 +7,8 @@ _kldunload() local cur prev words cword _init_completion || return - COMPREPLY=( $( kldstat | command sed -ne \ - "s/^.*[[:blank:]]\{1,\}\($cur[a-z_]\{1,\}\).ko$/\1/p" ) ) + COMPREPLY=( $( compgen -W '$(kldstat)' -X 'kernel' -X '!*.ko' -- "$cur" ) ) + COMPREPLY=( ${COMPREPLY[@]%.ko} ) } && complete -F _kldunload kldunload diff --git a/completions/ktutil b/completions/ktutil index 384db329..2baa1c6c 100644 --- a/completions/ktutil +++ b/completions/ktutil @@ -24,7 +24,7 @@ _ktutil() local cur prev words cword split _init_completion -s || return - local command options + local command commands i options case $prev in -p|--principal) @@ -36,7 +36,7 @@ _ktutil() return ;; -a|--admin-server) - _known_hosts_real "$cur" + _known_hosts_real -- "$cur" return ;; -r|--realm) diff --git a/completions/ldapsearch b/completions/ldapsearch index 282760f7..9a6f25db 100644 --- a/completions/ldapsearch +++ b/completions/ldapsearch @@ -17,7 +17,7 @@ _ldapsearch() case $prev in -h) - _known_hosts_real "$cur" + _known_hosts_real -- "$cur" return ;; -H) @@ -60,7 +60,7 @@ _ldapaddmodify() case $prev in -h) - _known_hosts_real "$cur" + _known_hosts_real -- "$cur" return ;; -H) @@ -90,7 +90,7 @@ _ldapdelete() case $prev in -h) - _known_hosts_real "$cur" + _known_hosts_real -- "$cur" return ;; -H) @@ -120,7 +120,7 @@ _ldapcompare() case $prev in -h) - _known_hosts_real "$cur" + _known_hosts_real -- "$cur" return ;; -H) @@ -150,7 +150,7 @@ _ldapmodrdn() case $prev in -h) - _known_hosts_real "$cur" + _known_hosts_real -- "$cur" return ;; -H) @@ -180,7 +180,7 @@ _ldapwhoami() case $prev in -h) - _known_hosts_real "$cur" + _known_hosts_real -- "$cur" return ;; -H) @@ -210,7 +210,7 @@ _ldappasswd() case $prev in -h) - _known_hosts_real "$cur" + _known_hosts_real -- "$cur" return ;; -H) diff --git a/completions/ldapvi b/completions/ldapvi index e3c1f103..7d3fcf66 100644 --- a/completions/ldapvi +++ b/completions/ldapvi @@ -7,7 +7,7 @@ _ldapvi() case $prev in -h|--host) - _known_hosts_real "$cur" + _known_hosts_real -- "$cur" return ;; -Y|--sasl-mech) diff --git a/completions/lftp b/completions/lftp index edb363b2..3eb07399 100644 --- a/completions/lftp +++ b/completions/lftp @@ -21,8 +21,8 @@ _lftp() fi COMPREPLY=( $( compgen -W \ - '$( cut -f 1 -s ~/.lftp/bookmarks 2>/dev/null )' -- "$cur" ) ) - _known_hosts_real "$cur" + '$( cut -f 1 -s ~/.lftp/bookmarks ${XDG_DATA_HOME:-$HOME/.local/share}/lftp/bookmarks 2>/dev/null )' -- "$cur" ) ) + _known_hosts_real -- "$cur" } && complete -F _lftp lftp diff --git a/completions/lrzip b/completions/lrzip index f8e2cf1c..5338bd87 100644 --- a/completions/lrzip +++ b/completions/lrzip @@ -36,13 +36,13 @@ _lrzip() ;; esac - _expand || return - 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" ) \ diff --git a/completions/lspci b/completions/lspci new file mode 100644 index 00000000..70abc3c4 --- /dev/null +++ b/completions/lspci @@ -0,0 +1,41 @@ +# lspci(8) completion -*- shell-script -*- + +_lspci() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -s|-D|-O) + return + ;; + -i) + _filedir ids + return + ;; + -p) + _filedir pcimap + return + ;; + -A) + COMPREPLY+=( $( compgen -W '$( $1 -A help | command grep -vF : )' \ + -- "$cur") ) + return + ;; + -H) + COMPREPLY+=( $( compgen -W "1 2" -- "$cur" ) ) + return + ;; + -F) + _filedir + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + fi +} && +complete -F _lspci lspci + +# ex: filetype=sh diff --git a/completions/lsscsi b/completions/lsscsi new file mode 100644 index 00000000..b64c5927 --- /dev/null +++ b/completions/lsscsi @@ -0,0 +1,27 @@ +# lsscsi(8) completion -*- shell-script -*- + +_lsscsi() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + -h|--help|-V|--version) + return + ;; + -y|--sysfsroot) + _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 diff --git a/completions/lsusb b/completions/lsusb new file mode 100644 index 00000000..d6700beb --- /dev/null +++ b/completions/lsusb @@ -0,0 +1,20 @@ +# lsusb(8) completion -*- shell-script -*- + +_lsusb() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -h|--help|-V|--version|-s|-D) + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + fi +} && +complete -F _lsusb lsusb + +# ex: filetype=sh diff --git a/completions/lz4 b/completions/lz4 index 56602ca2..365fef9d 100644 --- a/completions/lz4 +++ b/completions/lz4 @@ -42,7 +42,8 @@ _lz4() esac done - _expand || return + _tilde "$cur" || return + local IFS=$'\n' compopt -o filenames COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \ diff --git a/completions/lzma b/completions/lzma index 74dac25c..0a5ab355 100644 --- a/completions/lzma +++ b/completions/lzma @@ -24,7 +24,7 @@ _lzma() [[ "$prev" == -*z* ]] && xspec= fi - _expand || return + _tilde "$cur" || return compopt -o filenames COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \ diff --git a/completions/lzop b/completions/lzop index f6753529..900a36ad 100644 --- a/completions/lzop +++ b/completions/lzop @@ -48,7 +48,7 @@ _lzop() ;; esac - _expand || return + _tilde "$cur" || return local IFS=$'\n' compopt -o filenames diff --git a/completions/make b/completions/make index 1075b37a..45d51168 100644 --- a/completions/make +++ b/completions/make @@ -152,12 +152,11 @@ _make() mode=-d # display-only mode fi - local reset=$( shopt -po posix ); set +o posix # <(...) + local IFS=$' \t\n' script=$( _make_target_extract_script $mode "$cur" ) COMPREPLY=( $( LC_ALL=C \ $1 -npq __BASH_MAKE_COMPLETION__=1 \ "${makef[@]}" "${makef_dir[@]}" .DEFAULT 2>/dev/null | \ - command sed -nf <(_make_target_extract_script $mode "$cur") ) ) - $reset + command sed -ne "$script" ) ) if [[ $mode != -d ]]; then # Completion will occur if there is only one suggestion diff --git a/completions/man b/completions/man index a00ac7a0..0668b8ee 100644 --- a/completions/man +++ b/completions/man @@ -45,23 +45,21 @@ _man() return fi - _expand || return - # file based completion if parameter looks like a path if [[ "$cur" == @(*/|[.~])* ]]; then _filedir "$manext" return fi - local manpath="$MANPATH" - [[ -z $manpath ]] && \ - manpath=$( manpath 2>/dev/null || command man -w 2>/dev/null ) + local manpath=$( manpath 2>/dev/null || command man -w 2>/dev/null ) [[ -z $manpath ]] && manpath="/usr/share/man:/usr/local/share/man" # determine manual section to search local sect [[ "$prev" == $mansect ]] && sect=$prev || sect='*' + _expand || return + manpath=$manpath: if [[ -n $cur ]]; then manpath="${manpath//://*man$sect/$cur* } ${manpath//://*cat$sect/$cur* }" diff --git a/completions/medusa b/completions/medusa index 697cafea..017d163d 100644 --- a/completions/medusa +++ b/completions/medusa @@ -7,7 +7,7 @@ _medusa() case $prev in -h) - _known_hosts_real "$cur" + _known_hosts_real -- "$cur" return ;; -H|-U|-P|-C|-O) diff --git a/completions/mplayer b/completions/mplayer index ab08b9a9..e43e6c08 100644 --- a/completions/mplayer +++ b/completions/mplayer @@ -3,7 +3,7 @@ _mplayer_options_list() { cur=${cur%\\} - COMPREPLY=( $( compgen -W "$( $1 -nomsgcolor -nomsgmodule $2 help 2>/dev/null | \ + 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" ) ) } @@ -26,7 +26,7 @@ _mplayer() return ;; -audiofile|-audio-file) - _filedir '@(mp3|mpg|ogg|w?(a)v|mid|flac|mka|ac3|ape)' + _filedir '@(mp3|mpg|og[ag]|w?(a)v|mid|flac|mka|ac3|ape)' return ;; -font|-subfont) @@ -262,7 +262,7 @@ _mplayer() -*) # Assume arg is required for everything else except options # for which -list-options says Type is Flag or Print. - $cmd -nomsgcolor -nomsgmodule -list-options 2>/dev/null \ + $cmd -noconfig all -list-options 2>/dev/null \ | while read -r i j k; do if [[ $i == ${prev#-} ]]; then [[ ${j,,} != @(flag|print) ]] && return 1 @@ -274,7 +274,7 @@ _mplayer() case $cur in -*) - COMPREPLY=( $( compgen -W '$( $cmd -nomsgcolor -nomsgmodule -list-options 2>/dev/null | \ + 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" ) ) diff --git a/completions/munin-node-configure b/completions/munin-node-configure index 82815a6e..a2021727 100644 --- a/completions/munin-node-configure +++ b/completions/munin-node-configure @@ -15,7 +15,7 @@ _munin_node_configure() return ;; --snmp) - _known_hosts_real "$cur" + _known_hosts_real -- "$cur" return ;; --snmpversion) diff --git a/completions/munin-update b/completions/munin-update index 8889a94d..ef8bf5b5 100644 --- a/completions/munin-update +++ b/completions/munin-update @@ -11,7 +11,7 @@ _munin_update() return ;; --host) - _known_hosts_real "$cur" + _known_hosts_real -- "$cur" return ;; esac diff --git a/completions/mussh b/completions/mussh index 2e9842b6..185f9d30 100644 --- a/completions/mussh +++ b/completions/mussh @@ -34,7 +34,7 @@ _mussh() return ;; -p|-h) - [[ $cur == *@* ]] && _user_at_host || _known_hosts_real -a "$cur" + [[ $cur == *@* ]] && _user_at_host || _known_hosts_real -a -- "$cur" return ;; -c) diff --git a/completions/mysql b/completions/mysql index ddc94e68..48fe0e39 100644 --- a/completions/mysql +++ b/completions/mysql @@ -16,11 +16,11 @@ _mysql() ;; -h|--host) - _known_hosts_real "$cur" + _known_hosts_real -- "$cur" return ;; --default-character-set) - local reset=$( shopt -p failglob ); shopt -u failglob + local IFS=$' \t\n' reset=$( shopt -p failglob ); shopt -u failglob local -a charsets=( /usr/share/m{ariadb,ysql}/charsets/*.xml ) $reset charsets=( "${charsets[@]##*/}" ) diff --git a/completions/mysqladmin b/completions/mysqladmin index 13799052..bb7ba869 100644 --- a/completions/mysqladmin +++ b/completions/mysqladmin @@ -11,7 +11,7 @@ _mysqladmin() return ;; -h|--host) - _known_hosts_real "$cur" + _known_hosts_real -- "$cur" return ;; --character-sets-dir|--ssl-capath) diff --git a/completions/nc b/completions/nc index 61bf5b52..63cb9d14 100644 --- a/completions/nc +++ b/completions/nc @@ -23,7 +23,7 @@ _nc() return ;; -x) - _known_hosts_real "$cur" + _known_hosts_real -- "$cur" return ;; esac @@ -39,7 +39,7 @@ _nc() [[ ${words[i]} != -* && ${words[i-1]} != -[IiOPpsTVwXx] ]] && return done - _known_hosts_real "$cur" + _known_hosts_real -- "$cur" } && complete -F _nc nc diff --git a/completions/nmap b/completions/nmap index 7de8ed42..c56c7210 100644 --- a/completions/nmap +++ b/completions/nmap @@ -19,7 +19,7 @@ _nmap() return ;; -b|--dns-servers) - _known_hosts_real "$cur" + _known_hosts_real -- "$cur" return ;; esac @@ -42,7 +42,7 @@ _nmap() -A --datadir --send-eth --send-ip --privilege--unprivileged -V -h' -- "$cur" ) ) else - _known_hosts_real "$cur" + _known_hosts_real -- "$cur" fi } && complete -F _nmap nmap diff --git a/completions/nproc b/completions/nproc new file mode 100644 index 00000000..8903940e --- /dev/null +++ b/completions/nproc @@ -0,0 +1,21 @@ +# 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 diff --git a/completions/nslookup b/completions/nslookup index f137b0a1..65770629 100644 --- a/completions/nslookup +++ b/completions/nslookup @@ -45,7 +45,7 @@ _nslookup() local args _count_args = if [[ $args -le 2 ]]; then - _known_hosts_real "$cur" + _known_hosts_real -- "$cur" [[ $args -eq 1 && $cur == @(|-) ]] && COMPREPLY+=( - ) fi } && @@ -79,7 +79,7 @@ _host() return fi - _known_hosts_real "$cur" + _known_hosts_real -- "$cur" } && complete -F _host host diff --git a/completions/ntpdate b/completions/ntpdate index ade95a69..ff0c9f00 100644 --- a/completions/ntpdate +++ b/completions/ntpdate @@ -27,7 +27,7 @@ _ntpdate() if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) else - _known_hosts_real "$cur" + _known_hosts_real -- "$cur" fi } && complete -F _ntpdate ntpdate diff --git a/completions/oggdec b/completions/oggdec new file mode 100644 index 00000000..0493087d --- /dev/null +++ b/completions/oggdec @@ -0,0 +1,38 @@ +# bash completion for oggdec(1) -*- shell-script -*- + +_oggdec() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + --help|-h|--version|-V) + return + ;; + --bits|-b) + COMPREPLY=( $( compgen -W "8 16" -- "$cur" ) ) + return + ;; + --endianness|-e|--sign|-s) + 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 diff --git a/completions/openssl b/completions/openssl index 57476848..73e56a44 100644 --- a/completions/openssl +++ b/completions/openssl @@ -50,7 +50,7 @@ _openssl() 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' + sha224 sha256 sha384 sha512 genpkey pkey pkeyparam pkeyutl' if [[ $cword -eq 1 ]]; then COMPREPLY=( $( compgen -W "$commands" -- "$cur" ) ) @@ -59,9 +59,9 @@ _openssl() case $prev in -CA|-CAfile|-CAkey|-CAserial|-cert|-certfile|-config|-content| \ -dcert|-dkey|-dhparam|-extfile|-in|-inkey|-kfile|-key|-keyout| \ - -out|-oid|-prvrify|-rand|-recip|-revoke|-sess_in|-sess_out| \ - -spkac|-sign|-signkey|-signer|-signature|-ss_cert|-untrusted| \ - -verify) + -out|-oid|-paramfile|-peerkey|-prvrify|-rand|-recip|-revoke| \ + -sess_in|-sess_out|-spkac|-sigfile|-sign|-signkey|-signer| \ + -signature|-ss_cert|-untrusted|-verify) _filedir return ;; @@ -74,7 +74,7 @@ _openssl() return ;; -inform|-outform|-keyform|-certform|-CAform|-CAkeyform|-dkeyform|\ - -dcertform) + -dcertform|-peerform) formats='DER PEM' case $command in x509) @@ -83,12 +83,15 @@ _openssl() smime) formats+=" SMIME" ;; + pkeyutl) + formats+=" ENGINE" + ;; esac COMPREPLY=( $( compgen -W "$formats" -- "$cur" ) ) return ;; -connect) - _known_hosts_real "$cur" + _known_hosts_real -- "$cur" return ;; -starttls) @@ -100,6 +103,10 @@ _openssl() -- "$cur" ) ) return ;; + -kdf) + COMPREPLY=( $( compgen -W 'TLS1-PRF HKDF' -- "$cur" ) ) + return + ;; esac if [[ "$cur" == -* ]]; then @@ -151,6 +158,10 @@ _openssl() gendsa) options='-out -des -des3 -idea -rand' ;; + genpkey) + options='-out -outform -pass -cipher -engine -paramfile + -algorithm -pkeyopt -genparam -text' + ;; genrsa) options='-out -passout -des -des3 -idea -f4 -3 -rand' ;; @@ -158,6 +169,20 @@ _openssl() options='-inform -outform -in -out -print_certs -text -noout' ;; + pkey) + options='-inform -outform -in -passin -out -passout + -traditional -cipher -text -text_pub -noout -pubin + -pubout -engine' + ;; + pkeyparam) + options='-in -out -text -noout -engine' + ;; + pkeyutl) + options='-in -out -sigfile -inkey -keyform -passin -peerkey + -peerform -pubin -certin -rev -sign -verify + -verifyrecover -encrypt -decrypt -derive -kdf -kdflen + -pkeyopt -hexdump -asn1parse -engine -engine_impl' + ;; rand) options='-out -rand -base64' ;; diff --git a/completions/perltidy b/completions/perltidy new file mode 100644 index 00000000..10c49cab --- /dev/null +++ b/completions/perltidy @@ -0,0 +1,53 @@ +# 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=*) + cur="${cur#*=}" + _filedir + return + ;; + -ole=*) + COMPREPLY=( $( compgen -W 'dos win mac unix' -- "${cur#*=}" ) ) + return + ;; + -bt=*|-pt=*|-sbt=*|-bvt=*|-pvt=*|-sbvt=*|-bvtc=*|-pvtc=*|-sbvtc=*|\ + -cti=*|-kbl=*|-vt=*) + COMPREPLY=( $( compgen -W '0 1 2' -- "${cur#*=}" ) ) + return + ;; + -vtc=*) + COMPREPLY=( $( compgen -W '0 1' -- "${cur#*=}" ) ) + return + ;; + -cab=*) + 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]' + fi +} && +complete -F _perltidy perltidy diff --git a/completions/ping b/completions/ping index 221fdd51..cc1bca7a 100644 --- a/completions/ping +++ b/completions/ping @@ -5,6 +5,8 @@ _ping() local cur prev words cword _init_completion -n = || return + local ipvx + case $prev in -c|-F|-G|-g|-h|-i|-l|-m|-P|-p|-s|-t|-V|-W|-w|-z) return @@ -47,6 +49,9 @@ _ping() COMPREPLY=( $( compgen -W 'tsonly tsandaddr' -- "$cur" ) ) return ;; + -4|-6) + ipvx=$prev + ;; esac if [[ $cur == -* ]]; then @@ -54,7 +59,8 @@ _ping() return fi - _known_hosts_real "$cur" + [[ $1 == *6 ]] && ipvx=-6 + _known_hosts_real $ipvx -- "$cur" } && complete -F _ping ping ping6 diff --git a/completions/psql b/completions/psql index 668bb9ef..86a66030 100644 --- a/completions/psql +++ b/completions/psql @@ -25,7 +25,7 @@ _createdb() case $prev in -h|--host) - _known_hosts_real "$cur" + _known_hosts_real -- "$cur" return ;; -U|--username|-O|--owner) @@ -65,7 +65,7 @@ _createuser() return ;; -h|--host) - _known_hosts_real "$cur" + _known_hosts_real -- "$cur" return ;; -U|--username) @@ -92,7 +92,7 @@ _dropdb() case $prev in -h|--host) - _known_hosts_real "$cur" + _known_hosts_real -- "$cur" return ;; -U|--username) @@ -128,7 +128,7 @@ _dropuser() return ;; -h|--host) - _known_hosts_real "$cur" + _known_hosts_real -- "$cur" return ;; -U|--username) @@ -157,7 +157,7 @@ _psql() case $prev in -h|--host) - _known_hosts_real "$cur" + _known_hosts_real -- "$cur" return ;; -U|--username) diff --git a/completions/puppet b/completions/puppet index b36b0341..59a477ed 100644 --- a/completions/puppet +++ b/completions/puppet @@ -115,7 +115,7 @@ _puppet() agent) case $prev in --certname) - _known_hosts_real "$cur" + _known_hosts_real -- "$cur" return ;; --digest) @@ -123,7 +123,7 @@ _puppet() return ;; --fqdn) - _known_hosts_real "$cur" + _known_hosts_real -- "$cur" return ;; -l|--logdest) @@ -185,7 +185,7 @@ _puppet() return ;; generate|--generate) - _known_hosts_real "$cur" + _known_hosts_real -- "$cur" return ;; clean|print|revoke|--clean|--print|--revoke) @@ -237,7 +237,7 @@ _puppet() filebucket) case $prev in -s|--server) - _known_hosts_real "$cur" + _known_hosts_real -- "$cur" return ;; -b|--bucket) @@ -261,7 +261,7 @@ _puppet() return ;; --host) - _known_hosts_real "$cur" + _known_hosts_real -- "$cur" return ;; -t|--tag) @@ -271,7 +271,7 @@ _puppet() if [[ "$cur" == -* ]]; then _puppet_subcmd_opts "$1" $subcommand else - _known_hosts_real "$cur" + _known_hosts_real -- "$cur" fi return esac diff --git a/completions/pv b/completions/pv new file mode 100644 index 00000000..28514e7c --- /dev/null +++ b/completions/pv @@ -0,0 +1,30 @@ +# pv(1) completion -*- shell-script -*- + +_pv() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -h|--help|-V|--version|-A|--last-written|-F|--format|-D|--delay-start|\ + -i|--interval|-w|--width|-H|--height|-N|--name|-L|--rate-limit|\ + -B|--buffer-size) + return + ;; + -R|--remote) + _pids + return + ;; + -P|--pidfile|-d|--watchfd) + _filedir pid + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + else + _filedir + fi +} && +complete -F _pv pv diff --git a/completions/pycodestyle b/completions/pycodestyle new file mode 100644 index 00000000..7a62ac07 --- /dev/null +++ b/completions/pycodestyle @@ -0,0 +1,34 @@ +# 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 diff --git a/completions/pylint b/completions/pylint index 0383c7e2..b1d80918 100644 --- a/completions/pylint +++ b/completions/pylint @@ -5,6 +5,8 @@ _pylint() local cur prev words cword split _init_completion -s || return + local python=python; [[ $1 == *3* ]] && python=python3 + case $prev in --version|-h|--help|--long-help|--help-msg|--init-hook|--ignore|-e|\ --enable|-d|--disable|--evaluation|--max-line-length|\ @@ -34,8 +36,8 @@ _pylint() --load-plugins|--deprecated-modules) local prefix=; [[ $cur == *,* ]] && prefix="${cur%,*}," cur="${cur##*,}" - _xfunc python _python_modules - COMPREPLY=( ${COMPREPLY[@]/#/$prefix} ) + _xfunc python _python_modules $python + [[ ${#COMPREPLY[@]} -eq 1 ]] && COMPREPLY=( ${COMPREPLY/#/$prefix} ) return ;; -f|--format) @@ -58,9 +60,9 @@ _pylint() return fi - _xfunc python _python_modules + _xfunc python _python_modules $python _filedir py } && -complete -F _pylint pylint +complete -F _pylint pylint pylint-2 pylint-3 # ex: filetype=sh diff --git a/completions/python b/completions/python index 758b44ef..f8ef6d0c 100644 --- a/completions/python +++ b/completions/python @@ -3,8 +3,8 @@ _python_modules() { COMPREPLY+=( $( compgen -W \ - "$( ${1:-python} ${BASH_SOURCE[0]%/*}/../helpers/python 2>/dev/null )" \ - -- "$cur" ) ) + "$( ${1:-python} ${BASH_SOURCE[0]%/*}/../helpers/python $cur \ + 2>/dev/null )" -- "$cur" ) ) } _python() diff --git a/completions/radvdump b/completions/radvdump new file mode 100644 index 00000000..7280a7a1 --- /dev/null +++ b/completions/radvdump @@ -0,0 +1,22 @@ +# 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 diff --git a/completions/rdesktop b/completions/rdesktop index acc43098..1ad6978d 100644 --- a/completions/rdesktop +++ b/completions/rdesktop @@ -48,7 +48,7 @@ _rdesktop() local opts=( $( _parse_help "$1" ) ) COMPREPLY=( $( compgen -W '${opts[@]%:}' -- "$cur" ) ) else - _known_hosts_real "$cur" + _known_hosts_real -- "$cur" fi } && diff --git a/completions/reportbug b/completions/reportbug index 1049d194..c13cc627 100644 --- a/completions/reportbug +++ b/completions/reportbug @@ -2,11 +2,11 @@ _reportbug() { - local cur prev words cword - _init_completion || return + local cur prev words cword split + _init_completion -s || return case $prev in - -f|--filename|-i|--include|--mta|-o|--output) + -f|--filename|-i|--include|--mta|-o|--output|-A|--attach) _filedir return ;; @@ -55,26 +55,21 @@ _reportbug() ;; esac - COMPREPLY=($( compgen -W '--help --version --attach --no-query-bts - --query-bts --bts --body --body-file --bodyfile --no-config-files - --class --configure --check-available --debug --no-check-available - --debconf --test --draftpath --editor --email --exit-prompt --filename - --from-buildd --gnupg --gpg --path --gnus --header --include - --no-check-installed --check-installed --justification --kudos --keyid - --license --list-cc --maintonly --mirror --mode --mua --mta --mutt --mh - --nmh --bugnumber --no-bug-script --no-cc-menu --output --offline - --print --paranoid --no-paranoid --pgp --proxy --http_proxy - --pseudo-header --quiet --query-only --query-source --no-query-source - --realname --report-quiet --reply-to --replyto --subject --severity - --smtphost --timeout --tls --smtpuser --smtppasswd --src --source - --type --tag --template --verify --no-verify --no-cc --package-version - --no-compress --ui --interface - 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' \ - -- "$cur" ) $( apt-cache pkgnames -- "$cur" 2> /dev/null ) ) - _filedir + $split && return + + COMPREPLY=( $( compgen -W '$( _parse_help "$1" ) + 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' -- "$cur" ) + $( apt-cache pkgnames -- "$cur" 2>/dev/null ) ) + if [[ $COMPREPLY == -*= ]]; then + compopt -o nospace + else + _filedir + fi } && complete -F _reportbug reportbug diff --git a/completions/ri b/completions/ri index 16e44664..ba4dbe51 100644 --- a/completions/ri +++ b/completions/ri @@ -90,7 +90,7 @@ _ri() 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 ) ) + 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 diff --git a/completions/rsync b/completions/rsync index d72f6324..22593577 100644 --- a/completions/rsync +++ b/completions/rsync @@ -5,8 +5,6 @@ _rsync() local cur prev words cword split _init_completion -s -n : || return - _expand || return - case $prev in --config|--password-file|--include-from|--exclude-from|--files-from|\ --log-file|--write-batch|--only-write-batch|--read-batch) @@ -34,6 +32,8 @@ _rsync() $split && return + _expand || return + case $cur in -*) COMPREPLY=( $( compgen -W '--verbose --quiet --no-motd --checksum @@ -76,7 +76,7 @@ _rsync() [[ $shell == ssh ]] && _xfunc ssh _scp_remote_files ;; *) - _known_hosts_real -c -a "$cur" + _known_hosts_real -c -a -- "$cur" _xfunc ssh _scp_local_files ;; esac diff --git a/completions/ss b/completions/ss index 63e6a458..b240c5e0 100644 --- a/completions/ss +++ b/completions/ss @@ -16,9 +16,10 @@ _ss() ;; -A|--query) local prefix=; [[ $cur == *,* ]] && prefix="${cur%,*}," - COMPREPLY=( $( compgen -P "$prefix" -W '$( "$1" --help | \ + COMPREPLY=( $( compgen -W '$( "$1" --help | \ command sed -e "s/|/ /g" -ne "s/.*QUERY := {\([^}]*\)}.*/\1/p" )' \ -- "${cur##*,}" ) ) + [[ ${#COMPREPLY[@]} -eq 1 ]] && COMPREPLY=( ${COMPREPLY/#/$prefix} ) return ;; -D|--diag|-F|--filter) diff --git a/completions/ssh b/completions/ssh index ecd50e57..ba3d4b45 100644 --- a/completions/ssh +++ b/completions/ssh @@ -43,7 +43,7 @@ _ssh_options() HostbasedAuthentication HostKeyAlgorithms HostKeyAlias HostName IdentityFile IdentitiesOnly IPQoS KbdInteractiveDevices KexAlgorithms LocalCommand LocalForward LogLevel MACs - NoHostAuthenticationForLocalhost NumberOfPasswordPrompts + NoHostAuthenticationForLocalhost NumberOfPasswordPrompts ProxyJump PasswordAuthentication PermitLocalCommand PKCS11Provider Port PreferredAuthentications Protocol ProxyCommand PubkeyAuthentication RekeyLimit RemoteForward RequestTTY RhostsRSAAuthentication @@ -86,6 +86,9 @@ _ssh_suboption() Cipher) COMPREPLY=( $( compgen -W 'blowfish des 3des' -- "$cur" ) ) ;; + ProxyJump) + _known_hosts_real -a -F "$configfile" -- "$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" ) ) @@ -159,17 +162,30 @@ _ssh() local -a config + local configfile + _ssh_configfile + _ssh_suboption_check "$1" && return + local ipvx + case $prev in -F|-i|-S) _filedir return ;; + -I) + _filedir so + return + ;; -c) _ssh_ciphers "$1" return ;; + -J) + _known_hosts_real -a -F "$configfile" -- "$cur" + return + ;; -m) _ssh_macs "$1" return @@ -198,9 +214,12 @@ _ssh() _ip_addresses return ;; - -D|-e|-I|-L|-p|-R|-W) + -D|-e|-L|-p|-R|-W) return ;; + -4|-6) + ipvx=$prev + ;; esac if [[ "$cur" == -F* ]]; then @@ -212,9 +231,7 @@ _ssh() elif [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) else - local configfile - _ssh_configfile - _known_hosts_real -a -F "$configfile" "$cur" + _known_hosts_real $ipvx -a -F "$configfile" -- "$cur" local args _count_args @@ -233,8 +250,13 @@ _sftp() local cur prev words cword _init_completion || return + local configfile + _ssh_configfile + _ssh_suboption_check && return + local ipvx + case $prev in -b|-F|-i) _filedir @@ -255,6 +277,9 @@ _sftp() -B|-D|-l|-P|-R|-s) return ;; + -4|-6) + ipvx=$prev + ;; esac if [[ "$cur" == -F* ]]; then @@ -266,9 +291,7 @@ _sftp() elif [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) else - local configfile - _ssh_configfile - _known_hosts_real -a -F "$configfile" "$cur" + _known_hosts_real $ipvx -a -F "$configfile" -- "$cur" fi } && shopt -u hostcomplete && complete -F _sftp sftp @@ -344,13 +367,16 @@ _scp() local cur prev words cword _init_completion -n : || return - local prefix + local configfile + _ssh_configfile _ssh_suboption_check && { COMPREPLY=( "${COMPREPLY[@]/%/ }" ) return } + local ipvx + case $prev in -l|-P) return @@ -374,6 +400,9 @@ _scp() compopt +o nospace return ;; + -4|-6) + ipvx=$prev + ;; esac _expand || return @@ -383,6 +412,8 @@ _scp() *:*) _scp_remote_files ; return ;; esac + local prefix + if [[ "$cur" == -F* ]]; then cur=${cur#-F} prefix=-F @@ -398,9 +429,7 @@ _scp() # not a known host, pass through ;; *) - local configfile - _ssh_configfile - _known_hosts_real -c -a -F "$configfile" "$cur" + _known_hosts_real $ipvx -c -a -F "$configfile" -- "$cur" ;; esac fi diff --git a/completions/ssh-add b/completions/ssh-add index 1885c37a..4d47c0d0 100644 --- a/completions/ssh-add +++ b/completions/ssh-add @@ -6,7 +6,11 @@ _ssh_add() _init_completion || return case $prev in - -t|-s|-e) + -t) + return + ;; + -s|-e) + _filedir so return ;; esac diff --git a/completions/ssh-copy-id b/completions/ssh-copy-id index bd8c8fe0..1e81172c 100644 --- a/completions/ssh-copy-id +++ b/completions/ssh-copy-id @@ -15,7 +15,7 @@ _ssh_copy_id() if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) else - _known_hosts_real -a "$cur" + _known_hosts_real -a -- "$cur" fi } && complete -F _ssh_copy_id ssh-copy-id diff --git a/completions/ssh-keygen b/completions/ssh-keygen index f72b9aa2..d1eafa9e 100644 --- a/completions/ssh-keygen +++ b/completions/ssh-keygen @@ -6,12 +6,20 @@ _ssh_keygen() _init_completion -n = || return case $prev in - -a|-b|-C|-D|-I|-J|-j|-M|-N|-n|-r|-P|-S|-V|-W|-z) + -a|-b|-C|-I|-J|-j|-M|-N|-n|-r|-P|-S|-V|-W|-z) + return + ;; + -E) + COMPREPLY=( $( compgen -W 'md5 sha256' -- "$cur" ) ) return ;; -F|-R) # TODO: trim this down to actual entries in known hosts files - _known_hosts_real "$cur" + _known_hosts_real -- "$cur" + return + ;; + -D) + _filedir so return ;; -f|-G|-K|-s|-T) diff --git a/completions/sshfs b/completions/sshfs index 4f6d1a1b..4afcc994 100644 --- a/completions/sshfs +++ b/completions/sshfs @@ -16,7 +16,7 @@ _sshfs() return fi - [[ "$cur" == @(*/|[.~])* ]] || _known_hosts_real -c -a "$cur" + [[ "$cur" == @(*/|[.~])* ]] || _known_hosts_real -c -a -- "$cur" _xfunc ssh _scp_local_files -d } && diff --git a/completions/sshmitm b/completions/sshmitm index f7332201..192835c0 100644 --- a/completions/sshmitm +++ b/completions/sshmitm @@ -8,7 +8,7 @@ _sshmitm() if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) else - _known_hosts_real "$cur" + _known_hosts_real -- "$cur" fi } && diff --git a/completions/tar b/completions/tar index 5a854edd..2886f745 100644 --- a/completions/tar +++ b/completions/tar @@ -433,9 +433,9 @@ __tar_cleanup_prev() __tar_detect_ext() { - local tars='@(@(tar|gem|spkg)?(.@(Z|[bgx]z|bz2|lz?(ma)))|t@([abglx]z|b?(z)2))' + local tars='@(@(tar|gem|spkg)?(.@(Z|[bgx]z|bz2|lz?(ma|o)))|t@([abglx]z|b?(z)2))' ext="$tars" - regex='\(\(tar\|gem\|spkg\)\(\.\(Z\|[bgx]z\|bz2\|lz\(ma\)\?\)\)\?\|t\([abglx]z\|bz\?2\)\)' + regex='\(\(tar\|gem\|spkg\)\(\.\(Z\|[bgx]z\|bz2\|lz\(ma\|o\)\?\)\)\?\|t\([abglx]z\|bz\?2\)\)' case "$tar_mode_arg" in --*) @@ -453,7 +453,7 @@ __tar_detect_ext() ;; +([^ZzJjy])f) ext="$tars" - regex='\(\(tar\|gem\|spkg\)\(\.\(Z\|[bgx]z\|bz2\|lz\(ma\)\?\)\)\?\|t\([abglx]z\|bz\?2\)\)' + regex='\(\(tar\|gem\|spkg\)\(\.\(Z\|[bgx]z\|bz2\|lz\(ma\|o\)\?\)\)\?\|t\([abglx]z\|bz\?2\)\)' ;; *[Zz]*f) ext='@(@(t?(ar.)|gem.|spkg.)@(gz|Z)|taz)' diff --git a/completions/tox b/completions/tox new file mode 100644 index 00000000..5812fcbf --- /dev/null +++ b/completions/tox @@ -0,0 +1,34 @@ +# tox completion -*- shell-script -*- + +_tox() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -h|--help|--version|-n|--num|-i|--index-url|--hashseed|--force-dep) + return + ;; + -c) + _filedir ini + return + ;; + --installpkg|--result-json|--workdir) + _filedir + return + ;; + -e) + local envs=$( "$1" --listenvs-all 2>/dev/null ) + local prefix=""; [[ $cur == *,* ]] && prefix="${cur%,*}," + COMPREPLY=( $( compgen -W "$envs ALL" -- "${cur##*,}" ) ) + [[ ${#COMPREPLY[@]} -eq 1 ]] && COMPREPLY=( ${COMPREPLY/#/$prefix} ) + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + return + fi +} && +complete -F _tox tox diff --git a/completions/tracepath b/completions/tracepath index 06455cb5..bd2f3ea3 100644 --- a/completions/tracepath +++ b/completions/tracepath @@ -16,7 +16,9 @@ _tracepath() return fi - _known_hosts_real "$cur" + local ipvx + [[ $1 == *6 ]] && ipvx=-6 + _known_hosts_real $ipvx -- "$cur" } && complete -F _tracepath tracepath tracepath6 diff --git a/completions/tshark b/completions/tshark index 34d93a0d..bd795c24 100644 --- a/completions/tshark +++ b/completions/tshark @@ -51,9 +51,9 @@ _tshark() ;; -O) local prefix=; [[ $cur == *,* ]] && prefix="${cur%,*}," - COMPREPLY=( $( compgen -P "$prefix" -W \ - "$( "$1" -G protocols 2>&1 | cut -f 3 )" \ + COMPREPLY=( $( compgen -W "$( "$1" -G protocols 2>&1 | cut -f 3 )" \ -- "${cur##*,}" ) ) + [[ ${#COMPREPLY[@]} -eq 1 ]] && COMPREPLY=( ${COMPREPLY/#/$prefix} ) return ;; -T) diff --git a/completions/uscan b/completions/uscan index fc05d2e8..aafc1dfd 100644 --- a/completions/uscan +++ b/completions/uscan @@ -2,7 +2,7 @@ _uscan() { - local cur prev split + local cur prev words cword split _init_completion -s || return case $prev in diff --git a/completions/useradd b/completions/useradd index 9ed2f9f6..fa8e58cc 100644 --- a/completions/useradd +++ b/completions/useradd @@ -25,7 +25,8 @@ _useradd() ;; -G|--groups) local prefix=; [[ $cur == *,* ]] && prefix="${cur%,*}," - COMPREPLY=( $( compgen -P "$prefix" -g -- "${cur##*,}" ) ) + COMPREPLY=( $( compgen -g -- "${cur##*,}" ) ) + [[ ${#COMPREPLY[@]} -eq 1 ]] && COMPREPLY=( ${COMPREPLY/#/$prefix} ) return ;; -s|--shell) diff --git a/completions/usermod b/completions/usermod index 03cc89fe..9d478c3a 100644 --- a/completions/usermod +++ b/completions/usermod @@ -21,7 +21,8 @@ _usermod() ;; -G|--groups) local prefix=; [[ $cur == *,* ]] && prefix="${cur%,*}," - COMPREPLY=( $( compgen -P "$prefix" -g -- "${cur##*,}" ) ) + COMPREPLY=( $( compgen -g -- "${cur##*,}" ) ) + [[ ${#COMPREPLY[@]} -eq 1 ]] && COMPREPLY=( ${COMPREPLY/#/$prefix} ) return ;; -R|--root) diff --git a/completions/vncviewer b/completions/vncviewer index 4a3f2abd..9b307331 100644 --- a/completions/vncviewer +++ b/completions/vncviewer @@ -32,7 +32,7 @@ _tightvncviewer() return ;; -via) - _known_hosts_real "$cur" + _known_hosts_real -- "$cur" return ;; esac @@ -44,7 +44,7 @@ _tightvncviewer() -owncmap -truecolour -truecolor -depth -compresslevel -quality -nojpeg -nocursorshape -x11cursor' -- "$cur" ) ) else - _known_hosts_real "$cur" + _known_hosts_real -- "$cur" fi } && complete -F _tightvncviewer tightvncviewer @@ -72,7 +72,7 @@ _xvnc4viewer() ;; # -via -[vV][iI][aA]) - _known_hosts_real "$cur" + _known_hosts_real -- "$cur" return ;; esac @@ -87,13 +87,14 @@ _xvnc4viewer() WMDecorationWidth ZlibLevel ) [[ "$cur" == --* ]] && dash=-- || dash=- - local option reset=$( shopt -p nocasematch ); shopt -s nocasematch + 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" + _known_hosts_real -- "$cur" fi } && complete -F _xvnc4viewer xvnc4viewer diff --git a/completions/vpnc b/completions/vpnc index 4e1fa81e..b7b8c14a 100644 --- a/completions/vpnc +++ b/completions/vpnc @@ -8,11 +8,11 @@ _vpnc() case $prev in --help|--long-help|--version|--id|--username|--domain|--ifname|\ --application-version|--local-addr|--local-port|--udp-port|--dpd-idle|\ - --target-network) + --target-network|--ifmtu) return ;; --gateway) - _known_hosts_real "$cur" + _known_hosts_real -- "$cur" return ;; --vendor) @@ -36,6 +36,10 @@ _vpnc() 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 @@ -48,13 +52,29 @@ _vpnc() _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 - COMPREPLY=( $( compgen -W '$( command ls /etc/vpnc )' -- "$cur" ) ) + # 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 diff --git a/completions/webmitm b/completions/webmitm index a8484ca1..308f2281 100644 --- a/completions/webmitm +++ b/completions/webmitm @@ -8,7 +8,7 @@ _webmitm() if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) else - _known_hosts_real "$cur" + _known_hosts_real -- "$cur" fi } && diff --git a/completions/wget b/completions/wget index b1878fdb..95011bef 100644 --- a/completions/wget +++ b/completions/wget @@ -18,7 +18,7 @@ _wget() return ;; -D|--domains|--exclude-domains) - _known_hosts_real "$cur" + _known_hosts_real -- "$cur" return ;; --restrict-file-names) diff --git a/completions/wol b/completions/wol index 50653385..1ce25b05 100644 --- a/completions/wol +++ b/completions/wol @@ -16,7 +16,7 @@ _wol() 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" + _known_hosts_real -- "$cur" return ;; -f|--file) diff --git a/completions/wsimport b/completions/wsimport index d53a17fb..a7f591e7 100644 --- a/completions/wsimport +++ b/completions/wsimport @@ -32,7 +32,7 @@ _wsimport() esac if [[ $cur == -httpproxy:* ]]; then - _known_hosts_real "${cur#-httpproxy:}" + _known_hosts_real -- "${cur#-httpproxy:}" return elif [[ $cur == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" -help )' \ diff --git a/completions/xdg-mime b/completions/xdg-mime new file mode 100644 index 00000000..92d5b838 --- /dev/null +++ b/completions/xdg-mime @@ -0,0 +1,71 @@ +# 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 -eq 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 -eq 2 ]]; then + COMPREPLY=( $( compgen -W 'filetype default' -- "$cur" ) ) + return + fi + case ${words[2]} in # TODO and $args -eq 3 (takes only one arg!) + filetype) _filedir ;; + default) _xdg_mime_mimetype ;; + esac + ;; + default) + if [[ $args -eq 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 diff --git a/completions/xdg-settings b/completions/xdg-settings new file mode 100644 index 00000000..15f040d4 --- /dev/null +++ b/completions/xdg-settings @@ -0,0 +1,29 @@ +# 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 | + command sed -e "s/[{|]/\n/g" | _parse_help - )' -- "$cur" ) ) + return + fi + + local args + _count_args + if [[ $args -eq 1 ]]; then + COMPREPLY=( $( compgen -W "get check set" -- "$cur" ) ) + elif [[ $args -eq 2 ]]; then + COMPREPLY=( $( compgen -W \ + '$( "$1" --list | awk "!/^Known/ { print \$1 }" )' -- "$cur" ) ) + fi +} && +complete -F _xdg_settings xdg-settings diff --git a/completions/xgamma b/completions/xgamma index eda46d62..7b9d43cc 100644 --- a/completions/xgamma +++ b/completions/xgamma @@ -37,7 +37,7 @@ _xgamma() "${cur##*.}" ) ) elif [[ "$cur" != *:* ]]; then # complete hostnames - _known_hosts_real -c "$cur" + _known_hosts_real -c -- "$cur" if [[ ! $cur ]]; then COMPREPLY+=( : ) fi diff --git a/completions/xhost b/completions/xhost index 8f605a90..53b3695b 100644 --- a/completions/xhost +++ b/completions/xhost @@ -6,9 +6,9 @@ _xhost () _init_completion || return case $cur in - +*) _known_hosts_real -p+ "${cur:1}" ;; - -*) _known_hosts_real -p- "${cur:1}" ;; - *) _known_hosts_real "$cur" ;; + +*) _known_hosts_real -p+ -- "${cur:1}" ;; + -*) _known_hosts_real -p- -- "${cur:1}" ;; + *) _known_hosts_real -- "$cur" ;; esac } && complete -F _xhost xhost diff --git a/completions/xm b/completions/xm index 93852f61..c720fae1 100644 --- a/completions/xm +++ b/completions/xm @@ -19,7 +19,7 @@ _xm() # TODO: _split_longopt - local command options + 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 @@ -94,7 +94,7 @@ _xm() _xen_domain_names ;; 3) - _known_hosts_real "$cur" + _known_hosts_real -- "$cur" ;; esac ;; diff --git a/completions/xz b/completions/xz index 53e6b398..7499ffb5 100644 --- a/completions/xz +++ b/completions/xz @@ -40,8 +40,6 @@ _xz() $split && return - _expand || return - if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" --long-help ) {-1..-9}' \ -- "$cur" ) ) @@ -49,6 +47,8 @@ _xz() return fi + _tilde "$cur" || return + local IFS=$'\n' compopt -o filenames COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \ diff --git a/completions/zopfli b/completions/zopfli index 23da6dbf..ee2c890c 100644 --- a/completions/zopfli +++ b/completions/zopfli @@ -18,10 +18,9 @@ _zopfli() return fi - local IFS=$'\n' xspec="*.@(gz|t[ag]z)" - - _expand || return + _tilde "$cur" || return + local IFS=$'\n' xspec="*.@(gz|t[ag]z)" compopt -o filenames COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \ $( compgen -d -- "$cur" ) ) |