diff options
author | Ville Skyttä <ville.skytta@iki.fi> | 2011-10-25 20:18:42 +0300 |
---|---|---|
committer | Ville Skyttä <ville.skytta@iki.fi> | 2011-10-25 20:18:42 +0300 |
commit | b377dc5de84913b69efa325590e9d0bb97d02128 (patch) | |
tree | a2ba252228eabd2be018fdb8d4f8b1ad225f9825 | |
parent | c922626d4b9b78d266c8336c702b4c5e9a0325d4 (diff) | |
parent | 3b029892f6f9db3b7210a7f66d636be3e5ec5fa2 (diff) | |
download | bash-completion-b377dc5de84913b69efa325590e9d0bb97d02128.tar.gz |
Merge branch 'dynamic-loading'
349 files changed, 5407 insertions, 4208 deletions
@@ -70,24 +70,11 @@ believed to be a bug in bash. II. -The have() function is used to conserve memory by only installing -completion functions for those programs that are actually present on -your system. The current method of determining whether or not a given -binary is present is whether or not it can be found along a certain -path of directories. The path that is currently searched is: - - $PATH:/sbin:/usr/sbin:/usr/local/sbin - -where $PATH is your user path at the time the bash completion file is -sourced. - -III. - Many of the completion functions assume GNU versions of the various text utilities that they call (e.g. grep, sed and awk). Your mileage may vary. -IV. +III. If you are seeing 'unbound variable' warnings from bash when hitting <Tab>, this is because you have either 'set -u' or 'set -o nounset' @@ -127,10 +114,17 @@ Q. I author/maintain package X and would like to maintain my own completion code for this package. Where should I put it to be sure that interactive bash shells will find it and source it? - Put it in the directory pointed to by $BASH_COMPLETION_COMPAT_DIR, which - is defined at the beginning of the main completion script. Any - scripts placed in this directory will be sourced by interactive - bash shells. Usually, this is /etc/bash_completion.d. + 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. Q. I use CVS in combination with passwordless ssh access to my remote repository. How can I have the cvs command complete on remotely @@ -1,33 +0,0 @@ -bash completion needs to be rewritten from the ground up. ---------------------------------------------------------- - -bash completion really needs to be rewritten from the ground up, using all of -the features available in bash 4.1+ and without regard for compatibility with -earlier versions. - -At that time, it should be split into multiple files for easier source -management. Whether or not it is actually installed on the destination -computer as separate files is a matter for future debate. - -If it were installed as tens or even hundreds of files, each of which had to -be opened to decide whether it should be sourced in its entirety, that could -prove very expensive on some systems. - -Alternatively, a master file could decide which of the individual completion -files should be sourced. In that way, we wouldn't need to open extra files -just to ascertain that the commands for those functions aren't on the system, -anyway. - -A further alternative is that a build process be created, which would -concatenate the various files into a single completion file, similar to what -we have now. This option is my least favourite, because a system with a lot of -packages installed currently has to deal with sourcing over 200 kB of bash -code for each invocation of an interactive shell. - -An even better alternative would be if bash supported dynamic loading of shell -functions (in the manner of zsh), but I don't believe there are any plans to -add this feature. - --- -Ian Macdonald -Amsterdam, March 2006 diff --git a/bash_completion b/bash_completion index cdd2fe96..1656a714 100644 --- a/bash_completion +++ b/bash_completion @@ -46,17 +46,6 @@ readonly BASH_COMPLETION_COMPAT_DIR # _blacklist_glob='@(acroread.sh)' -# Set a couple of useful vars -# -UNAME=$( uname -s ) -# strip OS type and version under Cygwin (e.g. CYGWIN_NT-5.1 => Cygwin) -UNAME=${UNAME/CYGWIN_*/Cygwin} - -case ${UNAME} in - Linux|GNU|GNU/*) USERLAND=GNU ;; - *) USERLAND=${UNAME} ;; -esac - # Turn on extended globbing and programmable completion shopt -s extglob progcomp @@ -103,16 +92,31 @@ complete -b builtin # start of section containing completion functions called by other functions +# Check if we're running on the given userland +# @param $1 userland to check for +_userland() +{ + local userland=$( uname -s ) + [[ $userland == @(Linux|GNU/*) ]] && userland=GNU + [[ $userland == $1 ]] +} + # This function checks whether we have a given program on the system. -# No need for bulky functions in memory if we don't. # -have() +_have() { - unset -v have # Completions for system administrator commands are installed as well in # case completion is attempted via `sudo command ...'. - PATH=$PATH:/usr/sbin:/sbin:/usr/local/sbin type $1 &>/dev/null && - have="yes" + PATH=$PATH:/usr/sbin:/sbin:/usr/local/sbin type $1 &>/dev/null +} + +# Backwards compatibility for compat completions that use have(). +# @deprecated should no longer be used; generally not needed with dynamically +# loaded completions, and _have is suitable for runtime use. +have() +{ + unset -v have + _have $1 && have=yes } # This function checks whether a given readline variable @@ -601,11 +605,11 @@ _split_longopt() return 1 } -# Initialize completion and deal with redirections: do file completion where -# appropriate, and adjust prev, words, and cword as if no redirections exist -# so that completions do not need to deal with them. Before calling this -# function, make sure cur, prev, words, and cword are local, ditto split if -# you use -s. +# Initialize completion and deal with various general things: do file +# and variable completion where appropriate, and adjust prev, words, +# and cword as if no redirections exist so that completions do not +# need to deal with them. Before calling this function, make sure +# cur, prev, words, and cword are local, ditto split if you use -s. # # Options: # -n EXCLUDE Passed to _get_comp_words_by_ref -n with redirection chars @@ -640,6 +644,14 @@ _init_completion() local redir="@(?([0-9])<|?([0-9&])>?(>)|>&)" _get_comp_words_by_ref -n "$exclude<>&" cur prev words cword + # Complete variable names. + if [[ $cur =~ ^(\$\{?)([A-Za-z0-9_]*)$ ]]; then + [[ $cur == *{* ]] && local suffix=} || local suffix= + COMPREPLY=( $( compgen -P ${BASH_REMATCH[1]} -S "$suffix" -v -- \ + "${BASH_REMATCH[2]}" ) ) + return 1 + fi + # Complete on files if current is a redirect possibly followed by a # filename, e.g. ">foo", or previous is a "bare" redirect, e.g. ">". if [[ $cur == $redir* || $prev == $redir ]]; then @@ -954,7 +966,7 @@ _expand() # This function completes on process IDs. # AIX and Solaris ps prefers X/Open syntax. -[[ $UNAME == @(SunOS|AIX) ]] && +[[ $OSTYPE == *@(solaris|aix)* ]] && _pids() { COMPREPLY=( $( compgen -W '$( command ps -efo pid | sed 1d )' -- "$cur" )) @@ -966,7 +978,7 @@ _pids() # This function completes on process group IDs. # AIX and SunOS prefer X/Open, all else should be BSD. -[[ $UNAME == @(SunOS|AIX) ]] && +[[ $OSTYPE == *@(solaris|aix)* ]] && _pgids() { COMPREPLY=( $( compgen -W '$( command ps -efo pgid | sed 1d )' -- "$cur" )) @@ -978,7 +990,7 @@ _pgids() # This function completes on process names. # AIX and SunOS prefer X/Open, all else should be BSD. -[[ $UNAME == @(SunOS|AIX) ]] && +[[ $OSTYPE == *@(solaris|aix)* ]] && _pnames() { COMPREPLY=( $( compgen -X '<defunct>' -W '$( command ps -efo comm | \ @@ -1272,9 +1284,9 @@ _terms() } # a little help for FreeBSD ports users -[ $UNAME = FreeBSD ] && complete -W 'index search fetch fetch-list extract \ - patch configure build install reinstall deinstall clean clean-depends \ - kernel buildworld' make +[[ $OSTYPE == *freebsd* ]] && complete -W 'index search fetch fetch-list + extract patch configure build install reinstall deinstall clean + clean-depends kernel buildworld' make # This function provides simple user@host completion # @@ -1691,15 +1703,12 @@ _longopt() fi } # makeinfo and texi2dvi are defined elsewhere. -for i in a2ps awk base64 bash bc bison cat colordiff cp csplit \ +complete -F _longopt a2ps awk base64 bash bc bison cat colordiff cp csplit \ cut date df diff dir du enscript env expand fmt fold gperf \ grep grub head indent irb ld ldd less ln ls m4 md5sum mkdir mkfifo mknod \ mv netstat nl nm objcopy objdump od paste patch pr ptx readelf rm rmdir \ sed seq sha{,1,224,256,384,512}sum shar sort split strip sum tac tail tee \ - texindex touch tr uname unexpand uniq units vdir wc wget who; do - have $i && complete -F _longopt $i -done -unset i + texindex touch tr uname unexpand uniq units vdir wc wget who declare -A _xspecs _filedir_xspec() @@ -1810,7 +1819,52 @@ _install_xspec '!@(*.@(ks|jks|jceks|p12|pfx|bks|ubr|gkr|cer|crt|cert|p7b|pkipath _install_xspec '!*.@(mp[234c]|og[ag]|@(fl|a)ac|m4[abp]|spx|tta|w?(a)v|wma|aif?(f)|asf|ape)' kid3 kid3-qt unset -f _install_xspec -# source completion directory definitions +# Minimal completion to use as fallback in _completion_loader. +_minimal() +{ + local cur prev words cword split + _init_completion -s || return + $split && return + _filedir +} + +# set up dynamic completion loading +_completion_loader() +{ + local compdir=./completions + [[ $BASH_SOURCE == */* ]] && compdir="${BASH_SOURCE%/*}/completions" + + # Special case for init.d scripts. + if [[ $1 == /etc?(/rc.d)/init.d/* ]]; then + . "$compdir/service" &>/dev/null && return 124 || return 1 + fi + + # Try basename. + . "$compdir/${1##*/}" &>/dev/null && return 124 + + # Need to define *something*, otherwise there will be no completion at all. + complete -F _minimal "$1" && return 124 +} && +complete -D -F _completion_loader + +# Function for loading and calling functions from dynamically loaded +# completion files that may not have been sourced yet. +# @param $1 completion file to load function from in case it is missing +# @param $2... function and its arguments +_xfunc() +{ + set -- "$@" + local srcfile=$1 + shift + declare -F $1 &>/dev/null || { + local compdir=./completions + [[ $BASH_SOURCE == */* ]] && compdir="${BASH_SOURCE%/*}/completions" + . "$compdir/$srcfile" + } + "$@" +} + +# source compat completion directory definitions if [[ -d $BASH_COMPLETION_COMPAT_DIR && -r $BASH_COMPLETION_COMPAT_DIR && \ -x $BASH_COMPLETION_COMPAT_DIR ]]; then for i in $(LC_ALL=C command ls "$BASH_COMPLETION_COMPAT_DIR"); do @@ -1819,22 +1873,13 @@ if [[ -d $BASH_COMPLETION_COMPAT_DIR && -r $BASH_COMPLETION_COMPAT_DIR && \ && -f $i && -r $i ]] && . "$i" done fi -if [[ "${BASH_SOURCE[0]%/*}/completions" != $BASH_COMPLETION_COMPAT_DIR && \ - -d "${BASH_SOURCE[0]%/*}/completions" && -r "${BASH_SOURCE[0]%/*}/completions" && \ - -x "${BASH_SOURCE[0]%/*}/completions" ]]; then - for i in $(LC_ALL=C command ls "${BASH_SOURCE[0]%/*}/completions"); do - i="${BASH_SOURCE[0]%/*}/completions/$i" - [[ ${i##*/} != @($_backup_glob|Makefile*|$_blacklist_glob) \ - && -f $i && -r $i ]] && . "$i" - done -fi unset i # source user completion file [[ ${BASH_SOURCE[0]} != ~/.bash_completion && -r ~/.bash_completion ]] \ && . ~/.bash_completion unset -f have -unset UNAME USERLAND have +unset have set $BASH_COMPLETION_ORIGINAL_V_VALUE unset BASH_COMPLETION_ORIGINAL_V_VALUE diff --git a/completions/.gitignore b/completions/.gitignore new file mode 100644 index 00000000..944fc3ae --- /dev/null +++ b/completions/.gitignore @@ -0,0 +1,176 @@ +a2x +aclocal-1.11 +alpine +alternatives +animate +apropos +asciidoc.py +autoheader +automake-1.11 +autossh +autoupdate +btdownloadcurses.py +btdownloadgui.py +c++ +cc +cdrecord +ci +ciptool +civclient +civserver +co +compare +compgen +composite +conjure +cowthink +createdb +dcop +declare +dfutool +display +dpkg-deb +dpkg-reconfigure +dropdb +edquota +filebucket +freeciv-sdl +freeciv-xaw +g++ +g4 +g77 +gcj +gkrellm2 +gmake +gmplayer +gnumake +gpc +hciattach +hciconfig +host +hping +hping3 +identify +ifdown +ifstatus +import +javac +javadoc +kplayer +l2ping +lbzip2 +ldapadd +ldapcompare +ldapdelete +ldapmodify +ldapmodrdn +ldappasswd +ldapwhoami +lintian-info +lvchange +lvcreate +lvdisplay +lvextend +lvmdiskscan +lvreduce +lvremove +lvrename +lvresize +lvs +lvscan +mailsnarf +mdecrypt +mencoder +mkisofs +modinfo +modprobe +mogrify +montage +mplayer2 +msgsnarf +muttng +ncal +pbzip2 +pccardctl +perldoc +phing +pidof +pigz +pinfo +ping6 +pkg_deinstall +pkg_info +pkill +pm-suspend +pm-suspend-hybrid +pmake +postalias +puppetca +puppetd +puppetdoc +puppetmasterd +puppetqd +puppetrun +pvchange +pvcreate +pvdisplay +pvmove +pvremove +pvs +pvscan +pxz +python2 +python3 +quotacheck +quotaoff +quotaon +ralsh +rcsdiff +rdict +repquota +rfcomm +rlog +rpm2targz +rpm2txz +rpmbuild +rpmbuild-md5 +sbcl-mt +scp +sdptool +setquota +sftp +slogin +smbcacls +smbcquotas +smbget +smbpasswd +smbtar +smbtree +spovray +stream +tightvncviewer +tracepath6 +typeset +umount +vgcfgbackup +vgcfgrestore +vgchange +vgck +vgconvert +vgdisplay +vgexport +vgextend +vgimport +vgmerge +vgmknodes +vgreduce +vgremove +vgrename +vgs +vgscan +vgsplit +vigr +whatis +xpovray +xvnc4viewer +ypcat diff --git a/completions/Makefile.am b/completions/Makefile.am index 4e2547f2..3f8b3fcd 100644 --- a/completions/Makefile.am +++ b/completions/Makefile.am @@ -1,38 +1,57 @@ bashcompdir = $(pkgdatadir)/completions bashcomp_DATA = abook \ + aclocal \ + add_members \ + alias \ ant \ apache2ctl \ - apt \ apt-build \ + apt-cache \ + apt-get \ aptitude \ + arch \ + arping \ + arpspoof \ asciidoc \ aspell \ autoconf \ automake \ + autoreconf \ autorpm \ - bash-builtins \ - bind-utils \ - bitkeeper \ - bittorrent \ - bluez \ + autoscan \ + badblocks \ + bk \ brctl \ + btdownloadheadless.py \ bzip2 \ cal \ + cancel \ cardctl \ - cfengine \ + cfagent \ + cfrun \ + chage \ + change_pw \ + check_db \ + check_perms \ + chgrp \ chkconfig \ + chown \ + chpasswd \ chrpath \ chsh \ cksfv \ + cleanarch \ clisp \ + clone_member \ + complete \ + config_list \ configure \ - coreutils \ + convert \ cowsay \ cpan2dist \ cpio \ cppcheck \ crontab \ - cups \ curl \ cryptsetup \ cvs \ @@ -40,119 +59,197 @@ bashcomp_DATA = abook \ dd \ dhclient \ dict \ + dmesg \ dot \ dpkg \ + dpkg-source \ dselect \ dsniff \ - dvd+rw-tools \ - e2fsprogs \ + dumpdb \ + dumpe2fs \ + e2freefrag \ + e2label \ + ether-wake \ evince \ + explodepkg \ + export \ + faillog \ + fbgs \ fbi \ feh \ file \ - findutils \ - freeciv \ - freerdp \ - fuse \ + filefrag \ + filesnarf \ + find \ + find_member \ + freeciv-gtk2 \ + freeciv-server \ + function \ + fusermount \ gcc \ gcl \ gdb \ + genaliases \ + gendiff \ genisoimage \ getent \ gkrellm \ gnatmake \ gnome-mplayer \ + gpasswd \ gpg \ gpg2 \ gprof \ + groupadd \ + groupdel \ + groupmems \ + groupmod \ + growisofs \ + grpck \ gzip \ + hcitool \ hddtemp \ - heimdal \ + hid2hci \ hping2 \ htpasswd \ iconv \ idn \ iftop \ - ifupdown \ - imagemagick \ + ifup \ info \ + inject \ + insmod \ + installpkg \ + invoke-rc.d \ + ionice \ + ip \ iptables \ ipmitool \ - iproute2 \ ipsec \ - iputils \ ipv6calc \ + iscsiadm \ isql \ + iwconfig \ + iwlist \ + iwpriv \ + iwspy \ jar \ + jarsigner \ java \ + javaws \ + jps \ k3b \ kcov \ + kill \ + killall \ kldload \ + kldunload \ + ktutil \ larch \ + lastlog \ + ldapsearch \ ldapvi \ lftp \ + lftpget \ lilo \ links \ lintian \ lisp \ + list_admins \ + list_lists \ + list_members \ + list_owners \ + look \ + lpq \ + lpr \ lrzip \ lsof \ lvm \ lzma \ lzop \ - mailman \ + macof \ + mailmanctl \ make \ + makepkg \ man \ mc \ mcrypt \ mdadm \ + mdtool \ medusa \ + mii-diag \ + mii-tool \ minicom \ mkinitrd \ - module-init-tools \ + mktemp \ + mmsitepass \ monodevelop \ mount \ mplayer \ msynctool \ mtx \ - munin-node \ + munindoc \ + munin-node-configure \ + munin-run \ + munin-update \ mutt \ mysql \ mysqladmin \ ncftp \ - net-tools \ + newgrp \ + newlist \ + newusers \ nmap \ + nslookup \ ntpdate \ - openldap \ openssl \ - open-iscsi \ p4 \ + pack200 \ + passwd \ perl \ + pgrep \ pine \ + ping \ pkg-config \ - pkg_install \ - pkgtools \ - pm-utils \ + pkg_delete \ + pkgtool \ + pm-hibernate \ + pm-is-supported \ + pm-powersave \ + portinstall \ portupgrade \ + postcat \ + postconf \ postfix \ - postgresql \ + postmap \ + postsuper \ povray \ prelink \ - procps \ protoc \ + psql \ puppet \ + pwck \ + pwdx \ pwgen \ python \ qdbus \ qemu \ - quota-tools \ + qrunner \ + querybts \ + quota \ rcs \ rdesktop \ + remove_members \ + removepkg \ + renice \ reptyr \ reportbug \ resolvconf \ rfkill \ ri \ + rmlist \ + rmmod \ + route \ rpcdebug \ rpm \ rpm2tgz \ @@ -160,39 +257,57 @@ bashcomp_DATA = abook \ rrdtool \ rsync \ rtcwake \ - samba \ sbcl \ sbopkg \ screen \ service \ sh \ - shadow \ sitecopy \ slackpkg \ - slapt \ + slapt-get \ + slapt-src \ smartctl \ + smbclient \ snownews \ sqlite3 \ ssh \ + ssh-copy-id \ sshfs \ + sshmitm \ + sshow \ strace \ svk \ + sync_members \ sysbench \ sysctl \ - sysv-rc \ tar \ tcpdump \ + tcpkill \ + tcpnice \ + tracepath \ + tune2fs \ unace \ + unpack200 \ unrar \ + unshunt \ update-alternatives \ - util-linux \ + update-rc.d \ + upgradepkg \ + urlsnarf \ + useradd \ + userdel \ + usermod \ + vipw \ vncviewer \ vpnc \ - wireless-tools \ + watch \ + webmitm \ + withlist \ wodim \ wol \ wtf \ wvdial \ + xfreerdp \ xgamma \ xhost \ xm \ @@ -204,8 +319,473 @@ bashcomp_DATA = abook \ xrdb \ xsltproc \ xz \ - yp-tools \ + xzdec \ + ypmatch \ yum-arch EXTRA_DIST = $(bashcomp_DATA) \ _mock _modules _subversion _yum _yum-utils + +CLEANFILES = \ + a2x \ + aclocal-1.11 \ + alpine \ + alternatives \ + animate \ + apropos \ + asciidoc.py \ + autoheader \ + automake-1.11 \ + autossh \ + autoupdate \ + btdownloadcurses.py \ + btdownloadgui.py \ + c++ \ + cc \ + cdrecord \ + ci \ + ciptool \ + civclient \ + civserver \ + co \ + compare \ + compgen \ + composite \ + conjure \ + cowthink \ + createdb \ + dcop \ + declare \ + dfutool \ + display \ + dpkg-deb \ + dpkg-reconfigure \ + dropdb \ + edquota \ + filebucket \ + freeciv-sdl \ + freeciv-xaw \ + g++ \ + g4 \ + g77 \ + gcj \ + gkrellm2 \ + gmake \ + gmplayer \ + gnumake \ + gpc \ + hciattach \ + hciconfig \ + host \ + hping \ + hping3 \ + identify \ + ifdown \ + ifstatus \ + import \ + javac \ + javadoc \ + kplayer \ + l2ping \ + lbzip2 \ + ldapadd \ + ldapcompare \ + ldapdelete \ + ldapmodify \ + ldapmodrdn \ + ldappasswd \ + ldapwhoami \ + lintian-info \ + lvchange \ + lvcreate \ + lvdisplay \ + lvextend \ + lvmdiskscan \ + lvreduce \ + lvremove \ + lvrename \ + lvresize \ + lvs \ + lvscan \ + mailsnarf \ + mdecrypt \ + mencoder \ + mkisofs \ + modinfo \ + modprobe \ + mogrify \ + montage \ + mplayer2 \ + msgsnarf \ + muttng \ + ncal \ + pbzip2 \ + pccardctl \ + perldoc \ + phing \ + pidof \ + pigz \ + pinfo \ + ping6 \ + pkg_deinstall \ + pkg_info \ + pkill \ + pm-suspend \ + pm-suspend-hybrid \ + pmake \ + postalias \ + puppetca \ + puppetd \ + puppetdoc \ + puppetmasterd \ + puppetqd \ + puppetrun \ + pvchange \ + pvcreate \ + pvdisplay \ + pvmove \ + pvremove \ + pvs \ + pvscan \ + pxz \ + python2 \ + python3 \ + quotacheck \ + quotaoff \ + quotaon \ + ralsh \ + rcsdiff \ + rdict \ + repquota \ + rfcomm \ + rlog \ + rpm2targz \ + rpm2txz \ + rpmbuild \ + rpmbuild-md5 \ + sbcl-mt \ + scp \ + sdptool \ + setquota \ + sftp \ + slogin \ + smbcacls \ + smbcquotas \ + smbget \ + smbpasswd \ + smbtar \ + smbtree \ + spovray \ + stream \ + tightvncviewer \ + tracepath6 \ + typeset \ + umount \ + vgcfgbackup \ + vgcfgrestore \ + vgchange \ + vgck \ + vgconvert \ + vgdisplay \ + vgexport \ + vgextend \ + vgimport \ + vgmerge \ + vgmknodes \ + vgreduce \ + vgremove \ + vgrename \ + vgs \ + vgscan \ + vgsplit \ + vigr \ + whatis \ + xpovray \ + xvnc4viewer \ + ypcat + +symlinks: + for file in aclocal-1.11 ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) aclocal $(targetdir)/$$file ; \ + done + for file in phing ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) ant $(targetdir)/$$file ; \ + done + for file in a2x asciidoc.py ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) asciidoc $(targetdir)/$$file ; \ + done + for file in automake-1.11 ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) automake $(targetdir)/$$file ; \ + done + for file in autoheader ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) autoreconf $(targetdir)/$$file ; \ + done + for file in autoupdate ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) autoscan $(targetdir)/$$file ; \ + done + for file in btdownloadcurses.py btdownloadgui.py ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) btdownloadheadless.py $(targetdir)/$$file ; \ + done + for file in lbzip2 pbzip2 ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) bzip2 $(targetdir)/$$file ; \ + done + for file in ncal ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) cal $(targetdir)/$$file ; \ + done + for file in pccardctl ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) cardctl $(targetdir)/$$file ; \ + done + for file in compgen ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) complete $(targetdir)/$$file ; \ + done + for file in mogrify display animate identify montage composite \ + compare conjure import stream ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) convert $(targetdir)/$$file ; \ + done + for file in cowthink ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) cowsay $(targetdir)/$$file ; \ + done + for file in rdict ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) dict $(targetdir)/$$file ; \ + done + for file in dpkg-deb dpkg-reconfigure ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) dpkg $(targetdir)/$$file ; \ + done + for file in mailsnarf msgsnarf ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) filesnarf $(targetdir)/$$file ; \ + done + for file in civclient freeciv-sdl freeciv-xaw ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) freeciv-gtk2 $(targetdir)/$$file ; \ + done + for file in civserver ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) freeciv-server $(targetdir)/$$file ; \ + done + for file in declare typeset ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) function $(targetdir)/$$file ; \ + done + for file in g++ c++ g77 gcj gpc cc ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) gcc $(targetdir)/$$file ; \ + done + for file in mkisofs ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) genisoimage $(targetdir)/$$file ; \ + done + for file in gkrellm2 ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) gkrellm $(targetdir)/$$file ; \ + done + for file in pigz ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) gzip $(targetdir)/$$file ; \ + done + for file in sdptool l2ping rfcomm ciptool dfutool hciconfig \ + hciattach ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) hcitool $(targetdir)/$$file ; \ + done + for file in hping hping3 ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) hping2 $(targetdir)/$$file ; \ + done + for file in ifdown ifstatus ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) ifup $(targetdir)/$$file ; \ + done + for file in pinfo ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) info $(targetdir)/$$file ; \ + done + for file in modprobe modinfo ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) insmod $(targetdir)/$$file ; \ + done + for file in javac javadoc ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) java $(targetdir)/$$file ; \ + done + for file in pkill ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) killall $(targetdir)/$$file ; \ + done + for file in ldapadd ldapmodify ldapdelete ldapcompare ldapmodrdn \ + ldapwhoami ldappasswd ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) ldapsearch $(targetdir)/$$file ; \ + done + for file in lintian-info ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) lintian $(targetdir)/$$file ; \ + done + for file in lvmdiskscan pvscan pvs pvdisplay pvchange pvcreate pvmove \ + pvremove vgscan vgs vgdisplay vgchange vgremove vgrename \ + vgreduce vgextend vgimport vgexport vgck vgconvert \ + vgcfgbackup vgcfgrestore vgmerge vgsplit vgmknodes lvscan lvs \ + lvdisplay lvchange lvcreate lvremove lvrename lvreduce \ + lvresize lvextend ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) lvm $(targetdir)/$$file ; \ + done + for file in gmake gnumake pmake ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) make $(targetdir)/$$file ; \ + done + for file in apropos whatis ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) man $(targetdir)/$$file ; \ + done + for file in mdecrypt ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) mcrypt $(targetdir)/$$file ; \ + done + for file in umount ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) mount $(targetdir)/$$file ; \ + done + for file in mplayer2 mencoder gmplayer kplayer ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) mplayer $(targetdir)/$$file ; \ + done + for file in muttng ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) mutt $(targetdir)/$$file ; \ + done + for file in host ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) nslookup $(targetdir)/$$file ; \ + done + for file in g4 ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) p4 $(targetdir)/$$file ; \ + done + for file in perldoc ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) perl $(targetdir)/$$file ; \ + done + for file in pidof ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) pgrep $(targetdir)/$$file ; \ + done + for file in alpine ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) pine $(targetdir)/$$file ; \ + done + for file in ping6 ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) ping $(targetdir)/$$file ; \ + done + for file in pkg_info pkg_deinstall ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) pkg_delete $(targetdir)/$$file ; \ + done + for file in pm-suspend pm-suspend-hybrid ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) pm-hibernate $(targetdir)/$$file ; \ + done + for file in createdb dropdb ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) psql $(targetdir)/$$file ; \ + done + for file in postalias ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) postmap $(targetdir)/$$file ; \ + done + for file in xpovray spovray ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) povray $(targetdir)/$$file ; \ + done + for file in puppetmasterd puppetd puppetca ralsh puppetrun puppetqd \ + filebucket puppetdoc ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) puppet $(targetdir)/$$file ; \ + done + for file in python2 python3 ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) python $(targetdir)/$$file ; \ + done + for file in dcop ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) qdbus $(targetdir)/$$file ; \ + done + for file in setquota edquota quotacheck repquota quotaon quotaoff ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) quota $(targetdir)/$$file ; \ + done + for file in ci co rlog rcsdiff ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) rcs $(targetdir)/$$file ; \ + done + for file in rpmbuild rpmbuild-md5 ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) rpm $(targetdir)/$$file ; \ + done + for file in rpm2txz rpm2targz ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) rpm2tgz $(targetdir)/$$file ; \ + done + for file in smbget smbcacls smbcquotas smbpasswd smbtar smbtree ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) smbclient $(targetdir)/$$file ; \ + done + for file in sbcl-mt ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) sbcl $(targetdir)/$$file ; \ + done + for file in slogin autossh sftp scp ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) ssh $(targetdir)/$$file ; \ + done + for file in tracepath6 ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) tracepath $(targetdir)/$$file ; \ + done + for file in alternatives ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) update-alternatives $(targetdir)/$$file ; \ + done + for file in vigr ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) vipw $(targetdir)/$$file ; \ + done + for file in tightvncviewer xvnc4viewer ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) vncviewer $(targetdir)/$$file ; \ + done + for file in cdrecord ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) wodim $(targetdir)/$$file ; \ + done + for file in pxz ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) xz $(targetdir)/$$file ; \ + done + for file in ypcat ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) ypmatch $(targetdir)/$$file ; \ + done +.PHONY: symlinks + +all-local: targetdir = $(srcdir) +all-local: symlinks + +install-data-local: targetdir = $(DESTDIR)$(bashcompdir) +install-data-local: symlinks diff --git a/completions/_mock b/completions/_mock index 55d7a0f2..583933d2 100644 --- a/completions/_mock +++ b/completions/_mock @@ -3,8 +3,6 @@ # bash completion for mock -have mock || return - _mock() { local cur prev words cword split diff --git a/completions/_modules b/completions/_modules index c76ed66d..61523915 100644 --- a/completions/_modules +++ b/completions/_modules @@ -19,7 +19,7 @@ # 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 ] || have module || return +[ -f /etc/profile.d/modules.sh ] || return 1 _module_list () { diff --git a/completions/_subversion b/completions/_subversion index 0ad3303f..f17a7116 100644 --- a/completions/_subversion +++ b/completions/_subversion @@ -3,8 +3,6 @@ # svn completion -have svn || return - _svn() { local cur prev words cword diff --git a/completions/_yum b/completions/_yum index cf31da80..87f4b8b5 100644 --- a/completions/_yum +++ b/completions/_yum @@ -3,8 +3,6 @@ # yum(8) completion -have yum || return - _yum_list() { if [[ "$1" == all ]] ; then diff --git a/completions/_yum-utils b/completions/_yum-utils index b11c95e3..2917e9ad 100644 --- a/completions/_yum-utils +++ b/completions/_yum-utils @@ -3,8 +3,6 @@ # bash completion for repomanage -have repomanage || return - _repomanage() { local cur prev words cword split diff --git a/completions/abook b/completions/abook index 5f462942..a26f92df 100644 --- a/completions/abook +++ b/completions/abook @@ -1,7 +1,5 @@ # abook(1) completion -have abook || return - _abook() { local cur prev words cword diff --git a/completions/aclocal b/completions/aclocal new file mode 100644 index 00000000..6c61870b --- /dev/null +++ b/completions/aclocal @@ -0,0 +1,41 @@ +# aclocal(1) completion + +_aclocal() +{ + local cur prev words cword split + _init_completion -s || return + + case "$prev" in + --help|--print-ac-dir|--version) + return 0 + ;; + --acdir|-I) + _filedir -d + return 0 + ;; + --output) + _filedir + return 0 + ;; + --warnings|-W) + local cats=( syntax unsupported ) + COMPREPLY=( $( compgen -W \ + '${cats[@]} ${cats[@]/#/no-} all none error' -- "$cur" ) ) + return 0 + ;; + esac + + $split && return 0 + + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace +} && +complete -F _aclocal aclocal aclocal-1.11 + +# 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 diff --git a/completions/add_members b/completions/add_members new file mode 100644 index 00000000..27feb5e0 --- /dev/null +++ b/completions/add_members @@ -0,0 +1,38 @@ +# mailman add_members completion + +_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 0 + ;; + -w|-a|--welcome-msg|--admin-notify) + COMPREPLY=( $( compgen -W 'y n' -- "$cur") ) + return 0 + ;; + esac + + $split && return 0 + + 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 + +# 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 diff --git a/completions/alias b/completions/alias new file mode 100644 index 00000000..65b37251 --- /dev/null +++ b/completions/alias @@ -0,0 +1,26 @@ +# bash alias completion + +_alias() +{ + local cur prev words cword + _init_completion || return + + case ${words[@]} in + *[^=]) + COMPREPLY=( $( compgen -A alias -- "$cur" ) ) + ;; + *=) + COMPREPLY=( "$( alias ${cur%=} 2>/dev/null | sed \ + -e 's|^alias '"$cur"'\(.*\)$|\1|' )" ) + ;; + esac +} && +complete -F _alias -o nospace alias + +# 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 diff --git a/completions/ant b/completions/ant index 4ba13ab8..e174c17b 100644 --- a/completions/ant +++ b/completions/ant @@ -1,7 +1,5 @@ # bash completion for ant and phing -have ant || have phing || return - _ant() { local cur prev words cword @@ -59,9 +57,9 @@ _ant() COMPREPLY=( $( compgen -W '$targets' -- "$cur" ) ) fi } && -have ant && { type complete-ant-cmd.pl &>/dev/null && \ - complete -C complete-ant-cmd.pl -F _ant ant || complete -F _ant ant; } -have phing && complete -F _ant phing +complete -F _ant ant phing +type complete-ant-cmd.pl &>/dev/null && \ + complete -C complete-ant-cmd.pl -F _ant ant || : # Local variables: # mode: shell-script diff --git a/completions/apache2ctl b/completions/apache2ctl index 7facbd2b..d9b10639 100644 --- a/completions/apache2ctl +++ b/completions/apache2ctl @@ -1,7 +1,5 @@ # apache2ctl(1) completion -have apache2ctl || return - _apache2ctl() { local cur prev words cword diff --git a/completions/apt-build b/completions/apt-build index 5400dbb9..2a11f221 100644 --- a/completions/apt-build +++ b/completions/apt-build @@ -1,7 +1,5 @@ # Debian apt-build(1) completion. -have apt-build || return - _apt_build() { local cur prev words cword diff --git a/completions/apt-cache b/completions/apt-cache new file mode 100644 index 00000000..a50f89c0 --- /dev/null +++ b/completions/apt-cache @@ -0,0 +1,80 @@ +# Debian apt-cache(8) completion. + +_apt_cache() +{ + local cur prev words cword + _init_completion || return + + local special i + if [ "$cur" != show ]; then + for (( i=0; i < ${#words[@]}-1; i++ )); do + if [[ ${words[i]} == @(add|depends|dotty|madison|policy|rdepends|show?(pkg|src|)) ]]; then + special=${words[i]} + fi + done + fi + + + if [ -n "$special" ]; then + case $special in + add) + _filedir + return 0 + ;; + + showsrc) + COMPREPLY=( $( apt-cache dumpavail | \ + command grep "^Source: $cur" | sort -u | cut -f2 -d" " ) ) + return 0 + ;; + + *) + COMPREPLY=( $( apt-cache --no-generate pkgnames "$cur" 2> /dev/null ) ) + return 0 + ;; + + esac + fi + + + case $prev in + -c|-p|-s|--config-file|--pkg-cache|--src-cache) + _filedir + return 0 + ;; + search) + if [[ "$cur" != -* ]]; then + return 0 + 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" ) ) + else + + COMPREPLY=( $( compgen -W 'add gencaches show showpkg showsrc \ + stats dump dumpavail unmet search search \ + depends rdepends pkgnames dotty xvcg \ + policy madison' -- "$cur" ) ) + + fi + + + return 0 +} && +complete -F _apt_cache apt-cache + +# 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 diff --git a/completions/apt b/completions/apt-get index c020ab2b..25e256a8 100644 --- a/completions/apt +++ b/completions/apt-get @@ -1,6 +1,5 @@ # Debian apt-get(8) completion. -have apt-get && _apt_get() { local cur prev words cword @@ -21,7 +20,7 @@ _apt_get() COMPREPLY=( $( _comp_dpkg_installed_packages $cur ) ) else # assume RPM based - _rpm_installed_packages + _xfunc rpm _rpm_installed_packages fi return 0 ;; @@ -73,80 +72,6 @@ _apt_get() } && complete -F _apt_get apt-get -# Debian apt-cache(8) completion. -# -have apt-cache && -_apt_cache() -{ - local cur prev words cword - _init_completion || return - - local special i - if [ "$cur" != show ]; then - for (( i=0; i < ${#words[@]}-1; i++ )); do - if [[ ${words[i]} == @(add|depends|dotty|madison|policy|rdepends|show?(pkg|src|)) ]]; then - special=${words[i]} - fi - done - fi - - - if [ -n "$special" ]; then - case $special in - add) - _filedir - return 0 - ;; - - showsrc) - COMPREPLY=( $( apt-cache dumpavail | \ - command grep "^Source: $cur" | sort -u | cut -f2 -d" " ) ) - return 0 - ;; - - *) - COMPREPLY=( $( apt-cache --no-generate pkgnames "$cur" 2> /dev/null ) ) - return 0 - ;; - - esac - fi - - - case $prev in - -c|-p|-s|--config-file|--pkg-cache|--src-cache) - _filedir - return 0 - ;; - search) - if [[ "$cur" != -* ]]; then - return 0 - 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" ) ) - else - - COMPREPLY=( $( compgen -W 'add gencaches show showpkg showsrc \ - stats dump dumpavail unmet search search \ - depends rdepends pkgnames dotty xvcg \ - policy madison' -- "$cur" ) ) - - fi - - - return 0 -} && -complete -F _apt_cache apt-cache - # Local variables: # mode: shell-script # sh-basic-offset: 4 diff --git a/completions/aptitude b/completions/aptitude index 5ec8c618..b1274971 100644 --- a/completions/aptitude +++ b/completions/aptitude @@ -1,8 +1,6 @@ # Debian aptitude(1) completion -have aptitude || return - -have grep-status && { +_have grep-status && { _comp_dpkg_hold_packages() { grep-status -P -e "^$1" -a -FStatus 'hold' -n -s Package diff --git a/completions/arch b/completions/arch new file mode 100644 index 00000000..80f1fc3b --- /dev/null +++ b/completions/arch @@ -0,0 +1,53 @@ +# mailman arch completion + +# 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 0 + ;; + -d|--file) + _filedir + return 0 + ;; + esac + + $split && return 0 + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--wipe --start --end --quiet \ + --help' -- "$cur" ) ) + else + local args=$cword + for (( i=1; i < cword; i++ )); do + if [[ "${words[i]}" == -* ]]; then + args=$(($args-1)) + fi + done + case $args in + 1) + _xfunc list_lists _mailman_lists + ;; + 2) + _filedir + ;; + esac + fi + +} && +complete -F _arch arch + +# 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 diff --git a/completions/arping b/completions/arping new file mode 100644 index 00000000..ea35bbde --- /dev/null +++ b/completions/arping @@ -0,0 +1,37 @@ +# arping(8) completion + +_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 + +# 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 diff --git a/completions/arpspoof b/completions/arpspoof new file mode 100644 index 00000000..91bafe58 --- /dev/null +++ b/completions/arpspoof @@ -0,0 +1,34 @@ +# arpspoof completion + +_arpspoof() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -i) + _available_interfaces + return 0 + ;; + -t) + _known_hosts_real "$cur" + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + else + _known_hosts_real "$cur" + fi + +} && +complete -F _arpspoof arpspoof + +# 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 diff --git a/completions/asciidoc b/completions/asciidoc index 19f8e84c..36b463c4 100644 --- a/completions/asciidoc +++ b/completions/asciidoc @@ -1,5 +1,3 @@ -have asciidoc || have a2x || return - _asciidoc_doctype() { COMPREPLY+=( $( compgen -W 'article book manpage' -- "$cur" ) ) diff --git a/completions/aspell b/completions/aspell index ae5b3366..7d940c68 100644 --- a/completions/aspell +++ b/completions/aspell @@ -1,7 +1,5 @@ # bash completion for aspell -have aspell || return - _aspell_dictionary() { local datadir diff --git a/completions/autoconf b/completions/autoconf index ba6dd185..0484860e 100644 --- a/completions/autoconf +++ b/completions/autoconf @@ -1,6 +1,5 @@ -# Completions for autoconf tools +# autoconf(1) completion -have autoconf && _autoconf() { local cur prev words cword split @@ -38,77 +37,6 @@ _autoconf() } && complete -F _autoconf autoconf -have autoreconf || have autoheader && -_autoreconf() -{ - local cur prev words cword split - _init_completion -s || return - - case "$prev" in - --help|-h|--version|-V) - return 0 - ;; - --warnings|-W) - local cats=( cross gnu obsolete override portability syntax \ - unsupported ) - COMPREPLY=( $( compgen -W \ - '${cats[@]} ${cats[@]/#/no-} all none error' -- "$cur" ) ) - return 0 - ;; - --prepend-include|-B|--include|-I) - _filedir -d - return 0 - ;; - esac - - $split && return 0 - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) - [[ $COMPREPLY == *= ]] && compopt -o nospace - return 0 - fi - - if [[ $1 == autoheader ]] ; then - _filedir '@(ac|in)' - else - _filedir -d - fi -} && -complete -F _autoreconf autoreconf autoheader - -have autoscan || have autoupdate && -_autoscan() -{ - local cur prev words cword split - _init_completion -s || return - - case "$prev" in - --help|-h|--version|-V) - return 0 - ;; - --prepend-include|-B|--include|-I) - _filedir -d - return 0 - ;; - esac - - $split && return 0 - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) - [[ $COMPREPLY == *= ]] && compopt -o nospace - return 0 - fi - - if [[ $1 == autoupdate ]] ; then - _filedir '@(ac|in)' - else - _filedir -d - fi -} && -complete -F _autoscan autoscan autoupdate - # Local variables: # mode: shell-script # sh-basic-offset: 4 diff --git a/completions/automake b/completions/automake index 2080f252..64057bc6 100644 --- a/completions/automake +++ b/completions/automake @@ -1,6 +1,5 @@ -# Completions for automake tools +# automake(1) completion -have automake && _automake() { local cur prev words cword split @@ -34,39 +33,6 @@ _automake() } && complete -F _automake automake automake-1.11 -have aclocal && -_aclocal() -{ - local cur prev words cword split - _init_completion -s || return - - case "$prev" in - --help|--print-ac-dir|--version) - return 0 - ;; - --acdir|-I) - _filedir -d - return 0 - ;; - --output) - _filedir - return 0 - ;; - --warnings|-W) - local cats=( syntax unsupported ) - COMPREPLY=( $( compgen -W \ - '${cats[@]} ${cats[@]/#/no-} all none error' -- "$cur" ) ) - return 0 - ;; - esac - - $split && return 0 - - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) - [[ $COMPREPLY == *= ]] && compopt -o nospace -} && -complete -F _aclocal aclocal aclocal-1.11 - # Local variables: # mode: shell-script # sh-basic-offset: 4 diff --git a/completions/autoreconf b/completions/autoreconf new file mode 100644 index 00000000..b661f985 --- /dev/null +++ b/completions/autoreconf @@ -0,0 +1,47 @@ +# autoreconf(1) completion + +_autoreconf() +{ + local cur prev words cword split + _init_completion -s || return + + case "$prev" in + --help|-h|--version|-V) + return 0 + ;; + --warnings|-W) + local cats=( cross gnu obsolete override portability syntax \ + unsupported ) + COMPREPLY=( $( compgen -W \ + '${cats[@]} ${cats[@]/#/no-} all none error' -- "$cur" ) ) + return 0 + ;; + --prepend-include|-B|--include|-I) + _filedir -d + return 0 + ;; + esac + + $split && return 0 + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + return 0 + fi + + if [[ $1 == autoheader ]] ; then + _filedir '@(ac|in)' + else + _filedir -d + fi +} && +complete -F _autoreconf autoreconf autoheader + +# 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 diff --git a/completions/autorpm b/completions/autorpm index dea2d484..51c12fa2 100644 --- a/completions/autorpm +++ b/completions/autorpm @@ -1,7 +1,5 @@ # autorpm(8) completion -have autorpm || return - _autorpm() { local cur prev words cword diff --git a/completions/autoscan b/completions/autoscan new file mode 100644 index 00000000..e5040abd --- /dev/null +++ b/completions/autoscan @@ -0,0 +1,40 @@ +# autoscan(1) completion + +_autoscan() +{ + local cur prev words cword split + _init_completion -s || return + + case "$prev" in + --help|-h|--version|-V) + return 0 + ;; + --prepend-include|-B|--include|-I) + _filedir -d + return 0 + ;; + esac + + $split && return 0 + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + return 0 + fi + + if [[ $1 == autoupdate ]] ; then + _filedir '@(ac|in)' + else + _filedir -d + fi +} && +complete -F _autoscan autoscan autoupdate + +# 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 diff --git a/completions/avctrl b/completions/avctrl new file mode 100644 index 00000000..57f5d57b --- /dev/null +++ b/completions/avctrl @@ -0,0 +1,26 @@ +# avctrl completion + +_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 -eq 1 ]; then + COMPREPLY=( $( compgen -W 'discover switch' -- "$cur" ) ) + fi + fi +} && +complete -F _avctrl avctrl + +# 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 diff --git a/completions/badblocks b/completions/badblocks new file mode 100644 index 00000000..4953a182 --- /dev/null +++ b/completions/badblocks @@ -0,0 +1,38 @@ +# badblocks(8) completion + +_badblocks() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -b|-c|-e|-d|-p|-t) + return 0 + ;; + -i|-o) + _filedir + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + # Filter out -w (dangerous) and -X (internal use) + for i in ${!COMPREPLY[@]}; do + [[ ${COMPREPLY[i]} == -[wX] ]] && unset COMPREPLY[i] + done + return 0 + fi + + cur=${cur:=/dev/} + _filedir +} && +complete -F _badblocks badblocks + +# 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 diff --git a/completions/bash-builtins b/completions/bash-builtins deleted file mode 100644 index 3df3ddb3..00000000 --- a/completions/bash-builtins +++ /dev/null @@ -1,120 +0,0 @@ -# bash alias completion -# -_alias() -{ - local cur prev words cword - _init_completion || return - - case ${words[@]} in - *[^=]) - COMPREPLY=( $( compgen -A alias -- "$cur" ) ) - ;; - *=) - COMPREPLY=( "$( alias ${cur%=} 2>/dev/null | sed \ - -e 's|^alias '"$cur"'\(.*\)$|\1|' )" ) - ;; - esac -} && -complete -F _alias -o nospace alias - -# bash export completion -# -_export() -{ - local cur prev words cword - _init_completion || return - - case ${words[@]} in - *=\$*) - COMPREPLY=( $( compgen -v -P '$' -- "${cur#*=\$}" ) ) - ;; - *[^=]) - COMPREPLY=( $( compgen -v -S '=' -- "$cur" ) ) - ;; - *=) - COMPREPLY=( "$( eval echo -n \"$`echo ${cur%=}`\" | - ( echo -n \' - sed -e 's/'\''/'\''\\\'\'''\''/g' - echo -n \' ) )" ) - ;; - esac -} && -complete -F _export -o default -o nospace export - -# bash shell function completion -# -_function() -{ - local cur prev words cword - _init_completion || return - - if [[ $1 == @(declare|typeset) ]]; then - if [ "$prev" = -f ]; then - COMPREPLY=( $( compgen -A function -- "$cur" ) ) - elif [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-a -f -F -i -r -x -p' -- "$cur" ) ) - fi - elif [ $cword -eq 1 ]; then - COMPREPLY=( $( compgen -A function -- "$cur" ) ) - else - COMPREPLY=( "() $( type -- ${words[1]} | sed -e 1,2d )" ) - fi -} && -complete -F _function function declare typeset - -# bash complete completion -# -_complete() -{ - local cur prev words cword - _init_completion || return - - case $prev in - -o) - COMPREPLY=( $( compgen -W 'bashdefault default dirnames filenames \ - nospace plusdirs' -- "$cur" ) ) - return 0 - ;; - - -A) - COMPREPLY=( $( compgen -W 'alias arrayvar binding builtin command \ - directory disabled enabled export file function group \ - helptopic hostname job keyword running service setopt shopt \ - signal stopped user variable' -- "$cur" ) ) - return 0 - ;; - - -C) - COMPREPLY=( $( compgen -A command -- "$cur" ) ) - return 0 - ;; - -F) - COMPREPLY=( $( compgen -A function -- "$cur" ) ) - return 0 - ;; - -p|-r) - COMPREPLY=( $( complete -p | sed -e 's|.* ||' ) ) - COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) ) - return 0 - ;; - - esac - - if [[ "$cur" == -* ]]; then - # 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 - -# 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 diff --git a/completions/bitkeeper b/completions/bk index 8f1d9490..580ec040 100644 --- a/completions/bitkeeper +++ b/completions/bk @@ -1,14 +1,12 @@ # BitKeeper completion adapted from code by Bart Trojanowski <bart@jukie.net> -have bk || return - _bk() { local cur prev words cword _init_completion || return - local BKCMDS="$( bk help topics | awk '/^ bk/ { print $4 }' | \ - xargs printf '%s ' )" + local BKCMDS="$( bk help topics 2>/dev/null | \ + awk '/^ bk/ { print $4 }' | xargs printf '%s ' )" COMPREPLY=( $( compgen -W "$BKCMDS" -- "$cur" ) ) _filedir diff --git a/completions/brctl b/completions/brctl index 8ae7dab7..ced11cef 100644 --- a/completions/brctl +++ b/completions/brctl @@ -1,7 +1,5 @@ # bash completion for brctl -have brctl || return - _brctl() { local cur prev words cword diff --git a/completions/bittorrent b/completions/btdownloadheadless.py index ba940750..ea0f781a 100644 --- a/completions/bittorrent +++ b/completions/btdownloadheadless.py @@ -1,8 +1,5 @@ # btdownloadheadless(1) completion -have btdownloadheadless.py || have btdownloadcurses.py || \ - have btdownloadgui.py || return - _btdownload() { local cur prev words cword diff --git a/completions/bzip2 b/completions/bzip2 index 7b75a76c..f7d615ea 100644 --- a/completions/bzip2 +++ b/completions/bzip2 @@ -1,7 +1,5 @@ # bash completion for bzip2 -have bzip2 || have pbzip2 || have lbzip2 || return - _bzip2() { local cur prev words cword diff --git a/completions/cal b/completions/cal index e2195a6d..f6fafb59 100644 --- a/completions/cal +++ b/completions/cal @@ -1,5 +1,3 @@ -have cal || have ncal || return - _cal() { local cur prev words cword diff --git a/completions/cancel b/completions/cancel new file mode 100644 index 00000000..5268e08f --- /dev/null +++ b/completions/cancel @@ -0,0 +1,18 @@ +# cancel(1) completion + +_cancel() +{ + local cur prev words cword + _init_completion || return + + COMPREPLY=( $( compgen -W "$( lpstat 2>/dev/null | cut -d' ' -f1 )" -- "$cur" ) ) +} && +complete -F _cancel cancel + +# 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 diff --git a/completions/cardctl b/completions/cardctl index da95f6d1..6ed4558d 100644 --- a/completions/cardctl +++ b/completions/cardctl @@ -1,7 +1,5 @@ # Linux cardctl(8) completion -have cardctl || have pccardctl || return - _cardctl() { local cur prev words cword diff --git a/completions/cfagent b/completions/cfagent new file mode 100644 index 00000000..01ca7ad5 --- /dev/null +++ b/completions/cfagent @@ -0,0 +1,27 @@ +# cfagent completion + +_cfagent() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -f|--file) + _filedir + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + fi +} && +complete -F _cfagent cfagent + +# 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 diff --git a/completions/cfengine b/completions/cfrun index d959b79f..810f03dc 100644 --- a/completions/cfengine +++ b/completions/cfrun @@ -1,24 +1,4 @@ -# bash completion for cfengine - -have cfagent || return - -_cfagent() -{ - local cur prev words cword - _init_completion || return - - case $prev in - -f|--file) - _filedir - return 0 - ;; - esac - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) - fi -} && -complete -F _cfagent cfagent +# cfrun completion _cfrun() { diff --git a/completions/chage b/completions/chage new file mode 100644 index 00000000..3bd1816e --- /dev/null +++ b/completions/chage @@ -0,0 +1,32 @@ +# chage(1) completion + +_chage() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + -d|--lastday|-E|--expiredate|-h|--help|-I|--inactive|-m|--mindays|\ + -M|--maxdays|-W|--warndays) + return 0 + ;; + esac + + $split && return 0 + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + return 0 + fi + + COMPREPLY=( $( compgen -u -- "$cur" ) ) +} && +complete -F _chage chage + +# 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 diff --git a/completions/change_pw b/completions/change_pw new file mode 100644 index 00000000..aa4507d8 --- /dev/null +++ b/completions/change_pw @@ -0,0 +1,31 @@ +# mailman change_pw completion + +_change_pw() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + -l|--listname) + _xfunc list_lists _mailman_lists + return 0 + ;; + esac + + $split && return 0 + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--all --domain --listname \ + --password --quiet --help' -- "$cur" ) ) + fi + +} && +complete -F _change_pw change_pw + +# 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 diff --git a/completions/check_db b/completions/check_db new file mode 100644 index 00000000..5a6cd063 --- /dev/null +++ b/completions/check_db @@ -0,0 +1,23 @@ +# mailman check_db completion + +_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 + +# 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 diff --git a/completions/check_perms b/completions/check_perms new file mode 100644 index 00000000..695aad5c --- /dev/null +++ b/completions/check_perms @@ -0,0 +1,21 @@ +# mailman check_perms completion + +_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 + +# 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 diff --git a/completions/chgrp b/completions/chgrp new file mode 100644 index 00000000..cdd6c2ce --- /dev/null +++ b/completions/chgrp @@ -0,0 +1,46 @@ +# chgrp(1) completion + +_chgrp() +{ + local cur prev words cword split + _init_completion -s || return + + cur=${cur//\\\\/} + + if [[ "$prev" == --reference ]]; then + _filedir + return 0 + fi + + $split && return 0 + + # 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 0 + fi + + # first parameter on line or first since an option? + if [[ $cword -eq 1 && "$cur" != -* || "$prev" == -* ]]; then + _allowed_groups "$cur" + else + _filedir || return 0 + fi + + return 0 +} && +complete -F _chgrp chgrp + +# 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 diff --git a/completions/chkconfig b/completions/chkconfig index 3a6651ed..1a640ff1 100644 --- a/completions/chkconfig +++ b/completions/chkconfig @@ -1,7 +1,5 @@ # chkconfig(8) completion -have chkconfig || return - _chkconfig() { local cur prev words cword split diff --git a/completions/chown b/completions/chown new file mode 100644 index 00000000..1ce0edc0 --- /dev/null +++ b/completions/chown @@ -0,0 +1,52 @@ +# chown(1) completion + +_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 0 + ;; + --reference) + _filedir + return 0 + ;; + esac + + $split && return 0 + + 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 -eq 1 ]]; then + _usergroup -u + else + _filedir + fi + fi +} && +complete -F _chown chown + +# 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 diff --git a/completions/chpasswd b/completions/chpasswd new file mode 100644 index 00000000..ed77069b --- /dev/null +++ b/completions/chpasswd @@ -0,0 +1,35 @@ +# chpasswd(8) completion + +_chpasswd() +{ + 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 0 + ;; + -s|--sha-rounds) + return 0 + ;; + esac + + $split && return 0 + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + return 0 + fi +} && +complete -F _chpasswd chpasswd + +# 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 diff --git a/completions/chrpath b/completions/chrpath index 5d40203a..89889c3b 100644 --- a/completions/chrpath +++ b/completions/chrpath @@ -1,5 +1,3 @@ -have chrpath || return - _chrpath() { local cur prev words cword diff --git a/completions/chsh b/completions/chsh index c19e436c..fd25d672 100644 --- a/completions/chsh +++ b/completions/chsh @@ -1,7 +1,5 @@ # chsh(1) completion -have chsh || return - _chsh() { local cur prev words cword diff --git a/completions/cksfv b/completions/cksfv index f5fcab38..87f3253d 100644 --- a/completions/cksfv +++ b/completions/cksfv @@ -1,7 +1,5 @@ # cksfv completion by Chris <xris@forevermore.net> -have cksfv || return - _cksfv() { local cur prev words cword diff --git a/completions/cleanarch b/completions/cleanarch new file mode 100644 index 00000000..24d405d7 --- /dev/null +++ b/completions/cleanarch @@ -0,0 +1,22 @@ +# mailman cleanarch completion + +_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 + +# 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 diff --git a/completions/clisp b/completions/clisp index dc0f2cdd..b2ea0c18 100644 --- a/completions/clisp +++ b/completions/clisp @@ -1,8 +1,6 @@ # bash brogrammable completion for various Common Lisp implementations by # Nikodemus Siivola <nikodemus@random-state.net> -have clisp || return - _clisp() { local cur prev words cword diff --git a/completions/clone_member b/completions/clone_member new file mode 100644 index 00000000..11067e7c --- /dev/null +++ b/completions/clone_member @@ -0,0 +1,31 @@ +# mailman clone_member completion + +_clone_member() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + -l|--listname) + _xfunc list_lists _mailman_lists + return 0 + ;; + esac + + $split && return 0 + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--listname --remove --admin \ + --quiet --nomodify --help' -- "$cur" ) ) + fi + +} && +complete -F _clone_member clone_member + +# 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 diff --git a/completions/complete b/completions/complete new file mode 100644 index 00000000..e5b69a05 --- /dev/null +++ b/completions/complete @@ -0,0 +1,56 @@ +# bash complete completion + +_complete() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -o) + COMPREPLY=( $( compgen -W 'bashdefault default dirnames filenames \ + nospace plusdirs' -- "$cur" ) ) + return 0 + ;; + + -A) + COMPREPLY=( $( compgen -W 'alias arrayvar binding builtin command \ + directory disabled enabled export file function group \ + helptopic hostname job keyword running service setopt shopt \ + signal stopped user variable' -- "$cur" ) ) + return 0 + ;; + + -C) + COMPREPLY=( $( compgen -A command -- "$cur" ) ) + return 0 + ;; + -F) + COMPREPLY=( $( compgen -A function -- "$cur" ) ) + return 0 + ;; + -p|-r) + COMPREPLY=( $( complete -p | sed -e 's|.* ||' ) ) + COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) ) + return 0 + ;; + + esac + + if [[ "$cur" == -* ]]; then + # 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 + +# 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 diff --git a/completions/config_list b/completions/config_list new file mode 100644 index 00000000..a695b038 --- /dev/null +++ b/completions/config_list @@ -0,0 +1,33 @@ +# mailman config_list completion + +_config_list() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + -i|-o|--inputfile|--outputfile) + _filedir + return 0 + ;; + esac + + $split && return 0 + + 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 + +# 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 diff --git a/completions/configure b/completions/configure index af1c736a..2127571b 100644 --- a/completions/configure +++ b/completions/configure @@ -1,7 +1,5 @@ # bash completion for configure -# No "have configure" here on purpose, it's rarely in any $PATH - _configure() { local cur prev words cword split diff --git a/completions/imagemagick b/completions/convert index 160d7c24..31792c3e 100644 --- a/completions/imagemagick +++ b/completions/convert @@ -1,7 +1,5 @@ # bash completion for ImageMagick -have convert || return - _ImageMagick() { case $prev in diff --git a/completions/coreutils b/completions/coreutils deleted file mode 100644 index d4a5558d..00000000 --- a/completions/coreutils +++ /dev/null @@ -1,143 +0,0 @@ -# Completions for various core utilities - -# chown(1) completion -# -have chown && -_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 0 - ;; - --reference) - _filedir - return 0 - ;; - esac - - $split && return 0 - - 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 -eq 1 ]]; then - _usergroup -u - else - _filedir - fi - fi -} && -complete -F _chown chown - - -# chgrp(1) completion -# -have chgrp && -_chgrp() -{ - local cur prev words cword split - _init_completion -s || return - - cur=${cur//\\\\/} - - if [[ "$prev" == --reference ]]; then - _filedir - return 0 - fi - - $split && return 0 - - # 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 0 - fi - - # first parameter on line or first since an option? - if [[ $cword -eq 1 && "$cur" != -* || "$prev" == -* ]]; then - _allowed_groups "$cur" - else - _filedir || return 0 - fi - - return 0 -} && -complete -F _chgrp chgrp - -# id(1) completion -# -have id && -_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 - -# mktemp(1) completion -# -have mktemp && -_mktemp() -{ - local cur prev words cword split - _init_completion -s || return - - case "$prev" in - --help|--version|--suffix) - return 0 - ;; - --tmpdir|-p) - _filedir -d - return 0 - ;; - esac - - $split && return 0 - - 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 - -# 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 diff --git a/completions/cowsay b/completions/cowsay index 723a236b..86df189b 100644 --- a/completions/cowsay +++ b/completions/cowsay @@ -1,7 +1,5 @@ # bash completion for cowsay -have cowsay || return - _cowsay() { local cur prev words cword diff --git a/completions/cpan2dist b/completions/cpan2dist index 4ec33c0b..84ec3b60 100644 --- a/completions/cpan2dist +++ b/completions/cpan2dist @@ -1,7 +1,5 @@ # bash completion for cpan2dist -have cpan2dist || return - _cpan2dist() { local cur prev words cword diff --git a/completions/cpio b/completions/cpio index 7671c7f7..ce299149 100644 --- a/completions/cpio +++ b/completions/cpio @@ -1,7 +1,5 @@ # bash completion for cpio -have cpio || return - _cpio_format() { COMPREPLY=( $( compgen -W 'bin odc newc crc tar ustar hpbin hpodc' -- "$cur" ) ) diff --git a/completions/cppcheck b/completions/cppcheck index befd109b..cb15f730 100644 --- a/completions/cppcheck +++ b/completions/cppcheck @@ -1,7 +1,5 @@ # bash completion for cppcheck(1) -have cppcheck || return - _cppcheck() { local cur prev words cword split diff --git a/completions/crontab b/completions/crontab index e043a111..ca233769 100644 --- a/completions/crontab +++ b/completions/crontab @@ -1,7 +1,5 @@ # crontab(1) completion -have crontab || return - _crontab() { local cur prev words cword diff --git a/completions/cryptsetup b/completions/cryptsetup index 9b29a548..566c4f73 100644 --- a/completions/cryptsetup +++ b/completions/cryptsetup @@ -1,7 +1,5 @@ # bash completion for cryptsetup -have cryptsetup || return - _cryptsetup_name() { COMPREPLY=( $( compgen -X control -W '$( command ls /dev/mapper )' \ diff --git a/completions/curl b/completions/curl index 1fb96d69..a0060415 100644 --- a/completions/curl +++ b/completions/curl @@ -1,5 +1,3 @@ -have curl || return - _curl() { local cur prev words cword diff --git a/completions/cvs b/completions/cvs index 05a7c7ea..7baeb976 100644 --- a/completions/cvs +++ b/completions/cvs @@ -1,7 +1,5 @@ # cvs(1) completion -have cvs || return - _cvs_entries() { local prefix=${cur%/*}/ IFS=$'\n' diff --git a/completions/cvsps b/completions/cvsps index f22b7a46..1821a1a1 100644 --- a/completions/cvsps +++ b/completions/cvsps @@ -1,7 +1,5 @@ # bash completion for cvsps -have cvsps || return - _cvsps() { local cur prev words cword @@ -44,7 +42,7 @@ _cvsps() return 0 ;; --root) - declare -F _cvs_roots &>/dev/null && _cvs_roots + _xfunc cvs _cvs_roots return 0 ;; esac @@ -52,7 +50,7 @@ _cvsps() if [[ "$cur" == -* ]] ; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" -h )' -- "$cur" ) ) else - declare -F _cvs_roots &>/dev/null && _cvs_roots + _xfunc cvs _cvs_roots fi } && complete -F _cvsps cvsps diff --git a/completions/dd b/completions/dd index d6e9e87a..1c4452eb 100644 --- a/completions/dd +++ b/completions/dd @@ -1,7 +1,5 @@ # bash completion for dd -have dd || return - _dd() { local cur prev words cword diff --git a/completions/dhclient b/completions/dhclient index add77e87..2922296b 100644 --- a/completions/dhclient +++ b/completions/dhclient @@ -1,7 +1,5 @@ # bash completion for dhclient -have dhclient || return - _dhclient() { local cur prev words cword diff --git a/completions/dict b/completions/dict index 2bab183b..394c1db5 100644 --- a/completions/dict +++ b/completions/dict @@ -1,7 +1,5 @@ # dict(1) completion -have dict || have rdict || return - _dictdata() { dict $host $port $1 2>/dev/null | sed -ne \ diff --git a/completions/dmesg b/completions/dmesg new file mode 100644 index 00000000..7aad7be5 --- /dev/null +++ b/completions/dmesg @@ -0,0 +1,33 @@ +# dmesg(1) completion + +_dmesg() +{ + [[ $OSTYPE == *solaris* ]] && return # no args there + + local cur prev words cword + _init_completion || return + + case $prev in + -s|-M|-N) + return + ;; + -n) + COMPREPLY=( $( compgen -W '{1..8}' -- "$cur" ) ) + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + return + fi +} && +complete -F _dmesg dmesg + +# 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 diff --git a/completions/dnsspoof b/completions/dnsspoof new file mode 100644 index 00000000..63229704 --- /dev/null +++ b/completions/dnsspoof @@ -0,0 +1,32 @@ +# dnsspoof completion + +_dnsspoof() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -i) + _interfaces + return 0 + ;; + -f) + _filedir + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + fi + +} && +complete -F _dnsspoof dnsspoof + +# 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 diff --git a/completions/dot b/completions/dot index cd53598f..7193ce85 100644 --- a/completions/dot +++ b/completions/dot @@ -1,7 +1,5 @@ # dot(1) completion -have dot || return - _dot() { local cur prev words cword diff --git a/completions/dpkg b/completions/dpkg index d6ae6bc9..3c368920 100644 --- a/completions/dpkg +++ b/completions/dpkg @@ -1,6 +1,6 @@ # This function is required by _dpkg() and _dpkg-reconfigure() -have dpkg && { -have grep-status && { + +_have grep-status && { _comp_dpkg_installed_packages() { grep-status -P -e "^$1" -a -FStatus 'install ok installed' -n -s Package @@ -66,11 +66,9 @@ _dpkg() [[ $COMPREPLY == *= ]] && compopt -o nospace } && complete -F _dpkg dpkg dpkg-deb -} # Debian GNU dpkg-reconfigure(8) completion # -have dpkg-reconfigure && _dpkg_reconfigure() { local cur prev words cword @@ -101,113 +99,6 @@ _dpkg_reconfigure() } && complete -F _dpkg_reconfigure -o default dpkg-reconfigure -# Debian dpkg-source completion -# -have dpkg-source && -_dpkg_source() -{ - local cur prev words cword - _init_completion || return - - local options work i 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 $packopts $unpackopts" - fields="Format Source Version Binary Maintainer Uploader Architecture \ - Standards-Version Build-Depends Files" - - action="options" - for (( i=0; i < ${#words[@]}-1; i++ )); do - if [[ ${words[$i]} == "-x" ]]; then - action=unpack - elif [[ ${words[$i]} == "-b" ]]; then - action=pack - elif [[ ${words[$i]} == "-h" ]]; then - action=help - fi - done - - case $action in - unpack) - case $prev in - -x) - _filedir -d - _filedir 'dsc' - return 0 - ;; - *) - COMPREPLY=( $( compgen -W "$unpackopts" -- "$cur" ) ) - _filedir -d - _filedir - return 0 - ;; - esac - return 0 - ;; - pack) - case $prev in - -b) - _filedir -d - return 0 - ;; - -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 - return 0 - ;; - -F) - # -F: force change log format - COMPREPLY=( $( command ls /usr/lib/dpkg/parsechangelog ) ) - return 0 - ;; - -V|-D) - # -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=() - return 0 - ;; - -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=() - return 0 - else - COMPREPLY=( $( compgen -W "$fields" -- "$cur" ) ) - return 0 - fi - ;; - -U) - # -U: remove a field - # Suggest possible fieldnames - COMPREPLY=( $( compgen -W "$fields" -- "$cur" ) ) - return 0 - ;; - *) - COMPREPLY=( $( compgen -W "$packopts $unpackopts" -- "$cur" ) ) - return 0 - ;; - esac - return 0 - ;; - *) - COMPREPLY=( $( compgen -W "$options" -- "$cur" ) ) - return 0 - ;; - esac -} && -complete -F _dpkg_source dpkg-source - # Local variables: # mode: shell-script # sh-basic-offset: 4 diff --git a/completions/dpkg-source b/completions/dpkg-source new file mode 100644 index 00000000..66ac6d58 --- /dev/null +++ b/completions/dpkg-source @@ -0,0 +1,113 @@ +# Debian dpkg-source completion + +_dpkg_source() +{ + local cur prev words cword + _init_completion || return + + local options work i 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 $packopts $unpackopts" + fields="Format Source Version Binary Maintainer Uploader Architecture \ + Standards-Version Build-Depends Files" + + action="options" + for (( i=0; i < ${#words[@]}-1; i++ )); do + if [[ ${words[$i]} == "-x" ]]; then + action=unpack + elif [[ ${words[$i]} == "-b" ]]; then + action=pack + elif [[ ${words[$i]} == "-h" ]]; then + action=help + fi + done + + case $action in + unpack) + case $prev in + -x) + _filedir -d + _filedir 'dsc' + return 0 + ;; + *) + COMPREPLY=( $( compgen -W "$unpackopts" -- "$cur" ) ) + _filedir -d + _filedir + return 0 + ;; + esac + return 0 + ;; + pack) + case $prev in + -b) + _filedir -d + return 0 + ;; + -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 + return 0 + ;; + -F) + # -F: force change log format + COMPREPLY=( $( command ls /usr/lib/dpkg/parsechangelog ) ) + return 0 + ;; + -V|-D) + # -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=() + return 0 + ;; + -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=() + return 0 + else + COMPREPLY=( $( compgen -W "$fields" -- "$cur" ) ) + return 0 + fi + ;; + -U) + # -U: remove a field + # Suggest possible fieldnames + COMPREPLY=( $( compgen -W "$fields" -- "$cur" ) ) + return 0 + ;; + *) + COMPREPLY=( $( compgen -W "$packopts $unpackopts" -- "$cur" ) ) + return 0 + ;; + esac + return 0 + ;; + *) + COMPREPLY=( $( compgen -W "$options" -- "$cur" ) ) + return 0 + ;; + esac +} && +complete -F _dpkg_source dpkg-source + +# 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 diff --git a/completions/dselect b/completions/dselect index 2923414c..94894586 100644 --- a/completions/dselect +++ b/completions/dselect @@ -1,7 +1,5 @@ # Debian Linux dselect(8) completion. -have dselect || return - _dselect() { local cur prev words cword diff --git a/completions/dsniff b/completions/dsniff index f1c24002..b0eeedf0 100644 --- a/completions/dsniff +++ b/completions/dsniff @@ -1,56 +1,5 @@ -# dsniff util completion +# dsniff completion -have arpspoof && -_arpspoof() -{ - local cur prev words cword - _init_completion || return - - case $prev in - -i) - _available_interfaces - return 0 - ;; - -t) - _known_hosts_real "$cur" - return 0 - ;; - esac - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) - else - _known_hosts_real "$cur" - fi - -} && -complete -F _arpspoof arpspoof - -have dnsspoof && -_dnsspoof() -{ - local cur prev words cword - _init_completion || return - - case $prev in - -i) - _interfaces - return 0 - ;; - -f) - _filedir - return 0 - ;; - esac - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) - fi - -} && -complete -F _dnsspoof dnsspoof - -have dsniff && _dsniff() { local cur prev words cword @@ -74,157 +23,6 @@ _dsniff() } && complete -F _dsniff dsniff -have filesnarf || have mailsnarf || have msgsnarf && -_snarf() -{ - local cur prev words cword - _init_completion || return - - case $prev in - -i) - _interfaces - return 0 - ;; - esac - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) - fi - -} && -complete -F _snarf filesnarf mailsnarf msgsnarf - -have macof && -_macof() -{ - local cur prev words cword - _init_completion || return - - case $prev in - -i) - _interfaces - return 0 - ;; - esac - - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) - fi - -} && -complete -F _macof macof - -have sshmitm && -_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 - -have sshow && -_sshow() -{ - local cur prev words cword - _init_completion || return - - case $prev in - -i) - _interfaces - return 0 - ;; - esac - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) - fi - -} && -complete -F _sshow sshow - -have tcpkill && -_tcpkill() -{ - local cur prev words cword - _init_completion || return - - case $prev in - -i) - _interfaces - return 0 - ;; - esac - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-i -1 -2 -3 -4 -5 -6 -7 -8 -9' -- "$cur" ) ) - fi - -} && -complete -F _tcpkill tcpkill - -have tcpnice && -_tcpnice() -{ - local cur prev words cword - _init_completion || return - - case $prev in - -i) - _interfaces - return 0 - ;; - esac - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) - fi - -} && -complete -F _tcpnice tcpnice - -have urlsnarf && -_urlsnarf() -{ - local cur prev words cword - _init_completion || return - - case $prev in - -i) - _interfaces - return 0 - ;; - esac - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) - fi - -} && -complete -F _urlsnarf urlsnarf - -have webmitm && -_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 - # Local variables: # mode: shell-script # sh-basic-offset: 4 diff --git a/completions/dumpdb b/completions/dumpdb new file mode 100644 index 00000000..4f093c6c --- /dev/null +++ b/completions/dumpdb @@ -0,0 +1,24 @@ +# mailman dumpdb completion + +_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 + +# 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 diff --git a/completions/dumpe2fs b/completions/dumpe2fs new file mode 100644 index 00000000..7597a298 --- /dev/null +++ b/completions/dumpe2fs @@ -0,0 +1,34 @@ +# dumpe2fs(8) completion + +_dumpe2fs() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -o|-V) + return 0 + ;; + -i) + _filedir + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + return 0 + fi + + cur=${cur:=/dev/} + _filedir +} && +complete -F _dumpe2fs dumpe2fs + +# 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 diff --git a/completions/e2freefrag b/completions/e2freefrag new file mode 100644 index 00000000..519a6275 --- /dev/null +++ b/completions/e2freefrag @@ -0,0 +1,30 @@ +# e2freefrag(8) completion + +_e2freefrag() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -c|-h) + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" -h )' -- "$cur" ) ) + return 0 + fi + + cur=${cur:=/dev/} + _filedir +} && +complete -F _e2freefrag e2freefrag + +# 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 diff --git a/completions/e2fsprogs b/completions/e2fsprogs deleted file mode 100644 index 32520c04..00000000 --- a/completions/e2fsprogs +++ /dev/null @@ -1,176 +0,0 @@ -# bash completion for e2fsprogs - -have badblocks && -_badblocks() -{ - local cur prev words cword - _init_completion || return - - case $prev in - -b|-c|-e|-d|-p|-t) - return 0 - ;; - -i|-o) - _filedir - return 0 - ;; - esac - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) - # Filter out -w (dangerous) and -X (internal use) - for i in ${!COMPREPLY[@]}; do - [[ ${COMPREPLY[i]} == -[wX] ]] && unset COMPREPLY[i] - done - return 0 - fi - - cur=${cur:=/dev/} - _filedir -} && -complete -F _badblocks badblocks - - -have dumpe2fs && -_dumpe2fs() -{ - local cur prev words cword - _init_completion || return - - case $prev in - -o|-V) - return 0 - ;; - -i) - _filedir - return 0 - ;; - esac - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) - return 0 - fi - - cur=${cur:=/dev/} - _filedir -} && -complete -F _dumpe2fs dumpe2fs - - -have e2freefrag && -_e2freefrag() -{ - local cur prev words cword - _init_completion || return - - case $prev in - -c|-h) - return 0 - ;; - esac - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" -h )' -- "$cur" ) ) - return 0 - fi - - cur=${cur:=/dev/} - _filedir -} && -complete -F _e2freefrag e2freefrag - - -have e2label && -_e2label() -{ - local cur prev words cword - _init_completion || return - - if [ $cword -eq 1 ]; then - cur=${cur:=/dev/} - _filedir - fi -} && -complete -F _e2label e2label - - -have filefrag && -_filefrag() -{ - local cur prev words cword - _init_completion || return - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) - return 0 - fi - - _filedir -} && -complete -F _filefrag filefrag - - -have tune2fs && -_tune2fs() -{ - local cur prev words cword - _init_completion || return - - case $prev in - -c|-C|-E|-i|-J|-L|-m|-r|-T) - return 0 - ;; - -e) - COMPREPLY=( $( compgen -W 'continue remount-ro panic' -- "$cur" ) ) - return 0 - ;; - -g) - _gids - COMPREPLY=( $( compgen -g -W '${COMPREPLY[@]}' -- "$cur" ) ) - return 0 - ;; - -M) - _filedir -d - ;; - -o) - local -a opts=(^debug ^bsdgroups ^user_xattr ^acl ^uid16 - ^journal_data ^journal_data_ordered ^journal_data_writeback) - COMPREPLY=( $( compgen -W '${opts[@]} ${opts[@]#^}' -- "$cur" ) ) - return 0 - ;; - -O) - local -a opts=(^dir_index ^dir_nlink ^extent ^extra_isize ^filetype - ^flex_bg ^has_journal ^huge_file ^large_file ^resize_inode - ^sparse_super ^uninit_bg) - COMPREPLY=( $( compgen -W '${opts[@]} ${opts[@]#^}' -- "$cur" ) ) - return 0 - ;; - -u) - _uids - COMPREPLY=( $( compgen -u -W '${COMPREPLY[@]}' -- "$cur" ) ) - return 0 - ;; - -U) - COMPREPLY=( $( compgen -W 'clear random time' -- "$cur" ) ) - return 0 - ;; - esac - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) - return - fi - - cur=${cur:=/dev/} - _filedir -} && -complete -F _tune2fs tune2fs - -# 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 diff --git a/completions/e2label b/completions/e2label new file mode 100644 index 00000000..e6601163 --- /dev/null +++ b/completions/e2label @@ -0,0 +1,21 @@ +# e2label(8) completion + +_e2label() +{ + local cur prev words cword + _init_completion || return + + if [ $cword -eq 1 ]; then + cur=${cur:=/dev/} + _filedir + fi +} && +complete -F _e2label e2label + +# 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 diff --git a/completions/ether-wake b/completions/ether-wake new file mode 100644 index 00000000..96ac75af --- /dev/null +++ b/completions/ether-wake @@ -0,0 +1,33 @@ +# ether-wake(8) completion + +_ether_wake() +{ + local cur prev words cword + _init_completion -n : || return + + case $prev in + -i) + _available_interfaces + return 0 + ;; + -p) + return 0 + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" -u ) -V' -- "$cur" ) ) + return 0 + fi + + _mac_addresses +} && +complete -F _ether_wake ether-wake + +# 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 diff --git a/completions/evince b/completions/evince index 93f35bd6..aa5feffe 100644 --- a/completions/evince +++ b/completions/evince @@ -1,5 +1,3 @@ -have evince || return - _evince() { local cur prev words cword split diff --git a/completions/explodepkg b/completions/explodepkg new file mode 100644 index 00000000..3806327e --- /dev/null +++ b/completions/explodepkg @@ -0,0 +1,11 @@ +# Slackware Linux explodepkg completion + +complete -o plusdirs -f -X '!*.t[bglx]z' explodepkg + +# 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 diff --git a/completions/export b/completions/export new file mode 100644 index 00000000..a27dc016 --- /dev/null +++ b/completions/export @@ -0,0 +1,31 @@ +# bash export completion + +_export() +{ + local cur prev words cword + _init_completion || return + + case ${words[@]} in + *=\$*) + COMPREPLY=( $( compgen -v -P '$' -- "${cur#*=\$}" ) ) + ;; + *[^=]) + COMPREPLY=( $( compgen -v -S '=' -- "$cur" ) ) + ;; + *=) + COMPREPLY=( "$( eval echo -n \"$`echo ${cur%=}`\" | + ( echo -n \' + sed -e 's/'\''/'\''\\\'\'''\''/g' + echo -n \' ) )" ) + ;; + esac +} && +complete -F _export -o default -o nospace export + +# 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 diff --git a/completions/faillog b/completions/faillog new file mode 100644 index 00000000..b7a91d1b --- /dev/null +++ b/completions/faillog @@ -0,0 +1,34 @@ +# faillog(8) completion + +_faillog() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + -h|--help|-l|--lock-time|-m|--maximum|-t|--time) + return 0 + ;; + -u|--user) + COMPREPLY=( $( compgen -u -- "$cur" ) ) + return 0 + ;; + esac + + $split && return 0 + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + return 0 + fi +} && +complete -F _faillog faillog + +# 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 diff --git a/completions/fbgs b/completions/fbgs new file mode 100644 index 00000000..e3687621 --- /dev/null +++ b/completions/fbgs @@ -0,0 +1,45 @@ +# bash completion for fbgs(1) + +_fbgs() +{ + local cur prev words cword + _init_completion || return + + case "$prev" in + -f) + local IFS=$'\n' + COMPREPLY=( $( compgen -W '$( fc-list 2>/dev/null )' -- "$cur" ) ) + return + ;; + -m) + COMPREPLY=( $( compgen -W '$( sed \ + -n "/^mode/{s/^mode \{1,\}\"\([^\"]\{1,\}\)\"/\1/g;p}" \ + /etc/fb.modes 2> /dev/null )' -- "$cur" ) ) + return + ;; + -d) + COMPREPLY=( $( compgen -f -d -- "${cur:-/dev/}" ) ) + return + ;; + -t|-g|-p) + # argument required but no completions available + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $(compgen -W '-l -xl -xxl -a --fitwidth -d -m -t -g -f -p \ + -h -c' -- "$cur") ) + [[ $COMPREPLY ]] && return + fi + + _filedir '?(e)ps|pdf' +} && complete -F _fbgs fbgs + +# 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 diff --git a/completions/fbi b/completions/fbi index ec197546..61540af3 100644 --- a/completions/fbi +++ b/completions/fbi @@ -1,6 +1,4 @@ -# bash completion for fbi(1) and fbgs(1) - -have fbi || return +# bash completion for fbi(1) _fbi() { @@ -53,43 +51,6 @@ _fbi() _filedir 'bmp|gif|jp?(e)g|pcd|png|p[pgb]m|tif?(f)|webp|xpm|xwd|?(e)ps|pdf|dvi|txt|svg?(z)' } && complete -F _fbi fbi -have fbgs && -_fbgs() -{ - local cur prev words cword - _init_completion || return - - case "$prev" in - -f) - local IFS=$'\n' - COMPREPLY=( $( compgen -W '$( fc-list 2>/dev/null )' -- "$cur" ) ) - return - ;; - -m) - COMPREPLY=( $( compgen -W '$( sed \ - -n "/^mode/{s/^mode \{1,\}\"\([^\"]\{1,\}\)\"/\1/g;p}" \ - /etc/fb.modes 2> /dev/null )' -- "$cur" ) ) - return - ;; - -d) - COMPREPLY=( $( compgen -f -d -- "${cur:-/dev/}" ) ) - return - ;; - -t|-g|-p) - # argument required but no completions available - return - ;; - esac - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $(compgen -W '-l -xl -xxl -a --fitwidth -d -m -t -g -f -p \ - -h -c' -- "$cur") ) - [[ $COMPREPLY ]] && return - fi - - _filedir '?(e)ps|pdf' -} && complete -F _fbgs fbgs - # Local variables: # mode: shell-script # sh-basic-offset: 4 diff --git a/completions/feh b/completions/feh index 53ed5589..e71386a8 100644 --- a/completions/feh +++ b/completions/feh @@ -1,7 +1,5 @@ # bash completion for feh(1) -have feh || return - _feh() { local cur prev words cword split diff --git a/completions/file b/completions/file index 07b4c677..63db2252 100644 --- a/completions/file +++ b/completions/file @@ -1,5 +1,3 @@ -have file || return - _file() { local cur prev words cword diff --git a/completions/filefrag b/completions/filefrag new file mode 100644 index 00000000..56696671 --- /dev/null +++ b/completions/filefrag @@ -0,0 +1,23 @@ +# filefrag(8) completion + +_filefrag() +{ + local cur prev words cword + _init_completion || return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + return 0 + fi + + _filedir +} && +complete -F _filefrag filefrag + +# 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 diff --git a/completions/filesnarf b/completions/filesnarf new file mode 100644 index 00000000..321b29cb --- /dev/null +++ b/completions/filesnarf @@ -0,0 +1,28 @@ +# filesnarf etc completion + +_snarf() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -i) + _interfaces + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + fi + +} && +complete -F _snarf filesnarf mailsnarf msgsnarf + +# 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 diff --git a/completions/findutils b/completions/find index cd1c4404..1d3a2822 100644 --- a/completions/findutils +++ b/completions/find @@ -2,8 +2,6 @@ # globs and contains Linux specific code for completing the parameter # to the -fstype option. -have find || return - _find() { local cur prev words cword diff --git a/completions/find_member b/completions/find_member new file mode 100644 index 00000000..e1ea650e --- /dev/null +++ b/completions/find_member @@ -0,0 +1,31 @@ +# mailman find_member completion + +_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 0 + ;; + esac + + $split && return 0 + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--listname --exclude --owners \ + --help' -- "$cur" ) ) + fi + +} && +complete -F _find_member find_member + +# 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 diff --git a/completions/freeciv b/completions/freeciv-gtk2 index 71bb1168..1c129979 100644 --- a/completions/freeciv +++ b/completions/freeciv-gtk2 @@ -1,26 +1,5 @@ -# freeciv completions +# freeciv client completions -have civserver || have freeciv-server && -_civserver() -{ - local cur prev words cword - _init_completion || return - - case $prev in - -f|-g|-l|-r|--file|--log|--gamelog|--read) - _filedir - return 0 - ;; - esac - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) - fi - -} && -complete -F _civserver civserver freeciv-server - -have civclient || have freeciv-gtk2 || have freeciv-sdl || have freeciv-xaw && _civclient() { local cur prev words cword diff --git a/completions/freeciv-server b/completions/freeciv-server new file mode 100644 index 00000000..3def8bf1 --- /dev/null +++ b/completions/freeciv-server @@ -0,0 +1,28 @@ +# freeciv-server completion + +_civserver() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -f|-g|-l|-r|--file|--log|--gamelog|--read) + _filedir + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + fi + +} && +complete -F _civserver civserver freeciv-server + +# 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 diff --git a/completions/function b/completions/function new file mode 100644 index 00000000..4916b2ac --- /dev/null +++ b/completions/function @@ -0,0 +1,28 @@ +# bash shell function completion + +_function() +{ + local cur prev words cword + _init_completion || return + + if [[ $1 == @(declare|typeset) ]]; then + if [ "$prev" = -f ]; then + COMPREPLY=( $( compgen -A function -- "$cur" ) ) + elif [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-a -f -F -i -r -x -p' -- "$cur" ) ) + fi + elif [ $cword -eq 1 ]; then + COMPREPLY=( $( compgen -A function -- "$cur" ) ) + else + COMPREPLY=( "() $( type -- ${words[1]} | sed -e 1,2d )" ) + fi +} && +complete -F _function function declare typeset + +# 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 diff --git a/completions/fuse b/completions/fusermount index 45b74234..d00cc2a8 100644 --- a/completions/fuse +++ b/completions/fusermount @@ -1,6 +1,4 @@ -# bash completion for fuse - -have fusermount || return +# fusermount completion _fusermount() { diff --git a/completions/gcc b/completions/gcc index 306bbd4f..c8825115 100644 --- a/completions/gcc +++ b/completions/gcc @@ -8,8 +8,6 @@ # ask the driver ("g++") for the name of the compiler ("cc1"), and parse the # --help output of the compiler. -have gcc || return - _gcc() { local cur prev words cword @@ -35,7 +33,8 @@ _gcc() esac if [[ "$cur" == -* ]]; then - cc=$( $1 -print-prog-name=$backend ) + cc=$( $1 -print-prog-name=$backend 2>/dev/null ) + [[ $cc ]] || return # sink stderr: # for C/C++/ObjectiveC it's useless # for FORTRAN/Java it's an error @@ -49,8 +48,8 @@ _gcc() } && complete -F _gcc gcc g++ c++ g77 gcj gpc -[[ $USERLAND == GNU || $UNAME == Cygwin ]] && \ -[ -n "${have:-}" ] && complete -F _gcc cc +[[ $OSTYPE == *cygwin* ]] || _userland GNU && _have gcc && \ + complete -F _gcc cc || : # Local variables: # mode: shell-script diff --git a/completions/gcl b/completions/gcl index d4e0cb33..f235d59a 100644 --- a/completions/gcl +++ b/completions/gcl @@ -1,8 +1,6 @@ # bash programmable completion for various Common Lisp implementations by # Nikodemus Siivola <nikodemus@random-state.net> -have gcl || return - _gcl() { local cur prev words cword diff --git a/completions/gdb b/completions/gdb index 1d3489b1..5dc832a8 100644 --- a/completions/gdb +++ b/completions/gdb @@ -1,7 +1,5 @@ # bash completion for gdb -have gdb || return - _gdb() { local cur prev words cword diff --git a/completions/genaliases b/completions/genaliases new file mode 100644 index 00000000..d0099146 --- /dev/null +++ b/completions/genaliases @@ -0,0 +1,21 @@ +# mailman genaliases completion + +_genaliases() +{ + local cur prev words cword + _init_completion || return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--quiet --help' -- "$cur" ) ) + fi + +} && +complete -F _genaliases genaliases + +# 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 diff --git a/completions/gendiff b/completions/gendiff new file mode 100644 index 00000000..51ef8a09 --- /dev/null +++ b/completions/gendiff @@ -0,0 +1,18 @@ +# gendiff(1) completion + +_gendiff() +{ + local cur prev words cword + _init_completion -o @(diff|patch) || return + + [[ $cword -eq 1 ]] && _filedir -d +} && +complete -F _gendiff gendiff + +# 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 diff --git a/completions/genisoimage b/completions/genisoimage index 77d72627..b4b11191 100644 --- a/completions/genisoimage +++ b/completions/genisoimage @@ -1,7 +1,5 @@ # bash completion for mkisofs/genisoimage -have mkisofs || have genisoimage || return - _mkisofs() { local cur prev words cword diff --git a/completions/getent b/completions/getent index 012c229a..34214442 100644 --- a/completions/getent +++ b/completions/getent @@ -1,7 +1,5 @@ # bash completion for getent -have getent || return - _getent() { local cur prev words cword split diff --git a/completions/gkrellm b/completions/gkrellm index 2b8cee87..9e915134 100644 --- a/completions/gkrellm +++ b/completions/gkrellm @@ -1,7 +1,5 @@ # gkrellm(1) completion -have gkrellm || have gkrellm2 || return - _gkrellm() { local cur prev words cword diff --git a/completions/gnatmake b/completions/gnatmake index 540e6e18..9aac664c 100644 --- a/completions/gnatmake +++ b/completions/gnatmake @@ -1,7 +1,5 @@ # Gnatmake completion by Ralf_Schroth@t-online.de (Ralf Schroth) -have gnatmake || return - _gnatmake() { local cur prev words cword diff --git a/completions/gnome-mplayer b/completions/gnome-mplayer index ee936843..396c8994 100644 --- a/completions/gnome-mplayer +++ b/completions/gnome-mplayer @@ -1,5 +1,3 @@ -have gnome-mplayer || return - _gnome_mplayer() { local cur prev words cword split diff --git a/completions/gpasswd b/completions/gpasswd new file mode 100644 index 00000000..6ac932e3 --- /dev/null +++ b/completions/gpasswd @@ -0,0 +1,31 @@ +# gpasswd(1) completion + +_gpasswd() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -a|--add|-d|--delete|-A|--administrators|-M|--members) + COMPREPLY=( $( compgen -u -- "$cur" ) ) + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + # TODO: only -A and -M can be combined + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + return 0 + fi + + COMPREPLY=( $( compgen -g -- "$cur" ) ) +} && +complete -F _gpasswd gpasswd + +# 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 diff --git a/completions/gpg b/completions/gpg index 8e16f305..233c7d4e 100644 --- a/completions/gpg +++ b/completions/gpg @@ -1,7 +1,5 @@ # bash completion for gpg -have gpg || return - _gpg() { local cur prev words cword diff --git a/completions/gpg2 b/completions/gpg2 index 1a4649c8..7ffc8e24 100644 --- a/completions/gpg2 +++ b/completions/gpg2 @@ -1,7 +1,5 @@ # gpg2(1) completion -have gpg2 || return - _gpg2() { local cur prev words cword diff --git a/completions/gprof b/completions/gprof index 6c0aa78b..66067740 100644 --- a/completions/gprof +++ b/completions/gprof @@ -1,5 +1,3 @@ -have gprof || return - _gprof() { local cur prev words cword split diff --git a/completions/groupadd b/completions/groupadd new file mode 100644 index 00000000..f074c20c --- /dev/null +++ b/completions/groupadd @@ -0,0 +1,33 @@ +# groupadd(8) completion + +_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 + -g|--gid|-K|--key|-p|--password) + return 0 + ;; + esac + + $split && return 0 + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + return 0 + fi +} && +complete -F _groupadd groupadd + +# 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 diff --git a/completions/groupdel b/completions/groupdel new file mode 100644 index 00000000..2e7af611 --- /dev/null +++ b/completions/groupdel @@ -0,0 +1,11 @@ +# groupdel(8) completion + +complete -g groupdel + +# 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 diff --git a/completions/groupmems b/completions/groupmems new file mode 100644 index 00000000..0176cd0e --- /dev/null +++ b/completions/groupmems @@ -0,0 +1,32 @@ +# groupmems(8) completion + +_groupmems() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -a|--add|-d|--delete) + COMPREPLY=( $( compgen -u -- "$cur" ) ) + return 0 + ;; + -g|--group) + COMPREPLY=( $( compgen -g -- "$cur" ) ) + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + return 0 + fi +} && +complete -F _groupmems groupmems + +# 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 diff --git a/completions/groupmod b/completions/groupmod new file mode 100644 index 00000000..73a4a791 --- /dev/null +++ b/completions/groupmod @@ -0,0 +1,35 @@ +# groupmod(8) completion + +_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 + -g|--gid|-h|--help|-n|--new-name|-p|--password) + return 0 + ;; + esac + + $split && return 0 + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + return 0 + fi + + COMPREPLY=( $( compgen -g -- "$cur" ) ) +} && +complete -F _groupmod groupmod + +# 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 diff --git a/completions/dvd+rw-tools b/completions/growisofs index 83ecd8ce..583c5499 100644 --- a/completions/dvd+rw-tools +++ b/completions/growisofs @@ -1,6 +1,4 @@ -# dvd+rw-tools completions - -have growisofs || return +# growisofs(1) completion _growisofs() { diff --git a/completions/grpck b/completions/grpck new file mode 100644 index 00000000..6a1c093b --- /dev/null +++ b/completions/grpck @@ -0,0 +1,23 @@ +# grpck(8) completion + +_grpck() +{ + local cur prev words cword + _init_completion || return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + return 0 + fi + + _filedir +} && +complete -F _grpck grpck + +# 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 diff --git a/completions/gzip b/completions/gzip index 3b33de11..4cc10c02 100644 --- a/completions/gzip +++ b/completions/gzip @@ -1,7 +1,5 @@ # bash completion for gzip -have gzip || have pigz || return - _gzip() { local cur prev words cword diff --git a/completions/bluez b/completions/hcitool index 74acdb4c..b763867b 100644 --- a/completions/bluez +++ b/completions/hcitool @@ -1,7 +1,5 @@ # bash completion for bluez utils -have hcitool || return - _bluetooth_adresses() { if [ -n "${COMP_BLUETOOTH_SCAN:-}" ]; then @@ -378,35 +376,6 @@ _hciattach() } && complete -F _hciattach hciattach -_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 - -_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 -eq 1 ]; then - COMPREPLY=( $( compgen -W 'discover switch' -- "$cur" ) ) - fi - fi -} && -complete -F _avctrl avctrl - # Local variables: # mode: shell-script # sh-basic-offset: 4 diff --git a/completions/hddtemp b/completions/hddtemp index 3e9f8256..e0afc40c 100644 --- a/completions/hddtemp +++ b/completions/hddtemp @@ -1,7 +1,5 @@ # hddtemp(8) completion -have hddtemp || return - _hddtemp() { local cur prev words cword split diff --git a/completions/hid2hci b/completions/hid2hci new file mode 100644 index 00000000..2c49cf7f --- /dev/null +++ b/completions/hid2hci @@ -0,0 +1,21 @@ +# hid2hci completion + +_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 + +# 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 diff --git a/completions/hping2 b/completions/hping2 index f30aa675..dfdd3c21 100644 --- a/completions/hping2 +++ b/completions/hping2 @@ -1,7 +1,5 @@ # bash completion for hping2 -have hping || have hping2 || have hping3 || return - _hping2() { local cur prev words cword diff --git a/completions/htpasswd b/completions/htpasswd index 7d4898b9..76b82aa4 100644 --- a/completions/htpasswd +++ b/completions/htpasswd @@ -1,7 +1,5 @@ # htpasswd(1) completion -have htpasswd || return - _htpasswd() { local cur prev words cword diff --git a/completions/iconv b/completions/iconv index 16e39037..7c4dc086 100644 --- a/completions/iconv +++ b/completions/iconv @@ -1,7 +1,5 @@ # iconv(1) completion -have iconv || return - _iconv() { local cur prev words cword split diff --git a/completions/id b/completions/id new file mode 100644 index 00000000..6c15c829 --- /dev/null +++ b/completions/id @@ -0,0 +1,24 @@ +# id(1) completion + +_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 + +# 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 diff --git a/completions/idn b/completions/idn index fba95f03..8b57ef3d 100644 --- a/completions/idn +++ b/completions/idn @@ -1,5 +1,3 @@ -have idn || return - _idn() { local cur prev words cword split diff --git a/completions/iftop b/completions/iftop index 29b48cd7..8e995771 100644 --- a/completions/iftop +++ b/completions/iftop @@ -1,7 +1,5 @@ # iftop(8) completion -have iftop || return - _iftop() { local cur prev words cword diff --git a/completions/ifupdown b/completions/ifup index 776279c4..0da6b69f 100644 --- a/completions/ifupdown +++ b/completions/ifup @@ -1,6 +1,6 @@ # Red Hat & Debian GNU/Linux if{up,down} completion -# -[ $USERLAND = GNU ] && have ifup || have ifdown || return + +_userland GNU || return 1 _ifupdown() { @@ -14,9 +14,7 @@ _ifupdown() return 0 } && -complete -F _ifupdown ifup ifdown - -have ifstatus && complete -F _ifupdown ifstatus +complete -F _ifupdown ifup ifdown ifstatus # Local variables: # mode: shell-script diff --git a/completions/info b/completions/info index 432e57e7..962dec94 100644 --- a/completions/info +++ b/completions/info @@ -1,7 +1,5 @@ # bash completion for info -have info || have pinfo || return - _info() { local cur prev words cword split diff --git a/completions/inject b/completions/inject new file mode 100644 index 00000000..1e4d9d4c --- /dev/null +++ b/completions/inject @@ -0,0 +1,32 @@ +# mailman inject completion + +_inject() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + -l|--listname) + _xfunc list_lists _mailman_lists + return 0 + ;; + esac + + $split && return 0 + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--listname --queue --help' -- "$cur" ) ) + else + _filedir + fi + +} && +complete -F _inject inject + +# 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 diff --git a/completions/module-init-tools b/completions/insmod index 9d24d16f..fa84d76e 100644 --- a/completions/module-init-tools +++ b/completions/insmod @@ -1,24 +1,7 @@ -# bash completion for Linux module-init-tools - -# Linux rmmod(8) completion. This completes on a list of all currently -# installed kernel modules. -# -have rmmod && -_rmmod() -{ - local cur prev words cword - _init_completion || return - - _installed_modules "$cur" - return 0 -} && -complete -F _rmmod rmmod - # Linux insmod(8), modprobe(8) and modinfo(8) completion. This completes on a # list of all available modules for the version of the kernel currently # running. # -have insmod || have modprobe || have modinfo && _insmod() { local cur prev words cword diff --git a/completions/installpkg b/completions/installpkg new file mode 100644 index 00000000..12997588 --- /dev/null +++ b/completions/installpkg @@ -0,0 +1,38 @@ +# Slackware Linux installpkg completion + +_installpkg() +{ + local cur prev words cword + _init_completion || return + + case "$prev" in + --root) + _filedir -d + return 0 + ;; + --priority) + COMPREPLY=( $( compgen -W 'ADD REC OPT SKP' -- "$cur" ) ) + return 0 + ;; + --tagfile) + _filedir + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--warn --md5sum --root --infobox --terse \ + --menu --ask --priority --tagfile' -- "$cur") ) + return 0 + fi + + _filedir "t[bglx]z" +} && complete -F _installpkg installpkg + +# 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 diff --git a/completions/invoke-rc.d b/completions/invoke-rc.d new file mode 100644 index 00000000..670e9968 --- /dev/null +++ b/completions/invoke-rc.d @@ -0,0 +1,45 @@ +# invoke-rc.d(8) completion +# +# 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[@]}" \ + | sed -ne "/$( sed "s/ /\\\\|/g" <<<"${options[@]}" )/p" \ + | sort | uniq -u \ + ) ) + COMPREPLY=( $( compgen -W '${valid_options[@]} ${services[@]}' -- "$cur" ) ) + elif [ -x $sysvdir/$prev ]; then + COMPREPLY=( $( compgen -W '`sed -e "y/|/ /" \ + -ne "s/^.*Usage:[ ]*[^ ]*[ ]*{*\([^}\"]*\).*$/\1/p" \ + $sysvdir/$prev`' -- "$cur" ) ) + else + COMPREPLY=() + fi + + return 0 +} && +complete -F _invoke_rc_d invoke-rc.d + +# 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 diff --git a/completions/ionice b/completions/ionice new file mode 100644 index 00000000..0af68a7a --- /dev/null +++ b/completions/ionice @@ -0,0 +1,63 @@ +# ionice(1) completion + +_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 -gt 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 + +# 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 diff --git a/completions/iproute2 b/completions/ip index c699a3f8..0d431e4f 100644 --- a/completions/iproute2 +++ b/completions/ip @@ -1,6 +1,4 @@ -# iproute2 tools completion - -have ip || return +# ip(8) completion _ip() { diff --git a/completions/ipmitool b/completions/ipmitool index 5888f16e..6a1911b2 100644 --- a/completions/ipmitool +++ b/completions/ipmitool @@ -1,7 +1,5 @@ # bash completion for ipmitool -have ipmitool || return - _ipmitool_singleline_help() { COMPREPLY=( $( compgen -W "$( $1 $2 2>&1 | \ diff --git a/completions/ipsec b/completions/ipsec index 677e1e0e..d24e80b8 100644 --- a/completions/ipsec +++ b/completions/ipsec @@ -1,6 +1,5 @@ # Linux ipsec(8) completion (for FreeS/WAN and strongSwan) # -have ipsec || return # Complete ipsec.conf conn entries. # @@ -98,7 +97,7 @@ _ipsec_strongswan() return 0 } -case "$( ipsec --version )" in +case "$( ipsec --version 2>/dev/null )" in *strongSwan*) complete -F _ipsec_strongswan ipsec ;; diff --git a/completions/iptables b/completions/iptables index ea52983f..c554a26b 100644 --- a/completions/iptables +++ b/completions/iptables @@ -1,7 +1,5 @@ # bash completion for iptables -have iptables || return - _iptables() { local cur prev words cword split diff --git a/completions/ipv6calc b/completions/ipv6calc index 9332475a..6aa4a55a 100644 --- a/completions/ipv6calc +++ b/completions/ipv6calc @@ -1,5 +1,3 @@ -have ipv6calc || return - _ipv6calc() { local cur prev words cword split diff --git a/completions/open-iscsi b/completions/iscsiadm index 6a954d86..46170635 100644 --- a/completions/open-iscsi +++ b/completions/iscsiadm @@ -1,7 +1,5 @@ # iscsiadm(1) completion -have iscsiadm || return - _iscsiadm() { local cur prev words cword split diff --git a/completions/isql b/completions/isql index 59c393b3..1e79b55d 100644 --- a/completions/isql +++ b/completions/isql @@ -1,7 +1,5 @@ # isql completion by Victor Bogado da Silva Lins <victor@bogado.net> -have isql || return - _isql() { local cur prev words cword diff --git a/completions/wireless-tools b/completions/iwconfig index 75c348ca..247d648a 100644 --- a/completions/wireless-tools +++ b/completions/iwconfig @@ -1,8 +1,5 @@ -# bash completion for Linux wireless-tools +# iwconfig completion -[ $UNAME = Linux ] || return - -have iwconfig && _iwconfig() { local cur prev words cword @@ -90,76 +87,6 @@ _iwconfig() } && complete -F _iwconfig iwconfig - -have iwlist && -_iwlist() -{ - local cur prev words cword - _init_completion || return - - if [ $cword -eq 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 - - -have iwspy && -_iwspy() -{ - local cur prev words cword - _init_completion || return - - if [ $cword -eq 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 - - -have iwpriv && -_iwpriv() -{ - local cur prev words cword - _init_completion || return - - case $prev in - roam) - COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) ) - return 0 - ;; - port) - COMPREPLY=( $( compgen -W 'ad-hoc managed' -- "$cur" ) ) - return 0 - ;; - esac - - if [ $cword -eq 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 - # Local variables: # mode: shell-script # sh-basic-offset: 4 diff --git a/completions/iwlist b/completions/iwlist new file mode 100644 index 00000000..a68ad73a --- /dev/null +++ b/completions/iwlist @@ -0,0 +1,28 @@ +# iwlist completion + +_iwlist() +{ + local cur prev words cword + _init_completion || return + + if [ $cword -eq 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 + +# 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 diff --git a/completions/iwpriv b/completions/iwpriv new file mode 100644 index 00000000..45ffadbd --- /dev/null +++ b/completions/iwpriv @@ -0,0 +1,37 @@ +# iwpriv completion + +_iwpriv() +{ + local cur prev words cword + _init_completion || return + + case $prev in + roam) + COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) ) + return 0 + ;; + port) + COMPREPLY=( $( compgen -W 'ad-hoc managed' -- "$cur" ) ) + return 0 + ;; + esac + + if [ $cword -eq 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 + +# 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 diff --git a/completions/iwspy b/completions/iwspy new file mode 100644 index 00000000..c5219b37 --- /dev/null +++ b/completions/iwspy @@ -0,0 +1,26 @@ +# iwspy completion + +_iwspy() +{ + local cur prev words cword + _init_completion || return + + if [ $cword -eq 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 + +# 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 diff --git a/completions/jar b/completions/jar index 9d199c04..84d3e30e 100644 --- a/completions/jar +++ b/completions/jar @@ -1,7 +1,5 @@ # jar(1) completion -have jar || return - _jar() { local cur prev words cword diff --git a/completions/jarsigner b/completions/jarsigner new file mode 100644 index 00000000..982f7a4b --- /dev/null +++ b/completions/jarsigner @@ -0,0 +1,62 @@ +# jarsigner(1) completion + +_jarsigner() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -keystore) + COMPREPLY=( $( compgen -W 'NONE' -- "$cur" ) ) + _filedir '@(jks|ks|p12|pfx)' + return 0 + ;; + -storepass|-keypass|-sigfile|-digestalg|-sigalg|-tsacert|-altsigner|\ + -altsignerpath|-providerName|-providerClass|-providerArg) + return 0 + ;; + -storetype) + COMPREPLY=( $( compgen -W 'JKS PKCS11 PKCS12' -- "$cur" ) ) + return 0 + ;; + -signedjar) + _filedir jar + return 0 + ;; + -tsa) + _filedir + return 0 + ;; + esac + + # Check if a jar was already given. + local i jar=false + for (( i=0; i < ${#words[@]}-1; i++ )) ; do + if [[ "${words[i]}" == *.jar && \ + "${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 + fi +} && +complete -F _jarsigner jarsigner + +# 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 diff --git a/completions/java b/completions/java index 0d51f563..bd8b6471 100644 --- a/completions/java +++ b/completions/java @@ -1,14 +1,12 @@ # bash completion for java, javac and javadoc # available path elements completion -have java || have javac || have javadoc && _java_path() { cur=${cur##*:} _filedir '@(jar|zip)' } -have java || have javadoc && { # exact classpath determination _java_find_classpath() { @@ -115,11 +113,9 @@ _java_packages() # convert path syntax to package syntax cur=${COMPREPLY[@]//\//.} } -} # java completion # -have java && _java() { local cur prev words cword @@ -234,7 +230,6 @@ _java() } && complete -F _java java -have javadoc && _javadoc() { local cur prev words cword @@ -276,7 +271,6 @@ _javadoc() } && complete -F _javadoc javadoc -have javac && _javac() { local cur prev words cword @@ -321,234 +315,6 @@ _javac() } && complete -F _javac javac -have pack200 && -_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 0 - ;; - -E|--effort) - COMPREPLY=( $( compgen -W '{0..9}' -- "$cur" ) ) - return 0 - ;; - -H|--deflate-hint) - COMPREPLY=( $( compgen -W 'true false keep' -- "$cur" ) ) - return 0 - ;; - -m|--modification-time) - COMPREPLY=( $( compgen -W 'latest keep' -- "$cur" ) ) - return 0 - ;; - -U|--unknown-attribute) - COMPREPLY=( $( compgen -W 'error strip pass' -- "$cur" ) ) - return 0 - ;; - -f|--config-file) - _filedir properties - return 0 - ;; - -l|--log-file) - COMPREPLY=( $( compgen -W '-' -- "$cur" ) ) - _filedir log - return 0 - ;; - -r|--repack) - _filedir jar - return 0 - ;; - esac - - $split && return - - # Check if a pack or a jar was already given. - local i pack=false jar=false - for (( i=0; 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 - -have unpack200 && -_unpack200() -{ - local cur prev words cword split - _init_completion -s || return - - case $prev in - '-?'|-h|--help|-V|--version|-J) - return 0 - ;; - -H|--deflate-hint) - COMPREPLY=( $( compgen -W 'true false keep' -- "$cur" ) ) - return 0 - ;; - -l|--log-file) - COMPREPLY=( $( compgen -W '-' -- "$cur" ) ) - _filedir log - return 0 - ;; - esac - - $split && return - - # Check if a pack or a jar was already given. - local i pack=false jar=false - for (( i=0; 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 '--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 - -have jarsigner && -_jarsigner() -{ - local cur prev words cword - _init_completion || return - - case $prev in - -keystore) - COMPREPLY=( $( compgen -W 'NONE' -- "$cur" ) ) - _filedir '@(jks|ks|p12|pfx)' - return 0 - ;; - -storepass|-keypass|-sigfile|-digestalg|-sigalg|-tsacert|-altsigner|\ - -altsignerpath|-providerName|-providerClass|-providerArg) - return 0 - ;; - -storetype) - COMPREPLY=( $( compgen -W 'JKS PKCS11 PKCS12' -- "$cur" ) ) - return 0 - ;; - -signedjar) - _filedir jar - return 0 - ;; - -tsa) - _filedir - return 0 - ;; - esac - - # Check if a jar was already given. - local i jar=false - for (( i=0; i < ${#words[@]}-1; i++ )) ; do - if [[ "${words[i]}" == *.jar && \ - "${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 - fi -} && -complete -F _jarsigner jarsigner - -have javaws && -_javaws() -{ - local cur prev words cword - _init_completion -n = || return - - case $prev in - -help|-license|-about|-viewer|-arg|-param|-property|-update|-umask) - return 0 - ;; - -basedir|-codebase) - _filedir -d - return 0 - ;; - -uninstall|-import) - _filedir jnlp - return 0 - ;; - esac - - if [[ $cur == *= ]]; then - return 0 - elif [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W "$( _parse_help "$1" -help ) " -- "$cur" ) ) - [[ $COMPREPLY == *= ]] && compopt -o nospace - return 0 - fi - - _filedir jnlp -} && -complete -F _javaws javaws - -have jps && -_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 - # Local variables: # mode: shell-script # sh-basic-offset: 4 diff --git a/completions/javaws b/completions/javaws new file mode 100644 index 00000000..03f6c883 --- /dev/null +++ b/completions/javaws @@ -0,0 +1,40 @@ +# javaws(1) completion + +_javaws() +{ + local cur prev words cword + _init_completion -n = || return + + case $prev in + -help|-license|-about|-viewer|-arg|-param|-property|-update|-umask) + return 0 + ;; + -basedir|-codebase) + _filedir -d + return 0 + ;; + -uninstall|-import) + _filedir jnlp + return 0 + ;; + esac + + if [[ $cur == *= ]]; then + return 0 + elif [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W "$( _parse_help "$1" -help ) " -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + return 0 + fi + + _filedir jnlp +} && +complete -F _javaws javaws + +# 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 diff --git a/completions/jps b/completions/jps new file mode 100644 index 00000000..bf62d573 --- /dev/null +++ b/completions/jps @@ -0,0 +1,31 @@ +# jps(1) completion + +_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 + +# 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 diff --git a/completions/k3b b/completions/k3b index 9f41ed5c..94a75c33 100644 --- a/completions/k3b +++ b/completions/k3b @@ -1,7 +1,5 @@ # bash completion for k3b -have k3b || return - _k3b() { local cur prev words cword diff --git a/completions/kcov b/completions/kcov index de421ff9..737b7b0f 100644 --- a/completions/kcov +++ b/completions/kcov @@ -1,5 +1,3 @@ -have kcov || return - _kcov() { local cur prev words cword split diff --git a/completions/kill b/completions/kill new file mode 100644 index 00000000..d3c5fbe7 --- /dev/null +++ b/completions/kill @@ -0,0 +1,24 @@ +# kill(1) completion + +_kill() +{ + local cur prev words cword + _init_completion || return + + if [[ $cword -eq 1 && "$cur" == -* ]]; then + # return list of available signals + _signals + else + # return list of available PIDs + _pids + fi +} && +complete -F _kill kill + +# 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 diff --git a/completions/killall b/completions/killall new file mode 100644 index 00000000..8d05d132 --- /dev/null +++ b/completions/killall @@ -0,0 +1,25 @@ +# killall(1) (Linux, FreeBSD and Darwin) and pkill(1) completion. + +_killall() +{ + local cur prev words cword + _init_completion || return + + if [[ $cword -eq 1 && "$cur" == -* ]]; then + _signals + else + _pnames + fi + + return 0 +} && +complete -F _killall pkill +[[ $OSTYPE == *@(linux|freebsd|darwin)* ]] && complete -F _killall killall || : + +# 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 diff --git a/completions/kldload b/completions/kldload index 16373160..ddd103f3 100644 --- a/completions/kldload +++ b/completions/kldload @@ -1,6 +1,6 @@ -# bash completion for FreeBSD kernel module commands +# FreeBSD kldload completion -[ $UNAME = FreeBSD ] || return +[[ $OSTYPE == *freebsd* ]] || return 1 _kldload() { @@ -19,16 +19,6 @@ _kldload() } && complete -F _kldload kldload -_kldunload() -{ - local cur prev words cword - _init_completion || return - - COMPREPLY=( $( kldstat | \ - sed -ne "s/^.*[ \t]\{1,\}\($cur[a-z_]\{1,\}\).ko$/\1/p" ) ) -} && -complete -F _kldunload kldunload - # Local variables: # mode: shell-script # sh-basic-offset: 4 diff --git a/completions/kldunload b/completions/kldunload new file mode 100644 index 00000000..3776e69c --- /dev/null +++ b/completions/kldunload @@ -0,0 +1,21 @@ +# FreeBSD kldunload completion + +[[ $OSTYPE == *freebsd* ]] || return 1 + +_kldunload() +{ + local cur prev words cword + _init_completion || return + + COMPREPLY=( $( kldstat | \ + sed -ne "s/^.*[ \t]\{1,\}\($cur[a-z_]\{1,\}\).ko$/\1/p" ) ) +} && +complete -F _kldunload kldunload + +# 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 diff --git a/completions/heimdal b/completions/ktutil index fb36f4cb..bda4ae14 100644 --- a/completions/heimdal +++ b/completions/ktutil @@ -1,6 +1,4 @@ -# bash completion for heimdal - -have ktutil || return +# ktutil completion _heimdal_principals() { diff --git a/completions/larch b/completions/larch index 081e18b0..84272995 100644 --- a/completions/larch +++ b/completions/larch @@ -1,7 +1,5 @@ # larch(1) completion by Alex Shinn <foof@synthcode.com> -have larch || return - _larch() { local cur prev words cword diff --git a/completions/lastlog b/completions/lastlog new file mode 100644 index 00000000..cadc518b --- /dev/null +++ b/completions/lastlog @@ -0,0 +1,34 @@ +# lastlog(8) completion + +_lastlog() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + -b|--before|-h|--help|-t|--time) + return 0 + ;; + -u|--user) + COMPREPLY=( $( compgen -u -- "$cur" ) ) + return 0 + ;; + esac + + $split && return 0 + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + return 0 + fi +} && +complete -F _lastlog lastlog + +# 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 diff --git a/completions/openldap b/completions/ldapsearch index 9520a5e2..7bdf29f4 100644 --- a/completions/openldap +++ b/completions/ldapsearch @@ -1,7 +1,5 @@ # bash completion for openldap -have ldapsearch || return - _ldap_uris() { COMPREPLY=( $( compgen -W 'ldap:// ldaps://' -- "$cur" ) ) diff --git a/completions/ldapvi b/completions/ldapvi index 124a3496..ea77e10d 100644 --- a/completions/ldapvi +++ b/completions/ldapvi @@ -1,7 +1,5 @@ # bash completion for ldapvi -have ldapvi || return - _ldapvi() { local cur prev words cword diff --git a/completions/lftp b/completions/lftp index 18944bc1..9e47ae16 100644 --- a/completions/lftp +++ b/completions/lftp @@ -1,6 +1,5 @@ -# bash completion for lftp +# lftp(1) completion -have lftp && _lftp() { local cur prev words cword @@ -27,18 +26,6 @@ _lftp() } && complete -F _lftp lftp -have lftpget && -_lftpget() -{ - local cur prev words cword - _init_completion || return - - if [[ "$cur" == -* ]] ; then - COMPREPLY=( $( compgen -W '-c -d -v' -- "$cur" ) ) - fi -} && -complete -F _lftpget lftpget - # Local variables: # mode: shell-script # sh-basic-offset: 4 diff --git a/completions/lftpget b/completions/lftpget new file mode 100644 index 00000000..9ed6a5c7 --- /dev/null +++ b/completions/lftpget @@ -0,0 +1,20 @@ +# lftpget(1) completion + +_lftpget() +{ + local cur prev words cword + _init_completion || return + + if [[ "$cur" == -* ]] ; then + COMPREPLY=( $( compgen -W '-c -d -v' -- "$cur" ) ) + fi +} && +complete -F _lftpget lftpget + +# 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 diff --git a/completions/lilo b/completions/lilo index ad8b2da5..712268d4 100644 --- a/completions/lilo +++ b/completions/lilo @@ -1,7 +1,5 @@ # bash completion for lilo(8) -have lilo || return - _lilo_labels() { COMPREPLY=( $( compgen -W "$( awk -F'=' '/label/ {print $2}' \ diff --git a/completions/links b/completions/links index 09a6193d..822fe439 100644 --- a/completions/links +++ b/completions/links @@ -1,7 +1,5 @@ # bash completion for links -have links || return - _links() { local cur prev words cword diff --git a/completions/lintian b/completions/lintian index b2467212..59af7a0a 100644 --- a/completions/lintian +++ b/completions/lintian @@ -3,8 +3,6 @@ # # bash completion for lintian(1) and lintian-info(1) -have lintian || return - _lintian_tags() { local match search tags diff --git a/completions/lisp b/completions/lisp index 78054e09..cb1f899d 100644 --- a/completions/lisp +++ b/completions/lisp @@ -1,8 +1,6 @@ # bash programmable completion for various Common Lisp implementations by # Nikodemus Siivola <nikodemus@random-state.net> -have lisp || return - _lisp() { local cur prev words cword diff --git a/completions/list_admins b/completions/list_admins new file mode 100644 index 00000000..6ffeafe1 --- /dev/null +++ b/completions/list_admins @@ -0,0 +1,23 @@ +# mailman list_admins completion + +_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 + +# 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 diff --git a/completions/list_lists b/completions/list_lists new file mode 100644 index 00000000..7209ea76 --- /dev/null +++ b/completions/list_lists @@ -0,0 +1,27 @@ +# mailman list_lists completion + +_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 + +# 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 diff --git a/completions/list_members b/completions/list_members new file mode 100644 index 00000000..7b49b20f --- /dev/null +++ b/completions/list_members @@ -0,0 +1,42 @@ +# mailman list_members completion + +_list_members() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + -o|--output) + _filedir + return 0 + ;; + -d|--digest) + COMPREPLY=( $( compgen -W 'mime plain' -- "$cur") ) + return 0 + ;; + -n|--nomail) + COMPREPLY=( $( compgen -W 'byadmin byuser bybounce unknown' \ + -- "$cur") ) + return 0 + ;; + esac + + $split && return 0 + + 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 + +# 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 diff --git a/completions/list_owners b/completions/list_owners new file mode 100644 index 00000000..eb88cba5 --- /dev/null +++ b/completions/list_owners @@ -0,0 +1,24 @@ +# mailman list_owners completion + +_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 + +# 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 diff --git a/completions/look b/completions/look new file mode 100644 index 00000000..e339958e --- /dev/null +++ b/completions/look @@ -0,0 +1,20 @@ +# look(1) completion + +_look() +{ + local cur prev words cword + _init_completion || return + + if [[ $cword -eq 1 ]]; then + COMPREPLY=( $( compgen -W '$(look "$cur" 2>/dev/null)' -- "$cur" ) ) + fi +} && +complete -F _look -o default look + +# 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 diff --git a/completions/lpq b/completions/lpq new file mode 100644 index 00000000..13bfc426 --- /dev/null +++ b/completions/lpq @@ -0,0 +1,34 @@ +# lpq(1) completion + +_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 0 + ;; + -U) + COMPREPLY=( $( compgen -u -- "$cur" ) ) + return 0 + ;; + esac + + if [[ "$cur" == - ]]; then + COMPREPLY=( $( compgen -W '-E -P -U -a -h -l' -- "$cur" ) ) + return 0 + fi + + _filedir +} && +complete -F _lpq lpq + +# 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 diff --git a/completions/cups b/completions/lpr index dcd8f2c9..6c121df6 100644 --- a/completions/cups +++ b/completions/lpr @@ -1,16 +1,5 @@ -# bash completion for cups +# lpr(1) completion -have cancel && -_cancel() -{ - local cur prev words cword - _init_completion || return - - COMPREPLY=( $( compgen -W "$( lpstat 2>/dev/null | cut -d' ' -f1 )" -- "$cur" ) ) -} && -complete -F _cancel cancel - -have lpr && _lpr() { local cur prev words cword @@ -41,32 +30,6 @@ _lpr() } && complete -F _lpr lpr -have lpq && -_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 0 - ;; - -U) - COMPREPLY=( $( compgen -u -- "$cur" ) ) - return 0 - ;; - esac - - if [[ "$cur" == - ]]; then - COMPREPLY=( $( compgen -W '-E -P -U -a -h -l' -- "$cur" ) ) - return 0 - fi - - _filedir -} && -complete -F _lpq lpq - # Local variables: # mode: shell-script # sh-basic-offset: 4 diff --git a/completions/lrzip b/completions/lrzip index 3622271e..50af8b48 100644 --- a/completions/lrzip +++ b/completions/lrzip @@ -1,7 +1,5 @@ # lrzip(1) completion -have lrzip || return - _lrzip() { local cur prev words cword diff --git a/completions/lsof b/completions/lsof index 1a28659a..a1e215bc 100644 --- a/completions/lsof +++ b/completions/lsof @@ -1,7 +1,5 @@ # lsof(8) completion -have lsof || return - _lsof() { local cur prev words cword diff --git a/completions/lvm b/completions/lvm index 0d7a7f53..e8823913 100644 --- a/completions/lvm +++ b/completions/lvm @@ -1,7 +1,5 @@ # bash completion for lvm -have lvm || return - _volumegroups() { COMPREPLY=( $(compgen -W "$( vgscan 2>/dev/null | \ diff --git a/completions/lzma b/completions/lzma index cb5b2ce4..415cf79c 100644 --- a/completions/lzma +++ b/completions/lzma @@ -1,7 +1,5 @@ # lzma(1) completion by Per Øyvind Karlsen <peroyvind@mandriva.org> -have lzma || return - _lzma() { local cur prev words cword diff --git a/completions/lzop b/completions/lzop index 97ca9901..41091d77 100644 --- a/completions/lzop +++ b/completions/lzop @@ -1,7 +1,5 @@ # lzop(1) completion -have lzop || return - _lzop() { local cur prev words cword diff --git a/completions/macof b/completions/macof new file mode 100644 index 00000000..6819674e --- /dev/null +++ b/completions/macof @@ -0,0 +1,29 @@ +# macof completion + +_macof() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -i) + _interfaces + return 0 + ;; + esac + + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + fi + +} && +complete -F _macof macof + +# 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 diff --git a/completions/mailman b/completions/mailman deleted file mode 100644 index 93f75fb1..00000000 --- a/completions/mailman +++ /dev/null @@ -1,517 +0,0 @@ -# mailman completion - -have list_lists && { -_mailman_lists() -{ - COMPREPLY=( $( compgen -W '$( list_lists -b )' -- "$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 -} - -have add_members && -_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 0 - ;; - -w|-a|--welcome-msg|--admin-notify) - COMPREPLY=( $( compgen -W 'y n' -- "$cur") ) - return 0 - ;; - esac - - $split && return 0 - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--regular-members-file \ - --digest-members-file --welcome-msg \ - --admin-notify --help' -- "$cur" ) ) - else - _mailman_lists - fi - -} && -complete -F _add_members add_members - -have remove_members && -_remove_members() -{ - local cur prev words cword split - _init_completion -s || return - - case $prev in - -f|--file) - _filedir - return 0 - ;; - esac - - $split && return 0 - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--file --all --fromall --nouserack \ - --noadminack --help' -- "$cur" ) ) - else - _mailman_lists - fi - -} && -complete -F _remove_members remove_members - -have find_member && -_find_member() -{ - local cur prev words cword split - _init_completion -s || return - - case $prev in - -l|-x|--listname|--exclude) - _mailman_lists - return 0 - ;; - esac - - $split && return 0 - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--listname --exclude --owners \ - --help' -- "$cur" ) ) - fi - -} && -complete -F _find_member find_member - -have clone_member && -_clone_member() -{ - local cur prev words cword split - _init_completion -s || return - - case $prev in - -l|--listname) - _mailman_lists - return 0 - ;; - esac - - $split && return 0 - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--listname --remove --admin \ - --quiet --nomodify --help' -- "$cur" ) ) - fi - -} && -complete -F _clone_member clone_member - -have sync_members && -_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 0 - ;; - -d|--file) - _filedir - return 0 - ;; - esac - - $split && return 0 - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--no-change --welcome-msg \ - --goodbye-msg --digest --notifyadmin --file --help' -- "$cur" ) ) - else - _mailman_lists - fi - -} && -complete -F _sync_members sync_members - -have unshunt && -_unshunt() -{ - local cur prev words cword - _init_completion || return - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--help' -- "$cur" ) ) - else - _filedir -d - fi - -} && -complete -F _unshunt unshunt - -have list_admins && -_list_admins() -{ - local cur prev words cword - _init_completion || return - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--all-vhost --all --help' -- "$cur" ) ) - else - _mailman_lists - fi - -} && -complete -F _list_admins list_admins - -have list_owners && -_list_owners() -{ - local cur prev words cword - _init_completion || return - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--with-listnames --moderators \ - --help' -- "$cur" ) ) - else - _mailman_lists - fi - -} && -complete -F _list_owners list_owners - -have list_members && -_list_members() -{ - local cur prev words cword split - _init_completion -s || return - - case $prev in - -o|--output) - _filedir - return 0 - ;; - -d|--digest) - COMPREPLY=( $( compgen -W 'mime plain' -- "$cur") ) - return 0 - ;; - -n|--nomail) - COMPREPLY=( $( compgen -W 'byadmin byuser bybounce unknown' \ - -- "$cur") ) - return 0 - ;; - esac - - $split && return 0 - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--output --regular --digest \ - --nomail --fullnames --preserve --help' -- "$cur" ) ) - else - _mailman_lists - fi - -} && -complete -F _list_members list_members - -have change_pw && -_change_pw() -{ - local cur prev words cword split - _init_completion -s || return - - case $prev in - -l|--listname) - _mailman_lists - return 0 - ;; - esac - - $split && return 0 - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--all --domain --listname \ - --password --quiet --help' -- "$cur" ) ) - fi - -} && -complete -F _change_pw change_pw - -have withlist && -_withlist() -{ - local cur prev words cword - _init_completion || return - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--lock --interactive \ - --run --all --quiet --help' -- "$cur" ) ) - else - _mailman_lists - fi - -} && -complete -F _withlist withlist - -have newlist && -_newlist() -{ - local cur prev words cword - _init_completion || return - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--language --quiet --help' -- "$cur" ) ) - else - _mailman_lists - fi - -} && -complete -F _newlist newlist - -have rmlist && -_rmlist() -{ - local cur prev words cword - _init_completion || return - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--archives --help' -- "$cur" ) ) - else - _mailman_lists - fi - -} && -complete -F _rmlist rmlist - -have config_list && -_config_list() -{ - local cur prev words cword split - _init_completion -s || return - - case $prev in - -i|-o|--inputfile|--outputfile) - _filedir - return 0 - ;; - esac - - $split && return 0 - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--inputfile --outputfile \ - --checkonly --verbose --help' -- "$cur" ) ) - else - _mailman_lists - fi - -} && -complete -F _config_list config_list - -# Try to detect whether this is the mailman "arch" to avoid installing -# it for the coreutils/util-linux-ng one. -have arch && 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 0 - ;; - -d|--file) - _filedir - return 0 - ;; - esac - - $split && return 0 - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--wipe --start --end --quiet \ - --help' -- "$cur" ) ) - else - local args=$cword - for (( i=1; i < cword; i++ )); do - if [[ "${words[i]}" == -* ]]; then - args=$(($args-1)) - fi - done - case $args in - 1) - _mailman_lists - ;; - 2) - _filedir - ;; - esac - fi - -} && -complete -F _arch arch - -have cleanarch && -_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 - -have inject && -_inject() -{ - local cur prev words cword split - _init_completion -s || return - - case $prev in - -l|--listname) - _mailman_lists - return 0 - ;; - esac - - $split && return 0 - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--listname --queue --help' -- "$cur" ) ) - else - _filedir - fi - -} && -complete -F _inject inject - -have dumpdb && -_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 - -have check_db && -_check_db() -{ - local cur prev words cword - _init_completion || return - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--all --verbose --help' -- "$cur" ) ) - else - _mailman_lists - fi - -} && -complete -F _check_db check_db - -have check_perms && -_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 - -have genaliases && -_genaliases() -{ - local cur prev words cword - _init_completion || return - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--quiet --help' -- "$cur" ) ) - fi - -} && -complete -F _genaliases genaliases - -have mmsitepass && -_mmsitepass() -{ - local cur prev words cword - _init_completion || return - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--listcreator --help' -- "$cur" ) ) - fi - -} && -complete -F _mmsitepass mmsitepass - -have qrunner && -_qrunner() -{ - local cur prev words cword split - _init_completion -s || return - - $split && return 0 - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--runner --once \ - --list --verbose --subproc --help' -- "$cur" ) ) - fi - -} && -complete -F _qrunner qrunner - -have mailmanctl && -_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 - -# 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 diff --git a/completions/mailmanctl b/completions/mailmanctl new file mode 100644 index 00000000..4ff61691 --- /dev/null +++ b/completions/mailmanctl @@ -0,0 +1,24 @@ +# mailmanctl completion + +_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 + +# 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 diff --git a/completions/make b/completions/make index 12dfad47..c2b73145 100644 --- a/completions/make +++ b/completions/make @@ -1,7 +1,5 @@ # bash completion for GNU make -have make || have gmake || have gnumake || have pmake || return - _make() { local cur prev words cword split diff --git a/completions/makepkg b/completions/makepkg new file mode 100644 index 00000000..f5003cad --- /dev/null +++ b/completions/makepkg @@ -0,0 +1,30 @@ +# Slackware Linux makepkg completion + +_makepkg() +{ + local cur prev words cword + _init_completion || return + + case "$prev" in + -l|--linkadd|-c|--chown) + COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-l --linkadd -p --prepend \ + -c --chown' -- "$cur") ) + return 0 + fi + + _filedir +} && complete -F _makepkg makepkg + +# 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 diff --git a/completions/man b/completions/man index 0fa17a0d..e7f82fa8 100644 --- a/completions/man +++ b/completions/man @@ -1,6 +1,8 @@ # man(1) completion -[[ $USERLAND == GNU || $UNAME == @(Darwin|FreeBSD|SunOS|Cygwin|OpenBSD) ]] && +[[ $OSTYPE == *@(darwin|freebsd|solaris|cygwin|openbsd)* ]] || _userland GNU \ + || return 1 + _man() { local cur prev words cword split diff --git a/completions/mc b/completions/mc index 27ddc0a0..8444e522 100644 --- a/completions/mc +++ b/completions/mc @@ -1,7 +1,5 @@ # bash completion for mc -have mc || return - _mc() { local cur prev words cword split diff --git a/completions/mcrypt b/completions/mcrypt index d205dba4..824907ed 100644 --- a/completions/mcrypt +++ b/completions/mcrypt @@ -1,7 +1,5 @@ # mcrypt(1) completion by Ariel Fermani <the_end@bbs.frc.utn.edu.ar> -have mcrypt || have mdecrypt || return - _mcrypt() { local cur prev words cword diff --git a/completions/mdadm b/completions/mdadm index 19647e08..d36e20b0 100644 --- a/completions/mdadm +++ b/completions/mdadm @@ -1,7 +1,5 @@ # bash completion for mdadm -have mdadm || return - _mdadm_raid_level() { local mode diff --git a/completions/mdtool b/completions/mdtool new file mode 100644 index 00000000..5b052b93 --- /dev/null +++ b/completions/mdtool @@ -0,0 +1,68 @@ +# mdtool completion + +_mdtool() +{ + local cur prev words cword + _init_completion || return + + local command i + + for (( i=0; i < ${#words[@]}-1; i++ )); do + if [[ ${words[i]} == @(build|generate-makefiles|setup) ]]; then + command=${words[i]} + fi + done + + if [[ -n "$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 0 + ;; + "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 0 + ;; + "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 0 + ;; + esac + fi + + COMPREPLY=( $( compgen -W 'gsetup build dbgen project-export \ + generate-makefiles gettext-update setup -q' -- "$cur" ) ) + + return 0 +} && +complete -F _mdtool mdtool + +# 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 diff --git a/completions/medusa b/completions/medusa index f0d538e5..a9837afa 100644 --- a/completions/medusa +++ b/completions/medusa @@ -1,7 +1,5 @@ # bash completion for medusa -have medusa || return - _medusa() { local cur prev words cword diff --git a/completions/mii-diag b/completions/mii-diag new file mode 100644 index 00000000..1b19e0c6 --- /dev/null +++ b/completions/mii-diag @@ -0,0 +1,33 @@ +# mii-diag(8) completion + +_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 0 + ;; + esac + + $split && return 0 + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + else + _available_interfaces -a + fi +} && +complete -F _mii_diag -o default mii-diag + +# 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 diff --git a/completions/mii-tool b/completions/mii-tool new file mode 100644 index 00000000..9cb4d70b --- /dev/null +++ b/completions/mii-tool @@ -0,0 +1,38 @@ +# mii-tool(8) completion + +_mii_tool() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + -F|--force) + COMPREPLY=( $( compgen -W '100baseTx-FD 100baseTx-HD \ + 10baseT-FD 10baseT-HD' -- "$cur" ) ) + return 0 + ;; + -A|--advertise) + COMPREPLY=( $( compgen -W '100baseT4 100baseTx-FD 100baseTx-HD \ + 10baseT-FD 10baseT-HD' -- "$cur" ) ) + return 0 + ;; + esac + + $split && return 0 + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + else + _available_interfaces -a + fi +} && +complete -F _mii_tool -o default mii-tool + +# 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 diff --git a/completions/minicom b/completions/minicom index 2daaf00b..fd9c0c5b 100644 --- a/completions/minicom +++ b/completions/minicom @@ -1,7 +1,5 @@ # bash completion for minicom -have minicom || return - _minicom() { local cur prev words cword diff --git a/completions/mkinitrd b/completions/mkinitrd index 9efdf8e5..122ff001 100644 --- a/completions/mkinitrd +++ b/completions/mkinitrd @@ -1,7 +1,5 @@ # bash completion for mkinitrd -have mkinitrd || return - _mkinitrd() { local cur prev words cword split diff --git a/completions/mktemp b/completions/mktemp new file mode 100644 index 00000000..cdb0e822 --- /dev/null +++ b/completions/mktemp @@ -0,0 +1,35 @@ +# mktemp(1) completion + +_mktemp() +{ + local cur prev words cword split + _init_completion -s || return + + case "$prev" in + --help|--version|--suffix) + return 0 + ;; + --tmpdir|-p) + _filedir -d + return 0 + ;; + esac + + $split && return 0 + + 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 + +# 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 diff --git a/completions/mmsitepass b/completions/mmsitepass new file mode 100644 index 00000000..a07c272a --- /dev/null +++ b/completions/mmsitepass @@ -0,0 +1,21 @@ +# mailman mmsitepass completion + +_mmsitepass() +{ + local cur prev words cword + _init_completion || return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--listcreator --help' -- "$cur" ) ) + fi + +} && +complete -F _mmsitepass mmsitepass + +# 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 diff --git a/completions/monodevelop b/completions/monodevelop index bb7aa645..50cf5784 100644 --- a/completions/monodevelop +++ b/completions/monodevelop @@ -1,6 +1,5 @@ -# Monodevelop completion +# monodevelop completion -have monodevelop && _monodevelop() { local cur prev words cword split @@ -18,66 +17,6 @@ _monodevelop() } && complete -F _monodevelop monodevelop -have mdtool && -_mdtool() -{ - local cur prev words cword - _init_completion || return - - local command i - - for (( i=0; i < ${#words[@]}-1; i++ )); do - if [[ ${words[i]} == @(build|generate-makefiles|setup) ]]; then - command=${words[i]} - fi - done - - if [[ -n "$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 0 - ;; - "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 0 - ;; - "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 0 - ;; - esac - fi - - COMPREPLY=( $( compgen -W 'gsetup build dbgen project-export \ - generate-makefiles gettext-update setup -q' -- "$cur" ) ) - - return 0 -} && -complete -F _mdtool mdtool - # Local variables: # mode: shell-script # sh-basic-offset: 4 diff --git a/completions/mount b/completions/mount index ccff0187..25f58f10 100644 --- a/completions/mount +++ b/completions/mount @@ -4,7 +4,6 @@ # query the server for a list of all available exports and complete on # that instead. # -have mount || return # Just like COMPREPLY=(`compgen -W "${COMPREPLY[*]}" -- "$cur"`), only better! # @@ -133,7 +132,6 @@ complete -F _mount -o default -o dirnames mount # umount(8) completion. This relies on the mount point being the third # space-delimited field in the output of mount(8) # -have umount && _umount() { local cur prev words cword diff --git a/completions/mplayer b/completions/mplayer index 98908c05..278d1c55 100644 --- a/completions/mplayer +++ b/completions/mplayer @@ -1,7 +1,5 @@ # mplayer(1) completion -have mplayer || have mplayer2 || have mencoder || return - _mplayer_options_list() { cur=${cur%\\} diff --git a/completions/msynctool b/completions/msynctool index 3afab814..161d6072 100644 --- a/completions/msynctool +++ b/completions/msynctool @@ -1,7 +1,5 @@ # bash completion for msynctool -have msynctool || return - _msynctool() { local cur prev words cword diff --git a/completions/mtx b/completions/mtx index e119b80c..12fa12f1 100644 --- a/completions/mtx +++ b/completions/mtx @@ -1,7 +1,5 @@ # mtx completion by Jon Middleton <jjm@ixtab.org.uk> -have mtx || return - _mtx() { local cur prev words cword @@ -12,11 +10,11 @@ _mtx() options="-f nobarcode invert noattach --version inquiry noattach \ inventory status load unload eepos first last next" - tapes=$(mtx status | \ + tapes=$(mtx status 2>/dev/null | \ awk '/Storage Element [0-9]+:Full/ { printf "%s ", $3 }') tapes=${tapes//:Full} - drives=$(mtx status | \ + drives=$(mtx status 2>/dev/null | \ awk '/Data Transfer Element [0-9]+:(Full|Empty)/ { printf "%s ", $4 }') drives=${drives//:Full} drives=${drives//:Empty} diff --git a/completions/munin-node b/completions/munin-node deleted file mode 100644 index c7af5bd3..00000000 --- a/completions/munin-node +++ /dev/null @@ -1,102 +0,0 @@ -# bash completion for munin node - -have munin-run && -_munin_run() -{ - local cur prev words cword - _init_completion || return - - case $prev in - --config|--sconffile) - _filedir - return 0 - ;; - --servicedir|--sconfdir) - _filedir -d - return 0 - ;; - esac - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) - else - COMPREPLY=( $( compgen -W '$( command ls /etc/munin/plugins )' \ - -- "$cur" ) ) - fi -} && -complete -F _munin_run munin-run - -have munindoc && -_munindoc() -{ - local cur prev words cword - _init_completion || return - - COMPREPLY=( $( compgen -W '$( command ls /usr/share/munin/plugins )' \ - -- "$cur" ) ) -} && -complete -F _munindoc munindoc - -have munin-update && -_munin_update() -{ - local cur prev words cword - _init_completion || return - - case $prev in - --config) - _filedir - return 0 - ;; - --host) - _known_hosts_real "$cur" - return 0 - ;; - esac - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--force-root --[no]force-root \ - --service --host --config --help --debug --nodebug \ - --fork --nofork --stdout --nostdout --timeout' -- "$cur" ) ) - fi -} && -complete -F _munin_update munin-update - -have munin-node-configure && -_munin_node_configure() -{ - local cur prev words cword - _init_completion || return - - case $prev in - --config) - _filedir - return 0 - ;; - --servicedir|--libdir) - _filedir -d - return 0 - ;; - --snmp) - _known_hosts_real "$cur" - return 0 - ;; - --snmpversion) - COMPREPLY=( $( compgen -W '1 2c 3' -- "$cur" ) ) - return 0 - ;; - esac - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) - fi -} && -complete -F _munin_node_configure munin-node-configure - -# 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 diff --git a/completions/munin-node-configure b/completions/munin-node-configure new file mode 100644 index 00000000..2e4e4b16 --- /dev/null +++ b/completions/munin-node-configure @@ -0,0 +1,39 @@ +# munin-node-configure completion + +_munin_node_configure() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --config) + _filedir + return 0 + ;; + --servicedir|--libdir) + _filedir -d + return 0 + ;; + --snmp) + _known_hosts_real "$cur" + return 0 + ;; + --snmpversion) + COMPREPLY=( $( compgen -W '1 2c 3' -- "$cur" ) ) + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + fi +} && +complete -F _munin_node_configure munin-node-configure + +# 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 diff --git a/completions/munin-run b/completions/munin-run new file mode 100644 index 00000000..03c686d0 --- /dev/null +++ b/completions/munin-run @@ -0,0 +1,34 @@ +# munin-run completion + +_munin_run() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --config|--sconffile) + _filedir + return 0 + ;; + --servicedir|--sconfdir) + _filedir -d + return 0 + ;; + 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 + +# 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 diff --git a/completions/munin-update b/completions/munin-update new file mode 100644 index 00000000..d7799fbf --- /dev/null +++ b/completions/munin-update @@ -0,0 +1,33 @@ +# munin-update completion + +_munin_update() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --config) + _filedir + return 0 + ;; + --host) + _known_hosts_real "$cur" + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--force-root --[no]force-root \ + --service --host --config --help --debug --nodebug \ + --fork --nofork --stdout --nostdout --timeout' -- "$cur" ) ) + fi +} && +complete -F _munin_update munin-update + +# 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 diff --git a/completions/munindoc b/completions/munindoc new file mode 100644 index 00000000..527037ee --- /dev/null +++ b/completions/munindoc @@ -0,0 +1,19 @@ +# munindoc completion + +_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 + +# 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 diff --git a/completions/mutt b/completions/mutt index c5d5d1f6..374e2f1b 100644 --- a/completions/mutt +++ b/completions/mutt @@ -3,8 +3,6 @@ # 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. -have mutt || have muttng || return - # @param $1 (cur) Current word to complete _muttaddr() { @@ -97,7 +95,7 @@ _muttquery() local cur=$1 querycmd muttcmd=${words[0]} local -a queryresults - querycmd="$( $muttcmd -Q query_command | sed -e 's|^query_command=\"\(.*\)\"$|\1|' -e 's|%s|'$cur'|' )" + querycmd="$( $muttcmd -Q query_command 2>/dev/null | sed -e 's|^query_command=\"\(.*\)\"$|\1|' -e 's|%s|'$cur'|' )" if [[ -z "$cur" || -z "$querycmd" ]]; then queryresults=() else @@ -119,7 +117,7 @@ _muttfiledir() muttrc=$(_muttrc) if [[ $cur == [=+]* ]]; then - folder="$( $muttcmd -F "$muttrc" -Q folder | sed -e 's|^folder=\"\(.*\)\"$|\1|' )" + folder="$( $muttcmd -F "$muttrc" -Q folder 2>/dev/null | sed -e 's|^folder=\"\(.*\)\"$|\1|' )" : folder:=~/Mail # Match any file in $folder beginning with $cur @@ -129,7 +127,7 @@ _muttfiledir() COMPREPLY=( ${COMPREPLY[@]#$folder/} ) return 0 elif [ "$cur" == !* ]; then - spoolfile="$( $muttcmd -F "$muttrc" -Q spoolfile | \ + spoolfile="$( $muttcmd -F "$muttrc" -Q spoolfile 2>/dev/null | \ sed -e 's|^spoolfile=\"\(.*\)\"$|\1|' )" [ ! -z "$spoolfile" ] && eval cur="${cur/^!/$spoolfile}" fi diff --git a/completions/mysql b/completions/mysql index b2c69d94..24fc7da4 100644 --- a/completions/mysql +++ b/completions/mysql @@ -1,7 +1,5 @@ # mysql(1) completion -have mysql || return - _mysql() { local cur prev words cword split diff --git a/completions/mysqladmin b/completions/mysqladmin index b14a90bb..d79460b8 100644 --- a/completions/mysqladmin +++ b/completions/mysqladmin @@ -1,7 +1,5 @@ # bash completion for mysqladmin -have mysqladmin || return - _mysqladmin() { local cur prev words cword split diff --git a/completions/ncftp b/completions/ncftp index 9492efcc..58c7b7fc 100644 --- a/completions/ncftp +++ b/completions/ncftp @@ -1,7 +1,5 @@ # bash completion for ncftp -have ncftp || return - _ncftp() { local cur prev words cword diff --git a/completions/net-tools b/completions/net-tools deleted file mode 100644 index 97297b19..00000000 --- a/completions/net-tools +++ /dev/null @@ -1,117 +0,0 @@ -# bash completion for net tools - -have mii-tool && -_mii_tool() -{ - local cur prev words cword split - _init_completion -s || return - - case $prev in - -F|--force) - COMPREPLY=( $( compgen -W '100baseTx-FD 100baseTx-HD \ - 10baseT-FD 10baseT-HD' -- "$cur" ) ) - return 0 - ;; - -A|--advertise) - COMPREPLY=( $( compgen -W '100baseT4 100baseTx-FD 100baseTx-HD \ - 10baseT-FD 10baseT-HD' -- "$cur" ) ) - return 0 - ;; - esac - - $split && return 0 - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) - [[ $COMPREPLY == *= ]] && compopt -o nospace - else - _available_interfaces -a - fi -} && -complete -F _mii_tool -o default mii-tool - -have mii-diag && -_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 0 - ;; - esac - - $split && return 0 - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) - else - _available_interfaces -a - fi -} && -complete -F _mii_diag -o default mii-diag - -# Linux route(8) completion -# -[ $UNAME = Linux ] && have route && -_route() -{ - local cur prev words cword - _init_completion || return - - if [ "$prev" = dev ]; then - _available_interfaces - return 0 - 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[${#COMPREPLY[@]}]="$opt" - done - - COMPREPLY=( $( compgen -W '"${COMPREPLY[@]}"' -- "$cur" ) ) -} && -complete -F _route route - -have ether-wake && -_ether_wake() -{ - local cur prev words cword - _init_completion -n : || return - - case $prev in - -i) - _available_interfaces - return 0 - ;; - -p) - return 0 - ;; - esac - - if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" -u ) -V' -- "$cur" ) ) - return 0 - fi - - _mac_addresses -} && -complete -F _ether_wake ether-wake - -# 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 diff --git a/completions/newgrp b/completions/newgrp new file mode 100644 index 00000000..c3979546 --- /dev/null +++ b/completions/newgrp @@ -0,0 +1,22 @@ +# newgrp(1) completion + +_newgrp() +{ + local cur prev words cword + _init_completion || return + + if [[ "$cur" == "-" ]]; then + COMPREPLY=( - ) + else + _allowed_groups "$cur" + fi +} && +complete -F _newgrp newgrp + +# 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 diff --git a/completions/newlist b/completions/newlist new file mode 100644 index 00000000..e5da0cfe --- /dev/null +++ b/completions/newlist @@ -0,0 +1,23 @@ +# mailman newlist completion + +_newlist() +{ + local cur prev words cword + _init_completion || return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--language --quiet --help' -- "$cur" ) ) + else + _xfunc list_lists _mailman_lists + fi + +} && +complete -F _newlist newlist + +# 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 diff --git a/completions/newusers b/completions/newusers new file mode 100644 index 00000000..1a102aac --- /dev/null +++ b/completions/newusers @@ -0,0 +1,37 @@ +# newusers(8) completion + +_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 0 + ;; + -s|--sha-rounds) + return 0 + ;; + esac + + $split && return 0 + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + return 0 + fi + + _filedir +} && +complete -F _newusers newusers + +# 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 diff --git a/completions/nmap b/completions/nmap index 2c28af18..4dcbfbc7 100644 --- a/completions/nmap +++ b/completions/nmap @@ -1,7 +1,5 @@ # bash completion for nmap -have nmap || return - _nmap() { local cur prev words cword diff --git a/completions/bind-utils b/completions/nslookup index dcb413a4..787ceeb9 100644 --- a/completions/bind-utils +++ b/completions/nslookup @@ -1,7 +1,5 @@ # bash completion for nslookup -have nslookup || have host || return - _bind_queryclass() { COMPREPLY+=( $( compgen -W 'IN CH HS ANY' -- "$cur" ) ) diff --git a/completions/ntpdate b/completions/ntpdate index 0d18f102..fd9db951 100644 --- a/completions/ntpdate +++ b/completions/ntpdate @@ -1,7 +1,5 @@ # bash completion for ntpdate -have ntpdate || return - _ntpdate() { local cur prev words cword diff --git a/completions/openssl b/completions/openssl index 68eaa167..b3573877 100644 --- a/completions/openssl +++ b/completions/openssl @@ -1,7 +1,5 @@ # bash completion for openssl -have openssl || return - _openssl_sections() { local config f diff --git a/completions/p4 b/completions/p4 index d18b679d..40fb6f58 100644 --- a/completions/p4 +++ b/completions/p4 @@ -1,7 +1,5 @@ # Perforce completion by Frank Cusack <frank@google.com> -have p4 || return - _p4() { local cur prev words cword @@ -10,7 +8,7 @@ _p4() local p4commands p4filetypes # rename isn't really a command - p4commands="$( p4 help commands | awk 'NF>3 {print $1}' )" + 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" diff --git a/completions/pack200 b/completions/pack200 new file mode 100644 index 00000000..49829ebb --- /dev/null +++ b/completions/pack200 @@ -0,0 +1,81 @@ +# pack200(1) completion + +_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 0 + ;; + -E|--effort) + COMPREPLY=( $( compgen -W '{0..9}' -- "$cur" ) ) + return 0 + ;; + -H|--deflate-hint) + COMPREPLY=( $( compgen -W 'true false keep' -- "$cur" ) ) + return 0 + ;; + -m|--modification-time) + COMPREPLY=( $( compgen -W 'latest keep' -- "$cur" ) ) + return 0 + ;; + -U|--unknown-attribute) + COMPREPLY=( $( compgen -W 'error strip pass' -- "$cur" ) ) + return 0 + ;; + -f|--config-file) + _filedir properties + return 0 + ;; + -l|--log-file) + COMPREPLY=( $( compgen -W '-' -- "$cur" ) ) + _filedir log + return 0 + ;; + -r|--repack) + _filedir jar + return 0 + ;; + esac + + $split && return + + # Check if a pack or a jar was already given. + local i pack=false jar=false + for (( i=0; 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 + +# 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 diff --git a/completions/passwd b/completions/passwd new file mode 100644 index 00000000..66f7773e --- /dev/null +++ b/completions/passwd @@ -0,0 +1,29 @@ +# passwd(1) completion + +_passwd() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -n|--minimum|-x|--maximum|-w|--warning|-i|--inactive|-\?|--help|--usage) + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + return 0 + fi + + _allowed_users +} && +complete -F _passwd passwd + +# 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 diff --git a/completions/perl b/completions/perl index eeea0eb2..4ec55a2b 100644 --- a/completions/perl +++ b/completions/perl @@ -1,7 +1,5 @@ # bash completion for perl -have perl || return - _perlmodules() { COMPREPLY=( $( compgen -P "$prefix" -W \ diff --git a/completions/pgrep b/completions/pgrep new file mode 100644 index 00000000..3c329ba2 --- /dev/null +++ b/completions/pgrep @@ -0,0 +1,44 @@ +# pgrep(1) completion. + +_pgrep() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -d|-g|-s|-t) + return + ;; + -G) + _gids + return + ;; + -P) + _pids + return + ;; + -u|-U) + _uids + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + return + fi + + _pnames +} && +complete -F _pgrep pgrep + +# Linux pidof(8) completion. +[[ $OSTYPE == *linux* ]] && complete -F _pgrep pidof + +# 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 diff --git a/completions/pine b/completions/pine index a8f15736..e37cbd9c 100644 --- a/completions/pine +++ b/completions/pine @@ -1,7 +1,5 @@ # PINE address-book completion -have pine || have alpine || return - _pineaddr() { local cur prev words cword diff --git a/completions/iputils b/completions/ping index 236cf878..01cb581a 100644 --- a/completions/iputils +++ b/completions/ping @@ -1,4 +1,5 @@ -have ping || have ping6 && +# ping(8) completion + _ping() { local cur prev words cword @@ -57,58 +58,6 @@ _ping() } && complete -F _ping ping ping6 - -have tracepath || have tracepath6 && -_tracepath() -{ - local cur prev words cword - _init_completion || return - - case $prev in - -l) - return - ;; - esac - - if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) - return - fi - - _known_hosts_real "$cur" -} && -complete -F _tracepath tracepath tracepath6 - - -have arping && -_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 - # Local variables: # mode: shell-script # sh-basic-offset: 4 diff --git a/completions/pkg-config b/completions/pkg-config index b30fa557..aa89eed8 100644 --- a/completions/pkg-config +++ b/completions/pkg-config @@ -1,7 +1,5 @@ # bash completion for pkgconfig -have pkg-config || return - _pkg_config() { local cur prev words cword split diff --git a/completions/pkg_install b/completions/pkg_delete index 52545557..40b7cc38 100644 --- a/completions/pkg_install +++ b/completions/pkg_delete @@ -1,6 +1,6 @@ # bash completion for FreeBSD base package management tools -[ $UNAME = FreeBSD ] || return +[[ $OSTYPE == *freebsd* ]] || return 1 _pkg_delete() { @@ -16,7 +16,7 @@ _pkg_delete() return 0 } && -complete -F _pkg_delete -o dirnames pkg_delete pkg_info +complete -F _pkg_delete -o dirnames pkg_delete pkg_info pkg_deinstall # Local variables: # mode: shell-script diff --git a/completions/pkgtool b/completions/pkgtool new file mode 100644 index 00000000..d9e5815a --- /dev/null +++ b/completions/pkgtool @@ -0,0 +1,42 @@ +# Slackware Linux pkgtool completion + +_pkgtool() +{ + local cur prev words cword + _init_completion || return + + case "$prev" in + --source_dir|--target_dir) + _filedir -d + return 0 + ;; + --sets) + # argument required but no completions available + return 0 + ;; + --source_device) + COMPREPLY=( $( compgen -f -d -- "${cur:-/dev/}" ) ) + return 0 + ;; + --tagfile) + _filedir + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--sets --ignore-tagfiles --tagfile \ + --source-mounted --source_dir --target_dir --source_device' \ + -- "$cur" ) ) + return 0 + fi +} && +complete -F _pkgtool pkgtool + +# 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 diff --git a/completions/pkgtools b/completions/pkgtools deleted file mode 100644 index e760f8ff..00000000 --- a/completions/pkgtools +++ /dev/null @@ -1,133 +0,0 @@ -# bash completion for Slackware Linux pkgtools - -[ -f /etc/slackware-version ] || return - - -have pkgtool && -_pkgtool() -{ - local cur prev words cword - _init_completion || return - - case "$prev" in - --source_dir|--target_dir) - _filedir -d - return 0 - ;; - --sets) - # argument required but no completions available - return 0 - ;; - --source_device) - COMPREPLY=( $( compgen -f -d -- "${cur:-/dev/}" ) ) - return 0 - ;; - --tagfile) - _filedir - return 0 - ;; - esac - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--sets --ignore-tagfiles --tagfile \ - --source-mounted --source_dir --target_dir --source_device' \ - -- "$cur" ) ) - return 0 - fi -} && -complete -F _pkgtool pkgtool - -have removepkg && -_removepkg() -{ - local cur prev words cword - _init_completion || return - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-copy -keep -preserve -warn' \ - -- "$cur" ) ) - return 0 - fi - - local root=${ROOT:-/} - COMPREPLY=( $( cd "$root/var/log/packages" 2> /dev/null || return 1 ; \ - compgen -f -- "$cur" ) ) -} && -complete -F _removepkg removepkg - -have upgradepkg && -_upgradepkg() -{ - local cur prev words cword - _init_completion || return - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--dry-run --install-new --reinstall \ - --verbose' -- "$cur") ) - return 0 - fi - - _filedir "t[bglx]z" -} && complete -F _upgradepkg upgradepkg - -have installpkg && -_installpkg() -{ - local cur prev words cword - _init_completion || return - - case "$prev" in - --root) - _filedir -d - return 0 - ;; - --priority) - COMPREPLY=( $( compgen -W 'ADD REC OPT SKP' -- "$cur" ) ) - return 0 - ;; - --tagfile) - _filedir - return 0 - ;; - esac - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--warn --md5sum --root --infobox --terse \ - --menu --ask --priority --tagfile' -- "$cur") ) - return 0 - fi - - _filedir "t[bglx]z" -} && complete -F _installpkg installpkg - -have makepkg && -_makepkg() -{ - local cur prev words cword - _init_completion || return - - case "$prev" in - -l|--linkadd|-c|--chown) - COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) - return 0 - ;; - esac - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-l --linkadd -p --prepend \ - -c --chown' -- "$cur") ) - return 0 - fi - - _filedir -} && complete -F _makepkg makepkg - -have explodepkg && -complete -o plusdirs -f -X '!*.t[bglx]z' explodepkg - -# 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 diff --git a/completions/pm-hibernate b/completions/pm-hibernate new file mode 100644 index 00000000..da22ba8b --- /dev/null +++ b/completions/pm-hibernate @@ -0,0 +1,18 @@ +# bash completion for pm-utils + +_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 + +# 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 diff --git a/completions/pm-is-supported b/completions/pm-is-supported new file mode 100644 index 00000000..c883c74b --- /dev/null +++ b/completions/pm-is-supported @@ -0,0 +1,19 @@ +# pm-is-supported(1) completion + +_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 + +# 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 diff --git a/completions/pm-powersave b/completions/pm-powersave new file mode 100644 index 00000000..afa1c85b --- /dev/null +++ b/completions/pm-powersave @@ -0,0 +1,18 @@ +# pm-powersave(8) completion + +_pm_powersave() +{ + local cur prev words cword + _init_completion || return + + COMPREPLY=( $( compgen -W "true false" -- "$cur" ) ) +} && +complete -F _pm_powersave pm-powersave + +# 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 diff --git a/completions/pm-utils b/completions/pm-utils deleted file mode 100644 index 3d4f2fe8..00000000 --- a/completions/pm-utils +++ /dev/null @@ -1,40 +0,0 @@ -# bash completion for pm-utils - -have pm-is-supported && -_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 - -have pm-hibernate || have pm-suspend || have pm-suspend-hybrid && -_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 - -have pm-powersave && -_pm_powersave() -{ - local cur prev words cword - _init_completion || return - - COMPREPLY=( $( compgen -W "true false" -- "$cur" ) ) -} && -complete -F _pm_powersave pm-powersave - -# 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 diff --git a/completions/portinstall b/completions/portinstall new file mode 100644 index 00000000..1ff82f5c --- /dev/null +++ b/completions/portinstall @@ -0,0 +1,38 @@ +# bash completion for FreeBSD portinstall + +_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 0 + + 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[@]}" ) + + return 0 +} && +complete -F _portinstall -o dirnames portinstall + +# 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 diff --git a/completions/portupgrade b/completions/portupgrade index 0e8a20b3..9999b265 100644 --- a/completions/portupgrade +++ b/completions/portupgrade @@ -1,6 +1,5 @@ -# bash completion for FreeBSD portupgrade package +# bash completion for FreeBSD portupgrade -have portupgrade && _portupgrade() { local cur prev words cword @@ -18,39 +17,6 @@ _portupgrade() } && complete -F _portupgrade -o dirnames portupgrade -have portinstall && -_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 0 - - COMPREPLY=( $( command grep -E "^$cur" < $indexfile | cut -d'|' -f1 ) ) - COMPREPLY2=( $( command grep -E "^[^\|]+\|$portsdir$cur" < $indexfile | \ - cut -d'|' -f2 ) ) - COMPREPLY2=( ${COMPREPLY2[@]#$portsdir} ) - COMPREPLY+=( "${COMPREPLY2[@]}" ) - - return 0 -} && -complete -F _portinstall -o dirnames portinstall - -# _pkg_delete is in pkg_install -declare -F _pkg_delete &>/dev/null && have pkg_deinstall && \ -complete -F _pkg_delete -o dirnames pkg_deinstall - # Local variables: # mode: shell-script # sh-basic-offset: 4 diff --git a/completions/postcat b/completions/postcat new file mode 100644 index 00000000..75033e78 --- /dev/null +++ b/completions/postcat @@ -0,0 +1,48 @@ +# postcat(1) completion + +_postcat() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -c) + _filedir -d + return 0 + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + return 0 + fi + + local idx qfile=0 + for idx in "${words[@]}"; do + [[ "$idx" = -q ]] && qfile=1 && break + done + if [[ $qfile -eq 1 ]]; then + local len=${#cur} pval + idx=0 + for pval in $( mailq 2>/dev/null | \ + sed -e '1d; $d; /^[^0-9A-Z]/d; /^$/d; s/[* !].*$//' ); do + if [[ "$cur" == "${pval:0:$len}" ]]; then + COMPREPLY[$idx]=$pval + idx=$(($idx+1)) + fi + done + return 0 + else + _filedir + return 0 + fi +} && +complete -F _postcat postcat + +# 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 diff --git a/completions/postconf b/completions/postconf new file mode 100644 index 00000000..4de95e4f --- /dev/null +++ b/completions/postconf @@ -0,0 +1,47 @@ +# postconf(1) completion + +_postconf() +{ + local cur prev words cword + _init_completion || return + + local eqext + + case $prev in + -b|-t) + _filedir + return 0 + ;; + -c) + _filedir -d + return 0 + ;; + -e) + cur=${cur#[\"\']} + eqext='=' + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + return 0 + fi + + local len=${#cur} idx=0 pval + for pval in $( /usr/sbin/postconf 2>/dev/null | cut -d ' ' -f 1 ); do + if [[ "$cur" == "${pval:0:$len}" ]]; then + COMPREPLY[$idx]="$pval$eqext" + idx=$(($idx+1)) + fi + done + return 0 +} && +complete -F _postconf postconf + +# 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 diff --git a/completions/postfix b/completions/postfix index b950b1d4..5743b7a2 100644 --- a/completions/postfix +++ b/completions/postfix @@ -1,9 +1,5 @@ -# bash completion for postfix +# postfix(1) completion -have postfix || return - -# postfix(1) -# _postfix() { local cur prev words cword @@ -30,190 +26,6 @@ _postfix() } && complete -F _postfix postfix -# postalias(1) and postmap(1) -# -_postmap() -{ - local cur prev words cword - _init_completion || return - - case $prev in - -c) - _filedir -d - return 0 - ;; - -[dq]) - return 0 - ;; - esac - - if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) - return 0 - fi - - if [[ "$cur" == *:* ]]; then - compopt -o filenames - COMPREPLY=( $( compgen -f -- "${cur#*:}" ) ) - else - local len=${#cur} idx=0 pval - for pval in $( /usr/sbin/postconf -m ); do - if [[ "$cur" == "${pval:0:$len}" ]]; then - COMPREPLY[$idx]="$pval:" - idx=$(($idx+1)) - fi - done - if [[ $idx -eq 0 ]]; then - compopt -o filenames - COMPREPLY=( $( compgen -f -- "$cur" ) ) - fi - fi - return 0 -} && -complete -F _postmap postmap postalias - -# postcat(1) -# -_postcat() -{ - local cur prev words cword - _init_completion || return - - case $prev in - -c) - _filedir -d - return 0 - ;; - esac - - if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) - return 0 - fi - - local idx qfile=0 - for idx in "${words[@]}"; do - [[ "$idx" = -q ]] && qfile=1 && break - done - if [[ $qfile -eq 1 ]]; then - local len=${#cur} pval - idx=0 - for pval in $( mailq 2>/dev/null | \ - sed -e '1d; $d; /^[^0-9A-Z]/d; /^$/d; s/[* !].*$//' ); do - if [[ "$cur" == "${pval:0:$len}" ]]; then - COMPREPLY[$idx]=$pval - idx=$(($idx+1)) - fi - done - return 0 - else - _filedir - return 0 - fi -} && -complete -F _postcat postcat - -# postconf(1) -# -_postconf() -{ - local cur prev words cword - _init_completion || return - - local eqext - - case $prev in - -b|-t) - _filedir - return 0 - ;; - -c) - _filedir -d - return 0 - ;; - -e) - cur=${cur#[\"\']} - eqext='=' - ;; - esac - - if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) - return 0 - fi - - local len=${#cur} idx=0 pval - for pval in $( /usr/sbin/postconf 2>/dev/null | cut -d ' ' -f 1 ); do - if [[ "$cur" == "${pval:0:$len}" ]]; then - COMPREPLY[$idx]="$pval$eqext" - idx=$(($idx+1)) - fi - done - return 0 -} && -complete -F _postconf postconf - -# postsuper(1) -# -_postsuper() -{ - local cur prev words cword - _init_completion || return - - local pval len idx - - case $prev in - -c) - _filedir -d - return 0 - ;; - -[dr]) - len=${#cur} - idx=0 - for pval in ALL $( mailq 2>/dev/null | \ - sed -e '1d; $d; /^[^0-9A-Z]/d; /^$/d; s/[* !].*$//' ); do - if [[ "$cur" == "${pval:0:$len}" ]]; then - COMPREPLY[$idx]=$pval - idx=$(($idx+1)) - fi - done - return 0 - ;; - -h) - len=${#cur} - idx=0 - for pval in ALL $( mailq 2>/dev/null | \ - sed -e '1d; $d; /^[^0-9A-Z]/d; /^$/d; s/[* ].*$//; /!$/d' ); do - if [[ "$cur" == "${pval:0:$len}" ]]; then - COMPREPLY[$idx]=$pval - idx=$(($idx+1)) - fi - done - return 0 - ;; - -H) - len=${#cur} - idx=0 - for pval in ALL $( mailq 2>/dev/null | \ - sed -e '1d; $d; /^[^0-9A-Z]/d; /^$/d; /^[0-9A-Z]*[* ]/d; s/!.*$//' ); do - if [[ "$cur" == "${pval:0:$len}" ]]; then - COMPREPLY[$idx]=$pval - idx=$(($idx+1)) - fi - done - return 0 - ;; - esac - - if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) - return 0 - fi - - COMPREPLY=( $( compgen -W 'hold incoming active deferred' -- "$cur" ) ) -} && -complete -F _postsuper postsuper - # Local variables: # mode: shell-script # sh-basic-offset: 4 diff --git a/completions/postmap b/completions/postmap new file mode 100644 index 00000000..ac59711d --- /dev/null +++ b/completions/postmap @@ -0,0 +1,49 @@ +# postalias(1) and postmap(1) completion + +_postmap() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -c) + _filedir -d + return 0 + ;; + -[dq]) + return 0 + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + return 0 + fi + + if [[ "$cur" == *:* ]]; then + compopt -o filenames + COMPREPLY=( $( compgen -f -- "${cur#*:}" ) ) + else + local len=${#cur} idx=0 pval + for pval in $( /usr/sbin/postconf -m 2>/dev/null ); do + if [[ "$cur" == "${pval:0:$len}" ]]; then + COMPREPLY[$idx]="$pval:" + idx=$(($idx+1)) + fi + done + if [[ $idx -eq 0 ]]; then + compopt -o filenames + COMPREPLY=( $( compgen -f -- "$cur" ) ) + fi + fi + return 0 +} && +complete -F _postmap postmap postalias + +# 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 diff --git a/completions/postsuper b/completions/postsuper new file mode 100644 index 00000000..cfa867c6 --- /dev/null +++ b/completions/postsuper @@ -0,0 +1,68 @@ +# postsuper(1) completion + +_postsuper() +{ + local cur prev words cword + _init_completion || return + + local pval len idx + + case $prev in + -c) + _filedir -d + return 0 + ;; + -[dr]) + len=${#cur} + idx=0 + for pval in ALL $( mailq 2>/dev/null | \ + sed -e '1d; $d; /^[^0-9A-Z]/d; /^$/d; s/[* !].*$//' ); do + if [[ "$cur" == "${pval:0:$len}" ]]; then + COMPREPLY[$idx]=$pval + idx=$(($idx+1)) + fi + done + return 0 + ;; + -h) + len=${#cur} + idx=0 + for pval in ALL $( mailq 2>/dev/null | \ + sed -e '1d; $d; /^[^0-9A-Z]/d; /^$/d; s/[* ].*$//; /!$/d' ); do + if [[ "$cur" == "${pval:0:$len}" ]]; then + COMPREPLY[$idx]=$pval + idx=$(($idx+1)) + fi + done + return 0 + ;; + -H) + len=${#cur} + idx=0 + for pval in ALL $( mailq 2>/dev/null | \ + sed -e '1d; $d; /^[^0-9A-Z]/d; /^$/d; /^[0-9A-Z]*[* ]/d; s/!.*$//' ); do + if [[ "$cur" == "${pval:0:$len}" ]]; then + COMPREPLY[$idx]=$pval + idx=$(($idx+1)) + fi + done + return 0 + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + return 0 + fi + + COMPREPLY=( $( compgen -W 'hold incoming active deferred' -- "$cur" ) ) +} && +complete -F _postsuper postsuper + +# 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 diff --git a/completions/povray b/completions/povray index c663ed08..0a853550 100644 --- a/completions/povray +++ b/completions/povray @@ -1,7 +1,5 @@ # povray completion by "David Necas (Yeti)" <yeti@physics.muni.cz> -have povray || have xpovray || have spovray || return - _povray() { local cur prev words cword diff --git a/completions/prelink b/completions/prelink index 017d543a..ade3258d 100644 --- a/completions/prelink +++ b/completions/prelink @@ -1,5 +1,3 @@ -have prelink || return - _prelink() { local cur prev words cword split diff --git a/completions/procps b/completions/procps deleted file mode 100644 index b12b936e..00000000 --- a/completions/procps +++ /dev/null @@ -1,132 +0,0 @@ -# Completions for tools included in procps and related - -# killall(1) (Linux, FreeBSD and Darwin) and pkill(1) completion. -# -[[ $UNAME == @(Linux|FreeBSD|Darwin) ]] || have pkill && -_killall() -{ - local cur prev words cword - _init_completion || return - - if [[ $cword -eq 1 && "$cur" == -* ]]; then - _signals - else - _pnames - fi - - return 0 -} -[[ $UNAME == @(Linux|FreeBSD|Darwin) ]] && complete -F _killall killall -have pkill && complete -F _killall pkill - -# pgrep(1) completion. -# -[ $UNAME = Linux ] || have pgrep && -_pgrep() -{ - local cur prev words cword - _init_completion || return - - case $prev in - -d|-g|-s|-t) - return - ;; - -G) - _gids - return - ;; - -P) - _pids - return - ;; - -u|-U) - _uids - return - ;; - esac - - if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) - return - fi - - _pnames -} -have pgrep && complete -F _pgrep pgrep - -# Linux pidof(8) completion. -[ $UNAME = Linux ] && complete -F _pgrep pidof - -have pwdx && -_pwdx() -{ - local cur prev words cword - _init_completion || return - - [[ $prev == -V ]] && return - - if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '-V' -- "$cur" ) ) - else - _pids - fi -} && -complete -F _pwdx pwdx - -[[ $UNAME == Linux ]] && have watch && -_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 - -h|--help|--version) - return - ;; - -n|--interval) - (( i++ )) - continue - ;; - -*) - continue - ;; - esac - offset=$i - break - done - - if [[ $offset -gt 0 ]]; then - _command_offset $offset - return - fi - - case $prev in - -d|--differences) - [[ $cur != -* ]] && \ - COMPREPLY=( $( compgen -W 'cumulative' -- "$cur" ) ) - return - ;; - -n|--interval) - return - ;; - esac - - $split && return - - if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) - [[ $COMPREPLY == *= ]] && compopt -o nospace - return - fi -} && -complete -F _watch watch - -# 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 diff --git a/completions/protoc b/completions/protoc index 26a10961..2ebae940 100644 --- a/completions/protoc +++ b/completions/protoc @@ -1,5 +1,3 @@ -have protoc || return - _protoc() { local cur prev words cword split diff --git a/completions/postgresql b/completions/psql index e3c3d122..6aeaf50c 100644 --- a/completions/postgresql +++ b/completions/psql @@ -1,7 +1,5 @@ # bash completion for Postgresql -have psql || return - _pg_databases() { # -w was introduced in 8.4, https://launchpad.net/bugs/164772 diff --git a/completions/puppet b/completions/puppet index fe4a3d32..489a85d9 100644 --- a/completions/puppet +++ b/completions/puppet @@ -1,8 +1,5 @@ # bash completion for puppet -have puppetmasterd || have puppetd || have puppetca || have ralsh || \ -have puppetrun || have puppetqd || have filebucket || have puppetdoc || return - _puppet_logdest() { if [ -z "$cur" ]; then diff --git a/completions/pwck b/completions/pwck new file mode 100644 index 00000000..478f5f9b --- /dev/null +++ b/completions/pwck @@ -0,0 +1,23 @@ +# pwck(8) completion + +_pwck() +{ + local cur prev words cword + _init_completion || return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + return 0 + fi + + _filedir +} && +complete -F _pwck pwck + +# 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 diff --git a/completions/pwdx b/completions/pwdx new file mode 100644 index 00000000..d5186711 --- /dev/null +++ b/completions/pwdx @@ -0,0 +1,24 @@ +# pwdx(1) completion + +_pwdx() +{ + local cur prev words cword + _init_completion || return + + [[ $prev == -V ]] && return + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '-V' -- "$cur" ) ) + else + _pids + fi +} && +complete -F _pwdx pwdx + +# 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 diff --git a/completions/pwgen b/completions/pwgen index 40bf376e..29bfb442 100644 --- a/completions/pwgen +++ b/completions/pwgen @@ -1,5 +1,3 @@ -have pwgen || return - _pwgen() { local cur prev words cword split diff --git a/completions/python b/completions/python index fb5f71aa..86285f43 100644 --- a/completions/python +++ b/completions/python @@ -1,7 +1,5 @@ # bash completion for python -have python || return - _python() { local cur prev words cword diff --git a/completions/qdbus b/completions/qdbus index ffdea33b..e4fa968e 100644 --- a/completions/qdbus +++ b/completions/qdbus @@ -1,7 +1,5 @@ # Qt qdbus, dcop completion -have qdbus || have dcop || return - _qdbus() { local cur prev words cword diff --git a/completions/qemu b/completions/qemu index 1e314848..320c3010 100644 --- a/completions/qemu +++ b/completions/qemu @@ -1,7 +1,5 @@ # bash completion for qemu -have qemu || return - _qemu() { local cur prev words cword diff --git a/completions/qrunner b/completions/qrunner new file mode 100644 index 00000000..1427a826 --- /dev/null +++ b/completions/qrunner @@ -0,0 +1,24 @@ +# mailman qrunner completion + +_qrunner() +{ + local cur prev words cword split + _init_completion -s || return + + $split && return 0 + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--runner --once \ + --list --verbose --subproc --help' -- "$cur" ) ) + fi + +} && +complete -F _qrunner qrunner + +# 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 diff --git a/completions/querybts b/completions/querybts new file mode 100644 index 00000000..1f2c971d --- /dev/null +++ b/completions/querybts @@ -0,0 +1,41 @@ +# querybts completion + +_querybts() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + -B|--bts) + COMPREPLY=( $( compgen -W "debian guug kde mandrake help" \ + -- "$cur" )) + return 0 + ;; + -u|--ui|--interface) + COMPREPLY=($( compgen -W "newt text gnome" -- "$cur" )) + return 0 + ;; + esac + + $split && return 0 + + COMPREPLY=($( compgen -W '-h --help -v --version -A --archive \ + -B --bts -l --ldap --no-ldap --proxy --http_proxy \ + -s --source -w --web -u --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) ) +} && +complete -F _querybts querybts + +# 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 diff --git a/completions/quota-tools b/completions/quota index e6cba919..b95c386a 100644 --- a/completions/quota-tools +++ b/completions/quota @@ -1,7 +1,5 @@ # bash completion for quota-tools -have quota || return - _user_or_group() { local i diff --git a/completions/rcs b/completions/rcs index 9b150109..f29d2e46 100644 --- a/completions/rcs +++ b/completions/rcs @@ -1,7 +1,5 @@ # bash completion for rcs -have rcs || return - _rcs() { local cur prev words cword diff --git a/completions/rdesktop b/completions/rdesktop index 20f3b482..b4b14dd9 100644 --- a/completions/rdesktop +++ b/completions/rdesktop @@ -1,7 +1,5 @@ # bash completion for rdesktop -have rdesktop || return - _rdesktop() { local cur prev words cword diff --git a/completions/remove_members b/completions/remove_members new file mode 100644 index 00000000..f0622058 --- /dev/null +++ b/completions/remove_members @@ -0,0 +1,33 @@ +# mailman remove_members completion + +_remove_members() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + -f|--file) + _filedir + return 0 + ;; + esac + + $split && return 0 + + 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 + +# 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 diff --git a/completions/removepkg b/completions/removepkg new file mode 100644 index 00000000..0152bfc3 --- /dev/null +++ b/completions/removepkg @@ -0,0 +1,25 @@ +# Slackware Linux removepkg completion + +_removepkg() +{ + local cur prev words cword + _init_completion || return + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-copy -keep -preserve -warn' \ + -- "$cur" ) ) + return 0 + fi + + local root=${ROOT:-/} + COMPREPLY=( $( cd "$root/var/log/packages" 2> /dev/null || return 1 ; \ + compgen -f -- "$cur" ) ) +} && +complete -F _removepkg removepkg + +# 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 diff --git a/completions/renice b/completions/renice new file mode 100644 index 00000000..d335b3f5 --- /dev/null +++ b/completions/renice @@ -0,0 +1,35 @@ +# renice(8) completion + +_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 -le $cword && ${#COMPREPLY[@]} -eq 0 ]]; do + curopt=${words[cword-$i]} + case "$curopt" in + -u) + _allowed_users + ;; + -g) + _pgids + ;; + -p|$command) + _pids + ;; + esac + i=$(( ++i )) + done +} && +complete -F _renice renice + +# 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 diff --git a/completions/reportbug b/completions/reportbug index 7daa3180..f2bfece7 100644 --- a/completions/reportbug +++ b/completions/reportbug @@ -1,6 +1,5 @@ -# bash completion for (Debian) reportbug package +# bash completion for (Debian) reportbug -have reportbug && _reportbug() { local cur prev words cword @@ -84,39 +83,6 @@ _reportbug() } && complete -F _reportbug reportbug -have querybts && -_querybts() -{ - local cur prev words cword split - _init_completion -s || return - - case $prev in - -B|--bts) - COMPREPLY=( $( compgen -W "debian guug kde mandrake help" \ - -- "$cur" )) - return 0 - ;; - -u|--ui|--interface) - COMPREPLY=($( compgen -W "newt text gnome" -- "$cur" )) - return 0 - ;; - esac - - $split && return 0 - - COMPREPLY=($( compgen -W '-h --help -v --version -A --archive \ - -B --bts -l --ldap --no-ldap --proxy --http_proxy \ - -s --source -w --web -u --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) ) -} && -complete -F _querybts querybts - # Local variables: # mode: shell-script # sh-basic-offset: 4 diff --git a/completions/reptyr b/completions/reptyr index 527735bb..1bc4a447 100644 --- a/completions/reptyr +++ b/completions/reptyr @@ -1,7 +1,5 @@ # bash completion for reptyr(1) -have reptyr || return - _reptyr() { local cur prev words cword diff --git a/completions/resolvconf b/completions/resolvconf index 83cbdb07..682d79ba 100644 --- a/completions/resolvconf +++ b/completions/resolvconf @@ -1,7 +1,5 @@ # bash completion for resolvconf -have resolvconf || return - _resolvconf() { local cur prev words cword diff --git a/completions/rfkill b/completions/rfkill index f0d4f1cc..c03f488a 100644 --- a/completions/rfkill +++ b/completions/rfkill @@ -1,7 +1,5 @@ # bash completion for rfkill -have rfkill || return - _rfkill() { local cur prev words cword diff --git a/completions/ri b/completions/ri index f0658d7f..0c02033a 100644 --- a/completions/ri +++ b/completions/ri @@ -1,7 +1,5 @@ # ri completion for Ruby documentation by Ian Macdonald <ian@caliban.org> -have ri || return - ri_get_methods() { local regex @@ -19,7 +17,7 @@ ri_get_methods() "$( ri ${classes[@]} 2>/dev/null | ruby -ane \ 'if /^'"$regex"' methods:/.../^------------------|^$/ and \ /^ / then print $_.split(/, |,$/).grep(/^[^\[]*$/).join("\n"); \ - end' | sort -u )" ) + end' 2>/dev/null | sort -u )" ) else # older versions of ri didn't distinguish between class/module and # instance methods @@ -63,8 +61,8 @@ _ri() if [ "$ri_version" = integrated ]; then # integrated ri from Ruby 1.9 - classes=( $( ri -c | ruby -ne 'if /^\s*$/..$stdin.eof then \ - if /, [A-Z]+/ then print; end; end' ) ) + 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_version" = "ri 1.8a" ]; then classes=( $( ruby -W0 $ri_path | \ ruby -ne 'if /^'"'"'ri'"'"' has/..$stdin.eof then \ diff --git a/completions/rmlist b/completions/rmlist new file mode 100644 index 00000000..5f77092d --- /dev/null +++ b/completions/rmlist @@ -0,0 +1,23 @@ +# mailman rmlist completion + +_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 + +# 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 diff --git a/completions/rmmod b/completions/rmmod new file mode 100644 index 00000000..50dd982c --- /dev/null +++ b/completions/rmmod @@ -0,0 +1,20 @@ +# Linux rmmod(8) completion. This completes on a list of all currently +# installed kernel modules. + +_rmmod() +{ + local cur prev words cword + _init_completion || return + + _installed_modules "$cur" + return 0 +} && +complete -F _rmmod rmmod + +# 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 diff --git a/completions/route b/completions/route new file mode 100644 index 00000000..72079e23 --- /dev/null +++ b/completions/route @@ -0,0 +1,36 @@ +# Linux route(8) completion + +[[ $OSTYPE == *linux* ]] || return 1 + +_route() +{ + local cur prev words cword + _init_completion || return + + if [ "$prev" = dev ]; then + _available_interfaces + return 0 + 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[${#COMPREPLY[@]}]="$opt" + done + + COMPREPLY=( $( compgen -W '"${COMPREPLY[@]}"' -- "$cur" ) ) +} && +complete -F _route route + +# 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 diff --git a/completions/rpcdebug b/completions/rpcdebug index ef9eabf1..22830b16 100644 --- a/completions/rpcdebug +++ b/completions/rpcdebug @@ -1,7 +1,5 @@ # bash completion for rpcdebug -have rpcdebug || return - _rpcdebug_flags() { diff --git a/completions/rpm b/completions/rpm index 883e8631..f6b65e7c 100644 --- a/completions/rpm +++ b/completions/rpm @@ -1,6 +1,5 @@ # bash completion for rpm -have rpm && { # helper functions _rpm_installed_packages() @@ -302,17 +301,6 @@ _rpmbuild() [[ -n $ext ]] && _filedir $ext } && complete -F _rpmbuild rpmbuild rpmbuild-md5 -} - -have gendiff && -_gendiff() -{ - local cur prev words cword - _init_completion -o @(diff|patch) || return - - [[ $cword -eq 1 ]] && _filedir -d -} && -complete -F _gendiff gendiff # Local variables: # mode: shell-script diff --git a/completions/rpm2tgz b/completions/rpm2tgz index 556060ad..7dc73d7c 100644 --- a/completions/rpm2tgz +++ b/completions/rpm2tgz @@ -1,7 +1,5 @@ # Slackware rpm2tgz completion. -have rpm2tgz || return - _rpm2tgz() { local cur prev words cword diff --git a/completions/rpmcheck b/completions/rpmcheck index 55db88c4..8bbc46a3 100644 --- a/completions/rpmcheck +++ b/completions/rpmcheck @@ -1,7 +1,5 @@ # bash completion for rpmcheck -have rpmcheck || return - _rpmcheck() { local cur prev words cword diff --git a/completions/rrdtool b/completions/rrdtool index aec5dbb5..909d2f4d 100644 --- a/completions/rrdtool +++ b/completions/rrdtool @@ -1,7 +1,5 @@ # bash completion for rrdtool -have rrdtool || return - _rrdtool () { local cur prev words cword diff --git a/completions/rsync b/completions/rsync index 5a70bd47..aec6ea3c 100644 --- a/completions/rsync +++ b/completions/rsync @@ -1,7 +1,5 @@ # bash completion for rsync -have rsync || return - _rsync() { local cur prev words cword split @@ -68,22 +66,19 @@ _rsync() [[ $COMPREPLY == *= ]] || compopt +o nospace ;; *:*) - if declare -F _scp_remote_files &>/dev/null; then - # 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 ] && _scp_remote_files - fi + # 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" - declare -F _scp_local_files &>/dev/null && \ - _scp_local_files || _filedir + _xfunc ssh _scp_local_files ;; esac diff --git a/completions/rtcwake b/completions/rtcwake index 021dd21c..bc2bbf39 100644 --- a/completions/rtcwake +++ b/completions/rtcwake @@ -1,7 +1,5 @@ # bash completion for rtcwake -have rtcwake || return - _rtcwake() { local cur prev words cword split diff --git a/completions/sbcl b/completions/sbcl index 85d0b437..13282696 100644 --- a/completions/sbcl +++ b/completions/sbcl @@ -1,8 +1,6 @@ # bash programmable completion for various Common Lisp implementations by # Nikodemus Siivola <nikodemus@random-state.net> -have sbcl || have sbcl-mt || return - _sbcl() { local cur prev words cword diff --git a/completions/sbopkg b/completions/sbopkg index cec466ec..d31d73b1 100644 --- a/completions/sbopkg +++ b/completions/sbopkg @@ -1,7 +1,5 @@ # bash completion for sbopkg tool -have sbopkg || return - _sbopkg() { local cur prev words cword diff --git a/completions/screen b/completions/screen index 9e4b33cf..00e93f15 100644 --- a/completions/screen +++ b/completions/screen @@ -1,7 +1,5 @@ # bash completion for screen -have screen || return - _screen_sessions() { local sessions=( $( command screen -ls | sed -ne \ diff --git a/completions/service b/completions/service index 47fde5ad..51257ab0 100644 --- a/completions/service +++ b/completions/service @@ -4,8 +4,6 @@ # 'service' command and/or the SysV init.d directory, followed by # that script's available commands -[[ -d /etc/init.d || -d /etc/rc.d/init.d ]] || have service || return - _service() { local cur prev words cword diff --git a/completions/sh b/completions/sh index 2ca56e8e..4728236d 100644 --- a/completions/sh +++ b/completions/sh @@ -1,7 +1,5 @@ # POSIX sh(1) completion -have sh || return - _sh() { local cur prev words cword diff --git a/completions/shadow b/completions/shadow deleted file mode 100644 index b3c00d89..00000000 --- a/completions/shadow +++ /dev/null @@ -1,426 +0,0 @@ -# bash completion for shadow utils - -have useradd && -_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 - -c|--comment|-h|--help|-e|--expiredate|-f|--inactive|-k|--key|\ - -p|--password|-u|--uid|-Z|--selinux-user) - return 0 - ;; - -b|--base-dir|-d|--home|-k|--skel) - _filedir -d - return 0 - ;; - -g|--gid) - _gids - COMPREPLY=( $( compgen -W '${COMPREPLY[@]} $( compgen -g )' \ - -- "$cur" ) ) - return 0 - ;; - -G|--groups) - COMPREPLY=( $( compgen -g -- "$cur" ) ) - return 0 - ;; - -s|--shell) - _shells - return 0 - ;; - esac - - $split && return 0 - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) - return 0 - fi -} && -complete -F _useradd useradd - -have usermod && -_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 - -c|--comment|-d|--home|-e|--expiredate|-f|--inactive|-h|--help|\ - -l|--login|-p|--password|-u|--uid|-Z|--selinux-user) - return 0 - ;; - -g|--gid) - _gids - COMPREPLY=( $( compgen -W '${COMPREPLY[@]} $( compgen -g )' \ - -- "$cur" ) ) - return 0 - ;; - -G|--groups) - COMPREPLY=( $( compgen -g -- "$cur" ) ) - return 0 - ;; - -s|--shell) - _shells - return 0 - ;; - esac - - $split && return 0 - - if [[ "$cur" == -* ]]; then - # TODO: -U/--unlock, -p/--password, -L/--lock mutually exclusive - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) - return 0 - fi - - COMPREPLY=( $( compgen -u -- "$cur" ) ) -} && -complete -F _usermod usermod - -have userdel && -_userdel() -{ - local cur prev words cword - _init_completion || return - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) - return 0 - fi - - COMPREPLY=( $( compgen -u -- "$cur" ) ) -} && -complete -F _userdel userdel - -have chage && -_chage() -{ - local cur prev words cword split - _init_completion -s || return - - case $prev in - -d|--lastday|-E|--expiredate|-h|--help|-I|--inactive|-m|--mindays|\ - -M|--maxdays|-W|--warndays) - return 0 - ;; - esac - - $split && return 0 - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) - return 0 - fi - - COMPREPLY=( $( compgen -u -- "$cur" ) ) -} && -complete -F _chage chage - -have passwd && -_passwd() -{ - local cur prev words cword - _init_completion || return - - case $prev in - -n|--minimum|-x|--maximum|-w|--warning|-i|--inactive|-\?|--help|--usage) - return 0 - ;; - esac - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) - return 0 - fi - - _allowed_users -} && -complete -F _passwd passwd - -have chpasswd && -_chpasswd() -{ - 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 0 - ;; - -s|--sha-rounds) - return 0 - ;; - esac - - $split && return 0 - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) - [[ $COMPREPLY == *= ]] && compopt -o nospace - return 0 - fi -} && -complete -F _chpasswd chpasswd - -have newusers && -_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 0 - ;; - -s|--sha-rounds) - return 0 - ;; - esac - - $split && return 0 - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) - [[ $COMPREPLY == *= ]] && compopt -o nospace - return 0 - fi - - _filedir -} && -complete -F _newusers newusers - -have pwck && -_pwck() -{ - local cur prev words cword - _init_completion || return - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) - return 0 - fi - - _filedir -} && -complete -F _pwck pwck - -have groupadd && -_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 - -g|--gid|-K|--key|-p|--password) - return 0 - ;; - esac - - $split && return 0 - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) - [[ $COMPREPLY == *= ]] && compopt -o nospace - return 0 - fi -} && -complete -F _groupadd groupadd - -have groupmod && -_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 - -g|--gid|-h|--help|-n|--new-name|-p|--password) - return 0 - ;; - esac - - $split && return 0 - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) - [[ $COMPREPLY == *= ]] && compopt -o nospace - return 0 - fi - - COMPREPLY=( $( compgen -g -- "$cur" ) ) -} && -complete -F _groupmod groupmod - -complete -g groupdel - -have newgrp && -_newgrp() -{ - local cur prev words cword - _init_completion || return - - if [[ "$cur" == "-" ]]; then - COMPREPLY=( - ) - else - _allowed_groups "$cur" - fi -} && -complete -F _newgrp newgrp - -have gpasswd && -_gpasswd() -{ - local cur prev words cword - _init_completion || return - - case $prev in - -a|--add|-d|--delete|-A|--administrators|-M|--members) - COMPREPLY=( $( compgen -u -- "$cur" ) ) - return 0 - ;; - esac - - if [[ "$cur" == -* ]]; then - # TODO: only -A and -M can be combined - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) - return 0 - fi - - COMPREPLY=( $( compgen -g -- "$cur" ) ) -} && -complete -F _gpasswd gpasswd - -have groupmems && -_groupmems() -{ - local cur prev words cword - _init_completion || return - - case $prev in - -a|--add|-d|--delete) - COMPREPLY=( $( compgen -u -- "$cur" ) ) - return 0 - ;; - -g|--group) - COMPREPLY=( $( compgen -g -- "$cur" ) ) - return 0 - ;; - esac - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) - return 0 - fi -} && -complete -F _groupmems groupmems - -have grpck && -_grpck() -{ - local cur prev words cword - _init_completion || return - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) - return 0 - fi - - _filedir -} && -complete -F _grpck grpck - -have vipw || have vigr && -_vipw() -{ - local cur prev words cword - _init_completion || return - - case $prev in - -h|--help) - return 0 - ;; - esac - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) - return 0 - fi -} && -complete -F _vipw vipw vigr - -have faillog && -_faillog() -{ - local cur prev words cword split - _init_completion -s || return - - case $prev in - -h|--help|-l|--lock-time|-m|--maximum|-t|--time) - return 0 - ;; - -u|--user) - COMPREPLY=( $( compgen -u -- "$cur" ) ) - return 0 - ;; - esac - - $split && return 0 - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) - [[ $COMPREPLY == *= ]] && compopt -o nospace - return 0 - fi -} && -complete -F _faillog faillog - -have lastlog && -_lastlog() -{ - local cur prev words cword split - _init_completion -s || return - - case $prev in - -b|--before|-h|--help|-t|--time) - return 0 - ;; - -u|--user) - COMPREPLY=( $( compgen -u -- "$cur" ) ) - return 0 - ;; - esac - - $split && return 0 - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) - [[ $COMPREPLY == *= ]] && compopt -o nospace - return 0 - fi -} && -complete -F _lastlog lastlog - -# 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 diff --git a/completions/sitecopy b/completions/sitecopy index 0762f87c..c12b3609 100644 --- a/completions/sitecopy +++ b/completions/sitecopy @@ -3,8 +3,6 @@ # 2011 Raphaël Droz <raphael.droz+floss@gmail.com> # License: GNU GPL v2 or later -have sitecopy || return - _sitecopy() { local cur prev words cword split diff --git a/completions/slackpkg b/completions/slackpkg index bd56f443..399563c0 100644 --- a/completions/slackpkg +++ b/completions/slackpkg @@ -1,8 +1,6 @@ # bash completion for slackpkg tool # options list is based on `grep '\-.*\=.*)' /usr/sbin/slackpkg | cut -f1 -d\)` -have slackpkg || return - _slackpkg() { local cur prev words cword diff --git a/completions/slapt b/completions/slapt-get index d493342d..f6d9f35a 100644 --- a/completions/slapt +++ b/completions/slapt-get @@ -1,6 +1,5 @@ -# slapt-get and slapt-src completion +# slapt-get completion -have slapt-get && _slapt_get() { local cur prev words cword @@ -79,64 +78,6 @@ _slapt_get() esac } && complete -F _slapt_get slapt-get -have slapt-src && -_slapt_src() -{ - local cur prev words cword - _init_completion -n : || return - - case "$prev" in - --config|-c) - _filedir - return 0 - ;; - --search|-s|--postprocess|-p) - # argument required but no completions available - return 0 - ;; - esac - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" --help )' -- "$cur" ) ) - [[ $COMPREPLY == *= ]] && compopt -o nospace - [[ $COMPREPLY ]] && return 0 - fi - - local i t - # search for last action (-i|-w|-b|-f) - for (( i=${#words[@]}-1; i>0; i-- )); do - if [[ ${words[i]} == -@(i|w|f|b|-install|-show|-build|-fetch) ]]; then - t="all" - break - fi - done - if [ "$t" != "all" ]; then - return 0 - 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]}" - break - fi - done - if [ ! -r "$config" ]; then - return 0 - fi - - if [[ "$cur" == *:* ]]; then - local name=${cur%:*} - local version=${cur##*:} - COMPREPLY=( $( slapt-src --config $config --search "^$name" 2> \ - /dev/null | sed -ne "/^$cur/{s/^$name:\([^ ]*\) .*$/\1/;p}" ) ) - else - COMPREPLY=( $( slapt-src --config $config --search "^$cur" 2>/dev/null \ - | sed -ne "/^$cur/{s/ .*$//;p}" ) ) - fi -} && complete -F _slapt_src slapt-src - # Local variables: # mode: shell-script # sh-basic-offset: 4 diff --git a/completions/slapt-src b/completions/slapt-src new file mode 100644 index 00000000..305879f9 --- /dev/null +++ b/completions/slapt-src @@ -0,0 +1,66 @@ +# slapt-src completion + +_slapt_src() +{ + local cur prev words cword + _init_completion -n : || return + + case "$prev" in + --config|-c) + _filedir + return 0 + ;; + --search|-s|--postprocess|-p) + # argument required but no completions available + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" --help )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + [[ $COMPREPLY ]] && return 0 + fi + + local i t + # search for last action (-i|-w|-b|-f) + for (( i=${#words[@]}-1; i>0; i-- )); do + if [[ ${words[i]} == -@(i|w|f|b|-install|-show|-build|-fetch) ]]; then + t="all" + break + fi + done + if [ "$t" != "all" ]; then + return 0 + 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]}" + break + fi + done + if [ ! -r "$config" ]; then + return 0 + fi + + if [[ "$cur" == *:* ]]; then + local name=${cur%:*} + local version=${cur##*:} + COMPREPLY=( $( slapt-src --config $config --search "^$name" 2> \ + /dev/null | sed -ne "/^$cur/{s/^$name:\([^ ]*\) .*$/\1/;p}" ) ) + else + COMPREPLY=( $( slapt-src --config $config --search "^$cur" 2>/dev/null \ + | sed -ne "/^$cur/{s/ .*$//;p}" ) ) + fi +} && complete -F _slapt_src slapt-src + +# 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 diff --git a/completions/smartctl b/completions/smartctl index e950f875..61ec7d66 100644 --- a/completions/smartctl +++ b/completions/smartctl @@ -1,7 +1,5 @@ # bash completion for smartctl(8) -have smartctl || return - _smartctl_quietmode() { COMPREPLY=( $( compgen -W 'errorsonly silent noserial' -- "$cur" ) ) diff --git a/completions/samba b/completions/smbclient index 4a947672..3f45ea79 100644 --- a/completions/samba +++ b/completions/smbclient @@ -1,7 +1,5 @@ # bash completion for samba -have smbclient || return - _samba_resolve_order() { COMPREPLY=( $( compgen -W 'lmhosts host wins bcast' -- "$cur" ) ) diff --git a/completions/snownews b/completions/snownews index 7cdacb54..3ba2dc79 100644 --- a/completions/snownews +++ b/completions/snownews @@ -1,7 +1,5 @@ # snownews(1) completion -have snownews || return - _snownews() { local cur prev words cword diff --git a/completions/sqlite3 b/completions/sqlite3 index fe76652a..e65e27d0 100644 --- a/completions/sqlite3 +++ b/completions/sqlite3 @@ -1,7 +1,5 @@ # sqlite3(1) completion -have sqlite3 || return - _sqlite3() { local cur prev words cword diff --git a/completions/ssh b/completions/ssh index ebce83ca..eae47b26 100644 --- a/completions/ssh +++ b/completions/ssh @@ -1,7 +1,5 @@ # ssh(1) completion -have ssh || return - _ssh_ciphers() { COMPREPLY+=( $( compgen -W '3des-cbc aes128-cbc \ @@ -387,30 +385,6 @@ _scp() } && complete -F _scp -o nospace scp -# ssh-copy-id(1) completion -# -_ssh_copy_id() -{ - local cur prev words cword - _init_completion || return - - case $prev in - -i) - _filedir - return 0 - ;; - esac - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) - else - _known_hosts_real -a "$cur" - fi - - return 0 -} && -complete -F _ssh_copy_id ssh-copy-id - # Local variables: # mode: shell-script # sh-basic-offset: 4 diff --git a/completions/ssh-copy-id b/completions/ssh-copy-id new file mode 100644 index 00000000..46829190 --- /dev/null +++ b/completions/ssh-copy-id @@ -0,0 +1,31 @@ +# ssh-copy-id(1) completion + +_ssh_copy_id() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -i) + _filedir + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) + else + _known_hosts_real -a "$cur" + fi + + return 0 +} && +complete -F _ssh_copy_id ssh-copy-id + +# 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 diff --git a/completions/sshfs b/completions/sshfs index b29d1d58..180647ee 100644 --- a/completions/sshfs +++ b/completions/sshfs @@ -1,7 +1,5 @@ # sshfs(1) completion -have sshfs || return - _sshfs() { local cur prev words cword @@ -11,8 +9,8 @@ _sshfs() _expand || return 0 - if [[ "$cur" == *:* ]] && declare -F _scp_remote_files &>/dev/null ; then - _scp_remote_files -d + if [[ "$cur" == *:* ]]; then + _xfunc ssh _scp_remote_files -d # unlike scp and rsync, sshfs works with 1 backslash instead of 3 COMPREPLY=( "${COMPREPLY[@]//\\\\\\/\\}" ) return 0 @@ -20,7 +18,7 @@ _sshfs() [[ "$cur" == @(*/|[.~])* ]] || _known_hosts_real -c -a "$cur" - declare -F _scp_local_files &>/dev/null && _scp_local_files -d + _xfunc ssh _scp_local_files -d return 0 } && diff --git a/completions/sshmitm b/completions/sshmitm new file mode 100644 index 00000000..22609826 --- /dev/null +++ b/completions/sshmitm @@ -0,0 +1,23 @@ +# sshmitm completion + +_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 + +# 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 diff --git a/completions/sshow b/completions/sshow new file mode 100644 index 00000000..fad595d7 --- /dev/null +++ b/completions/sshow @@ -0,0 +1,28 @@ +# sshow completion + +_sshow() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -i) + _interfaces + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + fi + +} && +complete -F _sshow sshow + +# 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 diff --git a/completions/strace b/completions/strace index 5d2b98d3..18ca69ef 100644 --- a/completions/strace +++ b/completions/strace @@ -1,7 +1,5 @@ # bash completion for strace -have strace || return - _strace() { local cur prev words cword diff --git a/completions/svk b/completions/svk index 3aa1b322..bccc1689 100644 --- a/completions/svk +++ b/completions/svk @@ -1,7 +1,5 @@ # svk(1) completion -have svk || return - _svk() { local cur prev words cword diff --git a/completions/sync_members b/completions/sync_members new file mode 100644 index 00000000..ba23267a --- /dev/null +++ b/completions/sync_members @@ -0,0 +1,37 @@ +# mailman sync_members completion + +_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 0 + ;; + -d|--file) + _filedir + return 0 + ;; + esac + + $split && return 0 + + 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 + +# 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 diff --git a/completions/sysbench b/completions/sysbench index 496a39bd..854f4cb5 100644 --- a/completions/sysbench +++ b/completions/sysbench @@ -1,7 +1,5 @@ # bash completion for sysbench -have sysbench || return - _sysbench() { local cur prev words cword split diff --git a/completions/sysctl b/completions/sysctl index 8c7d68a8..b6e1a278 100644 --- a/completions/sysctl +++ b/completions/sysctl @@ -1,7 +1,5 @@ # bash completion for sysctl -have sysctl || return - _sysctl() { local cur prev words cword diff --git a/completions/tar b/completions/tar index 0a650cee..8ea292e0 100644 --- a/completions/tar +++ b/completions/tar @@ -1,7 +1,5 @@ # bash completion for GNU tar -have tar || return - _tar() { local cur prev words cword split diff --git a/completions/tcpdump b/completions/tcpdump index bd09a10a..802835e1 100644 --- a/completions/tcpdump +++ b/completions/tcpdump @@ -1,7 +1,5 @@ # bash completion for tcpdump -have tcpdump || return - _tcpdump() { local cur prev words cword diff --git a/completions/tcpkill b/completions/tcpkill new file mode 100644 index 00000000..a9680d29 --- /dev/null +++ b/completions/tcpkill @@ -0,0 +1,28 @@ +# tcpkill completion + +_tcpkill() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -i) + _interfaces + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-i -1 -2 -3 -4 -5 -6 -7 -8 -9' -- "$cur" ) ) + fi + +} && +complete -F _tcpkill tcpkill + +# 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 diff --git a/completions/tcpnice b/completions/tcpnice new file mode 100644 index 00000000..ea069a6c --- /dev/null +++ b/completions/tcpnice @@ -0,0 +1,28 @@ +# tcpnice completion + +_tcpnice() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -i) + _interfaces + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + fi + +} && +complete -F _tcpnice tcpnice + +# 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 diff --git a/completions/tracepath b/completions/tracepath new file mode 100644 index 00000000..9b45534a --- /dev/null +++ b/completions/tracepath @@ -0,0 +1,29 @@ +# tracepath(8) completion + +_tracepath() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -l) + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + return + fi + + _known_hosts_real "$cur" +} && +complete -F _tracepath tracepath tracepath6 + +# 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 diff --git a/completions/tune2fs b/completions/tune2fs new file mode 100644 index 00000000..c23548f1 --- /dev/null +++ b/completions/tune2fs @@ -0,0 +1,64 @@ +# tune2fs(8) completion + +_tune2fs() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -c|-C|-E|-i|-J|-L|-m|-r|-T) + return 0 + ;; + -e) + COMPREPLY=( $( compgen -W 'continue remount-ro panic' -- "$cur" ) ) + return 0 + ;; + -g) + _gids + COMPREPLY=( $( compgen -g -W '${COMPREPLY[@]}' -- "$cur" ) ) + return 0 + ;; + -M) + _filedir -d + ;; + -o) + local -a opts=(^debug ^bsdgroups ^user_xattr ^acl ^uid16 + ^journal_data ^journal_data_ordered ^journal_data_writeback) + COMPREPLY=( $( compgen -W '${opts[@]} ${opts[@]#^}' -- "$cur" ) ) + return 0 + ;; + -O) + local -a opts=(^dir_index ^dir_nlink ^extent ^extra_isize ^filetype + ^flex_bg ^has_journal ^huge_file ^large_file ^resize_inode + ^sparse_super ^uninit_bg) + COMPREPLY=( $( compgen -W '${opts[@]} ${opts[@]#^}' -- "$cur" ) ) + return 0 + ;; + -u) + _uids + COMPREPLY=( $( compgen -u -W '${COMPREPLY[@]}' -- "$cur" ) ) + return 0 + ;; + -U) + COMPREPLY=( $( compgen -W 'clear random time' -- "$cur" ) ) + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + return + fi + + cur=${cur:=/dev/} + _filedir +} && +complete -F _tune2fs tune2fs + +# 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 diff --git a/completions/unace b/completions/unace index 17380c29..0b93a3da 100644 --- a/completions/unace +++ b/completions/unace @@ -1,7 +1,5 @@ # unace(1) completion -have unace || return - _unace() { local cur prev words cword diff --git a/completions/unpack200 b/completions/unpack200 new file mode 100644 index 00000000..208ad471 --- /dev/null +++ b/completions/unpack200 @@ -0,0 +1,54 @@ +# unpack200(1) completion + +_unpack200() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + '-?'|-h|--help|-V|--version|-J) + return 0 + ;; + -H|--deflate-hint) + COMPREPLY=( $( compgen -W 'true false keep' -- "$cur" ) ) + return 0 + ;; + -l|--log-file) + COMPREPLY=( $( compgen -W '-' -- "$cur" ) ) + _filedir log + return 0 + ;; + esac + + $split && return + + # Check if a pack or a jar was already given. + local i pack=false jar=false + for (( i=0; 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 '--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 + +# 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 diff --git a/completions/unrar b/completions/unrar index f83ef3b0..917cb2e5 100644 --- a/completions/unrar +++ b/completions/unrar @@ -1,7 +1,5 @@ # unrar(1) completion -have unrar || return - _unrar() { local cur prev words cword diff --git a/completions/unshunt b/completions/unshunt new file mode 100644 index 00000000..422e5045 --- /dev/null +++ b/completions/unshunt @@ -0,0 +1,23 @@ +# mailman unshunt completion + +_unshunt() +{ + local cur prev words cword + _init_completion || return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--help' -- "$cur" ) ) + else + _filedir -d + fi + +} && +complete -F _unshunt unshunt + +# 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 diff --git a/completions/update-alternatives b/completions/update-alternatives index 5033cc54..1e9b7686 100644 --- a/completions/update-alternatives +++ b/completions/update-alternatives @@ -1,7 +1,5 @@ # bash completion for update-alternatives -have update-alternatives || return - _installed_alternatives() { local admindir diff --git a/completions/sysv-rc b/completions/update-rc.d index 6e480a40..92e29eb2 100644 --- a/completions/sysv-rc +++ b/completions/update-rc.d @@ -2,7 +2,6 @@ # # Copyright (C) 2004 Servilio Afre Puentes <servilio@gmail.com> -have update-rc.d && _update_rc_d() { local cur prev words cword @@ -63,45 +62,6 @@ _update_rc_d() } && complete -F _update_rc_d update-rc.d -# invoke-rc.d(8) completion -# -# Copyright (C) 2004 Servilio Afre Puentes <servilio@gmail.com> -# -have invoke-rc.d && -_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[@]}" \ - | sed -ne "/$( sed "s/ /\\\\|/g" <<<"${options[@]}" )/p" \ - | sort | uniq -u \ - ) ) - COMPREPLY=( $( compgen -W '${valid_options[@]} ${services[@]}' -- "$cur" ) ) - elif [ -x $sysvdir/$prev ]; then - COMPREPLY=( $( compgen -W '`sed -e "y/|/ /" \ - -ne "s/^.*Usage:[ ]*[^ ]*[ ]*{*\([^}\"]*\).*$/\1/p" \ - $sysvdir/$prev`' -- "$cur" ) ) - else - COMPREPLY=() - fi - - return 0 -} && -complete -F _invoke_rc_d invoke-rc.d - # Local variables: # mode: shell-script # sh-basic-offset: 4 diff --git a/completions/upgradepkg b/completions/upgradepkg new file mode 100644 index 00000000..e4a7d8ad --- /dev/null +++ b/completions/upgradepkg @@ -0,0 +1,23 @@ +# Slackware Linux upgradepkg completion + +_upgradepkg() +{ + local cur prev words cword + _init_completion || return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--dry-run --install-new --reinstall \ + --verbose' -- "$cur") ) + return 0 + fi + + _filedir "t[bglx]z" +} && complete -F _upgradepkg upgradepkg + +# 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 diff --git a/completions/urlsnarf b/completions/urlsnarf new file mode 100644 index 00000000..172e789a --- /dev/null +++ b/completions/urlsnarf @@ -0,0 +1,28 @@ +# urlsnarf completion + +_urlsnarf() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -i) + _interfaces + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + fi + +} && +complete -F _urlsnarf urlsnarf + +# 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 diff --git a/completions/useradd b/completions/useradd new file mode 100644 index 00000000..6b2be57a --- /dev/null +++ b/completions/useradd @@ -0,0 +1,51 @@ +# useradd(8) completion + +_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 + -c|--comment|-h|--help|-e|--expiredate|-f|--inactive|-k|--key|\ + -p|--password|-u|--uid|-Z|--selinux-user) + return 0 + ;; + -b|--base-dir|-d|--home|-k|--skel) + _filedir -d + return 0 + ;; + -g|--gid) + _gids + COMPREPLY=( $( compgen -W '${COMPREPLY[@]} $( compgen -g )' \ + -- "$cur" ) ) + return 0 + ;; + -G|--groups) + COMPREPLY=( $( compgen -g -- "$cur" ) ) + return 0 + ;; + -s|--shell) + _shells + return 0 + ;; + esac + + $split && return 0 + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + return 0 + fi +} && +complete -F _useradd useradd + +# 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 diff --git a/completions/userdel b/completions/userdel new file mode 100644 index 00000000..08939b25 --- /dev/null +++ b/completions/userdel @@ -0,0 +1,23 @@ +# userdel(8) completion + +_userdel() +{ + local cur prev words cword + _init_completion || return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + return 0 + fi + + COMPREPLY=( $( compgen -u -- "$cur" ) ) +} && +complete -F _userdel userdel + +# 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 diff --git a/completions/usermod b/completions/usermod new file mode 100644 index 00000000..18e363a0 --- /dev/null +++ b/completions/usermod @@ -0,0 +1,50 @@ +# usermod(8) completion + +_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 + -c|--comment|-d|--home|-e|--expiredate|-f|--inactive|-h|--help|\ + -l|--login|-p|--password|-u|--uid|-Z|--selinux-user) + return 0 + ;; + -g|--gid) + _gids + COMPREPLY=( $( compgen -W '${COMPREPLY[@]} $( compgen -g )' \ + -- "$cur" ) ) + return 0 + ;; + -G|--groups) + COMPREPLY=( $( compgen -g -- "$cur" ) ) + return 0 + ;; + -s|--shell) + _shells + return 0 + ;; + esac + + $split && return 0 + + if [[ "$cur" == -* ]]; then + # TODO: -U/--unlock, -p/--password, -L/--lock mutually exclusive + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + return 0 + fi + + COMPREPLY=( $( compgen -u -- "$cur" ) ) +} && +complete -F _usermod usermod + +# 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 diff --git a/completions/util-linux b/completions/util-linux deleted file mode 100644 index 6246b118..00000000 --- a/completions/util-linux +++ /dev/null @@ -1,150 +0,0 @@ -# Completions for tools included in util-linux (not necessarily Linux specific) - -# renice(8) completion -# -have renice && -_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 -le $cword && ${#COMPREPLY[@]} -eq 0 ]]; do - curopt=${words[cword-$i]} - case "$curopt" in - -u) - _allowed_users - ;; - -g) - _pgids - ;; - -p|$command) - _pids - ;; - esac - i=$(( ++i )) - done -} && -complete -F _renice renice - -# kill(1) completion -# -have kill && -_kill() -{ - local cur prev words cword - _init_completion || return - - if [[ $cword -eq 1 && "$cur" == -* ]]; then - # return list of available signals - _signals - else - # return list of available PIDs - _pids - fi -} && -complete -F _kill kill - -# look(1) completion -# -have look && -_look() -{ - local cur prev words cword - _init_completion || return - - if [[ $cword -eq 1 ]]; then - COMPREPLY=( $( compgen -W '$(look "$cur" 2>/dev/null)' -- "$cur" ) ) - fi -} && -complete -F _look -o default look - -have ionice && -_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 -gt 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 - -have dmesg && -_dmesg() -{ - [[ $OSTYPE == *solaris* ]] && return # no args there - - local cur prev words cword - _init_completion || return - - case $prev in - -s|-M|-N) - return - ;; - -n) - COMPREPLY=( $( compgen -W '{1..8}' -- "$cur" ) ) - return - ;; - esac - - if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) - return - fi -} && -complete -F _dmesg dmesg - -# 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 diff --git a/completions/vipw b/completions/vipw new file mode 100644 index 00000000..ac885aa7 --- /dev/null +++ b/completions/vipw @@ -0,0 +1,27 @@ +# vipw(8) and vigr completion + +_vipw() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -h|--help) + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + return 0 + fi +} && +complete -F _vipw vipw vigr + +# 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 diff --git a/completions/vncviewer b/completions/vncviewer index 955dd47f..2cabfd9b 100644 --- a/completions/vncviewer +++ b/completions/vncviewer @@ -1,6 +1,5 @@ # bash completion for vncviewer -have vncviewer && _vncviewer_bootstrap() { local fname @@ -17,7 +16,6 @@ _vncviewer_bootstrap() } && complete -F _vncviewer_bootstrap vncviewer -have tightvncviewer && _tightvncviewer() { local cur prev words cword @@ -56,7 +54,6 @@ complete -F _tightvncviewer tightvncviewer # NOTE: - VNC Viewer options are case insensitive. # Preferred case is taken from -help. # - Both single dash (-) and double dash (--) are allowed as option prefix -have xvnc4viewer && _xvnc4viewer() { local cur prev words cword diff --git a/completions/vpnc b/completions/vpnc index 9cb35b7a..511d0251 100644 --- a/completions/vpnc +++ b/completions/vpnc @@ -1,7 +1,5 @@ # bash completion for vpnc -have vpnc || return - _vpnc() { local cur prev words cword diff --git a/completions/watch b/completions/watch new file mode 100644 index 00000000..025a47b2 --- /dev/null +++ b/completions/watch @@ -0,0 +1,60 @@ +# watch(1) completion + +[[ $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 + -h|--help|--version) + return + ;; + -n|--interval) + (( i++ )) + continue + ;; + -*) + continue + ;; + esac + offset=$i + break + done + + if [[ $offset -gt 0 ]]; then + _command_offset $offset + return + fi + + case $prev in + -d|--differences) + [[ $cur != -* ]] && \ + COMPREPLY=( $( compgen -W 'cumulative' -- "$cur" ) ) + return + ;; + -n|--interval) + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + return + fi +} && +complete -F _watch watch + +# 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 diff --git a/completions/webmitm b/completions/webmitm new file mode 100644 index 00000000..cf181f87 --- /dev/null +++ b/completions/webmitm @@ -0,0 +1,23 @@ +# webmitm completion + +_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 + +# 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 diff --git a/completions/withlist b/completions/withlist new file mode 100644 index 00000000..167d6533 --- /dev/null +++ b/completions/withlist @@ -0,0 +1,24 @@ +# mailman withlist completion + +_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 + +# 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 diff --git a/completions/wodim b/completions/wodim index bc2912a7..8c762f95 100644 --- a/completions/wodim +++ b/completions/wodim @@ -1,7 +1,5 @@ # bash completion for cdrecord/wodim -have cdrecord || have wodim || return - _cdrecord() { local cur prev words cword diff --git a/completions/wol b/completions/wol index 001e2f61..8a6a3a60 100644 --- a/completions/wol +++ b/completions/wol @@ -1,7 +1,5 @@ # wol(1) completion -have wol || return - _wol() { local cur prev words cword split diff --git a/completions/wtf b/completions/wtf index 545a2e5c..58b422dd 100644 --- a/completions/wtf +++ b/completions/wtf @@ -1,8 +1,6 @@ # wtf completion # Raphael Droz, 25/09/2009 -have wtf || return - _wtf() { local cur prev words cword diff --git a/completions/wvdial b/completions/wvdial index 4a2620c3..e2f73b78 100644 --- a/completions/wvdial +++ b/completions/wvdial @@ -1,7 +1,5 @@ # bash completion for wvdial -have wvdial || return - _wvdial() { local cur prev words cword split diff --git a/completions/freerdp b/completions/xfreerdp index 93f4119b..bb24dbfd 100644 --- a/completions/freerdp +++ b/completions/xfreerdp @@ -1,6 +1,4 @@ -# bash completion for xfreerdp - -have xfreerdp || return +# xfreerdp completion _xfreerdp() { diff --git a/completions/xgamma b/completions/xgamma index fba7cd55..164a5de4 100644 --- a/completions/xgamma +++ b/completions/xgamma @@ -1,7 +1,5 @@ # bash completion for xgamma(1) -have xgamma || return - _xgamma() { local cur prev words cword diff --git a/completions/xhost b/completions/xhost index 2cbabe86..8a529740 100644 --- a/completions/xhost +++ b/completions/xhost @@ -1,7 +1,5 @@ # xhost(1) completion -have xhost || return - _xhost () { local cur prev words cword diff --git a/completions/xm b/completions/xm index dfed9836..0cc6e783 100644 --- a/completions/xm +++ b/completions/xm @@ -1,7 +1,5 @@ # bash completion for xm -have xm || return - _xen_domain_names() { COMPREPLY=( $(compgen -W "$( xm list 2>/dev/null | \ diff --git a/completions/xmllint b/completions/xmllint index 64f53c26..3d941f2b 100644 --- a/completions/xmllint +++ b/completions/xmllint @@ -1,7 +1,5 @@ # bash completion for xmllint(1) -have xmllint || return - _xmllint() { local cur prev words cword diff --git a/completions/xmlwf b/completions/xmlwf index 0fd49700..83612007 100644 --- a/completions/xmlwf +++ b/completions/xmlwf @@ -1,7 +1,5 @@ # bash completion for xmlwf(1) -have xmlwf || return - _xmlwf() { local cur prev words cword diff --git a/completions/xmms b/completions/xmms index 933c949a..697c9da3 100644 --- a/completions/xmms +++ b/completions/xmms @@ -1,7 +1,5 @@ # bash completion for xmms -have xmms || return - _xmms() { local cur prev words cword split diff --git a/completions/xmodmap b/completions/xmodmap index 595b26e7..b50800d5 100644 --- a/completions/xmodmap +++ b/completions/xmodmap @@ -1,7 +1,5 @@ # xmodmap(1) completion -have xmodmap || return - _xmodmap() { local cur prev words cword diff --git a/completions/xrandr b/completions/xrandr index 964b79fa..c636304f 100644 --- a/completions/xrandr +++ b/completions/xrandr @@ -1,7 +1,5 @@ # bash completion for xrandr -have xrandr || return - _xrandr() { local cur prev words cword diff --git a/completions/xrdb b/completions/xrdb index 8170c1c6..99188802 100644 --- a/completions/xrdb +++ b/completions/xrdb @@ -1,7 +1,5 @@ # xrdb(1) completion -have xrdb || return - _xrdb() { local cur prev words cword diff --git a/completions/xsltproc b/completions/xsltproc index dcf4d07f..010eb7b5 100644 --- a/completions/xsltproc +++ b/completions/xsltproc @@ -1,7 +1,5 @@ # xsltproc(1) completion -have xsltproc || return - _xsltproc() { local cur prev words cword diff --git a/completions/xz b/completions/xz index 3cf05271..5acf724a 100644 --- a/completions/xz +++ b/completions/xz @@ -1,6 +1,5 @@ # xz(1) completion -have xz || have pxz && _xz() { local cur prev words cword split @@ -53,37 +52,6 @@ _xz() } && complete -F _xz xz pxz -# xzdec(1) completion -# -have xzdec && -_xzdec() -{ - local cur prev words cword split - _init_completion -s || return - - case $prev in - -M|--memory) - # argument required but no completions available - return 0 - ;; - -h|--help|-V|--version) - # all other arguments are noop with these - return 0 - ;; - esac - - $split && return 0 - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) - [[ $COMPREPLY == *= ]] && compopt -o nospace - return 0 - fi - - _filedir xz # no lzma support here as of xz 4.999.9beta -} && -complete -F _xzdec xzdec - # Local variables: # mode: shell-script # sh-basic-offset: 4 diff --git a/completions/xzdec b/completions/xzdec new file mode 100644 index 00000000..dc7a911b --- /dev/null +++ b/completions/xzdec @@ -0,0 +1,37 @@ +# xzdec(1) completion + +_xzdec() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + -M|--memory) + # argument required but no completions available + return 0 + ;; + -h|--help|-V|--version) + # all other arguments are noop with these + return 0 + ;; + esac + + $split && return 0 + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + return 0 + fi + + _filedir xz # no lzma support here as of xz 4.999.9beta +} && +complete -F _xzdec xzdec + +# 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 diff --git a/completions/yp-tools b/completions/ypmatch index f777a5b0..1b46e41c 100644 --- a/completions/yp-tools +++ b/completions/ypmatch @@ -1,7 +1,5 @@ # bash completion for yp-tools -have ypcat || return - _ypmatch() { local cur prev words cword @@ -14,12 +12,13 @@ _ypmatch() if [[ $cmd == ypmatch && $cword -eq 1 && ${#words[@]} -eq 3 ]]; then map=${words[2]} - COMPREPLY=( $( compgen -W '$( ypcat $map | \ + COMPREPLY=( $( compgen -W '$( ypcat $map 2>/dev/null | \ cut -d':' -f 1 )' -- "$cur") ) else [[ $cmd == ypmatch && $cword -ne 2 ]] && return 0 COMPREPLY=( $( compgen -W \ - '$( printf "%s\n" $(ypcat -x | cut -d"\"" -f 2) )' -- "$cur")) + '$( printf "%s\n" $(ypcat -x 2>/dev/null | \ + cut -d"\"" -f 2) )' -- "$cur") ) fi return 0 diff --git a/completions/yum-arch b/completions/yum-arch index eb02b924..f095ae12 100644 --- a/completions/yum-arch +++ b/completions/yum-arch @@ -1,7 +1,5 @@ # yum-arch(8) completion -have yum-arch || return - _yum_arch() { local cur prev words cword diff --git a/configure.ac b/configure.ac index 723a49d0..0e0c5168 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,7 @@ AC_PREREQ([2.59]) AC_INIT([bash-completion], [1.99]) AM_INIT_AUTOMAKE([foreign dist-bzip2 no-dist-gzip -Wall -Werror]) +AC_PROG_LN_S AC_SUBST(compatdir, $sysconfdir/bash_completion.d) AC_CONFIG_FILES([Makefile completions/Makefile helpers/Makefile test/Makefile bash-completion.pc]) AC_OUTPUT diff --git a/install-completions b/install-completions deleted file mode 100755 index 6d5d197f..00000000 --- a/install-completions +++ /dev/null @@ -1,75 +0,0 @@ -#!/bin/bash -# install relevant completions, by sourcing every scriptlet -# found in a given directory, and symlinking those matching -# an installed command to another directory - -have() -{ - PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin type $1 &>/dev/null -} - -usage() -{ - echo "usage: $0 <completion_dir> [installation_dir]" -} - -while getopts ":h" flag; do - case $flag in - h) usage; exit 0;; - esac -done - -shift $((OPTIND - 1)) - -completion_dir=$1 -if [ -z "$completion_dir" ]; then - echo "missing completion directory" - usage - exit 1 -fi -if [ ! -d $completion_dir ]; then - echo "invalid directory $completion_dir" - usage - exit 1 -fi - -installation_dir=$2 -if [ ! -d $installation_dir ]; then - echo "invalid directory $installation_dir" - usage - exit 1 -fi - -# many scripts require this -shopt -s extglob - -# and some require this also -UNAME=$(uname -s) -UNAME=${UNAME/CYGWIN_*/Cygwin} - -case $UNAME in - Linux|GNU|GNU/*) USERLAND=GNU ;; - *) USERLAND=$UNAME ;; -esac - -for script in $completion_dir/*; do - # reset completion - complete -r - - # source script - source $script 2>/dev/null - - # check completion output - output=$(complete -p) - - if [ -z "$output" ]; then - continue - fi - - if [ -n "$installation_dir" ]; then - ln -sf $script $installation_dir/$(basename $script) - else - echo "$script OK" - fi - -done |