summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Paleino <dapal@debian.org>2011-11-03 12:32:52 +0100
committerDavid Paleino <dapal@debian.org>2011-11-03 12:32:52 +0100
commit2c8171c38d87ddef31c92a76547d3fdf773a1337 (patch)
tree5e720d5a06ead72ed55454bf6647a712a761ed91
parent9920a8faedf704420571d8072ccab27e9dac40ba (diff)
downloadbash-completion-2c8171c38d87ddef31c92a76547d3fdf773a1337.tar.gz
Imported Upstream version 1.90upstream/1.90
-rw-r--r--.dir-locals.el5
-rw-r--r--CHANGES172
-rw-r--r--Makefile.am20
-rw-r--r--Makefile.in127
-rw-r--r--README66
-rw-r--r--TODO33
-rw-r--r--aclocal.m44
-rw-r--r--bash-completion.pc.in9
-rw-r--r--bash_completion936
-rw-r--r--bash_completion.sh.in10
-rw-r--r--completions/Makefile.am687
-rw-r--r--completions/Makefile.in973
-rw-r--r--completions/_mock38
-rw-r--r--completions/_modules30
-rw-r--r--completions/_subversion222
-rw-r--r--completions/_yum39
-rw-r--r--completions/_yum-utils23
-rw-r--r--completions/a2x40
-rw-r--r--completions/abook20
-rw-r--r--completions/aclocal35
-rw-r--r--completions/add_members32
-rw-r--r--completions/alias20
-rw-r--r--completions/ant64
-rw-r--r--completions/apache2ctl22
-rw-r--r--completions/apt157
-rw-r--r--completions/apt-build25
-rw-r--r--completions/apt-cache74
-rw-r--r--completions/apt-get76
-rw-r--r--completions/aptitude39
-rw-r--r--completions/arch47
-rw-r--r--completions/arping31
-rw-r--r--completions/arpspoof28
-rw-r--r--completions/asciidoc52
-rw-r--r--completions/aspell62
-rw-r--r--completions/autoconf94
-rw-r--r--completions/automake54
-rw-r--r--completions/autoreconf41
-rw-r--r--completions/autorpm15
-rw-r--r--completions/autoscan34
-rw-r--r--completions/badblocks32
-rw-r--r--completions/bash-builtins128
-rw-r--r--completions/bind-utils23
-rw-r--r--completions/bitkeeper26
-rw-r--r--completions/bk19
-rw-r--r--completions/brctl18
-rw-r--r--completions/btdownloadheadless.py (renamed from completions/bittorrent)19
-rw-r--r--completions/bzip226
-rw-r--r--completions/cal34
-rw-r--r--completions/cancel12
-rw-r--r--completions/cardctl17
-rw-r--r--completions/cfagent21
-rw-r--r--completions/cfengine88
-rw-r--r--completions/cfrun47
-rw-r--r--completions/chage26
-rw-r--r--completions/change_pw25
-rw-r--r--completions/check_db17
-rw-r--r--completions/check_perms15
-rw-r--r--completions/chgrp40
-rw-r--r--completions/chkconfig21
-rw-r--r--completions/chown46
-rw-r--r--completions/chpasswd29
-rw-r--r--completions/chrpath27
-rw-r--r--completions/chsh23
-rw-r--r--completions/cksfv21
-rw-r--r--completions/cleanarch16
-rw-r--r--completions/clisp14
-rw-r--r--completions/clone_member25
-rw-r--r--completions/complete50
-rw-r--r--completions/config_list27
-rw-r--r--completions/configure34
-rw-r--r--completions/convert328
-rw-r--r--completions/coreutils149
-rw-r--r--completions/cowsay15
-rw-r--r--completions/cpan2dist31
-rw-r--r--completions/cpio26
-rw-r--r--completions/cppcheck60
-rw-r--r--completions/crontab46
-rw-r--r--completions/cryptsetup27
-rw-r--r--completions/cups21
-rw-r--r--completions/curl85
-rw-r--r--completions/cvs256
-rw-r--r--completions/cvsps25
-rw-r--r--completions/dd17
-rw-r--r--completions/dhclient16
-rw-r--r--completions/dict39
-rw-r--r--completions/dmesg27
-rw-r--r--completions/dot45
-rw-r--r--completions/dpkg174
-rw-r--r--completions/dpkg-source107
-rw-r--r--completions/dselect15
-rw-r--r--completions/dsniff238
-rw-r--r--completions/dumpdb18
-rw-r--r--completions/dumpe2fs28
-rw-r--r--completions/e2freefrag24
-rw-r--r--completions/e2fsprogs180
-rw-r--r--completions/e2label15
-rw-r--r--completions/ether-wake27
-rw-r--r--completions/evince33
-rw-r--r--completions/explodepkg5
-rw-r--r--completions/export25
-rw-r--r--completions/faillog28
-rw-r--r--completions/fbgs39
-rw-r--r--completions/fbi54
-rw-r--r--completions/feh119
-rw-r--r--completions/file32
-rw-r--r--completions/filefrag17
-rw-r--r--completions/filesnarf22
-rw-r--r--completions/find (renamed from completions/findutils)76
-rw-r--r--completions/find_member25
-rw-r--r--completions/freeciv65
-rw-r--r--completions/freeciv-gtk230
-rw-r--r--completions/freeciv-server22
-rw-r--r--completions/function22
-rw-r--r--completions/fusermount (renamed from completions/fuse)16
-rw-r--r--completions/gcc25
-rw-r--r--completions/gcl14
-rw-r--r--completions/gdb31
-rw-r--r--completions/genaliases15
-rw-r--r--completions/gendiff12
-rw-r--r--completions/genisoimage15
-rw-r--r--completions/getent57
-rw-r--r--completions/gkrellm20
-rw-r--r--completions/gnatmake16
-rw-r--r--completions/gnome-mplayer39
-rw-r--r--completions/gpasswd25
-rw-r--r--completions/gpg20
-rw-r--r--completions/gpg220
-rw-r--r--completions/gprof65
-rw-r--r--completions/groupadd27
-rw-r--r--completions/groupdel5
-rw-r--r--completions/groupmems26
-rw-r--r--completions/groupmod29
-rw-r--r--completions/growisofs (renamed from completions/dvd+rw-tools)18
-rw-r--r--completions/grpck17
-rw-r--r--completions/gzip28
-rw-r--r--completions/hcitool (renamed from completions/bluez)157
-rw-r--r--completions/hddtemp38
-rw-r--r--completions/helpers/Makefile.am3
-rw-r--r--completions/hid2hci15
-rw-r--r--completions/hping228
-rw-r--r--completions/htpasswd33
-rw-r--r--completions/iconv22
-rw-r--r--completions/idn26
-rw-r--r--completions/iftop17
-rw-r--r--completions/ifup19
-rw-r--r--completions/ifupdown27
-rw-r--r--completions/imagemagick532
-rw-r--r--completions/info57
-rw-r--r--completions/inject26
-rw-r--r--completions/insmod34
-rw-r--r--completions/installpkg32
-rw-r--r--completions/invoke-rc.d39
-rw-r--r--completions/ionice57
-rw-r--r--completions/ip (renamed from completions/iproute2)16
-rw-r--r--completions/ipmitool30
-rw-r--r--completions/ipsec93
-rw-r--r--completions/iptables24
-rw-r--r--completions/ipv6calc19
-rw-r--r--completions/iscsiadm (renamed from completions/open-iscsi)30
-rw-r--r--completions/isql14
-rw-r--r--completions/iwconfig90
-rw-r--r--completions/iwlist22
-rw-r--r--completions/iwpriv31
-rw-r--r--completions/iwspy20
-rw-r--r--completions/jar21
-rw-r--r--completions/jarsigner56
-rw-r--r--completions/java327
-rw-r--r--completions/javaws34
-rw-r--r--completions/jps25
-rw-r--r--completions/k3b15
-rw-r--r--completions/kcov39
-rw-r--r--completions/kill29
-rw-r--r--completions/killall35
-rw-r--r--completions/kldload32
-rw-r--r--completions/kldunload15
-rw-r--r--completions/ktutil (renamed from completions/heimdal)29
-rw-r--r--completions/larch18
-rw-r--r--completions/lastlog28
-rw-r--r--completions/ldapsearch (renamed from completions/openldap)92
-rw-r--r--completions/ldapvi28
-rw-r--r--completions/lftp31
-rw-r--r--completions/lftpget14
-rw-r--r--completions/lilo18
-rw-r--r--completions/links15
-rw-r--r--completions/lintian73
-rw-r--r--completions/lisp14
-rw-r--r--completions/list_admins17
-rw-r--r--completions/list_lists21
-rw-r--r--completions/list_members36
-rw-r--r--completions/list_owners18
-rw-r--r--completions/look14
-rw-r--r--completions/lpq28
-rw-r--r--completions/lpr33
-rw-r--r--completions/lrzip44
-rw-r--r--completions/lsof14
-rw-r--r--completions/lvm430
-rw-r--r--completions/lzma21
-rw-r--r--completions/lzop43
-rw-r--r--completions/macof23
-rw-r--r--completions/mailman587
-rw-r--r--completions/mailmanctl18
-rw-r--r--completions/make57
-rw-r--r--completions/makepkg24
-rw-r--r--completions/man60
-rw-r--r--completions/mc26
-rw-r--r--completions/mcrypt36
-rw-r--r--completions/mdadm59
-rw-r--r--completions/mdtool62
-rw-r--r--completions/medusa19
-rw-r--r--completions/mii-diag27
-rw-r--r--completions/mii-tool32
-rw-r--r--completions/minicom16
-rw-r--r--completions/mkinitrd21
-rw-r--r--completions/mktemp29
-rw-r--r--completions/mmsitepass15
-rw-r--r--completions/module-init-tools61
-rw-r--r--completions/monodevelop80
-rw-r--r--completions/mount27
-rw-r--r--completions/mplayer24
-rw-r--r--completions/msynctool17
-rw-r--r--completions/mtx22
-rw-r--r--completions/munin-node113
-rw-r--r--completions/munin-node-configure33
-rw-r--r--completions/munin-run28
-rw-r--r--completions/munin-update27
-rw-r--r--completions/munindoc13
-rw-r--r--completions/mutt60
-rw-r--r--completions/mysql82
-rw-r--r--completions/mysqladmin30
-rw-r--r--completions/ncftp17
-rw-r--r--completions/net-tools131
-rw-r--r--completions/newgrp16
-rw-r--r--completions/newlist17
-rw-r--r--completions/newusers31
-rw-r--r--completions/nmap16
-rw-r--r--completions/nslookup75
-rw-r--r--completions/ntpdate28
-rw-r--r--completions/openssl36
-rw-r--r--completions/p418
-rw-r--r--completions/pack20075
-rw-r--r--completions/passwd23
-rw-r--r--completions/perl64
-rw-r--r--completions/pgrep38
-rw-r--r--completions/pine15
-rw-r--r--completions/ping61
-rw-r--r--completions/pkg-config29
-rw-r--r--completions/pkg_delete21
-rw-r--r--completions/pkg_install30
-rw-r--r--completions/pkgtool36
-rw-r--r--completions/pkgtools22
-rw-r--r--completions/pm-hibernate12
-rw-r--r--completions/pm-is-supported13
-rw-r--r--completions/pm-powersave12
-rw-r--r--completions/pm-utils37
-rw-r--r--completions/portinstall32
-rw-r--r--completions/portupgrade47
-rw-r--r--completions/postcat42
-rw-r--r--completions/postconf41
-rw-r--r--completions/postfix214
-rw-r--r--completions/postmap43
-rw-r--r--completions/postsuper62
-rw-r--r--completions/povray23
-rw-r--r--completions/prelink42
-rw-r--r--completions/procps49
-rw-r--r--completions/protoc63
-rw-r--r--completions/psql (renamed from completions/postgresql)57
-rw-r--r--completions/puppet310
-rw-r--r--completions/pwck17
-rw-r--r--completions/pwdx18
-rw-r--r--completions/pwgen28
-rw-r--r--completions/python24
-rw-r--r--completions/qdbus19
-rw-r--r--completions/qemu31
-rw-r--r--completions/qrunner18
-rw-r--r--completions/querybts35
-rw-r--r--completions/quota192
-rw-r--r--completions/quota-tools257
-rw-r--r--completions/rcs17
-rw-r--r--completions/rdesktop48
-rw-r--r--completions/remove_members27
-rw-r--r--completions/removepkg19
-rw-r--r--completions/renice29
-rw-r--r--completions/reportbug56
-rw-r--r--completions/reptyr23
-rw-r--r--completions/resolvconf15
-rw-r--r--completions/rfkill17
-rw-r--r--completions/ri31
-rw-r--r--completions/rmlist17
-rw-r--r--completions/rmmod14
-rw-r--r--completions/route30
-rw-r--r--completions/rpcdebug32
-rw-r--r--completions/rpm256
-rw-r--r--completions/rpm2tgz16
-rw-r--r--completions/rpmcheck17
-rw-r--r--completions/rrdtool21
-rw-r--r--completions/rsync55
-rw-r--r--completions/rtcwake19
-rw-r--r--completions/samba298
-rw-r--r--completions/sbcl14
-rw-r--r--completions/sbopkg74
-rw-r--r--completions/screen60
-rw-r--r--completions/service33
-rw-r--r--completions/sh14
-rw-r--r--completions/shadow482
-rw-r--r--completions/sitecopy55
-rw-r--r--completions/slackpkg108
-rw-r--r--completions/slapt-get81
-rw-r--r--completions/slapt-src60
-rw-r--r--completions/smartctl86
-rw-r--r--completions/smbclient323
-rw-r--r--completions/snownews18
-rw-r--r--completions/sqlite314
-rw-r--r--completions/ssh132
-rw-r--r--completions/ssh-copy-id25
-rw-r--r--completions/sshfs23
-rw-r--r--completions/sshmitm17
-rw-r--r--completions/sshow22
-rw-r--r--completions/strace67
-rw-r--r--completions/svk25
-rw-r--r--completions/sync_members31
-rw-r--r--completions/sysbench58
-rw-r--r--completions/sysctl31
-rw-r--r--completions/tar120
-rw-r--r--completions/tcpdump39
-rw-r--r--completions/tcpkill22
-rw-r--r--completions/tcpnice22
-rw-r--r--completions/tracepath23
-rw-r--r--completions/tune2fs58
-rw-r--r--completions/unace17
-rw-r--r--completions/unpack20048
-rw-r--r--completions/unrar17
-rw-r--r--completions/unshunt17
-rw-r--r--completions/update-alternatives34
-rw-r--r--completions/update-rc.d (renamed from completions/sysv-rc)61
-rw-r--r--completions/upgradepkg17
-rw-r--r--completions/urlsnarf22
-rw-r--r--completions/useradd45
-rw-r--r--completions/userdel17
-rw-r--r--completions/usermod44
-rw-r--r--completions/util-linux76
-rw-r--r--completions/vipw21
-rw-r--r--completions/vncviewer43
-rw-r--r--completions/vpnc15
-rw-r--r--completions/watch54
-rw-r--r--completions/webmitm17
-rw-r--r--completions/wireless-tools180
-rw-r--r--completions/withlist18
-rw-r--r--completions/wodim45
-rw-r--r--completions/wol19
-rw-r--r--completions/wtf23
-rw-r--r--completions/wvdial30
-rw-r--r--completions/xfreerdp (renamed from completions/freerdp)15
-rw-r--r--completions/xgamma57
-rw-r--r--completions/xhost13
-rw-r--r--completions/xm26
-rw-r--r--completions/xmllint22
-rw-r--r--completions/xmlwf23
-rw-r--r--completions/xmms29
-rw-r--r--completions/xmodmap14
-rw-r--r--completions/xrandr51
-rw-r--r--completions/xrdb18
-rw-r--r--completions/xsltproc19
-rw-r--r--completions/xz77
-rw-r--r--completions/xzdec31
-rw-r--r--completions/yp-tools36
-rw-r--r--completions/ypmatch28
-rw-r--r--completions/yum-arch14
-rwxr-xr-xconfigure141
-rw-r--r--configure.ac8
-rw-r--r--helpers/Makefile.am4
-rw-r--r--helpers/Makefile.in (renamed from completions/helpers/Makefile.in)78
-rw-r--r--[-rwxr-xr-x]helpers/perl (renamed from completions/helpers/perl)9
-rw-r--r--test/Makefile.in4
-rw-r--r--test/completion/a2x.exp1
-rw-r--r--test/completion/arping.exp1
-rw-r--r--test/completion/asciidoc.exp1
-rw-r--r--test/completion/avctrl.exp1
-rw-r--r--test/completion/base64.exp1
-rw-r--r--test/completion/cal.exp1
-rw-r--r--test/completion/cfagent.exp1
-rw-r--r--test/completion/chage.exp1
-rw-r--r--test/completion/chpasswd.exp1
-rw-r--r--test/completion/chrpath.exp1
-rw-r--r--test/completion/ciptool.exp1
-rw-r--r--test/completion/compare.exp1
-rw-r--r--test/completion/conjure.exp1
-rw-r--r--test/completion/cppcheck.exp1
-rw-r--r--test/completion/curl.exp1
-rw-r--r--test/completion/dfutool.exp1
-rw-r--r--test/completion/dmesg.exp1
-rw-r--r--test/completion/dot.exp1
-rw-r--r--test/completion/explodepkg.exp1
-rw-r--r--test/completion/faillog.exp1
-rw-r--r--test/completion/fbgs.exp1
-rw-r--r--test/completion/fbi.exp1
-rw-r--r--test/completion/feh.exp1
-rw-r--r--test/completion/file.exp1
-rw-r--r--test/completion/fusermount.exp1
-rw-r--r--test/completion/gendiff.exp1
-rw-r--r--test/completion/gnome-mplayer.exp1
-rw-r--r--test/completion/gpasswd.exp1
-rw-r--r--test/completion/grpck.exp1
-rw-r--r--test/completion/hciattach.exp1
-rw-r--r--test/completion/hciconfig.exp1
-rw-r--r--test/completion/hddtemp.exp1
-rw-r--r--test/completion/host.exp1
-rw-r--r--test/completion/htpasswd.exp1
-rw-r--r--test/completion/idn.exp1
-rw-r--r--test/completion/import.exp1
-rw-r--r--test/completion/installpkg.exp1
-rw-r--r--test/completion/ionice.exp1
-rw-r--r--test/completion/jps.exp1
-rw-r--r--test/completion/kcov.exp1
-rw-r--r--test/completion/l2ping.exp1
-rw-r--r--test/completion/lastlog.exp1
-rw-r--r--test/completion/ldapadd.exp1
-rw-r--r--test/completion/ldapcompare.exp1
-rw-r--r--test/completion/ldapdelete.exp1
-rw-r--r--test/completion/ldapmodrdn.exp1
-rw-r--r--test/completion/ldappasswd.exp1
-rw-r--r--test/completion/ldapsearch.exp1
-rw-r--r--test/completion/ldapvi.exp1
-rw-r--r--test/completion/ldapwhoami.exp1
-rw-r--r--test/completion/lpq.exp1
-rw-r--r--test/completion/lpr.exp1
-rw-r--r--test/completion/makepkg.exp1
-rw-r--r--test/completion/mdadm.exp1
-rw-r--r--test/completion/mdtool.exp1
-rw-r--r--test/completion/medusa.exp1
-rw-r--r--test/completion/mii-diag.exp1
-rw-r--r--test/completion/mii-tool.exp1
-rw-r--r--test/completion/monodevelop.exp1
-rw-r--r--test/completion/msynctool.exp1
-rw-r--r--test/completion/mysql.exp1
-rw-r--r--test/completion/newusers.exp1
-rw-r--r--test/completion/nslookup.exp1
-rw-r--r--test/completion/passwd.exp1
-rw-r--r--test/completion/phing.exp1
-rw-r--r--test/completion/pinfo.exp1
-rw-r--r--test/completion/pkgtool.exp1
-rw-r--r--test/completion/postcat.exp1
-rw-r--r--test/completion/postconf.exp1
-rw-r--r--test/completion/postfix.exp1
-rw-r--r--test/completion/postmap.exp1
-rw-r--r--test/completion/postsuper.exp1
-rw-r--r--test/completion/prelink.exp1
-rw-r--r--test/completion/protoc.exp1
-rw-r--r--test/completion/puppet.exp1
-rw-r--r--test/completion/pwck.exp1
-rw-r--r--test/completion/pwdx.exp1
-rw-r--r--test/completion/pwgen.exp1
-rw-r--r--test/completion/qemu.exp1
-rw-r--r--test/completion/quota.exp1
-rw-r--r--test/completion/quotacheck.exp1
-rw-r--r--test/completion/quotaon.exp1
-rw-r--r--test/completion/rdesktop.exp1
-rw-r--r--test/completion/reptyr.exp1
-rw-r--r--test/completion/rfcomm.exp1
-rw-r--r--test/completion/route.exp1
-rw-r--r--test/completion/rpm2tgz.exp1
-rw-r--r--test/completion/rpmbuild.exp1
-rw-r--r--test/completion/sbopkg.exp1
-rw-r--r--test/completion/sdptool.exp1
-rw-r--r--test/completion/setquota.exp1
-rw-r--r--test/completion/slackpkg.exp1
-rw-r--r--test/completion/slapt-get.exp1
-rw-r--r--test/completion/slapt-src.exp1
-rw-r--r--test/completion/smbcacls.exp1
-rw-r--r--test/completion/smbclient.exp1
-rw-r--r--test/completion/smbcquotas.exp1
-rw-r--r--test/completion/smbget.exp1
-rw-r--r--test/completion/smbpasswd.exp1
-rw-r--r--test/completion/smbtar.exp1
-rw-r--r--test/completion/smbtree.exp1
-rw-r--r--test/completion/ssh-copy-id.exp1
-rw-r--r--test/completion/stream.exp1
-rw-r--r--test/completion/tcpdump.exp1
-rw-r--r--test/completion/tracepath.exp1
-rw-r--r--test/completion/upgradepkg.exp1
-rw-r--r--test/completion/vipw.exp1
-rw-r--r--test/completion/watch.exp1
-rw-r--r--test/completion/xgamma.exp1
-rw-r--r--test/completion/xzdec.exp1
-rw-r--r--test/fixtures/ant/build.xml17
-rw-r--r--test/fixtures/cvs/foo/CVS/Entries2
-rw-r--r--test/fixtures/cvs/foo/bar0
-rw-r--r--test/fixtures/cvs/foo/quux0
-rw-r--r--test/fixtures/htpasswd/htpasswd2
-rw-r--r--test/fixtures/mutt/bar/muttrc_b1
-rw-r--r--test/fixtures/mutt/foo/muttrc_f0
-rw-r--r--test/fixtures/mutt/muttrc1
-rw-r--r--test/fixtures/slackware/etc/slapt-get/slapt-getrc0
-rw-r--r--test/fixtures/slackware/etc/slapt-get/slapt-srcrc0
-rw-r--r--test/fixtures/slackware/home/abc-4-i686-1.txz1
-rw-r--r--test/fixtures/slackware/home/opq-1.0-2.i386.rpm1
-rw-r--r--test/fixtures/slackware/home/tcl.d/tcl.tgz1
-rw-r--r--test/fixtures/slackware/usr/src/slapt-src/slackbuilds_data20
-rw-r--r--test/fixtures/slackware/var/log/packages/radeontool-1.6.1-i486-124
-rw-r--r--test/fixtures/slackware/var/log/packages/rzip-2.1-i486-129
-rw-r--r--test/fixtures/slackware/var/slapt-get/package_data47
-rw-r--r--test/lib/completions/a2x.exp20
-rw-r--r--test/lib/completions/ant.exp6
-rw-r--r--test/lib/completions/arping.exp21
-rw-r--r--test/lib/completions/asciidoc.exp20
-rw-r--r--test/lib/completions/avctrl.exp20
-rw-r--r--test/lib/completions/base64.exp20
-rw-r--r--test/lib/completions/c++.exp1
-rw-r--r--test/lib/completions/cal.exp20
-rw-r--r--test/lib/completions/cfagent.exp20
-rw-r--r--test/lib/completions/chage.exp20
-rw-r--r--test/lib/completions/chown.exp6
-rw-r--r--test/lib/completions/chpasswd.exp20
-rw-r--r--test/lib/completions/chrpath.exp21
-rw-r--r--test/lib/completions/chsh.exp2
-rw-r--r--test/lib/completions/ciptool.exp20
-rw-r--r--test/lib/completions/compare.exp20
-rw-r--r--test/lib/completions/conjure.exp20
-rw-r--r--test/lib/completions/convert.exp2
-rw-r--r--test/lib/completions/cppcheck.exp30
-rw-r--r--test/lib/completions/curl.exp20
-rw-r--r--test/lib/completions/cvs.exp5
-rw-r--r--test/lib/completions/dfutool.exp20
-rw-r--r--test/lib/completions/display.exp17
-rw-r--r--test/lib/completions/dmesg.exp18
-rw-r--r--test/lib/completions/dot.exp20
-rw-r--r--test/lib/completions/explodepkg.exp25
-rw-r--r--test/lib/completions/faillog.exp20
-rw-r--r--test/lib/completions/fbgs.exp20
-rw-r--r--test/lib/completions/fbi.exp20
-rw-r--r--test/lib/completions/feh.exp55
-rw-r--r--test/lib/completions/file.exp21
-rw-r--r--test/lib/completions/find.exp2
-rw-r--r--test/lib/completions/finger.exp4
-rw-r--r--test/lib/completions/fusermount.exp20
-rw-r--r--test/lib/completions/gendiff.exp20
-rw-r--r--test/lib/completions/gnome-mplayer.exp20
-rw-r--r--test/lib/completions/gpasswd.exp20
-rw-r--r--test/lib/completions/grpck.exp20
-rw-r--r--test/lib/completions/hciattach.exp20
-rw-r--r--test/lib/completions/hciconfig.exp20
-rw-r--r--test/lib/completions/hddtemp.exp20
-rw-r--r--test/lib/completions/host.exp20
-rw-r--r--test/lib/completions/htpasswd.exp32
-rw-r--r--test/lib/completions/idn.exp20
-rw-r--r--test/lib/completions/import.exp20
-rw-r--r--test/lib/completions/installpkg.exp49
-rw-r--r--test/lib/completions/ionice.exp18
-rw-r--r--test/lib/completions/java.exp11
-rw-r--r--test/lib/completions/javadoc.exp6
-rw-r--r--test/lib/completions/jps.exp20
-rw-r--r--test/lib/completions/kcov.exp27
-rw-r--r--test/lib/completions/kill.exp8
-rw-r--r--test/lib/completions/killall.exp2
-rw-r--r--test/lib/completions/l2ping.exp20
-rw-r--r--test/lib/completions/lastlog.exp20
-rw-r--r--test/lib/completions/ldapadd.exp20
-rw-r--r--test/lib/completions/ldapcompare.exp20
-rw-r--r--test/lib/completions/ldapdelete.exp20
-rw-r--r--test/lib/completions/ldapmodrdn.exp20
-rw-r--r--test/lib/completions/ldappasswd.exp20
-rw-r--r--test/lib/completions/ldapsearch.exp20
-rw-r--r--test/lib/completions/ldapvi.exp20
-rw-r--r--test/lib/completions/ldapwhoami.exp20
-rw-r--r--test/lib/completions/lpq.exp20
-rw-r--r--test/lib/completions/lpr.exp20
-rw-r--r--test/lib/completions/lvchange.exp4
-rw-r--r--test/lib/completions/lvcreate.exp4
-rw-r--r--test/lib/completions/lvdisplay.exp4
-rw-r--r--test/lib/completions/lvextend.exp4
-rw-r--r--test/lib/completions/lvmdiskscan.exp4
-rw-r--r--test/lib/completions/lvreduce.exp4
-rw-r--r--test/lib/completions/lvremove.exp4
-rw-r--r--test/lib/completions/lvrename.exp4
-rw-r--r--test/lib/completions/lvresize.exp4
-rw-r--r--test/lib/completions/lvs.exp4
-rw-r--r--test/lib/completions/lvscan.exp4
-rw-r--r--test/lib/completions/makepkg.exp28
-rw-r--r--test/lib/completions/mdadm.exp18
-rw-r--r--test/lib/completions/mdtool.exp20
-rw-r--r--test/lib/completions/medusa.exp20
-rw-r--r--test/lib/completions/mii-diag.exp20
-rw-r--r--test/lib/completions/mii-tool.exp20
-rw-r--r--test/lib/completions/mkdir.exp7
-rw-r--r--test/lib/completions/monodevelop.exp20
-rw-r--r--test/lib/completions/mount.exp9
-rw-r--r--test/lib/completions/msynctool.exp20
-rw-r--r--test/lib/completions/mutt.exp16
-rw-r--r--test/lib/completions/mysql.exp20
-rw-r--r--test/lib/completions/newusers.exp20
-rw-r--r--test/lib/completions/nslookup.exp20
-rw-r--r--test/lib/completions/openssl.exp4
-rw-r--r--test/lib/completions/passwd.exp20
-rw-r--r--test/lib/completions/perl.exp2
-rw-r--r--test/lib/completions/perldoc.exp2
-rw-r--r--test/lib/completions/phing.exp20
-rw-r--r--test/lib/completions/pinfo.exp20
-rw-r--r--test/lib/completions/ping.exp3
-rw-r--r--test/lib/completions/pkgtool.exp20
-rw-r--r--test/lib/completions/postcat.exp20
-rw-r--r--test/lib/completions/postconf.exp20
-rw-r--r--test/lib/completions/postfix.exp20
-rw-r--r--test/lib/completions/postmap.exp20
-rw-r--r--test/lib/completions/postsuper.exp20
-rw-r--r--test/lib/completions/prelink.exp21
-rw-r--r--test/lib/completions/protoc.exp20
-rw-r--r--test/lib/completions/puppet.exp20
-rw-r--r--test/lib/completions/pvchange.exp4
-rw-r--r--test/lib/completions/pvcreate.exp4
-rw-r--r--test/lib/completions/pvdisplay.exp4
-rw-r--r--test/lib/completions/pvremove.exp4
-rw-r--r--test/lib/completions/pvs.exp4
-rw-r--r--test/lib/completions/pwck.exp20
-rw-r--r--test/lib/completions/pwdx.exp20
-rw-r--r--test/lib/completions/pwgen.exp20
-rw-r--r--test/lib/completions/qemu.exp20
-rw-r--r--test/lib/completions/quota.exp20
-rw-r--r--test/lib/completions/quotacheck.exp20
-rw-r--r--test/lib/completions/quotaon.exp20
-rw-r--r--test/lib/completions/rdesktop.exp20
-rw-r--r--test/lib/completions/removepkg.exp19
-rw-r--r--test/lib/completions/reptyr.exp22
-rw-r--r--test/lib/completions/rfcomm.exp20
-rw-r--r--test/lib/completions/ri.exp2
-rw-r--r--test/lib/completions/route.exp20
-rw-r--r--test/lib/completions/rpm2tgz.exp31
-rw-r--r--test/lib/completions/rpmbuild.exp20
-rw-r--r--test/lib/completions/rsync.exp6
-rw-r--r--test/lib/completions/sbopkg.exp20
-rw-r--r--test/lib/completions/scp.exp9
-rw-r--r--test/lib/completions/screen.exp8
-rw-r--r--test/lib/completions/sdptool.exp20
-rw-r--r--test/lib/completions/setquota.exp20
-rw-r--r--test/lib/completions/slackpkg.exp20
-rw-r--r--test/lib/completions/slapt-get.exp46
-rw-r--r--test/lib/completions/slapt-src.exp49
-rw-r--r--test/lib/completions/smbcacls.exp20
-rw-r--r--test/lib/completions/smbclient.exp20
-rw-r--r--test/lib/completions/smbcquotas.exp20
-rw-r--r--test/lib/completions/smbget.exp20
-rw-r--r--test/lib/completions/smbpasswd.exp20
-rw-r--r--test/lib/completions/smbtar.exp20
-rw-r--r--test/lib/completions/smbtree.exp20
-rw-r--r--test/lib/completions/ssh-copy-id.exp20
-rw-r--r--test/lib/completions/stream.exp20
-rw-r--r--test/lib/completions/sudo.exp59
-rw-r--r--test/lib/completions/tcpdump.exp20
-rw-r--r--test/lib/completions/time.exp18
-rw-r--r--test/lib/completions/tracepath.exp21
-rw-r--r--test/lib/completions/upgradepkg.exp39
-rw-r--r--test/lib/completions/vgcfgbackup.exp4
-rw-r--r--test/lib/completions/vgcfgrestore.exp4
-rw-r--r--test/lib/completions/vgck.exp4
-rw-r--r--test/lib/completions/vgconvert.exp4
-rw-r--r--test/lib/completions/vgdisplay.exp4
-rw-r--r--test/lib/completions/vgexport.exp4
-rw-r--r--test/lib/completions/vgextend.exp4
-rw-r--r--test/lib/completions/vgimport.exp4
-rw-r--r--test/lib/completions/vgmerge.exp4
-rw-r--r--test/lib/completions/vgmknodes.exp4
-rw-r--r--test/lib/completions/vgreduce.exp4
-rw-r--r--test/lib/completions/vgremove.exp4
-rw-r--r--test/lib/completions/vgrename.exp4
-rw-r--r--test/lib/completions/vgs.exp4
-rw-r--r--test/lib/completions/vgscan.exp4
-rw-r--r--test/lib/completions/vipw.exp20
-rw-r--r--test/lib/completions/watch.exp18
-rw-r--r--test/lib/completions/xgamma.exp21
-rw-r--r--test/lib/completions/xhost.exp6
-rw-r--r--test/lib/completions/xvnc4viewer.exp2
-rw-r--r--test/lib/completions/xzdec.exp20
-rw-r--r--test/lib/library.exp60
-rw-r--r--test/lib/library.sh10
-rw-r--r--test/unit/_filedir.exp107
-rw-r--r--test/unit/_get_comp_words_by_ref.exp176
-rw-r--r--test/unit/_get_cword.exp94
-rw-r--r--test/unit/_init_completion.exp35
-rw-r--r--test/unit/_known_hosts_real.exp8
-rw-r--r--test/unit/_parse_help.exp74
-rw-r--r--test/unit/_parse_usage.exp59
-rw-r--r--test/unit/compgen.exp24
680 files changed, 14705 insertions, 9886 deletions
diff --git a/.dir-locals.el b/.dir-locals.el
new file mode 100644
index 00000000..537ba6c3
--- /dev/null
+++ b/.dir-locals.el
@@ -0,0 +1,5 @@
+;; bash-completion shell-script mode settings for Emacs
+
+((sh-mode . ((indent-tabs-mode . nil)
+ (sh-basic-offset . 4)
+ (sh-indent-comment . t))))
diff --git a/CHANGES b/CHANGES
index d700c46f..17667d08 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,175 @@
+bash-completion (1.90)
+
+ * bash-completion 2 preview: dynamic loading of completions.
+
+ [ David Paleino ]
+ * If _filedir 'ext' returns nothing, just fallback to generic file
+ completion. It is optional, and off by default. Patch by Clint Byrum
+ (Debian: #619014, LP: #533985)
+ * Fix __get_cword_at_cursor_by_ref: check for $index when completing with a
+ cword+1 argument already present (Debian: #622383)
+ * Layout change: everything is now in /usr/share/bash-completion/, rather
+ than in /etc/.
+ * Get rid of BASH_COMPLETION_DIR, BASH_COMPLETION_HELPERS_DIR, BASH_COMPLETION
+ * Fix autotools to use pkgdatadir instead of redefining datadir, get rid of
+ helpersdir.
+ * Implemented a blacklist for unwanted third-parties completions
+ * New completions:
+ - epdfview, lpr and lpq (Raphaƫl Droz), mysql (Raphaƫl Droz)
+ * Improved completions:
+ - ant: handle "extension-point" the same as "target" tag (Petr Kozelka,
+ Alioth: #313105)
+ - apt: add 'download' to subcommands (Debian: #625234, Ubuntu: #720541)
+ - aptitude: add 'versions' command (Debian: #604393)
+ - dpkg-query: use the 'dpkg' completion (Debian: #642526)
+ - lintian: remove --unpack-level (Debian: #623680)
+ - {shadow,coreutils}: fix broken _allowed_groups usage
+ - rrdtool: complete filenames after commands (Debian: #577933)
+ - sitecopy: fixed a bug with grep and brackets: use sitecopy -v to fetch
+ sites (Raphaƫl Droz).
+
+ [ Freddy Vulto ]
+ * Improve __reassemble_comp_words_by_ref() (Alioth #313057)
+ * Testsuite:
+ - add -unsorted option to _get_hosts()
+
+ [ Guillaume Rousse ]
+ * Use $() for subshell, instead of backquotes
+ * Use simple quotes for constant strings
+ * Drop -o filenames, as suggested by Ville
+ * New completions: puppet
+
+ [ Igor Murzov ]
+ * Abort completion file loading earlier if required commands are not
+ available.
+ * docs: Improve tester's manual
+ * Make completions that use _command also work with file names
+ * _command_offset: Restore compopts used by called command.
+ * New completions:
+ - pkgtool, makepkg, rmp2tgz, slapt-get, slapt-src, slackpkg, kcov, feh,
+ xgamma, fbi, fbgs
+ * Improved completions:
+ - file: ddd few missing --exclude arguments completions
+ - host, nslookup: Remove completions for bind utils from bash_completion.
+ - {install,upgrade,explode}pkg: use -o plusdirs instead of -o dirnames
+ - makepkg: should complete filenames
+ - removepkg, upgradepkg, installpkg: add option completion
+ - xrandr: Add more option completions.
+ - overall clean up of different slackware-specific completions
+ * Testsuite:
+ - add basic tests for pkgtools, rpm2tgz, slapt, sbopkg, slackpkg
+ - fix broken tests for finger and xhost
+ - remove unused -expect-cmd-full option from assert_complete*
+
+ [ Sergey V ]
+ * New completions: sbopkg
+
+ [ Ville SkyttƤ ]
+ * Load completions in separate files dynamically, get rid of have()
+ * Drop unnecessary $USERLAND checks
+ * Try /usr/sbin before /sbin in have()
+ * Try both full path and basename completions for sudo etc (Alioth: #313065)
+ * Add _init_completion() for common completion initialization and generic
+ redirection handling
+ * Replace actual sysconfdir in bash_completion on install (Alioth: #313081)
+ * Drop support for bash < 4.1
+ * Drop no longer needed _compopt_o_filenames()
+ * Drop no longer needed "type compopt" checks
+ * docs: Update "simply sourcing" instructions to match new layout, check
+ $PS1.
+ * Get rid of bash_completion self-parsing from _filedir_xspec
+ (RedHat: #479936).
+ * Provide profile.d hook for per user disabling of bash_completion
+ (Debian: #593835)
+ * New completions:
+ - a2x, arping, asciidoc, base64, cal, chrpath, cppcheck, curl, dmesg,
+ dot, file, gnome-mplayer, gprof, hddtemp, host, htpasswd, idn, ionice,
+ jps, lbunzip2, lbzip2, lbzcat, prelink, protoc, pwdx, pwgen, reptyr,
+ sum (RedHat: #717341), watch
+ - phing: reuse ant completion (Elan RuusamƤe, Alioth: #312910)
+ - pinfo: reuse info completion
+ * Improved completions:
+ - bluez, e2fsprogs, grpck, java (Mattias Ulbrich), passwd, pwck, route,
+ rsync, smartctl
+ - ant: improve -lib, -find/-s, and -D argument completions; rewrite build
+ target parsing in plain bash, add build file test case
+ - aspell: add --add-filter|--rem-filter completions; get --mode completions
+ from 'aspell modes' output
+ - bzip2, gzip, python, sysbench: quote command argument to _parse_help()
+ - chsh: use _allowed_users instead of plain compgen -u
+ - cksfv: add -g argument completion
+ - cpan2dist: don't hang if no package list files exist
+ - crontab: use /sys/fs/selinux and /selinux instead of /etc/selinux to
+ find out if SELinux is around
+ - cvs: (diff) parse options from cvs diff instead of plain diff; drop -o
+ default to fix CVS root completions; (commit) complete on entries
+ instead of default if COMP_CVS_REMOTE is not set; improve CVS
+ controlled file completions; add CVS controlled file completions for
+ admin and update; list "primary" command names first in mode switch;
+ recognize some additional commands and synonyms; add editors/watchers
+ completion; sort mode completions alphabetically
+ - freeciv: complete freeciv-* in addition to civclient/civserver
+ - gdb: improve filename completion
+ - gendiff: do file completion after output redirection
+ - getent: add gshadow to known databases; allow multiple completions from
+ same db, add option completion
+ - info: add option completion support
+ - ipsec (Tobias Brunner): drop uname check, add strongSwan specific
+ completion with fallback, complete connection names for 'up', 'down' and
+ other commands
+ - jar: complete on *.sar (JBoss service archive)
+ - java, javac: add -X* completions
+ - javadoc: implement -linkoffline two argument completion
+ - killall: activate completion on Darwin (Alioth: #312350)
+ - (la)tex (Ted Pavlic): add *.dbj to filename completions (RedHat: #678122)
+ - man: add option parsing and completion
+ - modplug*: add more extensions for files supported by libmodplug
+ - mutt: support tildes when recursively sourcing muttrc files
+ (Debian: #615134); expand tilde in mutt query command (Alioth: #312759)
+ - ntpdate: add some option argument (non)completions
+ - oo{writer,impress,calc,draw} (Matej Cepl): complete on LibreOffice
+ FlatXML extensions (RedHat: #692548)
+ - perldoc (Scott Bronson): override MANPAGER when generating perldoc
+ completions (RedHat: #689180); don't parse man page when we know it'll
+ produce no completions; use perldoc itself instead of man
+ - pgrep: add option and option argument completions
+ - rpm: make rpm --queryformat use more consistent; drop rpm query support
+ for rpm < 4.1
+ - rpmbuild: add --buildpolicy completion
+ - rpmcheck: drop reference to undefined $files variable (Alioth: #313270)
+ - screen: add _terms() and -T completion; add commands completion
+ (Alioth: #312164, RedHat: #547852)
+ - _services: avoid bogus completions when init or xinetd dirs exist but are
+ empty; include systemd services
+ - smartctl: fix short alternative for --tolerance
+ - ssh, scp, sftp, ssh-copy-id: add some option argument (non)completions
+ - strace: don't append space for -e *= completions; don't try to extract
+ syscall names if they're not going to be used; rewrite arch specific
+ syscall extraction in plain bash
+ - svn*: don't suggest short options
+ - tar: fix completion of files inside *.tar.bz2 archives when [Ijy] is not
+ given; added option completions; improve tar *[cr]*f completions
+ (Debian: #618734)
+ - unzip: complete on *.sar (JBoss service archive)
+ - xmllint, xmlwf: complete on *.tld (tag library descriptor)
+ - xmlwf: add -v non-completion
+ - xmms: add some option argument completions
+ - xz: apply xz completion to pxz too; non-complete
+ --memlimit{,-compress,-decompress}
+ * Testsuite:
+ - add basic tests for gendiff, mdadm, puppet, xzdec, mii-diag, mii-tool,
+ grpck, passwd, pwck, samba, rdesktop, fusermount, tcpdump, l2ping,
+ ssh-copy-id, postfix, qemu, ldap*, medusa, mdtool, monodevelop,
+ msynctool, cfagent, lpr, lpq, mysql, nslookup, compare, conjure,
+ import, stream
+ - fix tests for ri
+ - fix get_hosts option docs.
+ - add test case for Debian: #622383.
+ - add chown foo: and :foo test cases, should complete files
+ (RedHat: #710714)
+
+ -- David Paleino <d.paleino@gmail.com> Thu, 03 Nov 2011 09:53:55 +0000
+
bash-completion (1.3)
[ Guillaume Rousse ]
diff --git a/Makefile.am b/Makefile.am
index dcecc32c..3441b630 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,13 +1,23 @@
-SUBDIRS = completions test
+SUBDIRS = completions helpers test
-sysconf_DATA = bash_completion
+pkgdata_DATA = bash_completion
profiledir = $(sysconfdir)/profile.d
profile_DATA = bash_completion.sh
+pkgconfigdir = $(datadir)/pkgconfig
+pkgconfig_DATA = bash-completion.pc
+
bash_completion.sh: bash_completion.sh.in Makefile
- sed -e 's|@sysconfdir[@]|$(sysconfdir)|' <$(srcdir)/$@.in >$@
+ sed -e 's|@pkgdatadir[@]|$(pkgdatadir)|' <$(srcdir)/$@.in >$@
+
+CLEANFILES = bash_completion.sh bash-completion.pc
-CLEANFILES = bash_completion.sh
+EXTRA_DIST = CHANGES $(sysconf_DATA) $(pkgdata_DATA) bash_completion.sh.in \
+ .dir-locals.el
-EXTRA_DIST = CHANGES $(sysconf_DATA) bash_completion.sh.in
+install-data-hook:
+ tmpfile=`mktemp $${TMPDIR:-/tmp}/bash_completion.XXXXXX` && \
+ sed -e 's|=/etc/bash_completion\.d|=$(sysconfdir)/bash_completion.d|' \
+ $(DESTDIR)$(pkgdatadir)/bash_completion > $$tmpfile && \
+ mv $$tmpfile $(DESTDIR)$(pkgdatadir)/bash_completion
diff --git a/Makefile.in b/Makefile.in
index 27ad8d02..43fbb6d7 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -34,8 +34,8 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
subdir = .
DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
- $(srcdir)/Makefile.in $(top_srcdir)/configure AUTHORS COPYING \
- TODO install-sh missing
+ $(srcdir)/Makefile.in $(srcdir)/bash-completion.pc.in \
+ $(top_srcdir)/configure AUTHORS COPYING install-sh missing
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
@@ -43,7 +43,7 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno config.status.lineno
mkinstalldirs = $(install_sh) -d
-CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_FILES = bash-completion.pc
CONFIG_CLEAN_VPATH_FILES =
SOURCES =
DIST_SOURCES =
@@ -75,8 +75,9 @@ am__nobase_list = $(am__nobase_strip_setup); \
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
-am__installdirs = "$(DESTDIR)$(profiledir)" "$(DESTDIR)$(sysconfdir)"
-DATA = $(profile_DATA) $(sysconf_DATA)
+am__installdirs = "$(DESTDIR)$(pkgconfigdir)" \
+ "$(DESTDIR)$(pkgdatadir)" "$(DESTDIR)$(profiledir)"
+DATA = $(pkgconfig_DATA) $(pkgdata_DATA) $(profile_DATA)
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
@@ -139,6 +140,7 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
+LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
@@ -161,16 +163,15 @@ abs_top_srcdir = @abs_top_srcdir@
am__leading_dot = @am__leading_dot@
am__tar = @am__tar@
am__untar = @am__untar@
-bashcompdir = @bashcompdir@
bindir = @bindir@
build_alias = @build_alias@
builddir = @builddir@
+compatdir = @compatdir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
-helpersdir = @helpersdir@
host_alias = @host_alias@
htmldir = @htmldir@
includedir = @includedir@
@@ -195,12 +196,16 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-SUBDIRS = completions test
-sysconf_DATA = bash_completion
+SUBDIRS = completions helpers test
+pkgdata_DATA = bash_completion
profiledir = $(sysconfdir)/profile.d
profile_DATA = bash_completion.sh
-CLEANFILES = bash_completion.sh
-EXTRA_DIST = CHANGES $(sysconf_DATA) bash_completion.sh.in
+pkgconfigdir = $(datadir)/pkgconfig
+pkgconfig_DATA = bash-completion.pc
+CLEANFILES = bash_completion.sh bash-completion.pc
+EXTRA_DIST = CHANGES $(sysconf_DATA) $(pkgdata_DATA) bash_completion.sh.in \
+ .dir-locals.el
+
all: all-recursive
.SUFFIXES:
@@ -238,46 +243,68 @@ $(top_srcdir)/configure: $(am__configure_deps)
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
$(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
$(am__aclocal_m4_deps):
-install-profileDATA: $(profile_DATA)
+bash-completion.pc: $(top_builddir)/config.status $(srcdir)/bash-completion.pc.in
+ cd $(top_builddir) && $(SHELL) ./config.status $@
+install-pkgconfigDATA: $(pkgconfig_DATA)
@$(NORMAL_INSTALL)
- test -z "$(profiledir)" || $(MKDIR_P) "$(DESTDIR)$(profiledir)"
- @list='$(profile_DATA)'; test -n "$(profiledir)" || list=; \
+ test -z "$(pkgconfigdir)" || $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)"
+ @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
done | $(am__base_list) | \
while read files; do \
- echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(profiledir)'"; \
- $(INSTALL_DATA) $$files "$(DESTDIR)$(profiledir)" || exit $$?; \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgconfigdir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgconfigdir)" || exit $$?; \
done
-uninstall-profileDATA:
+uninstall-pkgconfigDATA:
@$(NORMAL_UNINSTALL)
- @list='$(profile_DATA)'; test -n "$(profiledir)" || list=; \
+ @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
test -n "$$files" || exit 0; \
- echo " ( cd '$(DESTDIR)$(profiledir)' && rm -f" $$files ")"; \
- cd "$(DESTDIR)$(profiledir)" && rm -f $$files
-install-sysconfDATA: $(sysconf_DATA)
+ echo " ( cd '$(DESTDIR)$(pkgconfigdir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(pkgconfigdir)" && rm -f $$files
+install-pkgdataDATA: $(pkgdata_DATA)
@$(NORMAL_INSTALL)
- test -z "$(sysconfdir)" || $(MKDIR_P) "$(DESTDIR)$(sysconfdir)"
- @list='$(sysconf_DATA)'; test -n "$(sysconfdir)" || list=; \
+ test -z "$(pkgdatadir)" || $(MKDIR_P) "$(DESTDIR)$(pkgdatadir)"
+ @list='$(pkgdata_DATA)'; test -n "$(pkgdatadir)" || list=; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
done | $(am__base_list) | \
while read files; do \
- echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(sysconfdir)'"; \
- $(INSTALL_DATA) $$files "$(DESTDIR)$(sysconfdir)" || exit $$?; \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgdatadir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgdatadir)" || exit $$?; \
done
-uninstall-sysconfDATA:
+uninstall-pkgdataDATA:
@$(NORMAL_UNINSTALL)
- @list='$(sysconf_DATA)'; test -n "$(sysconfdir)" || list=; \
+ @list='$(pkgdata_DATA)'; test -n "$(pkgdatadir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
test -n "$$files" || exit 0; \
- echo " ( cd '$(DESTDIR)$(sysconfdir)' && rm -f" $$files ")"; \
- cd "$(DESTDIR)$(sysconfdir)" && rm -f $$files
+ echo " ( cd '$(DESTDIR)$(pkgdatadir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(pkgdatadir)" && rm -f $$files
+install-profileDATA: $(profile_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(profiledir)" || $(MKDIR_P) "$(DESTDIR)$(profiledir)"
+ @list='$(profile_DATA)'; test -n "$(profiledir)" || list=; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(profiledir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(profiledir)" || exit $$?; \
+ done
+
+uninstall-profileDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(profile_DATA)'; test -n "$(profiledir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ test -n "$$files" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(profiledir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(profiledir)" && rm -f $$files
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
@@ -593,7 +620,7 @@ check: check-recursive
all-am: Makefile $(DATA)
installdirs: installdirs-recursive
installdirs-am:
- for dir in "$(DESTDIR)$(profiledir)" "$(DESTDIR)$(sysconfdir)"; do \
+ for dir in "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(pkgdatadir)" "$(DESTDIR)$(profiledir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-recursive
@@ -643,13 +670,15 @@ info: info-recursive
info-am:
-install-data-am: install-profileDATA
-
+install-data-am: install-pkgconfigDATA install-pkgdataDATA \
+ install-profileDATA
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) install-data-hook
install-dvi: install-dvi-recursive
install-dvi-am:
-install-exec-am: install-sysconfDATA
+install-exec-am:
install-html: install-html-recursive
@@ -689,10 +718,11 @@ ps: ps-recursive
ps-am:
-uninstall-am: uninstall-profileDATA uninstall-sysconfDATA
+uninstall-am: uninstall-pkgconfigDATA uninstall-pkgdataDATA \
+ uninstall-profileDATA
.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \
- install-am install-strip tags-recursive
+ install-am install-data-am install-strip tags-recursive
.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
all all-am am--refresh check check-am clean clean-generic \
@@ -701,19 +731,26 @@ uninstall-am: uninstall-profileDATA uninstall-sysconfDATA
distclean distclean-generic distclean-tags distcleancheck \
distdir distuninstallcheck dvi dvi-am html html-am info \
info-am install install-am install-data install-data-am \
- install-dvi install-dvi-am install-exec install-exec-am \
- install-html install-html-am install-info install-info-am \
- install-man install-pdf install-pdf-am install-profileDATA \
- install-ps install-ps-am install-strip install-sysconfDATA \
- installcheck installcheck-am installdirs installdirs-am \
- maintainer-clean maintainer-clean-generic mostlyclean \
- mostlyclean-generic pdf pdf-am ps ps-am tags tags-recursive \
- uninstall uninstall-am uninstall-profileDATA \
- uninstall-sysconfDATA
+ install-data-hook install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-man install-pdf install-pdf-am \
+ install-pkgconfigDATA install-pkgdataDATA install-profileDATA \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs installdirs-am maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
+ pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \
+ uninstall-pkgconfigDATA uninstall-pkgdataDATA \
+ uninstall-profileDATA
bash_completion.sh: bash_completion.sh.in Makefile
- sed -e 's|@sysconfdir[@]|$(sysconfdir)|' <$(srcdir)/$@.in >$@
+ sed -e 's|@pkgdatadir[@]|$(pkgdatadir)|' <$(srcdir)/$@.in >$@
+
+install-data-hook:
+ tmpfile=`mktemp $${TMPDIR:-/tmp}/bash_completion.XXXXXX` && \
+ sed -e 's|=/etc/bash_completion\.d|=$(sysconfdir)/bash_completion.d|' \
+ $(DESTDIR)$(pkgdatadir)/bash_completion > $$tmpfile && \
+ mv $$tmpfile $(DESTDIR)$(pkgdatadir)/bash_completion
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/README b/README
index 71758cd0..428f2947 100644
--- a/README
+++ b/README
@@ -8,11 +8,10 @@ from either /etc/bashrc or ~/.bashrc (or any other file sourcing those). You
can do this by simply using:
# Use bash-completion, if available
-if [ -f /etc/bash_completion ]; then
- . /etc/bash_completion
-fi
+[[ $PS1 && -f /usr/share/bash-completion/bash-completion ]] && \
+ . /usr/share/bash-completion/bash-completion
-(if you happen to have *only* bash >= 3.2 installed, see further if not)
+(if you happen to have *only* bash >= 4.1 installed, see further if not)
If you don't have the package readily available for your distribution, or
you simply don't want to use one, you can install bash completion using the
@@ -30,19 +29,22 @@ mechanism, i.e. does not automatically source shell scripts in it, you
can source the $sysconfdir/profile.d/bash_completion.sh script in
/etc/bashrc or ~/.bashrc.
+The profile.d script provides a configuration file hook that can be
+used to prevent loading bash_completion on per user basis when it's
+installed system wide. To do this, turn off programmable completion
+with "shopt -u progcomp" in $XDG_CONFIG_HOME/bash_completion
+(~/.config/bash_completion if $XDG_CONFIG_HOME is not set), and turn
+it back on for example in ~/.bashrc if you want to use programmable
+completion for other purposes.
+
If you're using MacOS X, /etc/bashrc is apparently not sourced at all.
-In that case, you should put the bash_completion file in /sw/etc and add
+In that case, you can put the bash_completion file in /sw/etc and add
the following code to ~/.bash_profile:
if [ -f /sw/etc/bash_completion ]; then
. /sw/etc/bash_completion
fi
-If you are putting the bash completion source file somewhere other
-than /etc/bash_completion, you should ensure that $BASH_COMPLETION is
-set to point to it before you source it. Your ~/.bashrc file is a good
-place to do this.
-
TROUBLESHOOTING
---------------
@@ -68,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'
@@ -125,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_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
@@ -291,12 +287,10 @@ guidelines in mind:
start interpreters. Use lightweight programs such as grep(1), awk(1)
and sed(1).
-- Use the full power of bash >= 3.2. We no longer support earlier bash
+- Use the full power of bash >= 4.1. We no longer support earlier bash
versions, so you may as well use all the features of that version of
bash to optimise your code. However, be careful when using features
- added since bash 3.2, since not everyone will be able to use them. Be
- ESPECIALLY careful of using features exclusive to 4.x, as many people
- are still using 3.x.
+ added since bash 4.1, since not everyone will be able to use them.
For example, extended globs often enable you to avoid the use of
external programs, which are expensive to fork and execute, so do
@@ -374,10 +368,10 @@ guidelines in mind:
- Generate patches preferably against the git repository, with "git
format-patch origin/master" (assuming the diff was against the
- origin/master branch), and don't forget the entry for the CHANGES file
- if you feel that the change deserves one. If you don't have git
- available or can't access the repository for some reason, generate
- patches as unified diffs ('diff -u').
+ origin/master branch), and send them preferably with "git
+ send-email". If you don't have git available or can't access the
+ repository for some reason, generate patches as unified diffs
+ ('diff -u').
- If your code was written for a particular platform, try to make it
portable to other platforms, so that everyone may enjoy it. If your
diff --git a/TODO b/TODO
deleted file mode 100644
index 7a5afe5d..00000000
--- a/TODO
+++ /dev/null
@@ -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 3.2+ 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/aclocal.m4 b/aclocal.m4
index fa01d2d9..3052e91c 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -13,8 +13,8 @@
m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
-m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.67],,
-[m4_warning([this file was generated for autoconf 2.67.
+m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
+[m4_warning([this file was generated for autoconf 2.68.
You have another version of autoconf. It may work, but is not guaranteed to.
If you have problems, you may need to regenerate the build system entirely.
To do so, use the procedure documented by the package, typically `autoreconf'.])])
diff --git a/bash-completion.pc.in b/bash-completion.pc.in
new file mode 100644
index 00000000..c73cd39e
--- /dev/null
+++ b/bash-completion.pc.in
@@ -0,0 +1,9 @@
+prefix=@prefix@
+compatdir=@compatdir@
+completionsdir=@datarootdir@/@PACKAGE@/completions
+helpersdir=@datarootdir@/@PACKAGE@/helpers
+
+Name: bash-completion
+Description: programmable completion for the bash shell
+URL: http://bash-completion.alioth.debian.org/
+Version: @VERSION@
diff --git a/bash_completion b/bash_completion
index 66019379..62ef87ed 100644
--- a/bash_completion
+++ b/bash_completion
@@ -1,5 +1,6 @@
+# -*- shell-script -*-
#
-# bash_completion - programmable completion functions for bash 3.2+
+# bash_completion - programmable completion functions for bash 4.1+
#
# Copyright Ā© 2006-2008, Ian Macdonald <ian@caliban.org>
# Ā© 2009-2011, Bash Completion Maintainers
@@ -17,13 +18,13 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# The latest version of this software can be obtained here:
#
# http://bash-completion.alioth.debian.org/
#
-# RELEASE: 1.3
+# RELEASE: 1.90
if [[ $- == *v* ]]; then
BASH_COMPLETION_ORIGINAL_V_VALUE="-v"
@@ -39,21 +40,12 @@ fi
# Alter the following to reflect the location of this file.
#
-[ -n "$BASH_COMPLETION" ] || BASH_COMPLETION=/etc/bash_completion
-[ -n "$BASH_COMPLETION_DIR" ] || BASH_COMPLETION_DIR=/etc/bash_completion.d
[ -n "$BASH_COMPLETION_COMPAT_DIR" ] || BASH_COMPLETION_COMPAT_DIR=/etc/bash_completion.d
-readonly BASH_COMPLETION BASH_COMPLETION_DIR BASH_COMPLETION_COMPAT_DIR
+readonly BASH_COMPLETION_COMPAT_DIR
-# Set a couple of useful vars
+# Blacklisted completions, causing problems with our code.
#
-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
+_blacklist_glob='@(acroread.sh)'
# Turn on extended globbing and programmable completion
shopt -s extglob progcomp
@@ -64,68 +56,6 @@ shopt -s extglob progcomp
# Make directory commands see only directories
complete -d pushd
-# The following section lists completions that are redefined later
-# Do NOT break these over multiple lines.
-#
-# START exclude -- do NOT remove this line
-# bzcmp, bzdiff, bz*grep, bzless, bzmore intentionally not here, see Debian: #455510
-complete -f -X '!*.?(t)bz?(2)' bunzip2 bzcat pbunzip2 pbzcat
-complete -f -X '!*.@(zip|[ejw]ar|exe|pk3|wsz|zargo|xpi|sxw|o[tx]t|od[fgpst]|epub|apk)' unzip zipinfo
-complete -f -X '*.Z' compress znew
-# zcmp, zdiff, z*grep, zless, zmore intentionally not here, see Debian: #455510
-complete -f -X '!*.@(Z|[gGd]z|t[ag]z)' gunzip zcat unpigz
-complete -f -X '!*.Z' uncompress
-# lzcmp, lzdiff intentionally not here, see Debian: #455510
-complete -f -X '!*.@(tlz|lzma)' lzcat lzegrep lzfgrep lzgrep lzless lzmore unlzma
-complete -f -X '!*.@(?(t)xz|tlz|lzma)' unxz xzcat
-complete -f -X '!*.lrz' lrunzip
-complete -f -X '!*.@(gif|jp?(e)g|miff|tif?(f)|pn[gm]|p[bgp]m|bmp|xpm|ico|xwd|tga|pcx)' ee
-complete -f -X '!*.@(gif|jp?(e)g|tif?(f)|png|p[bgp]m|bmp|x[bp]m|rle|rgb|pcx|fits|pm)' xv qiv
-complete -f -X '!*.@(@(?(e)ps|?(E)PS|pdf|PDF)?(.gz|.GZ|.bz2|.BZ2|.Z))' gv ggv kghostview
-complete -f -X '!*.@(dvi|DVI)?(.@(gz|Z|bz2))' xdvi kdvi
-complete -f -X '!*.dvi' dvips dviselect dvitype dvipdf advi dvipdfm dvipdfmx
-complete -f -X '!*.[pf]df' acroread gpdf xpdf
-complete -f -X '!*.@(?(e)ps|pdf)' kpdf
-complete -f -X '!*.@(@(?(e)ps|?(E)PS|[pf]df|[PF]DF|dvi|DVI)?(.gz|.GZ|.bz2|.BZ2)|cb[rz]|djv?(u)|gif|jp?(e)g|miff|tif?(f)|pn[gm]|p[bgp]m|bmp|xpm|ico|xwd|tga|pcx|fdf)' evince
-complete -f -X '!*.@(okular|@(?(e|x)ps|?(E|X)PS|pdf|PDF|dvi|DVI|cb[rz]|CB[RZ]|djv?(u)|DJV?(U)|dvi|DVI|gif|jp?(e)g|miff|tif?(f)|pn[gm]|p[bgp]m|bmp|xpm|ico|xwd|tga|pcx|GIF|JP?(E)G|MIFF|TIF?(F)|PN[GM]|P[BGP]M|BMP|XPM|ICO|XWD|TGA|PCX|epub|EPUB|odt|ODT|fb?(2)|FB?(2)|mobi|MOBI|g3|G3|chm|CHM|fdf|FDF)?(.?(gz|GZ|bz2|BZ2)))' okular
-complete -f -X '!*.@(?(e)ps|pdf)' ps2pdf ps2pdf12 ps2pdf13 ps2pdf14 ps2pdfwr
-complete -f -X '!*.texi*' makeinfo texi2html
-complete -f -X '!*.@(?(la)tex|texi|dtx|ins|ltx)' tex latex slitex jadetex pdfjadetex pdftex pdflatex texi2dvi
-complete -f -X '!*.mp3' mpg123 mpg321 madplay
-complete -f -X '!*@(.@(mp?(e)g|MP?(E)G|wma|avi|AVI|asf|vob|VOB|bin|dat|divx|DIVX|vcd|ps|pes|fli|flv|FLV|fxm|FXM|viv|rm|ram|yuv|mov|MOV|qt|QT|wmv|mp[234]|MP[234]|m4[pv]|M4[PV]|mkv|MKV|og[gmv]|OG[GMV]|t[ps]|T[PS]|m2t?(s)|M2T?(S)|wav|WAV|flac|FLAC|asx|ASX|mng|MNG|srt|m[eo]d|M[EO]D|s[3t]m|S[3T]M|it|IT|xm|XM)|+([0-9]).@(vdr|VDR))?(.part)' xine aaxine fbxine
-complete -f -X '!*@(.@(mp?(e)g|MP?(E)G|wma|avi|AVI|asf|vob|VOB|bin|dat|divx|DIVX|vcd|ps|pes|fli|flv|FLV|fxm|FXM|viv|rm|ram|yuv|mov|MOV|qt|QT|wmv|mp[234]|MP[234]|m4[pv]|M4[PV]|mkv|MKV|og[gmv]|OG[GMV]|t[ps]|T[PS]|m2t?(s)|M2T?(S)|wav|WAV|flac|FLAC|asx|ASX|mng|MNG|srt|m[eo]d|M[EO]D|s[3t]m|S[3T]M|it|IT|xm|XM|iso|ISO)|+([0-9]).@(vdr|VDR))?(.part)' kaffeine dragon
-complete -f -X '!*.@(avi|asf|wmv)' aviplay
-complete -f -X '!*.@(rm?(j)|ra?(m)|smi?(l))' realplay
-complete -f -X '!*.@(mpg|mpeg|avi|mov|qt)' xanim
-complete -f -X '!*.@(ogg|m3u|flac|spx)' ogg123
-complete -f -X '!*.@(mp3|ogg|pls|m3u)' gqmpeg freeamp
-complete -f -X '!*.fig' xfig
-complete -f -X '!*.@(mid?(i)|cmf)' playmidi
-complete -f -X '!*.@(mid?(i)|rmi|rcp|[gr]36|g18|mod|xm|it|x3m|s[3t]m|kar)' timidity
-complete -f -X '!*.@(m[eo]d|s[3t]m|xm|it)' modplugplay modplug123
-complete -f -X '*.@(o|so|so.!(conf)|a|[rs]pm|gif|jp?(e)g|mp3|mp?(e)g|avi|asf|ogg|class)' vi vim gvim rvim view rview rgvim rgview gview emacs xemacs sxemacs kate kwrite
-complete -f -X '!*.@([eE][xX][eE]?(.[sS][oO])|[cC][oO][mM]|[sS][cC][rR])' wine
-complete -f -X '!*.@(zip|z|gz|tgz)' bzme
-# konqueror not here on purpose, it's more than a web/html browser
-complete -f -X '!*.@(?([xX]|[sS])[hH][tT][mM]?([lL]))' netscape mozilla lynx opera galeon dillo elinks amaya firefox mozilla-firefox iceweasel google-chrome chromium-browser epiphany
-complete -f -X '!*.@(sxw|stw|sxg|sgl|doc?([mx])|dot?([mx])|rtf|txt|htm|html|odt|ott|odm)' oowriter
-complete -f -X '!*.@(sxi|sti|pps?(x)|ppt?([mx])|pot?([mx])|odp|otp)' ooimpress
-complete -f -X '!*.@(sxc|stc|xls?([bmx])|xlw|xlt?([mx])|[ct]sv|ods|ots)' oocalc
-complete -f -X '!*.@(sxd|std|sda|sdd|odg|otg)' oodraw
-complete -f -X '!*.@(sxm|smf|mml|odf)' oomath
-complete -f -X '!*.odb' oobase
-complete -f -X '!*.[rs]pm' rpm2cpio
-complete -f -X '!*.aux' bibtex
-complete -f -X '!*.po' poedit gtranslator kbabel lokalize
-complete -f -X '!*.@([Pp][Rr][Gg]|[Cc][Ll][Pp])' harbour gharbour hbpp
-complete -f -X '!*.[Hh][Rr][Bb]' hbrun
-complete -f -X '!*.ly' lilypond ly2dvi
-complete -f -X '!*.@(dif?(f)|?(d)patch)?(.@([gx]z|bz2|lzma))' cdiff
-complete -f -X '!*.lyx' lyx
-complete -f -X '!@(*.@(ks|jks|jceks|p12|pfx|bks|ubr|gkr|cer|crt|cert|p7b|pkipath|pem|p10|csr|crl)|cacerts)' portecle
-complete -f -X '!*.@(mp[234c]|og[ag]|@(fl|a)ac|m4[abp]|spx|tta|w?(a)v|wma|aif?(f)|asf|ape)' kid3 kid3-qt
-# FINISH exclude -- do not remove this line
-
# start of section containing compspecs that can be handled within bash
# user commands see only users
@@ -163,16 +93,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:/sbin:/usr/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
@@ -214,7 +159,8 @@ dequote()
# use multiple '_upvar' calls, since one '_upvar' call might
# reassign a variable to be used by another '_upvar' call.
# See: http://fvue.nl/wiki/Bash:_Passing_variables_by_reference
-_upvar() {
+_upvar()
+{
if unset -v "$1"; then # Unset & validate varname
if (( $# == 2 )); then
eval $1=\"\$2\" # Return single value
@@ -233,7 +179,8 @@ _upvar() {
# -v Assign single value to varname
# Return: 1 if error occurs
# See: http://fvue.nl/wiki/Bash:_Passing_variables_by_reference
-_upvars() {
+_upvars()
+{
if ! (( $# )); then
echo "${FUNCNAME[0]}: usage: ${FUNCNAME[0]} [-v varname"\
"value] | [-aN varname [value ...]] ..." 1>&2
@@ -276,8 +223,9 @@ _upvars() {
# @param $2 words Name of variable to return words to
# @param $3 cword Name of variable to return cword to
#
-__reassemble_comp_words_by_ref() {
- local exclude i j ref
+__reassemble_comp_words_by_ref()
+{
+ local exclude i j line ref
# Exclude word separator characters?
if [[ $1 ]]; then
# Yes, exclude word separator characters;
@@ -290,26 +238,40 @@ __reassemble_comp_words_by_ref() {
# Are characters excluded which were former included?
if [[ $exclude ]]; then
# Yes, list of word completion separators has shrunk;
+ line=$COMP_LINE
# Re-assemble words to complete
for (( i=0, j=0; i < ${#COMP_WORDS[@]}; i++, j++)); do
# Is current word not word 0 (the command itself) and is word not
- # empty and is word made up of just word separator characters to be
- # excluded?
+ # empty and is word made up of just word separator characters to
+ # be excluded and is current word not preceded by whitespace in
+ # original line?
while [[ $i -gt 0 && ${COMP_WORDS[$i]} &&
- ${COMP_WORDS[$i]//[^$exclude]} == ${COMP_WORDS[$i]}
+ ${COMP_WORDS[$i]//[^$exclude]} == ${COMP_WORDS[$i]}
]]; do
- [ $j -ge 2 ] && ((j--))
- # Append word separator to current word
+ # Is word separator not preceded by whitespace in original line
+ # and are we not going to append to word 0 (the command
+ # itself), then append to current word.
+ [[ ${line:0:1} != ' ' && ${line:0:1} != $'\t' ]] &&
+ (( j >= 2 )) && ((j--))
+ # Append word separator to current or new word
ref="$2[$j]"
eval $2[$j]=\${!ref}\${COMP_WORDS[i]}
# Indicate new cword
[ $i = $COMP_CWORD ] && eval $3=$j
- # Indicate next word if available, else end *both* while and for loop
+ # Remove optional whitespace + word separator from line copy
+ line=${line#*"${COMP_WORDS[$i]}"}
+ # Start new word if word separator in original line is
+ # followed by whitespace.
+ [[ ${line:0:1} == ' ' || ${line:0:1} == $'\t' ]] && ((j++))
+ # Indicate next word if available, else end *both* while and
+ # for loop
(( $i < ${#COMP_WORDS[@]} - 1)) && ((i++)) || break 2
done
# Append word to current word
ref="$2[$j]"
eval $2[$j]=\${!ref}\${COMP_WORDS[i]}
+ # Remove optional whitespace + word from line copy
+ line=${line#*"${COMP_WORDS[i]}"}
# Indicate new cword
[[ $i == $COMP_CWORD ]] && eval $3=$j
done
@@ -323,51 +285,50 @@ __reassemble_comp_words_by_ref() {
# @param $1 exclude Characters out of $COMP_WORDBREAKS which should NOT be
# considered word breaks. This is useful for things like scp where
# we want to return host:path and not only path, so we would pass the
-# colon (:) as $1 in this case. Bash-3 doesn't do word splitting, so this
-# ensures we get the same word on both bash-3 and bash-4.
+# colon (:) as $1 in this case.
# @param $2 words Name of variable to return words to
# @param $3 cword Name of variable to return cword to
# @param $4 cur Name of variable to return current word to complete to
-# @see ___get_cword_at_cursor_by_ref()
-__get_cword_at_cursor_by_ref() {
+# @see __reassemble_comp_words_by_ref()
+__get_cword_at_cursor_by_ref()
+{
local cword words=()
__reassemble_comp_words_by_ref "$1" words cword
- local i cur2
- local cur="$COMP_LINE"
- local index="$COMP_POINT"
- for (( i = 0; i <= cword; ++i )); do
- while [[
- # Current word fits in $cur?
- "${#cur}" -ge ${#words[i]} &&
- # $cur doesn't match cword?
- "${cur:0:${#words[i]}}" != "${words[i]}"
- ]]; do
- # Strip first character
- cur="${cur:1}"
- # Decrease cursor position
- ((index--))
- done
-
- # Does found word matches cword?
- if [[ "$i" -lt "$cword" ]]; then
- # No, cword lies further;
- local old_size="${#cur}"
- cur="${cur#${words[i]}}"
- local new_size="${#cur}"
- index=$(( index - old_size + new_size ))
- fi
- done
+ local i cur cur2 index=$COMP_POINT lead=${COMP_LINE:0:$COMP_POINT}
+ # Cursor not at position 0 and not leaded by just space(s)?
+ if [[ $index -gt 0 && ( $lead && ${lead//[[:space:]]} ) ]]; then
+ cur=$COMP_LINE
+ for (( i = 0; i <= cword; ++i )); do
+ while [[
+ # Current word fits in $cur?
+ "${#cur}" -ge ${#words[i]} &&
+ # $cur doesn't match cword?
+ "${cur:0:${#words[i]}}" != "${words[i]}"
+ ]]; do
+ # Strip first character
+ cur="${cur:1}"
+ # Decrease cursor position
+ ((index--))
+ done
- if [[ "${words[cword]:0:${#cur}}" != "$cur" ]]; then
- # We messed up. At least return the whole word so things keep working
- cur2=${words[cword]}
- else
- cur2=${cur:0:$index}
+ # Does found word match cword?
+ if [[ "$i" -lt "$cword" ]]; then
+ # No, cword lies further;
+ local old_size="${#cur}"
+ cur="${cur#${words[i]}}"
+ local new_size="${#cur}"
+ index=$(( index - old_size + new_size ))
+ fi
+ done
+ # Clear $cur if just space(s)
+ [[ $cur && ! ${cur//[[:space:]]} ]] && cur=
+ # Zero $index if negative
+ [[ $index -lt 0 ]] && index=0
fi
- local "$2" "$3" "$4" &&
- _upvars -a${#words[@]} $2 "${words[@]}" -v $3 "$cword" -v $4 "$cur2"
+ local "$2" "$3" "$4" && _upvars -a${#words[@]} $2 "${words[@]}" \
+ -v $3 "$cword" -v $4 "${cur:0:$index}"
}
@@ -388,9 +349,7 @@ __get_cword_at_cursor_by_ref() {
# -n EXCLUDE Characters out of $COMP_WORDBREAKS which should NOT be
# considered word breaks. This is useful for things like scp
# where we want to return host:path and not only path, so we
-# would pass the colon (:) as -n option in this case. Bash-3
-# doesn't do word splitting, so this ensures we get the same
-# word on both bash-3 and bash-4.
+# would pass the colon (:) as -n option in this case.
# -c VARNAME Return cur via $VARNAME
# -p VARNAME Return prev via $VARNAME
# -w VARNAME Return words via $VARNAME
@@ -431,7 +390,7 @@ _get_comp_words_by_ref()
[[ $vcur ]] && { upvars+=("$vcur" ); upargs+=(-v $vcur "$cur" ); }
[[ $vcword ]] && { upvars+=("$vcword"); upargs+=(-v $vcword "$cword"); }
- [[ $vprev ]] && { upvars+=("$vprev" ); upargs+=(-v $vprev
+ [[ $vprev && $cword -ge 1 ]] && { upvars+=("$vprev" ); upargs+=(-v $vprev
"${words[cword - 1]}"); }
[[ $vwords ]] && { upvars+=("$vwords"); upargs+=(-a${#words[@]} $vwords
"${words[@]}"); }
@@ -448,8 +407,7 @@ _get_comp_words_by_ref()
# @param $1 string Characters out of $COMP_WORDBREAKS which should NOT be
# considered word breaks. This is useful for things like scp where
# we want to return host:path and not only path, so we would pass the
-# colon (:) as $1 in this case. Bash-3 doesn't do word splitting, so this
-# ensures we get the same word on both bash-3 and bash-4.
+# colon (:) as $1 in this case.
# @param $2 integer Index number of word to return, negatively offset to the
# current word (default is 0, previous is 1), respecting the exclusions
# given at $1. For example, `_get_cword "=:" 1' returns the word left of
@@ -515,14 +473,14 @@ _get_cword()
_get_pword()
{
if [ $COMP_CWORD -ge 1 ]; then
- _get_cword "${@:-}" 1;
+ _get_cword "${@:-}" 1
fi
}
# If the word-to-complete contains a colon (:), left-trim COMPREPLY items with
# word-to-complete.
-# On bash-3, and bash-4 with a colon in COMP_WORDBREAKS, words containing
+# With a colon in COMP_WORDBREAKS, words containing
# colons are always completed as entire words if the word to complete contains
# a colon. This function fixes this, by removing the colon-containing-prefix
# from COMPREPLY items.
@@ -537,16 +495,9 @@ _get_pword()
# @param $1 current word to complete (cur)
# @modifies global array $COMPREPLY
#
-__ltrim_colon_completions() {
- # If word-to-complete contains a colon,
- # and bash-version < 4,
- # or bash-version >= 4 and COMP_WORDBREAKS contains a colon
- if [[
- "$1" == *:* && (
- ${BASH_VERSINFO[0]} -lt 4 ||
- (${BASH_VERSINFO[0]} -ge 4 && "$COMP_WORDBREAKS" == *:*)
- )
- ]]; then
+__ltrim_colon_completions()
+{
+ if [[ "$1" == *:* && "$COMP_WORDBREAKS" == *:* ]]; then
# Remove colon-word prefix from COMPREPLY items
local colon_word=${1%${1##*:}}
local i=${#COMPREPLY[*]}
@@ -564,20 +515,8 @@ __ltrim_colon_completions() {
# $ ls "a'b/"
# c
# $ compgen -f "a'b/" # Wrong, doesn't return output
-# $ compgen -f "a\'b/" # Good (bash-4)
+# $ compgen -f "a\'b/" # Good
# a\'b/c
-# $ compgen -f "a\\\\\'b/" # Good (bash-3)
-# a\'b/c
-#
-# On bash-3, special characters need to be escaped extra. This is
-# unless the first character is a single quote ('). If the single
-# quote appears further down the string, bash default completion also
-# fails, e.g.:
-#
-# $ ls 'a&b/'
-# f
-# $ foo 'a&b/<TAB> # Becomes: foo 'a&b/f'
-# $ foo a'&b/<TAB> # Nothing happens
#
# See also:
# - http://lists.gnu.org/archive/html/bug-bash/2009-03/msg00155.html
@@ -588,17 +527,8 @@ __ltrim_colon_completions() {
_quote_readline_by_ref()
{
if [[ ${1:0:1} == "'" ]]; then
- if [[ ${BASH_VERSINFO[0]} -ge 4 ]]; then
- # Leave out first character
- printf -v $2 %s "${1:1}"
- else
- # Quote word, leaving out first character
- printf -v $2 %q "${1:1}"
- # Double-quote word (bash-3)
- printf -v $2 %q ${!2}
- fi
- elif [[ ${BASH_VERSINFO[0]} -le 3 && ${1:0:1} == '"' ]]; then
- printf -v $2 %q "${1:1}"
+ # Leave out first character
+ printf -v $2 %s "${1:1}"
else
printf -v $2 %q "$1"
fi
@@ -610,19 +540,6 @@ _quote_readline_by_ref()
} # _quote_readline_by_ref()
-# This function turns on "-o filenames" behavior dynamically. It is present
-# for bash < 4 reasons. See http://bugs.debian.org/272660#64 for info about
-# the bash < 4 compgen hack.
-_compopt_o_filenames()
-{
- # We test for compopt availability first because directly invoking it on
- # bash < 4 at this point may cause terminal echo to be turned off for some
- # reason, see https://bugzilla.redhat.com/653669 for more info.
- type compopt &>/dev/null && compopt -o filenames 2>/dev/null || \
- compgen -f /non-existing-dir/ >/dev/null
-}
-
-
# This function performs file and directory completion. It's better than
# simply using 'compgen -f', because it honours spaces in filenames.
# @param $1 If `-d', complete only on directories. Otherwise filter/pick only
@@ -639,7 +556,7 @@ _filedir()
local quoted tmp
_quote_readline_by_ref "$cur" quoted
- toks=( ${toks[@]-} $(
+ toks=( $(
compgen -d -- "$quoted" | {
while read -r tmp; do
# TODO: I have removed a "[ -n $tmp ] &&" before 'printf ..',
@@ -654,19 +571,26 @@ _filedir()
if [[ "$1" != -d ]]; then
# Munge xspec to contain uppercase version too
- [[ ${BASH_VERSINFO[0]} -ge 4 ]] && \
- xspec=${1:+"!*.@($1|${1^^})"} || \
- xspec=${1:+"!*.@($1|$(printf %s $1 | tr '[:lower:]' '[:upper:]'))"}
- toks=( ${toks[@]-} $( compgen -f -X "$xspec" -- $quoted) )
+ # http://thread.gmane.org/gmane.comp.shells.bash.bugs/15294/focus=15306
+ xspec=${1:+"!*.@($1|${1^^})"}
+ toks+=( $( compgen -f -X "$xspec" -- $quoted ) )
fi
- [ ${#toks[@]} -ne 0 ] && _compopt_o_filenames
- COMPREPLY=( "${COMPREPLY[@]}" "${toks[@]}" )
+ # If the filter failed to produce anything, try without it if configured to
+ [[ -n ${COMP_FILEDIR_FALLBACK:-} && \
+ -n "$1" && "$1" != -d && ${#toks[@]} -lt 1 ]] && \
+ toks+=( $( compgen -f -- $quoted ) )
+
+ [ ${#toks[@]} -ne 0 ] && compopt -o filenames 2>/dev/null
+
+ COMPREPLY+=( "${toks[@]}" )
} # _filedir()
# This function splits $cur=--foo=bar into $prev=--foo, $cur=bar, making it
# easier to support both "--foo bar" and "--foo=bar" style completions.
+# `=' should have been removed from COMP_WORDBREAKS when setting $cur for
+# this to be useful.
# Returns 0 if current option was split, 1 otherwise.
#
_split_longopt()
@@ -682,31 +606,186 @@ _split_longopt()
return 1
}
-# This function tries to parse the help output of the given command.
+# 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
+# -e XSPEC Passed to _filedir as first arg for stderr redirections
+# -o XSPEC Passed to _filedir as first arg for other output redirections
+# -i XSPEC Passed to _filedir as first arg for stdin redirections
+# -s Split long options with _split_longopt, implies -n =
+# @return True (0) if completion needs further processing,
+# False (> 0) no further processing is necessary.
+#
+_init_completion()
+{
+ local exclude flag outx errx inx OPTIND=1
+
+ while getopts "n:e:o:i:s" flag "$@"; do
+ case $flag in
+ n) exclude+=$OPTARG ;;
+ e) errx=$OPTARG ;;
+ o) outx=$OPTARG ;;
+ i) inx=$OPTARG ;;
+ s) split=false ; exclude+== ;;
+ esac
+ done
+
+ # For some reason completion functions are not invoked at all by
+ # bash (at least as of 4.1.7) after the command line contains an
+ # ampersand so we don't get a chance to deal with redirections
+ # containing them, but if we did, hopefully the below would also
+ # do the right thing with them...
+
+ COMPREPLY=()
+ 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
+ local xspec
+ case $cur in
+ 2'>'*) xspec=$errx ;;
+ *'>'*) xspec=$outx ;;
+ *'<'*) xspec=$inx ;;
+ *)
+ case $prev in
+ 2'>'*) xspec=$errx ;;
+ *'>'*) xspec=$outx ;;
+ *'<'*) xspec=$inx ;;
+ esac
+ ;;
+ esac
+ cur="${cur##$redir}"
+ _filedir $xspec
+ return 1
+ fi
+
+ # Remove all redirections so completions don't have to deal with them.
+ local i skip
+ for (( i=1; i < ${#words[@]}; )); do
+ if [[ ${words[i]} == $redir* ]]; then
+ # If "bare" redirect, remove also the next word (skip=2).
+ [[ ${words[i]} == $redir ]] && skip=2 || skip=1
+ words=( "${words[@]:0:i}" "${words[@]:i+skip}" )
+ [[ $i -le $cword ]] && cword=$(( cword - skip ))
+ else
+ i=$(( ++i ))
+ fi
+ done
+
+ [[ $cword -eq 0 ]] && return 1
+ prev=${words[cword-1]}
+
+ [[ $split ]] && _split_longopt && split=true
+
+ return 0
+}
+
+# Helper function for _parse_help and _parse_usage.
+__parse_options()
+{
+ local option option2 i IFS=$' \t\n,/|'
+
+ # Take first found long option, or first one (short) if not found.
+ option=
+ for i in $1; do
+ case $i in
+ ---*) break ;;
+ --?*) option=$i ; break ;;
+ -?*) [[ $option ]] || option=$i ;;
+ *) break ;;
+ esac
+ done
+ [[ $option ]] || return 0
+
+ IFS=$' \t\n' # affects parsing of the regexps below...
+
+ # Expand --[no]foo to --foo and --nofoo etc
+ if [[ $option =~ (\[((no|dont)-?)\]). ]]; then
+ option2=${option/"${BASH_REMATCH[1]}"/}
+ option2=${option2%%[<{().[]*}
+ printf '%s\n' "${option2/=*/=}"
+ option=${option/"${BASH_REMATCH[1]}"/"${BASH_REMATCH[2]}"}
+ fi
+
+ option=${option%%[<{().[]*}
+ printf '%s\n' "${option/=*/=}"
+}
+
+# Parse GNU style help output of the given command.
# @param $1 command
# @param $2 command options (default: --help)
#
-_parse_help() {
- $1 ${2:---help} 2>&1 | sed -e '/^[[:space:]]*-/!d' -e 's|[,/]| |g' | \
- awk '{ print $1; if ($2 ~ /^-/) { print $2 } }' | sed -e 's|[<=].*||'
+_parse_help()
+{
+ eval local cmd=$1
+ local line
+ "$cmd" ${2:---help} 2>&1 | while read -r line; do
+
+ [[ $line == *([ $'\t'])-* ]] || continue
+ # transform "-f FOO, --foo=FOO" to "-f , --foo=FOO" etc
+ while [[ $line =~ \
+ ((^|[^-])-[A-Za-z0-9?][[:space:]]+)\[?[A-Z0-9]+\]? ]]; do
+ line=${line/"${BASH_REMATCH[0]}"/"${BASH_REMATCH[1]}"}
+ done
+ __parse_options "${line// or /, }"
+
+ done
}
-# This function completes on signal names
+# Parse BSD style usage output (options in brackets) of the given command.
+# @param $1 command
+# @param $2 command options (default: --usage)
#
-_signals()
+_parse_usage()
{
- local i
+ eval local cmd=$1
+ local line match option i char
+ "$cmd" ${2:---usage} 2>&1 | while read -r line; do
+
+ while [[ $line =~ \[[[:space:]]*(-[^]]+)[[:space:]]*\] ]]; do
+ match=${BASH_REMATCH[0]}
+ option=${BASH_REMATCH[1]}
+ case $option in
+ -?(\[)+([a-zA-Z0-9?]))
+ # Treat as bundled short options
+ for (( i=1; i < ${#option}; i++ )); do
+ char=${option:i:1}
+ [[ $char != '[' ]] && printf '%s\n' -$char
+ done
+ ;;
+ *)
+ __parse_options "$option"
+ ;;
+ esac
+ line=${line#*"$match"}
+ done
- # standard signal completion is rather braindead, so we need
- # to hack around to get what we want here, which is to
- # complete on a dash, followed by the signal name minus
- # the SIG prefix
- COMPREPLY=( $( compgen -A signal SIG${cur#-} ))
- for (( i=0; i < ${#COMPREPLY[@]}; i++ )); do
- COMPREPLY[i]=-${COMPREPLY[i]#SIG}
done
}
+# This function completes on signal names (minus the SIG prefix)
+# @param $1 prefix
+_signals()
+{
+ local -a sigs=( $( compgen -P "$1" -A signal "SIG${cur#$1}" ) )
+ COMPREPLY+=( "${sigs[@]/#${1}SIG/${1}}" )
+}
+
# This function completes on known mac addresses
#
_mac_addresses()
@@ -715,16 +794,16 @@ _mac_addresses()
local PATH="$PATH:/sbin:/usr/sbin"
# Local interfaces (Linux only?)
- COMPREPLY=( "${COMPREPLY[@]}" $( ifconfig -a 2>/dev/null | sed -ne \
+ COMPREPLY+=( $( ifconfig -a 2>/dev/null | sed -ne \
"s/.*[[:space:]]HWaddr[[:space:]]\{1,\}\($re\)[[:space:]]*$/\1/p" ) )
# ARP cache
- COMPREPLY=( "${COMPREPLY[@]}" $( arp -an 2>/dev/null | sed -ne \
+ COMPREPLY+=( $( arp -an 2>/dev/null | sed -ne \
"s/.*[[:space:]]\($re\)[[:space:]].*/\1/p" -ne \
"s/.*[[:space:]]\($re\)[[:space:]]*$/\1/p" ) )
# /etc/ethers
- COMPREPLY=( "${COMPREPLY[@]}" $( sed -ne \
+ COMPREPLY+=( $( sed -ne \
"s/^[[:space:]]*\($re\)[[:space:]].*/\1/p" /etc/ethers 2>/dev/null ) )
COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) )
@@ -757,6 +836,17 @@ _configured_interfaces()
fi
}
+# Local IP addresses.
+#
+_ip_addresses()
+{
+ COMPREPLY+=( $( compgen -W \
+ "$( PATH="$PATH:/sbin" ifconfig -a |
+ sed -ne 's/.*addr:\([^[:space:]]*\).*/\1/p' \
+ -ne 's/.*inet[[:space:]]\{1,\}\([^[:space:]]*\).*/\1/p' )" \
+ -- "$cur" ) )
+}
+
# This function completes on available kernels
#
_kernel_versions()
@@ -790,14 +880,14 @@ _available_interfaces()
# @return True (0) if completion needs further processing,
# False (> 0) if tilde is followed by a valid username, completions
# are put in COMPREPLY and no further processing is necessary.
-_tilde() {
+_tilde()
+{
local result=0
- # Does $1 start with tilde (~) and doesn't contain slash (/)?
- if [[ ${1:0:1} == "~" && $1 == ${1//\/} ]]; then
- _compopt_o_filenames
- # Try generate username completions
+ if [[ $1 == ~* && $1 != */* ]]; then
+ # Try generate ~username completions
COMPREPLY=( $( compgen -P '~' -u "${1#\~}" ) )
result=${#COMPREPLY[@]}
+ [ $result -gt 0 ] && compopt -o filenames 2>/dev/null
fi
return $result
}
@@ -825,7 +915,8 @@ _tilde() {
# ~foo/* /home/foo/*
#
# @param $1 Name of variable (not the value of the variable) to expand
-__expand_tilde_by_ref() {
+__expand_tilde_by_ref()
+{
# Does $1 start with tilde (~)?
if [ "${!1:0:1}" = "~" ]; then
# Does $1 contain slash (/)?
@@ -850,7 +941,7 @@ __expand_tilde_by_ref() {
_expand()
{
# FIXME: Why was this here?
- #[ "$cur" != "${cur%\\}" ] && cur="$cur\\"
+ #[ "$cur" != "${cur%\\}" ] && cur+="\\"
# Expand ~username type directory specifications. We want to expand
# ~foo/... to /home/foo/... to avoid problems when $cur starting with
@@ -868,7 +959,7 @@ _expand()
# This function completes on process IDs.
# AIX and Solaris ps prefers X/Open syntax.
-[[ $UNAME == SunOS || $UNAME == AIX ]] &&
+[[ $OSTYPE == *@(solaris|aix)* ]] &&
_pids()
{
COMPREPLY=( $( compgen -W '$( command ps -efo pid | sed 1d )' -- "$cur" ))
@@ -880,7 +971,7 @@ _pids()
# This function completes on process group IDs.
# AIX and SunOS prefer X/Open, all else should be BSD.
-[[ $UNAME == SunOS || $UNAME == AIX ]] &&
+[[ $OSTYPE == *@(solaris|aix)* ]] &&
_pgids()
{
COMPREPLY=( $( compgen -W '$( command ps -efo pgid | sed 1d )' -- "$cur" ))
@@ -892,7 +983,7 @@ _pgids()
# This function completes on process names.
# AIX and SunOS prefer X/Open, all else should be BSD.
-[[ $UNAME == SunOS || $UNAME == AIX ]] &&
+[[ $OSTYPE == *@(solaris|aix)* ]] &&
_pnames()
{
COMPREPLY=( $( compgen -X '<defunct>' -W '$( command ps -efo comm | \
@@ -942,6 +1033,10 @@ _gids()
fi
}
+# Glob for matching various backup files.
+#
+_backup_glob='@(#*#|*@(~|.@(bak|orig|rej|swp|dpkg*|rpm@(orig|new|save))))'
+
# This function completes on services
#
_services()
@@ -949,14 +1044,20 @@ _services()
local sysvdir famdir
[ -d /etc/rc.d/init.d ] && sysvdir=/etc/rc.d/init.d || sysvdir=/etc/init.d
famdir=/etc/xinetd.d
- COMPREPLY=( $( printf '%s\n' \
- $sysvdir/!(*.rpm@(orig|new|save)|*~|functions) ) )
+
+ local restore_nullglob=$(shopt -p nullglob); shopt -s nullglob
+
+ COMPREPLY=( $( printf '%s\n' $sysvdir/!($_backup_glob|functions) ) )
if [ -d $famdir ]; then
- COMPREPLY=( "${COMPREPLY[@]}" $( printf '%s\n' \
- $famdir/!(*.rpm@(orig|new|save)|*~) ) )
+ COMPREPLY+=( $( printf '%s\n' $famdir/!($_backup_glob) ) )
fi
+ $restore_nullglob
+
+ COMPREPLY+=( $( systemctl list-units --full --all 2>/dev/null | \
+ awk '$1 ~ /\.service$/ { sub("\\.service$", "", $1); print $1 }' ) )
+
COMPREPLY=( $( compgen -W '${COMPREPLY[@]#@($sysvdir|$famdir)/}' -- "$cur" ) )
}
@@ -1059,9 +1160,10 @@ _allowed_groups()
#
_shells()
{
- COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W \
- '$( command grep "^[[:space:]]*/" /etc/shells 2>/dev/null )' \
- -- "$cur" ) )
+ local shell rest
+ while read -r shell rest; do
+ [[ $shell == /* && $shell == "$cur"* ]] && COMPREPLY+=( $shell )
+ done 2>/dev/null < /etc/shells
}
# This function completes on valid filesystem types
@@ -1084,7 +1186,7 @@ _fstypes()
fi
[ -n "$fss" ] && \
- COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "$fss" -- "$cur" ) )
+ COMPREPLY+=( $( compgen -W "$fss" -- "$cur" ) )
}
# Get real command.
@@ -1140,7 +1242,7 @@ _count_args()
#
_pci_ids()
{
- COMPREPLY=( ${COMPREPLY[@]:-} $( compgen -W \
+ COMPREPLY+=( $( compgen -W \
"$( PATH="$PATH:/sbin" lspci -n | awk '{print $3}')" -- "$cur" ) )
}
@@ -1148,38 +1250,43 @@ _pci_ids()
#
_usb_ids()
{
- COMPREPLY=( ${COMPREPLY[@]:-} $( compgen -W \
+ COMPREPLY+=( $( compgen -W \
"$( PATH="$PATH:/sbin" lsusb | awk '{print $6}' )" -- "$cur" ) )
}
# CD device names
_cd_devices()
{
- COMPREPLY=( "${COMPREPLY[@]}"
- $( compgen -f -d -X "!*/?([amrs])cd*" -- "${cur:-/dev/}" ) )
+ COMPREPLY+=( $( compgen -f -d -X "!*/?([amrs])cd*" -- "${cur:-/dev/}" ) )
}
# DVD device names
_dvd_devices()
{
- COMPREPLY=( "${COMPREPLY[@]}"
- $( compgen -f -d -X "!*/?(r)dvd*" -- "${cur:-/dev/}" ) )
+ COMPREPLY+=( $( compgen -f -d -X "!*/?(r)dvd*" -- "${cur:-/dev/}" ) )
}
-# start of section containing completion functions for external programs
+# TERM environment variable values
+_terms()
+{
+ COMPREPLY+=( $( compgen -W \
+ "$( sed -ne 's/^\([^[:space:]#|]\{2,\}\)|.*/\1/p' /etc/termcap \
+ 2>/dev/null )" -- "$cur" ) )
+ COMPREPLY+=( $( compgen -W "$( { toe -a 2>/dev/null || toe 2>/dev/null; } \
+ | awk '{ print $1 }' | sort -u )" -- "$cur" ) )
+}
# 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
#
-_user_at_host() {
- local cur
-
- COMPREPLY=()
- _get_comp_words_by_ref -n : cur
+_user_at_host()
+{
+ local cur prev words cword
+ _init_completion -n : || return
if [[ $cur == *@* ]]; then
_known_hosts_real "$cur"
@@ -1195,14 +1302,15 @@ shopt -u hostcomplete && complete -F _user_at_host -o nospace talk ytalk finger
# `_known_hosts_real' instead.
_known_hosts()
{
- local options
- COMPREPLY=()
+ local cur prev words cword
+ _init_completion -n : || return
# NOTE: Using `_known_hosts' as a helper function and passing options
# to `_known_hosts' is deprecated: Use `_known_hosts_real' instead.
+ local options
[[ "$1" == -a || "$2" == -a ]] && options=-a
- [[ "$1" == -c || "$2" == -c ]] && options="$options -c"
- _known_hosts_real $options "$(_get_cword :)"
+ [[ "$1" == -c || "$2" == -c ]] && options+=" -c"
+ _known_hosts_real $options -- "$cur"
} # _known_hosts()
# Helper function for completing _known_hosts.
@@ -1243,11 +1351,11 @@ _known_hosts_real()
# ssh config files
if [ -n "$configfile" ]; then
[ -r "$configfile" ] &&
- config=( "${config[@]}" "$configfile" )
+ config+=( "$configfile" )
else
for i in /etc/ssh/ssh_config "${HOME}/.ssh/config" \
"${HOME}/.ssh2/config"; do
- [ -r $i ] && config=( "${config[@]}" "$i" )
+ [ -r $i ] && config+=( "$i" )
done
fi
@@ -1265,7 +1373,7 @@ _known_hosts_real()
i=${i//\"}
# Eval/expand possible `~' or `~user'
__expand_tilde_by_ref i
- [ -r "$i" ] && kh=( "${kh[@]}" "$i" )
+ [ -r "$i" ] && kh+=( "$i" )
done
IFS=$OIFS
fi
@@ -1275,10 +1383,10 @@ _known_hosts_real()
for i in /etc/ssh/ssh_known_hosts /etc/ssh/ssh_known_hosts2 \
/etc/known_hosts /etc/known_hosts2 ~/.ssh/known_hosts \
~/.ssh/known_hosts2; do
- [ -r $i ] && kh=( "${kh[@]}" $i )
+ [ -r $i ] && kh+=( $i )
done
for i in /etc/ssh2/knownhosts ~/.ssh2/hostkeys; do
- [ -d $i ] && khd=( "${khd[@]}" $i/*pub )
+ [ -d $i ] && khd+=( $i/*pub )
done
fi
@@ -1305,7 +1413,7 @@ _known_hosts_real()
if [ ${#kh[@]} -gt 0 ]; then
# FS needs to look for a comma separated list
- COMPREPLY=( "${COMPREPLY[@]}" $( awk 'BEGIN {FS=","}
+ COMPREPLY+=( $( awk 'BEGIN {FS=","}
/^\s*[^|\#]/ {for (i=1; i<=2; ++i) { \
sub(" .*$", "", $i); \
sub("^\\[", "", $i); sub("\\](:[0-9]+)?$", "", $i); \
@@ -1321,7 +1429,7 @@ _known_hosts_real()
if [[ "$i" == *key_22_$curd*.pub && -r "$i" ]]; then
host=${i/#*key_22_/}
host=${host/%.pub/}
- COMPREPLY=( "${COMPREPLY[@]}" $host )
+ COMPREPLY+=( $host )
fi
done
fi
@@ -1335,7 +1443,7 @@ _known_hosts_real()
# append any available aliases from config files
if [[ ${#config[@]} -gt 0 && -n "$aliases" ]]; then
local hosts=$( sed -ne 's/^[ \t]*[Hh][Oo][Ss][Tt]\([Nn][Aa][Mm][Ee]\)\{0,1\}['"$'\t '"']\{1,\}\([^#*?]*\)\(#.*\)\{0,1\}$/\2/p' "${config[@]}" )
- COMPREPLY=( "${COMPREPLY[@]}" $( compgen -P "$prefix$user" \
+ COMPREPLY+=( $( compgen -P "$prefix$user" \
-S "$suffix" -W "$hosts" -- "$cur" ) )
fi
@@ -1347,8 +1455,7 @@ _known_hosts_real()
# if it contains ";", it may mistify the result. But on Gentoo (at
# least), -k wasn't available (even if mentioned in the manpage) some
# time ago, so...
- COMPREPLY=( "${COMPREPLY[@]}" $( \
- compgen -P "$prefix$user" -S "$suffix" -W \
+ COMPREPLY+=( $( compgen -P "$prefix$user" -S "$suffix" -W \
"$( avahi-browse -cpr _workstation._tcp 2>/dev/null | \
awk -F';' '/^=/ { print $7 }' | sort -u )" -- "$cur" ) )
fi
@@ -1356,7 +1463,7 @@ _known_hosts_real()
# Add results of normal hostname completion, unless
# `COMP_KNOWN_HOSTS_WITH_HOSTFILE' is set to an empty value.
if [ -n "${COMP_KNOWN_HOSTS_WITH_HOSTFILE-1}" ]; then
- COMPREPLY=( "${COMPREPLY[@]}"
+ COMPREPLY+=(
$( compgen -A hostname -P "$prefix$user" -S "$suffix" -- "$cur" ) )
fi
@@ -1364,25 +1471,25 @@ _known_hosts_real()
return 0
} # _known_hosts_real()
-complete -F _known_hosts traceroute traceroute6 tracepath tracepath6 ping \
- ping6 fping fping6 telnet host nslookup rsh rlogin ftp dig mtr \
- ssh-installkeys showmount
+complete -F _known_hosts traceroute traceroute6 tracepath tracepath6 \
+ fping fping6 telnet rsh rlogin ftp dig mtr ssh-installkeys showmount
# This meta-cd function observes the CDPATH variable, so that cd additionally
# completes on directories under those specified in CDPATH.
#
_cd()
{
- local cur IFS=$'\n' i j k
- _get_comp_words_by_ref cur
+ local cur prev words cword
+ _init_completion || return
+ local IFS=$'\n' i j k
# try to allow variable completion
if [[ "$cur" == ?(\\)\$* ]]; then
COMPREPLY=( $( compgen -v -P '$' -- "${cur#?(\\)$}" ) )
return 0
fi
- _compopt_o_filenames
+ compopt -o filenames
# Use standard dir completion if no CDPATH or parameter starts with /,
# ./ or ../
@@ -1400,7 +1507,7 @@ _cd()
k="${#COMPREPLY[@]}"
for j in $( compgen -d $i/$cur ); do
if [[ ( $mark_symdirs && -h $j || $mark_dirs && ! -h $j ) && ! -d ${j#$i/} ]]; then
- j="${j}/"
+ j+="/"
fi
COMPREPLY[k++]=${j#$i/}
done
@@ -1441,22 +1548,17 @@ _command()
# A meta-command completion function for commands like sudo(8), which need to
# first complete on a command, then complete according to that command's own
-# completion definition - currently not quite foolproof (e.g. mount and umount
-# don't work properly), but still quite useful.
+# completion definition.
#
_command_offset()
{
- local cur func cline cspec noglob cmd i char_offset word_offset \
- _COMMAND_FUNC _COMMAND_FUNC_ARGS
-
- word_offset=$1
-
# rewrite current completion context before invoking
# actual command completion
# find new first word position, then
# rewrite COMP_LINE and adjust COMP_POINT
- local first_word=${COMP_WORDS[$word_offset]}
+ local word_offset=$1
+ local first_word=${COMP_WORDS[$word_offset]} char_offset i
for (( i=0; i <= ${#COMP_LINE}; i++ )); do
if [[ "${COMP_LINE:$i:${#first_word}}" == "$first_word" ]]; then
char_offset=$i
@@ -1471,25 +1573,47 @@ _command_offset()
COMP_WORDS[i]=${COMP_WORDS[i+$word_offset]}
done
for (( i; i <= COMP_CWORD; i++ )); do
- unset COMP_WORDS[i];
+ unset COMP_WORDS[i]
done
COMP_CWORD=$(( $COMP_CWORD - $word_offset ))
COMPREPLY=()
+ local cur
_get_comp_words_by_ref cur
if [[ $COMP_CWORD -eq 0 ]]; then
- _compopt_o_filenames
- COMPREPLY=( $( compgen -c -- "$cur" ) )
+ local IFS=$'\n'
+ compopt -o filenames
+ COMPREPLY=( $( compgen -d -c -- "$cur" ) )
else
- cmd=${COMP_WORDS[0]}
- if complete -p ${cmd##*/} &>/dev/null; then
- cspec=$( complete -p ${cmd##*/} )
+ local cmd=${COMP_WORDS[0]} compcmd=${COMP_WORDS[0]}
+ local cspec=$( complete -p $cmd 2>/dev/null )
+ if [[ ! $cspec ]]; then
+ if [[ $cmd == */* ]]; then
+ # Load completion for full path
+ _completion_loader $cmd
+ if [[ $? -eq 124 ]]; then
+ # Success, but we may now have the full path completion...
+ cspec=$( complete -p $cmd 2>/dev/null )
+ if [[ ! $cspec ]]; then
+ # ...or just the basename one.
+ compcmd=${cmd##*/}
+ cspec=$( complete -p $compcmd 2>/dev/null )
+ fi
+ fi
+ else
+ # Simple, non-full path case.
+ _completion_loader $cmd
+ [[ $? -eq 124 ]] && cspec=$( complete -p $cmd 2>/dev/null )
+ fi
+ fi
+
+ if [[ -n $cspec ]]; then
if [ "${cspec#* -F }" != "$cspec" ]; then
# complete -F <function>
# get function name
- func=${cspec#*-F }
+ local func=${cspec#*-F }
func=${func%% *}
if [[ ${#COMP_WORDS[@]} -ge 2 ]]; then
@@ -1498,25 +1622,25 @@ _command_offset()
$func $cmd "${COMP_WORDS[${#COMP_WORDS[@]}-1]}"
fi
- # remove any \: generated by a command that doesn't
- # default to filenames or dirnames (e.g. sudo chown)
- # FIXME: I'm pretty sure this does not work!
- if [ "${cspec#*-o }" != "$cspec" ]; then
- cspec=${cspec#*-o }
- cspec=${cspec%% *}
- if [[ "$cspec" != @(dir|file)names ]]; then
- COMPREPLY=("${COMPREPLY[@]//\\\\:/:}")
- else
- _compopt_o_filenames
+ # restore initial compopts
+ local opt t
+ while true; do
+ # FIXME: should we take "+o opt" into account?
+ t=${cspec#*-o }
+ if [ "$t" == "$cspec" ]; then
+ break
fi
- fi
- elif [ -n "$cspec" ]; then
- cspec=${cspec#complete};
- cspec=${cspec%%${cmd##*/}};
- COMPREPLY=( $( eval compgen "$cspec" -- "$cur" ) );
+ opt=${t%% *}
+ compopt -o $opt
+ cspec=${t#$opt}
+ done
+ else
+ cspec=${cspec#complete}
+ cspec=${cspec%%$compcmd}
+ COMPREPLY=( $( eval compgen "$cspec" -- "$cur" ) )
fi
elif [ ${#COMPREPLY[@]} -eq 0 ]; then
- _filedir
+ _minimal
fi
fi
}
@@ -1539,28 +1663,44 @@ _complete_as_root()
_longopt()
{
- local cur prev split=false
- _get_comp_words_by_ref -n = cur prev
+ local cur prev words cword split
+ _init_completion -s || return
- _split_longopt && split=true
-
- case "$prev" in
- --*[Dd][Ii][Rr]*)
+ case "${prev,,}" in
+ --help|--usage|--version)
+ return 0
+ ;;
+ --*dir*)
_filedir -d
return 0
;;
- --*[Ff][Ii][Ll][Ee]*|--*[Pp][Aa][Tt][Hh]*)
+ --*file*|--*path*)
_filedir
return 0
;;
+ --+([-a-z0-9_]))
+ local argtype=$( $1 --help 2>&1 | sed -ne \
+ "s|.*$prev\[\{0,1\}=[<[]\{0,1\}\([-A-Za-z0-9_]\{1,\}\).*|\1|p" )
+ case ${argtype,,} in
+ *dir*)
+ _filedir -d
+ return 0
+ ;;
+ *file*|*path*)
+ _filedir
+ return 0
+ ;;
+ esac
+ ;;
esac
$split && return 0
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W "$( $1 --help 2>&1 | \
- sed -ne 's/.*\(--[-A-Za-z0-9]\{1,\}\).*/\1/p' | sort -u )" \
+ sed -ne 's/.*\(--[-A-Za-z0-9]\{1,\}=\{0,1\}\).*/\1/p' | sort -u )" \
-- "$cur" ) )
+ [[ $COMPREPLY == *= ]] && compopt -o nospace
elif [[ "$1" == @(mk|rm)dir ]]; then
_filedir -d
else
@@ -1568,37 +1708,25 @@ _longopt()
fi
}
# makeinfo and texi2dvi are defined elsewhere.
-for i in a2ps awk bash bc bison cat colordiff cp csplit \
- curl cut date df diff dir du enscript env expand fmt fold gperf gprof \
+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 tac tail tee \
- texindex touch tr uname unexpand uniq units vdir wc wget who; do
- have $i && complete -F _longopt -o default $i
-done
-unset i
+ 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
+declare -A _xspecs
_filedir_xspec()
{
- local IFS cur xspec
-
- IFS=$'\n'
- COMPREPLY=()
- _get_comp_words_by_ref cur
+ local cur prev words cword
+ _init_completion || return
_expand || return 0
- # get first exclusion compspec that matches this command
- xspec=$( awk "/^complete[ \t]+.*[ \t]${1##*/}([ \t]|\$)/ { print \$0; exit }" \
- "$BASH_COMPLETION" )
- # prune to leave nothing but the -X spec
- xspec=${xspec#*-X }
- xspec=${xspec%% *}
-
+ local IFS=$'\n' xspec=${_xspecs[${1##*/}]} tmp
local -a toks
- local tmp
- toks=( ${toks[@]-} $(
+ toks=( $(
compgen -d -- "$(quote_readline "$cur")" | {
while read -r tmp; do
# see long TODO comment in _filedir() --David
@@ -1608,17 +1736,16 @@ _filedir_xspec()
))
# Munge xspec to contain uppercase version too
+ # http://thread.gmane.org/gmane.comp.shells.bash.bugs/15294/focus=15306
eval xspec="${xspec}"
local matchop=!
if [[ $xspec == !* ]]; then
xspec=${xspec#!}
matchop=@
fi
- [[ ${BASH_VERSINFO[0]} -ge 4 ]] && \
- xspec="$matchop($xspec|${xspec^^})" || \
- xspec="$matchop($xspec|$(printf %s $xspec | tr '[:lower:]' '[:upper:]'))"
+ xspec="$matchop($xspec|${xspec^^})"
- toks=( ${toks[@]-} $(
+ toks+=( $(
eval compgen -f -X "!$xspec" -- "\$(quote_readline "\$cur")" | {
while read -r tmp; do
[ -n $tmp ] && printf '%s\n' $tmp
@@ -1626,65 +1753,140 @@ _filedir_xspec()
}
))
- [ ${#toks[@]} -ne 0 ] && _compopt_o_filenames
+ [ ${#toks[@]} -ne 0 ] && compopt -o filenames
COMPREPLY=( "${toks[@]}" )
}
-list=( $( sed -ne '/^# START exclude/,/^# FINISH exclude/p' "$BASH_COMPLETION" | \
- # read exclusion compspecs
- (
- while read line
- do
- # ignore compspecs that are commented out
- if [ "${line#\#}" != "$line" ]; then continue; fi
- line=${line%# START exclude*}
- line=${line%# FINISH exclude*}
- line=${line##*\'}
- list=( "${list[@]}" $line )
+
+_install_xspec()
+{
+ local xspec=$1 cmd
+ shift
+ for cmd in $@; do
+ _xspecs[$cmd]=$xspec
done
- printf '%s ' "${list[@]}"
- )
- ) )
-# remove previous compspecs
-if [ ${#list[@]} -gt 0 ]; then
- eval complete -r ${list[@]}
- # install new compspecs
- eval complete -F _filedir_xspec "${list[@]}"
-fi
-unset list
+ complete -F _filedir_xspec $@
+}
+# bzcmp, bzdiff, bz*grep, bzless, bzmore intentionally not here, see Debian: #455510
+_install_xspec '!*.?(t)bz?(2)' bunzip2 bzcat pbunzip2 pbzcat lbunzip2 lbzcat
+_install_xspec '!*.@(zip|[ejsw]ar|exe|pk3|wsz|zargo|xpi|sxw|o[tx]t|od[fgpst]|epub|apk)' unzip zipinfo
+_install_xspec '*.Z' compress znew
+# zcmp, zdiff, z*grep, zless, zmore intentionally not here, see Debian: #455510
+_install_xspec '!*.@(Z|[gGd]z|t[ag]z)' gunzip zcat unpigz
+_install_xspec '!*.Z' uncompress
+# lzcmp, lzdiff intentionally not here, see Debian: #455510
+_install_xspec '!*.@(tlz|lzma)' lzcat lzegrep lzfgrep lzgrep lzless lzmore unlzma
+_install_xspec '!*.@(?(t)xz|tlz|lzma)' unxz xzcat
+_install_xspec '!*.lrz' lrunzip
+_install_xspec '!*.@(gif|jp?(e)g|miff|tif?(f)|pn[gm]|p[bgp]m|bmp|xpm|ico|xwd|tga|pcx)' ee
+_install_xspec '!*.@(gif|jp?(e)g|tif?(f)|png|p[bgp]m|bmp|x[bp]m|rle|rgb|pcx|fits|pm)' xv qiv
+_install_xspec '!*.@(@(?(e)ps|?(E)PS|pdf|PDF)?(.gz|.GZ|.bz2|.BZ2|.Z))' gv ggv kghostview
+_install_xspec '!*.@(dvi|DVI)?(.@(gz|Z|bz2))' xdvi kdvi
+_install_xspec '!*.dvi' dvips dviselect dvitype dvipdf advi dvipdfm dvipdfmx
+_install_xspec '!*.[pf]df' acroread gpdf xpdf
+_install_xspec '!*.@(?(e)ps|pdf)' kpdf
+_install_xspec '!*.@(okular|@(?(e|x)ps|?(E|X)PS|[pf]df|[PF]DF|dvi|DVI|cb[rz]|CB[RZ]|djv?(u)|DJV?(U)|dvi|DVI|gif|jp?(e)g|miff|tif?(f)|pn[gm]|p[bgp]m|bmp|xpm|ico|xwd|tga|pcx|GIF|JP?(E)G|MIFF|TIF?(F)|PN[GM]|P[BGP]M|BMP|XPM|ICO|XWD|TGA|PCX|epub|EPUB|odt|ODT|fb?(2)|FB?(2)|mobi|MOBI|g3|G3|chm|CHM)?(.?(gz|GZ|bz2|BZ2)))' okular
+_install_xspec '!*.pdf' epdfview
+_install_xspec '!*.@(?(e)ps|pdf)' ps2pdf ps2pdf12 ps2pdf13 ps2pdf14 ps2pdfwr
+_install_xspec '!*.texi*' makeinfo texi2html
+_install_xspec '!*.@(?(la)tex|texi|dtx|ins|ltx|dbj)' tex latex slitex jadetex pdfjadetex pdftex pdflatex texi2dvi
+_install_xspec '!*.mp3' mpg123 mpg321 madplay
+_install_xspec '!*@(.@(mp?(e)g|MP?(E)G|wma|avi|AVI|asf|vob|VOB|bin|dat|divx|DIVX|vcd|ps|pes|fli|flv|FLV|fxm|FXM|viv|rm|ram|yuv|mov|MOV|qt|QT|wmv|mp[234]|MP[234]|m4[pv]|M4[PV]|mkv|MKV|og[gmv]|OG[GMV]|t[ps]|T[PS]|m2t?(s)|M2T?(S)|wav|WAV|flac|FLAC|asx|ASX|mng|MNG|srt|m[eo]d|M[EO]D|s[3t]m|S[3T]M|it|IT|xm|XM)|+([0-9]).@(vdr|VDR))?(.part)' xine aaxine fbxine
+_install_xspec '!*@(.@(mp?(e)g|MP?(E)G|wma|avi|AVI|asf|vob|VOB|bin|dat|divx|DIVX|vcd|ps|pes|fli|flv|FLV|fxm|FXM|viv|rm|ram|yuv|mov|MOV|qt|QT|wmv|mp[234]|MP[234]|m4[pv]|M4[PV]|mkv|MKV|og[gmv]|OG[GMV]|t[ps]|T[PS]|m2t?(s)|M2T?(S)|wav|WAV|flac|FLAC|asx|ASX|mng|MNG|srt|m[eo]d|M[EO]D|s[3t]m|S[3T]M|it|IT|xm|XM|iso|ISO)|+([0-9]).@(vdr|VDR))?(.part)' kaffeine dragon
+_install_xspec '!*.@(avi|asf|wmv)' aviplay
+_install_xspec '!*.@(rm?(j)|ra?(m)|smi?(l))' realplay
+_install_xspec '!*.@(mpg|mpeg|avi|mov|qt)' xanim
+_install_xspec '!*.@(ogg|m3u|flac|spx)' ogg123
+_install_xspec '!*.@(mp3|ogg|pls|m3u)' gqmpeg freeamp
+_install_xspec '!*.fig' xfig
+_install_xspec '!*.@(mid?(i)|cmf)' playmidi
+_install_xspec '!*.@(mid?(i)|rmi|rcp|[gr]36|g18|mod|xm|it|x3m|s[3t]m|kar)' timidity
+_install_xspec '!*.@(669|abc|am[fs]|d[bs]m|dmf|far|it|mdl|m[eo]d|mid?(i)|mt[2m]|okta|p[st]m|s[3t]m|ult|umx|wav|xm)' modplugplay modplug123
+_install_xspec '*.@(o|so|so.!(conf)|a|[rs]pm|gif|jp?(e)g|mp3|mp?(e)g|avi|asf|ogg|class)' vi vim gvim rvim view rview rgvim rgview gview emacs xemacs sxemacs kate kwrite
+_install_xspec '!*.@([eE][xX][eE]?(.[sS][oO])|[cC][oO][mM]|[sS][cC][rR])' wine
+_install_xspec '!*.@(zip|z|gz|tgz)' bzme
+# konqueror not here on purpose, it's more than a web/html browser
+_install_xspec '!*.@(?([xX]|[sS])[hH][tT][mM]?([lL]))' netscape mozilla lynx opera galeon dillo elinks amaya firefox mozilla-firefox iceweasel google-chrome chromium-browser epiphany
+_install_xspec '!*.@(sxw|stw|sxg|sgl|doc?([mx])|dot?([mx])|rtf|txt|htm|html|?(f)odt|ott|odm)' oowriter
+_install_xspec '!*.@(sxi|sti|pps?(x)|ppt?([mx])|pot?([mx])|?(f)odp|otp)' ooimpress
+_install_xspec '!*.@(sxc|stc|xls?([bmx])|xlw|xlt?([mx])|[ct]sv|?(f)ods|ots)' oocalc
+_install_xspec '!*.@(sxd|std|sda|sdd|?(f)odg|otg)' oodraw
+_install_xspec '!*.@(sxm|smf|mml|odf)' oomath
+_install_xspec '!*.odb' oobase
+_install_xspec '!*.[rs]pm' rpm2cpio
+_install_xspec '!*.aux' bibtex
+_install_xspec '!*.po' poedit gtranslator kbabel lokalize
+_install_xspec '!*.@([Pp][Rr][Gg]|[Cc][Ll][Pp])' harbour gharbour hbpp
+_install_xspec '!*.[Hh][Rr][Bb]' hbrun
+_install_xspec '!*.ly' lilypond ly2dvi
+_install_xspec '!*.@(dif?(f)|?(d)patch)?(.@([gx]z|bz2|lzma))' cdiff
+_install_xspec '!*.lyx' lyx
+_install_xspec '!@(*.@(ks|jks|jceks|p12|pfx|bks|ubr|gkr|cer|crt|cert|p7b|pkipath|pem|p10|csr|crl)|cacerts)' portecle
+_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
+
+# Minimal completion to use as fallback in _completion_loader.
+_minimal()
+{
+ local cur prev words cword split
+ _init_completion -s || return
+ $split && return
+ _filedir
+}
-# source completion directory definitions
+# 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
i=$BASH_COMPLETION_COMPAT_DIR/$i
- [[ ${i##*/} != @(*~|*.bak|*.swp|\#*\#|*.dpkg*|*.rpm@(orig|new|save)|Makefile*) \
- && -f $i && -r $i ]] && . "$i"
- done
-fi
-if [[ $BASH_COMPLETION_DIR != $BASH_COMPLETION_COMPAT_DIR && \
- -d $BASH_COMPLETION_DIR && -r $BASH_COMPLETION_DIR && \
- -x $BASH_COMPLETION_DIR ]]; then
- for i in $(LC_ALL=C command ls "$BASH_COMPLETION_DIR"); do
- i=$BASH_COMPLETION_DIR/$i
- [[ ${i##*/} != @(*~|*.bak|*.swp|\#*\#|*.dpkg*|*.rpm@(orig|new|save)|Makefile*) \
+ [[ ${i##*/} != @($_backup_glob|Makefile*|$_blacklist_glob) \
&& -f $i && -r $i ]] && . "$i"
done
fi
unset i
# source user completion file
-[[ $BASH_COMPLETION != ~/.bash_completion && -r ~/.bash_completion ]] \
+[[ ${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
-# 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/bash_completion.sh.in b/bash_completion.sh.in
index f6a983fb..2fb74625 100644
--- a/bash_completion.sh.in
+++ b/bash_completion.sh.in
@@ -1,12 +1,14 @@
# Check for interactive bash and that we haven't already been sourced.
-[ -z "$BASH_VERSION" -o -z "$PS1" -o -n "$BASH_COMPLETION" ] && return
+[ -z "$BASH_VERSION" -o -z "$PS1" -o -n "$BASH_COMPLETION_COMPAT_DIR" ] && return
# Check for recent enough version of bash.
bash=${BASH_VERSION%.*}; bmajor=${bash%.*}; bminor=${bash#*.}
-if [ $bmajor -gt 3 ] || [ $bmajor -eq 3 -a $bminor -ge 2 ]; then
- if shopt -q progcomp && [ -r @sysconfdir@/bash_completion ]; then
+if [ $bmajor -gt 4 ] || [ $bmajor -eq 4 -a $bminor -ge 1 ]; then
+ [ -r "${XDG_CONFIG_HOME:-$HOME/.config}/bash_completion" ] && \
+ . "${XDG_CONFIG_HOME:-$HOME/.config}/bash_completion"
+ if shopt -q progcomp && [ -r @pkgdatadir@/bash_completion ]; then
# Source completion code.
- . @sysconfdir@/bash_completion
+ . @pkgdatadir@/bash_completion
fi
fi
unset bash bmajor bminor
diff --git a/completions/Makefile.am b/completions/Makefile.am
index 38cd986d..21201925 100644
--- a/completions/Makefile.am
+++ b/completions/Makefile.am
@@ -1,171 +1,315 @@
-SUBDIRS = helpers
-bashcomp_DATA = abook \
+bashcompdir = $(pkgdatadir)/completions
+bashcomp_DATA = a2x \
+ 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 \
cvsps \
dd \
dhclient \
dict \
+ dmesg \
+ dot \
dpkg \
+ dpkg-source \
dselect \
dsniff \
- dvd+rw-tools \
- e2fsprogs \
- findutils \
- freeciv \
- freerdp \
- fuse \
+ dumpdb \
+ dumpe2fs \
+ e2freefrag \
+ e2label \
+ ether-wake \
+ evince \
+ explodepkg \
+ export \
+ faillog \
+ fbgs \
+ fbi \
+ feh \
+ file \
+ 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 \
- heimdal \
+ hcitool \
+ hddtemp \
+ hid2hci \
hping2 \
+ htpasswd \
iconv \
+ idn \
iftop \
- ifupdown \
- imagemagick \
+ ifup \
info \
+ inject \
+ insmod \
+ installpkg \
+ invoke-rc.d \
+ ionice \
+ ip \
iptables \
ipmitool \
- iproute2 \
ipsec \
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 \
- procps \
+ prelink \
+ 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 \
rpmcheck \
rrdtool \
rsync \
rtcwake \
- samba \
sbcl \
+ sbopkg \
screen \
service \
sh \
- shadow \
sitecopy \
+ slackpkg \
+ 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 \
xmllint \
@@ -176,8 +320,473 @@ bashcomp_DATA = abook \
xrdb \
xsltproc \
xz \
- yp-tools \
+ xzdec \
+ ypmatch \
yum-arch
EXTRA_DIST = $(bashcomp_DATA) \
_mock _modules _subversion _yum _yum-utils
+
+CLEANFILES = \
+ 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-query \
+ 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 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-query 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 = .
+all-local: symlinks
+
+install-data-local: targetdir = $(DESTDIR)$(bashcompdir)
+install-data-local: symlinks
diff --git a/completions/Makefile.in b/completions/Makefile.in
index 04f41522..16d05310 100644
--- a/completions/Makefile.in
+++ b/completions/Makefile.in
@@ -43,13 +43,6 @@ CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
SOURCES =
DIST_SOURCES =
-RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
- html-recursive info-recursive install-data-recursive \
- install-dvi-recursive install-exec-recursive \
- install-html-recursive install-info-recursive \
- install-pdf-recursive install-ps-recursive install-recursive \
- installcheck-recursive installdirs-recursive pdf-recursive \
- ps-recursive uninstall-recursive
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
@@ -73,40 +66,7 @@ am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__installdirs = "$(DESTDIR)$(bashcompdir)"
DATA = $(bashcomp_DATA)
-RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
- distclean-recursive maintainer-clean-recursive
-AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
- $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
- distdir
-ETAGS = etags
-CTAGS = ctags
-DIST_SUBDIRS = $(SUBDIRS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-am__relativize = \
- dir0=`pwd`; \
- sed_first='s,^\([^/]*\)/.*$$,\1,'; \
- sed_rest='s,^[^/]*/*,,'; \
- sed_last='s,^.*/\([^/]*\)$$,\1,'; \
- sed_butlast='s,/*[^/]*$$,,'; \
- while test -n "$$dir1"; do \
- first=`echo "$$dir1" | sed -e "$$sed_first"`; \
- if test "$$first" != "."; then \
- if test "$$first" = ".."; then \
- dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
- dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
- else \
- first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
- if test "$$first2" = "$$first"; then \
- dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
- else \
- dir2="../$$dir2"; \
- fi; \
- dir0="$$dir0"/"$$first"; \
- fi; \
- fi; \
- dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
- done; \
- reldir="$$dir2"
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
@@ -125,6 +85,7 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
+LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
@@ -147,16 +108,15 @@ abs_top_srcdir = @abs_top_srcdir@
am__leading_dot = @am__leading_dot@
am__tar = @am__tar@
am__untar = @am__untar@
-bashcompdir = @bashcompdir@
bindir = @bindir@
build_alias = @build_alias@
builddir = @builddir@
+compatdir = @compatdir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
-helpersdir = @helpersdir@
host_alias = @host_alias@
htmldir = @htmldir@
includedir = @includedir@
@@ -181,174 +141,318 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-SUBDIRS = helpers
-bashcomp_DATA = abook \
+bashcompdir = $(pkgdatadir)/completions
+bashcomp_DATA = a2x \
+ 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 \
cvsps \
dd \
dhclient \
dict \
+ dmesg \
+ dot \
dpkg \
+ dpkg-source \
dselect \
dsniff \
- dvd+rw-tools \
- e2fsprogs \
- findutils \
- freeciv \
- freerdp \
- fuse \
+ dumpdb \
+ dumpe2fs \
+ e2freefrag \
+ e2label \
+ ether-wake \
+ evince \
+ explodepkg \
+ export \
+ faillog \
+ fbgs \
+ fbi \
+ feh \
+ file \
+ 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 \
- heimdal \
+ hcitool \
+ hddtemp \
+ hid2hci \
hping2 \
+ htpasswd \
iconv \
+ idn \
iftop \
- ifupdown \
- imagemagick \
+ ifup \
info \
+ inject \
+ insmod \
+ installpkg \
+ invoke-rc.d \
+ ionice \
+ ip \
iptables \
ipmitool \
- iproute2 \
ipsec \
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 \
- procps \
+ prelink \
+ 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 \
rpmcheck \
rrdtool \
rsync \
rtcwake \
- samba \
sbcl \
+ sbopkg \
screen \
service \
sh \
- shadow \
sitecopy \
+ slackpkg \
+ 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 \
xmllint \
@@ -359,13 +463,192 @@ bashcomp_DATA = abook \
xrdb \
xsltproc \
xz \
- yp-tools \
+ xzdec \
+ ypmatch \
yum-arch
EXTRA_DIST = $(bashcomp_DATA) \
_mock _modules _subversion _yum _yum-utils
-all: all-recursive
+CLEANFILES = \
+ 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-query \
+ 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
+
+all: all-am
.SUFFIXES:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@@ -418,141 +701,12 @@ uninstall-bashcompDATA:
test -n "$$files" || exit 0; \
echo " ( cd '$(DESTDIR)$(bashcompdir)' && rm -f" $$files ")"; \
cd "$(DESTDIR)$(bashcompdir)" && rm -f $$files
-
-# This directory's subdirectories are mostly independent; you can cd
-# into them and run `make' without going through this Makefile.
-# To change the values of `make' variables: instead of editing Makefiles,
-# (1) if the variable is set in `config.status', edit `config.status'
-# (which will cause the Makefiles to be regenerated when you run `make');
-# (2) otherwise, pass the desired values on the `make' command line.
-$(RECURSIVE_TARGETS):
- @fail= failcom='exit 1'; \
- for f in x $$MAKEFLAGS; do \
- case $$f in \
- *=* | --[!k]*);; \
- *k*) failcom='fail=yes';; \
- esac; \
- done; \
- dot_seen=no; \
- target=`echo $@ | sed s/-recursive//`; \
- list='$(SUBDIRS)'; for subdir in $$list; do \
- echo "Making $$target in $$subdir"; \
- if test "$$subdir" = "."; then \
- dot_seen=yes; \
- local_target="$$target-am"; \
- else \
- local_target="$$target"; \
- fi; \
- ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
- || eval $$failcom; \
- done; \
- if test "$$dot_seen" = "no"; then \
- $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
- fi; test -z "$$fail"
-
-$(RECURSIVE_CLEAN_TARGETS):
- @fail= failcom='exit 1'; \
- for f in x $$MAKEFLAGS; do \
- case $$f in \
- *=* | --[!k]*);; \
- *k*) failcom='fail=yes';; \
- esac; \
- done; \
- dot_seen=no; \
- case "$@" in \
- distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
- *) list='$(SUBDIRS)' ;; \
- esac; \
- rev=''; for subdir in $$list; do \
- if test "$$subdir" = "."; then :; else \
- rev="$$subdir $$rev"; \
- fi; \
- done; \
- rev="$$rev ."; \
- target=`echo $@ | sed s/-recursive//`; \
- for subdir in $$rev; do \
- echo "Making $$target in $$subdir"; \
- if test "$$subdir" = "."; then \
- local_target="$$target-am"; \
- else \
- local_target="$$target"; \
- fi; \
- ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
- || eval $$failcom; \
- done && test -z "$$fail"
-tags-recursive:
- list='$(SUBDIRS)'; for subdir in $$list; do \
- test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
- done
-ctags-recursive:
- list='$(SUBDIRS)'; for subdir in $$list; do \
- test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
- done
-
-ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- mkid -fID $$unique
tags: TAGS
+TAGS:
-TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
- $(TAGS_FILES) $(LISP)
- set x; \
- here=`pwd`; \
- if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
- include_option=--etags-include; \
- empty_fix=.; \
- else \
- include_option=--include; \
- empty_fix=; \
- fi; \
- list='$(SUBDIRS)'; for subdir in $$list; do \
- if test "$$subdir" = .; then :; else \
- test ! -f $$subdir/TAGS || \
- set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
- fi; \
- done; \
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- shift; \
- if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
- test -n "$$unique" || unique=$$empty_fix; \
- if test $$# -gt 0; then \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- "$$@" $$unique; \
- else \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- $$unique; \
- fi; \
- fi
ctags: CTAGS
-CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
- $(TAGS_FILES) $(LISP)
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- test -z "$(CTAGS_ARGS)$$unique" \
- || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
- $$unique
-
-GTAGS:
- here=`$(am__cd) $(top_builddir) && pwd` \
- && $(am__cd) $(top_srcdir) \
- && gtags -i $(GTAGS_ARGS) "$$here"
-
-distclean-tags:
- -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+CTAGS:
+
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
@@ -584,51 +738,22 @@ distdir: $(DISTFILES)
|| exit 1; \
fi; \
done
- @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
- if test "$$subdir" = .; then :; else \
- test -d "$(distdir)/$$subdir" \
- || $(MKDIR_P) "$(distdir)/$$subdir" \
- || exit 1; \
- fi; \
- done
- @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
- if test "$$subdir" = .; then :; else \
- dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
- $(am__relativize); \
- new_distdir=$$reldir; \
- dir1=$$subdir; dir2="$(top_distdir)"; \
- $(am__relativize); \
- new_top_distdir=$$reldir; \
- echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
- echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
- ($(am__cd) $$subdir && \
- $(MAKE) $(AM_MAKEFLAGS) \
- top_distdir="$$new_top_distdir" \
- distdir="$$new_distdir" \
- am__remove_distdir=: \
- am__skip_length_check=: \
- am__skip_mode_fix=: \
- distdir) \
- || exit 1; \
- fi; \
- done
check-am: all-am
-check: check-recursive
-all-am: Makefile $(DATA)
-installdirs: installdirs-recursive
-installdirs-am:
+check: check-am
+all-am: Makefile $(DATA) all-local
+installdirs:
for dir in "$(DESTDIR)$(bashcompdir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
-install: install-recursive
-install-exec: install-exec-recursive
-install-data: install-data-recursive
-uninstall: uninstall-recursive
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-installcheck: installcheck-recursive
+installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
@@ -637,6 +762,7 @@ install-strip:
mostlyclean-generic:
clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
@@ -645,90 +771,373 @@ distclean-generic:
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
-clean: clean-recursive
+clean: clean-am
clean-am: clean-generic mostlyclean-am
-distclean: distclean-recursive
+distclean: distclean-am
-rm -f Makefile
-distclean-am: clean-am distclean-generic distclean-tags
+distclean-am: clean-am distclean-generic
-dvi: dvi-recursive
+dvi: dvi-am
dvi-am:
-html: html-recursive
+html: html-am
html-am:
-info: info-recursive
+info: info-am
info-am:
-install-data-am: install-bashcompDATA
+install-data-am: install-bashcompDATA install-data-local
-install-dvi: install-dvi-recursive
+install-dvi: install-dvi-am
install-dvi-am:
install-exec-am:
-install-html: install-html-recursive
+install-html: install-html-am
install-html-am:
-install-info: install-info-recursive
+install-info: install-info-am
install-info-am:
install-man:
-install-pdf: install-pdf-recursive
+install-pdf: install-pdf-am
install-pdf-am:
-install-ps: install-ps-recursive
+install-ps: install-ps-am
install-ps-am:
installcheck-am:
-maintainer-clean: maintainer-clean-recursive
+maintainer-clean: maintainer-clean-am
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
-mostlyclean: mostlyclean-recursive
+mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-generic
-pdf: pdf-recursive
+pdf: pdf-am
pdf-am:
-ps: ps-recursive
+ps: ps-am
ps-am:
uninstall-am: uninstall-bashcompDATA
-.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \
- install-am install-strip tags-recursive
-
-.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
- all all-am check check-am clean clean-generic ctags \
- ctags-recursive distclean distclean-generic distclean-tags \
- distdir dvi dvi-am html html-am info info-am install \
- install-am install-bashcompDATA install-data install-data-am \
- install-dvi install-dvi-am install-exec install-exec-am \
- install-html install-html-am install-info install-info-am \
- install-man install-pdf install-pdf-am install-ps \
- install-ps-am install-strip installcheck installcheck-am \
- installdirs installdirs-am maintainer-clean \
- maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
- pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \
+.MAKE: install-am install-strip
+
+.PHONY: all all-am all-local check check-am clean clean-generic \
+ distclean distclean-generic distdir dvi dvi-am html html-am \
+ info info-am install install-am install-bashcompDATA \
+ install-data install-data-am install-data-local install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am \
uninstall-bashcompDATA
+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 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-query 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 = .
+all-local: symlinks
+
+install-data-local: targetdir = $(DESTDIR)$(bashcompdir)
+install-data-local: symlinks
+
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
diff --git a/completions/_mock b/completions/_mock
index fa312711..cb7d6571 100644
--- a/completions/_mock
+++ b/completions/_mock
@@ -1,31 +1,26 @@
+# bash completion for mock -*- shell-script -*-
+
# Use of this file is deprecated. Upstream completion is available in
# mock > 1.1.0, use that instead.
-# bash completion for mock
-
-have mock &&
_mock()
{
- local cur prev plugins cfgdir split=false
+ local cur prev words cword split
+ _init_completion -s || return
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
- plugins='tmpfs root_cache yum_cache bind_mount ccache'
- cfgdir=/etc/mock
+ local plugins='tmpfs root_cache yum_cache bind_mount ccache'
+ local cfgdir=/etc/mock count=0 i
- count=0
- for i in "${COMP_WORDS[@]}" ; do
- [ $count -eq $COMP_CWORD ] && break
+ for i in "${words[@]}" ; do
+ [ $count -eq $cword ] && break
if [[ "$i" == --configdir ]] ; then
- cfgdir="${COMP_WORDS[((count+1))]}"
+ cfgdir="${words[((count+1))]}"
elif [[ "$i" == --configdir=* ]] ; then
cfgdir=${i/*=/}
fi
count=$((++count))
done
- _split_longopt && split=true
-
case $prev in
-h|--help|--copyin|--copyout|--arch|-D|--define|--with|--without|\
--uniqueext|--rpmbuild_timeout|--sources|--cwd)
@@ -63,23 +58,12 @@ _mock()
$split && return 0
if [[ "$cur" == -* ]] ; then
- COMPREPLY=( $( compgen -W '--version --help --rebuild --buildsrpm
- --shell --chroot --clean --init --installdeps --install --update
- --orphanskill --copyin --copyout --root --offline --no-clean
- --cleanup-after --no-cleanup-after --arch --target --define --with
- --without --resultdir --uniqueext --configdir --rpmbuild_timeout
- --unpriv --cwd --spec --sources --verbose --quiet --trace
- --enable-plugin --disable-plugin --print-root-path' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
+ [[ $COMPREPLY == *= ]] && compopt -o nospace
else
_filedir '@(?(no)src.r|s)pm'
fi
} &&
complete -F _mock mock
-# 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/_modules b/completions/_modules
index f1ad88d8..6f337a90 100644
--- a/completions/_modules
+++ b/completions/_modules
@@ -1,8 +1,8 @@
+# module completion by Ted Stern <stern@cray.com> -*- shell-script -*-
+#
# Use of this file is deprecated, upstream completion is available in
# modules >= 3.2.7, use that instead.
#
-# module completion by Ted Stern <stern@cray.com>
-#
# Completion for Environment Modules `module' alias.
#
# See http://sourceforge.net/projects/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.
-have module || [ -f /etc/profile.d/modules.sh ] && {
+[ -f /etc/profile.d/modules.sh ] || return 1
_module_list ()
{
@@ -46,20 +46,19 @@ _module_avail ()
# A completion function for the module alias
_module ()
{
- local cur prev options
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
- if [ $COMP_CWORD -eq 1 ] ; then
+ if [ $cword -eq 1 ] ; then
# First parameter on line -- we expect it to be a mode selection
+ local options
options="$( module help 2>&1 | command grep -E '^[[:space:]]*\+' | \
awk '{print $2}' | sed -e 's/|/ /g' | sort )"
COMPREPLY=( $(compgen -W "$options" -- "$cur") )
- elif [ $COMP_CWORD -eq 2 ] ; then
+ elif [ $cword -eq 2 ] ; then
case $prev in
add|display|help|load|show|whatis)
COMPREPLY=( $(_module_avail "$cur") )
@@ -71,22 +70,15 @@ _module ()
COMPREPLY=( $(_module_path "$cur") )
;;
esac
- elif [ $COMP_CWORD -eq 3 ] ; then
- case ${COMP_WORDS[1]} in
+ elif [ $cword -eq 3 ] ; then
+ case ${words[1]} in
swap|switch)
COMPREPLY=( $(_module_avail "$cur") )
;;
esac
fi
return 0
-}
+} &&
complete -F _module -o default module
-}
-# 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/_subversion b/completions/_subversion
index 91523d89..103bcb86 100644
--- a/completions/_subversion
+++ b/completions/_subversion
@@ -1,17 +1,14 @@
+# svn completion -*- shell-script -*-
+
# Use of this file is deprecated. Upstream completion is available in
# subversion >= 0.12.0, use that instead.
-# svn completion
-
-have svn &&
-{
_svn()
{
- local cur prev commands options command
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
+ local commands
commands='add blame praise annotate ann cat checkout co cleanup commit \
ci copy cp delete del remove rm diff di export help ? h import \
info list ls lock log merge mkdir move mv rename ren \
@@ -19,7 +16,7 @@ _svn()
proplist plist pl propset pset ps resolved revert \
status stat st switch sw unlock update up'
- if [[ $COMP_CWORD -eq 1 ]] ; then
+ if [[ $cword -eq 1 ]] ; then
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--version' -- $cur ) )
else
@@ -42,154 +39,149 @@ _svn()
return 0
;;
--editor-cmd|--diff-cmd|--diff3-cmd)
- COMP_WORDS=(COMP_WORDS[0] $cur)
- COMP_CWORD=1
+ words=(words[0] $cur)
+ cword=1
_command
return 0
;;
esac
- command=${COMP_WORDS[1]}
+ local command=${words[1]}
if [[ "$cur" == -* ]]; then
# possible options for the command
+ local options
case $command in
add)
options='--auto-props --no-auto-props --force --targets
- --no-ignore --non-recursive -N -q --quiet'
+ --no-ignore --non-recursive --quiet'
;;
blame|annotate|ann|praise)
- options='-r --revisions --username --password
- --no-auth-cache --non-interactive -v --verbose
- --incremental --xml'
+ options='--revision --username --password --no-auth-cache
+ --non-interactive --verbose --incremental --xml'
;;
cat)
- options='-r --revision --username --password
- --no-auth-cache --non-interactive'
+ options='--revision --username --password --no-auth-cache
+ --non-interactive'
;;
checkout|co)
- options='-r --revision -q --quiet -N --non-recursive
- --username --password --no-auth-cache
- --non-interactive --ignore-externals'
+ options='--revision --quiet --non-recursive --username
+ --password --no-auth-cache --non-interactive
+ --ignore-externals'
;;
cleanup)
options='--diff3-cmd'
;;
commit|ci)
- options='-m --message -F --file --encoding --force-log -q
- --quiet --non-recursive -N --targets --editor-cmd
- --username --password --no-auth-cache
- --non-interactive --no-unlock'
+ options='--message --file --encoding --force-log --quiet
+ --non-recursive --targets --editor-cmd --username
+ --password --no-auth-cache --non-interactive
+ --no-unlock'
;;
copy|cp)
- options='-m --message -F --file --encoding --force-log -r
- --revision -q --quiet --editor-cmd -username
- --password --no-auth-cache --non-interactive'
+ options='--message --file --encoding --force-log --revision
+ --quiet --editor-cmd -username --password
+ --no-auth-cache --non-interactive'
;;
delete|del|remove|rm)
- options='--force -m --message -F --file --encoding
- --force-log -q --quiet --targets --editor-cmd
- --username --password --no-auth-cache
- --non-interactive'
+ options='--force --message --file --encoding --force-log
+ --quiet --targets --editor-cmd --username
+ --password --no-auth-cache --non-interactive'
;;
diff|di)
- options='-r --revision -x --extensions --diff-cmd
- --no-diff-deleted -N --non-recursive --username
+ options='--revision --extensions --diff-cmd
+ --no-diff-deleted --non-recursive --username
--password --no-auth-cache --non-interactive
--force --old --new --notice-ancestry'
;;
export)
- options='-r --revision -q --quiet --username --password
- --no-auth-cache --non-interactive -N
- --non-recursive --force --native-eol
- --ignore-externals'
+ options='--revision --quiet --username --password
+ --no-auth-cache --non-interactive --non-recursive
+ --force --native-eol --ignore-externals'
;;
import)
- options='--auto-props --no-auto-props -m --message -F
- --file --encoding --force-log -q --quiet
- --non-recursive --no-ignore --editor-cmd
- --username --password --no-auth-cache
- --non-interactive'
+ options='--auto-props --no-auto-props --message --file
+ --encoding --force-log --quiet --non-recursive
+ --no-ignore --editor-cmd --username --password
+ --no-auth-cache --non-interactive'
;;
info)
options='--username --password --no-auth-cache
- --non-interactive -r --revision --xml --targets
- -R --recursive --incremental'
+ --non-interactive --revision --xml --targets
+ --recursive --incremental'
;;
list|ls)
- options='-r --revision -v --verbose -R --recursive
- --username --password --no-auth-cache
- --non-interactive --incremental --xml'
+ options='--revision --verbose --recursive --username
+ --password --no-auth-cache --non-interactive
+ --incremental --xml'
;;
lock)
- options='-m --message -F --file --encoding --force-log
- --targets --force --username --password
- --no-auth-cache --non-interactive'
+ options='--message --file --encoding --force-log --targets
+ --force --username --password --no-auth-cache
+ --non-interactive'
;;
log)
- options='-r --revision -v --verbose --targets --username
+ options='--revision --verbose --targets --username
--password --no-auth-cache --non-interactive
- --stop-on-copy --incremental --xml -q --quiet
+ --stop-on-copy --incremental --xml --quiet
--limit'
;;
merge)
- options='-r --revision -N --non-recursive -q --quiet
- --force --dry-run --diff3-cmd --username
- --password --no-auth-cache --non-interactive
+ options='--revision --non-recursive --quiet --force
+ --dry-run --diff3-cmd --username --password
+ --no-auth-cache --non-interactive
--ignore-ancestry'
;;
mkdir)
- options='-m --message -F --file --encoding --force-log -q
- --quiet --editor-cmd --username --password
- --no-auth-cache --non-interactive'
+ options='--message --file --encoding --force-log --quiet
+ --editor-cmd --username --password --no-auth-cache
+ --non-interactive'
;;
move|mv|rename|ren)
- options='-m --message -F --file --encoding --force-log -r
- --revision -q --quiet --force --editor-cmd
- --username --password --no-auth-cache
- --non-interactive'
+ options='--message --file --encoding --force-log --revision
+ --quiet --force --editor-cmd --username --password
+ --no-auth-cache --non-interactive'
;;
propdel|pdel|pd)
- options='-q --quiet -R --recursive -r --revision --revprop
+ options='--quiet --recursive --revision --revprop
--username --password --no-auth-cache
--non-interactive'
;;
propedit|pedit|pe)
- options='-r --revision --revprop --encoding --editor-cmd
+ options='--revision --revprop --encoding --editor-cmd
--username --password --no-auth-cache
--non-interactive --force'
;;
propget|pget|pg)
- options='-R --recursive -r --revision --revprop --strict
+ options='--recursive --revision --revprop --strict
--username --password --no-auth-cache
--non-interactive'
;;
proplist|plist|pl)
- options='-v --verbose -R --recursive -r --revision
- --revprop -q --quiet --username --password
- --no-auth-cache --non-interactive'
+ options='--verbose --recursive --revision --revprop --quiet
+ --username --password --no-auth-cache
+ --non-interactive'
;;
propset|pset|ps)
- options='-F --file -q --quiet --targets -R --recursive
- --revprop --encoding --username --password
- --no-auth-cache --non-interactive -r --revision
- --force'
+ options='--file --quiet --targets --recursive --revprop
+ --encoding --username --password --no-auth-cache
+ --non-interactive --revision --force'
;;
resolved)
- options='--targets -R --recursive -q --quiet'
+ options='--targets --recursive --quiet'
;;
revert)
- options='--targets -R --recursive -q --quiet'
+ options='--targets --recursive --quiet'
;;
status|stat|st)
- options='-u --show-updates -v --verbose -N --non-recursive
- -q --quiet --username --password --no-auth-cache
+ options='--show-updates --verbose --non-recursive --quiet
+ --username --password --no-auth-cache
--non-interactive --no-ignore --ignore-externals
--incremental --xml'
;;
switch|sw)
- options='--relocate -r --revision -N --non-recursive -q
- --quiet --username --password --no-auth-cache
+ options='--relocate --revision --non-recursive --quiet
+ --username --password --no-auth-cache
--non-interactive --diff3-cmd'
;;
unlock)
@@ -197,12 +189,12 @@ _svn()
--no-auth-cache --non-interactive'
;;
update|up)
- options='-r --revision -N --non-recursive -q --quiet
- --username --password --no-auth-cache
- --non-interactive --diff3-cmd --ignore-externals'
+ options='--revision --non-recursive --quiet --username
+ --password --no-auth-cache --non-interactive
+ --diff3-cmd --ignore-externals'
;;
esac
- options="$options --help -h --config-dir"
+ options+=" --help --config-dir"
COMPREPLY=( $( compgen -W "$options" -- $cur ) )
else
@@ -215,20 +207,19 @@ _svn()
fi
return 0
-}
+} &&
complete -F _svn svn
_svnadmin()
{
- local cur prev commands options mode
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
+ local commands
commands='create deltify dump help ? hotcopy list-dblogs list-unused-dblogs
load lslocks lstxns recover rmlocks rmtxns setlog verify'
- if [[ $COMP_CWORD -eq 1 ]] ; then
+ if [[ $cword -eq 1 ]] ; then
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--version' -- $cur ) )
else
@@ -246,37 +237,38 @@ _svnadmin()
;;
esac
- command=${COMP_WORDS[1]}
+ local command=${words[1]}
if [[ "$cur" == -* ]]; then
# possible options for the command
+ local options
case $command in
create)
options='--bdb-txn-nosync --bdb-log-keep --config-dir
--fs-type'
;;
deltify)
- options='-r --revision -q --quiet'
+ options='--revision --quiet'
;;
dump)
- options='-r --revision --incremental -q --quiet --deltas'
+ options='--revision --incremental --quiet --deltas'
;;
hotcopy)
options='--clean-logs'
;;
load)
- options='--ignore-uuid --force-uuid --parent-dir -q --quiet
+ options='--ignore-uuid --force-uuid --parent-dir --quiet
--use-pre-commit-hook --use-post-commit-hook'
;;
rmtxns)
- options='-q --quiet'
+ options='--quiet'
;;
setlog)
- options='-r --revision --bypass-hooks'
+ options='--revision --bypass-hooks'
;;
esac
- options="$options --help -h"
+ options+=" --help"
COMPREPLY=( $( compgen -W "$options" -- $cur ) )
else
if [[ "$command" == @(help|h|\?) ]]; then
@@ -288,54 +280,53 @@ _svnadmin()
fi
return 0
-}
+} &&
complete -F _svnadmin -o default svnadmin
_svnlook()
{
- local cur prev commands options mode
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
+ local cur prev words cword
+ _init_completion || return
+ local commands
commands='author cat changed date diff dirs-changed help ? h history info
lock log propget pget pg proplist plist pl tree uuid youngest'
- if [[ $COMP_CWORD -eq 1 ]] ; then
+ if [[ $cword -eq 1 ]] ; then
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--version' -- $cur ) )
else
COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
fi
else
- command=${COMP_WORDS[1]}
+ local command=${words[1]}
if [[ "$cur" == -* ]]; then
# possible options for the command
+ local options
case $command in
author|cat|date|dirs-changed|info|log)
- options='-r --revision -t --transaction'
+ options='--revision --transaction'
;;
changed)
- options='-r --revision -t --transaction --copy-info'
+ options='--revision --transaction --copy-info'
;;
diff)
- options='-r --revision -t --transaction --no-diff-deleted
+ options='--revision --transaction --no-diff-deleted
--no-diff-added --diff-copy-from'
;;
history)
- options='-r --revision --show-ids'
+ options='--revision --show-ids'
;;
propget|proplist)
- options='-r --revision -t --transaction --revprop'
+ options='--revision --transaction --revprop'
;;
tree)
- options='-r --revision -t --transaction --show-ids
- --full-paths'
+ options='--revision --transaction --show-ids --full-paths'
;;
esac
- options="$options --help -h"
+ options+=" --help"
COMPREPLY=( $( compgen -W "$options" -- $cur ) )
else
if [[ "$command" == @(help|h|\?) ]]; then
@@ -347,14 +338,7 @@ _svnlook()
fi
return 0
-}
+} &&
complete -F _svnlook -o default svnlook
-}
-# 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/_yum b/completions/_yum
index 9d3cbb68..c2d37948 100644
--- a/completions/_yum
+++ b/completions/_yum
@@ -1,9 +1,8 @@
+# yum(8) completion -*- shell-script -*-
+
# Use of this file is deprecated. Upstream completion is available in
# yum > 3.2.25, use that instead.
-# yum(8) completion
-
-have yum && {
_yum_list()
{
if [[ "$1" == all ]] ; then
@@ -36,20 +35,20 @@ _yum_plugins()
_yum()
{
- local cur prev special i split=false
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword split
+ _init_completion -s || return
- for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
- if [[ ${COMP_WORDS[i]} == @(install|update|upgrade|remove|erase|deplist|info) ]]; then
- special=${COMP_WORDS[i]}
+ local special i
+ for (( i=0; i < ${#words[@]}-1; i++ )); do
+ if [[ ${words[i]} == @(install|update|upgrade|remove|erase|deplist|info) ]]; then
+ special=${words[i]}
fi
done
if [ -n "$special" ]; then
# TODO: install|update|upgrade should not match *src.rpm
- if [[ "$cur" == */* && "$special" == @(deplist|install|update|upgrade) ]]; then
+ if [[ "$cur" == @(*/|[.~])* && \
+ "$special" == @(deplist|install|update|upgrade) ]]; then
_filedir rpm
return 0
fi
@@ -74,8 +73,6 @@ _yum()
esac
fi
- _split_longopt && split=true
-
case $prev in
list)
COMPREPLY=( $( compgen -W 'all available updates \
@@ -93,7 +90,7 @@ _yum()
_filedir rpm
;;
-d|-e)
- COMPREPLY=( $( compgen -W '0 1 2 3 4 5 6 7 8 9 10' -- $cur ) )
+ COMPREPLY=( $( compgen -W '{0..10}' -- $cur ) )
;;
-c)
_filedir
@@ -137,21 +134,11 @@ _yum()
$split && return 0
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--help --tolerant -C -c -R -d \
- --showduplicates -e --quiet --verbose -y --version --installroot \
- --enablerepo --disablerepo --exclude --disableexcludes --obsoletes \
- --noplugins --nogpgcheck --disableplugin --enableplugin \
- --skip-broken --color' -- $cur ) )
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
+ [[ $COMPREPLY == *= ]] && compopt -o nospace
return 0
fi
-}
} &&
complete -F _yum yum
-# 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/_yum-utils b/completions/_yum-utils
index b7f6d264..22b97af8 100644
--- a/completions/_yum-utils
+++ b/completions/_yum-utils
@@ -1,31 +1,24 @@
+# bash completion for repomanage -*- shell-script -*-
+
# Use of this file is deprecated. Upstream completion is available in
# yum-utils >= 1.1.24, use that instead.
-# bash completion for repomanage
-
-have repomanage &&
_repomanage()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword split
+ _init_completion -s || return
[[ "$prev" == -@(h|-help|k|-keep) ]] && return 0
+ $split && return
+
if [[ "$cur" == -* ]] ; then
- COMPREPLY=( $( compgen -W '--old --new --space \
- --keep --nocheck --help' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
+ [[ $COMPREPLY == *= ]] && compopt -o nospace
else
_filedir -d
fi
} &&
complete -F _repomanage repomanage
-# 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/a2x b/completions/a2x
new file mode 100644
index 00000000..7c330908
--- /dev/null
+++ b/completions/a2x
@@ -0,0 +1,40 @@
+# a2x(1) completion -*- shell-script -*-
+
+_a2x()
+{
+ local cur prev words cword split
+ _init_completion -s || return
+
+ case $prev in
+ -a|--attribute|--asciidoc-opts|--dblatex-opts|--fop-opts|-h|--help|\
+ --version|--xsltproc-opts)
+ return
+ ;;
+ -D|--destination-dir|--icons-dir)
+ _filedir -d
+ return
+ ;;
+ --doctype|-d)
+ _xfunc asciidoc _asciidoc_doctype
+ return
+ ;;
+ --stylesheet)
+ _filedir css
+ return
+ ;;
+ esac
+
+ $split && return
+
+ if [[ $cur == -* ]]; then
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" --help )' \
+ -- "$cur" ) )
+ [[ $COMPREPLY == *= ]] && compopt -o nospace
+ return
+ fi
+
+ _filedir
+} &&
+complete -F _a2x a2x
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/abook b/completions/abook
index f09c8b50..07a0f090 100644
--- a/completions/abook
+++ b/completions/abook
@@ -1,16 +1,12 @@
-# abook(1) completion
+# abook(1) completion -*- shell-script -*-
-have abook &&
_abook()
{
- local cur prev
+ local cur prev words cword
+ _init_completion || return
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- # abook only takes options, tabbing after command name adds a single
- # dash (bash4)
- [[ ${BASH_VERSINFO[0]} -ge 4 && $COMP_CWORD -eq 1 && -z "$cur" ]] &&
+ # abook only takes options, tabbing after command name adds a single dash
+ [[ $cword -eq 1 && -z "$cur" ]] &&
{
compopt -o nospace
COMPREPLY=( "-" )
@@ -53,10 +49,4 @@ _abook()
} &&
complete -F _abook abook
-# 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/aclocal b/completions/aclocal
new file mode 100644
index 00000000..2bbc3152
--- /dev/null
+++ b/completions/aclocal
@@ -0,0 +1,35 @@
+# aclocal(1) completion -*- shell-script -*-
+
+_aclocal()
+{
+ local cur prev words cword split
+ _init_completion -s || return
+
+ case "$prev" in
+ --help|--print-ac-dir|--version)
+ return 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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/add_members b/completions/add_members
new file mode 100644
index 00000000..3a6661c2
--- /dev/null
+++ b/completions/add_members
@@ -0,0 +1,32 @@
+# mailman add_members completion -*- shell-script -*-
+
+_add_members()
+{
+ local cur prev words cword split
+ _init_completion -s || return
+
+ case $prev in
+ -r|-d|--regular-members-file|--digest-members-file)
+ _filedir
+ return 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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/alias b/completions/alias
new file mode 100644
index 00000000..112dea3b
--- /dev/null
+++ b/completions/alias
@@ -0,0 +1,20 @@
+# bash alias completion -*- shell-script -*-
+
+_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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/ant b/completions/ant
index 132c4390..96ef8172 100644
--- a/completions/ant
+++ b/completions/ant
@@ -1,13 +1,9 @@
-# bash completion for ant
+# bash completion for ant and phing -*- shell-script -*-
-have ant &&
-{
_ant()
{
- local cur prev buildfile i
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-buildfile|-file|-f)
@@ -23,48 +19,46 @@ _ant()
return 0
;;
-nice)
- COMPREPLY=( $( compgen -W '1 2 3 4 5 6 7 8 9 10' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '{1..10}' -- "$cur" ) )
+ return 0
+ ;;
+ -lib)
+ _filedir -d
return 0
;;
- -lib|-logger|-listener|-D|-inputhandler|-main)
+ -logger|-listener|-inputhandler|-main|-find|-s)
return 0
;;
esac
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-help -projecthelp -version -diagnostics \
- -quiet -verbose -debug -emacs -lib -logfile -logger -listener \
- -noinput -buildfile -D -keep-going -propertyfile -inputhandler \
- -find -s -nice -nouserlib -noclasspath -autoproxy -main' \
- -- "$cur" ) )
+ if [[ $cur == -D* ]]; then
+ return 0
+ elif [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" -h )' -- "$cur" ) )
else
# available targets completion
# find which buildfile to use
- buildfile=build.xml
- for (( i=1; i < COMP_CWORD; i++ )); do
- if [[ "${COMP_WORDS[i]}" == -@(?(build)file|f) ]]; then
- buildfile=${COMP_WORDS[i+1]}
+ local buildfile=build.xml i
+ for (( i=1; i < cword; i++ )); do
+ if [[ "${words[i]}" == -@(?(build)file|f) ]]; then
+ buildfile=${words[i+1]}
break
fi
done
[ ! -f $buildfile ] && return 0
# parse buildfile for targets
- # some versions of sed complain if there's no trailing linefeed,
- # hence the 2>/dev/null
- COMPREPLY=( $( compgen -W "$( cat $buildfile | tr "'\t\n>" "\" \n" | \
- sed -ne 's/.*<target .*name="\([^"]*\).*/\1/p' 2>/dev/null )" \
- -- "$cur" ) )
- fi
-}
-have complete-ant-cmd.pl && \
- complete -C complete-ant-cmd.pl -F _ant ant || complete -F _ant ant
-}
+ local line targets
+ while read -rd '>' line; do
+ [[ $line =~ \
+ \<(targe|extension-poin)t[[:space:]].*name=[\"\']([^\"\']+) ]] \
+ && targets+=" ${BASH_REMATCH[2]}"
+ done < $buildfile
+ COMPREPLY=( $( compgen -W '$targets' -- "$cur" ) )
+ fi
+} &&
+complete -F _ant ant phing
+type complete-ant-cmd.pl &>/dev/null && \
+ complete -C complete-ant-cmd.pl -F _ant ant || :
-# 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/apache2ctl b/completions/apache2ctl
index 287443a2..f6fdeb30 100644
--- a/completions/apache2ctl
+++ b/completions/apache2ctl
@@ -1,24 +1,16 @@
-# apache2ctl(1) completion
+# apache2ctl(1) completion -*- shell-script -*-
-have apache2ctl && {
-_apache2ctl() {
- local APWORDS cur
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
+_apache2ctl()
+{
+ local cur prev words cword
+ _init_completion || return
+ local APWORDS
APWORDS=$(apache2ctl 2>&1 >/dev/null | awk 'NR<2 { print $3; exit }' | \
tr "|" " ")
COMPREPLY=( $( compgen -W "$APWORDS" -- "$cur" ) )
-}
+} &&
complete -F _apache2ctl apache2ctl
-}
-# 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
deleted file mode 100644
index 84811ae8..00000000
--- a/completions/apt
+++ /dev/null
@@ -1,157 +0,0 @@
-# Debian apt-get(8) completion.
-
-have apt-get &&
-_apt_get()
-{
- local cur prev special i
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
- if [[ ${COMP_WORDS[i]} == @(install|remove|autoremove|purge|source|build-dep) ]]; then
- special=${COMP_WORDS[i]}
- fi
- done
-
- if [ -n "$special" ]; then
- case $special in
- remove|autoremove|purge)
- if [ -f /etc/debian_version ]; then
- # Debian system
- COMPREPLY=( $( _comp_dpkg_installed_packages $cur ) )
- else
- # assume RPM based
- _rpm_installed_packages
- fi
- return 0
- ;;
- source)
- COMPREPLY=( $( apt-cache --no-generate pkgnames "$cur" \
- 2> /dev/null ) $( 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|--config-file)
- _filedir
- return 0
- ;;
- -t|--target-release|--default-release)
- COMPREPLY=( $( apt-cache policy | \
- command grep "release.o=Debian,a=$cur" | \
- sed -e "s/.*a=\(\w*\).*/\1/" | uniq 2> /dev/null) )
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-d -f -h -v -m -q -s -y -u -t -b -c -o \
- --download-only --fix-broken --help --version --ignore-missing \
- --fix-missing --no-download --quiet --simulate --just-print \
- --dry-run --recon --no-act --yes --assume-yes --show-upgraded \
- --only-source --compile --build --ignore-hold --target-release \
- --no-upgrade --force-yes --print-uris --purge --reinstall \
- --list-cleanup --default-release --trivial-only --no-remove \
- --diff-only --no-install-recommends --tar-only --config-file \
- --option --auto-remove' -- "$cur" ) )
- else
- COMPREPLY=( $( compgen -W 'update upgrade dselect-upgrade \
- dist-upgrade install remove purge source build-dep \
- check clean autoclean autoremove' -- "$cur" ) )
- fi
-
- return 0
-} &&
-complete -F _apt_get apt-get
-
-# Debian apt-cache(8) completion.
-#
-have apt-cache &&
-_apt_cache()
-{
- local cur prev special i
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- if [ "$cur" != show ]; then
- for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
- if [[ ${COMP_WORDS[i]} == @(add|depends|dotty|madison|policy|rdepends|show?(pkg|src|)) ]]; then
- special=${COMP_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-build b/completions/apt-build
index d875a986..aa78b230 100644
--- a/completions/apt-build
+++ b/completions/apt-build
@@ -1,16 +1,14 @@
-# Debian apt-build(1) completion.
+# Debian apt-build(1) completion -*- shell-script -*-
-have apt-build &&
_apt_build()
{
- local cur prev special i
+ local cur prev words cword
+ _init_completion || return
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
- if [[ ${COMP_WORDS[i]} == @(install|remove|source|info|clean) ]]; then
- special=${COMP_WORDS[i]}
+ local special i
+ for (( i=0; i < ${#words[@]}-1; i++ )); do
+ if [[ ${words[i]} == @(install|remove|source|info|clean) ]]; then
+ special=${words[i]}
fi
done
@@ -21,7 +19,8 @@ _apt_build()
return 0
;;
remove)
- COMPREPLY=( $( _comp_dpkg_installed_packages "$cur" ) )
+ COMPREPLY=( \
+ $( _xfunc dpkg _comp_dpkg_installed_packages "$cur" ) )
return 0
;;
*)
@@ -57,10 +56,4 @@ _apt_build()
} &&
complete -F _apt_build apt-build
-# 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-cache b/completions/apt-cache
new file mode 100644
index 00000000..00b41478
--- /dev/null
+++ b/completions/apt-cache
@@ -0,0 +1,74 @@
+# Debian apt-cache(8) completion -*- shell-script -*-
+
+_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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/apt-get b/completions/apt-get
new file mode 100644
index 00000000..447305a4
--- /dev/null
+++ b/completions/apt-get
@@ -0,0 +1,76 @@
+# Debian apt-get(8) completion -*- shell-script -*-
+
+_apt_get()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ local special i
+ for (( i=0; i < ${#words[@]}-1; i++ )); do
+ if [[ ${words[i]} == @(install|remove|autoremove|purge|source|build-dep|download) ]]; then
+ special=${words[i]}
+ fi
+ done
+
+ if [ -n "$special" ]; then
+ case $special in
+ remove|autoremove|purge)
+ if [ -f /etc/debian_version ]; then
+ # Debian system
+ COMPREPLY=( $( \
+ _xfunc dpkg _comp_dpkg_installed_packages $cur ) )
+ else
+ # assume RPM based
+ _xfunc rpm _rpm_installed_packages
+ fi
+ return 0
+ ;;
+ source)
+ COMPREPLY=( $( apt-cache --no-generate pkgnames "$cur" \
+ 2> /dev/null ) $( 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|--config-file)
+ _filedir
+ return 0
+ ;;
+ -t|--target-release|--default-release)
+ COMPREPLY=( $( apt-cache policy | \
+ command grep "release.o=Debian,a=$cur" | \
+ sed -e "s/.*a=\(\w*\).*/\1/" | uniq 2> /dev/null) )
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-d -f -h -v -m -q -s -y -u -t -b -c -o \
+ --download-only --fix-broken --help --version --ignore-missing \
+ --fix-missing --no-download --quiet --simulate --just-print \
+ --dry-run --recon --no-act --yes --assume-yes --show-upgraded \
+ --only-source --compile --build --ignore-hold --target-release \
+ --no-upgrade --force-yes --print-uris --purge --reinstall \
+ --list-cleanup --default-release --trivial-only --no-remove \
+ --diff-only --no-install-recommends --tar-only --config-file \
+ --option --auto-remove' -- "$cur" ) )
+ else
+ COMPREPLY=( $( compgen -W 'update upgrade dselect-upgrade \
+ dist-upgrade install remove purge source build-dep \
+ download \
+ check clean autoclean autoremove' -- "$cur" ) )
+ fi
+
+ return 0
+} &&
+complete -F _apt_get apt-get
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/aptitude b/completions/aptitude
index c00ad40e..1afd738d 100644
--- a/completions/aptitude
+++ b/completions/aptitude
@@ -1,7 +1,6 @@
-# Debian aptitude(1) completion
+# Debian aptitude(1) completion -*- shell-script -*-
-have aptitude && {
-have grep-status && {
+_have grep-status && {
_comp_dpkg_hold_packages()
{
grep-status -P -e "^$1" -a -FStatus 'hold' -n -s Package
@@ -16,11 +15,10 @@ _comp_dpkg_hold_packages()
_aptitude()
{
- local cur dashoptions prev special i
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
+ local dashoptions
dashoptions='-S -u -i -h --help --version -s --simulate -d \
--download-only -P --prompt -y --assume-yes -F \
--display-format -O --sort -w --width -f -r -g \
@@ -28,25 +26,27 @@ _aptitude()
--target-release -V --show-versions -D --show-deps\
-Z -v --verbose --purge-unused --schedule-only'
- for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
- if [[ ${COMP_WORDS[i]} == @(@(|re)install|@(|un)hold|@(|un)markauto|@(dist|full)-upgrade|download|show|forbid-version|purge|remove|changelog|why@(|-not)|keep@(|-all)|build-dep|@(add|remove)-user-tag) ]]; then
- special=${COMP_WORDS[i]}
+ local special i
+ for (( i=0; i < ${#words[@]}-1; i++ )); do
+ if [[ ${words[i]} == @(@(|re)install|@(|un)hold|@(|un)markauto|@(dist|full)-upgrade|download|show|forbid-version|purge|remove|changelog|why@(|-not)|keep@(|-all)|build-dep|@(add|remove)-user-tag|versions) ]]; then
+ special=${words[i]}
fi
#exclude some mutually exclusive options
- [[ ${COMP_WORDS[i]} == '-u' ]] && dashoptions=${dashoptions/-i}
- [[ ${COMP_WORDS[i]} == '-i' ]] && dashoptions=${dashoptions/-u}
+ [[ ${words[i]} == '-u' ]] && dashoptions=${dashoptions/-i}
+ [[ ${words[i]} == '-i' ]] && dashoptions=${dashoptions/-u}
done
if [[ -n "$special" ]]; then
case $special in
install|hold|markauto|unmarkauto|dist-upgrade|full-upgrade| \
download|show|changelog|why|why-not|build-dep|add-user-tag| \
- remove-user-tag)
+ remove-user-tag|versions)
COMPREPLY=( $( apt-cache pkgnames $cur 2> /dev/null ) )
return 0
;;
purge|remove|reinstall|forbid-version)
- COMPREPLY=( $( _comp_dpkg_installed_packages "$cur" ) )
+ COMPREPLY=( \
+ $( _xfunc dpkg _comp_dpkg_installed_packages "$cur" ) )
return 0
;;
unhold)
@@ -81,18 +81,11 @@ _aptitude()
hold unhold purge markauto unmarkauto why why-not \
dist-upgrade full-upgrade download search show \
forbid-version changelog keep-all build-dep \
- add-user-tag remove-user-tag' -- "$cur" ) )
+ add-user-tag remove-user-tag versions' -- "$cur" ) )
fi
return 0
-}
+} &&
complete -F _aptitude -o default aptitude
-}
-# 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/arch b/completions/arch
new file mode 100644
index 00000000..3bb5f571
--- /dev/null
+++ b/completions/arch
@@ -0,0 +1,47 @@
+# mailman arch completion -*- shell-script -*-
+
+# Try to detect whether this is the mailman "arch" to avoid installing
+# it for the coreutils/util-linux-ng one.
+_have mailmanctl &&
+_arch()
+{
+ local cur prev words cword split
+ _init_completion -s || return
+
+ case $prev in
+ -w|-g|-d|--welcome-msg|--goodbye-msg|--digest)
+ COMPREPLY=( $( compgen -W 'y n' -- "$cur") )
+ return 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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/arping b/completions/arping
new file mode 100644
index 00000000..231a63be
--- /dev/null
+++ b/completions/arping
@@ -0,0 +1,31 @@
+# arping(8) completion -*- shell-script -*-
+
+_arping()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ case $prev in
+ -c|-w)
+ return
+ ;;
+ -I)
+ _available_interfaces -a
+ return
+ ;;
+ -s)
+ _ip_addresses
+ return
+ ;;
+ esac
+
+ if [[ $cur == -* ]]; then
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" -h )' -- "$cur" ) )
+ return
+ fi
+
+ _known_hosts_real "$cur"
+} &&
+complete -F _arping arping
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/arpspoof b/completions/arpspoof
new file mode 100644
index 00000000..9c1b99f5
--- /dev/null
+++ b/completions/arpspoof
@@ -0,0 +1,28 @@
+# arpspoof completion -*- shell-script -*-
+
+_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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/asciidoc b/completions/asciidoc
new file mode 100644
index 00000000..722614f6
--- /dev/null
+++ b/completions/asciidoc
@@ -0,0 +1,52 @@
+# asciidoc(1) completion -*- shell-script -*-
+
+_asciidoc_doctype()
+{
+ COMPREPLY+=( $( compgen -W 'article book manpage' -- "$cur" ) )
+}
+
+_asciidoc()
+{
+ local cur prev words cword split
+ _init_completion -s || return
+
+ case $prev in
+ --attribute|-a)
+ return
+ ;;
+ --backend|-b)
+ COMPREPLY=( $( compgen -W 'docbook html4 xhtml11' -- "$cur" ) )
+ return
+ ;;
+ --conf-file|-f)
+ _filedir conf
+ return
+ ;;
+ --doctype|-d)
+ _asciidoc_doctype
+ return
+ ;;
+ --help|-h)
+ COMPREPLY=( $( compgen -W 'manpage syntax topics' -- "$cur" ) )
+ return
+ ;;
+ --out-file|-o)
+ _filedir
+ return
+ ;;
+ esac
+
+ $split && return
+
+ if [[ $cur == -* ]]; then
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" "--help manpage" )' \
+ -- "$cur" ) )
+ [[ $COMPREPLY == *= ]] && compopt -o nospace
+ return
+ fi
+
+ _filedir
+} &&
+complete -F _asciidoc asciidoc asciidoc.py
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/aspell b/completions/aspell
index 5254eee7..a663fa95 100644
--- a/completions/aspell
+++ b/completions/aspell
@@ -1,6 +1,5 @@
-# bash completion for aspell
+# bash completion for aspell -*- shell-script -*-
-have aspell && {
_aspell_dictionary()
{
local datadir
@@ -10,18 +9,14 @@ _aspell_dictionary()
COMPREPLY=( ${COMPREPLY[@]%.alias} )
COMPREPLY=( ${COMPREPLY[@]#$datadir/} )
# Then, add the canonical dicts
- COMPREPLY=( "${COMPREPLY[@]}" $( aspell dicts 2>/dev/null ) )
+ COMPREPLY+=( $( aspell dicts 2>/dev/null ) )
COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) )
}
_aspell()
{
- local cur prev split=false
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- _split_longopt && split=true
+ local cur prev words cword split
+ _init_completion -s || return
case $prev in
-c|-p|check|--conf|--personal|--repl|--per-conf)
@@ -37,7 +32,8 @@ _aspell()
return 0
;;
--mode)
- COMPREPLY=( $( compgen -W 'none url email sgml tex' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W "$( $1 modes 2>/dev/null | \
+ awk '{ print $1 }' )" -- "$cur" ) )
return 0
;;
--sug-mode)
@@ -52,45 +48,43 @@ _aspell()
_aspell_dictionary
return 0
;;
+ --add-filter|--rem-filter)
+ COMPREPLY=( $( compgen -W "$( $1 filters 2>/dev/null | \
+ awk '{ print $1 }' )" -- "$cur" ) )
+ return 0
+ ;;
esac
$split && return 0
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--conf --conf-dir --data-dir --dict-dir \
- --encoding --add-filter --rem-filter --mode \
- --add-extra-dicts --rem-extra-dicts \
- --home-dir --ignore --ignore-accents \
+ COMPREPLY=( $( compgen -W '--conf= --conf-dir= --data-dir= --dict-dir= \
+ --encoding= --add-filter= --rem-filter= --mode= \
+ --add-extra-dicts= --rem-extra-dicts= \
+ --home-dir= --ignore= --ignore-accents \
--dont-ignore-accents --ignore-case --dont-ignore-case \
- --ignore-repl --dont-ignore-repl --jargon --keyboard \
- --lang --language-tag --local-data-dir --master \
+ --ignore-repl --dont-ignore-repl --jargon --keyboard= \
+ --lang= --language-tag --local-data-dir= --master= \
--module --add-module-search-order \
- --rem-module-search-order --per-conf --personal \
- --prefix --repl --run-together --dont-run-together \
- --run-together-limit --run-together-min --save-repl \
- --dont-save-repl --set-prefix --dont-set-prefix --size \
+ --rem-module-search-order --per-conf= --personal= \
+ --prefix= --repl= --run-together --dont-run-together \
+ --run-together-limit= --run-together-min= --save-repl \
+ --dont-save-repl --set-prefix --dont-set-prefix --size= \
--spelling --strip-accents --dont-strip-accents \
- --sug-mode --add-word-list-path --rem-word-list-path \
+ --sug-mode= --add-word-list-path --rem-word-list-path \
--backup --dont-backup --reverse --dont-reverse \
- --time --dont-time --keymapping --add-email-quote \
- --rem-email-quote --email-margin --add-tex-command \
- --rem-tex-command --tex-check-comments \
+ --time --dont-time --keymapping= --add-email-quote= \
+ --rem-email-quote= --email-margin= --add-tex-command= \
+ --rem-tex-command= --tex-check-comments \
--dont-tex-check-comments --add-tex-extension \
- --rem-tex-extension --add-sgml-check --rem-sgml-check \
+ --rem-tex-extension --add-sgml-check= --rem-sgml-check= \
--add-sgml-extension --rem-sgml-extension' -- "$cur" ) )
+ [[ $COMPREPLY == *= ]] && compopt -o nospace
else
COMPREPLY=( $( compgen -W 'usage help check pipe list \
config soundslike filter version dump create merge' -- "$cur" ) )
fi
-
-}
+} &&
complete -F _aspell aspell
-}
-# 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/autoconf b/completions/autoconf
index c8f1b195..fea524e7 100644
--- a/completions/autoconf
+++ b/completions/autoconf
@@ -1,13 +1,9 @@
-# Completions for autoconf tools
+# autoconf(1) completion -*- shell-script -*-
-have autoconf &&
_autoconf()
{
- COMPREPLY=()
- local cur prev split=false
- _get_comp_words_by_ref cur prev
-
- _split_longopt && split=true
+ local cur prev words cword split
+ _init_completion -s || return
case "$prev" in
--help|-h|--version|-V|--trace|-t)
@@ -32,7 +28,8 @@ _autoconf()
$split && return 0
if [[ "$cur" == -* ]]; then
- _longopt $1
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
+ [[ $COMPREPLY == *= ]] && compopt -o nospace
return
fi
@@ -40,85 +37,4 @@ _autoconf()
} &&
complete -F _autoconf autoconf
-have autoreconf || have autoheader &&
-_autoreconf()
-{
- COMPREPLY=()
- local cur prev split=false
- _get_comp_words_by_ref cur prev
-
- _split_longopt && split=true
-
- case "$prev" in
- --help|-h|--version|-V)
- return 0
- ;;
- --warnings|-W)
- local cats=( cross gnu obsolete override portability syntax \
- unsupported )
- COMPREPLY=( $( compgen -W \
- '${cats[@]} ${cats[@]/#/no-} all none error' -- "$cur" ) )
- return 0
- ;;
- --prepend-include|-B|--include|-I)
- _filedir -d
- return 0
- ;;
- esac
-
- $split && return 0
-
- if [[ "$cur" == -* ]]; then
- _longopt $1
- return 0
- fi
-
- if [[ $1 == autoheader ]] ; then
- _filedir '@(ac|in)'
- else
- _filedir -d
- fi
-} &&
-complete -F _autoreconf autoreconf autoheader
-
-have autoscan || have autoupdate &&
-_autoscan()
-{
- COMPREPLY=()
- local cur prev split=false
- _get_comp_words_by_ref cur prev
-
- _split_longopt && split=true
-
- case "$prev" in
- --help|-h|--version|-V)
- return 0
- ;;
- --prepend-include|-B|--include|-I)
- _filedir -d
- return 0
- ;;
- esac
-
- $split && return 0
-
- if [[ "$cur" == -* ]]; then
- _longopt $1
- return 0
- fi
-
- if [[ $1 == autoupdate ]] ; then
- _filedir '@(ac|in)'
- else
- _filedir -d
- fi
-} &&
-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/automake b/completions/automake
index 7ed87453..78bc6db2 100644
--- a/completions/automake
+++ b/completions/automake
@@ -1,13 +1,9 @@
-# Completions for automake tools
+# automake(1) completion -*- shell-script -*-
-have automake &&
_automake()
{
- COMPREPLY=()
- local cur prev split=false
- _get_comp_words_by_ref cur prev
-
- _split_longopt && split=true
+ local cur prev words cword split
+ _init_completion -s || return
case "$prev" in
--help|--version)
@@ -28,7 +24,8 @@ _automake()
$split && return 0
if [[ "$cur" == -* ]]; then
- _longopt $1
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
+ [[ $COMPREPLY == *= ]] && compopt -o nospace
return
fi
@@ -36,45 +33,4 @@ _automake()
} &&
complete -F _automake automake automake-1.11
-have aclocal &&
-_aclocal()
-{
- COMPREPLY=()
- local cur prev split=false
- _get_comp_words_by_ref cur prev
-
- _split_longopt && split=true
-
- case "$prev" in
- --help|--print-ac-dir|--version)
- return 0
- ;;
- --acdir|-I)
- _filedir -d
- return 0
- ;;
- --output)
- _filedir
- return 0
- ;;
- --warnings|-W)
- local cats=( syntax unsupported )
- COMPREPLY=( $( compgen -W \
- '${cats[@]} ${cats[@]/#/no-} all none error' -- "$cur" ) )
- return 0
- ;;
- esac
-
- $split && return 0
-
- _longopt $1
-} &&
-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/autoreconf b/completions/autoreconf
new file mode 100644
index 00000000..8de40c88
--- /dev/null
+++ b/completions/autoreconf
@@ -0,0 +1,41 @@
+# autoreconf(1) completion -*- shell-script -*-
+
+_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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/autorpm b/completions/autorpm
index 6a5f7620..377ac987 100644
--- a/completions/autorpm
+++ b/completions/autorpm
@@ -1,12 +1,9 @@
-# autorpm(8) completion
+# autorpm(8) completion -*- shell-script -*-
-have autorpm &&
_autorpm()
{
- local cur
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
+ local cur prev words cword
+ _init_completion || return
COMPREPLY=( $( compgen -W '--notty --debug --help --version auto add \
fullinfo info help install list remove set' -- "$cur" ) )
@@ -14,10 +11,4 @@ _autorpm()
} &&
complete -F _autorpm autorpm
-# 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/autoscan b/completions/autoscan
new file mode 100644
index 00000000..80b051cf
--- /dev/null
+++ b/completions/autoscan
@@ -0,0 +1,34 @@
+# autoscan(1) completion -*- shell-script -*-
+
+_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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/badblocks b/completions/badblocks
new file mode 100644
index 00000000..2dc8eb43
--- /dev/null
+++ b/completions/badblocks
@@ -0,0 +1,32 @@
+# badblocks(8) completion -*- shell-script -*-
+
+_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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/bash-builtins b/completions/bash-builtins
deleted file mode 100644
index 3eba8a11..00000000
--- a/completions/bash-builtins
+++ /dev/null
@@ -1,128 +0,0 @@
-# bash alias completion
-#
-_alias()
-{
- local cur
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
-
- case $COMP_LINE in
- *[^=])
- COMPREPLY=( $( compgen -A alias -- "$cur" ) )
- ;;
- *=)
- COMPREPLY=( "$( alias ${cur%=} 2>/dev/null | sed \
- -e 's|^alias '"$cur"'\(.*\)$|\1|' )" )
- ;;
- esac
-}
-complete -F _alias -o nospace alias
-
-# bash export completion
-#
-_export()
-{
- local cur
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
-
- case $COMP_LINE in
- *=\$*)
- COMPREPLY=( $( compgen -v -P '$' -- "${cur#*=\$}" ) )
- ;;
- *[^=])
- COMPREPLY=( $( compgen -v -S '=' -- "$cur" ) )
- ;;
- *=)
- COMPREPLY=( "$( eval echo -n \"$`echo ${cur%=}`\" |
- ( echo -n \'
- sed -e 's/'\''/'\''\\\'\'''\''/g'
- echo -n \' ) )" )
- ;;
- esac
-}
-complete -F _export -o default -o nospace export
-
-# bash shell function completion
-#
-_function()
-{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- if [[ $1 == @(declare|typeset) ]]; then
- if [ "$prev" = -f ]; then
- COMPREPLY=( $( compgen -A function -- "$cur" ) )
- elif [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-a -f -F -i -r -x -p' -- "$cur" ) )
- fi
- elif [ $COMP_CWORD -eq 1 ]; then
- COMPREPLY=( $( compgen -A function -- "$cur" ) )
- else
- COMPREPLY=( "() $( type -- ${COMP_WORDS[1]} | sed -e 1,2d )" )
- fi
-}
-complete -F _function function declare typeset
-
-# bash complete completion
-#
-_complete()
-{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- case $prev in
- -o)
- COMPREPLY=( $( compgen -W 'bashdefault default dirnames filenames \
- nospace plusdirs' -- "$cur" ) )
- return 0
- ;;
-
- -A)
- COMPREPLY=( $( compgen -W 'alias arrayvar binding builtin command \
- directory disabled enabled export file function group \
- helptopic hostname job keyword running service setopt shopt \
- signal stopped user variable' -- "$cur" ) )
- return 0
- ;;
-
- -C)
- COMPREPLY=( $( compgen -A command -- "$cur" ) )
- return 0
- ;;
- -F)
- COMPREPLY=( $( compgen -A function -- "$cur" ) )
- return 0
- ;;
- -p|-r)
- COMPREPLY=( $( complete -p | sed -e 's|.* ||' ) )
- COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) )
- return 0
- ;;
-
- esac
-
- if [[ "$cur" == -* ]]; then
- # 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="$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/bind-utils b/completions/bind-utils
deleted file mode 100644
index 040d1975..00000000
--- a/completions/bind-utils
+++ /dev/null
@@ -1,23 +0,0 @@
-# bash completion for nslookup
-
-have nslookup &&
-_nslookup()
-{
- local cur
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
-
- COMPREPLY=( $( compgen -P '-' -W 'all class= debug d2 domain= srchlist= \
- defname search port= querytype= type= recurse retry root timeout vc \
- ignoretc' -- "$cur" ) )
-} &&
-complete -F _nslookup nslookup
-
-# 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/bitkeeper
deleted file mode 100644
index 4c312a14..00000000
--- a/completions/bitkeeper
+++ /dev/null
@@ -1,26 +0,0 @@
-# BitKeeper completion adapted from code by Bart Trojanowski <bart@jukie.net>
-
-have bk &&
-_bk() {
- local BKCMDS
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
-
- BKCMDS="$( bk help topics | awk '/^ bk/ { print $4 }' | \
- xargs printf '%s ' )"
-
- COMPREPLY=( $( compgen -W "$BKCMDS" -- "$cur" ) )
- _filedir
-
- return 0
-} &&
-complete -F _bk bk
-
-# 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/bk b/completions/bk
new file mode 100644
index 00000000..8be6fb76
--- /dev/null
+++ b/completions/bk
@@ -0,0 +1,19 @@
+# BitKeeper completion -*- shell-script -*-
+# adapted from code by Bart Trojanowski <bart@jukie.net>
+
+_bk()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ local BKCMDS="$( bk help topics 2>/dev/null | \
+ awk '/^ bk/ { print $4 }' | xargs printf '%s ' )"
+
+ COMPREPLY=( $( compgen -W "$BKCMDS" -- "$cur" ) )
+ _filedir
+
+ return 0
+} &&
+complete -F _bk bk
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/brctl b/completions/brctl
index 1be86af1..441aa08f 100644
--- a/completions/brctl
+++ b/completions/brctl
@@ -1,15 +1,13 @@
-# bash completion for brctl
+# bash completion for brctl -*- shell-script -*-
-have brctl &&
_brctl()
{
- local cur command
+ local cur prev words cword
+ _init_completion || return
- COMPREPLY=()
- _get_comp_words_by_ref cur
- command=${COMP_WORDS[1]}
+ local command=${words[1]}
- case $COMP_CWORD in
+ case $cword in
1)
COMPREPLY=( $( compgen -W "addbr delbr addif delif \
setageing setbridgeprio setfd sethello \
@@ -39,10 +37,4 @@ _brctl()
} &&
complete -F _brctl -o default brctl
-# 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/bittorrent b/completions/btdownloadheadless.py
index 761d0836..60d1962d 100644
--- a/completions/bittorrent
+++ b/completions/btdownloadheadless.py
@@ -1,13 +1,9 @@
-# btdownloadheadless(1) completion
+# btdownloadheadless(1) completion -*- shell-script -*-
-have btdownloadheadless.py || have btdownloadcurses.py || \
-have btdownloadgui.py &&
_btdownload()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
--responsefile|--saveas)
@@ -30,12 +26,7 @@ _btdownload()
_filedir
fi
} &&
-complete -F _btdownload btdownloadheadless.py btdownloadcurses.py btdownloadgui.py
+complete -F _btdownload btdownloadheadless.py btdownloadcurses.py \
+ btdownloadgui.py
-# 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/bzip2 b/completions/bzip2
index 7e2f9fd0..6e6c68bb 100644
--- a/completions/bzip2
+++ b/completions/bzip2
@@ -1,13 +1,9 @@
-# bash completion for bzip2
+# bash completion for bzip2 -*- shell-script -*-
-have bzip2 || have pbzip2 &&
_bzip2()
{
- local cur prev xspec helpopts
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
- helpopts=`_parse_help ${COMP_WORDS[0]}`
+ local cur prev words cword
+ _init_completion || return
case $prev in
-b|-h|--help|-p)
@@ -16,14 +12,14 @@ _bzip2()
esac
if [[ "$cur" == -* ]]; then
+ local helpopts=$( _parse_help "$1" )
COMPREPLY=( $( compgen -W "${helpopts//#/} -2 -3 -4 -5 -6 -7 -8 -9" \
-- "$cur" ) )
return 0
fi
- local IFS=$'\n'
+ local IFS=$'\n' xspec="*.bz2"
- xspec="*.bz2"
if [[ "$prev" == --* ]]; then
[[ "$prev" == --decompress || \
"$prev" == --list || \
@@ -36,16 +32,10 @@ _bzip2()
_expand || return 0
- _compopt_o_filenames
+ compopt -o filenames
COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \
$( compgen -d -- "$cur" ) )
} &&
-complete -F _bzip2 bzip2 pbzip2
-
-# Local variables:
-# mode: shell-script
-# sh-basic-offset: 4
-# sh-indent-comment: t
-# indent-tabs-mode: nil
-# End:
+complete -F _bzip2 bzip2 pbzip2 lbzip2
+
# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/cal b/completions/cal
new file mode 100644
index 00000000..880b0b35
--- /dev/null
+++ b/completions/cal
@@ -0,0 +1,34 @@
+# cal(1) completion -*- shell-script -*-
+
+_cal()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ case $prev in
+ -m)
+ if [[ $OSTYPE == *bsd* ]]; then
+ COMPREPLY=( $( compgen -W '{1..12}' -- "$cur" ) )
+ return
+ fi
+ ;;
+ -s)
+ [[ $OSTYPE == *bsd* ]] && return
+ ;;
+ -A|-B|-d|-H)
+ return
+ ;;
+ esac
+
+ if [[ $cur == -* ]]; then
+ COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) )
+ return
+ fi
+
+ local args
+ _count_args
+ [[ $args -eq 1 ]] && COMPREPLY=( $( compgen -W '{1..12}' -- "$cur" ) )
+} &&
+complete -F _cal cal ncal
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/cancel b/completions/cancel
new file mode 100644
index 00000000..3e9a3781
--- /dev/null
+++ b/completions/cancel
@@ -0,0 +1,12 @@
+# cancel(1) completion -*- shell-script -*-
+
+_cancel()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ COMPREPLY=( $( compgen -W "$( lpstat 2>/dev/null | cut -d' ' -f1 )" -- "$cur" ) )
+} &&
+complete -F _cancel cancel
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/cardctl b/completions/cardctl
index 1af7491b..0532d6ef 100644
--- a/completions/cardctl
+++ b/completions/cardctl
@@ -1,24 +1,15 @@
-# Linux cardctl(8) completion
+# Linux cardctl(8) completion -*- shell-script -*-
-have cardctl || have pccardctl &&
_cardctl()
{
- local cur
+ local cur prev words cword
+ _init_completion || return
- COMPREPLY=()
- _get_comp_words_by_ref cur
-
- if [ $COMP_CWORD -eq 1 ]; then
+ if [ $cword -eq 1 ]; then
COMPREPLY=( $( compgen -W 'status config ident suspend \
resume reset eject insert scheme' -- "$cur" ) )
fi
} &&
complete -F _cardctl cardctl pccardctl
-# 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/cfagent b/completions/cfagent
new file mode 100644
index 00000000..f3e227a4
--- /dev/null
+++ b/completions/cfagent
@@ -0,0 +1,21 @@
+# cfagent completion -*- shell-script -*-
+
+_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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/cfengine b/completions/cfengine
deleted file mode 100644
index 50a13840..00000000
--- a/completions/cfengine
+++ /dev/null
@@ -1,88 +0,0 @@
-# bash completion for cfengine
-
-have cfagent && {
-_cfagent_options()
-{
- COMPREPLY=( $( compgen -W '--sysadm --force-net-copy --no-check-files \
- --no-check-mounts --debug --define --no-edits --enforce-links --file \
- --help --no-hard-classes --no-ifconfig --inform --no-copy --no-lock \
- --traverse-links --delete-stale-links --no-mount --no-modules \
- --dry-run --negate --parse-only --no-processes --no-splay \
- --no-commands --silent --no-tidy --use-env --underscore-classes \
- --verbose --version --no-preconf --no-links --quiet' -- "$cur" ) )
-}
-
-_cfagent()
-{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- case $prev in
- -f|--file)
- _filedir
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- _cfagent_options
- fi
-}
-complete -F _cfagent cfagent
-
-_cfrun()
-{
- local i section cfinputs cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- section=1
- for (( i=1; i < COMP_CWORD; i++ )); do
- if [[ "${COMP_WORDS[i]}" == -- ]]; then
- section=$((section + 1))
- fi
- done
-
- case $section in
- 1)
- case $prev in
- -f)
- _filedir
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-f -h -d -S -T -v' -- $cur ) )
- else
- hostfile=${CFINPUTS:-/var/lib/cfengine/inputs}/cfrun.hosts
- for (( i=1; i < COMP_CWORD; i++ )); do
- if [[ "${COMP_WORDS[i]}" == -f ]]; then
- hostfile=${COMP_WORDS[i+1]}
- break
- fi
- done
- [ ! -f $hostfile ] && return 0
-
- COMPREPLY=( $(compgen -W "$( command grep -v \
- -E '(=|^$|^#)' $hostfile )" -- "$cur" ) )
- fi
- ;;
- 2)
- _cfagent_options
- ;;
- esac
-}
-complete -F _cfrun cfrun
-}
-
-# 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/cfrun b/completions/cfrun
new file mode 100644
index 00000000..288bcf43
--- /dev/null
+++ b/completions/cfrun
@@ -0,0 +1,47 @@
+# cfrun completion -*- shell-script -*-
+
+_cfrun()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ local i section=1
+ for (( i=1; i < cword; i++ )); do
+ if [[ "${words[i]}" == -- ]]; then
+ section=$((section + 1))
+ fi
+ done
+
+ case $section in
+ 1)
+ case $prev in
+ -f)
+ _filedir
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-f -h -d -S -T -v' -- $cur ) )
+ else
+ hostfile=${CFINPUTS:-/var/lib/cfengine/inputs}/cfrun.hosts
+ for (( i=1; i < cword; i++ )); do
+ if [[ "${words[i]}" == -f ]]; then
+ hostfile=${words[i+1]}
+ break
+ fi
+ done
+ [ ! -f $hostfile ] && return 0
+
+ COMPREPLY=( $(compgen -W "$( command grep -v \
+ -E '(=|^$|^#)' $hostfile )" -- "$cur" ) )
+ fi
+ ;;
+ 2)
+ COMPREPLY=( $( compgen -W '$( _parse_help cfagent )' -- "$cur" ) )
+ ;;
+ esac
+} &&
+complete -F _cfrun cfrun
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/chage b/completions/chage
new file mode 100644
index 00000000..1842bb8a
--- /dev/null
+++ b/completions/chage
@@ -0,0 +1,26 @@
+# chage(1) completion -*- shell-script -*-
+
+_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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/change_pw b/completions/change_pw
new file mode 100644
index 00000000..98852583
--- /dev/null
+++ b/completions/change_pw
@@ -0,0 +1,25 @@
+# mailman change_pw completion -*- shell-script -*-
+
+_change_pw()
+{
+ local cur prev words cword split
+ _init_completion -s || return
+
+ case $prev in
+ -l|--listname)
+ _xfunc list_lists _mailman_lists
+ return 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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/check_db b/completions/check_db
new file mode 100644
index 00000000..651b375c
--- /dev/null
+++ b/completions/check_db
@@ -0,0 +1,17 @@
+# mailman check_db completion -*- shell-script -*-
+
+_check_db()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--all --verbose --help' -- "$cur" ) )
+ else
+ _xfunc list_lists _mailman_lists
+ fi
+
+} &&
+complete -F _check_db check_db
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/check_perms b/completions/check_perms
new file mode 100644
index 00000000..472b9266
--- /dev/null
+++ b/completions/check_perms
@@ -0,0 +1,15 @@
+# mailman check_perms completion -*- shell-script -*-
+
+_check_perms()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-f -v -h' -- "$cur" ) )
+ fi
+
+} &&
+complete -F _check_perms check_perms
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/chgrp b/completions/chgrp
new file mode 100644
index 00000000..7355a680
--- /dev/null
+++ b/completions/chgrp
@@ -0,0 +1,40 @@
+# chgrp(1) completion -*- shell-script -*-
+
+_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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/chkconfig b/completions/chkconfig
index 2d02e56e..31a575e3 100644
--- a/completions/chkconfig
+++ b/completions/chkconfig
@@ -1,14 +1,9 @@
-# chkconfig(8) completion
+# chkconfig(8) completion -*- shell-script -*-
-have chkconfig &&
_chkconfig()
{
- local cur prev split=false
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- _split_longopt && split=true
+ local cur prev words cword split
+ _init_completion -s || return
case $prev in
--level=[1-6]|[1-6]|--list|--add|--del|--override)
@@ -16,7 +11,7 @@ _chkconfig()
return 0
;;
--level)
- COMPREPLY=( $( compgen -W '1 2 3 4 5 6' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '{1..6}' -- "$cur" ) )
return 0
;;
esac
@@ -26,7 +21,7 @@ _chkconfig()
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--list --add --del --override --level' -- "$cur" ) )
else
- if [[ $COMP_CWORD -eq 2 || $COMP_CWORD -eq 4 ]]; then
+ if [[ $cword -eq 2 || $cword -eq 4 ]]; then
COMPREPLY=( $( compgen -W 'on off reset resetpriorities' -- "$cur" ) )
else
_services
@@ -35,10 +30,4 @@ _chkconfig()
} &&
complete -F _chkconfig chkconfig
-# 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/chown b/completions/chown
new file mode 100644
index 00000000..f9bd9686
--- /dev/null
+++ b/completions/chown
@@ -0,0 +1,46 @@
+# chown(1) completion -*- shell-script -*-
+
+_chown()
+{
+ local cur prev words cword split
+ # Don't treat user:group as separate words.
+ _init_completion -s -n : || return
+
+ case "$prev" in
+ --from)
+ _usergroup
+ return 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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/chpasswd b/completions/chpasswd
new file mode 100644
index 00000000..d8a7e62c
--- /dev/null
+++ b/completions/chpasswd
@@ -0,0 +1,29 @@
+# chpasswd(8) completion -*- shell-script -*-
+
+_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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/chrpath b/completions/chrpath
new file mode 100644
index 00000000..29a71851
--- /dev/null
+++ b/completions/chrpath
@@ -0,0 +1,27 @@
+# chrpath(1) completion -*- shell-script -*-
+
+_chrpath()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ case $prev in
+ -v|--version|-h|--help)
+ return
+ ;;
+ -r|--replace)
+ _filedir -d
+ return
+ ;;
+ esac
+
+ if [[ $cur == -* ]]; then
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
+ return
+ fi
+
+ _filedir
+} &&
+complete -F _chrpath chrpath
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/chsh b/completions/chsh
index 1af3630f..f65291a1 100644
--- a/completions/chsh
+++ b/completions/chsh
@@ -1,11 +1,9 @@
-# chsh(1) completion
+# chsh(1) completion -*- shell-script -*-
_chsh()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
--list-shells|--help|-v|--version)
@@ -17,21 +15,14 @@ _chsh()
;;
esac
- if [[ "$cur" == -* && "$( uname -s )" == @(Linux|GNU|GNU/*) ]]; then
- COMPREPLY=( $( compgen -W '--shell --list-shells --help --version' \
- -- "$cur" ) )
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) )
else
- COMPREPLY=( $( compgen -u -- "$cur" ) )
+ _allowed_users
fi
return 0
-}
+} &&
complete -F _chsh chsh
-# 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/cksfv b/completions/cksfv
index 1f83824b..d21bcf39 100644
--- a/completions/cksfv
+++ b/completions/cksfv
@@ -1,20 +1,17 @@
-# cksfv completion by Chris <xris@forevermore.net>
+# cksfv completion by Chris <xris@forevermore.net> -*- shell-script -*-
-have cksfv &&
_cksfv()
{
- local cur prev
+ local cur prev words cword
+ _init_completion || return
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- if [ $COMP_CWORD -eq 1 ]; then
- COMPREPLY=( $( compgen -W '-C -f -i -q -v' -- "$cur" ) )
+ if [ $cword -eq 1 ]; then
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
return 0
fi
case "$prev" in
- -C)
+ -C|-g)
_filedir -d
return 0
;;
@@ -29,10 +26,4 @@ _cksfv()
} &&
complete -F _cksfv cksfv
-# 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/cleanarch b/completions/cleanarch
new file mode 100644
index 00000000..df18aaf5
--- /dev/null
+++ b/completions/cleanarch
@@ -0,0 +1,16 @@
+# mailman cleanarch completion -*- shell-script -*-
+
+_cleanarch()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--status --dry-run --quiet \
+ --help' -- "$cur" ) )
+ fi
+
+} &&
+complete -F _cleanarch cleanarch
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/clisp b/completions/clisp
index 074f692c..fd19b252 100644
--- a/completions/clisp
+++ b/completions/clisp
@@ -1,13 +1,11 @@
+# -*- shell-script -*-
# bash brogrammable completion for various Common Lisp implementations by
# Nikodemus Siivola <nikodemus@random-state.net>
-have clisp &&
_clisp()
{
- local cur
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
+ local cur prev words cword
+ _init_completion || return
# completing an option (may or may not be separated by a space)
if [[ "$cur" == -* ]]; then
@@ -22,10 +20,4 @@ _clisp()
} &&
complete -F _clisp -o default clisp
-# 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/clone_member b/completions/clone_member
new file mode 100644
index 00000000..74608f96
--- /dev/null
+++ b/completions/clone_member
@@ -0,0 +1,25 @@
+# mailman clone_member completion -*- shell-script -*-
+
+_clone_member()
+{
+ local cur prev words cword split
+ _init_completion -s || return
+
+ case $prev in
+ -l|--listname)
+ _xfunc list_lists _mailman_lists
+ return 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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/complete b/completions/complete
new file mode 100644
index 00000000..ebf90237
--- /dev/null
+++ b/completions/complete
@@ -0,0 +1,50 @@
+# bash complete completion -*- shell-script -*-
+
+_complete()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ case $prev in
+ -o)
+ COMPREPLY=( $( compgen -W 'bashdefault default dirnames filenames \
+ nospace plusdirs' -- "$cur" ) )
+ return 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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/config_list b/completions/config_list
new file mode 100644
index 00000000..50fa0500
--- /dev/null
+++ b/completions/config_list
@@ -0,0 +1,27 @@
+# mailman config_list completion -*- shell-script -*-
+
+_config_list()
+{
+ local cur prev words cword split
+ _init_completion -s || return
+
+ case $prev in
+ -i|-o|--inputfile|--outputfile)
+ _filedir
+ return 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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/configure b/completions/configure
index 1b207692..8e28d451 100644
--- a/completions/configure
+++ b/completions/configure
@@ -1,17 +1,22 @@
-# bash completion for configure
+# bash completion for configure -*- shell-script -*-
_configure()
{
- local cur prev split=false
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- _split_longopt && split=true
+ local cur prev words cword split
+ _init_completion -s || return
case $prev in
+ -h|--help|-V|--version|--program-prefix|--program-suffix|\
+ --program-transform-name)
+ return
+ ;;
+ --*file)
+ _filedir
+ return
+ ;;
--*prefix|--*dir)
_filedir -d
+ return
;;
esac
@@ -26,19 +31,12 @@ _configure()
awk '/^ --[A-Za-z]/ { print $1; \
if ($2 ~ /--[A-Za-z]/) print $2 }' | sed -e 's/[[,].*//g' )" \
-- "$cur" ) )
+ [[ $COMPREPLY == *=* ]] && compopt -o nospace
else
- COMPREPLY=( $( compgen -W "$( $1 --help 2>&1 | \
- awk '/^ --[A-Za-z]/ { print $1; \
- if ($2 ~ /--[A-Za-z]/) print $2 }' | sed -e 's/[[,=].*//g' )" \
- -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
+ [[ $COMPREPLY == *= ]] && compopt -o nospace
fi
-}
+} &&
complete -F _configure 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/convert b/completions/convert
new file mode 100644
index 00000000..c86293a6
--- /dev/null
+++ b/completions/convert
@@ -0,0 +1,328 @@
+# bash completion for ImageMagick -*- shell-script -*-
+
+_ImageMagick()
+{
+ case $prev in
+ -channel)
+ COMPREPLY=( $( compgen -W 'Red Green Blue Opacity \
+ Matte Cyan Magenta Yellow Black' -- "$cur" ) )
+ return 0
+ ;;
+ -colormap)
+ COMPREPLY=( $( compgen -W 'shared private' -- "$cur" ) )
+ return 0
+ ;;
+ -colorspace)
+ COMPREPLY=( $( compgen -W 'GRAY OHTA RGB Transparent \
+ XYZ YCbCr YIQ YPbPr YUV CMYK' -- "$cur" ) )
+ return 0
+ ;;
+ -compose)
+ COMPREPLY=( $( compgen -W 'Over In Out Atop Xor Plus \
+ Minus Add Subtract Difference Multiply Bumpmap\
+ Copy CopyRed CopyGreen CopyBlue CopyOpacity' -- "$cur" ) )
+ return 0
+ ;;
+ -compress)
+ COMPREPLY=( $( compgen -W 'None BZip Fax Group4 JPEG \
+ Lossless LZW RLE Zip' -- "$cur" ) )
+ return 0
+ ;;
+ -dispose)
+ COMPREPLY=( $( compgen -W 'Undefined None Background Previous' \
+ -- "$cur" ) )
+ return 0
+ ;;
+ -encoding)
+ COMPREPLY=( $( compgen -W 'AdobeCustom AdobeExpert \
+ AdobeStandard AppleRoman BIG5 GB2312 Latin2 \
+ None SJIScode Symbol Unicode Wansung' -- "$cur"))
+ return 0
+ ;;
+ -endian)
+ COMPREPLY=( $( compgen -W 'MSB LSB' -- "$cur" ) )
+ return 0
+ ;;
+ -filter)
+ COMPREPLY=( $( compgen -W 'Point Box Triangle Hermite \
+ Hanning Hamming Blackman Gaussian Quadratic \
+ Cubic Catrom Mitchell Lanczos Bessel Sinc' -- "$cur" ) )
+ return 0
+ ;;
+ -format)
+ COMPREPLY=( $( compgen -W "$( convert -list format | awk \
+ '/ [r-][w-][+-] / { sub("[*]$","",$1); print tolower($1) }' )" \
+ -- "$cur" ) )
+ return 0
+ ;;
+ -gravity)
+ COMPREPLY=( $( compgen -W 'Northwest North NorthEast \
+ West Center East SouthWest South SouthEast' -- "$cur" ) )
+ return 0
+ ;;
+ -intent)
+ COMPREPLY=( $( compgen -W 'Absolute Perceptual \
+ Relative Saturation' -- "$cur" ) )
+ return 0
+ ;;
+ -interlace)
+ COMPREPLY=( $( compgen -W 'None Line Plane Partition' -- "$cur" ) )
+ return 0
+ ;;
+ -limit)
+ COMPREPLY=( $( compgen -W 'Disk File Map Memory' -- "$cur" ) )
+ return 0
+ ;;
+ -list)
+ COMPREPLY=( $( compgen -W 'Delegate Format Magic Module Resource \
+ Type' -- "$cur" ) )
+ return 0
+ ;;
+ -map)
+ COMPREPLY=( $( compgen -W 'best default gray red green blue' \
+ -- "$cur" ) )
+ _filedir
+ return 0
+ ;;
+ -noise)
+ COMPREPLY=( $( compgen -W 'Uniform Gaussian Multiplicative \
+ Impulse Laplacian Poisson' -- "$cur" ) )
+ return 0
+ ;;
+ -preview)
+ COMPREPLY=( $( compgen -W 'Rotate Shear Roll Hue \
+ Saturation Brightness Gamma Spiff \
+ Dull Grayscale Quantize Despeckle \
+ ReduceNoise AddNoise Sharpen Blur \
+ Treshold EdgeDetect Spread Shade \
+ Raise Segment Solarize Swirl Implode \
+ Wave OilPaint CharcoalDrawing JPEG' -- "$cur" ) )
+ return 0
+ ;;
+ -mask|-profile|-texture|-tile|-write)
+ _filedir
+ return 0
+ ;;
+ -type)
+ COMPREPLY=( $( compgen -W 'Bilevel Grayscale Palette PaletteMatte \
+ TrueColor TrueColorMatte ColorSeparation ColorSeparationlMatte \
+ Optimize' -- "$cur" ) )
+ return 0
+ ;;
+ -units)
+ COMPREPLY=( $( compgen -W 'Undefined PixelsPerInch \
+ PixelsPerCentimeter' -- "$cur" ) )
+ return 0
+ ;;
+ -virtual-pixel)
+ COMPREPLY=( $( compgen -W 'Constant Edge mirror tile' -- "$cur" ) )
+ return 0
+ ;;
+ -visual)
+ COMPREPLY=( $( compgen -W 'StaticGray GrayScale StaticColor \
+ PseudoColor TrueColor DirectColor defaut visualid' -- "$cur" ))
+ return 0
+ ;;
+ esac
+
+ return 1
+}
+
+_convert()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ _ImageMagick && return
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" -help )' -- "$cur" ) )
+ elif [[ "$cur" == +* ]]; then
+ COMPREPLY=( $( compgen -W '+adjoin +append +compress \
+ +contrast +debug +dither +endian +gamma +label +map \
+ +mask +matte +negate +noise +page +raise +render \
+ +write' -- "$cur" ) )
+ else
+ _filedir
+ fi
+} &&
+complete -F _convert convert
+
+_mogrify()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ _ImageMagick && return
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" -help )' -- "$cur" ) )
+ elif [[ "$cur" == +* ]]; then
+ COMPREPLY=( $( compgen -W '+compress +contrast +debug +dither \
+ +endian +gamma +label +map +mask +matte +negate +page \
+ +raise' -- "$cur" ) )
+ else
+ _filedir
+ fi
+} &&
+complete -F _mogrify mogrify
+
+_display()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ _ImageMagick && return
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" -help )' -- "$cur" ) )
+ elif [[ "$cur" == +* ]]; then
+ COMPREPLY=( $( compgen -W '+compress +contrast +debug +dither \
+ +endian +gamma +label +map +matte +negate +page \
+ +raise +write' -- "$cur" ) )
+ else
+ _filedir
+ fi
+} &&
+complete -F _display display
+
+_animate()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ _ImageMagick && return
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" -help )' -- "$cur" ) )
+ elif [[ "$cur" == +* ]]; then
+ COMPREPLY=( $( compgen -W '+debug +dither +gamma +map +matte' \
+ -- "$cur" ) )
+ else
+ _filedir
+ fi
+} &&
+complete -F _animate animate
+
+_identify()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ _ImageMagick && return
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" -help )' -- "$cur" ) )
+ elif [[ "$cur" == +* ]]; then
+ COMPREPLY=( $( compgen -W '+debug' -- "$cur" ) )
+ else
+ _filedir
+ fi
+} &&
+complete -F _identify identify
+
+_montage()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ _ImageMagick && return
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" -help )' -- "$cur" ) )
+ elif [[ "$cur" == +* ]]; then
+ COMPREPLY=( $( compgen -W '+adjoin +compress +debug +dither \
+ +endian +gamma +label +matte +page' -- "$cur" ) )
+ else
+ _filedir
+ fi
+} &&
+complete -F _montage montage
+
+_composite()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ _ImageMagick && return
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" -help )' -- "$cur" ) )
+ elif [[ "$cur" == +* ]]; then
+ COMPREPLY=( $( compgen -W '+compress +debug +dither +endian +label \
+ +matte +negate +page +write' -- "$cur" ) )
+ else
+ _filedir
+ fi
+} &&
+complete -F _composite composite
+
+_compare()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ _ImageMagick && return
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" -help )' -- "$cur" ) )
+ elif [[ "$cur" == +* ]]; then
+ COMPREPLY=( $( compgen -W '+debug' -- "$cur" ) )
+ else
+ _filedir
+ fi
+} &&
+complete -F _compare compare
+
+_conjure()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ _ImageMagick && return
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" -help )' -- "$cur" ) )
+ elif [[ "$cur" == +* ]]; then
+ COMPREPLY=( $( compgen -W '+debug' -- "$cur" ) )
+ else
+ _filedir
+ fi
+} &&
+complete -F _conjure conjure
+
+_import()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ _ImageMagick && return
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" -help )' -- "$cur" ) )
+ elif [[ "$cur" == +* ]]; then
+ COMPREPLY=( $( compgen -W '+debug' -- "$cur" ) )
+ else
+ _filedir
+ fi
+} &&
+complete -F _import import
+
+_stream()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ _ImageMagick && return
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" -help )' -- "$cur" ) )
+ elif [[ "$cur" == +* ]]; then
+ COMPREPLY=( $( compgen -W '+debug' -- "$cur" ) )
+ else
+ _filedir
+ fi
+} &&
+complete -F _stream stream
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/coreutils b/completions/coreutils
deleted file mode 100644
index 33d58cf7..00000000
--- a/completions/coreutils
+++ /dev/null
@@ -1,149 +0,0 @@
-# Completions for various core utilities
-
-# chown(1) completion
-#
-have chown &&
-_chown()
-{
- local cur prev split=false
-
- # Get cur and prev words; but don't treat user:group as separate words.
- _get_comp_words_by_ref -n : cur prev
-
- _split_longopt && split=true
-
- case "$prev" in
- --from)
- _usergroup
- return 0
- ;;
- --reference)
- _filedir
- return 0
- ;;
- esac
-
- $split && return 0
-
- if [[ "$cur" == -* ]]; then
- # Complete -options
- local w opts
- for w in "${COMP_WORDS[@]}" ; do
- [[ "$w" == -@(R|-recursive) ]] && opts="-H -L -P" && break
- done
- COMPREPLY=( $( compgen -W '-c -h -f -R -v --changes --dereference \
- --no-dereference --from --silent --quiet --reference --recursive \
- --verbose --help --version $opts' -- "$cur" ) )
- else
- local args
-
- # The first argument is an usergroup; the rest are filedir.
- _count_args :
-
- if [[ $args == 1 ]]; then
- _usergroup -u
- else
- _filedir
- fi
- fi
-} &&
-complete -F _chown chown
-
-
-# chgrp(1) completion
-#
-have chgrp &&
-_chgrp()
-{
- local cur prev split=false
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
- cur=${cur//\\\\/}
-
- _split_longopt && split=true
-
- if [[ "$prev" == --reference ]]; then
- _filedir
- return 0
- fi
-
- $split && return 0
-
- # options completion
- if [[ "$cur" == -* ]]; then
- local w opts
- for w in "${COMP_WORDS[@]}" ; do
- [[ "$w" == -@(R|-recursive) ]] && opts="-H -L -P" && break
- done
- COMPREPLY=( $( compgen -W '-c -h -f -R -v --changes --dereference \
- --no-dereference --silent --quiet --reference --recursive \
- --verbose --help --version $opts' -- "$cur" ) )
- return 0
- fi
-
- # first parameter on line or first since an option?
- if [[ $COMP_CWORD -eq 1 && "$cur" != -* || "$prev" == -* ]]; then
- _allowed_groups
- else
- _filedir || return 0
- fi
-
- return 0
-} &&
-complete -F _chgrp chgrp
-
-# id(1) completion
-#
-have id &&
-_id()
-{
- local cur
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-a -g --group -G --groups -n --name\
- -r --real -u --user --help --version' -- "$cur" ) )
- else
- COMPREPLY=( $( compgen -u "$cur" ) )
- fi
-} &&
-complete -F _id id
-
-# mktemp(1) completion
-#
-have mktemp &&
-_mktemp()
-{
- COMPREPLY=()
- local cur prev split=false
- _get_comp_words_by_ref cur prev
-
- _split_longopt && split=true
-
- case "$prev" in
- --help|--version|--suffix)
- return 0
- ;;
- --tmpdir|-p)
- _filedir -d
- return 0
- ;;
- esac
-
- $split && return 0
-
- [[ "$cur" == -* ]] && \
- COMPREPLY=( $( compgen -W '-d -u -q -p -t' -- "$cur" ) )
-} &&
-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 c6d797aa..47c2e52c 100644
--- a/completions/cowsay
+++ b/completions/cowsay
@@ -1,12 +1,9 @@
-# bash completion for cowsay
+# bash completion for cowsay -*- shell-script -*-
-have cowsay &&
_cowsay()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-f)
@@ -22,10 +19,4 @@ _cowsay()
} &&
complete -F _cowsay -o default cowsay cowthink
-# 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/cpan2dist b/completions/cpan2dist
index 13f568af..f6a67ac6 100644
--- a/completions/cpan2dist
+++ b/completions/cpan2dist
@@ -1,12 +1,9 @@
-# bash completion for cpan2dist
+# bash completion for cpan2dist -*- shell-script -*-
-have cpan2dist &&
_cpan2dist()
{
- local cur prev packagelist cpandirs
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
--format)
@@ -23,30 +20,18 @@ _cpan2dist()
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--help --skiptest --force --install \
- --verbose --keepsource --makefile --buildprereq \
- --archive --flushcache --defaults --edit-metafile \
- --format --ban --banlist --ignore --ignorelist \
- --modulelist --logfile --timeout --set-config \
- --set-program --dist-opts --default-banlist \
- --default-ignorelist' -- $cur ) )
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
else
- cpandirs=( "$HOME/.cpanplus/" "$HOME/.cpan/source/modules/" )
+ local cpandirs=( "$HOME/.cpanplus/" "$HOME/.cpan/source/modules/" )
+ local packagelist
for dir in ${cpandirs[@]}; do
[[ -d "$dir" && -r "$dir/02packages.details.txt.gz" ]] && \
packagelist="$dir/02packages.details.txt.gz"
done
- COMPREPLY=( $( zgrep "^${cur//-/::}" \
- $packagelist 2>/dev/null \
- | awk '{print $1}' | sed -e 's/::/-/g' ) )
+ [[ $packagelist ]] && COMPREPLY=( $( zgrep "^${cur//-/::}" \
+ $packagelist 2>/dev/null | awk '{print $1}' | sed -e 's/::/-/g' ) )
fi
} &&
complete -F _cpan2dist -o default cpan2dist
-# 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/cpio b/completions/cpio
index 5ead0184..ebbe5c57 100644
--- a/completions/cpio
+++ b/completions/cpio
@@ -1,6 +1,5 @@
-# bash completion for cpio
+# bash completion for cpio -*- shell-script -*-
-have cpio && {
_cpio_format()
{
COMPREPLY=( $( compgen -W 'bin odc newc crc tar ustar hpbin hpodc' -- "$cur" ) )
@@ -8,12 +7,8 @@ _cpio_format()
_cpio()
{
- local cur prev split=false
-
- COMPREPLY=()
- _get_comp_words_by_ref -n : cur prev
-
- _split_longopt && split=true
+ local cur prev words cword split
+ _init_completion -s -n : || return
# --name value style option
case $prev in
@@ -30,7 +25,7 @@ _cpio()
return 0
;;
--rsh-command)
- _compopt_o_filenames
+ compopt -o filenames
COMPREPLY=( $( compgen -c -- "$cur" ) )
return 0
;;
@@ -38,11 +33,11 @@ _cpio()
$split && return 0
- if [ $COMP_CWORD -eq 1 ]; then
+ if [ $cword -eq 1 ]; then
COMPREPLY=( $( compgen -W '-o --create -i --extract -p --pass-through \
-? --help --license --usage --version' -- "$cur" ) )
else
- case ${COMP_WORDS[1]} in
+ case ${words[1]} in
-o|--create)
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-0 -a -c -v -A -B\
@@ -90,14 +85,7 @@ _cpio()
;;
esac
fi
-}
+} &&
complete -F _cpio cpio
-}
-# 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/cppcheck b/completions/cppcheck
new file mode 100644
index 00000000..5dd30931
--- /dev/null
+++ b/completions/cppcheck
@@ -0,0 +1,60 @@
+# bash completion for cppcheck(1) -*- shell-script -*-
+
+_cppcheck()
+{
+ local cur prev words cword split
+ _init_completion -s || return
+
+ case $prev in
+ --append|--exitcode-suppressions|--file-list|--rule-file|\
+ --suppressions-list|-i)
+ _filedir
+ return
+ ;;
+ -D|--rule|--suppress|--template)
+ return
+ ;;
+ --enable)
+ COMPREPLY=( $( compgen -W 'all style performance portability
+ information unusedFunction missingInclude' -- "$cur" ) )
+ return
+ ;;
+ --error-exitcode)
+ COMPREPLY=( $( compgen -W '{0..255}' -- "$cur" ) )
+ return
+ ;;
+ -I)
+ _filedir -d
+ return
+ ;;
+ -j)
+ COMPREPLY=( $( compgen -W '{2..16}' -- "$cur" ) )
+ return
+ ;;
+ --std)
+ COMPREPLY=( $( compgen -W 'c99 posix' -- "$cur" ) )
+ return
+ ;;
+ --platform)
+ COMPREPLY=( $( compgen -W 'unix32 unix64 win32A win32W win64' \
+ -- "$cur" ) )
+ return
+ ;;
+ --xml-version)
+ COMPREPLY=( $( compgen -W '1 2' -- "$cur" ) )
+ return
+ ;;
+ esac
+
+ $split && return
+
+ if [[ $cur == -* ]]; then
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
+ [[ $COMPREPLY == *= ]] && compopt -o nospace
+ else
+ _filedir @(cpp|cxx|cc|c++|c|tpp|txx)
+ fi
+} &&
+complete -F _cppcheck cppcheck
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/crontab b/completions/crontab
index d2ee23a0..ddd0066c 100644
--- a/completions/crontab
+++ b/completions/crontab
@@ -1,11 +1,9 @@
-# crontab(1) completion
+# crontab(1) completion -*- shell-script -*-
-have crontab &&
_crontab()
{
- local cur prev
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-u)
@@ -14,47 +12,37 @@ _crontab()
;;
esac
- local i opts=" -u -l -r -e" # leading space at start is significant...
- [ "$(uname -s)" = Linux ] && opts="$opts -i"
- [ -e /etc/selinux ] && opts="$opts -s"
- for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
- case "${COMP_WORDS[i]}" in
+ local -A opts=( [-u]= [-l]= [-r]= [-e]= )
+ [[ $OSTYPE == *linux* ]] && opts[-i]=
+ [[ -d /sys/fs/selinux || -d /selinux ]] && opts[-s]=
+
+ local i
+ for (( i=0; i < ${#words[@]}-1; i++ )); do
+ [[ ${words[i]} ]] && unset opts[${words[i]}]
+ case "${words[i]}" in
-l)
- opts=${opts// -l -r -e/}
- opts=${opts// -i/}
- opts=${opts// -s/}
+ unset opts[-r] opts[-e] opts[-i] opts[-s]
;;
-e)
- opts=${opts// -l -r -e/}
- opts=${opts// -i/}
+ unset opts[-l] opts[-r] opts[-i]
;;
-r)
- opts=${opts// -l -r -e/}
+ unset opts[-l] opts[-e]
;;
-u)
- opts=${opts// -u/}
- opts=${opts// -i/}
- ;;
- -i|-s)
- opts=${opts// ${COMP_WORDS[i]}/}
+ unset opts[-i]
;;
esac
done
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '$opts' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '${!opts[@]}' -- "$cur" ) )
return 0
fi
# do filenames only if we did not have -l, -r, or -e
- [[ "${COMP_LINE}" == *\ -@(l|r|e)* ]] || _filedir
+ [[ "${words[@]}" == *\ -@(l|r|e)* ]] || _filedir
} &&
complete -F _crontab crontab
-# 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/cryptsetup b/completions/cryptsetup
index 5e88de34..2bbdc952 100644
--- a/completions/cryptsetup
+++ b/completions/cryptsetup
@@ -1,4 +1,4 @@
-# bash completion for cryptsetup
+# bash completion for cryptsetup -*- shell-script -*-
_cryptsetup_name()
{
@@ -12,28 +12,26 @@ _cryptsetup_device()
_filedir
}
-have cryptsetup &&
_cryptsetup()
{
- local cur prev arg
- COMPREPLY=()
- cur=`_get_cword`
- prev=`_get_pword`
+ local cur prev words cword split
+ _init_completion -s || return
case $prev in
--key-file|--master-key-file|--header-backup-file|-d)
_filedir
- return 0;
+ return 0
;;
esac
+ $split && return
+
+ local arg
_get_first_arg
if [ -z $arg ]; then
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--hash --cipher --verify-passphrase \
- --key-file --master-key-file --key-slot --key-size --size \
- --offset --skip --readonly --iter-time --batch-mode --timeout \
- --tries --align-payload --version' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
+ [[ $COMPREPLY == *= ]] && compopt -o nospace
else
COMPREPLY=( $( compgen -W 'create remove status resize luksFormat \
luksOpen luksClose luksSuspend luksResume luksAddKey \
@@ -41,6 +39,7 @@ _cryptsetup()
luksDump luksHeaderBackup luksHeaderRestore' -- "$cur" ) )
fi
else
+ local args
_count_args
case $arg in
create)
@@ -104,10 +103,4 @@ _cryptsetup()
} &&
complete -F _cryptsetup cryptsetup
-# 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/cups
deleted file mode 100644
index 2848c953..00000000
--- a/completions/cups
+++ /dev/null
@@ -1,21 +0,0 @@
-# bash completion for cups
-
-have cancel &&
-_cancel()
-{
- local cur
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
-
- COMPREPLY=( $( compgen -W "$( lpstat | 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/curl b/completions/curl
new file mode 100644
index 00000000..f0fc6acf
--- /dev/null
+++ b/completions/curl
@@ -0,0 +1,85 @@
+# curl(1) completion -*- shell-script -*-
+
+_curl()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ case $prev in
+ --ciphers|--connect-timeout|-C|--continue-at|--form|--form-string|\
+ --ftp-account|--ftp-alternative-to-user|-P|--ftp-port|-H|--header|-h|\
+ --help|--hostpubmd5|--keepalive-time|--krb|--limit-rate|--local-port|\
+ --mail-from|--mail-rcpt|--max-filesize|--max-redirs|-m|--max-time|\
+ --pass|--proto|--proto-redir|--proxy-user|--proxy1.0|-Q|--quote|-r|\
+ --range|-X|--request|--retry|--retry-delay|--retry-max-time|\
+ --socks5-gssapi-service|-t|--telnet-option|--tftp-blksize|-z|\
+ --time-cond|--url|-u|--user|-A|--user-agent|-V|--version|-w|--write-out)
+ return
+ ;;
+ -K|--config|-b|--cookie|-c|--cookie-jar|-D|--dump-header|--egd-file|\
+ --key|--libcurl|-o|--output|--random-file|-T|--upload-file)
+ _filedir
+ return
+ ;;
+ --cacert|-E|--cert)
+ _filedir '@(c?(e)rt|cer|pem|der)'
+ return
+ ;;
+ --capath)
+ _filedir -d
+ return
+ ;;
+ --cert-type|--key-type)
+ COMPREPLY=( $( compgen -W 'DER PEM ENG' -- "$cur" ) )
+ return
+ ;;
+ --crlfile)
+ _filedir crl
+ return
+ ;;
+ -d|--data|--data-ascii|--data-binary|--data-urlencode)
+ if [[ $cur == \@* ]]; then
+ cur=${cur:1}
+ _filedir
+ COMPREPLY=( "${COMPREPLY[@]/#/@}" )
+ fi
+ return
+ ;;
+ --engine)
+ COMPREPLY=( $( compgen -W 'list' -- "$cur" ) )
+ return
+ ;;
+ --ftp-method)
+ COMPREPLY=( $( compgen -W 'multicwd nocwd singlecwd' -- "$cur" ) )
+ return
+ ;;
+ --ftp-ssl-ccc-mode)
+ COMPREPLY=( $( compgen -W 'active passive' -- "$cur" ) )
+ return
+ ;;
+ --interface)
+ _available_interfaces -a
+ return
+ ;;
+ -x|--proxy|--socks4|--socks4a|--socks5|--socks5-hostname)
+ _known_hosts_real
+ return
+ ;;
+ --pubkey)
+ _filedir pub
+ return
+ ;;
+ --stderr)
+ COMPREPLY=( $( compgen -W '-' -- "$cur" ) )
+ _filedir
+ return
+ ;;
+ esac
+
+ if [[ $cur == -* ]]; then
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
+ fi
+} &&
+complete -F _curl curl
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/cvs b/completions/cvs
index be3b1be7..bafe1901 100644
--- a/completions/cvs
+++ b/completions/cvs
@@ -1,20 +1,17 @@
-# cvs(1) completion
+# cvs(1) completion -*- shell-script -*-
-have cvs && {
-set_prefix()
+_cvs_entries()
{
- [ -z ${prefix:-} ] || prefix=${cur%/*}/
- [ -r ${prefix:-}CVS/Entries ] || prefix=""
-}
-
-get_entries()
-{
- local IFS=$'\n'
- [ -r ${prefix:-}CVS/Entries ] && \
- entries=$(cut -d/ -f2 -s ${prefix:-}CVS/Entries)
+ local prefix=${cur%/*}/ IFS=$'\n'
+ [[ -e ${prefix:-}CVS/Entries ]] || prefix=""
+ entries=( $( cut -d/ -f2 -s ${prefix:-}CVS/Entries 2>/dev/null ) )
+ if [[ $entries ]]; then
+ entries=( "${entries[@]/#/${prefix:-}}" )
+ compopt -o filenames
+ fi
}
-get_modules()
+_cvs_modules()
{
if [ -n "$prefix" ]; then
COMPREPLY=( $( command ls -d ${cvsroot}/${prefix}/!(CVSROOT) ) )
@@ -28,14 +25,9 @@ _cvs_commands()
cvs --help-commands 2>&1 | awk '/^( *|\t)/ { print $1 }'
}
-_cvs_options()
-{
- cvs --help-options 2>&1 | awk '/^( *|\t)-/ { print $1 }'
-}
-
_cvs_command_options()
{
- cvs --help $1 2>&1 | sed -ne 's/^[[:space:]]*\(-[^[:space:]=[]*\).*/\1/p'
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" "--help $2" )' -- "$cur" ) )
}
_cvs_kflags()
@@ -48,25 +40,25 @@ _cvs_roots()
local -a cvsroots
cvsroots=( $CVSROOT )
[ -r ~/.cvspass ] && \
- cvsroots=( "${cvsroots[@]}" $( awk '{ print $2 }' ~/.cvspass ) )
- [ -r CVS/Root ] && cvsroots=( "${cvsroots[@]}" $(cat CVS/Root) )
+ cvsroots+=( $( awk '{ print $2 }' ~/.cvspass ) )
+ [ -r CVS/Root ] && mapfile -tO ${#cvsroots[@]} cvsroots < CVS/Root
COMPREPLY=( $( compgen -W '${cvsroots[@]}' -- "$cur" ) )
__ltrim_colon_completions "$cur"
}
_cvs()
{
- local cur prev count mode i cvsroot cvsroots pwd
- local -a flags miss files entries changed newremoved
+ local cur prev words cword
+ _init_completion -n : || return
- COMPREPLY=()
- _get_comp_words_by_ref -n : cur prev
+ local count mode i cvsroot cvsroots pwd
+ local -a flags miss files entries changed newremoved
count=0
- for i in "${COMP_WORDS[@]}"; do
- [ $count -eq $COMP_CWORD ] && break
+ for i in "${words[@]}"; do
+ [ $count -eq $cword ] && break
# Last parameter was the CVSROOT, now go back to mode selection
- if [[ "${COMP_WORDS[((count))]}" == "$cvsroot" && "$mode" == cvsroot ]]; then
+ if [[ "${words[((count))]}" == "$cvsroot" && "$mode" == cvsroot ]]; then
mode=""
fi
if [ -z "$mode" ]; then
@@ -77,65 +69,71 @@ _cvs()
;;
-d)
mode=cvsroot
- cvsroot=${COMP_WORDS[((count+1))]}
+ cvsroot=${words[((count+1))]}
;;
- ad|add|new)
+ add|ad|new)
mode=add
;;
- adm|admin|rcs)
+ admin|adm|rcs)
mode=admin
;;
- ann|annotate)
+ annotate|ann|blame|rannotate|rann|ra)
mode=annotate
;;
checkout|co|get)
mode=checkout
;;
- com|commit|ci)
+ commit|ci|com)
mode=commit
;;
- di|dif|diff)
+ diff|di|dif)
mode=diff
;;
- ex|exp|export)
+ export|ex|exp)
mode=export
;;
- edit|unedit)
+ edit|unedit|editors|logout|pserver|server|watch|watchers)
mode=$i
;;
- hi|his|history)
+ history|hi|his)
mode=history
;;
- im|imp|import)
+ import|im|imp)
mode=import
;;
- re|rel|release)
- mode=release
- ;;
- log|rlog)
+ log|lo|rlog|rl)
mode=log
;;
- rdiff|patch)
+ login|logon|lgn)
+ mode=login
+ ;;
+ rdiff|patch|pa)
mode=rdiff
;;
+ release|re|rel)
+ mode=release
+ ;;
remove|rm|delete)
mode=remove
;;
- rtag|rfreeze)
+ rtag|rt|rfreeze)
mode=rtag
;;
- st|stat|status)
+ status|st|stat)
mode=status
;;
- tag|freeze)
+ tag|ta|freeze)
mode=tag
;;
- up|upd|update)
+ update|up|upd)
mode=update
;;
+ version|ve|ver)
+ mode=version
+ ;;
esac
elif [[ "$i" = -* ]]; then
- flags=( "${flags[@]}" $i )
+ flags+=( $i )
fi
count=$((++count))
done
@@ -153,20 +151,26 @@ _cvs()
esac
if [[ "$cur" != -* ]]; then
- set_prefix
- if [[ $COMP_CWORD -gt 1 && -r ${prefix:-}CVS/Entries ]]; then
- get_entries
- [ -z "$cur" ] && \
- files=$( command ls -Ad !(CVS) ) || \
- files=$( command ls -d ${cur}* 2>/dev/null )
- for i in "${entries[@]}"; do
- files=( ${files[@]/#$i//} )
- done
- COMPREPLY=( $( compgen -X '*~' -W '${files[@]}' -- $cur ) )
- fi
- else
- COMPREPLY=( $( compgen -W "$( _cvs_command_options $mode )" \
+ _cvs_entries
+ [ -z "$cur" ] && files=( !(CVS) ) || \
+ files=( $( command ls -d ${cur}* 2>/dev/null ) )
+ local f
+ for i in ${!files[@]}; do
+ if [[ ${files[i]} == ?(*/)CVS ]]; then
+ unset files[i]
+ else
+ for f in "${entries[@]}"; do
+ if [[ ${files[i]} == $f && ! -d $f ]]; then
+ unset files[i]
+ break
+ fi
+ done
+ fi
+ done
+ COMPREPLY=( $( compgen -X "$_backup_glob" -W '${files[@]}' \
-- "$cur" ) )
+ else
+ _cvs_command_options "$1" $mode
fi
;;
admin)
@@ -185,18 +189,19 @@ _cvs()
esac
if [[ "$cur" = -* ]]; then
- COMPREPLY=( $( compgen -W "$( _cvs_command_options $mode )" \
- -- "$cur" ) )
+ _cvs_command_options "$1" $mode
+ else
+ _cvs_entries
+ COMPREPLY=( $( compgen -W '${entries[@]}' -- "$cur" ) )
fi
;;
annotate)
[[ "$prev" == -@(r|D) ]] && return 0
if [[ "$cur" = -* ]]; then
- COMPREPLY=( $( compgen -W "$( _cvs_command_options $mode )" \
- -- "$cur" ) )
+ _cvs_command_options "$1" $mode
else
- get_entries
+ _cvs_entries
COMPREPLY=( $( compgen -W '${entries[@]}' -- "$cur" ) )
fi
;;
@@ -221,8 +226,7 @@ _cvs()
awk '{print $1}' ) )
COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) )
else
- COMPREPLY=( $( compgen -W "$( _cvs_command_options $mode )" \
- -- "$cur" ) )
+ _cvs_command_options "$1" $mode
fi
;;
commit)
@@ -236,36 +240,48 @@ _cvs()
;;
esac
- set_prefix
-
- if [[ "$cur" != -* && -r ${prefix:-}CVS/Entries ]]; then
+ if [[ "$cur" != -* ]]; then
# if $COMP_CVS_REMOTE is not null, 'cvs commit' will
# complete on remotely checked-out files (requires
# passwordless access to the remote repository
if [ -n "${COMP_CVS_REMOTE:-}" ]; then
- # this is the least computationally intensive
- # way found so far, but other changes
- # (something other than changed/removed/new)
- # may be missing
- changed=( $( cvs -q diff --brief 2>&1 | \
- sed -ne 's/^Files [^ ]* and \([^ ]*\) differ$/\1/p' ) )
- newremoved=( $( cvs -q diff --brief 2>&1 | \
- sed -ne 's/^cvs diff: \([^ ]*\) .*, no comparison available$/\1/p' ) )
- COMPREPLY=( $( compgen -W '${changed[@]:-} \
- ${newremoved[@]:-}' -- "$cur" ) )
+ # this is the least computationally intensive way found so
+ # far, but other changes (something other than
+ # changed/removed/new) may be missing
+ changed=( $( cvs -q diff --brief 2>&1 | \
+ sed -ne 's/^Files [^ ]* and \([^ ]*\) differ$/\1/p' ) )
+ newremoved=( $( cvs -q diff --brief 2>&1 | \
+ sed -ne 's/^cvs diff: \([^ ]*\) .*, no comparison available$/\1/p' ) )
+ COMPREPLY=( $( compgen -W '${changed[@]:-} \
+ ${newremoved[@]:-}' -- "$cur" ) )
else
- COMPREPLY=( $(compgen -o default -- "$cur") )
+ _cvs_entries
+ COMPREPLY=( $( compgen -W '${entries[@]}' -- "$cur" ) )
fi
else
- COMPREPLY=( $( compgen -W "$( _cvs_command_options $mode )" \
- -- "$cur" ) )
+ _cvs_command_options "$1" $mode
fi
;;
cvsroot)
- # TODO: works poorly because of the colons and -o default,
- # could we drop -o default? works ok without it in cvsps
_cvs_roots
;;
+ diff)
+ if [[ "$cur" == -* ]]; then
+ _cvs_command_options "$1" $mode
+ [[ $COMPREPLY == *= ]] && compopt -o nospace
+ else
+ _cvs_entries
+ COMPREPLY=( $( compgen -W '${entries[@]:-}' -- "$cur" ) )
+ fi
+ ;;
+ editors|watchers)
+ if [[ "$cur" = -* ]]; then
+ _cvs_command_options "$1" $mode
+ else
+ _cvs_entries
+ COMPREPLY=( $( compgen -W '${entries[@]}' -- "$cur" ) )
+ fi
+ ;;
export)
case $prev in
-r|-D)
@@ -286,32 +302,7 @@ _cvs()
COMPREPLY=( $( cvs -d "$cvsroot" co -c | awk '{print $1}' ) )
COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) )
else
- COMPREPLY=( $( compgen -W "$( _cvs_command_options $mode )" \
- -- "$cur" ) )
- fi
- ;;
- diff)
- if [[ "$cur" == -* ]]; then
- _longopt diff
- else
- get_entries
- COMPREPLY=( $( compgen -W '${entries[@]:-}' -- "$cur" ) )
- fi
- ;;
- remove)
- if [[ "$cur" != -* ]]; then
- set_prefix
- if [[ $COMP_CWORD -gt 1 && -r ${prefix:-}CVS/Entries ]]; then
- get_entries
- # find out what files are missing
- for i in "${entries[@]}"; do
- [ ! -r "$i" ] && miss=( "${miss[@]}" $i )
- done
- COMPREPLY=( $(compgen -W '${miss[@]:-}' -- "$cur") )
- fi
- else
- COMPREPLY=( $( compgen -W "$( _cvs_command_options $mode )" \
- -- "$cur" ) )
+ _cvs_command_options "$1" $mode
fi
;;
import)
@@ -328,9 +319,9 @@ _cvs()
if [[ "$cur" != -* ]]; then
# starts with same algorithm as checkout
[ -z "$cvsroot" ] && cvsroot=$CVSROOT
- prefix=${cur%/*}
+ local prefix=${cur%/*}
if [ -r ${cvsroot}/${prefix} ]; then
- get_modules
+ _cvs_modules
COMPREPLY=( ${COMPREPLY[@]#$cvsroot} )
COMPREPLY=( ${COMPREPLY[@]#\/} )
fi
@@ -338,8 +329,19 @@ _cvs()
pwd=${pwd##*/}
COMPREPLY=( $( compgen -W '${COMPREPLY[@]} $pwd' -- $cur ) )
else
- COMPREPLY=( $( compgen -W "$( _cvs_command_options $mode )" \
- -- "$cur" ) )
+ _cvs_command_options "$1" $mode
+ fi
+ ;;
+ remove)
+ if [[ "$cur" != -* ]]; then
+ _cvs_entries
+ # find out what files are missing
+ for i in "${entries[@]}"; do
+ [ ! -r "$i" ] && miss+=( $i )
+ done
+ COMPREPLY=( $( compgen -W '${miss[@]:-}' -- "$cur" ) )
+ else
+ _cvs_command_options "$1" $mode
fi
;;
update)
@@ -354,8 +356,10 @@ _cvs()
esac
if [[ "$cur" = -* ]]; then
- COMPREPLY=( $( compgen -W "$( _cvs_command_options $mode )" \
- -- "$cur" ) )
+ _cvs_command_options "$1" $mode
+ else
+ _cvs_entries
+ COMPREPLY=( $( compgen -W '${entries[@]}' -- "$cur" ) )
fi
;;
"")
@@ -368,25 +372,19 @@ _cvs()
return 0
;;
-z)
- COMPREPLY=( $( compgen -W '1 2 3 4 5 6 7 8 9' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '{1..9}' -- "$cur" ) )
return 0
;;
esac
- COMPREPLY=( $( compgen -W '$( _cvs_commands ) $( _cvs_options ) \
+ COMPREPLY=( $( compgen -W '$( _cvs_commands ) \
+ $( _parse_help "$1" --help-options ) \
--help --help-commands --help-options --version' -- "$cur" ) )
;;
esac
return 0
-}
-complete -F _cvs -o default cvs
-}
+} &&
+complete -F _cvs cvs
-# 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/cvsps b/completions/cvsps
index 257437bc..8b986f57 100644
--- a/completions/cvsps
+++ b/completions/cvsps
@@ -1,11 +1,9 @@
-# bash completion for cvsps
+# bash completion for cvsps -*- shell-script -*-
-have cvsps &&
_cvsps()
{
- COMPREPLY=()
- local cur prev
- _get_comp_words_by_ref -n : cur prev
+ local cur prev words cword
+ _init_completion -n : || return
case $prev in
-h|-z|-f|-d|-l|--diff-opts|--debuglvl)
@@ -40,30 +38,21 @@ _cvsps()
return 0
;;
-Z)
- COMPREPLY=( $( compgen -W '1 2 3 4 5 6 7 8 9' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '{1..9}' -- "$cur" ) )
return 0
;;
--root)
- type _cvs_roots &>/dev/null && _cvs_roots
+ _xfunc cvs _cvs_roots
return 0
;;
esac
if [[ "$cur" == -* ]] ; then
- COMPREPLY=( $( compgen -W '-h -x -u -z -g -s -a -f -d -b -l -r -p -v \
- -t --norc --summary-first --test-log --diff-opts --bkcvs --no-rlog \
- --cvs-direct --no-cvs-direct --debuglvl -Z --root -q -A' \
- -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" -h )' -- "$cur" ) )
else
- type _cvs_roots &>/dev/null && _cvs_roots
+ _xfunc cvs _cvs_roots
fi
} &&
complete -F _cvsps cvsps
-# 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/dd b/completions/dd
index 7b9b3ac7..53132dcc 100644
--- a/completions/dd
+++ b/completions/dd
@@ -1,12 +1,9 @@
-# bash completion for dd
+# bash completion for dd -*- shell-script -*-
-have dd &&
_dd()
{
- local cur
-
- COMPREPLY=()
- _get_comp_words_by_ref -n = cur
+ local cur prev words cword
+ _init_completion -n = || return
case $cur in
if=*|of=*)
@@ -24,16 +21,10 @@ _dd()
_expand || return 0
- COMPREPLY=( $( compgen -W '--help --version' -- "$cur" ) \
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) \
$( compgen -W 'bs cbs conv count ibs if obs of seek skip' \
-S '=' -- "$cur" ) )
} &&
complete -F _dd -o nospace dd
-# 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/dhclient b/completions/dhclient
index 3d7e1e1a..10bbbe66 100644
--- a/completions/dhclient
+++ b/completions/dhclient
@@ -1,11 +1,9 @@
-# bash completion for dhclient
+# bash completion for dhclient -*- shell-script -*-
-have dhclient && _dhclient()
+_dhclient()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-cf|-lf|-pf|-sf)
@@ -27,10 +25,4 @@ have dhclient && _dhclient()
} &&
complete -F _dhclient dhclient
-# 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/dict b/completions/dict
index 4cfdf98f..a31816d3 100644
--- a/completions/dict
+++ b/completions/dict
@@ -1,6 +1,5 @@
-# dict(1) completion
+# dict(1) completion -*- shell-script -*-
-{ have dict || have rdict; } && {
_dictdata()
{
dict $host $port $1 2>/dev/null | sed -ne \
@@ -9,26 +8,25 @@ _dictdata()
_dict()
{
- local cur prev host port db dictfile
+ local cur prev words cword
+ _init_completion || return
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
- dictfile=/usr/share/dict/words
+ local host port db i
- for (( i=1; i < COMP_CWORD; i++ )); do
- case ${COMP_WORDS[i]} in
+ for (( i=1; i < cword; i++ )); do
+ case ${words[i]} in
-h|--host)
- host=${COMP_WORDS[i+1]}
+ host=${words[i+1]}
[ -n "$host" ] && host="-h $host"
i=$((++i))
;;
-p|--port)
- port=${COMP_WORDS[i+1]}
+ port=${words[i+1]}
[ -n "$port" ] && port="-p $port"
i=$((++i))
;;
-d|--database)
- db=${COMP_WORDS[i+1]}
+ db=${words[i+1]}
[ -n "$db" ] && host="-d $db"
i=$((++i))
;;
@@ -38,14 +36,7 @@ _dict()
done
if [[ "$cur" = -* ]]; then
- COMPREPLY=( $( compgen -W '--host --port --database \
- --match --strategy --config \
- --nocorrect --dbs --strats \
- --serverhelp --info --serverinfo \
- --noauth --user --key --version \
- --license --help --verbose --raw \
- --pager --debug --html --pipesize --client' \
- -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
return 0
fi
@@ -62,16 +53,10 @@ _dict()
;;
esac
+ local dictfile=/usr/share/dict/words
[ -r $dictfile ] && \
COMPREPLY=( $( compgen -W '$( cat $dictfile )' -- "$cur" ) )
-}
+} &&
complete -F _dict -o default dict rdict
-}
-# 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/dmesg b/completions/dmesg
new file mode 100644
index 00000000..5fb28e45
--- /dev/null
+++ b/completions/dmesg
@@ -0,0 +1,27 @@
+# dmesg(1) completion -*- shell-script -*-
+
+_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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/dot b/completions/dot
new file mode 100644
index 00000000..ef946e4b
--- /dev/null
+++ b/completions/dot
@@ -0,0 +1,45 @@
+# dot(1) completion -*- shell-script -*-
+
+_dot()
+{
+ local cur prev words cword
+ _init_completion -n := || return
+
+ [[ $prev == -@(V|\?) ]] && return
+
+ case $cur in
+ -G*|-N*|-E*|-l?*|-q?*|-s?*|-Ln*|-LU*|-LC*|-LT*)
+ return
+ ;;
+ -T*)
+ local langs=( $( "$1" -TNON_EXISTENT 2>&1 | \
+ sed -ne 's/.*one of://p' ) )
+ COMPREPLY=( $( compgen -P -T -W '${langs[@]}' -- "${cur#-T}" ) )
+ return
+ ;;
+ -K*)
+ local layouts=( $( "$1" -KNON_EXISTENT 2>&1 | \
+ sed -ne 's/.*one of://p' ) )
+ COMPREPLY=( $( compgen -P -K -W '${layouts[@]}' -- "${cur#-K}" ) )
+ return
+ ;;
+ -o*)
+ cur=${cur#-o}
+ _filedir
+ COMPREPLY=( $( compgen -P -o -W '${COMPREPLY[@]}' -- "$cur" ) )
+ return
+ ;;
+ esac
+
+ if [[ $cur == -* ]]; then
+ COMPREPLY=( $( compgen -W '-V -v -G -N -E -T -K -l -o -O -P -q -s -y -n
+ -n1 -n2 -x -Lg -LO -Ln -LU -LC -LT -m -c -?' -- "$cur" ) )
+ [[ $COMPREPLY == -@(G|N|E|T|K|o|L[nUCT]) ]] && compopt -o nospace
+ return
+ fi
+
+ _filedir dot
+} &&
+complete -F _dot dot
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/dpkg b/completions/dpkg
index 0556f3d1..247171c5 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 && {
+# This function is required by _dpkg and _dpkg-reconfigure -*- shell-script -*-
+
+_have grep-status && {
_comp_dpkg_installed_packages()
{
grep-status -P -e "^$1" -a -FStatus 'install ok installed' -n -s Package
@@ -20,21 +20,18 @@ _comp_dpkg_installed_packages()
#
_dpkg()
{
- local cur prev i
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
- i=$COMP_CWORD
+ local cur prev words cword split
+ _init_completion -s || return
_expand || return 0
- _split_longopt
+ local i=$cword
# find the last option flag
if [[ $cur != -* ]]; then
- while [[ $prev != -* && $i != 1 ]]; do
+ while [[ $prev != -* && $i -ne 1 ]]; do
i=$((i-1))
- prev=${COMP_WORDS[i-1]}
+ prev=${words[i-1]}
done
fi
@@ -61,49 +58,23 @@ _dpkg()
COMPREPLY=( $( _comp_dpkg_installed_packages "$cur" ) )
return 0
;;
- *)
- COMPREPLY=( $( compgen -W '-i --install --unpack -A --record-avail \
- --configure -r --remove -P --purge --get-selections \
- --set-selections --update-avail --merge-avail \
- --clear-avail --command-fd --forget-old-unavail -s \
- --status -p --print-avail -L --listfiles -l --list \
- -S --search -C --audit --print-architecture \
- --print-gnu-build-architecture \
- --print-installation-architecture \
- --compare-versions --help --version --force-help \
- --force-all --force-auto-select --force-downgrade \
- --force-configure-any --force-hold --force-bad-path \
- --force-not-root --force-overwrite \
- --force-overwrite-diverted --force-bad-verify \
- --force-depends-version --force-depends \
- --force-confnew --force-confold --force-confdef \
- --force-confmiss --force-conflicts --force-architecture\
- --force-overwrite-dir --force-remove-reinstreq \
- --force-remove-essential -Dh \
- --debug=help --licence --admindir --root --instdir \
- -O --selected-only -E --skip-same-version \
- -G --refuse-downgrade -B --auto-deconfigure \
- --no-debsig --no-act -D --debug --status-fd \
- -b --build -I --info -f --field -c --contents \
- -x --extract -X --vextract --fsys-tarfile -e --control \
- --ignore-depends --abort-after' -- "$cur" ) )
- ;;
esac
+ $split && return
-}
-complete -F _dpkg dpkg dpkg-deb
-}
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
+ [[ $COMPREPLY == *= ]] && compopt -o nospace
+} &&
+complete -F _dpkg dpkg dpkg-deb dpkg-query
# Debian GNU dpkg-reconfigure(8) completion
#
-have dpkg-reconfigure &&
_dpkg_reconfigure()
{
- local cur prev opt
+ local cur prev words cword
+ _init_completion || return
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local opt
case $prev in
-f|--frontend)
@@ -128,117 +99,4 @@ _dpkg_reconfigure()
} &&
complete -F _dpkg_reconfigure -o default dpkg-reconfigure
-# Debian dpkg-source completion
-#
-have dpkg-source &&
-_dpkg_source()
-{
- local cur prev 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"
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- action="options"
- for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
- if [[ ${COMP_WORDS[$i]} == "-x" ]]; then
- action=unpack
- elif [[ ${COMP_WORDS[$i]} == "-b" ]]; then
- action=pack
- elif [[ ${COMP_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/dpkg-source b/completions/dpkg-source
new file mode 100644
index 00000000..6cd9bde3
--- /dev/null
+++ b/completions/dpkg-source
@@ -0,0 +1,107 @@
+# Debian dpkg-source completion -*- shell-script -*-
+
+_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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/dselect b/completions/dselect
index 3042a8d0..9da1e927 100644
--- a/completions/dselect
+++ b/completions/dselect
@@ -1,12 +1,9 @@
-# Debian Linux dselect(8) completion.
+# Debian Linux dselect(8) completion -*- shell-script -*-
-have dselect &&
_dselect()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
--admindir)
@@ -31,10 +28,4 @@ _dselect()
} &&
complete -F _dselect dselect
-# 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/dsniff b/completions/dsniff
index 1d3b303b..94b34ef6 100644
--- a/completions/dsniff
+++ b/completions/dsniff
@@ -1,66 +1,9 @@
-# dsniff util completion
+# dsniff completion -*- shell-script -*-
-have arpspoof &&
-_arpspoof()
-{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- case $prev in
- -i)
- _available_interfaces
- return 0
- ;;
- -t)
- _known_hosts_real "$cur"
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-i -t' -- "$cur" ) )
- else
- _known_hosts_real "$cur"
- fi
-
-} &&
-complete -F _arpspoof arpspoof
-
-have dnsspoof &&
-_dnsspoof()
-{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- case $prev in
- -i)
- _interfaces
- return 0
- ;;
- -f)
- _filedir
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-i -f' -- "$cur" ) )
- fi
-
-} &&
-complete -F _dnsspoof dnsspoof
-
-have dsniff &&
_dsniff()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-r|-w|-f)
@@ -74,183 +17,10 @@ _dsniff()
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-c -d -m -n -i -s -f -t -r -w' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_usage "$1" ) -r -w' -- "$cur" ) )
fi
} &&
complete -F _dsniff dsniff
-have filesnarf || have mailsnarf || have msgsnarf &&
-_snarf()
-{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- case $prev in
- -i)
- _interfaces
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-i -v' -- "$cur" ) )
- fi
-
-} &&
-complete -F _snarf filesnarf mailsnarf msgsnarf
-
-have macof &&
-_macof()
-{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- case $prev in
- -i)
- _interfaces
- return 0
- ;;
- esac
-
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-i -s -d -e -x -y -n' -- "$cur" ) )
- fi
-
-} &&
-complete -F _macof macof
-
-have sshmitm &&
-_sshmitm()
-{
- local cur
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-d -I -p' -- "$cur" ) )
- else
- _known_hosts_real "$cur"
- fi
-
-} &&
-complete -F _sshmitm sshmitm
-
-have sshow &&
-_sshow()
-{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- case $prev in
- -i)
- _interfaces
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-d -i' -- "$cur" ) )
- fi
-
-} &&
-complete -F _sshow sshow
-
-have tcpkill &&
-_tcpkill()
-{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- 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
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- case $prev in
- -i)
- _interfaces
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-A -I -M -i' -- "$cur" ) )
- fi
-
-} &&
-complete -F _tcpnice tcpnice
-
-have urlsnarf &&
-_urlsnarf()
-{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- case $prev in
- -i)
- _interfaces
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-n -i -v' -- "$cur" ) )
- fi
-
-} &&
-complete -F _urlsnarf urlsnarf
-
-have webmitm &&
-_webmitm()
-{
- local cur
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-d' -- "$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/dumpdb b/completions/dumpdb
new file mode 100644
index 00000000..461401c3
--- /dev/null
+++ b/completions/dumpdb
@@ -0,0 +1,18 @@
+# mailman dumpdb completion -*- shell-script -*-
+
+_dumpdb()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--marshal --pickle --noprint \
+ --help' -- "$cur" ) )
+ else
+ _filedir
+ fi
+
+} &&
+complete -F _dumpdb dumpdb
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/dumpe2fs b/completions/dumpe2fs
new file mode 100644
index 00000000..127b46fc
--- /dev/null
+++ b/completions/dumpe2fs
@@ -0,0 +1,28 @@
+# dumpe2fs(8) completion -*- shell-script -*-
+
+_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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/e2freefrag b/completions/e2freefrag
new file mode 100644
index 00000000..6a971156
--- /dev/null
+++ b/completions/e2freefrag
@@ -0,0 +1,24 @@
+# e2freefrag(8) completion -*- shell-script -*-
+
+_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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/e2fsprogs b/completions/e2fsprogs
deleted file mode 100644
index 50ce7885..00000000
--- a/completions/e2fsprogs
+++ /dev/null
@@ -1,180 +0,0 @@
-# bash completion for e2fsprogs
-
-have badblocks &&
-_badblocks()
-{
- COMPREPLY=()
- local cur prev
- _get_comp_words_by_ref cur prev
-
- case $prev in
- -b|-c|-e|-d|-p|-t)
- return 0
- ;;
- -i|-o)
- _filedir
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- # -w (dangerous) and -X (internal use) not here on purpose
- COMPREPLY=( $( compgen -W '-b -c -e -d -f -i -n -o -p -s -t -v' \
- -- "$cur" ) )
- return 0
- fi
-
- cur=${cur:=/dev/}
- _filedir
-} &&
-complete -F _badblocks badblocks
-
-
-have dumpe2fs &&
-_dumpe2fs()
-{
- COMPREPLY=()
- local cur prev
- _get_comp_words_by_ref cur prev
-
- case $prev in
- -o|-V)
- return 0
- ;;
- -i)
- _filedir
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-b -o -f -h -i -x -V' -- "$cur" ) )
- return 0
- fi
-
- cur=${cur:=/dev/}
- _filedir
-} &&
-complete -F _dumpe2fs dumpe2fs
-
-
-have e2freefrag &&
-_e2freefrag()
-{
- COMPREPLY=()
- local cur prev
- _get_comp_words_by_ref cur prev
-
- case $prev in
- -c|-h)
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-c -h' -- "$cur" ) )
- return 0
- fi
-
- cur=${cur:=/dev/}
- _filedir
-} &&
-complete -F _e2freefrag e2freefrag
-
-
-have e2label &&
-_e2label()
-{
- COMPREPLY=()
- local cur cword
- _get_comp_words_by_ref cur cword
-
- if [ $cword -eq 1 ]; then
- cur=${cur:=/dev/}
- _filedir
- fi
-} &&
-complete -F _e2label e2label
-
-
-have filefrag &&
-_filefrag()
-{
- COMPREPLY=()
- local cur
- _get_comp_words_by_ref cur
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-B -b -s -v -x' -- "$cur" ) )
- return 0
- fi
-
- _filedir
-} &&
-complete -F _filefrag filefrag
-
-
-have tune2fs &&
-_tune2fs()
-{
- COMPREPLY=()
- local cur prev
- _get_comp_words_by_ref cur prev
-
- case $prev in
- -c|-C|-E|-i|-J|-L|-m|-r|-T)
- return 0
- ;;
- -e)
- COMPREPLY=( $( compgen -W 'continue remount-ro panic' -- "$cur" ) )
- return 0
- ;;
- -g)
- _gids
- COMPREPLY=( $( compgen -g -W '${COMPREPLY[@]}' -- "$cur" ) )
- return 0
- ;;
- -M)
- _filedir -d
- ;;
- -o)
- local -a opts=(^debug ^bsdgroups ^user_xattr ^acl ^uid16
- ^journal_data ^journal_data_ordered ^journal_data_writeback)
- COMPREPLY=( $( compgen -W '${opts[@]} ${opts[@]#^}' -- "$cur" ) )
- return 0
- ;;
- -O)
- local -a opts=(^dir_index ^dir_nlink ^extent ^extra_isize ^filetype
- ^flex_bg ^has_journal ^huge_file ^large_file ^resize_inode
- ^sparse_super ^uninit_bg)
- COMPREPLY=( $( compgen -W '${opts[@]} ${opts[@]#^}' -- "$cur" ) )
- return 0
- ;;
- -u)
- _uids
- COMPREPLY=( $( compgen -u -W '${COMPREPLY[@]}' -- "$cur" ) )
- return 0
- ;;
- -U)
- COMPREPLY=( $( compgen -W 'clear random time' -- "$cur" ) )
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-c -C -e -E -f -g -i -j -J -l -L -m -M -o
- -O -r -T -u -U' -- "$cur" ) )
- fi
-
- cur=${cur:=/dev/}
- _filedir
-} &&
-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..86008d9f
--- /dev/null
+++ b/completions/e2label
@@ -0,0 +1,15 @@
+# e2label(8) completion -*- shell-script -*-
+
+_e2label()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ if [ $cword -eq 1 ]; then
+ cur=${cur:=/dev/}
+ _filedir
+ fi
+} &&
+complete -F _e2label e2label
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/ether-wake b/completions/ether-wake
new file mode 100644
index 00000000..2142d74e
--- /dev/null
+++ b/completions/ether-wake
@@ -0,0 +1,27 @@
+# ether-wake(8) completion -*- shell-script -*-
+
+_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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/evince b/completions/evince
new file mode 100644
index 00000000..9c7d0c3a
--- /dev/null
+++ b/completions/evince
@@ -0,0 +1,33 @@
+# evince(1) completion -*- shell-script -*-
+
+_evince()
+{
+ local cur prev words cword split
+ _init_completion -s || return
+
+ case $prev in
+ --help*|-h|--sm-client-id|--class|--name|--screen|--gdk-debug|\
+ --gdk-no-debug|--gtk-module|--gtk-debug|--gtk-no-debug|\
+ -p|--page-label|-i|--page-index|-l|--find|--display)
+ return
+ ;;
+ --sm-client-state-file)
+ _filedir
+ return
+ ;;
+ esac
+
+ $split && return 0
+
+ if [[ $cur == -* ]]; then
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" --help-all )' \
+ -- "$cur" ) )
+ [[ $COMPREPLY == *= ]] && compopt -o nospace
+ return
+ fi
+
+ _filedir '@(@(?(e)ps|?(E)PS|[pf]df|[PF]DF|dvi|DVI)?(.gz|.GZ|.bz2|.BZ2)|cb[rz]|djv?(u)|gif|jp?(e)g|miff|tif?(f)|pn[gm]|p[bgp]m|bmp|xpm|ico|xwd|tga|pcx)'
+} &&
+complete -F _evince evince
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/explodepkg b/completions/explodepkg
new file mode 100644
index 00000000..b6914750
--- /dev/null
+++ b/completions/explodepkg
@@ -0,0 +1,5 @@
+# Slackware Linux explodepkg completion -*- shell-script -*-
+
+complete -o plusdirs -f -X '!*.t[bglx]z' explodepkg
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/export b/completions/export
new file mode 100644
index 00000000..557c52cb
--- /dev/null
+++ b/completions/export
@@ -0,0 +1,25 @@
+# bash export completion -*- shell-script -*-
+
+_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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/faillog b/completions/faillog
new file mode 100644
index 00000000..77ca9c72
--- /dev/null
+++ b/completions/faillog
@@ -0,0 +1,28 @@
+# faillog(8) completion -*- shell-script -*-
+
+_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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/fbgs b/completions/fbgs
new file mode 100644
index 00000000..672de7cd
--- /dev/null
+++ b/completions/fbgs
@@ -0,0 +1,39 @@
+# bash completion for fbgs(1) -*- shell-script -*-
+
+_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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/fbi b/completions/fbi
new file mode 100644
index 00000000..f8f7a825
--- /dev/null
+++ b/completions/fbi
@@ -0,0 +1,54 @@
+# bash completion for fbi(1) -*- shell-script -*-
+
+_fbi()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ case "$prev" in
+ -l|--list)
+ _filedir
+ return
+ ;;
+ -r|--resolution)
+ COMPREPLY+=( $(compgen -W '{1..5}') )
+ return
+ ;;
+ -f|--font)
+ local IFS=$'\n'
+ COMPREPLY=( $( compgen -W '$( fc-list 2>/dev/null )' -- "$cur" ) )
+ return
+ ;;
+ -m|--mode)
+ COMPREPLY=( $( compgen -W '$( sed \
+ -n "/^mode/{s/^mode \{1,\}\"\([^\"]\{1,\}\)\"/\1/g;p}" \
+ /etc/fb.modes 2> /dev/null )' -- "$cur" ) )
+ return
+ ;;
+ -d|--device)
+ COMPREPLY=( $( compgen -f -d -- "${cur:-/dev/}" ) )
+ return
+ ;;
+ --cachemem|--blend|-T|--vt|-s|--scroll|-t|--timeout|-g|--gamma)
+ # argument required but no completions available
+ return
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $(compgen -W '--help --version --store --list --text \
+ --autozoom --autoup --noautoup --autodown --noautodown --fitwidth \
+ --nofitwidth --verbose --noverbose --random --norandom --comments \
+ --nocomments --edit --noedit --backup --nobackup --preserve \
+ --nopreserve --readahead --noreadahead --cachemem --blend --vt \
+ --scroll --timeout --once --noonce --resolution --gamma --font \
+ --device --mode' -- "$cur") )
+ [[ $COMPREPLY ]] && return
+ fi
+
+ # FIXME: It is hard to determine correct supported extensions.
+ # fbi can handle any format that imagemagick can plus some others
+ _filedir 'bmp|gif|jp?(e)g|pcd|png|p[pgb]m|tif?(f)|webp|xpm|xwd|?(e)ps|pdf|dvi|txt|svg?(z)'
+} && complete -F _fbi fbi
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/feh b/completions/feh
new file mode 100644
index 00000000..e39b5c31
--- /dev/null
+++ b/completions/feh
@@ -0,0 +1,119 @@
+# bash completion for feh(1) -*- shell-script -*-
+
+_feh()
+{
+ local cur prev words cword split
+ _init_completion -s || return
+
+ case "$prev" in
+ -B|--image-bg)
+ COMPREPLY=( $( compgen -W 'default white black' -- "$cur" ) )
+ return
+ ;;
+ --index-dim|--index-name|--index-size)
+ COMPREPLY=( $( compgen -W '0 1' -- "$cur" ) )
+ return
+ ;;
+ -f|--filelist|-o|--output|-O|--output-only|-\||--start-at)
+ _filedir
+ return
+ ;;
+ -K|--caption-path|-C|--fontpath|-j|--output-dir)
+ _filedir -d
+ return
+ ;;
+ -e|--font|-M|--menu-font|-@|--title-font)
+ # expect string like "dejavu.ttf/12"
+ if [[ "$cur" == */* ]]; then # expect integer value
+ COMPREPLY=( $(compgen -P "$cur" -W '{0..9}') )
+ compopt -o nospace
+ return
+ fi
+ local font_path
+ # font_path="$(imlib2-config --prefix 2> /dev/null)/share/imlib2/data/fonts"
+ # COMPREPLY=( $( cd "$font_path" 2> /dev/null; compgen -f \
+ # -X "!*.@([tT][tT][fF])" -S / -- "$cur" ) )
+ for (( i=${#words[@]}-1; i>0; i-- )); do
+ if [[ ${words[i]} == -@(C|-fontpath) ]]; then
+ font_path="${words[i+1]}"
+ COMPREPLY+=( $( cd "$font_path" 2> /dev/null; compgen -f \
+ -X "!*.@([tT][tT][fF])" -S / -- "$cur" ) )
+ fi
+ done
+ compopt -o nospace
+ return
+ ;;
+ -T|--theme)
+ local conf_path=~/.config/feh/themes
+ local theme_name theme_opts
+ [ -r "$conf_path" ] || return
+ while read theme_name theme_opts; do
+ if [[ "$theme_name" == '#'* || "$theme_name" == "" ]]; then
+ continue
+ fi
+ COMPREPLY+=( $( compgen -W "$theme_name" -- "$cur" ) )
+ done < "$conf_path"
+ return
+ ;;
+ -S|--sort)
+ COMPREPLY=( $( compgen -W 'name filename width height pixels size
+ format' -- "$cur" ) )
+ return
+ ;;
+ -R|--reload|-H|--limit-height|-W|--limit-width|-E|--thumb-height|\
+ -y|--thumb-width|-J|--thumb-redraw)
+ # expect integer value
+ COMPREPLY+=( $(compgen -W '{0..9}') )
+ compopt -o nospace
+ return
+ ;;
+ --zoom)
+ # expect integer value or "max", "fill"
+ COMPREPLY=( $(compgen -W 'max fill' -- "$cur") )
+ if [[ ! $cur || ! $COMPREPLY ]]; then
+ COMPREPLY+=( $(compgen -W '{0..9}') )
+ compopt -o nospace
+ fi
+ return
+ ;;
+ -0|--reload-button|-1|--pan-button|-2|--zoom-button|-3|--menu-button|\
+ -4|--prev-button|-5|--next-button|-8|--rotate-button|-9|--blur-button)
+ COMPREPLY=( $( compgen -W '{0..9}' -- "$cur" ) )
+ return
+ ;;
+ -a|--alpha)
+ COMPREPLY=( $( compgen -W '{0..255}' -- "$cur" ) )
+ return
+ ;;
+ -b|--bg)
+ _filedir
+ COMPREPLY+=( $( compgen -W 'trans' -- "$cur" ) )
+ return
+ ;;
+ -g|--geometry)
+ # expect string like 640x480
+ if [[ $cur && "$cur" != *x* ]]; then
+ COMPREPLY=( x )
+ fi
+ COMPREPLY+=( $(compgen -W "{0..9}") )
+ compopt -o nospace
+ return
+ ;;
+ -L|--customlist|--info|-D|--slideshow-delay|-~|--thumb-title|-^|--title)
+ # argument required but no completions available
+ return
+ ;;
+ esac
+
+ $split && return
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" --help )' -- "$cur" ) )
+ [[ $COMPREPLY == *= ]] && compopt -o nospace
+ [[ $COMPREPLY ]] && return
+ fi
+
+ _filedir 'xpm|tif?(f)|png|p[npgba]m|iff|?(i)lbm|jp?(e)g|jfi?(f)|gif|bmp|arg?(b)|tga|xcf|ani|ico'
+} && complete -F _feh feh
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/file b/completions/file
new file mode 100644
index 00000000..172fd5e0
--- /dev/null
+++ b/completions/file
@@ -0,0 +1,32 @@
+# file(1) completion -*- shell-script -*-
+
+_file()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ case $prev in
+ --help|-v|--version|-F|--separator)
+ return
+ ;;
+ -m|--magic-file|-f|--files-from)
+ _filedir
+ return
+ ;;
+ -e|--exclude)
+ COMPREPLY=( $( compgen -W 'apptype ascii cdf compress elf encoding
+ soft tar text tokens troff' -- "$cur" ) )
+ return
+ ;;
+ esac
+
+ if [[ $cur == -* ]]; then
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
+ return
+ fi
+
+ _filedir
+} &&
+complete -F _file file
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/filefrag b/completions/filefrag
new file mode 100644
index 00000000..ee9d0d81
--- /dev/null
+++ b/completions/filefrag
@@ -0,0 +1,17 @@
+# filefrag(8) completion -*- shell-script -*-
+
+_filefrag()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) )
+ return 0
+ fi
+
+ _filedir
+} &&
+complete -F _filefrag filefrag
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/filesnarf b/completions/filesnarf
new file mode 100644
index 00000000..07c4c741
--- /dev/null
+++ b/completions/filesnarf
@@ -0,0 +1,22 @@
+# filesnarf etc completion -*- shell-script -*-
+
+_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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/findutils b/completions/find
index b8aaa57a..2afb6fc9 100644
--- a/completions/findutils
+++ b/completions/find
@@ -1,18 +1,15 @@
-# bash completion for GNU find. This makes heavy use of ksh style extended
-# globs and contains Linux specific code for completing the parameter
-# to the -fstype option.
+# bash completion for GNU find -*- shell-script -*-
+# This makes heavy use of ksh style extended globs and contains Linux specific
+# code for completing the parameter to the -fstype option.
-have find &&
_find()
{
- local cur prev i exprfound onlyonce
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-maxdepth|-mindepth)
- COMPREPLY=( $( compgen -W '0 1 2 3 4 5 6 7 8 9' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '{0..9}' -- "$cur" ) )
return 0
;;
-newer|-anewer|-cnewer|-fls|-fprint|-fprint0|-fprintf|-name|-iname|\
@@ -22,10 +19,8 @@ _find()
;;
-fstype)
_fstypes
- if [[ "$( uname -s )" == *BSD ]] ; then
- COMPREPLY=( "${COMPREPLY[@]}" \
- $( compgen -W 'local rdonly' -- "$cur" ) )
- fi
+ [[ $OSTYPE == *bsd* ]] && \
+ COMPREPLY+=( $( compgen -W 'local rdonly' -- "$cur" ) )
return 0
;;
-gid)
@@ -49,8 +44,8 @@ _find()
return 0
;;
-exec|-execdir|-ok|-okdir)
- COMP_WORDS=(COMP_WORDS[0] "$cur")
- COMP_CWORD=1
+ words=(words[0] "$cur")
+ cword=1
_command
return 0
;;
@@ -68,13 +63,15 @@ _find()
esac
_expand || return 0
- # set exprfound to 1 if there is already an expression present
- for i in ${COMP_WORDS[@]}; do
- [[ "$i" = [-\(\),\!]* ]] && exprfound=1 && break
+
+ local i exprfound=false
+ # set exprfound to true if there is already an expression present
+ for i in ${words[@]}; do
+ [[ "$i" = [-\(\),\!]* ]] && exprfound=true && break
done
# handle case where first parameter is not a dash option
- if [[ "$exprfound" != 1 && "$cur" != [-\(\),\!]* ]]; then
+ if ! $exprfound && [[ "$cur" != [-\(\),\!]* ]]; then
_filedir -d
return 0
fi
@@ -92,26 +89,23 @@ _find()
-delete -exec -execdir -fls -fprint -fprint0 -fprintf -ls -ok -okdir \
-print -print0 -printf -prune -quit' -- "$cur" ) )
- # this removes any options from the list of completions that have
- # already been specified somewhere on the command line, as long as
- # these options can only be used once (in a word, "options", in
- # opposition to "tests" and "actions", as in the find(1) manpage).
- onlyonce=' -daystart -depth -follow -help -ignore_readdir_race -maxdepth \
- -mindepth -mount -noignore_readdir_race -noleaf -nowarn -regextype \
- -version -warn -xdev '
- COMPREPLY=( $( \
- (while read -d ' ' i; do
- [[ -z "$i" || "${onlyonce/ ${i%% *} / }" == "$onlyonce" ]] &&
- continue
- # flatten array with spaces on either side,
- # otherwise we cannot grep on word boundaries of
- # first and last word
- COMPREPLY=" ${COMPREPLY[@]} "
- # remove word from list of completions
- COMPREPLY=( ${COMPREPLY/ ${i%% *} / } )
+ if [[ ${#COMPREPLY[@]} -ne 0 ]]; then
+ # this removes any options from the list of completions that have
+ # already been specified somewhere on the command line, as long as
+ # these options can only be used once (in a word, "options", in
+ # opposition to "tests" and "actions", as in the find(1) manpage).
+ local -A onlyonce=( [-daystart]=1 [-depth]=1 [-follow]=1 [-help]=1
+ [-ignore_readdir_race]=1 [-maxdepth]=1 [-mindepth]=1 [-mount]=1
+ [-noignore_readdir_race]=1 [-noleaf]=1 [-nowarn]=1 [-regextype]=1
+ [-version]=1 [-warn]=1 [-xdev]=1 )
+ local j
+ for i in "${words[@]}"; do
+ [[ $i && ${onlyonce[$i]} ]] || continue
+ for j in ${!COMPREPLY[@]}; do
+ [[ ${COMPREPLY[j]} == $i ]] && unset COMPREPLY[j]
done
- printf '%s ' "${COMPREPLY[@]}") <<<"${COMP_WORDS[@]}"
- ) )
+ done
+ fi
_filedir
@@ -119,10 +113,4 @@ _find()
} &&
complete -F _find find
-# 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/find_member b/completions/find_member
new file mode 100644
index 00000000..d306f1be
--- /dev/null
+++ b/completions/find_member
@@ -0,0 +1,25 @@
+# mailman find_member completion -*- shell-script -*-
+
+_find_member()
+{
+ local cur prev words cword split
+ _init_completion -s || return
+
+ case $prev in
+ -l|-x|--listname|--exclude)
+ _xfunc list_lists _mailman_lists
+ return 0
+ ;;
+ esac
+
+ $split && return 0
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--listname --exclude --owners \
+ --help' -- "$cur" ) )
+ fi
+
+} &&
+complete -F _find_member find_member
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/freeciv b/completions/freeciv
deleted file mode 100644
index 602ad76a..00000000
--- a/completions/freeciv
+++ /dev/null
@@ -1,65 +0,0 @@
-# freeciv completions
-
-have civserver &&
-_civserver()
-{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- case $prev in
- -f|-g|-l|-r|--file|--log|--gamelog|--read)
- _filedir
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-d -f -g -h -i -l -m -M -p -q -r -v\
- --debug --file --gamelog --help --info --log --meta \
- --Metaserver --port --quitidle --read --version' -- "$cur" ) )
- fi
-
-} &&
-complete -F _civserver civserver
-
-have civclient &&
-_civclient()
-{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- case $prev in
- -l|-S|-t|--log|--Sound|--tiles)
- _filedir
- return 0
- ;;
- -P|--Plugin)
- COMPREPLY=( $( compgen -W 'none esd sdl' -- "$cur" ) )
- return 0
- ;;
- -s|--server)
- _known_hosts_real "$cur"
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-a -d -h -l -m -n -p -P -s -S -t -v\
- --autoconnect --debug --help --log --meta --name --port \
- --Plugin --server --Sound --tiles --version' -- "$cur" ) )
- fi
-
-} &&
-complete -F _civclient civclient
-
-# 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-gtk2 b/completions/freeciv-gtk2
new file mode 100644
index 00000000..c818433d
--- /dev/null
+++ b/completions/freeciv-gtk2
@@ -0,0 +1,30 @@
+# freeciv client completions -*- shell-script -*-
+
+_civclient()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ case $prev in
+ -l|-S|-t|--log|--Sound|--tiles)
+ _filedir
+ return 0
+ ;;
+ -P|--Plugin)
+ COMPREPLY=( $( compgen -W 'none esd sdl' -- "$cur" ) )
+ return 0
+ ;;
+ -s|--server)
+ _known_hosts_real "$cur"
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
+ fi
+
+} &&
+complete -F _civclient civclient freeciv-gtk2 freeciv-sdl freeciv-xaw
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/freeciv-server b/completions/freeciv-server
new file mode 100644
index 00000000..7daa30ce
--- /dev/null
+++ b/completions/freeciv-server
@@ -0,0 +1,22 @@
+# freeciv-server completion -*- shell-script -*-
+
+_civserver()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ case $prev in
+ -f|-g|-l|-r|--file|--log|--gamelog|--read)
+ _filedir
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
+ fi
+
+} &&
+complete -F _civserver civserver freeciv-server
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/function b/completions/function
new file mode 100644
index 00000000..6156e63d
--- /dev/null
+++ b/completions/function
@@ -0,0 +1,22 @@
+# bash shell function completion -*- shell-script -*-
+
+_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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/fuse b/completions/fusermount
index 58d0c516..fa51b228 100644
--- a/completions/fuse
+++ b/completions/fusermount
@@ -1,11 +1,9 @@
-# bash completion for fuse
+# fusermount completion -*- shell-script -*-
-have fusermount &&
_fusermount()
{
- COMPREPLY=()
- local cur prev
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-h|-V|-o)
@@ -20,17 +18,11 @@ _fusermount()
esac
if [[ "$cur" == -* ]] ; then
- COMPREPLY=( $( compgen -W '-h -V -o -u -q -z' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" -h )' -- "$cur" ) )
else
_filedir -d
fi
} &&
complete -F _fusermount fusermount
-# 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/gcc b/completions/gcc
index d78e3e24..bafb81b7 100644
--- a/completions/gcc
+++ b/completions/gcc
@@ -1,4 +1,4 @@
-# gcc(1) completion
+# gcc(1) completion -*- shell-script -*-
#
# The only unusual feature is that we don't parse "gcc --help -v" output
# directly, because that would include the options of all the other backend
@@ -8,16 +8,15 @@
# ask the driver ("g++") for the name of the compiler ("cc1"), and parse the
# --help output of the compiler.
-have gcc &&
_gcc()
{
- local cur cc backend
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
+ local cur prev words cword
+ _init_completion || return
_expand || return 0
+ local cc backend
+
case $1 in
gcj)
backend=jc1
@@ -34,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
@@ -47,13 +47,8 @@ _gcc()
fi
} &&
complete -F _gcc gcc g++ c++ g77 gcj gpc
-[ $USERLAND = GNU -o $UNAME = Cygwin ] && \
-[ -n "${have:-}" ] && complete -F _gcc cc
-# Local variables:
-# mode: shell-script
-# sh-basic-offset: 4
-# sh-indent-comment: t
-# indent-tabs-mode: nil
-# End:
+[[ $OSTYPE == *cygwin* ]] || _userland GNU && _have gcc && \
+ complete -F _gcc cc || :
+
# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/gcl b/completions/gcl
index e0931536..2796ca07 100644
--- a/completions/gcl
+++ b/completions/gcl
@@ -1,13 +1,11 @@
+# -*- shell-script -*-
# bash programmable completion for various Common Lisp implementations by
# Nikodemus Siivola <nikodemus@random-state.net>
-have gcl &&
_gcl()
{
- local cur
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
+ local cur prev words cword
+ _init_completion || return
# completing an option (may or may not be separated by a space)
if [[ "$cur" == -* ]]; then
@@ -21,10 +19,4 @@ _gcl()
} &&
complete -F _gcl -o default gcl
-# 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/gdb b/completions/gdb
index f0bc42d3..c24407b5 100644
--- a/completions/gdb
+++ b/completions/gdb
@@ -1,16 +1,13 @@
-# bash completion for gdb
+# bash completion for gdb -*- shell-script -*-
-have gdb &&
_gdb()
{
- local cur prev
+ local cur prev words cword
+ _init_completion || return
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- if [ $COMP_CWORD -eq 1 ]; then
+ if [ $cword -eq 1 ]; then
local IFS
- _compopt_o_filenames
+ compopt -o filenames
if [[ "$cur" == */* ]]; then
# compgen -c works as expected if $cur contains any slashes.
IFS=$'\n'
@@ -27,18 +24,14 @@ _gdb()
-mindepth 1 -maxdepth 1 -not -type d -executable \
-printf "%f\\n" 2>/dev/null)' -- "$cur" ) )
fi
- elif [ $COMP_CWORD -eq 2 ]; then
- prev=${prev##*/}
- COMPREPLY=( $( compgen -fW "$( command ps axo comm,pid | \
- awk '{if ($1 ~ /^'"$prev"'/) print $2}' )" -- "$cur" ) )
+ elif [ $cword -eq 2 ]; then
+ COMPREPLY=( $( compgen -W "$( command ps axo comm,pid | \
+ awk '{if ($1 ~ /^'"${prev##*/}"'/) print $2}' )" -- "$cur" ) )
+ compopt -o filenames
+ COMPREPLY+=( $( compgen -f -X '!?(*/)core?(.+([0-9]))' -o plusdirs \
+ -- "$cur" ) )
fi
} &&
-complete -F _gdb -o default gdb
+complete -F _gdb gdb
-# 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/genaliases b/completions/genaliases
new file mode 100644
index 00000000..32f5919a
--- /dev/null
+++ b/completions/genaliases
@@ -0,0 +1,15 @@
+# mailman genaliases completion -*- shell-script -*-
+
+_genaliases()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--quiet --help' -- "$cur" ) )
+ fi
+
+} &&
+complete -F _genaliases genaliases
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/gendiff b/completions/gendiff
new file mode 100644
index 00000000..38c0828e
--- /dev/null
+++ b/completions/gendiff
@@ -0,0 +1,12 @@
+# gendiff(1) completion -*- shell-script -*-
+
+_gendiff()
+{
+ local cur prev words cword
+ _init_completion -o @(diff|patch) || return
+
+ [[ $cword -eq 1 ]] && _filedir -d
+} &&
+complete -F _gendiff gendiff
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/genisoimage b/completions/genisoimage
index 61b18114..3c966515 100644
--- a/completions/genisoimage
+++ b/completions/genisoimage
@@ -1,12 +1,9 @@
-# bash completion for mkisofs/genisoimage
+# bash completion for mkisofs/genisoimage -*- shell-script -*-
-(have mkisofs || have genisoimage) &&
_mkisofs()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-o|-abstract|-biblio|-check-session|-copyright|-log-file| \
@@ -68,10 +65,4 @@ _mkisofs()
} &&
complete -F _mkisofs mkisofs genisoimage
-# 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/getent b/completions/getent
index 54e62ab8..1bb12f52 100644
--- a/completions/getent
+++ b/completions/getent
@@ -1,14 +1,30 @@
-# bash completion for getent
+# bash completion for getent -*- shell-script -*-
-have getent &&
_getent()
{
- local cur prev
+ local cur prev words cword split
+ _init_completion -s || return
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local i db
+ for (( i=1; i < cword; i++ )); do
+ case ${words[i]} in
+ -V|--version|--usage|-'?'|--help)
+ return
+ ;;
+ -s|--service)
+ (( i++ ))
+ ;;
+ -*)
+ ;;
+ *)
+ # First non-option value is the db
+ db=${words[i]}
+ break
+ ;;
+ esac
+ done
- case $prev in
+ case $db in
passwd)
COMPREPLY=( $( compgen -u "$cur" ) )
return 0
@@ -26,30 +42,37 @@ _getent()
return 0
;;
protocols|networks|ahosts|ahostsv4|ahostsv6|rpc)
- COMPREPLY=( $( compgen -W "$( getent "$prev" | \
+ COMPREPLY=( $( compgen -W "$( getent $db | \
awk '{ print $1 }' )" -- "$cur" ) )
return 0
;;
- aliases|shadow)
- COMPREPLY=( $( compgen -W "$( getent "$prev" | cut -d: -f1 )" \
+ aliases|shadow|gshadow)
+ COMPREPLY=( $( compgen -W "$( getent $db | cut -d: -f1 )" \
-- "$cur" ) )
return 0
;;
+ ethers|netgroup)
+ return
+ ;;
+ esac
+
+ case $prev in
+ -s|--service)
+ return
+ ;;
esac
+ $split && return
- if [ $COMP_CWORD -eq 1 ]; then
+ if [[ $cur == -* ]]; then
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
+ [[ $COMPREPLY == *= ]] && compopt -o nospace
+ elif [[ -z $db ]]; then
COMPREPLY=( $( compgen -W 'passwd group hosts services protocols \
networks ahosts ahostsv4 ahostsv6 aliases ethers netgroup rpc \
- shadow' -- "$cur" ) )
+ shadow gshadow' -- "$cur" ) )
fi
} &&
complete -F _getent getent
-# 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/gkrellm b/completions/gkrellm
index 13e25ada..f7979b96 100644
--- a/completions/gkrellm
+++ b/completions/gkrellm
@@ -1,12 +1,9 @@
-# gkrellm(1) completion
+# gkrellm(1) completion -*- shell-script -*-
-have gkrellm || have gkrellm2 &&
_gkrellm()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-t|--theme)
@@ -36,19 +33,10 @@ _gkrellm()
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--theme --geometry --wm --m2 --nt \
- --withdrawn --config --force-host-config --server --port --nc \
- --config-clean --nolock --plugin --demo --logfile --version \
- --debug-level --help' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
fi
} &&
complete -F _gkrellm gkrellm gkrellm2
-# 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/gnatmake b/completions/gnatmake
index cdd193c1..e807d923 100644
--- a/completions/gnatmake
+++ b/completions/gnatmake
@@ -1,12 +1,10 @@
-# Gnatmake completion by Ralf_Schroth@t-online.de (Ralf Schroth)
+# Gnatmake completion -*- shell-script -*-
+# by Ralf_Schroth@t-online.de (Ralf Schroth)
-have gnatmake &&
_gnatmake()
{
- local cur
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
+ local cur prev words cword
+ _init_completion || return
if [[ "$cur" == -* ]]; then
# relevant (and less relevant ;-) )options completion
@@ -28,10 +26,4 @@ _gnatmake()
} &&
complete -F _gnatmake gnatmake
-# 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/gnome-mplayer b/completions/gnome-mplayer
new file mode 100644
index 00000000..00701702
--- /dev/null
+++ b/completions/gnome-mplayer
@@ -0,0 +1,39 @@
+# gnome-mplayer(1) completion -*- shell-script -*-
+
+_gnome_mplayer()
+{
+ local cur prev words cword split
+ _init_completion -s || return
+
+ case $prev in
+ -'?'|--help|--help-all|--help-gtk)
+ return
+ ;;
+ --showcontrols|--showsubtitles|--autostart)
+ COMPREPLY=( $( compgen -w '0 1' -- "$cur" ) )
+ return
+ ;;
+ --subtitle)
+ _filedir '@(srt|sub|txt|utf|rar|mpsub|smi|js|ssa|ass)'
+ return
+ ;;
+ --tvdriver)
+ COMPREPLY=( $( compgen -W 'v4l v4l2' -- "$cur" ) )
+ return
+ ;;
+ esac
+
+ $split && return
+
+ if [[ $cur == -* ]]; then
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" --help-all )' \
+ -- "$cur" ) )
+ [[ $COMPREPLY == *= ]] && compopt -o nospace
+ return
+ fi
+
+ _filedir
+} &&
+complete -F _gnome_mplayer gnome-mplayer
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/gpasswd b/completions/gpasswd
new file mode 100644
index 00000000..eb5a7e48
--- /dev/null
+++ b/completions/gpasswd
@@ -0,0 +1,25 @@
+# gpasswd(1) completion -*- shell-script -*-
+
+_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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/gpg b/completions/gpg
index 878a800b..763086bc 100644
--- a/completions/gpg
+++ b/completions/gpg
@@ -1,12 +1,9 @@
-# bash completion for gpg
+# bash completion for gpg -*- shell-script -*-
-have gpg &&
_gpg()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-s|--sign|--clearsign|--decrypt-files|--load-extension)
@@ -24,7 +21,7 @@ _gpg()
COMPREPLY=( $( compgen -W "$( gpg --list-keys 2>/dev/null | \
sed -ne 's@^.*<\([^>]*\)>.*$@\1@p')" -- "$cur" ))
if [ -e ~/.gnupg/gpg.conf ]; then
- COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "$( sed -ne \
+ COMPREPLY+=( $( compgen -W "$( sed -ne \
's@^[ \t]*group[ \t][ \t]*\([^=]*\).*$@\1@p' \
~/.gnupg/gpg.conf )" -- "$cur") )
fi
@@ -34,15 +31,8 @@ _gpg()
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '$(gpg --dump-options)' -- "$cur" ) )
- fi
-
+ fi
} &&
complete -F _gpg -o default gpg
-# 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/gpg2 b/completions/gpg2
index b99783f9..03d2c5b8 100644
--- a/completions/gpg2
+++ b/completions/gpg2
@@ -1,12 +1,9 @@
-# gpg2(1) completion
+# gpg2(1) completion -*- shell-script -*-
-have gpg2 && {
-_gpg2 ()
+_gpg2()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
--homedir)
@@ -28,7 +25,7 @@ _gpg2 ()
COMPREPLY=( $( compgen -W "$( gpg2 --list-keys 2>/dev/null | \
sed -ne 's@^.*<\([^>]*\)>.*$@\1@p')" -- "$cur" ))
if [ -e ~/.gnupg/gpg.conf ]; then
- COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "$( sed -ne \
+ COMPREPLY+=( $( compgen -W "$( sed -ne \
's@^[ \t]*group[ \t][ \t]*\([^=]*\).*$@\1@p' \
~/.gnupg/gpg.conf)" -- "$cur"))
fi
@@ -41,12 +38,5 @@ _gpg2 ()
fi
} &&
complete -F _gpg2 -o default gpg2
-}
-# 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/gprof b/completions/gprof
new file mode 100644
index 00000000..810255a4
--- /dev/null
+++ b/completions/gprof
@@ -0,0 +1,65 @@
+# gprof(1) completion -*- shell-script -*-
+
+_gprof()
+{
+ local cur prev words cword split
+ _init_completion -s || return
+
+ case $cur in
+ -A*|-C*|-J*|-p*|-P*|-q*|-Q*|-n*|-N*|-d*)
+ return
+ ;;
+ -S*)
+ cur=${cur:2}
+ _filedir
+ COMPREPLY=( "${COMPREPLY[@]/#/-S}" )
+ return
+ ;;
+ -O*)
+ cur=${cur:2}
+ COMPREPLY=( $( compgen -P -O -W 'auto bsd 4.4bsd magic prof' \
+ -- "$cur" ) )
+ return
+ ;;
+ esac
+
+ case $prev in
+ -I|--directory-path)
+ _filedir -d
+ return
+ ;;
+ -R|--file-ordering|--external-symbol-table)
+ _filedir
+ return
+ ;;
+ -w|--width|-k|-m|--min-count|-h|--help|-e|-E|-f|-F)
+ return
+ ;;
+ --file-format)
+ COMPREPLY=( $( compgen -W 'auto bsd 4.4bsd magic prof' \
+ -- "$cur" ) )
+ return
+ ;;
+ esac
+
+ $split && return
+
+ if [[ $cur == -* ]]; then
+ COMPREPLY=( $( compgen -W '--annotated-source --brief --exec-counts
+ --file-info --directory-path --no-annotated-source --print-path
+ --flat-profile --no-flat-profile --graph --no-graph --table-length=
+ --separate-files --no-exec-counts --function-ordering
+ --file-ordering --traditional --width= --all-lines --demangle
+ --no-demangle --no-static --static-call-graph
+ --ignore-non-functions -k --line --min-count= --time= --no-time=
+ --external-symbol-table= --display-unused-functions --debug --help
+ --file-format= --sum --version' -- "$cur" ) )
+ [[ $COMPREPLY == *= ]] && compopt -o nospace
+ return
+ fi
+
+ _filedir
+} &&
+complete -F _gprof gprof
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/groupadd b/completions/groupadd
new file mode 100644
index 00000000..db5ff872
--- /dev/null
+++ b/completions/groupadd
@@ -0,0 +1,27 @@
+# groupadd(8) completion -*- shell-script -*-
+
+_groupadd()
+{
+ local cur prev words cword split
+ _init_completion -s || return
+
+ # TODO: if -o/--non-unique is given, could complete on existing gids
+ # with -g/--gid
+
+ case $prev in
+ -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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/groupdel b/completions/groupdel
new file mode 100644
index 00000000..bf6e5c6a
--- /dev/null
+++ b/completions/groupdel
@@ -0,0 +1,5 @@
+# groupdel(8) completion -*- shell-script -*-
+
+complete -g groupdel
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/groupmems b/completions/groupmems
new file mode 100644
index 00000000..627f8e01
--- /dev/null
+++ b/completions/groupmems
@@ -0,0 +1,26 @@
+# groupmems(8) completion -*- shell-script -*-
+
+_groupmems()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ case $prev in
+ -a|--add|-d|--delete)
+ COMPREPLY=( $( compgen -u -- "$cur" ) )
+ return 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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/groupmod b/completions/groupmod
new file mode 100644
index 00000000..1a0241a7
--- /dev/null
+++ b/completions/groupmod
@@ -0,0 +1,29 @@
+# groupmod(8) completion -*- shell-script -*-
+
+_groupmod()
+{
+ local cur prev words cword split
+ _init_completion -s || return
+
+ # TODO: if -o/--non-unique is given, could complete on existing gids
+ # with -g/--gid
+
+ case $prev in
+ -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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/dvd+rw-tools b/completions/growisofs
index f37781ee..c4cb7162 100644
--- a/completions/dvd+rw-tools
+++ b/completions/growisofs
@@ -1,18 +1,16 @@
-# dvd+rw-tools completions
+# growisofs(1) completion -*- shell-script -*-
-have growisofs &&
_growisofs()
{
- COMPREPLY=()
- local cur prev
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-version|-speed)
return 0
;;
-Z|-M)
- compopt -o nospace &>/dev/null
+ compopt -o nospace
_dvd_devices
return 0
;;
@@ -30,7 +28,7 @@ _growisofs()
# TODO: mkisofs options
COMPREPLY=( $( compgen -W '-dvd-compat -overburn -speed= -Z -M' \
-- "$cur" ) )
- [[ ${COMPREPLY[@]} == *= ]] && compopt -o nospace &>/dev/null
+ [[ ${COMPREPLY[@]} == *= ]] && compopt -o nospace
return 0
fi
@@ -38,10 +36,4 @@ _growisofs()
} &&
complete -F _growisofs growisofs
-# 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/grpck b/completions/grpck
new file mode 100644
index 00000000..0aff1439
--- /dev/null
+++ b/completions/grpck
@@ -0,0 +1,17 @@
+# grpck(8) completion -*- shell-script -*-
+
+_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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/gzip b/completions/gzip
index f7aec17e..87219630 100644
--- a/completions/gzip
+++ b/completions/gzip
@@ -1,13 +1,9 @@
-# bash completion for gzip
+# bash completion for gzip -*- shell-script -*-
-have gzip || have pigz &&
_gzip()
{
- local cur prev xspec helpopts
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
- helpopts=`_parse_help ${COMP_WORDS[0]}`
+ local cur prev words cword
+ _init_completion || return
case $prev in
-b|--blocksize|-p|--processes|-S|--suffix|-h|--help|-V|--version)
@@ -16,14 +12,14 @@ _gzip()
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W "$helpopts -1 -2 -3 -4 -5 -6 -7 -8 -9" \
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" ) {-1..-9}' \
-- "$cur" ) )
+ [[ $COMPREPLY == *= ]] && compopt -o nospace
return 0
fi
- local IFS=$'\n'
+ local IFS=$'\n' xspec="*.@(gz|t[ag]z)"
- xspec="*.@(gz|t[ag]z)"
if [[ "$prev" == --* ]]; then
[[ "$prev" == --decompress || \
"$prev" == --list || \
@@ -32,24 +28,14 @@ _gzip()
elif [[ "$prev" == -* ]]; then
[[ "$prev" == -*[dlt]* ]] && xspec="!"$xspec
[[ "$prev" == -*f* ]] && xspec=
- elif [[ "$prev" == '>' || "$prev" == '>>' ]]; then
- xspec=
- elif [ "$prev" = '<' ]; then
- xspec=
fi
_expand || return 0
- _compopt_o_filenames
+ compopt -o filenames
COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \
$( compgen -d -- "$cur" ) )
} &&
complete -F _gzip gzip pigz
-# 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/bluez b/completions/hcitool
index 7a2b1e57..417a0c99 100644
--- a/completions/bluez
+++ b/completions/hcitool
@@ -1,17 +1,16 @@
-# bash completion for bluez utils
+# bash completion for bluez utils -*- shell-script -*-
-have hcitool && {
_bluetooth_adresses()
{
if [ -n "${COMP_BLUETOOTH_SCAN:-}" ]; then
- COMPREPLY=( ${COMPREPLY[@]:-} $( compgen -W "$( hcitool scan | \
+ COMPREPLY+=( $( compgen -W "$( hcitool scan | \
awk '/^\t/{print $1}' )" -- "$cur" ) )
fi
}
_bluetooth_devices()
{
- COMPREPLY=( ${COMPREPLY[@]:-} $( compgen -W "$( hcitool dev | \
+ COMPREPLY+=( $( compgen -W "$( hcitool dev | \
awk '/^\t/{print $1}' )" -- "$cur" ) )
}
@@ -30,34 +29,31 @@ _bluetooth_packet_types()
_hcitool()
{
- local cur prev split=false arg
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- _split_longopt && split=true
+ local cur prev words cword split
+ _init_completion -s || return
case $prev in
-i)
_bluetooth_devices
- return 0;
+ return 0
;;
--role)
COMPREPLY=( $( compgen -W 'm s' -- "$cur" ) )
- return 0;
+ return 0
;;
--pkt-type)
_bluetooth_packet_types
- return 0;
+ return 0
;;
esac
$split && return 0
+ local arg
_get_first_arg
if [ -z $arg ]; then
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--help -i' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
else
COMPREPLY=( $( compgen -W 'dev inq scan name info \
spinq epinq cmd con cc dc sr cpt rssi lq tpl \
@@ -107,31 +103,28 @@ _hcitool()
;;
esac
fi
-}
+} &&
complete -F _hcitool hcitool
_sdptool()
{
- local cur prev split=false
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- _split_longopt && split=true
+ local cur prev words cword split
+ _init_completion -s || return
case $prev in
--bdaddr)
_bluetooth_adresses
- return 0;
+ return 0
;;
esac
$split && return 0
+ local arg
_get_first_arg
if [ -z $arg ]; then
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--help' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
else
COMPREPLY=( $( compgen -W 'search browse records add \
del get setattr setseq' -- "$cur" ) )
@@ -168,56 +161,54 @@ _sdptool()
;;
esac
fi
-}
+} &&
complete -F _sdptool sdptool
_l2ping()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-i)
_bluetooth_devices
- return 0;
+ return 0
+ ;;
+ -s|-c|-t|-d)
+ return 0
;;
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-i -s -c -t -f -r' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) )
else
_bluetooth_adresses
fi
-
-}
+} &&
complete -F _l2ping l2ping
_rfcomm()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-f|--config)
_filedir
- return 0;
+ return 0
;;
-i)
_bluetooth_devices
_bluetooth_adresses
- return 0;
+ return 0
;;
esac
+ local arg
_get_first_arg
if [ -z $arg ]; then
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--help -a --raw \
- --config -i --auth --encrypt --secure --master' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
else
COMPREPLY=( $( compgen -W 'show connect listen watch \
bind release' -- "$cur" ) )
@@ -236,28 +227,27 @@ _rfcomm()
esac
fi
fi
-}
+} &&
complete -F _rfcomm rfcomm
_ciptool()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-i)
_bluetooth_devices
_bluetooth_adresses
- return 0;
+ return 0
;;
esac
+ local arg
_get_first_arg
if [ -z $arg ]; then
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--help -i' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
else
COMPREPLY=( $( compgen -W 'show search connect release \
loopback' -- "$cur" ) )
@@ -272,26 +262,25 @@ _ciptool()
;;
esac
fi
-}
+} &&
complete -F _ciptool ciptool
_dfutool()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-d|--device)
_bluetooth_devices
- return 0;
+ return 0
;;
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--help --device' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
else
+ local args
_count_args
case $args in
1)
@@ -303,16 +292,15 @@ _dfutool()
;;
esac
fi
-}
+} &&
complete -F _dfutool dfutool
_hciconfig()
{
- local cur
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
+ local cur prev words cword
+ _init_completion || return
+ local arg
_get_first_arg
if [ -z $arg ]; then
if [[ "$cur" == -* ]]; then
@@ -349,19 +337,18 @@ _hciconfig()
;;
esac
fi
-}
+} &&
complete -F _hciconfig hciconfig
_hciattach()
{
- local cur
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
+ local cur prev words cword
+ _init_completion || return
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-n -p -t -b -s -l' -- "$cur" ) )
else
+ local args
_count_args
case $args in
1)
@@ -386,47 +373,7 @@ _hciattach()
;;
esac
fi
-
-}
+} &&
complete -F _hciattach hciattach
-_hid2hci()
-{
- local cur
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--help --quiet -0 --tohci -1 \
- --tohid' -- "$cur" ) )
- fi
-}
-complete -F _hid2hci hid2hci
-
-_avctrl()
-{
- local cur
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--help --quiet' -- "$cur" ) )
- else
- _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/hddtemp b/completions/hddtemp
new file mode 100644
index 00000000..75641045
--- /dev/null
+++ b/completions/hddtemp
@@ -0,0 +1,38 @@
+# hddtemp(8) completion -*- shell-script -*-
+
+_hddtemp()
+{
+ local cur prev words cword split
+ _init_completion -s || return
+
+ case $prev in
+ -f|--file)
+ _filedir db
+ return
+ ;;
+ -l|--listen)
+ _ip_addresses
+ return
+ ;;
+ -u|--unit)
+ COMPREPLY=( $( compgen -W 'C F' -- "$cur" ) )
+ return
+ ;;
+ -p|--port|-s|--separator|-S|--syslog|-v|--version|-h|-\?|--help)
+ return
+ ;;
+ esac
+
+ $split && return
+
+ if [[ $cur == -* ]]; then
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" ) --help' -- "$cur" ) )
+ [[ $COMPREPLY == *= ]] && compopt -o nospace
+ else
+ cur=${cur:=/dev/}
+ _filedir
+ fi
+} &&
+complete -F _hddtemp hddtemp
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/helpers/Makefile.am b/completions/helpers/Makefile.am
deleted file mode 100644
index 98fccefe..00000000
--- a/completions/helpers/Makefile.am
+++ /dev/null
@@ -1,3 +0,0 @@
-helpers_SCRIPTS = perl
-
-EXTRA_DIST = $(helpers_SCRIPTS)
diff --git a/completions/hid2hci b/completions/hid2hci
new file mode 100644
index 00000000..4e2ef039
--- /dev/null
+++ b/completions/hid2hci
@@ -0,0 +1,15 @@
+# hid2hci completion -*- shell-script -*-
+
+_hid2hci()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--help --quiet -0 --tohci -1 \
+ --tohid' -- "$cur" ) )
+ fi
+} &&
+complete -F _hid2hci hid2hci
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/hping2 b/completions/hping2
index e2e6bf1a..45c2c4c6 100644
--- a/completions/hping2
+++ b/completions/hping2
@@ -1,13 +1,9 @@
-# bash completion for hping2
+# bash completion for hping2 -*- shell-script -*-
-have hping || have hping2 || have hping3 &&
_hping2()
{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=`_get_pword`
+ local cur prev words cword
+ _init_completion || return
case $prev in
-I|--interface)
@@ -29,27 +25,11 @@ _hping2()
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--help --version --count --interval --fast \
- --faster --numeric --quiet --interface --verbose --debug --bind \
- --unbind --rawip --icmp --upd --scan --listen --spoof \
- --rand-source --rand-dest --ttl --id --ipproto --winid -rel --frag \
- --morefrag --dontfrag --fragoff --mtu --tos --rroute --icmptype \
- --icmpcode --icmp-ipver --icmp-iphlen --icmp-iplen --icmp-ipid \
- --icmp-ipproto --icmp-cksum --icmp-ts --icmp-addr --baseport \
- --destport --keep --win --tcpoff --tcpseq --tcpack --seqnum \
- --badcksum --tcp-timestamp --fin --syn --rst --push --ack --urg \
- --xmas --ymas --data --file --sign --dump --print --safe --end \
- --traceroute --tr-keep-ttl --tr-stop --tr-no-rtt' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
else
_known_hosts_real "$cur"
fi
} &&
complete -F _hping2 hping hping2 hping3
-# 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/htpasswd b/completions/htpasswd
new file mode 100644
index 00000000..b0990fe1
--- /dev/null
+++ b/completions/htpasswd
@@ -0,0 +1,33 @@
+# htpasswd(1) completion -*- shell-script -*-
+
+_htpasswd()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ local i o=0 # $o is index of first non-option argument
+ for (( i=1; i <= cword; i++ )); do
+ case ${words[i]} in
+ -*n*) return ;;
+ -*) ;;
+ *) o=$i ; break ;;
+ esac
+ done
+
+ if [[ $o -eq 0 || $o -eq $cword ]]; then
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
+ return
+ fi
+ # Password file (first non-option argument)
+ _filedir
+
+ elif [[ $o -eq $cword-1 ]]; then
+ # Username (second non-option argument)
+ COMPREPLY=( $( compgen -W \
+ '$( cut -d: -f1 "${words[o]}" 2>/dev/null )' -- "$cur" ) )
+ fi
+} &&
+complete -F _htpasswd htpasswd
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/iconv b/completions/iconv
index 9e332004..b33cc704 100644
--- a/completions/iconv
+++ b/completions/iconv
@@ -1,14 +1,9 @@
-# iconv(1) completion
+# iconv(1) completion -*- shell-script -*-
-have iconv &&
_iconv()
{
- local cur prev split=false
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- _split_longopt && split=true
+ local cur prev words cword split
+ _init_completion -s || return
case $prev in
-'?'|--help|--usage|-V|--version|--unicode-subst|--byte-subst|\
@@ -29,18 +24,11 @@ _iconv()
$split && return 0
if [[ "$cur" = -* ]]; then
- COMPREPLY=( $( compgen -W '--from-code --to-code --list -c
- --unicode-subst --byte-subst --widechar-subst --output --silent
- --verbose --help --usage --version' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
+ [[ $COMPREPLY == *= ]] && compopt -o nospace
return 0
fi
} &&
complete -F _iconv -o default iconv
-# 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
new file mode 100644
index 00000000..14e4cc1a
--- /dev/null
+++ b/completions/idn
@@ -0,0 +1,26 @@
+# idn(1) completion -*- shell-script -*-
+
+_idn()
+{
+ local cur prev words cword split
+ _init_completion -s || return
+
+ case $prev in
+ -h|--help|-V|--version)
+ return
+ ;;
+ -p|--profile)
+ COMPREPLY=( $( compgen -W 'Nameprep iSCSI Nodeprep Resourceprep
+ trace SASLprep' -- "$cur" ) )
+ return
+ ;;
+ esac
+
+ if ! $split && [[ $cur == -* ]]; then
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
+ [[ $COMPREPLY == *= ]] && compopt -o nospace
+ fi
+} &&
+complete -F _idn idn
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/iftop b/completions/iftop
index 9ec2a0d0..8c606172 100644
--- a/completions/iftop
+++ b/completions/iftop
@@ -1,11 +1,9 @@
-# iftop(8) completion
+# iftop(8) completion -*- shell-script -*-
-have iftop &&
_iftop()
{
- COMPREPLY=()
- local cur prev
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-h|-f|-F|-m)
@@ -21,15 +19,8 @@ _iftop()
;;
esac
- COMPREPLY=( $( compgen -W '-h -n -N -p -P -b -B -i -f -F -c -m' \
- -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" -h )' -- "$cur" ) )
} &&
complete -F _iftop iftop
-# 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/ifup b/completions/ifup
new file mode 100644
index 00000000..fee87d6b
--- /dev/null
+++ b/completions/ifup
@@ -0,0 +1,19 @@
+# Red Hat & Debian GNU/Linux if{up,down} completion -*- shell-script -*-
+
+_userland GNU || return 1
+
+_ifupdown()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ if [ $cword -eq 1 ]; then
+ _configured_interfaces
+ COMPREPLY=( $(compgen -W '${COMPREPLY[@]}' -- "$cur") )
+ fi
+
+ return 0
+} &&
+complete -F _ifupdown ifup ifdown ifstatus
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/ifupdown b/completions/ifupdown
deleted file mode 100644
index f81e08d5..00000000
--- a/completions/ifupdown
+++ /dev/null
@@ -1,27 +0,0 @@
-# Red Hat & Debian GNU/Linux if{up,down} completion
-#
-[ $USERLAND = GNU ] && { have ifup || have ifdown; } &&
-_ifupdown()
-{
- local cur
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
-
- if [ $COMP_CWORD -eq 1 ]; then
- _configured_interfaces
- COMPREPLY=( $(compgen -W '${COMPREPLY[@]}' -- "$cur") )
- fi
-
- return 0
-} &&
-complete -F _ifupdown ifup ifdown
-[ $USERLAND = GNU ] && have ifstatus && complete -F _ifupdown ifstatus
-
-# 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/imagemagick b/completions/imagemagick
deleted file mode 100644
index c7ba74c8..00000000
--- a/completions/imagemagick
+++ /dev/null
@@ -1,532 +0,0 @@
-# bash completion for ImageMagick
-
-have convert && {
-_ImageMagick()
-{
- local cur prev
- _get_comp_words_by_ref cur prev
-
- case $prev in
- -channel)
- COMPREPLY=( $( compgen -W 'Red Green Blue Opacity \
- Matte Cyan Magenta Yellow Black' -- "$cur" ) )
- return 0
- ;;
- -colormap)
- COMPREPLY=( $( compgen -W 'shared private' -- "$cur" ) )
- return 0
- ;;
- -colorspace)
- COMPREPLY=( $( compgen -W 'GRAY OHTA RGB Transparent \
- XYZ YCbCr YIQ YPbPr YUV CMYK' -- "$cur" ) )
- return 0
- ;;
- -compose)
- COMPREPLY=( $( compgen -W 'Over In Out Atop Xor Plus \
- Minus Add Subtract Difference Multiply Bumpmap\
- Copy CopyRed CopyGreen CopyBlue CopyOpacity' -- "$cur" ) )
- return 0
- ;;
- -compress)
- COMPREPLY=( $( compgen -W 'None BZip Fax Group4 JPEG \
- Lossless LZW RLE Zip' -- "$cur" ) )
- return 0
- ;;
- -dispose)
- COMPREPLY=( $( compgen -W 'Undefined None Background Previous' \
- -- "$cur" ) )
- return 0
- ;;
- -encoding)
- COMPREPLY=( $( compgen -W 'AdobeCustom AdobeExpert \
- AdobeStandard AppleRoman BIG5 GB2312 Latin2 \
- None SJIScode Symbol Unicode Wansung' -- "$cur"))
- return 0
- ;;
- -endian)
- COMPREPLY=( $( compgen -W 'MSB LSB' -- "$cur" ) )
- return 0
- ;;
- -filter)
- COMPREPLY=( $( compgen -W 'Point Box Triangle Hermite \
- Hanning Hamming Blackman Gaussian Quadratic \
- Cubic Catrom Mitchell Lanczos Bessel Sinc' -- "$cur" ) )
- return 0
- ;;
- -format)
- COMPREPLY=( $( compgen -W "$( convert -list format | \
- awk '/ [r-][w-][+-] / {print $1}' | \
- tr -d '*' | tr [:upper:] [:lower:] )" -- "$cur" ) )
- return 0
- ;;
- -gravity)
- COMPREPLY=( $( compgen -W 'Northwest North NorthEast \
- West Center East SouthWest South SouthEast' -- "$cur" ) )
- return 0
- ;;
- -intent)
- COMPREPLY=( $( compgen -W 'Absolute Perceptual \
- Relative Saturation' -- "$cur" ) )
- return 0
- ;;
- -interlace)
- COMPREPLY=( $( compgen -W 'None Line Plane Partition' -- "$cur" ) )
- return 0
- ;;
- -limit)
- COMPREPLY=( $( compgen -W 'Disk File Map Memory' -- "$cur" ) )
- return 0
- ;;
- -list)
- COMPREPLY=( $( compgen -W 'Delegate Format Magic Module Resource \
- Type' -- "$cur" ) )
- return 0
- ;;
- -map)
- COMPREPLY=( $( compgen -W 'best default gray red green blue' \
- -- "$cur" ) )
- _filedir
- return 0
- ;;
- -noise)
- COMPREPLY=( $( compgen -W 'Uniform Gaussian Multiplicative \
- Impulse Laplacian Poisson' -- "$cur" ) )
- return 0
- ;;
- -preview)
- COMPREPLY=( $( compgen -W 'Rotate Shear Roll Hue \
- Saturation Brightness Gamma Spiff \
- Dull Grayscale Quantize Despeckle \
- ReduceNoise AddNoise Sharpen Blur \
- Treshold EdgeDetect Spread Shade \
- Raise Segment Solarize Swirl Implode \
- Wave OilPaint CharcoalDrawing JPEG' -- "$cur" ) )
- return 0
- ;;
- -mask|-profile|-texture|-tile|-write)
- _filedir
- return 0
- ;;
- -type)
- COMPREPLY=( $( compgen -W 'Bilevel Grayscale Palette PaletteMatte \
- TrueColor TrueColorMatte ColorSeparation ColorSeparationlMatte \
- Optimize' -- "$cur" ) )
- return 0
- ;;
- -units)
- COMPREPLY=( $( compgen -W 'Undefined PixelsPerInch \
- PixelsPerCentimeter' -- "$cur" ) )
- return 0
- ;;
- -virtual-pixel)
- COMPREPLY=( $( compgen -W 'Constant Edge mirror tile' -- "$cur" ) )
- return 0
- ;;
- -visual)
- COMPREPLY=( $( compgen -W 'StaticGray GrayScale StaticColor \
- PseudoColor TrueColor DirectColor defaut visualid' -- "$cur" ))
- return 0
- ;;
- esac
-}
-
-_convert()
-{
- local cur
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
-
- _ImageMagick
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-adaptive-blur -adaptive-resize \
- -adaptive-sharpen -adjoin -affine -alpha -annotate \
- -antialias -append -attenuate -authenticate \
- -auto-orient -average -background -bench -bias \
- -black-point-compensation -black-threshold \
- -blue-primary -blur -border -bordercolor -caption \
- -channel -charcoal -chop -clip -clip-mask -clip-path \
- -clone -clut -coalesce -colorize -colors -colorspace \
- -combine -comment -compose -composite -compress \
- -contrast -contrast-stretch -convolve -crop -cycle \
- -debug -decipher -deconstruct -define -delay -delete \
- -density -depth -despeckle -display -dispose -distort \
- -dither -draw -edge -emboss -encipher -encoding \
- -endian -enhance -equalize -evaluate -extent -extract \
- -family -fill -filter -flatten -flip -floodfill -flop \
- -font -format -frame -fuzz -fx -gamma -gaussian-blur \
- -geometry -gravity -green-primary -help -identify \
- -implode -insert -intent -interlace -interpolate \
- -label -lat -layers -level -limit -linear-stretch \
- -liquid-rescale -list -log -loop -map -mask \
- -mattecolor -median -modulate -monitor -monochrome \
- -morph -mosaic -motion-blur -negate -noise -normalize \
- -opaque -ordered-dither -orient -page -paint -ping \
- -pointsize -polaroid -posterize -preview -print \
- -process -profile -quality -quantize -quiet \
- -radial-blur -raise -random-threshold -recolor \
- -red-primary -regard-warnings -region -render -repage \
- -resample -resize -respect-parenthesis -reverse -roll \
- -rotate -sample -sampling-factor -scale -scene -seed \
- -segment -separate -sepia-tone -set -shade -shadow \
- -sharpen -shave -shear -sigmoidal-contrast -size \
- -sketch -solarize -splice -spread -stretch -strip \
- -stroke -strokewidth -style -swap -swirl -taint \
- -texture -threshold -thumbnail -tile -tile-offset \
- -tint -transform -transparent -transparent-color \
- -transpose -transverse -treedepth -trim -type \
- -undercolor -unique-colors -units -unsharp -verbose \
- -version -view -vignette -virtual-pixel -wave \
- -weight -white-point -white-threshold \
- -write' -- "$cur" ) )
- elif [[ "$cur" == +* ]]; then
- COMPREPLY=( $( compgen -W '+adjoin +append +compress \
- +contrast +debug +dither +endian +gamma +label +map \
- +mask +matte +negate +noise +page +raise +render \
- +write' -- "$cur" ) )
- else
- _filedir
- fi
-}
-complete -F _convert convert
-
-_mogrify()
-{
- local cur
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
-
- _ImageMagick
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-adaptive-blur -adaptive-resize \
- -adaptive-sharpen -adjoin -affine -alpha -annotate \
- -antialias -attenuate -authenticate -auto-orient \
- -background -bias -black-point-compensation \
- -black-threshold -blue-primary -blur -border \
- -bordercolor -caption -channel -charcoal -chop -clip \
- -clip-mask -clip-path -clut -colorize -colors \
- -colorspace -comment -compose -compress -contrast \
- -contrast-stretch -convolve -cycle -debug -decipher \
- -define -delay -density -depth -despeckle -display \
- -dispose -distort -dither -draw -edge -emboss \
- -encipher -encoding -endian -enhance -equalize \
- -evaluate -extent -extract -family -fill -filter \
- -flip -floodfill -flop -font -format -frame -fuzz \
- -gamma -gaussian-blur -geometry -gravity \
- -green-primary -help -identify -implode -intent \
- -interlace -interpolate -label -lat -layers -level \
- -limit -linear-stretch -liquid-rescale -list -log \
- -loop -mask -mattecolor -median -modulate -monitor \
- -monochrome -motion-blur -negate -noise -normalize \
- -opaque -ordered-dither -orient -page -paint -path \
- -ping -pointsize -polaroid -posterize -preview -print \
- -profile -quality -quantize -quiet -radial-blur \
- -raise -random-threshold -recolor -red-primary \
- -regard-warnings -region -render -repage -resample \
- -resize -roll -rotate -sample -sampling-factor -scale \
- -scene -seed -segment -sepia-tone -set -shade -shadow \
- -sharpen -shave -shear -sigmoidal-contrast -size \
- -sketch -solarize -splice -spread -stretch -strip \
- -stroke -strokewidth -style -swirl -taint -texture \
- -threshold -thumbnail -tile -tile-offset -tint \
- -transform -transparent -transparent-color -transpose \
- -transverse -treedepth -trim -type -undercolor \
- -unique-colors -units -unsharp -verbose -version \
- -view -vignette -virtual-pixel -wave -weight \
- -white-point -white-threshold' -- "$cur" ) )
- elif [[ "$cur" == +* ]]; then
- COMPREPLY=( $( compgen -W '+compress +contrast +debug +dither \
- +endian +gamma +label +map +mask +matte +negate +page \
- +raise' -- "$cur" ) )
- else
- _filedir
- fi
-}
-complete -F _mogrify mogrify
-
-_display()
-{
- local cur
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
-
- _ImageMagick
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-alpha -antialias -authenticate \
- -auto-orient -backdrop -background -border \
- -bordercolor -borderwidth -channel -clip \
- -clip-path -coalesce -colormap -colors -colorspace \
- -comment -compress -contrast -crop -debug -decipher \
- -define -delay -density -depth -despeckle -display \
- -dispose -dither -edge -endian -enhance -extract \
- -filter -flatten -flip -flop -font -foreground \
- -format -frame -gamma -geometry -help -iconGeometry \
- -iconic -identify -immutable -interlace -interpolate \
- -label -limit -list -log -loop -map -mattecolor \
- -monitor -monochrome -name -negate -page -profile \
- -quality -quantize -quiet -raise -regard-warnings \
- -remote -repage -resample -resize \
- -respect-parenthesis -roll -rotate -sample \
- -sampling-factor -scenes -seed -segment -set \
- -shared-memory -sharpen -size -strip -texture -title \
- -transparent-color -treedepth -trim -update \
- -usePixmap -verbose -version -virtual-pixel -visual \
- -window -window-group -write' -- "$cur" ) )
- elif [[ "$cur" == +* ]]; then
- COMPREPLY=( $( compgen -W '+compress +contrast +debug +dither \
- +endian +gamma +label +map +matte +negate +page \
- +raise +write' -- "$cur" ) )
- else
- _filedir
- fi
-}
-complete -F _display display
-
-_animate()
-{
- local cur
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
-
- _ImageMagick
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-alpha -authenticate -backdrop \
- -background -bordercolor -borderwidth -channel \
- -coalesce -colormap -colors -colorspace -crop -debug \
- -decipher -define -delay -density -depth -display \
- -dispose -dither -extract -filter -flatten -font \
- -foreground -format -gamma -geometry -help \
- -iconGeometry -iconic -identify -immutable -interlace \
- -interpolate -limit -list -log -loop -map -mattecolor \
- -mattecolor -monitor -monochrome -name -page -pause \
- -quantize -quiet -regard-warnings -remote -repage \
- -resample -resize -respect-parenthesis -rotate \
- -sampling-factor -scenes -seed -set -shared-memory \
- -size -strip -title -transparent-color -treedepth \
- -trim -verbose -version -virtual-pixel -visual \
- -window' -- "$cur" ) )
- elif [[ "$cur" == +* ]]; then
- COMPREPLY=( $( compgen -W '+debug +dither +gamma +map +matte' \
- -- "$cur" ) )
- else
- _filedir
- fi
-}
-complete -F _animate animate
-
-_identify()
-{
- local cur
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
-
- _ImageMagick
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-alpha -antialias -authenticate \
- -channel -colorspace -crop -debug -define -density \
- -depth -extract -format -fuzz -gamma -help -interlace \
- -interpolate -limit -list -log -monitor -ping -quiet \
- -regard-warnings -respect-parenthesis \
- -sampling-factor -seed -set -size -strip -units \
- -verbose -version -virtual-pixel' -- "$cur" ) )
- elif [[ "$cur" == +* ]]; then
- COMPREPLY=( $( compgen -W '+debug' -- "$cur" ) )
- else
- _filedir
- fi
-}
-complete -F _identify identify
-
-_montage()
-{
- local cur
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
-
- _ImageMagick
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-adjoin -affine -alpha \
- -authenticate -background -blue-primary -blur -border \
- -bordercolor -borderwidth -caption -channel -clone \
- -coalesce -colors -colorspace -comment -compose \
- -compress -crop -debug -define -density -depth \
- -display -dispose -dither -draw -encoding -endian \
- -extract -fill -filter -flatten -flip -flop -font \
- -format -frame -gamma -geometry -gravity \
- -green-primary -help -identify -interlace \
- -interpolate -label -limit -list -log -mattecolor \
- -mode -monitor -monochrome -origin -page -pointsize \
- -polaroid -profile -quality -quantize -quiet \
- -red-primary -regard-warnings -repage -resize \
- -respect-parenthesis -rotate -sampling-factor -scenes \
- -seed -set -shadow -size -strip -stroke -texture \
- -thumbnail -tile -title -transform -transparent \
- -transparent-color -treedepth -trim -type -units \
- -verbose -version -virtual-pixel \
- -white-point' -- "$cur" ) )
- elif [[ "$cur" == +* ]]; then
- COMPREPLY=( $( compgen -W '+adjoin +compress +debug +dither \
- +endian +gamma +label +matte +page' -- "$cur" ) )
- else
- _filedir
- fi
-}
-complete -F _montage montage
-
-_composite()
-{
- local cur
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
-
- _ImageMagick
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-affine -alpha -authenticate \
- -blend -blue-primary -border -bordercolor -channel \
- -colors -colorspace -comment -compose -compress \
- -debug -decipher -define -density -depth -displace \
- -display -dispose -dissolve -dither -encipher \
- -encoding -endian -extract -filter -font -format \
- -geometry -gravity -green-primary -help -identify \
- -interlace -interpolate -label -limit -list -log \
- -monitor -monochrome -negate -page -profile -quality \
- -quantize -quiet -red-primary -regard-warnings \
- -repage -resize -respect-parenthesis -rotate \
- -sampling-factor -scene -seed -sharpen -shave -size \
- -stegano -stereo -strip -swap -thumbnail -tile \
- -transform -transparent-color -treedepth -type -units \
- -unsharp -verbose -version -virtual-pixel -watermark \
- -white-point -write' -- "$cur" ) )
- elif [[ "$cur" == +* ]]; then
- COMPREPLY=( $( compgen -W '+compress +debug +dither +endian +label \
- +matte +negate +page +write' -- "$cur" ) )
- else
- _filedir
- fi
-}
-complete -F _composite composite
-
-_compare()
-{
- local cur
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
-
- _ImageMagick
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-alpha -authenticate -channel \
- -colorspace -compress -debug -decipher -define \
- -density -depth -encipher -extract -format -fuzz \
- -help -highlight-color -identify -interlace -limit \
- -list -log -metric -monitor -passphrase -profile \
- -quality -quantize -quiet -regard-warnings \
- -respect-parenthesis -sampling-factor -seed -set \
- -size -transparent-color -type -verbose -version \
- -virtual-pixel' -- "$cur" ) )
- elif [[ "$cur" == +* ]]; then
- COMPREPLY=( $( compgen -W '+debug' -- "$cur" ) )
- else
- _filedir
- fi
-}
-complete -F _compare compare
-
-_conjure()
-{
- local cur
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
-
- _ImageMagick
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-debug -help -list -log -monitor -quiet \
- -regard-warnings -seed -verbose -version' -- "$cur" ) )
- elif [[ "$cur" == +* ]]; then
- COMPREPLY=( $( compgen -W '+debug' -- "$cur" ) )
- else
- _filedir
- fi
-}
-complete -F _conjure conjure
-
-_import()
-{
- local cur
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
-
- _ImageMagick
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-adjoin -annotate -border -channel \
- -colors -colorspace -comment -compress -crop -debug \
- -define -delay -density -depth -descend -display \
- -dispose -dither -encipher -encoding -endian -filter \
- -format -frame -geometry -gravity -help -identify \
- -interlace -interpolate -label -limit -list -log \
- -monitor -monochrome -negate -page -pause -pointsize \
- -quality -quantize -quiet -regard-warnings -repage \
- -resize -respect-parenthesis -rotate -sampling-factor \
- -scene -screen -seed -set -silent -snaps -strip \
- -thumbnail -transparent -transparent-color -treedepth \
- -trim -type -verbose -version -virtual-pixel \
- -window' -- "$cur" ) )
- elif [[ "$cur" == +* ]]; then
- COMPREPLY=( $( compgen -W '+debug' -- "$cur" ) )
- else
- _filedir
- fi
-}
-complete -F _import import
-
-_stream()
-{
- local cur
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
-
- _ImageMagick
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-authenticate -channel -colorspace \
- -compress -debug -define -density -depth -extract \
- -help -identify -interlace -interpolate -limit -list \
- -log -map -monitor -quantize -quiet -regard-warnings \
- -respect-parenthesis -sampling-factor -seed -set \
- -size -storage-type -transparent-color -verbose \
- -version -virtual-pixel' -- "$cur" ) )
- elif [[ "$cur" == +* ]]; then
- COMPREPLY=( $( compgen -W '+debug' -- "$cur" ) )
- else
- _filedir
- fi
-}
-complete -F _stream stream
-}
-
-# 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/info b/completions/info
index 367cadef..aa16be69 100644
--- a/completions/info
+++ b/completions/info
@@ -1,22 +1,47 @@
-# bash completion for info
+# bash completion for info -*- shell-script -*-
-have info &&
_info()
{
- local cur i infopath
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
+ local cur prev words cword split
+ _init_completion -s || return
_expand || return 0
- # default completion if parameter contains /
- if [[ "$cur" == */* ]]; then
+ # default completion if parameter looks like a path
+ if [[ "$cur" == @(*/|[.~])* ]]; then
_filedir
return 0
fi
- infopath='/usr/share/info'
+ case $prev in
+ -k|--apropos|--index-search|-n|--node|-h|--help|-v|--version)
+ return
+ ;;
+ -d)
+ if [[ ${1##*/} == info ]]; then
+ _filedir -d
+ return
+ fi
+ ;;
+ --directory)
+ _filedir -d
+ return
+ ;;
+ --dribble|-f|--file|-o|--output|--restore|-r|--raw-filename|--rcfile)
+ _filedir
+ return
+ ;;
+ esac
+
+ $split && return
+
+ if [[ $cur == -* ]]; then
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
+ [[ $COMPREPLY == *= ]] && compopt -o nospace
+ return
+ fi
+
+ local i infopath=/usr/share/info
if [ "${INFOPATH: -1:1}" == ':' ]; then
infopath=${INFOPATH}${infopath}
@@ -38,8 +63,8 @@ _info()
# weed out info dir file
for (( i=0 ; i < ${#COMPREPLY[@]} ; ++i )); do
if [ "${COMPREPLY[$i]}" == 'dir' ]; then
- unset COMPREPLY[$i];
- fi;
+ unset COMPREPLY[$i]
+ fi
done
# strip suffix from info pages
COMPREPLY=( ${COMPREPLY[@]%.@(gz|bz2|xz|lzma)} )
@@ -47,12 +72,6 @@ _info()
return 0
} &&
-complete -F _info info
-
-# Local variables:
-# mode: shell-script
-# sh-basic-offset: 4
-# sh-indent-comment: t
-# indent-tabs-mode: nil
-# End:
+complete -F _info info pinfo
+
# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/inject b/completions/inject
new file mode 100644
index 00000000..da2d9a9e
--- /dev/null
+++ b/completions/inject
@@ -0,0 +1,26 @@
+# mailman inject completion -*- shell-script -*-
+
+_inject()
+{
+ local cur prev words cword split
+ _init_completion -s || return
+
+ case $prev in
+ -l|--listname)
+ _xfunc list_lists _mailman_lists
+ return 0
+ ;;
+ esac
+
+ $split && return 0
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--listname --queue --help' -- "$cur" ) )
+ else
+ _filedir
+ fi
+
+} &&
+complete -F _inject inject
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/insmod b/completions/insmod
new file mode 100644
index 00000000..725678e8
--- /dev/null
+++ b/completions/insmod
@@ -0,0 +1,34 @@
+# Linux insmod(8), modprobe(8) and modinfo(8) completion -*- shell-script -*-
+# This completes on the list of all available modules for the version of the
+# kernel currently running.
+#
+_insmod()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ # behave like lsmod for modprobe -r
+ if [[ ${1##*/} == modprobe && "${words[1]}" == -r ]]; then
+ _installed_modules "$cur"
+ return 0
+ fi
+
+ # do filename completion if we're giving a path to a module
+ if [[ "$cur" == @(*/|[.~])* ]]; then
+ _filedir '@(?(k)o?(.gz))'
+ return 0
+ fi
+
+ if [[ $cword -gt 1 && "${words[cword-1]}" != -* ]]; then
+ # do module parameter completion
+ COMPREPLY=( $( compgen -W "$( /sbin/modinfo -p ${words[1]} | \
+ cut -d: -f1 )" -- "$cur" ) )
+ else
+ _modules $(uname -r)
+ fi
+
+ return 0
+} &&
+complete -F _insmod insmod modprobe modinfo
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/installpkg b/completions/installpkg
new file mode 100644
index 00000000..956f5d0c
--- /dev/null
+++ b/completions/installpkg
@@ -0,0 +1,32 @@
+# Slackware Linux installpkg completion -*- shell-script -*-
+
+_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
+
+# 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..fd2c1db0
--- /dev/null
+++ b/completions/invoke-rc.d
@@ -0,0 +1,39 @@
+# invoke-rc.d(8) completion -*- shell-script -*-
+#
+# Copyright (C) 2004 Servilio Afre Puentes <servilio@gmail.com>
+
+_invoke_rc_d()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ local sysvdir services options valid_options
+
+ [ -d /etc/rc.d/init.d ] && sysvdir=/etc/rc.d/init.d \
+ || sysvdir=/etc/init.d
+
+ services=( $( printf '%s ' $sysvdir/!(README*|*.sh|$_backup_glob) ) )
+ services=( ${services[@]#$sysvdir/} )
+ options=( --help --quiet --force --try-anyway --disclose-deny --query \
+ --no-fallback )
+
+ if [[ ($cword -eq 1) || ("$prev" == --* ) ]]; then
+ valid_options=( $( \
+ tr " " "\n" <<<"${words[@]} ${options[@]}" \
+ | 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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/ionice b/completions/ionice
new file mode 100644
index 00000000..6d9bdd46
--- /dev/null
+++ b/completions/ionice
@@ -0,0 +1,57 @@
+# ionice(1) completion -*- shell-script -*-
+
+_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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/iproute2 b/completions/ip
index f5d7bbd9..08ee74fe 100644
--- a/completions/iproute2
+++ b/completions/ip
@@ -1,11 +1,9 @@
-# iproute2 tools completion
+# ip(8) completion -*- shell-script -*-
-have ip &&
_ip()
{
- COMPREPLY=()
local cur prev words cword
- _get_comp_words_by_ref cur prev words cword
+ _init_completion || return
case $prev in
-V|-Version|-rc|-rcvbuf)
@@ -39,7 +37,7 @@ _ip()
-*)
local c="-Version -statistics -details -resolve -family
-oneline -timestamp -batch -rcvbuf"
- [[ $cword -eq 1 ]] && c="$c -force"
+ [[ $cword -eq 1 ]] && c+=" -force"
COMPREPLY=( $( compgen -W "$c" -- "$cur" ) )
return 0
;;
@@ -91,7 +89,7 @@ _ip()
local c="arp dynamic multicast allmulticast
promisc trailers txqueuelen name address
broadcast mtu netns alias"
- [[ $prev != @(up|down) ]] && c="$c up down"
+ [[ $prev != @(up|down) ]] && c+=" up down"
COMPREPLY=( $( compgen -W "$c" -- "$cur" ) )
;;
esac
@@ -276,10 +274,4 @@ _ip()
} &&
complete -F _ip ip
-# 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/ipmitool b/completions/ipmitool
index 3a90eeb4..81a6466f 100644
--- a/completions/ipmitool
+++ b/completions/ipmitool
@@ -1,6 +1,4 @@
-# bash completion for ipmitool
-
-have ipmitool && {
+# bash completion for ipmitool -*- shell-script -*-
_ipmitool_singleline_help()
{
@@ -10,10 +8,8 @@ _ipmitool_singleline_help()
_ipmitool()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-h|-V|-p|-U|-e|-k|-y|-P|-m|-b|-t|-B|-T|-l)
@@ -42,8 +38,7 @@ _ipmitool()
return 0
;;
-C)
- COMPREPLY=( $( compgen -W '0 1 2 3 4 5 6 7 8 9 10 11 12 13 14' \
- -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '{0..14}' -- "$cur" ) )
return 0
;;
-L)
@@ -63,8 +58,7 @@ _ipmitool()
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-h -V -v -c -d -I -H -p -U -f -S -a \
- -e -C -k -y -L -A -P -E -K -m -b -t -B -T -l -o -O' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" -h)' -- "$cur" ) )
return 0
fi
@@ -74,10 +68,10 @@ _ipmitool()
sel pef sol tsol isol user channel session sunoem kontronoem picmg fwum
firewall shell exec set hpm ekanalyzer)
local i c cmd subcmd
- for (( i=1; i < ${#COMP_WORDS[@]}-1; i++ )); do
- [[ -n $cmd ]] && subcmd=${COMP_WORDS[i]} && break
+ for (( i=1; i < ${#words[@]}-1; i++ )); do
+ [[ -n $cmd ]] && subcmd=${words[i]} && break
for c in ${cmds[@]}; do
- [ ${COMP_WORDS[i]} = $c ] && cmd=$c && break
+ [ ${words[i]} = $c ] && cmd=$c && break
done
done
@@ -200,15 +194,7 @@ _ipmitool()
;;
esac
-}
-
} &&
complete -F _ipmitool ipmitool
-# 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/ipsec b/completions/ipsec
index acb8c995..1a081028 100644
--- a/completions/ipsec
+++ b/completions/ipsec
@@ -1,22 +1,31 @@
-# Linux ipsec(8) completion (for FreeS/WAN)
+# Linux ipsec(8) completion (for FreeS/WAN and strongSwan) -*- shell-script -*-
+
+# Complete ipsec.conf conn entries.
#
-[ $UNAME = Linux ] && have ipsec &&
-_ipsec()
+# Reads a file from stdin in the ipsec.conf(5) format.
+_ipsec_connections()
{
- local cur
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
+ local keyword name
+ while read -r keyword name; do
+ if [[ $keyword = [#]* ]]; then continue; fi
+ [[ $keyword == conn && $name != '%default' ]] && COMPREPLY+=( "$name" )
+ done
+ COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) )
+}
+_ipsec_freeswan()
+{
+ local cur prev words cword
+ _init_completion || return
- if [ $COMP_CWORD -eq 1 ]; then
+ if [ $cword -eq 1 ]; then
COMPREPLY=( $( compgen -W 'auto barf eroute klipsdebug look manual \
pluto ranbits rsasigkey setup showdefaults showhostkey spi spigrp \
tncfg whack' -- "$cur" ) )
return 0
fi
- case ${COMP_WORDS[1]} in
+ case ${words[1]} in
auto)
COMPREPLY=( $( compgen -W '--asynchronous --up --add --delete \
--replace --down --route --unroute \
@@ -39,13 +48,61 @@ _ipsec()
esac
return 0
-} &&
-complete -F _ipsec ipsec
-
-# Local variables:
-# mode: shell-script
-# sh-basic-offset: 4
-# sh-indent-comment: t
-# indent-tabs-mode: nil
-# End:
+}
+
+_ipsec_strongswan()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ if [ $cword -eq 1 ]; then
+ COMPREPLY=( $( compgen -W 'down irdumm leases listaacerts listacerts \
+ listalgs listall listcacerts listcainfos listcards listcerts \
+ listcrls listgroups listocsp listocspcerts listpubkeys openac pki
+ pluto pool purgecerts purgecrls purgeike purgeocsp ready reload \
+ rereadaacerts rereadacerts rereadall rereadcacerts rereadcrls \
+ rereadgroups rereadocspcerts rereadsecrets restart route scdecrypt \
+ scencrypt scepclient secrets start starter status statusall stop \
+ stroke unroute uci up update version whack --confdir --copyright \
+ --directory --help --version --versioncode' -- "$cur" ) )
+ return 0
+ fi
+
+ case ${words[1]} in
+ down|route|status|statusall|unroute|up)
+ local confdir=$( ipsec --confdir )
+ _ipsec_connections < "$confdir/ipsec.conf"
+ ;;
+ list*)
+ COMPREPLY=( $( compgen -W '--utc' -- "$cur" ) )
+ ;;
+ restart|start)
+ COMPREPLY=( $( compgen -W '--attach-gdb --auto-update --debug \
+ --debug-all --debug-more --nofork' -- "$cur" ) )
+ ;;
+ pki)
+ COMPREPLY=( $( compgen -W '--gen --issue --keyid --print --pub \
+ --req --self --signcrl --verify' -- "$cur" ) )
+ ;;
+ pool)
+ ;;
+ irdumm)
+ _filedir 'rb'
+ ;;
+ *)
+ ;;
+ esac
+
+ return 0
+}
+
+case "$( ipsec --version 2>/dev/null )" in
+ *strongSwan*)
+ complete -F _ipsec_strongswan ipsec
+ ;;
+ *)
+ complete -F _ipsec_freeswan ipsec
+ ;;
+esac
+
# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/iptables b/completions/iptables
index bd0e4622..b9314f23 100644
--- a/completions/iptables
+++ b/completions/iptables
@@ -1,24 +1,20 @@
-# bash completion for iptables
+# bash completion for iptables -*- shell-script -*-
-have iptables &&
_iptables()
{
- local cur prev table chain
+ local cur prev words cword split
+ _init_completion -s || return
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
- chain='s/^Chain \([^ ]\{1,\}\).*$/\1/p'
+ local table chain='s/^Chain \([^ ]\{1,\}\).*$/\1/p'
- if [[ $COMP_LINE == *-t\ *filter* ]]; then
+ if [[ ${words[@]} == *-t\ *filter* ]]; then
table="-t filter"
- elif [[ $COMP_LINE == *-t\ *nat* ]]; then
+ elif [[ ${words[@]} == *-t\ *nat* ]]; then
table="-t nat"
- elif [[ $COMP_LINE == *-t\ *mangle* ]]; then
+ elif [[ ${words[@]} == *-t\ *mangle* ]]; then
table="-t mangle"
fi
- _split_longopt
-
case $prev in
-*[AIDRPFXLZ])
COMPREPLY=( $( compgen -W '`iptables $table -nL | \
@@ -61,10 +57,4 @@ _iptables()
} &&
complete -F _iptables iptables
-# 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/ipv6calc b/completions/ipv6calc
index 20e810df..102f8327 100644
--- a/completions/ipv6calc
+++ b/completions/ipv6calc
@@ -1,14 +1,9 @@
-have ipv6calc &&
+# ipv6calc completion -*- shell-script -*-
+
_ipv6calc()
{
- local cur prev split=false
-
- COMPREPLY=()
- _get_comp_words_by_ref -n = cur prev
- #cur=`_get_cword =`
- #prev=`_get_pword`
-
- _split_longopt && split=true
+ local cur prev words cword split
+ _init_completion -s || return
case "$prev" in
-d|--debug)
@@ -48,10 +43,4 @@ _ipv6calc()
} &&
complete -F _ipv6calc ipv6calc
-# 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/open-iscsi b/completions/iscsiadm
index 8c650d59..326dc208 100644
--- a/completions/open-iscsi
+++ b/completions/iscsiadm
@@ -1,42 +1,36 @@
-# iscsiadm(1) completion
+# iscsiadm(1) completion -*- shell-script -*-
-have iscsiadm &&
_iscsiadm()
{
- local cur prev mode split=false
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- _split_longopt && split=true
+ local cur prev words cword split
+ _init_completion -s || return
case $prev in
-m|--mode)
COMPREPLY=( $( compgen -W 'discovery node session iface fw host' \
-- "$cur" ) )
- return 0;
+ return 0
;;
-o|--op)
COMPREPLY=( $( compgen -W 'new delete update show' -- "$cur" ) )
- return 0;
+ return 0
;;
-t|--type)
COMPREPLY=( $( compgen -W 'sendtargets st slp isns fw' -- "$cur" ) )
- return 0;
+ return 0
;;
-L|-U|--loginall|--logoutall)
COMPREPLY=( $( compgen -W 'all manual automatic' -- "$cur" ) )
- return 0;
+ return 0
;;
esac
$split && return 0
local options
- if [[ $COMP_CWORD -gt 1 ]] ; then
- mode=${COMP_WORDS[2]}
+ if [[ $cword -gt 1 ]] ; then
- case $mode in
+ case ${words[2]} in
discovery)
options='--help --version --debug --print --interface --type \
--portal --login --op --name --value'
@@ -69,10 +63,4 @@ _iscsiadm()
} &&
complete -F _iscsiadm iscsiadm
-# 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/isql b/completions/isql
index f0ddbd75..695654f3 100644
--- a/completions/isql
+++ b/completions/isql
@@ -1,20 +1,14 @@
-# isql completion by Victor Bogado da Silva Lins <victor@bogado.net>
+# isql completion -*- shell-script -*-
+# by Victor Bogado da Silva Lins <victor@bogado.net>
-have isql &&
_isql()
{
- local cur
- _get_comp_words_by_ref cur
+ local cur prev words cword
+ _init_completion || return
[ -f "$ODBCINI" ] \
&& COMPREPLY=( $( command grep \\["$cur" "$ODBCINI" | tr -d \\[\\] ) )
} &&
complete -F _isql isql
-# 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/iwconfig b/completions/iwconfig
new file mode 100644
index 00000000..81dda723
--- /dev/null
+++ b/completions/iwconfig
@@ -0,0 +1,90 @@
+# iwconfig completion -*- shell-script -*-
+
+_iwconfig()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ case $prev in
+ mode)
+ COMPREPLY=( $( compgen -W 'managed ad-hoc master \
+ repeater secondary monitor' -- "$cur" ) )
+ return 0
+ ;;
+ essid)
+ COMPREPLY=( $( compgen -W 'on off any' -- "$cur" ) )
+ if [ -n "${COMP_IWLIST_SCAN:-}" ]; then
+ COMPREPLY+=( $( compgen -W \
+ "$( iwlist ${words[1]} scan | \
+ awk -F'\"' '/ESSID/ {print $2}' )" -- "$cur" ) )
+ fi
+ return 0
+ ;;
+ nwid)
+ COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) )
+ return 0
+ ;;
+ channel)
+ COMPREPLY=( $( compgen -W "$( iwlist ${words[1]} channel | \
+ awk '/^[ \t]*Channel/ {print $2}' )" -- "$cur" ) )
+ return 0
+ ;;
+
+ freq)
+ COMPREPLY=( $( compgen -W "$( iwlist ${words[1]} channel | \
+ awk '/^[ \t]*Channel/ {print $4"G"}')" -- "$cur" ) )
+ return 0
+ ;;
+ ap)
+ COMPREPLY=( $( compgen -W 'on off any' -- "$cur" ) )
+ if [ -n "${COMP_IWLIST_SCAN:-}" ]; then
+ COMPREPLY+=( $( compgen -W \
+ "$( iwlist ${words[1]} scan | \
+ awk -F ': ' '/Address/ {print $2}' )" -- "$cur" ) )
+ fi
+ return 0
+ ;;
+ rate)
+ COMPREPLY=( $( compgen -W 'auto fixed' -- "$cur" ) )
+ COMPREPLY+=( $( compgen -W \
+ "$( iwlist ${words[1]} rate | \
+ awk '/^[ \t]*[0-9]/ {print $1"M"}' )" -- "$cur" ) )
+ return 0
+ ;;
+ rts|frag)
+ COMPREPLY=( $( compgen -W 'auto fixed off' -- "$cur" ) )
+ return 0
+ ;;
+ key|enc)
+ COMPREPLY=( $( compgen -W 'off on open restricted' -- "$cur" ) )
+ return 0
+ ;;
+ power)
+ COMPREPLY=( $( compgen -W 'period timeout off on' -- "$cur" ) )
+ return 0
+ ;;
+ txpower)
+ COMPREPLY=( $( compgen -W 'off on auto' -- "$cur" ) )
+ return 0
+ ;;
+ retry)
+ COMPREPLY=( $( compgen -W 'limit lifetime' -- "$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 'essid nwid mode freq channel sens mode \
+ ap nick rate rts frag enc key power txpower commit' -- "$cur" ) )
+ fi
+
+} &&
+complete -F _iwconfig iwconfig
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/iwlist b/completions/iwlist
new file mode 100644
index 00000000..39bfa0f1
--- /dev/null
+++ b/completions/iwlist
@@ -0,0 +1,22 @@
+# iwlist completion -*- shell-script -*-
+
+_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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/iwpriv b/completions/iwpriv
new file mode 100644
index 00000000..b0d45043
--- /dev/null
+++ b/completions/iwpriv
@@ -0,0 +1,31 @@
+# iwpriv completion -*- shell-script -*-
+
+_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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/iwspy b/completions/iwspy
new file mode 100644
index 00000000..4bffc76e
--- /dev/null
+++ b/completions/iwspy
@@ -0,0 +1,20 @@
+# iwspy completion -*- shell-script -*-
+
+_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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/jar b/completions/jar
index d703019d..f16d7f70 100644
--- a/completions/jar
+++ b/completions/jar
@@ -1,24 +1,21 @@
-# jar(1) completion
+# jar(1) completion -*- shell-script -*-
-have jar &&
_jar()
{
- local cur
+ local cur prev words cword
+ _init_completion || return
- COMPREPLY=()
- _get_comp_words_by_ref cur
-
- if [ $COMP_CWORD = 1 ]; then
+ if [[ $cword -eq 1 ]]; then
COMPREPLY=( $( compgen -W 'c t x u' -- "$cur" ) )
return 0
fi
- case ${COMP_WORDS[1]} in
+ case ${words[1]} in
*c*f)
_filedir
;;
*f)
- _filedir '@([ejw]ar|zip|apk)'
+ _filedir '@([ejsw]ar|zip|apk)'
;;
*)
_filedir
@@ -27,10 +24,4 @@ _jar()
} &&
complete -F _jar jar
-# 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/jarsigner b/completions/jarsigner
new file mode 100644
index 00000000..02befae7
--- /dev/null
+++ b/completions/jarsigner
@@ -0,0 +1,56 @@
+# jarsigner(1) completion -*- shell-script -*-
+
+_jarsigner()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ case $prev in
+ -keystore)
+ COMPREPLY=( $( compgen -W 'NONE' -- "$cur" ) )
+ _filedir '@(jks|ks|p12|pfx)'
+ return 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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/java b/completions/java
index 460ae285..e02f7369 100644
--- a/completions/java
+++ b/completions/java
@@ -1,23 +1,21 @@
-# bash completion for java, javac and javadoc
+# bash completion for java, javac and javadoc -*- shell-script -*-
# 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()
{
local i
# search first in current options
- for (( i=1; i < COMP_CWORD; i++ )); do
- if [[ "${COMP_WORDS[i]}" == -@(cp|classpath) ]]; then
- classpath=${COMP_WORDS[i+1]}
+ for (( i=1; i < cword; i++ )); do
+ if [[ "${words[i]}" == -@(cp|classpath) ]]; then
+ classpath=${words[i+1]}
break
fi
done
@@ -35,15 +33,16 @@ _java_find_sourcepath()
local i
# search first in current options
- for (( i=1; i < COMP_CWORD; i++ )); do
- if [[ "${COMP_WORDS[i]}" == -sourcepath ]]; then
- sourcepath=${COMP_WORDS[i+1]}
+ for (( i=1; i < cword; i++ )); do
+ if [[ "${words[i]}" == -sourcepath ]]; then
+ sourcepath=${words[i+1]}
break
fi
done
# default to classpath
if [ -z "$sourcepath" ]; then
+ local classpath
_java_find_classpath
sourcepath=$classpath
fi
@@ -63,20 +62,20 @@ _java_classes()
for i in ${classpath//:/ }; do
if [[ "$i" == *.@(jar|zip) && -r $i ]]; then
if type zipinfo &>/dev/null; then
- COMPREPLY=( "${COMPREPLY[@]}" $( zipinfo -1 \
- "$i" "$cur*" 2>/dev/null | \
+ COMPREPLY+=( $( zipinfo -1 "$i" "$cur*" 2>/dev/null | \
command grep '^[^$]*\.class$' ) )
else
- COMPREPLY=( "${COMPREPLY[@]}" $( jar tf "$i" \
- "$cur" | command grep '^[^$]*\.class$' ) )
+ COMPREPLY+=( $( jar tf "$i" "$cur" | \
+ command grep '^[^$]*\.class$' ) )
fi
elif [ -d $i ]; then
- # Intentionally looking for *.class only in $i (not subdirs),
- # see Debian bug #496828.
- COMPREPLY=( "${COMPREPLY[@]}"
- $( command ls $i/$cur*.class 2>/dev/null | \
- sed -ne '/\$/d' -e "s|^$i//*||p" ) )
+ COMPREPLY+=(
+ $( compgen -d -- "$i/$cur" | sed -e "s|^$i/\(.*\)|\1.|" )
+ $( compgen -f -X '!*.class' -- "$i/$cur" | \
+ sed -e '/\$/d' -e "s|^$i/||" )
+ )
+ [[ $COMPREPLY == *.class ]] || compopt -o nospace
# FIXME: if we have foo.class and foo/, the completion
# returns "foo/"... how to give precedence to files
@@ -103,8 +102,8 @@ _java_packages()
# parse each sourcepath element for packages
for i in ${sourcepath//:/ }; do
if [ -d $i ]; then
- COMPREPLY=( "${COMPREPLY[@]}" $( command ls -F -d \
- $i/$cur* 2>/dev/null | sed -e 's|^'$i'/||' ) )
+ COMPREPLY+=( $( command ls -F -d $i/$cur* 2>/dev/null | \
+ sed -e 's|^'$i'/||' ) )
fi
done
# keep only packages
@@ -114,17 +113,15 @@ _java_packages()
# convert path syntax to package syntax
cur=${COMPREPLY[@]//\//.}
}
-}
# java completion
#
-have java &&
_java()
{
- local cur prev words cword i
+ local cur prev words cword
+ _init_completion -n : || return
- COMPREPLY=()
- _get_comp_words_by_ref -n : cur prev words cword
+ local i
for ((i=1; i < $cword; i++)); do
case ${words[$i]} in
@@ -214,11 +211,9 @@ _java()
esac
if [[ "$cur" == -* ]]; then
- # standard options
- COMPREPLY=( $( compgen -W '-client -server -agentlib: -agentpath:
- -classpath -D -d32 -d64 -enableassertions -disableassertions
- -enablesystemassertions -disablesystemassertions -jar -javaagent:
- -verbose -verbose -version -showversion -help -X' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" -help )' -- "$cur" ) )
+ [[ $cur == -X* ]] && \
+ COMPREPLY+=( $( compgen -W '$( _parse_help "$1" -X )' -- "$cur" ) )
else
if [[ "$prev" == -jar ]]; then
# jar file completion
@@ -229,20 +224,16 @@ _java()
fi
fi
- [[ ${#COMPREPLY[@]} -eq 1 && ${COMPREPLY[0]} == -*[:=] ]] && \
- type compopt &>/dev/null && compopt -o nospace
+ [[ $COMPREPLY == -*[:=] ]] && compopt -o nospace
__ltrim_colon_completions "$cur"
} &&
complete -F _java java
-have javadoc &&
_javadoc()
{
- COMPREPLY=()
- local cur prev classpath
-
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-overview|-helpfile)
@@ -254,7 +245,6 @@ _javadoc()
return 0
;;
-d|-link|-linkoffline)
- # TODO: -linkoffline takes two arguments
_filedir -d
return 0
;;
@@ -264,21 +254,14 @@ _javadoc()
;;
esac
+ # -linkoffline takes two arguments
+ if [[ $cword -gt 2 && ${words[$cword-2]} == -linkoffline ]]; then
+ _filedir -d
+ return
+ fi
+
if [[ "$cur" == -* ]]; then
- # relevant options completion
- COMPREPLY=( $( compgen -W '-overview -public -protected \
- -package -private -help -doclet -docletpath \
- -sourcepath -classpath -exclude -subpackages \
- -breakiterator -bootclasspath -source -extdirs \
- -verbose -locale -encoding -J -d -use -version \
- -author -docfilessubdirs -splitindex \
- -windowtitle -doctitle -header -footer -bottom \
- -link -linkoffline -excludedocfilessubdir \
- -group -nocomment -nodeprecated -noqualifier \
- -nosince -nodeprecatedlist -notree -noindex \
- -nohelp -nonavbar -quiet -serialwarn -tag \
- -taglet -tagletpath -charset -helpfile \
- -linksource -stylesheetfile -docencoding' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" -help )' -- "$cur" ) )
else
# source files completion
_filedir java
@@ -288,13 +271,10 @@ _javadoc()
} &&
complete -F _javadoc javadoc
-have javac &&
_javac()
{
- COMPREPLY=()
- local cur prev
-
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion -n : || return
case $prev in
-d)
@@ -307,227 +287,32 @@ _javac()
;;
esac
+ if [[ $cur == -+([a-zA-z0-9-_]):* ]]; then
+ # Parse required options from -foo:{bar,quux,baz}
+ local helpopt=-help
+ [[ $cur == -X* ]] && helpopt=-X
+ # For some reason there may be -g:none AND -g:{lines,source,vars};
+ # convert the none case to the curly brace format so it parses like
+ # the others.
+ local opts=$( "$1" $helpopt 2>&1 | sed -e 's/-g:none/-g:{none}/' -ne \
+ "s/^[[:space:]]*${cur%%:*}:{\([^}]\{1,\}\)}.*/\1/p" )
+ COMPREPLY=( $( compgen -W "${opts//,/ }" -- "${cur#*:}" ) )
+ return
+ fi
+
if [[ "$cur" == -* ]]; then
- # relevant options completion
- COMPREPLY=( $( compgen -W '-g -g:none -g:lines -g:vars \
- -g:source -O -nowarn -verbose -deprecation -classpath \
- -sourcepath -bootclasspath -extdirs -d -encoding -source \
- -target -help' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" -help )' -- "$cur" ) )
+ [[ $cur == -X* ]] && \
+ COMPREPLY+=( $( compgen -W '$( _parse_help "$1" -X )' -- "$cur" ) )
else
# source files completion
_filedir java
fi
-} &&
-complete -F _javac javac
-
-have pack200 &&
-_pack200()
-{
- COMPREPLY=()
- local cur prev
- _get_comp_words_by_ref cur prev
-
- 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 1 2 3 4 5 6 7 8 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
-
- # Check if a pack or a jar was already given.
- local i pack=false jar=false
- for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )) ; do
- case ${COMP_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[@]} -eq 1 && ${COMPREPLY[0]} == *= ]] && \
- type compopt &>/dev/null && compopt -o nospace
- else
- _filedir 'pack?(.gz)'
- fi
- elif ! $jar ; then
- _filedir jar
- fi
-} &&
-complete -F _pack200 pack200
-have unpack200 &&
-_unpack200()
-{
- COMPREPLY=()
- local cur prev
- _get_comp_words_by_ref cur prev
+ [[ $COMPREPLY == -*[:=] ]] && compopt -o nospace
- 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
-
- # Check if a pack or a jar was already given.
- local i pack=false jar=false
- for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )) ; do
- case ${COMP_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[@]} -eq 1 && ${COMPREPLY[0]} == *= ]] && \
- type compopt &>/dev/null && compopt -o nospace
- else
- _filedir 'pack?(.gz)'
- fi
- elif ! $jar ; then
- _filedir jar
- fi
-} &&
-complete -F _unpack200 unpack200
-
-have jarsigner &&
-_jarsigner()
-{
- COMPREPLY=()
- local cur prev
- _get_comp_words_by_ref cur prev
-
- 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 < ${#COMP_WORDS[@]}-1; i++ )) ; do
- if [[ "${COMP_WORDS[i]}" == *.jar && \
- "${COMP_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
+ __ltrim_colon_completions "$cur"
} &&
-complete -F _jarsigner jarsigner
-
-have javaws &&
-_javaws()
-{
- COMPREPLY=()
- local cur prev
- _get_comp_words_by_ref cur prev
-
- 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
- COMPREPLY=( $( compgen -W "$( _parse_help "$1" -help ) " -- "$cur" ) )
- return 0
- fi
+complete -F _javac javac
- _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/javaws b/completions/javaws
new file mode 100644
index 00000000..b9afefd7
--- /dev/null
+++ b/completions/javaws
@@ -0,0 +1,34 @@
+# javaws(1) completion -*- shell-script -*-
+
+_javaws()
+{
+ local cur prev words cword
+ _init_completion -n = || return
+
+ case $prev in
+ -help|-license|-about|-viewer|-arg|-param|-property|-update|-umask)
+ return 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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/jps b/completions/jps
new file mode 100644
index 00000000..774ad6ce
--- /dev/null
+++ b/completions/jps
@@ -0,0 +1,25 @@
+# jps(1) completion -*- shell-script -*-
+
+_jps()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ case $prev in
+ -J*|-help)
+ return
+ ;;
+ esac
+
+ if [[ $cur == -* ]]; then
+ # Not using _parse_usage because output has [-help] which does not
+ # mean -h, -e, -l, -p...
+ COMPREPLY=( $( compgen -W "-q -m -l -v -V -J -help" -- "$cur" ) )
+ [[ $COMPREPLY == -J* ]] && compopt -o nospace
+ else
+ _known_hosts_real "$cur"
+ fi
+} &&
+complete -F _jps jps
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/k3b b/completions/k3b
index 1965717b..9c03642f 100644
--- a/completions/k3b
+++ b/completions/k3b
@@ -1,11 +1,9 @@
-# bash completion for k3b
+# bash completion for k3b -*- shell-script -*-
-have k3b &&
_k3b()
{
- local cur prev
- _get_comp_words_by_ref cur prev
- COMPREPLY=()
+ local cur prev words cword
+ _init_completion || return
case $prev in
--help*|--author|-v|--version|--license|--lang)
@@ -40,16 +38,11 @@ _k3b()
if [[ "$cur" == -* ]] ; then
COMPREPLY=( $( compgen -W "$( _parse_help "$1" )" -- "$cur" ) )
+ [[ $COMPREPLY == *= ]] && compopt -o nospace
else
_filedir
fi
} &&
complete -F _k3b k3b
-# 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/kcov b/completions/kcov
new file mode 100644
index 00000000..e0f37fdb
--- /dev/null
+++ b/completions/kcov
@@ -0,0 +1,39 @@
+# kcov completion -*- shell-script -*-
+
+_kcov()
+{
+ local cur prev words cword split
+ _init_completion -s || return
+
+ case "$prev" in
+ --pid|-p)
+ _pids
+ return 0
+ ;;
+ --sort-type|-s)
+ COMPREPLY=( $( compgen -W 'filename percentage' -- "$cur" ) )
+ return 0
+ ;;
+ --include-path|--exclude-path)
+ _filedir
+ return 0
+ ;;
+ --limits|-l|--title|-t|--include-pattern|--exclude-pattern|\
+ --path-strip-level)
+ # argument required but no completions available
+ return 0
+ ;;
+ esac
+
+ $split && return 0
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" --help )' -- "$cur" ) )
+ [[ $COMPREPLY == *= ]] && compopt -o nospace
+ return 0
+ fi
+
+ _filedir
+} && complete -F _kcov kcov
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/kill b/completions/kill
new file mode 100644
index 00000000..ed5ae585
--- /dev/null
+++ b/completions/kill
@@ -0,0 +1,29 @@
+# kill(1) completion -*- shell-script -*-
+
+_kill()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ case $prev in
+ -s)
+ _signals
+ return
+ ;;
+ -l)
+ return
+ ;;
+ esac
+
+ if [[ $cword -eq 1 && "$cur" == -* ]]; then
+ # return list of available signals
+ _signals -
+ COMPREPLY+=( $( compgen -W "-s -l" -- "$cur" ) )
+ else
+ # return list of available PIDs
+ _pids
+ fi
+} &&
+complete -F _kill kill
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/killall b/completions/killall
new file mode 100644
index 00000000..d2f6dd47
--- /dev/null
+++ b/completions/killall
@@ -0,0 +1,35 @@
+# killall(1) and pkill(1) completion -*- shell-script -*-
+
+_killall()
+{
+ local cur prev words cword split
+ _init_completion -s || return
+
+ case $prev in
+ -Z|--context|-o|--older-than|-y|--younger-than|-V|--version)
+ return
+ ;;
+ -s|--signal)
+ [[ $1 == *killall ]] && _signals
+ return
+ ;;
+ -u|--user)
+ _allowed_users
+ return
+ ;;
+ esac
+
+ $split && 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 || :
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/kldload b/completions/kldload
index e5bce0a3..26ab0e19 100644
--- a/completions/kldload
+++ b/completions/kldload
@@ -1,40 +1,22 @@
-# bash completion for FreeBSD kernel module commands
+# FreeBSD kldload completion -*- shell-script -*-
-[ $UNAME = FreeBSD ] &&
-{
+[[ $OSTYPE == *freebsd* ]] || return 1
_kldload()
{
- local cur moddir
+ local cur prev words cword
+ _init_completion || return
- moddir=/modules/
+ local moddir=/modules/
[ -d $moddir ] || moddir=/boot/kernel/
- _get_comp_words_by_ref cur
- _compopt_o_filenames
+ compopt -o filenames
COMPREPLY=( $( compgen -f "$moddir$cur" ) )
COMPREPLY=( ${COMPREPLY[@]#$moddir} )
COMPREPLY=( ${COMPREPLY[@]%.ko} )
return 0
-}
+} &&
complete -F _kldload kldload
-_kldunload()
-{
- local cur
- _get_comp_words_by_ref cur
- 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/kldunload b/completions/kldunload
new file mode 100644
index 00000000..adb268d8
--- /dev/null
+++ b/completions/kldunload
@@ -0,0 +1,15 @@
+# FreeBSD kldunload completion -*- shell-script -*-
+
+[[ $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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/heimdal b/completions/ktutil
index c1efb110..e0bd60bf 100644
--- a/completions/heimdal
+++ b/completions/ktutil
@@ -1,23 +1,19 @@
-# bash completion for heimdal
+# ktutil completion -*- shell-script -*-
-have ktutil && {
_heimdal_principals()
{
-
COMPREPLY=( $( compgen -W "$( kadmin -l dump 2>/dev/null | \
awk '{print $1}' )" -- "$cur" ) )
}
_heimdal_realms()
{
-
COMPREPLY=( $( compgen -W "( kadmin -l dump 2>/dev/null | \
awk '{print $1}' | awk -F@ '{print $2}' )" -- "$cur" ) )
}
_heimdal_encodings()
{
-
COMPREPLY=( $( compgen -W 'des-cbc-mcrc des-cbc-md4 des-cbc-md5 \
des3-cbc-sha1 arcfour-hmac-md5 aes128-cts-hmac-sha1-96 \
aes256-cts-hmac-sha1-96' -- "$cur" ) )
@@ -25,12 +21,10 @@ _heimdal_encodings()
_ktutil()
{
- local cur prev command options split=false
+ local cur prev words cword split
+ _init_completion -s || return
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- _split_longopt && split=true
+ local command options
case $prev in
-p|--principal)
@@ -60,15 +54,15 @@ _ktutil()
commands='add change copy get list remove rename purge srvconvert \
srv2keytab srvcreate key2srvtab'
- for (( i=1; i < COMP_CWORD; i++ )); do
- case ${COMP_WORDS[i]} in
+ for (( i=1; i < cword; i++ )); do
+ case ${words[i]} in
-k|--keytab)
i=$(($i+1))
;;
-*)
;;
*)
- command=${COMP_WORDS[i]}
+ command=${words[i]}
break
;;
esac
@@ -120,14 +114,7 @@ _ktutil()
;;
esac
fi
-}
+} &&
complete -F _ktutil ktutil
-}
-# 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/larch b/completions/larch
index e58374f7..f6f796b2 100644
--- a/completions/larch
+++ b/completions/larch
@@ -1,14 +1,12 @@
-# larch(1) completion by Alex Shinn <foof@synthcode.com>
+# larch(1) completion -*- shell-script -*-
+# by Alex Shinn <foof@synthcode.com>
-have larch &&
_larch()
{
- local cur prev
+ local cur prev words cword
+ _init_completion || return
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- if [[ $COMP_CWORD -eq 1 || "$prev" == -* ]]; then
+ if [[ $cword -eq 1 || "$prev" == -* ]]; then
COMPREPLY=( $( compgen -W ' \
my-id my-default-archive register-archive whereis-archive archives \
init-tree tree-root tree-version set-tree-version inventory \
@@ -39,10 +37,4 @@ _larch()
} &&
complete -F _larch -o default larch
-# 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/lastlog b/completions/lastlog
new file mode 100644
index 00000000..8663afd7
--- /dev/null
+++ b/completions/lastlog
@@ -0,0 +1,28 @@
+# lastlog(8) completion -*- shell-script -*-
+
+_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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/openldap b/completions/ldapsearch
index e4bbba1f..6a9b7b1b 100644
--- a/completions/openldap
+++ b/completions/ldapsearch
@@ -1,6 +1,5 @@
-# bash completion for openldap
+# bash completion for openldap -*- shell-script -*-
-have ldapsearch && {
_ldap_uris()
{
COMPREPLY=( $( compgen -W 'ldap:// ldaps://' -- "$cur" ) )
@@ -13,10 +12,8 @@ _ldap_protocols()
_ldapsearch()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-h)
@@ -51,19 +48,15 @@ _ldapsearch()
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-n -u -v -t -tt -T -F -A -C -L -LL \
- -LLL -M -MM -S -d -f -x -D -W -w -y -H -h -p -b -s -a \
- -P -e -E -l -z -O -I -Q -U -R -X -Y -Z -ZZ' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" ) -MM -ZZ' -- "$cur" ) )
fi
-}
+} &&
complete -F _ldapsearch ldapsearch
_ldapaddmodify()
{
- local cur prev options
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-h)
@@ -85,22 +78,15 @@ _ldapaddmodify()
esac
if [[ "$cur" == -* ]]; then
- options='-c -S -n -v -M -MM -d -D -W -w -y -h -H -p -P -O -I \
- -Q -U -R -x -X -Y -Z -ZZ -f'
- if [[ ${COMP_WORDS[0]} == ldapmodify ]]; then
- options="$options -a"
- fi
- COMPREPLY=( $( compgen -W "$options" -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" ) -MM -ZZ' -- "$cur" ) )
fi
-}
+} &&
complete -F _ldapaddmodify ldapadd ldapmodify
_ldapdelete()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-h)
@@ -122,18 +108,15 @@ _ldapdelete()
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-n -v -c -M -MM -d -f -D -W -w -y \
- -H -h -P -p -O -U -R -r -x -I -Q -X -Y -Z -ZZ' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" ) -MM -ZZ' -- "$cur" ) )
fi
-}
+} &&
complete -F _ldapdelete ldapdelete
_ldapcompare()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-h)
@@ -155,18 +138,15 @@ _ldapcompare()
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-n -v -z -M -MM -d -D -W -w -y \
- -H -h -P -p -O -I -Q -U -R -x -X -Y -Z -ZZ' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" ) -MM -ZZ' -- "$cur" ) )
fi
-}
+} &&
complete -F _ldapcompare ldapcompare
_ldapmodrdn()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-h)
@@ -188,18 +168,15 @@ _ldapmodrdn()
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-r -s -n -v -c -M -MM -d -D -W -w \
- -y -H -h -P -p -O -I -Q -U -R -x -X -Y -Z -ZZ -f' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" ) -ZZ -MM' -- "$cur" ) )
fi
-}
+} &&
complete -F _ldapmodrdn ldapmodrdn
_ldapwhoami()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-h)
@@ -221,18 +198,15 @@ _ldapwhoami()
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-n -v -z -d -D -W -w -y -H -h -p -P \
- -O -I -Q -U -R -x -X -Y -Z -ZZ' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" ) -MM -ZZ' -- "$cur" ) )
fi
-}
+} &&
complete -F _ldapwhoami ldapwhoami
_ldappasswd()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-h)
@@ -250,17 +224,9 @@ _ldappasswd()
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-A -a -t -d -D -H -h -n -p -S -s -T \
- -v -W -w -y -O -I -Q -U -R -x -X -Y -Z -ZZ' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" ) -MM -ZZ' -- "$cur" ) )
fi
-}
+} &&
complete -F _ldappasswd ldappasswd
-}
-# 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/ldapvi b/completions/ldapvi
index 31e26d1c..f2d2c293 100644
--- a/completions/ldapvi
+++ b/completions/ldapvi
@@ -1,12 +1,9 @@
-# bash completion for ldapvi
+# bash completion for ldapvi -*- shell-script -*-
-have ldapvi &&
_ldapvi()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-h|--host)
@@ -47,26 +44,9 @@ _ldapvi()
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--discover --out --in --delete \
- --rename -h --host -D --user -w --password --bind \
- --bind-dialog -I --sasl-interactive --bind-dialog -O \
- --sasl-secprops -Q --sasl-quiet -R --sasl-realm -U \
- --sasl-authcid -X --sasl-authzid -Y --sasl-mech -b \
- --base -s --scope -S --sort --add -o --class --config \
- -c --continue --deleteoldrdn -a --deref -d --discover \
- -A --empty --ncoding -H --help --ldap-conf -m --may -M \
- --managedsait --noquestions -! --noninteractive -q \
- --quiet -R --read -Z --starttls --tls -v --verbose \
- --ldapsearch --ldapmodify --ldapdelete --ldapmoddn' \
- -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
fi
} &&
complete -F _ldapvi ldapvi
-# 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/lftp b/completions/lftp
index 1de87aec..86706002 100644
--- a/completions/lftp
+++ b/completions/lftp
@@ -1,12 +1,9 @@
-# bash completion for lftp
+# lftp(1) completion -*- shell-script -*-
-have lftp &&
_lftp()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-f)
@@ -19,8 +16,7 @@ _lftp()
esac
if [[ "$cur" == -* ]] ; then
- COMPREPLY=( $( compgen -W '-f -c --help --version -e -u -p' \
- -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
return 0
fi
@@ -30,23 +26,4 @@ _lftp()
} &&
complete -F _lftp lftp
-have lftpget &&
-_lftpget()
-{
- COMPREPLY=()
- local cur
- _get_comp_words_by_ref cur
-
- 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/lftpget b/completions/lftpget
new file mode 100644
index 00000000..88ab31f6
--- /dev/null
+++ b/completions/lftpget
@@ -0,0 +1,14 @@
+# lftpget(1) completion -*- shell-script -*-
+
+_lftpget()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ if [[ "$cur" == -* ]] ; then
+ COMPREPLY=( $( compgen -W '-c -d -v' -- "$cur" ) )
+ fi
+} &&
+complete -F _lftpget lftpget
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/lilo b/completions/lilo
index ab0d9dc3..f81f049a 100644
--- a/completions/lilo
+++ b/completions/lilo
@@ -1,6 +1,5 @@
-# bash completion for lilo(8)
+# bash completion for lilo(8) -*- shell-script -*-
-have lilo && {
_lilo_labels()
{
COMPREPLY=( $( compgen -W "$( awk -F'=' '/label/ {print $2}' \
@@ -9,10 +8,8 @@ _lilo_labels()
_lilo()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-C|-i|-m|-s|-S)
@@ -47,14 +44,7 @@ _lilo()
COMPREPLY=( $( compgen -W '-A -b -c -C -d -f -g -i -I -l -L -m \
-M -p -P -q -r -R -s -S -t -T -u -U -v -V -w -x -z' -- "$cur" ) )
fi
-}
+} &&
complete -F _lilo lilo
-}
-# 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/links b/completions/links
index 9b7b50f0..a212fa5a 100644
--- a/completions/links
+++ b/completions/links
@@ -1,12 +1,9 @@
-# bash completion for links
+# bash completion for links -*- shell-script -*-
-have links &&
_links()
{
- local cur
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
+ local cur prev words cword
+ _init_completion || return
case $cur in
--*)
@@ -34,10 +31,4 @@ _links()
} &&
complete -F _links links
-# 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/lintian b/completions/lintian
index e2237893..65121151 100644
--- a/completions/lintian
+++ b/completions/lintian
@@ -1,10 +1,7 @@
-# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
-# ex: ts=8 sw=8 noet filetype=sh
-#
-# bash completion for lintian(1) and lintian-info(1)
+# bash completion for lintian(1) and lintian-info(1) -*- shell-script -*-
-have lintian && {
-_lintian_tags() {
+_lintian_tags()
+{
local match search tags
tags=$( grep -e ^Tag /usr/share/lintian/checks/*.desc | cut -d\ -f2 )
@@ -15,17 +12,17 @@ _lintian_tags() {
| cut -d: -f1 )
tags=$( echo $tags | sed -e "s/\<$item\>//g" )
done
- COMPREPLY=( ${COMPREPLY[@]} $(compgen -W "$tags") )
+ COMPREPLY+=( $(compgen -W "$tags") )
elif [[ "$cur" == *,* ]]; then
- COMPREPLY=( ${COMPREPLY[@]} $(compgen -P "${cur%,*}," -W "$tags" -- \
- "${cur##*,}") )
+ COMPREPLY+=( $(compgen -P "${cur%,*}," -W "$tags" -- "${cur##*,}") )
else
- COMPREPLY=( ${COMPREPLY[@]} $(compgen -W "$tags" -- "$cur") )
+ COMPREPLY+=( $(compgen -W "$tags" -- "$cur") )
fi
return 0
}
-_lintian_checks() {
+_lintian_checks()
+{
local match search todisable checks
checks=$(grep -e ^Check-Script -e ^Abbrev \
@@ -41,17 +38,17 @@ _lintian_checks() {
checks=$( echo $checks | sed -e "s/\<$name\>//g" )
done
done
- COMPREPLY=( ${COMPREPLY[@]} $(compgen -W "$checks") )
+ COMPREPLY+=( $(compgen -W "$checks") )
elif [[ "$cur" == *,* ]]; then
- COMPREPLY=( ${COMPREPLY[@]} $(compgen -P "${cur%,*}," -W "$checks" \
- -- "${cur##*,}") )
+ COMPREPLY+=( $(compgen -P "${cur%,*}," -W "$checks" -- "${cur##*,}") )
else
- COMPREPLY=( ${COMPREPLY[@]} $(compgen -W "$checks" -- "$cur") )
+ COMPREPLY+=( $(compgen -W "$checks" -- "$cur") )
fi
return 0
}
-_lintian_infos() {
+_lintian_infos()
+{
local match search infos
infos=$(grep -e ^Collector /usr/share/lintian/collection/*.desc \
@@ -63,32 +60,34 @@ _lintian_infos() {
/usr/share/lintian/collection/*.desc | cut -d: -f1 )
infos=$( echo $infos | sed -e "s/\<$item\>//g" )
done
- COMPREPLY=( ${COMPREPLY[@]} $(compgen -W "$infos") )
+ COMPREPLY+=( $(compgen -W "$infos") )
elif [[ "$cur" == *,* ]]; then
- COMPREPLY=( ${COMPREPLY[@]} $(compgen -P "${cur%,*}," -W "$infos" \
- -- "${cur##*,}") )
+ COMPREPLY+=( $(compgen -P "${cur%,*}," -W "$infos" -- "${cur##*,}") )
else
- COMPREPLY=( ${COMPREPLY[@]} $(compgen -W "$infos" -- "$cur") )
+ COMPREPLY+=( $(compgen -W "$infos" -- "$cur") )
fi
return 0
}
-_lintian_arches() {
+_lintian_arches()
+{
return 0
}
-_lintian() {
- local cur prev action lint_actions general_opts behaviour_opts \
- configuration_opts selection_opts
+_lintian()
+{
+ local cur prev words cword
+ _init_completion || return
- _get_comp_words_by_ref cur prev
+ local action lint_actions general_opts behaviour_opts \
+ configuration_opts selection_opts
lint_actions="--setup-lab --remove-lab --check --check-part --tags \
--tags-from-file --ftp-master-rejects --dont-check-part \
--unpack --remove"
general_opts="--help --version --print-version --verbose --debug --quiet"
behaviour_opts="--info --display-info --display-experimental --pedantic \
- --display-level --suppress-tags --unpack-level \
+ --display-level --suppress-tags \
--suppress-tags-from-file --no-override --show-overrides \
--color --unpack-info --md5sums --checksums --allow-root \
--fail-on-warnings --keep-lab"
@@ -111,10 +110,6 @@ _lintian() {
--lab|--archivedir|--dist|--root)
_filedir -d
;;
- -l|--unpack-level)
- COMPREPLY=($(compgen -W "0 none 1 basic 2 contents" -- \
- "$cur"))
- ;;
--color)
COMPREPLY=($(compgen -W "never always auto html" -- "$cur"))
;;
@@ -156,12 +151,13 @@ _lintian() {
;;
esac
return 0
-}
-
-_lintian_info() {
- local cur prev
+} &&
+complete -F _lintian lintian
- _get_comp_words_by_ref cur prev
+_lintian_info()
+{
+ local cur prev words cword
+ _init_completion || return
case "$prev" in
-t|--tags)
@@ -179,8 +175,7 @@ _lintian_info() {
;;
esac
return 0
-}
-
-complete -F _lintian lintian
+} &&
complete -F _lintian_info lintian-info
-}
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/lisp b/completions/lisp
index ee43a019..941eae44 100644
--- a/completions/lisp
+++ b/completions/lisp
@@ -1,13 +1,11 @@
+# -*- shell-script -*-
# bash programmable completion for various Common Lisp implementations by
# Nikodemus Siivola <nikodemus@random-state.net>
-have lisp &&
_lisp()
{
- local cur
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
+ local cur prev words cword
+ _init_completion || return
# completing an option (may or may not be separated by a space)
if [[ "$cur" == -* ]]; then
@@ -22,10 +20,4 @@ _lisp()
} &&
complete -F _lisp -o default lisp
-# 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_admins b/completions/list_admins
new file mode 100644
index 00000000..6c05a7d3
--- /dev/null
+++ b/completions/list_admins
@@ -0,0 +1,17 @@
+# mailman list_admins completion -*- shell-script -*-
+
+_list_admins()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--all-vhost --all --help' -- "$cur" ) )
+ else
+ _xfunc list_lists _mailman_lists
+ fi
+
+} &&
+complete -F _list_admins list_admins
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/list_lists b/completions/list_lists
new file mode 100644
index 00000000..8ef2156a
--- /dev/null
+++ b/completions/list_lists
@@ -0,0 +1,21 @@
+# mailman list_lists completion -*- shell-script -*-
+
+_mailman_lists()
+{
+ COMPREPLY=( $( compgen -W '$( list_lists -b 2>/dev/null )' -- "$cur" ) )
+}
+
+_list_lists()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--advertised --virtual-host-overview \
+ --bare --help' -- "$cur" ) )
+ fi
+
+} &&
+complete -F _list_lists list_lists
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/list_members b/completions/list_members
new file mode 100644
index 00000000..b6262b7c
--- /dev/null
+++ b/completions/list_members
@@ -0,0 +1,36 @@
+# mailman list_members completion -*- shell-script -*-
+
+_list_members()
+{
+ local cur prev words cword split
+ _init_completion -s || return
+
+ case $prev in
+ -o|--output)
+ _filedir
+ return 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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/list_owners b/completions/list_owners
new file mode 100644
index 00000000..e4d67505
--- /dev/null
+++ b/completions/list_owners
@@ -0,0 +1,18 @@
+# mailman list_owners completion -*- shell-script -*-
+
+_list_owners()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--with-listnames --moderators \
+ --help' -- "$cur" ) )
+ else
+ _xfunc list_lists _mailman_lists
+ fi
+
+} &&
+complete -F _list_owners list_owners
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/look b/completions/look
new file mode 100644
index 00000000..df914452
--- /dev/null
+++ b/completions/look
@@ -0,0 +1,14 @@
+# look(1) completion -*- shell-script -*-
+
+_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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/lpq b/completions/lpq
new file mode 100644
index 00000000..d667713e
--- /dev/null
+++ b/completions/lpq
@@ -0,0 +1,28 @@
+# lpq(1) completion -*- shell-script -*-
+
+_lpq()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ case $prev in
+ -P)
+ COMPREPLY=( $( compgen -W "$( lpstat -a 2>/dev/null | cut -d' ' -f1 )" -- "$cur" ) )
+ return 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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/lpr b/completions/lpr
new file mode 100644
index 00000000..35ddd625
--- /dev/null
+++ b/completions/lpr
@@ -0,0 +1,33 @@
+# lpr(1) completion -*- shell-script -*-
+
+_lpr()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ case $prev in
+ -P)
+ COMPREPLY=( $( compgen -W "$( lpstat -a 2>/dev/null | cut -d' ' -f1 )" -- "$cur" ) )
+ return 0
+ ;;
+ -U)
+ COMPREPLY=( $( compgen -u -- "$cur" ) )
+ return 0
+ ;;
+ -o)
+ COMPREPLY=( $( compgen -W "media= landscape orientation-requested= sides= fitplot number-up= scaling= cpi= lpi= page-bottom= page-top= page-left= page-right=" -- "$cur" ) )
+ [[ $COMPREPLY == *= ]] && compopt -o nospace
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == - ]]; then
+ COMPREPLY=( $( compgen -W '-E -H -C -J -T -P -U -h -l -m -o -p -q -r' -- "$cur" ) )
+ return 0
+ fi
+
+ _filedir
+} &&
+complete -F _lpr lpr
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/lrzip b/completions/lrzip
index 5cde88a8..1569dab4 100644
--- a/completions/lrzip
+++ b/completions/lrzip
@@ -1,22 +1,14 @@
-# lrzip(1) completion
+# lrzip(1) completion -*- shell-script -*-
-have lrzip &&
_lrzip()
{
- COMPREPLY=()
- local cur prev
- _get_comp_words_by_ref cur prev
-
- if [[ "$cur" == -* && $prev != -N ]]; then
- COMPREPLY=( $( compgen -W '-w -d -o -O -S -f -D -q -L -n -l -b -g -M \
- -T -N -v -vv -V -h' -- "$cur" ) )
- return 0
- fi
+ local cur prev words cword
+ _init_completion || return
local xspec="*.lrz"
case $prev in
- -w|-S|-V|-h)
+ -w|-S|-V|-h|-'?')
return 0
;;
-d)
@@ -31,34 +23,38 @@ _lrzip()
return 0
;;
-L)
- COMPREPLY=( $( compgen -W '1 2 3 4 5 6 7 8 9' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '{1..9}' -- "$cur" ) )
return 0
;;
-T)
- COMPREPLY=( $( compgen -W '1 2 3 4 5 6 7 8 9 10' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '{1..10}' -- "$cur" ) )
return 0
;;
-N)
- COMPREPLY=( $( compgen -W '-20 -19 -18 -17 -16 -15 -14 -13 -12 \
- -11 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 8 9 10 11 \
- 12 13 14 15 16 17 18 19' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '{-20..19}' -- "$cur" ) )
+ return 0
+ ;;
+ -p)
+ local var=NPROCESSORS_ONLN
+ [[ $OSTYPE == *linux* ]] && var=_$var
+ local n=$( getconf $var 2>/dev/null )
+ COMPREPLY=( $( compgen -W "{1..${n:-1}}" -- "$cur" ) )
return 0
;;
esac
_expand || return 0
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
+ return 0
+ fi
+
local IFS=$'\n'
- _compopt_o_filenames
+ compopt -o filenames
COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \
$( compgen -d -- "$cur" ) )
} &&
complete -F _lrzip lrzip
-# 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/lsof b/completions/lsof
index ac010dad..6ff7786c 100644
--- a/completions/lsof
+++ b/completions/lsof
@@ -1,11 +1,9 @@
-# lsof(8) completion
+# lsof(8) completion -*- shell-script -*-
-have lsof &&
_lsof()
{
- COMPREPLY=()
- local cur prev
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-'?'|-h|+c|-c|-d|-F|-i|+r|-r|-s|-S|-T)
@@ -55,10 +53,4 @@ _lsof()
} &&
complete -F _lsof lsof
-# 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/lvm b/completions/lvm
index f4d3b77d..7b353114 100644
--- a/completions/lvm
+++ b/completions/lvm
@@ -1,6 +1,5 @@
-# bash completion for lvm
+# bash completion for lvm -*- shell-script -*-
-have lvm && {
_volumegroups()
{
COMPREPLY=( $(compgen -W "$( vgscan 2>/dev/null | \
@@ -32,13 +31,13 @@ _sizes()
_args()
{
args=0
- if [[ "${COMP_WORDS[0]}" == lvm ]]; then
+ if [[ "${words[0]}" == lvm ]]; then
offset=2
else
offset=1
fi
- for (( i=$offset; i < COMP_CWORD; i++ )); do
- if [[ "${COMP_WORDS[i]}" != -* ]]; then
+ for (( i=$offset; i < cword; i++ )); do
+ if [[ "${words[i]}" != -* ]]; then
args=$(($args + 1))
fi
done
@@ -46,39 +45,32 @@ _args()
_lvmdiskscan()
{
- local cur
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
+ local cur prev words cword
+ _init_completion || return
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--debug --help \
- --lvmpartition --verbose --version' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) )
fi
-}
+} &&
complete -F _lvmdiskscan lvmdiskscan
_pvscan()
{
- local cur
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
+ local cur prev words cword
+ _init_completion || return
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--debug --exported --novolumegroup \
--help --ignorelockingfailure --partial --short --uuid \
--verbose --version' -- "$cur" ) )
fi
-}
+} &&
complete -F _pvscan pvscan
_pvs()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-o|-O|--options|--sort)
@@ -95,22 +87,17 @@ _pvs()
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--aligned --all --debug \
- --help --ignorelockingfailure --noheadings \
- --nosuffix --options --sort --separator --unbuffered --units \
- --verbose --version' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) )
else
_physicalvolumes
fi
-}
+} &&
complete -F _pvs pvs
_pvdisplay()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
--units)
@@ -120,20 +107,17 @@ _pvdisplay()
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--colon --columns --units \
- --verbose --debug --help --version' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) )
else
_physicalvolumes
fi
-}
+} &&
complete -F _pvdisplay pvdisplay
_pvchange()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-A|-x|--autobackup|--allocatable)
@@ -143,22 +127,17 @@ _pvchange()
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--all --autobackup \
- --debug --help --test --uuid \
- --allocatable --verbose --addtag --deltag \
- --version' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) )
else
_physicalvolumes
fi
-}
+} &&
complete -F _pvchange pvchange
_pvcreate()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
--restorefile)
@@ -180,23 +159,17 @@ _pvcreate()
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--restorefile --debug \
- --force --help --labelsector --metadatatype \
- --metadatacopies --metadatasize \
- --setphysicalvolumesize --test --uuid \
- --verbose --yes --version' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) )
else
_physicalvolumes
fi
-}
+} &&
complete -F _pvcreate pvcreate
_pvmove()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-A|--autobackup)
@@ -215,46 +188,37 @@ _pvmove()
else
_physicalvolumes
fi
-}
+} &&
complete -F _pvmove pvmove
_pvremove()
{
- local cur
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
+ local cur prev words cword
+ _init_completion || return
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--debug --force \
- --help --yes --test --verbose --version' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) )
else
_physicalvolumes
fi
-}
+} &&
complete -F _pvremove pvremove
_vgscan()
{
- local cur
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
+ local cur prev words cword
+ _init_completion || return
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--debug --help \
- --ignorelockingfailure --mknodes \
- --partial --verbose --version' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) )
fi
-}
+} &&
complete -F _vgscan vgscan
_vgs()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-o|-O|--options|--sort)
@@ -272,23 +236,17 @@ _vgs()
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--aligned --debug \
- --help --ignorelockingfailure --noheadings \
- --nosuffix --options --sort --partial \
- --separator --unbuffered --units \
- --verbose --version' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) )
else
_volumegroups
fi
-}
+} &&
complete -F _vgs vgs
_vgdisplay()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
--units)
@@ -298,21 +256,17 @@ _vgdisplay()
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--colon --columns --units \
- --partial --activevolumegroups --verbose \
- --debug --help --version' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) )
else
_volumegroups
fi
-}
+} &&
complete -F _vgdisplay vgdisplay
_vgchange()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-a|-A|-x|--available|--autobackup|--resizeable)
@@ -330,15 +284,13 @@ _vgchange()
else
_volumegroups
fi
-}
+} &&
complete -F _vgchange vgchange
_vgcreate()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-A|--autobackup)
@@ -368,31 +320,26 @@ _vgcreate()
_physicalvolumes
fi
fi
-}
+} &&
complete -F _vgcreate vgcreate
_vgremove()
{
- local cur
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
+ local cur prev words cword
+ _init_completion || return
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--debug --help --test \
- --verbose --version' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) )
else
_volumegroups
fi
-}
+} &&
complete -F _vgremove vgremove
_vgrename()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-A|--autobackup)
@@ -402,20 +349,17 @@ _vgrename()
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--autobackup --debug \
- --help --test --verbose --version' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) )
else
_volumegroups
fi
-}
+} &&
complete -F _vgrename vgrename
_vgreduce()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-A|--autobackup)
@@ -425,9 +369,7 @@ _vgreduce()
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--all --autobackup \
- --debug --help --removemissing --test \
- --verbose --version' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) )
else
_args
@@ -437,15 +379,13 @@ _vgreduce()
_physicalvolumes
fi
fi
-}
+} &&
complete -F _vgreduce vgreduce
_vgextend()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-A|--autobackup)
@@ -459,8 +399,7 @@ _vgextend()
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--autobackup --debug \
- --help --test --verbose --version' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) )
else
_args
if [ $args -eq 0 ]; then
@@ -469,47 +408,39 @@ _vgextend()
_physicalvolumes
fi
fi
-}
+} &&
complete -F _vgextend vgextend
_vgport()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
+ local cur prev words cword
+ _init_completion || return
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--all --debug \
- --help --verbose --version' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) )
else
_volumegroups
fi
-}
+} &&
complete -F _vgport vgimport vgexport
_vgck()
{
- local cur
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
+ local cur prev words cword
+ _init_completion || return
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--debug \
- --help --verbose --version' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) )
else
_volumegroups
fi
-}
+} &&
complete -F _vgck vgck
_vgconvert()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-M|--metadatatype)
@@ -527,21 +458,17 @@ _vgconvert()
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--debug --help --labelsector \
- --metadatatype --metadatacopies --metadatasize \
- --test --verbose --version' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) )
else
_volumegroups
fi
-}
+} &&
complete -F _vgconvert vgconvert
_vgcfgbackup()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-f|--file)
@@ -551,21 +478,17 @@ _vgcfgbackup()
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--debug --file --help \
- --ignorelockingfailure --partial --verbose \
- --version' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) )
else
_volumegroups
fi
-}
+} &&
complete -F _vgcfgbackup vgcfgbackup
_vgcfgrestore()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-f|--file)
@@ -583,21 +506,17 @@ _vgcfgrestore()
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--debug --file --list \
- --help --metadatatype --name --test \
- --verbose --version' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) )
else
_volumegroups
fi
-}
+} &&
complete -F _vgcfgrestore vgcfgrestore
_vgmerge()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-A|--autobackup)
@@ -607,20 +526,17 @@ _vgmerge()
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--autobackup --debug --help \
- --list --test --verbose --version' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) )
else
_volumegroups
fi
-}
+} &&
complete -F _vgmerge vgmerge
_vgsplit()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-A|--autobackup)
@@ -645,46 +561,37 @@ _vgsplit()
_physicalvolumes
fi
fi
-}
+} &&
complete -F _vgsplit vgsplit
_vgmknodes()
{
- local cur
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
+ local cur prev words cword
+ _init_completion || return
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--debug --help --verbose \
- --version' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) )
else
_volumegroups
fi
-}
+} &&
complete -F _vgmknodes vgmknodes
_lvscan()
{
- local cur
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
+ local cur prev words cword
+ _init_completion || return
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--blockdevice --debug \
- --help --ignorelockingfailure \
- --partial --verbose --version' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) )
fi
-}
+} &&
complete -F _lvscan lvscan
_lvs()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-o|-O|--options|--sort)
@@ -700,22 +607,17 @@ _lvs()
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--aligned --debug --help \
- --ignorelockingfailure --noheadings --nosuffix --options \
- --sort --partial --segments --separator --unbuffered --units \
- --verbose --version' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) )
else
_logicalvolumes
fi
-}
+} &&
complete -F _lvs lvs
_lvdisplay()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
--units)
@@ -725,20 +627,17 @@ _lvdisplay()
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--colon --columns --units \
- --partial --maps --verbose --debug --help --version' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) )
else
_logicalvolumes
fi
-}
+} &&
complete -F _lvdisplay lvdisplay
_lvchange()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-a|-A|-C|-M|--available|--autobackup|--continguous|--persistent)
@@ -752,24 +651,17 @@ _lvchange()
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--autobackup --available \
- --addtag --alloc --contiguous --debug --deltag \
- --force --help --ignorelockingfailure \
- --persistent --major --minor --partial \
- --permission --readahead --refresh --test \
- --verbose --version' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) )
else
_logicalvolumes
fi
-}
+} &&
complete -F _lvchange lvchange
_lvcreate()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-A|-C|-M|-Z|--autobackup|--continguous|--persistent|--zero)
@@ -791,12 +683,7 @@ _lvcreate()
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--autobackup --addtag --alloc \
- --contiguous --debug --help --stripes \
- --stripesize --extents --size --persistent \
- --major --minor --name --permission \
- --readahead --test --type --verbose --zero \
- --version' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) )
else
_args
if [ $args -eq 0 ]; then
@@ -805,15 +692,13 @@ _lvcreate()
_physicalvolumes
fi
fi
-}
+} &&
complete -F _lvcreate lvcreate
_lvremove()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-A|--autobackup)
@@ -823,20 +708,17 @@ _lvremove()
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--autobackup --debug \
- --force --help --test --verbose --version' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) )
else
_logicalvolumes
fi
-}
+} &&
complete -F _lvremove lvremove
_lvrename()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-A|--autobackup)
@@ -846,20 +728,17 @@ _lvrename()
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--autobackup --debug \
- --help --test --verbose --version' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) )
else
_logicalvolumes
fi
-}
+} &&
complete -F _lvrename lvrename
_lvreduce()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-A|--autobackup)
@@ -873,21 +752,17 @@ _lvreduce()
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--autobackup \
- --debug --force --help --extents \
- --size --nofsck --resizefs --test --verbose --version' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) )
else
_logicalvolumes
fi
-}
+} &&
complete -F _lvreduce lvreduce
_lvresize()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-A|--autobackup)
@@ -901,10 +776,7 @@ _lvresize()
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--autobackup --alloc \
- --debug --help --stripes --stripesize \
- --extents --size --nofsck --resizefs \
- --test --type --verbose --version' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) )
else
_args
if [ $args -eq 0 ]; then
@@ -913,15 +785,13 @@ _lvresize()
_physicalvolumes
fi
fi
-}
+} &&
complete -F _lvresize lvresize
_lvextend()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-A|--autobackup)
@@ -935,10 +805,7 @@ _lvextend()
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--autobackup --alloc \
- --debug --help --stripes --stripesize \
- --extents --size --nofsck --resizefs \
- --test --type --verbose --version' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) )
else
_args
if [ $args -eq 0 ]; then
@@ -947,17 +814,15 @@ _lvextend()
_physicalvolumes
fi
fi
-}
+} &&
complete -F _lvextend lvextend
_lvm()
{
- local cur
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
+ local cur prev words cword
+ _init_completion || return
- if [ $COMP_CWORD -eq 1 ]; then
+ if [ $cword -eq 1 ]; then
COMPREPLY=( $( compgen -W 'dumpconfig help lvchange \
lvcreate lvdisplay lvextend lvmchange \
lvmdiskscan lvmsadc lvmsar lvreduce \
@@ -970,7 +835,7 @@ _lvm()
vgremove vgrename vgs vgscan vgsplit \
version' -- "$cur" ) )
else
- case ${COMP_WORDS[1]} in
+ case ${words[1]} in
pvchange)
_pvchange
;;
@@ -1081,14 +946,7 @@ _lvm()
;;
esac
fi
-}
+} &&
complete -F _lvm lvm
-}
-# 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/lzma b/completions/lzma
index 295ef37b..d377d15f 100644
--- a/completions/lzma
+++ b/completions/lzma
@@ -1,12 +1,10 @@
-# lzma(1) completion by Per Ƙyvind Karlsen <peroyvind@mandriva.org>
+# lzma(1) completion -*- shell-script -*-
+# by Per Ƙyvind Karlsen <peroyvind@mandriva.org>
-have lzma &&
_lzma()
{
- local cur prev xspec
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-1 -2 -3 -4 -5 -6 -7 -8 -9 \
@@ -16,9 +14,8 @@ _lzma()
return 0
fi
- local IFS=$'\n'
+ local IFS=$'\n' xspec="*.@(lzma|tlz)"
- xspec="*.@(lzma|tlz)"
if [[ "$prev" == --* ]]; then
[[ "$prev" == --decompress || \
"$prev" == --list || \
@@ -31,16 +28,10 @@ _lzma()
_expand || return 0
- _compopt_o_filenames
+ compopt -o filenames
COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \
$( compgen -d -- "$cur" ) )
} &&
complete -F _lzma lzma
-# 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/lzop b/completions/lzop
index 6d384128..a5084bb0 100644
--- a/completions/lzop
+++ b/completions/lzop
@@ -1,23 +1,9 @@
-# lzop(1) completion
+# lzop(1) completion -*- shell-script -*-
-have lzop &&
_lzop()
{
- local cur prev xspec
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-1 -2 -3 -4 -5 -6 -7 -8 -9 -P \
- --fast --best --decompress --extract --test --list --ls --info \
- --sysinfo --license --help --version --stdout --output --path \
- --force --no-checksum --no-name --name --no-mode --no-time \
- --suffix --keep --delete --crc32 --no-warn --ignore-warn --quiet \
- --verbose --no-stdin --filter --checksum --no-color --mono \
- --color' -- "$cur" ) )
- return 0
- fi
+ local cur prev words cword
+ _init_completion || return
case $prev in
-o|--output)
@@ -33,7 +19,18 @@ _lzop()
;;
esac
- xspec="*.?(t)lzo"
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-1 -2 -3 -4 -5 -6 -7 -8 -9 -P \
+ --fast --best --decompress --extract --test --list --ls --info \
+ --sysinfo --license --help --version --stdout --output --path \
+ --force --no-checksum --no-name --name --no-mode --no-time \
+ --suffix --keep --delete --crc32 --no-warn --ignore-warn --quiet \
+ --verbose --no-stdin --filter --checksum --no-color --mono \
+ --color' -- "$cur" ) )
+ return 0
+ fi
+
+ local xspec="*.?(t)lzo"
case $prev in
--decompress|--uncompress|--extract|--list|--ls|--info|--test)
xspec="!"$xspec
@@ -43,7 +40,7 @@ _lzop()
;;
--*)
;;
- -*f*|'<'|'>')
+ -*f*)
xspec=
;;
-*[dltx]*)
@@ -54,16 +51,10 @@ _lzop()
_expand || return 0
local IFS=$'\n'
- _compopt_o_filenames
+ compopt -o filenames
COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \
$( compgen -d -- "$cur" ) )
} &&
complete -F _lzop lzop
-# 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/macof b/completions/macof
new file mode 100644
index 00000000..b81b630a
--- /dev/null
+++ b/completions/macof
@@ -0,0 +1,23 @@
+# macof completion -*- shell-script -*-
+
+_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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/mailman b/completions/mailman
deleted file mode 100644
index b239cbbf..00000000
--- a/completions/mailman
+++ /dev/null
@@ -1,587 +0,0 @@
-# mailman completion
-
-have list_lists && {
-_mailman_lists()
-{
- COMPREPLY=( $( compgen -W '$( list_lists -b )' -- "$cur" ) )
-}
-
-_list_lists()
-{
- local cur
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
-
- 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 split=false
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- _split_longopt && split=true
-
- 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 split=false
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- _split_longopt && split=true
-
- 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 split=false
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- _split_longopt && split=true
-
- 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 split=false
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- _split_longopt && split=true
-
- 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 split=false
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- _split_longopt && split=true
-
- 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
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--help' -- "$cur" ) )
- else
- _filedir -d
- fi
-
-} &&
-complete -F _unshunt unshunt
-
-have list_admins &&
-_list_admins()
-{
- local cur
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
-
- 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
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
-
- 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 split=false
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- _split_longopt && split=true
-
- 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 split=false
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- _split_longopt && split=true
-
- 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
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
-
- 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
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--language --quiet --help' -- "$cur" ) )
- else
- _mailman_lists
- fi
-
-} &&
-complete -F _newlist newlist
-
-have rmlist &&
-_rmlist()
-{
- local cur
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
-
- 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 split=false
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- _split_longopt && split=true
-
- 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 split=false
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- _split_longopt && split=true
-
- 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
- args=$COMP_CWORD
- for (( i=1; i < COMP_CWORD; i++ )); do
- if [[ "${COMP_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
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--status --dry-run --quiet \
- --help' -- "$cur" ) )
- fi
-
-} &&
-complete -F _cleanarch cleanarch
-
-have inject &&
-_inject()
-{
- local cur prev split=false
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- _split_longopt && split=true
-
- 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
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
-
- 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
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
-
- 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
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-f -v -h' -- "$cur" ) )
- fi
-
-} &&
-complete -F _check_perms check_perms
-
-have genaliases &&
-_genaliases()
-{
- local cur
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--quiet --help' -- "$cur" ) )
- fi
-
-} &&
-complete -F _genaliases genaliases
-
-have mmsitepass &&
-_mmsitepass()
-{
- local cur
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--listcreator --help' -- "$cur" ) )
- fi
-
-} &&
-complete -F _mmsitepass mmsitepass
-
-have qrunner &&
-_qrunner()
-{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- _split_longopt && 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
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
-
- 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..4a49668f
--- /dev/null
+++ b/completions/mailmanctl
@@ -0,0 +1,18 @@
+# mailmanctl completion -*- shell-script -*-
+
+_mailmanctl()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--no-restart --run-as-user \
+ --stale-lock-cleanup --quiet --help' -- "$cur" ) )
+ else
+ COMPREPLY=( $( compgen -W 'start stop restart reopen' -- "$cur" ) )
+ fi
+
+} &&
+complete -F _mailmanctl mailmanctl
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/make b/completions/make
index 76e95284..d56e1962 100644
--- a/completions/make
+++ b/completions/make
@@ -1,58 +1,55 @@
-# bash completion for GNU make
+# bash completion for GNU make -*- shell-script -*-
-have make || have gmake || have gnumake || have pmake &&
_make()
{
- local file makef makef_dir="." makef_inc cur prev i split=false
+ local cur prev words cword split
+ _init_completion -s || return
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- _split_longopt && split=true
+ local file makef makef_dir="." makef_inc i
case $prev in
- -f|-o|-W|--file|--makefile|--old-file|--new-file|--assume-old|--assume-new|--what-if)
+ -f|--file|--makefile|-o|--old-file|--assume-old|-W|--what-if|\
+ --new-file|--assume-new)
_filedir
return 0
;;
- -I|-C|--directory|--include-dir)
+ -I|--include-dir|-C|--directory|-m)
_filedir -d
return 0
;;
+ -E)
+ COMPREPLY=( $( compgen -v -- "$cur" ) )
+ return 0
+ ;;
+ --eval|-D|-V|-x)
+ return 0
+ ;;
esac
$split && return 0
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-b -m -B -C -d -e -f -h -i -I\
- -j -l -k -n -o -p -q -r -R - s -S -t -v -w -W \
- --always-make --directory --debug \
- --environment-overrides --file --makefile --help \
- --ignore-errors --include-dir --jobs --load-average \
- --max-load --keep-going --just-print --dry-run \
- --recon --old-file --assume-old --print-data-base \
- --question --no-builtin-rules --no-builtin-variables \
- --silent --quiet --no-keep-goind --stop --touch \
- --version --print-directory --no-print-directory \
- --what-if --new-file --assume-new \
- --warn-undefined-variables' -- "$cur" ) )
+ local opts="$( _parse_help "$1" )"
+ [[ $opts ]] || opts="$( _parse_usage "$1" )"
+ COMPREPLY=( $( compgen -W "$opts" -- "$cur" ) )
+ [[ $COMPREPLY == *= ]] && compopt -o nospace
else
# before we check for makefiles, see if a path was specified
# with -C/--directory
- for (( i=0; i < ${#COMP_WORDS[@]}; i++ )); do
- if [[ ${COMP_WORDS[i]} == -@(C|-directory) ]]; then
+ for (( i=0; i < ${#words[@]}; i++ )); do
+ if [[ ${words[i]} == -@(C|-directory) ]]; then
# eval for tilde expansion
- eval makef_dir=${COMP_WORDS[i+1]}
+ eval makef_dir=${words[i+1]}
break
fi
done
# before we scan for targets, see if a Makefile name was
# specified with -f/--file/--makefile
- for (( i=0; i < ${#COMP_WORDS[@]}; i++ )); do
- if [[ ${COMP_WORDS[i]} == -@(f|-?(make)file) ]]; then
+ for (( i=0; i < ${#words[@]}; i++ )); do
+ if [[ ${words[i]} == -@(f|-?(make)file) ]]; then
# eval for tilde expansion
- eval makef=${COMP_WORDS[i+1]}
+ eval makef=${words[i+1]}
break
fi
done
@@ -69,10 +66,4 @@ _make()
} &&
complete -F _make make gmake gnumake pmake
-# 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/makepkg b/completions/makepkg
new file mode 100644
index 00000000..c24c9cc4
--- /dev/null
+++ b/completions/makepkg
@@ -0,0 +1,24 @@
+# Slackware Linux makepkg completion -*- shell-script -*-
+
+_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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/man b/completions/man
index 9e5cd3a8..5c134d33 100644
--- a/completions/man
+++ b/completions/man
@@ -1,27 +1,57 @@
-# man(1) completion
+# man(1) completion -*- shell-script -*-
+
+[[ $OSTYPE == *@(darwin|freebsd|solaris|cygwin|openbsd)* ]] || _userland GNU \
+ || return 1
-[ $USERLAND = GNU -o $UNAME = Darwin \
- -o $UNAME = FreeBSD -o $UNAME = SunOS -o $UNAME = Cygwin \
- -o $UNAME = OpenBSD ] &&
_man()
{
- local cur i prev sect manpath manext mansect uname
+ local cur prev words cword split
+ _init_completion -s -n : || return
+
+ local i sect manpath manext mansect uname
manext="@([0-9lnp]|[0-9][px]|man|3pm)?(.@([gx]z|bz2|lzma|Z))"
mansect="@([0-9lnp]|[0-9][px]|3pm)"
- COMPREPLY=()
- _get_comp_words_by_ref -n : cur prev
+ case $prev in
+ -C|--config-file)
+ _filedir conf
+ return
+ ;;
+ -l|--local-file)
+ _filedir $manext
+ return
+ ;;
+ -M|--manpath)
+ _filedir -d
+ return
+ ;;
+ -P|--pager)
+ COMPREPLY=( $( compgen -c -- "$cur" ) )
+ return
+ ;;
+ -p|--preprocessor)
+ COMPREPLY=( $( compgen -W 'e p t g r v' -- "$cur" ) )
+ return
+ ;;
+ -L|--locale|-m|--systems|-e|--extension|-r|--prompt|-R|--recode|\
+ -E|--encoding)
+ return
+ ;;
+ esac
- if [[ "$prev" == -l ]]; then
- _filedir $manext
- return 0
+ $split && return
+
+ if [[ $cur == -* ]]; then
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" -h )' -- "$cur" ) )
+ [[ $COMPREPLY == *= ]] && compopt -o nospace
+ return
fi
_expand || return 0
- # file based completion if parameter contains /
- if [[ "$cur" == */* ]]; then
+ # file based completion if parameter looks like a path
+ if [[ "$cur" == @(*/|[.~])* ]]; then
_filedir $manext
return 0
fi
@@ -71,10 +101,4 @@ _man()
} &&
complete -F _man man apropos whatis
-# 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/mc b/completions/mc
index 09e9eabe..f3065793 100644
--- a/completions/mc
+++ b/completions/mc
@@ -1,14 +1,9 @@
-# bash completion for mc
+# bash completion for mc -*- shell-script -*-
-have mc &&
_mc()
{
- local cur prev split=false
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- _split_longopt && split=true
+ local cur prev words cword split
+ _init_completion -s || return
case $prev in
-e|--edit|-v|--view|-l|--ftplog|-P|--printwd)
@@ -19,7 +14,7 @@ _mc()
# argument required but no completions available
return 0
;;
- -h|--help|-V|--version)
+ -h|--help|--help-*|-V|--version)
# all other arguments are noop with these
return 0
;;
@@ -28,20 +23,13 @@ _mc()
$split && return 0
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--stickchars --nocolor --color --colors \
- --nomouse --edit --datadir --resetsoft --ftplog --printwd --slow \
- --termcap --nosubshell --subshell --view --version --xterm \
- --debuglevel --help' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" --help-all )' \
+ -- "$cur" ) )
+ [[ $COMPREPLY == *= ]] && compopt -o nospace
else
_filedir -d
fi
} &&
complete -F _mc mc
-# 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/mcrypt b/completions/mcrypt
index 32c4f89f..8c7d189c 100644
--- a/completions/mcrypt
+++ b/completions/mcrypt
@@ -1,16 +1,14 @@
-# mcrypt(1) completion by Ariel Fermani <the_end@bbs.frc.utn.edu.ar>
+# mcrypt(1) completion -*- shell-script -*-
+# by Ariel Fermani <the_end@bbs.frc.utn.edu.ar>
-have mcrypt || have mdecrypt &&
_mcrypt()
{
- local cur prev i decrypt
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-g|--openpgp-z)
- COMPREPLY=( $( compgen -W '0 1 2 3 4 5 6 7 8 9' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '{0..9}' -- "$cur" ) )
return 0
;;
-o|--keymode)
@@ -48,21 +46,13 @@ _mcrypt()
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--openpgp --openpgp-z \
- --decrypt --keysize --keymode --keyfile \
- --config --algorithm --algorithms-directory \
- --mode --modes-directory --hash --key \
- --noiv --bare --gzip --bzip2 --flush \
- --doublecheck --unlink --nodelete --time \
- --force --echo --random --list --list-keymodes \
- --list-hash --verbose --quiet --help \
- --version --license' -- "$cur" ) )
- elif [[ ${COMP_WORDS[0]} == mdecrypt ]]; then
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
+ elif [[ ${words[0]} == mdecrypt ]]; then
_filedir nc
else
- decrypt=0
- for (( i=1; i < ${#COMP_WORDS[@]}-1; i++ )); do
- if [[ ${COMP_WORDS[i]} == -@(d|-decrypt) ]]; then
+ local i decrypt=0
+ for (( i=1; i < ${#words[@]}-1; i++ )); do
+ if [[ ${words[i]} == -@(d|-decrypt) ]]; then
_filedir nc
decrypt=1
break
@@ -75,10 +65,4 @@ _mcrypt()
} &&
complete -F _mcrypt mcrypt mdecrypt
-# 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/mdadm b/completions/mdadm
index 9cbaad7b..f0e917fd 100644
--- a/completions/mdadm
+++ b/completions/mdadm
@@ -1,13 +1,11 @@
-# bash completion for mdadm
+# bash completion for mdadm -*- shell-script -*-
-have mdadm &&
-{
_mdadm_raid_level()
{
local mode
- for (( i=1; i < COMP_CWORD; i++ )); do
- case ${COMP_WORDS[i]} in
+ for (( i=1; i < cword; i++ )); do
+ case ${words[i]} in
-C|--create)
mode=create
break
@@ -35,9 +33,9 @@ _mdadm_raid_level()
_mdadm_raid_layout()
{
local level
- for (( i=1; i < COMP_CWORD; i++ )); do
- if [[ "${COMP_WORDS[i]}" == -@(l|-level) ]]; then
- level=${COMP_WORDS[i+1]}
+ for (( i=1; i < cword; i++ )); do
+ if [[ "${words[i]}" == -@(l|-level) ]]; then
+ level=${words[i+1]}
break
fi
done
@@ -72,12 +70,8 @@ _mdadm_update_flag()
_mdadm()
{
- local cur prev mode options split=false
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- _split_longopt && split=true
+ local cur prev words cword split
+ _init_completion -s || return
case $prev in
-c|--config|-b|--bitmap|--backup-file)
@@ -104,28 +98,29 @@ _mdadm()
$split && return 0
+ local options
options='--help --help-options --version --verbose --quiet \
- --brief --force --config --scan --metadata --homehost'
+ --brief --force --config= --scan --metadata= --homehost='
if [[ "$cur" == -* ]]; then
- if [[ $COMP_CWORD -eq 1 ]] ; then
+ if [[ $cword -eq 1 ]] ; then
COMPREPLY=( $( compgen -W "$options --assemble --build \
--create --monitor --grow" -- "$cur" ) )
else
- case ${COMP_WORDS[COMP_CWORD-1]} in
+ case ${words[cword-1]} in
-A|--assemble)
- COMPREPLY=( $( compgen -W "$options --uuid \
- --super-minor --name --force --run \
- --no-degraded --auto --bitmap --backup-file \
- --update --auto-update-homehost" -- "$cur" ) )
+ COMPREPLY=( $( compgen -W "$options --uuid= \
+ --super-minor= --name= --force --run \
+ --no-degraded --auto= --bitmap= --backup-file= \
+ --update= --auto-update-homehost" -- "$cur" ) )
;;
-B|-C|-G|--build|--create|--grow)
- COMPREPLY=( $( compgen -W "$options --raid-devices \
- --spare-devices --size --chunk --rounding \
- --level --layout --parity --bitmap \
- --bitmap-chunk --write-mostly --write-behind \
- --assume-clean --backup-file --name --run \
- --force --auto" -- "$cur" ) )
+ COMPREPLY=( $( compgen -W "$options --raid-devices= \
+ --spare-devices= --size= --chunk= --rounding= \
+ --level= --layout= --parity= --bitmap= \
+ --bitmap-chunk= --write-mostly --write-behind= \
+ --assume-clean --backup-file= --name= --run \
+ --force --auto=" -- "$cur" ) )
;;
-F|--follow|--monitor)
COMPREPLY=( $( compgen -W "$options --mail --program \
@@ -145,18 +140,12 @@ _mdadm()
;;
esac
fi
+ [[ $COMPREPLY == *= ]] && compopt -o nospace
else
cur=${cur:=/dev/}
_filedir
fi
-}
+} &&
complete -F _mdadm mdadm
-}
-# 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/mdtool b/completions/mdtool
new file mode 100644
index 00000000..43358865
--- /dev/null
+++ b/completions/mdtool
@@ -0,0 +1,62 @@
+# mdtool completion -*- shell-script -*-
+
+_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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/medusa b/completions/medusa
index d8dcfe41..84a03813 100644
--- a/completions/medusa
+++ b/completions/medusa
@@ -1,13 +1,9 @@
-# bash completion for medusa
+# bash completion for medusa -*- shell-script -*-
-have medusa &&
_medusa()
{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=`_get_pword`
+ local cur prev words cword
+ _init_completion || return
case $prev in
-h)
@@ -26,16 +22,9 @@ _medusa()
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-h -H -u -U -p -P -C -O -e -M -m -d -n -s \
- -g -r -R -t -T -L -f -F -b -q -v -w -V -Z' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
fi
} &&
complete -F _medusa medusa
-# 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-diag b/completions/mii-diag
new file mode 100644
index 00000000..5e94877f
--- /dev/null
+++ b/completions/mii-diag
@@ -0,0 +1,27 @@
+# mii-diag(8) completion -*- shell-script -*-
+
+_mii_diag()
+{
+ local cur prev words cword split
+ _init_completion -s || return
+
+ case $prev in
+ -F|-A|--advertise|--fixed-speed)
+ COMPREPLY=( $( compgen -W '100baseT4 100baseTx \
+ 100baseTx-FD 100baseTx-HD 10baseT 10baseT-FD \
+ 10baseT-HD' -- "$cur" ) )
+ return 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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/mii-tool b/completions/mii-tool
new file mode 100644
index 00000000..effaa1db
--- /dev/null
+++ b/completions/mii-tool
@@ -0,0 +1,32 @@
+# mii-tool(8) completion -*- shell-script -*-
+
+_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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/minicom b/completions/minicom
index 76553317..6bac50ba 100644
--- a/completions/minicom
+++ b/completions/minicom
@@ -1,12 +1,9 @@
-# bash completion for minicom
+# bash completion for minicom -*- shell-script -*-
-have minicom &&
_minicom()
{
- local cur prev confdir
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-a|-c)
@@ -31,6 +28,7 @@ _minicom()
-c -S -d -p -C -T -7 -8' -- "$cur" ) )
return 0
else
+ local confdir
[ -n "$( command ls /etc/minirc.* 2>/dev/null)" ] \
&& confdir=/etc
[ -n "$( command ls /etc/minicom/minirc.* 2>/dev/null)" ] \
@@ -44,10 +42,4 @@ _minicom()
} &&
complete -F _minicom -o default minicom
-# 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/mkinitrd b/completions/mkinitrd
index 48893471..c54f22a2 100644
--- a/completions/mkinitrd
+++ b/completions/mkinitrd
@@ -1,14 +1,9 @@
-# bash completion for mkinitrd
+# bash completion for mkinitrd -*- shell-script -*-
-have mkinitrd &&
_mkinitrd()
{
- local cur prev args split=false
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- _split_longopt && split=true
+ local cur prev words cword split
+ _init_completion -s || return
case $prev in
--preload|--with|--builtin)
@@ -31,10 +26,12 @@ _mkinitrd()
COMPREPLY=( $( compgen -W '--version --help -v -f --preload \
--force-scsi-probe --omit-scsi-modules \
--omit-ide-modules --image-version --force-raid-probe \
- --omit-raid-modules --with --force-lvm-probe \
+ --omit-raid-modules --with= --force-lvm-probe \
--omit-lvm-modules --builtin --omit-dmraid --net-dev \
--fstab --nocompress --dsdt --bootchart' -- "$cur" ) )
+ [[ $COMPREPLY == *= ]] && compopt -o nospace
else
+ local args
_count_args
case $args in
@@ -50,10 +47,4 @@ _mkinitrd()
} &&
complete -F _mkinitrd mkinitrd
-# 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/mktemp b/completions/mktemp
new file mode 100644
index 00000000..3871e708
--- /dev/null
+++ b/completions/mktemp
@@ -0,0 +1,29 @@
+# mktemp(1) completion -*- shell-script -*-
+
+_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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/mmsitepass b/completions/mmsitepass
new file mode 100644
index 00000000..71fc8b09
--- /dev/null
+++ b/completions/mmsitepass
@@ -0,0 +1,15 @@
+# mailman mmsitepass completion -*- shell-script -*-
+
+_mmsitepass()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--listcreator --help' -- "$cur" ) )
+ fi
+
+} &&
+complete -F _mmsitepass mmsitepass
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/module-init-tools b/completions/module-init-tools
deleted file mode 100644
index bf2d24d1..00000000
--- a/completions/module-init-tools
+++ /dev/null
@@ -1,61 +0,0 @@
-# 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
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
-
- _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 modpath
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- # behave like lsmod for modprobe -r
- if [[ ${1##*/} == modprobe && "${COMP_WORDS[1]}" == -r ]]; then
- _installed_modules "$cur"
- return 0
- fi
-
- # do filename completion if we're giving a path to a module
- if [[ "$cur" == */* ]]; then
- _filedir '@(?(k)o?(.gz))'
- return 0
- fi
-
- if [[ $COMP_CWORD -gt 1 && "${COMP_WORDS[COMP_CWORD-1]}" != -* ]]; then
- # do module parameter completion
- COMPREPLY=( $( compgen -W "$( /sbin/modinfo -p ${COMP_WORDS[1]} | \
- cut -d: -f1 )" -- "$cur" ) )
- else
- _modules $(uname -r)
- fi
-
- return 0
-} &&
-complete -F _insmod insmod modprobe modinfo
-
-# 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 69b23445..9102b8bb 100644
--- a/completions/monodevelop
+++ b/completions/monodevelop
@@ -1,14 +1,15 @@
-# Monodevelop completion
+# monodevelop completion -*- shell-script -*-
-have monodevelop &&
_monodevelop()
{
- local cur
- _get_comp_words_by_ref cur
+ local cur prev words cword split
+ _init_completion -s || return
+
+ $split && return
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-? -help -help2 -ipc-tcp -newwindow -nologo \
- -usage -V -version' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" -h )' -- "$cur" ) )
+ [[ $COMPREPLY == *= ]] && compopt -o nospace
else
_filedir
fi
@@ -16,71 +17,4 @@ _monodevelop()
} &&
complete -F _monodevelop monodevelop
-have mdtool &&
-_mdtool()
-{
- local cur prev command i
-
- COMPREPLY=()
-
- _get_comp_words_by_ref cur prev
-
- for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
- if [[ ${COMP_WORDS[i]} == @(build|generate-makefiles|setup) ]]; then
- command=${COMP_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/mount b/completions/mount
index b14eef3e..48bc7b03 100644
--- a/completions/mount
+++ b/completions/mount
@@ -1,11 +1,10 @@
-# mount(8) completion. This will pull a list of possible mounts out of
+# mount(8) completion -*- shell-script -*-
+# This will pull a list of possible mounts out of
# /etc/{,v}fstab, unless the word being completed contains a ':', which
# would indicate the specification of an NFS server. In that case, we
# query the server for a list of all available exports and complete on
# that instead.
#
-have mount &&
-{
# Just like COMPREPLY=(`compgen -W "${COMPREPLY[*]}" -- "$cur"`), only better!
#
@@ -77,10 +76,10 @@ _linux_fstab()
_mount()
{
- local cur sm host prev
+ local cur prev words cword
+ _init_completion -n : || return
- COMPREPLY=()
- _get_comp_words_by_ref -n : cur prev
+ local sm host
case $prev in
-t|--types)
@@ -134,14 +133,12 @@ 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
- _get_comp_words_by_ref cur
- COMPREPLY=()
+ local cur prev words cword
+ _init_completion || return
- if [[ $(uname -s) = Linux && -r /proc/mounts ]]; then
+ if [[ $OSTYPE == *linux* && -r /proc/mounts ]]; then
# Linux /proc/mounts is properly quoted. This is important when
# unmounting usb devices with pretty names.
_linux_fstab < /proc/mounts
@@ -154,12 +151,4 @@ _umount()
} &&
complete -F _umount -o dirnames umount
-}
-
-# 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/mplayer b/completions/mplayer
index 39711370..cd39d309 100644
--- a/completions/mplayer
+++ b/completions/mplayer
@@ -1,6 +1,5 @@
-# mplayer(1) completion
+# mplayer(1) completion -*- shell-script -*-
-have mplayer && {
_mplayer_options_list()
{
cur=${cur%\\}
@@ -11,11 +10,10 @@ _mplayer_options_list()
_mplayer()
{
- local cmd cur prev i j k=0
+ local cur prev words cword
+ _init_completion || return
- COMPREPLY=()
- cmd=${COMP_WORDS[0]}
- _get_comp_words_by_ref cur prev
+ local cmd=${words[0]} i j k=0
case $prev in
-[av][cfo]|-[av]fm|-vop|-fstype|-demuxer|-o[av]c|-of|-profile| \
@@ -38,8 +36,7 @@ _mplayer()
_filedir ttf
fi
local IFS=$'\n'
- COMPREPLY=( "${COMPREPLY[@]}"
- $( compgen -W '$( fc-list 2>/dev/null )' -- "$cur" ) )
+ COMPREPLY+=( $( compgen -W '$( fc-list 2>/dev/null )' -- "$cur" ) )
return 0
;;
-sub)
@@ -256,14 +253,7 @@ _mplayer()
esac
return 0
-}
-complete -F _mplayer mplayer mencoder gmplayer kplayer
-}
+} &&
+complete -F _mplayer mplayer mplayer2 mencoder gmplayer kplayer
-# 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/msynctool b/completions/msynctool
index 3f9afb7f..db48e1b7 100644
--- a/completions/msynctool
+++ b/completions/msynctool
@@ -1,14 +1,11 @@
-# bash completion for msynctool
+# bash completion for msynctool -*- shell-script -*-
-have msynctool &&
_msynctool()
{
- local cur prev anteprev
+ local cur prev words cword
+ _init_completion || return
- COMPREPLY=()
- _get_comp_words_by_ref cur prev anteprev
-
- case $anteprev in
+ case $words in
--configure)
COMPREPLY=( $( compgen -W "$(msynctool --showgroup \
$prev | awk '/^Member/ {print $2}' | sed \
@@ -42,10 +39,4 @@ _msynctool()
} &&
complete -F _msynctool msynctool
-# 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/mtx b/completions/mtx
index 0454f032..0dae92ae 100644
--- a/completions/mtx
+++ b/completions/mtx
@@ -1,26 +1,26 @@
-# mtx completion by Jon Middleton <jjm@ixtab.org.uk>
+# mtx completion -*- shell-script -*-
+# by Jon Middleton <jjm@ixtab.org.uk>
-have mtx &&
_mtx()
{
- local cur prev options tapes drives
+ local cur prev words cword
+ _init_completion || return
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local options tapes drives
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}
- if [ $COMP_CWORD -gt 1 ]; then
+ if [ $cword -gt 1 ]; then
case $prev in
load)
COMPREPLY=( $( compgen -W "$tapes" -- "$cur" ) )
@@ -42,10 +42,4 @@ _mtx()
} &&
complete -F _mtx mtx
-# 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 b/completions/munin-node
deleted file mode 100644
index abf2b0f6..00000000
--- a/completions/munin-node
+++ /dev/null
@@ -1,113 +0,0 @@
-# bash completion for munin node
-
-have munin-run &&
-_munin_run()
-{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- case $prev in
- --config|--sconffile)
- _filedir
- return 0
- ;;
- --servicedir|--sconfdir)
- _filedir -d
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--config --servicedir --sconfdir \
- --sconffile --help --debug --version' -- "$cur" ) )
- else
- COMPREPLY=( $( compgen -W '$( command ls /etc/munin/plugins )' \
- -- "$cur" ) )
- fi
-} &&
-complete -F _munin_run munin-run
-
-have munindoc &&
-_munindoc()
-{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- COMPREPLY=( $( compgen -W '$( command ls /usr/share/munin/plugins )' \
- -- "$cur" ) )
-} &&
-complete -F _munindoc munindoc
-
-have munin-update &&
-_munin_update()
-{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- 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
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- 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 '--help --version --debug --config \
- --servicedir --libdir --families --suggest --shell \
- --remove-also --snmp --snmpversion --snmpcommunity' -- "$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..7f1d5a59
--- /dev/null
+++ b/completions/munin-node-configure
@@ -0,0 +1,33 @@
+# munin-node-configure completion -*- shell-script -*-
+
+_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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/munin-run b/completions/munin-run
new file mode 100644
index 00000000..756a0e0a
--- /dev/null
+++ b/completions/munin-run
@@ -0,0 +1,28 @@
+# munin-run completion -*- shell-script -*-
+
+_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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/munin-update b/completions/munin-update
new file mode 100644
index 00000000..f92f2f19
--- /dev/null
+++ b/completions/munin-update
@@ -0,0 +1,27 @@
+# munin-update completion -*- shell-script -*-
+
+_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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/munindoc b/completions/munindoc
new file mode 100644
index 00000000..c5a03c1c
--- /dev/null
+++ b/completions/munindoc
@@ -0,0 +1,13 @@
+# munindoc completion -*- shell-script -*-
+
+_munindoc()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ COMPREPLY=( $( compgen -W \
+ '$( command ls /usr/share/munin/plugins 2>/dev/null )' -- "$cur" ) )
+} &&
+complete -F _munindoc munindoc
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/mutt b/completions/mutt
index e5e9d289..70699a15 100644
--- a/completions/mutt
+++ b/completions/mutt
@@ -1,20 +1,18 @@
-# mutt completion
+# mutt completion -*- shell-script -*-
#
# Mutt doesn't have an "addressbook" like Pine, but it has aliases and
# a "query" function to retrieve addresses, so that's what we use here.
-have mutt || have muttng && {
-
# @param $1 (cur) Current word to complete
_muttaddr()
{
_muttaliases "$1"
_muttquery "$1"
- COMPREPLY=( "${COMPREPLY[@]}" $( compgen -u -- "$1" ) )
+ COMPREPLY+=( $( compgen -u -- "$1" ) )
return 0
-} # _muttaddr()
+}
# Find muttrc to use
@@ -22,7 +20,7 @@ _muttaddr()
_muttrc()
{
# Search COMP_WORDS for '-F muttrc' or '-Fmuttrc' argument
- set -- "${COMP_WORDS[@]}"
+ set -- "${words[@]}"
while [ $# -gt 0 ]; do
if [ "${1:0:2}" = -F ]; then
if [ ${#1} -gt 2 ]; then
@@ -44,7 +42,7 @@ _muttrc()
fi
fi
printf "%s" "$muttrc"
-} # _muttrc()
+}
# Recursively build list of sourced config files
@@ -61,21 +59,22 @@ _muttconffiles()
while [[ "$1" ]]; do
newconffiles=( $(sed -n 's|^source[[:space:]]\{1,\}\([^[:space:]]\{1,\}\).*$|\1|p' $(eval echo $1) ) )
for file in "${newconffiles[@]}"; do
+ __expand_tilde_by_ref file
[[ ! -f "$file" || "${sofar/ ${file} / }" != "$sofar" ]] &&
continue
- sofar="$sofar $file"
+ sofar+=" $file"
sofar=" $(eval _muttconffiles \"$sofar\" $file) "
done
shift
done
printf '%s\n' $sofar
-} # _muttconffiles()
+}
# @param $1 (cur) Current word to complete
_muttaliases()
{
- local cur=$1 muttrc muttcmd=${COMP_WORDS[0]}
+ local cur=$1 muttrc muttcmd=${words[0]}
local -a conffiles aliases
muttrc=$(_muttrc)
@@ -84,7 +83,7 @@ _muttaliases()
conffiles=( $(eval _muttconffiles $muttrc $muttrc) )
aliases=( $( sed -n 's|^alias[[:space:]]\{1,\}\([^[:space:]]\{1,\}\).*$|\1|p' \
$(eval echo "${conffiles[@]}") ) )
- COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "${aliases[*]}" -- "$cur" ) )
+ COMPREPLY+=( $( compgen -W "${aliases[*]}" -- "$cur" ) )
return 0
}
@@ -93,19 +92,19 @@ _muttaliases()
# @param $1 (cur) Current word to complete
_muttquery()
{
- local cur=$1 querycmd muttcmd=${COMP_WORDS[0]}
+ 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
+ __expand_tilde_by_ref querycmd
queryresults=( $( $querycmd | \
sed -n '2,$s|^\([^[:space:]]\{1,\}\).*|\1|p' ) )
fi
- COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "${queryresults[*]}" \
- -- "$cur" ) )
+ COMPREPLY+=( $( compgen -W "${queryresults[*]}" -- "$cur" ) )
return 0
}
@@ -114,38 +113,34 @@ _muttquery()
# @param $1 (cur) Current word to complete
_muttfiledir()
{
- local cur=$1 folder muttrc spoolfile muttcmd=${COMP_WORDS[0]}
+ local cur=$1 folder muttrc spoolfile muttcmd=${words[0]}
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
# (minus the leading '=' sign).
- _compopt_o_filenames
+ compopt -o filenames
COMPREPLY=( $( compgen -f -- "$folder/${cur:1}" ) )
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}";
+ [ ! -z "$spoolfile" ] && eval cur="${cur/^!/$spoolfile}"
fi
_filedir
return 0
-} # _muttfiledir
+}
_mutt()
{
- local cur prev
- _get_comp_words_by_ref -n =+! cur prev
- #cur=`_get_cword =+!`
- #prev=`_get_pword =+!`
-
- COMPREPLY=()
+ local cur prev words cword
+ _init_completion -n =+! || return
case $cur in
-*)
@@ -173,14 +168,7 @@ _mutt()
esac
;;
esac
-} # _mutt()
+} &&
complete -F _mutt -o default mutt muttng
-} # have mutt
-
-# 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/mysql b/completions/mysql
new file mode 100644
index 00000000..effd313c
--- /dev/null
+++ b/completions/mysql
@@ -0,0 +1,82 @@
+# mysql(1) completion -*- shell-script -*-
+
+_mysql()
+{
+ local cur prev words cword split
+ _init_completion -s || return
+
+ case $prev in
+ -u|--user)
+ COMPREPLY=( $( compgen -u -- "$cur" ) )
+ return 0
+ ;;
+ -D|--database)
+ COMPREPLY=( $( compgen -W "$(mysqlshow 2>/dev/null|sed -ne '2d' -e 's/^|.\([^|]*\)|.*/\1/p')" -- "$cur" ) )
+ return 0
+ ;;
+
+ -h|--host)
+ _known_hosts_real "$cur"
+ return 0
+ ;;
+ --default-character-set)
+ [ -d /usr/share/mysql/charsets ] && \
+ COMPREPLY=( $( compgen -W "$(command ls /usr/share/mysql/charsets|sed -e '/^\(README\|Index\.xml\)$/d' -e 's/.xml$//') utf8" -- "$cur" ) )
+ return 0
+ ;;
+
+ --character-sets-dir|--ssl-capath)
+ _filedir -d
+ return 0
+ ;;
+ -S|--socket)
+ _filedir sock
+ return 0
+ ;;
+ --protocol)
+ COMPREPLY=( $( compgen -W 'tcp socket pipe memory' -- "$cur" ) )
+ return 0
+ ;;
+ --defaults-file|--defaults-extra-file|--tee)
+ _filedir
+ return 0
+ ;;
+ --default-character-set|-P|--port|--set-variable|\
+ --ssl-ca|--ssl-cert|--ssl-cipher|--ssl-key|\
+ --connect_timeout|--max_allowed_packet|--prompt|\
+ --net_buffer_length|--select_limit|--max_join_size|\
+ --server-arg|--debug|--delimiter|--execute|-e|--pager)
+ # Argument required but no completions available
+ return 0
+ ;;
+ '-?'|-I|--help|-V|--version)
+ # All other options are noop with these
+ return 0
+ ;;
+ esac
+
+ case $cur in
+ --*)
+ local help=$(_parse_help "$1")
+ help+=" --skip-comments --skip-ssl"
+
+ COMPREPLY=( $( compgen -W "$help" -- "$cur" ) )
+ [[ $COMPREPLY == *= ]] && compopt -o nospace
+ return 0
+ ;;
+
+ # only complete long options
+ -)
+ compopt -o nospace
+ COMPREPLY=( -- )
+ return 0
+ ;;
+ esac
+
+ COMPREPLY=( $( compgen -W \
+ "$(mysqlshow 2>/dev/null|sed -ne '2d' -e 's/^|.\([^|]*\)|.*/\1/p')" \
+ -- "$cur" ) )
+} &&
+complete -F _mysql mysql
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/mysqladmin b/completions/mysqladmin
index c9415696..fd8c3186 100644
--- a/completions/mysqladmin
+++ b/completions/mysqladmin
@@ -1,14 +1,9 @@
-# bash completion for mysqladmin
+# bash completion for mysqladmin -*- shell-script -*-
-have mysqladmin &&
_mysqladmin()
{
- local cur prev split=false
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- _split_longopt && split=true
+ local cur prev words cword split
+ _init_completion -s || return
case $prev in
-u|--user)
@@ -45,27 +40,16 @@ _mysqladmin()
$split && return 0
- COMPREPLY=( $( compgen -W '--count --debug-check --debug-info --force \
- --compress --character-sets-dir --default-character-set --help --host \
- --no-beep --password --port --protocol --relative --set-variable \
- --silent --socket --sleep --ssl --ssl-ca --ssl-capath --ssl-cert \
- --ssl-cipher --ssl-key --ssl-verify-server-cert --user --verbose \
- --version --vertical --wait --connect_timeout --shutdown_timeout \
- --print-defaults --no-defaults --defaults-file --defaults-extra-file' \
- -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
- COMPREPLY=( "${COMPREPLY[@]}" \
+ COMPREPLY+=( \
$( compgen -W 'create debug drop extended-status flush-hosts \
flush-logs flush-status flush-tables flush-threads flush-privileges \
kill password old-password ping processlist reload refresh shutdown \
status start-slave stop-slave variables version' -- "$cur" ) )
+
+ [[ $COMPREPLY == *= ]] && compopt -o nospace
} &&
complete -F _mysqladmin mysqladmin
-# 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/ncftp b/completions/ncftp
index b831f444..57347e0e 100644
--- a/completions/ncftp
+++ b/completions/ncftp
@@ -1,14 +1,11 @@
-# bash completion for ncftp
+# bash completion for ncftp -*- shell-script -*-
-have ncftp &&
_ncftp()
{
- local cur
+ local cur prev words cword
+ _init_completion || return
- COMPREPLY=()
- _get_comp_words_by_ref cur
-
- if [[ $COMP_CWORD -eq 1 && -f ~/.ncftp/bookmarks ]]; then
+ if [[ $cword -eq 1 && -f ~/.ncftp/bookmarks ]]; then
COMPREPLY=( $( compgen -W '$( sed -ne "s/^\([^,]\{1,\}\),.*$/\1/p" \
~/.ncftp/bookmarks )' -- "$cur" ) )
fi
@@ -17,10 +14,4 @@ _ncftp()
} &&
complete -F _ncftp -o default ncftp
-# 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/net-tools b/completions/net-tools
deleted file mode 100644
index e7de2b04..00000000
--- a/completions/net-tools
+++ /dev/null
@@ -1,131 +0,0 @@
-# bash completion for net tools
-
-have mii-tool &&
-_mii_tool()
-{
- local cur prev split=false
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- _split_longopt && split=true
-
- case $prev in
- -F|--force)
- COMPREPLY=( $( compgen -W '100baseTx-FD 100baseTx-HD \
- 10baseT-FD 10baseT-HD' -- "$cur" ) )
- return 0
- ;;
- -A|--advertise)
- COMPREPLY=( $( compgen -W '100baseT4 100baseTx-FD 100baseTx-HD \
- 10baseT-FD 10baseT-HD' -- "$cur" ) )
- return 0
- ;;
- esac
-
- $split && return 0
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--verbose --version --reset --restart \
- --watch --log --advertise --force' -- "$cur" ) )
- else
- _available_interfaces -a
- fi
-} &&
-complete -F _mii_tool -o default mii-tool
-
-have mii-diag &&
-_mii_diag()
-{
- local cur prev split=false
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- _split_longopt && split=true
-
- case $prev in
- -F|-A|--advertise|--fixed-speed)
- COMPREPLY=( $( compgen -W '100baseT4 100baseTx \
- 100baseTx-FD 100baseTx-HD 10baseT 10baseT-FD \
- 10baseT-HD' -- "$cur" ) )
- return 0
- ;;
- esac
-
- $split && return 0
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--advertise --fixed-speed --all-interfaces \
- --status --debug --read-parameters --set-parameters --msg-level \
- --phy --restart --reset --verbose --version --watch --help' \
- -- "$cur" ) )
- else
- _available_interfaces -a
- fi
-} &&
-complete -F _mii_diag -o default mii-diag
-
-# Linux route(8) completion
-#
-[ $UNAME = Linux ] && have route &&
-_route()
-{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- if [ "$prev" = dev ]; then
- _available_interfaces
- return 0
- fi
-
- # Remove already given options from completions
- local i found
- for opt in add del -host -net netmask metric mss window irtt reject mod \
- dyn reinstate dev default gw; do
- found=false
- for (( i=1; i < ${#COMP_WORDS[@]}-1; i++ )); do
- [ "${COMP_WORDS[i]}" = "$opt" ] && found=true && break
- done
- $found || COMPREPLY[${#COMPREPLY[@]}]="$opt"
- done
-
- COMPREPLY=( $( compgen -W '"${COMPREPLY[@]}"' -- "$cur" ) )
-} &&
-complete -F _route route
-
-have ether-wake &&
-_ether_wake()
-{
- COMPREPLY=()
- local cur prev
- _get_comp_words_by_ref -n : cur prev
-
- case $prev in
- -i)
- _available_interfaces
- return 0
- ;;
- -p)
- return 0
- ;;
- esac
-
- if [[ $cur == -* ]]; then
- COMPREPLY=( $( compgen -W '-b -D -i -p -V' -- "$cur" ) )
- return 0
- fi
-
- _mac_addresses
-} &&
-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..ddcd79e8
--- /dev/null
+++ b/completions/newgrp
@@ -0,0 +1,16 @@
+# newgrp(1) completion -*- shell-script -*-
+
+_newgrp()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ if [[ "$cur" == "-" ]]; then
+ COMPREPLY=( - )
+ else
+ _allowed_groups "$cur"
+ fi
+} &&
+complete -F _newgrp newgrp
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/newlist b/completions/newlist
new file mode 100644
index 00000000..9e2f6933
--- /dev/null
+++ b/completions/newlist
@@ -0,0 +1,17 @@
+# mailman newlist completion -*- shell-script -*-
+
+_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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/newusers b/completions/newusers
new file mode 100644
index 00000000..aa1394d2
--- /dev/null
+++ b/completions/newusers
@@ -0,0 +1,31 @@
+# newusers(8) completion -*- shell-script -*-
+
+_newusers()
+{
+ local cur prev words cword split
+ _init_completion -s || return
+
+ case $prev in
+ -c|--crypt)
+ COMPREPLY=( $( compgen -W 'DES MD5 NONE SHA256 SHA512' \
+ -- "$cur" ) )
+ return 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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/nmap b/completions/nmap
index 19f0a07e..89769bfb 100644
--- a/completions/nmap
+++ b/completions/nmap
@@ -1,13 +1,9 @@
-# bash completion for nmap
+# bash completion for nmap -*- shell-script -*-
-have nmap &&
_nmap()
{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=`_get_pword`
+ local cur prev words cword
+ _init_completion || return
case $prev in
-iL|-oN|-oX|-oS|-oG|---excludefile|--resume|--stylesheet)
@@ -51,10 +47,4 @@ _nmap()
} &&
complete -F _nmap nmap
-# 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/nslookup b/completions/nslookup
new file mode 100644
index 00000000..8285ee1a
--- /dev/null
+++ b/completions/nslookup
@@ -0,0 +1,75 @@
+# bash completion for nslookup -*- shell-script -*-
+
+_bind_queryclass()
+{
+ COMPREPLY+=( $( compgen -W 'IN CH HS ANY' -- "$cur" ) )
+}
+
+_bind_querytype()
+{
+ # http://en.wikipedia.org/wiki/List_of_DNS_record_types
+ COMPREPLY+=( $( compgen -W 'A AAAA AFSDB APL CERT CNAME DHCID DLV DNAME
+ DNSKEY DS HIP IPSECKEY KEY KX LOC MX NAPTR NS NSEC NSEC3 NSEC3PARAM PTR
+ RRSIG RP SIG SOA SPF SRV SSHFP TXT' -- "$cur" ) )
+}
+
+_nslookup()
+{
+ local cur prev words cword
+ _init_completion -n = || return
+
+ case $cur in
+ -class=*|-cl=*)
+ cur=${cur#*=}
+ _bind_queryclass
+ return
+ ;;
+ -querytype=*|-type=*|-q=*|-ty=*)
+ cur=${cur#*=}
+ _bind_querytype
+ return
+ ;;
+ -?*=*)
+ return
+ ;;
+ esac
+
+ if [[ $cur == -* ]]; then
+ COMPREPLY=( $( compgen -W '-all -class= -debug -nodebug -d2 -nod2
+ -domain= -search -nosearch -port= -querytype= -recurse -norecurse
+ -retry= -timeout= -vc -novc -fail -nofail' -- "$cur" ) )
+ [[ $COMPREPLY == *= ]] && compopt -o nospace
+ fi
+} &&
+complete -F _nslookup nslookup
+
+_host()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ case $prev in
+ -c)
+ _bind_queryclass
+ return
+ ;;
+ -t)
+ _bind_querytype
+ return
+ ;;
+ -m)
+ COMPREPLY=( $( compgen -W 'trace record usage' -- "$cur" ) )
+ return
+ ;;
+ -N|-R|-W)
+ return
+ ;;
+ esac
+
+ if [[ $cur == -* ]]; then
+ COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) )
+ fi
+} &&
+complete -F _host host
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/ntpdate b/completions/ntpdate
index bf004b55..e09a2dfb 100644
--- a/completions/ntpdate
+++ b/completions/ntpdate
@@ -1,12 +1,9 @@
-# bash completion for ntpdate
+# bash completion for ntpdate -*- shell-script -*-
-have ntpdate &&
_ntpdate()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-k)
@@ -14,24 +11,25 @@ _ntpdate()
return 0
;;
-U)
- COMPREPLY=( $( compgen -u "$cur" ) )
+ COMPREPLY=( $( compgen -u "$cur" ) )
+ return 0
+ ;;
+ -p)
+ COMPREPLY=( $( compgen -W '{1..8}' -- "$cur" ) )
+ return 0
+ ;;
+
+ -a|-e|-o|-t)
return 0
;;
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-4 -6 -b -B -d -Q -q -s -u -v -a\
- -e -k -p -o -r -t' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) )
else
_known_hosts_real "$cur"
fi
} &&
complete -F _ntpdate ntpdate
-# 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/openssl b/completions/openssl
index e9796e6f..68a13c2a 100644
--- a/completions/openssl
+++ b/completions/openssl
@@ -1,14 +1,13 @@
-# bash completion for openssl
+# bash completion for openssl -*- shell-script -*-
-have openssl && {
_openssl_sections()
{
local config f
# check if a specific configuration file is used
- for (( i=2; i < COMP_CWORD; i++ )); do
- if [[ "${COMP_WORDS[i]}" == -config ]]; then
- config=${COMP_WORDS[i+1]}
+ for (( i=2; i < cword; i++ )); do
+ if [[ "${words[i]}" == -config ]]; then
+ config=${words[i+1]}
break
fi
done
@@ -29,10 +28,10 @@ _openssl_sections()
_openssl()
{
- local cur prev commands command options formats
+ local cur prev words cword
+ _init_completion || return
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local commands command options formats
commands='asn1parse ca ciphers crl crl2pkcs7 dgst dh dhparam dsa \
dsaparam ec ecparam enc engine errstr gendh gendsa genrsa \
@@ -49,10 +48,10 @@ _openssl()
rc2-40-cbc rc2-64-cbc rc2-cbc rc2-cfb rc2-ecb rc2-ofb rc4 \
rc4-40'
- if [ $COMP_CWORD -eq 1 ]; then
+ if [ $cword -eq 1 ]; then
COMPREPLY=( $( compgen -W "$commands" -- "$cur" ) )
else
- command=${COMP_WORDS[1]}
+ command=${words[1]}
case $prev in
-CA|-CAfile|-CAkey|-CAserial|-cert|-certfile|-config|-content| \
-dcert|-dkey|-dhparam|-extfile|-in|-inkey|-kfile|-key|-keyout| \
@@ -74,10 +73,10 @@ _openssl()
formats='DER PEM'
case $command in
x509)
- formats="$formats NET"
+ formats+=" NET"
;;
smime)
- formats="$formats SMIME"
+ formats+=" SMIME"
;;
esac
COMPREPLY=( $( compgen -W "$formats" -- "$cur" ) )
@@ -93,8 +92,8 @@ _openssl()
return 0
;;
-cipher)
- COMPREPLY=( $( compgen -W "$(openssl ciphers | \
- tr ':' '\n')" -- "$cur" ) )
+ COMPREPLY=( $( IFS=: compgen -W "$( openssl ciphers )" \
+ -- "$cur" ) )
return 0
;;
esac
@@ -241,14 +240,7 @@ _openssl()
fi
fi
fi
-}
+} &&
complete -F _openssl -o default openssl
-}
-# 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/p4 b/completions/p4
index 59b02c1d..59d1bcd9 100644
--- a/completions/p4
+++ b/completions/p4
@@ -1,15 +1,15 @@
-# Perforce completion by Frank Cusack <frank@google.com>
+# Perforce completion -*- shell-script -*-
+# by Frank Cusack <frank@google.com>
-have p4 &&
_p4()
{
- local cur prev words cword p4commands p4filetypes
+ local cur prev words cword
+ _init_completion || return
- COMPREPLY=()
- _get_comp_words_by_ref cur prev words cword
+ 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"
@@ -49,10 +49,4 @@ _p4()
} &&
complete -F _p4 -o default p4 g4
-# 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/pack200 b/completions/pack200
new file mode 100644
index 00000000..6be2dc88
--- /dev/null
+++ b/completions/pack200
@@ -0,0 +1,75 @@
+# pack200(1) completion -*- shell-script -*-
+
+_pack200()
+{
+ local cur prev words cword split
+ _init_completion -s || return
+
+ case $prev in
+ -S|--segment-limit|-P|--pass-file|-C|--class-attribute|\
+ -F|--field-attribute|-M|--method-attribute|-D|--code-attribute|\
+ '-?'|-h|--help|-V|--version|-J)
+ return 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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/passwd b/completions/passwd
new file mode 100644
index 00000000..e470b8bb
--- /dev/null
+++ b/completions/passwd
@@ -0,0 +1,23 @@
+# passwd(1) completion -*- shell-script -*-
+
+_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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/perl b/completions/perl
index 843e249b..a67c7699 100644
--- a/completions/perl
+++ b/completions/perl
@@ -1,26 +1,26 @@
-# bash completion for perl
+# bash completion for perl -*- shell-script -*-
-have perl &&
-{
_perlmodules()
{
- COMPREPLY=( $( compgen -P "$prefix" -W "$( $1 ${BASH_SOURCE[0]%/*}/helpers/perl modules $cur )" -- "$cur" ) )
+ COMPREPLY=( $( compgen -P "$prefix" -W \
+ "$( ${1:-perl} ${BASH_SOURCE[0]%/*}/../helpers/perl modules $cur )" \
+ -- "$cur" ) )
__ltrim_colon_completions "$prefix$cur"
}
_perlfunctions()
{
- COMPREPLY=( $( compgen -P "$prefix" -W "$( ${BASH_SOURCE[0]%/*}/helpers/perl functions $cur )" -- "$cur" ) )
+ COMPREPLY=( $( compgen -P "$prefix" -W \
+ "$( ${1:-perl} ${BASH_SOURCE[0]%/*}/../helpers/perl functions $cur )" \
+ -- "$cur" ) )
}
_perl()
{
- local cur prev prefix temp
- local optPrefix optSuffix
+ local cur prev words cword
+ _init_completion -n : || return
- COMPREPLY=()
- _get_comp_words_by_ref -n : cur prev
- prefix=""
+ local prefix="" temp optPrefix optSuffix
# If option not followed by whitespace, reassign prev and cur
if [[ "$cur" == -?* ]]; then
@@ -38,13 +38,13 @@ _perl()
;;
-I|-x)
local IFS=$'\n'
- _compopt_o_filenames
+ compopt -o filenames
COMPREPLY=( $( compgen -d $optPrefix $optSuffix -- "$cur" ) )
return 0
;;
-m|-M)
temp="${cur#-}"
- prefix="$prefix${cur%$temp}"
+ prefix+="${cur%$temp}"
cur="$temp"
_perlmodules $1
return 0
@@ -52,7 +52,7 @@ _perl()
-V)
if [[ $cur == :* ]]; then
temp="${cur##+(:)}"
- prefix="$prefix${cur%$temp}"
+ prefix+="${cur%$temp}"
local IFS=$'\n'
COMPREPLY=( $( compgen -P "$prefix" -W \
'$( $1 -MConfig -e "print join \"\\n\",
@@ -78,16 +78,15 @@ _perl()
else
_filedir
fi
-}
+} &&
complete -F _perl perl
_perldoc()
{
- local cur prev prefix temp
+ local cur prev words cword
+ _init_completion -n : || return
- COMPREPLY=()
- _get_comp_words_by_ref -n : cur prev
- prefix=""
+ local prefix="" temp
# completing an option (may or may not be separated by a space)
if [[ "$cur" == -?* ]]; then
@@ -97,10 +96,13 @@ _perldoc()
prefix=$prev
fi
+ local perl="${1%doc}"
+ [[ $perl == $1 ]] || ! type $perl &>/dev/null && perl=
+
# complete builtin perl functions
case $prev in
-f)
- _perlfunctions "$cur"
+ _perlfunctions $perl
return 0
;;
esac
@@ -109,23 +111,19 @@ _perldoc()
COMPREPLY=( $( compgen -W '-h -v -t -u -m -l -F -X -f -q' -- "$cur" ))
else
# return available modules (unless it is clearly a file)
- if [[ "$cur" != */* ]]; then
- _perlmodules
- COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W \
- '$( PAGER=/bin/cat man perl | \
- sed -ne "/perl.*Perl overview/,/perlwin32/p" | \
- awk "\$NF=2 { print \$1}" | command grep perl )' -- "$cur" ) )
+ if [[ "$cur" != @(*/|[.~])* ]]; then
+ _perlmodules $perl
+ if [[ $cur == p* ]]; then
+ COMPREPLY+=( $( compgen -W \
+ '$( PERLDOC_PAGER=/bin/cat "$1" -u perl | \
+ sed -ne "/perl.*Perl overview/,/perlwin32/p" | \
+ awk "\$NF=2 && \$1 ~ /^perl/ { print \$1 }" )' \
+ -- "$cur" ) )
+ fi
fi
_filedir 'p@(l|m|od)'
fi
-}
+} &&
complete -F _perldoc -o bashdefault perldoc
-}
-# 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/pgrep b/completions/pgrep
new file mode 100644
index 00000000..9e66fb95
--- /dev/null
+++ b/completions/pgrep
@@ -0,0 +1,38 @@
+# pgrep(1) completion -*- shell-script -*-
+
+_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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/pine b/completions/pine
index 2f069287..39227625 100644
--- a/completions/pine
+++ b/completions/pine
@@ -1,22 +1,13 @@
-# PINE address-book completion
+# PINE address-book completion -*- shell-script -*-
-have pine || have alpine &&
_pineaddr()
{
- local cur
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
+ local cur prev words cword
+ _init_completion || return
COMPREPLY=( $( compgen -W '$( awk "{print \$1}" ~/.addressbook \
2>/dev/null)' -- "$cur" ) )
} &&
complete -F _pineaddr -o default pine alpine
-# 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/ping b/completions/ping
new file mode 100644
index 00000000..7b1f77a0
--- /dev/null
+++ b/completions/ping
@@ -0,0 +1,61 @@
+# ping(8) completion -*- shell-script -*-
+
+_ping()
+{
+ local cur prev words cword
+ _init_completion -n = || return
+
+ case $prev in
+ -c|-F|-G|-g|-h|-i|-l|-m|-P|-p|-s|-t|-V|-W|-w|-z)
+ return
+ ;;
+ -I)
+ _available_interfaces -a
+ return
+ ;;
+ -M)
+ # Path MTU strategy in Linux, mask|time in FreeBSD
+ local opts="do want dont"
+ [[ $OSTYPE == *bsd* ]] && opts="mask time"
+ COMPREPLY=( $( compgen -W '$opts' -- "$cur" ) )
+ return
+ ;;
+ -N)
+ if [[ $cur != *= ]]; then
+ COMPREPLY=( $( compgen -W 'name ipv6 ipv6-global ipv6-sitelocal
+ ipv6-linklocal ipv6-all ipv4 ipv4-all subject-ipv6=
+ subject-ipv4= subject-name= subject-fqdn=' -- "$cur" ) )
+ [[ $COMPREPLY == *= ]] && compopt -o nospace
+ fi
+ return
+ ;;
+ -Q)
+ # TOS in Linux, "somewhat quiet" (no args) in FreeBSD
+ if [[ $OSTYPE != *bsd* ]]; then
+ COMPREPLY=( $( compgen -W '{0..7}' -- "$cur" ) )
+ return
+ fi
+ ;;
+ -S)
+ # Socket sndbuf in Linux, source IP in FreeBSD
+ [[ $OSTYPE == *bsd* ]] && _ip_addresses
+ return
+ ;;
+ -T)
+ # Timestamp option in Linux, TTL in FreeBSD
+ [[ $OSTYPE == *bsd* ]] || \
+ COMPREPLY=( $( compgen -W 'tsonly tsandaddr' -- "$cur" ) )
+ return
+ ;;
+ esac
+
+ if [[ $cur == -* ]]; then
+ COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) )
+ return
+ fi
+
+ _known_hosts_real "$cur"
+} &&
+complete -F _ping ping ping6
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/pkg-config b/completions/pkg-config
index b999bd81..0156c0dd 100644
--- a/completions/pkg-config
+++ b/completions/pkg-config
@@ -1,14 +1,9 @@
-# bash completion for pkgconfig
+# bash completion for pkgconfig -*- shell-script -*-
-have pkg-config &&
_pkg_config()
{
- local cur prev split=false
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- _split_longopt && split=true
+ local cur prev words cword split
+ _init_completion -s || return
case $prev in
--variable|--define-variable|--atleast-version|--atleast-pkgconfig-version| \
@@ -25,16 +20,8 @@ _pkg_config()
$split && return 0
if [[ "$cur" == -* ]]; then
- # return list of available options
- COMPREPLY=( $( compgen -W '--version --modversion \
- --atleast-pkgconfig-version --libs --static \
- --short-errors --libs-only-l --libs-only-other \
- --libs-only-L --cflags --cflags-only-I \
- --cflags-only-other --variable --define-variable \
- --exists --uninstalled --atleast-version \
- --exact-version --max-version --list-all --debug \
- --print-errors --silence-errors --errors-to-stdout \
- --print-provides --print-requires --help --usage' -- "$cur") )
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
+ [[ $COMPREPLY == *= ]] && compopt -o nospace
else
COMPREPLY=( $( compgen -W "$( pkg-config --list-all \
2>/dev/null | awk '{print $1}' )" -- "$cur" ) )
@@ -42,10 +29,4 @@ _pkg_config()
} &&
complete -F _pkg_config pkg-config
-# 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/pkg_delete b/completions/pkg_delete
new file mode 100644
index 00000000..15770acb
--- /dev/null
+++ b/completions/pkg_delete
@@ -0,0 +1,21 @@
+# bash completion for FreeBSD package management tools -*- shell-script -*-
+
+[[ $OSTYPE == *freebsd* ]] || return 1
+
+_pkg_delete()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ local pkgdir=${PKG_DBDIR:-/var/db/pkg}/
+
+ [[ "$prev" == -o || "$prev" == -p || "$prev" == -W ]] && return 0
+
+ COMPREPLY=( $( compgen -d "$pkgdir$cur" ) )
+ COMPREPLY=( ${COMPREPLY[@]#$pkgdir} )
+
+ return 0
+} &&
+complete -F _pkg_delete -o dirnames pkg_delete pkg_info pkg_deinstall
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/pkg_install b/completions/pkg_install
deleted file mode 100644
index 577d9c94..00000000
--- a/completions/pkg_install
+++ /dev/null
@@ -1,30 +0,0 @@
-# bash completion for FreeBSD base package management tools
-
-[ $UNAME = FreeBSD ] &&
-{
-
-_pkg_delete()
-{
- local cur pkgdir prev
-
- pkgdir=${PKG_DBDIR:-/var/db/pkg}/
- _get_comp_words_by_ref cur prev
-
- [[ "$prev" == -o || "$prev" == -p || "$prev" == -W ]] && return 0
-
- COMPREPLY=( $( compgen -d "$pkgdir$cur" ) )
- COMPREPLY=( ${COMPREPLY[@]#$pkgdir} )
-
- return 0
-}
-complete -F _pkg_delete -o dirnames pkg_delete pkg_info
-
-}
-
-# 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/pkgtool b/completions/pkgtool
new file mode 100644
index 00000000..f7291dbd
--- /dev/null
+++ b/completions/pkgtool
@@ -0,0 +1,36 @@
+# Slackware Linux pkgtool completion -*- shell-script -*-
+
+_pkgtool()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ case "$prev" in
+ --source_dir|--target_dir)
+ _filedir -d
+ return 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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/pkgtools b/completions/pkgtools
deleted file mode 100644
index 3a5df278..00000000
--- a/completions/pkgtools
+++ /dev/null
@@ -1,22 +0,0 @@
-# bash completion for Slackware Linux pkgtools
-
-have removepkg && [ -f /etc/slackware-version ] &&
-_removepkg()
-{
- local packages cur
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
-
- COMPREPLY=( $( (cd /var/log/packages; compgen -f -- "$cur") ) )
-} &&
-complete -F _removepkg -o filenames removepkg &&
- complete -o dirnames -f -X '!*.t[bglx]z' installpkg upgradepkg 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..24b30b17
--- /dev/null
+++ b/completions/pm-hibernate
@@ -0,0 +1,12 @@
+# bash completion for pm-utils -*- shell-script -*-
+
+_pm_action()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ COMPREPLY=( $( compgen -W "--help $( _parse_help "$1" )" -- "$cur" ) )
+} &&
+complete -F _pm_action pm-hibernate pm-suspend pm-suspend-hybrid
+
+# ex: 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..2ca5a9ec
--- /dev/null
+++ b/completions/pm-is-supported
@@ -0,0 +1,13 @@
+# pm-is-supported(1) completion -*- shell-script -*-
+
+_pm_is_supported()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ COMPREPLY=( $( compgen -W '--help --suspend --hibernate --suspend-hybrid' \
+ -- "$cur" ) )
+} &&
+complete -F _pm_is_supported pm-is-supported
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/pm-powersave b/completions/pm-powersave
new file mode 100644
index 00000000..1f790dca
--- /dev/null
+++ b/completions/pm-powersave
@@ -0,0 +1,12 @@
+# pm-powersave(8) completion -*- shell-script -*-
+
+_pm_powersave()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ COMPREPLY=( $( compgen -W "true false" -- "$cur" ) )
+} &&
+complete -F _pm_powersave pm-powersave
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/pm-utils b/completions/pm-utils
deleted file mode 100644
index 4deb82e7..00000000
--- a/completions/pm-utils
+++ /dev/null
@@ -1,37 +0,0 @@
-# bash completion for pm-utils
-
-have pm-is-supported &&
-_pm_is_supported()
-{
- local cur
- _get_comp_words_by_ref cur
- 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
- _get_comp_words_by_ref cur
- 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
- _get_comp_words_by_ref cur
- 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..3b30c5b3
--- /dev/null
+++ b/completions/portinstall
@@ -0,0 +1,32 @@
+# bash completion for FreeBSD portinstall -*- shell-script -*-
+
+_portinstall()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ local portsdir indexfile
+ local -a COMPREPLY2
+
+ portsdir=${PORTSDIR:-/usr/ports}/
+
+ # First try INDEX-5
+ indexfile=$portsdir/INDEX-5
+ # Then INDEX if INDEX-5 does not exist or system is not FreeBSD 5.x
+ [[ "${OSTYPE%.*}" == freebsd5 && -f $indexfile ]] ||
+ indexfile=$portsdir/INDEX
+
+ [[ "$prev" == -l || "$prev" == -L || "$prev" == -o ]] && return 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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/portupgrade b/completions/portupgrade
index 5389a5ca..96e4fb6d 100644
--- a/completions/portupgrade
+++ b/completions/portupgrade
@@ -1,15 +1,14 @@
-# bash completion for FreeBSD portupgrade package
+# bash completion for FreeBSD portupgrade -*- shell-script -*-
-have portupgrade &&
_portupgrade()
{
- local cur pkgdir prev
-
- pkgdir=${PKG_DBDIR:-/var/db/pkg}/
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
[[ "$prev" == -l || "$prev" == -L || "$prev" == -o ]] && return 0
+ local pkgdir=${PKG_DBDIR:-/var/db/pkg}/
+
COMPREPLY=( $( compgen -d "$pkgdir$cur" ) )
COMPREPLY=( ${COMPREPLY[@]#$pkgdir} )
COMPREPLY=( ${COMPREPLY[@]%-*} )
@@ -18,40 +17,4 @@ _portupgrade()
} &&
complete -F _portupgrade -o dirnames portupgrade
-have portinstall &&
-_portinstall()
-{
- local cur portsdir prev indexfile
- local -a COMPREPLY2
-
- portsdir=${PORTSDIR:-/usr/ports}/
- _get_comp_words_by_ref cur prev
- # 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=( "${COMPREPLY[@]}" "${COMPREPLY2[@]}" )
-
- return 0
-} &&
-complete -F _portinstall -o dirnames portinstall
-
-# _pkg_delete is in pkg_install
-type _pkg_delete &>/dev/null && have pkg_deinstall && \
-complete -F _pkg_delete -o dirnames pkg_deinstall
-
-# 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/postcat b/completions/postcat
new file mode 100644
index 00000000..c601cb0c
--- /dev/null
+++ b/completions/postcat
@@ -0,0 +1,42 @@
+# postcat(1) completion -*- shell-script -*-
+
+_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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/postconf b/completions/postconf
new file mode 100644
index 00000000..5b998d9e
--- /dev/null
+++ b/completions/postconf
@@ -0,0 +1,41 @@
+# postconf(1) completion -*- shell-script -*-
+
+_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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/postfix b/completions/postfix
index 1311c987..7eefccbb 100644
--- a/completions/postfix
+++ b/completions/postfix
@@ -1,14 +1,9 @@
-# bash completion for postfix
+# postfix(1) completion -*- shell-script -*-
-have postfix && {
-# postfix(1)
-#
_postfix()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-c)
@@ -22,212 +17,13 @@ _postfix()
esac
if [[ $cur == -* ]]; then
- COMPREPLY=( $( compgen -W '-c -D -v' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) )
return 0
fi
COMPREPLY=( $( compgen -W 'check start stop abort flush reload status \
set-permissions upgrade-configuration' -- "$cur" ) )
-}
+} &&
complete -F _postfix postfix
-# postalias(1) and postmap(1)
-#
-_postmap()
-{
- local cur prev len idx
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- case $prev in
- -c)
- _filedir -d
- return 0
- ;;
- -[dq])
- return 0
- ;;
- esac
-
- if [[ $cur == -* ]]; then
- COMPREPLY=( $( compgen -W '-N -f -i -n -o -p -r -v -w -c -d -q' \
- -- "$cur" ) )
- return 0
- fi
-
- if [[ "$cur" == *:* ]]; then
- _compopt_o_filenames
- COMPREPLY=( $( compgen -f -- "${cur#*:}" ) )
- else
- len=${#cur}
- idx=0
- 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 pval len idx qfile
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- case $prev in
- -c)
- _filedir -d
- return 0
- ;;
- esac
-
- if [[ $cur == -* ]]; then
- COMPREPLY=( $( compgen -W '-c -q -v' -- "$cur" ) )
- return 0
- fi
-
- qfile=0
- for idx in "${COMP_WORDS[@]}"; do
- [[ "$idx" = -q ]] && qfile=1 && break
- done
- if [[ $qfile == 1 ]]; then
- len=${#cur}
- 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 pval len idx eqext
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- case $prev in
- -b|-t)
- _filedir
- return 0
- ;;
- -c)
- _filedir -d
- return 0
- ;;
- -e)
- cur=${cur#[\"\']}
- eqext='='
- ;;
- esac
-
- if [[ $cur == -* ]]; then
- COMPREPLY=( $( compgen -W '-A -a -b -c -d -e -h -m -l -n -t -v' \
- -- "$cur" ) )
- return 0
- fi
-
- len=${#cur}
- idx=0
- 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 pval len idx
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- 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 '-c -d -h -H -p -r -s -v' -- "$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/postmap b/completions/postmap
new file mode 100644
index 00000000..001db9b5
--- /dev/null
+++ b/completions/postmap
@@ -0,0 +1,43 @@
+# postalias(1) and postmap(1) completion -*- shell-script -*-
+
+_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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/postsuper b/completions/postsuper
new file mode 100644
index 00000000..25bc916f
--- /dev/null
+++ b/completions/postsuper
@@ -0,0 +1,62 @@
+# postsuper(1) completion -*- shell-script -*-
+
+_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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/povray b/completions/povray
index a843a5cb..e5ef9df6 100644
--- a/completions/povray
+++ b/completions/povray
@@ -1,13 +1,13 @@
-# povray completion by "David Necas (Yeti)" <yeti@physics.muni.cz>
+# povray completion -*- shell-script -*-
+# by "David Necas (Yeti)" <yeti@physics.muni.cz>
-have povray || have xpovray || have spovray &&
_povray()
{
- local cur prev povcur pfx oext defoext
- defoext=png # default output extension, if cannot be determined FIXME
+ local cur prev words cword
+ _init_completion || return
- COMPREPLY=()
- _get_comp_words_by_ref -c povcur prev
+ local povcur=$cur pfx oext defoext
+ defoext=png # default output extension, if cannot be determined FIXME
_expand || return 0
@@ -21,14 +21,14 @@ _povray()
;;
[-+]O*)
# guess what output file type user may want
- case $( ( IFS=$'\n'; command grep '^[-+]F' <<<"${COMP_WORDS[*]}" ) ) in
+ case $( ( IFS=$'\n'; command grep '^[-+]F' <<<"${words[*]}" ) ) in
[-+]FN) oext=png ;;
[-+]FP) oext=ppm ;;
[-+]F[CT]) oext=tga ;;
*) oext=$defoext ;;
esac
# complete filename corresponding to previously specified +I
- COMPREPLY=( $( ( IFS=$'\n'; command grep '^[-+]I' <<<"${COMP_WORDS[*]}" ) ) )
+ COMPREPLY=( $( ( IFS=$'\n'; command grep '^[-+]I' <<<"${words[*]}" ) ) )
COMPREPLY=( ${COMPREPLY[@]#[-+]I} )
COMPREPLY=( ${COMPREPLY[@]/%.pov/.$oext} )
cur="${povcur#[-+]O}" # to confuse _filedir
@@ -48,7 +48,6 @@ _povray()
return 0
;;
*)
- cur="$povcur"
_filedir '@(ini|pov)'
return 0
;;
@@ -56,10 +55,4 @@ _povray()
} &&
complete -F _povray povray xpovray spovray
-# 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/prelink b/completions/prelink
new file mode 100644
index 00000000..f84261d1
--- /dev/null
+++ b/completions/prelink
@@ -0,0 +1,42 @@
+# prelink(8) completion -*- shell-script -*-
+
+_prelink()
+{
+ local cur prev words cword split
+ _init_completion -s || return
+
+ case $prev in
+ -'?'|--help|--usage|-V|--version|-r|--reloc-only)
+ return
+ ;;
+ -b|--black-list|--dynamic-linker|--undo-output)
+ _filedir
+ return
+ ;;
+ -c|--config-file)
+ _filedir conf
+ return
+ ;;
+ -C|--cache)
+ _filedir cache
+ return
+ ;;
+ --ld-library-path)
+ _filedir -d
+ return
+ ;;
+ esac
+
+ $split && return
+
+ if [[ $cur == -* ]]; then
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
+ [[ $COMPREPLY == *= ]] && compopt -o nospace
+ return
+ fi
+
+ _filedir
+} &&
+complete -F _prelink prelink
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/procps b/completions/procps
deleted file mode 100644
index db8fc3d5..00000000
--- a/completions/procps
+++ /dev/null
@@ -1,49 +0,0 @@
-# Completions for tools included in procps and related
-
-# killall(1) (Linux and FreeBSD) and pkill(1) completion.
-#
-[[ $UNAME == Linux || $UNAME == FreeBSD ]] || have pkill &&
-_killall()
-{
- local cur
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
-
- if [[ $COMP_CWORD -eq 1 && "$cur" == -* ]]; then
- _signals
- else
- _pnames
- fi
-
- return 0
-}
-[[ $UNAME == Linux || $UNAME == FreeBSD ]] && complete -F _killall killall
-have pkill && complete -F _killall pkill
-
-# pgrep(1) completion.
-#
-[ $UNAME = Linux ] || have pgrep &&
-_pgrep()
-{
- local cur
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
-
- _pnames
-
- return 0
-}
-have pgrep && complete -F _pgrep pgrep
-
-# Linux pidof(8) completion.
-[ $UNAME = 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/protoc b/completions/protoc
new file mode 100644
index 00000000..4621cf64
--- /dev/null
+++ b/completions/protoc
@@ -0,0 +1,63 @@
+# protoc completion -*- shell-script -*-
+
+_protoc()
+{
+ local cur prev words cword split
+ _init_completion -s || return
+
+ case $prev in
+ --proto_path|--cpp_out|--java_out|--python_out)
+ _filedir -d
+ return
+ ;;
+ --version|-h|--help|--encode|--decode)
+ return
+ ;;
+ --descriptor_set_out)
+ _filedir
+ return
+ ;;
+ --error_format)
+ COMPREPLY=( $( compgen -W 'gcc msvs' -- "$cur" ) )
+ return
+ ;;
+ --plugin)
+ if [[ $cur != *=* ]]; then
+ compopt -o filenames
+ COMPREPLY=( $( compgen -c -- "$cur" ) )
+ fi
+ return
+ ;;
+ esac
+
+ $split && return
+
+ case $cur in
+ -o*)
+ cur=${cur:2}
+ _filedir
+ COMPREPLY=( "${COMPREPLY[@]/#/-o}" )
+ return
+ ;;
+ -I*)
+ cur=${cur:2}
+ _filedir -d
+ COMPREPLY=( "${COMPREPLY[@]/#/-I}" )
+ return
+ ;;
+ -*)
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
+ local i
+ for i in ${!COMPREPLY[@]}; do
+ [[ ${COMPREPLY[i]} == -oFILE ]] && unset COMPREPLY[i]
+ done
+ [[ $COMPREPLY == *= ]] && compopt -o nospace
+ return
+ ;;
+ esac
+
+ _filedir proto
+} &&
+complete -F _protoc protoc
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/postgresql b/completions/psql
index f874b67b..7e4276bc 100644
--- a/completions/postgresql
+++ b/completions/psql
@@ -1,6 +1,5 @@
-# bash completion for Postgresql
+# bash completion for Postgresql -*- shell-script -*-
-have psql && {
_pg_databases()
{
# -w was introduced in 8.4, https://launchpad.net/bugs/164772
@@ -21,12 +20,8 @@ _pg_users()
#
_createdb()
{
- local cur prev split=false
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- _split_longopt && split=true
+ local cur prev words cword split
+ _init_completion -s || return
case $prev in
-h|--host)
@@ -50,25 +45,20 @@ _createdb()
$split && return 0
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--tablespace --template --encoding --host \
- --port --username --password --echo --quiet --help --version' \
- -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
+ [[ $COMPREPLY == *= ]] && compopt -o nospace
else
_pg_databases
fi
-}
+} &&
complete -F _createdb -o default createdb
# dropdb(1) completion
#
_dropdb()
{
- local cur prev split=false
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- _split_longopt && split=true
+ local cur prev words cword split
+ _init_completion -s || return
case $prev in
-h|--host)
@@ -88,24 +78,20 @@ _dropdb()
$split && return 0
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--host --port --username --password \
- --interactive --echo --quiet --help --version' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
+ [[ $COMPREPLY == *= ]] && compopt -o nospace
else
_pg_databases
fi
-}
+} &&
complete -F _dropdb -o default dropdb
# psql(1) completion
#
_psql()
{
- local cur prev split=false
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- _split_longopt && split=true
+ local cur prev words cword split
+ _init_completion -s || return
case $prev in
-h|--host)
@@ -139,24 +125,13 @@ _psql()
if [[ "$cur" == -* ]]; then
# return list of available options
- COMPREPLY=( $( compgen -W '--echo-all --no-align --command --dbname \
- --echo-queries --echo-hidden --file --field-separator --host \
- --html --list --log-file --output --port --pset --quiet \
- --record-separator --single-step --single-line --tuples-only \
- --table-attr --username --set --version --password --expanded \
- --no-psqlrc --single-transaction --help' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
+ [[ $COMPREPLY == *= ]] && compopt -o nospace
else
# return list of available databases
_pg_databases
fi
-}
+} &&
complete -F _psql psql
-}
-# 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/puppet b/completions/puppet
new file mode 100644
index 00000000..776c8492
--- /dev/null
+++ b/completions/puppet
@@ -0,0 +1,310 @@
+# bash completion for puppet -*- shell-script -*-
+
+_puppet_logdest()
+{
+ if [ -z "$cur" ]; then
+ COMPREPLY=( $( compgen -W 'syslog console /' -- "$cur" ) )
+ else
+ COMPREPLY=( $( compgen -W 'syslog console' -- "$cur" ) )
+ _filedir
+ fi
+}
+
+_puppet_digest()
+{
+ COMPREPLY=( $( compgen -W 'MD5 MD2 SHA1 SHA256' -- "$cur" ) )
+}
+
+_puppet_certs()
+{
+ local puppetca="puppet cert"
+ PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin type puppetca &>/dev/null \
+ && puppetca=puppetca
+
+ if [[ "$1" = '--all' ]]; then
+ cert_list=$( $puppetca --list --all | sed -e 's/^[+-]\?\s*\(\S\+\)\s\+.*$/\1/' )
+ else
+ cert_list=$( $puppetca --list )
+ fi
+ COMPREPLY+=( $( compgen -W "$cert_list" -- "$cur" ) )
+}
+
+_puppet_types()
+{
+ puppet_types=$( puppet describe --list | sed -e 's/^\(\S\+\).*$/\1/' )
+ COMPREPLY+=( $( compgen -W "$puppet_types" -- "$cur" ) )
+}
+
+_puppet_references()
+{
+ local puppetdoc="puppet doc"
+ PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin type puppetdoc &>/dev/null \
+ && puppetdoc=puppetdoc
+
+ puppet_doc_list=$( $puppetdoc --list | sed -e 's/^\(\S\+\).*$/\1/' )
+ COMPREPLY+=( $( compgen -W "$puppet_doc_list" -- "$cur" ) )
+}
+
+_puppet()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ local xspec helpopts command subcommand
+
+ case $prev in
+ --help)
+ return 0
+ ;;
+ esac
+
+ case ${words[0]} in
+ puppetmasterd)
+ command=master
+ ;;
+ puppetd)
+ command=agent
+ ;;
+ puppetca)
+ command=cert
+ ;;
+ ralsh)
+ command=resource
+ ;;
+ puppetrun)
+ command=kick
+ ;;
+ puppetqd)
+ command=queue
+ ;;
+ filebucket)
+ command=filebucket
+ ;;
+ puppetdoc)
+ command=doc
+ ;;
+ pi)
+ command=describe
+ ;;
+ puppet)
+ case ${words[1]} in
+ agent|apply|cert|describe|doc|filebucket|kick|master|queue|resource)
+ command=${words[1]}
+ ;;
+ *.pp|*.rb|-*)
+ command=apply
+ ;;
+ *)
+ COMPREPLY=( $( compgen -W 'agent apply cert describe doc \
+ filebucket kick master queue resource' -- "$cur" ) )
+ return 0
+ ;;
+ esac
+ esac
+
+ case $command in
+ agent)
+ case $prev in
+ --fqdn)
+ return 0
+ ;;
+ --logdest)
+ _puppet_logdest
+ return 0
+ ;;
+ --serve)
+ # From /usr/lib/ruby/1.8/puppet/network/handler/
+ COMPREPLY=( $( compgen -W 'ca filebucket fileserver master \
+ report runner status' -- "$cur" ) )
+ return 0
+ ;;
+ --digest)
+ _puppet_digest
+ return 0
+ ;;
+ --waitforcert)
+ COMPREPLY=( $( compgen -W '0 15 30 60 120' -- "$cur" ) )
+ return 0
+ ;;
+ *)
+ COMPREPLY=( $( compgen -W '--daemonize --no-daemonize \
+ --debug --detailed-exitcodes --disable --enable \
+ --help --fqdn --logdest --onetime --serve --test \
+ --noop --digest --fingerprint --version --verbose \
+ --waitforcert --no-client' -- "$cur" ) )
+ return 0
+ esac
+ ;;
+ apply)
+ case $prev in
+ --logdest)
+ _puppet_logdest
+ return 0
+ ;;
+ *)
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--help --version --debug \
+ --verbose --execute --detailed-exitcodes \
+ --logdest' -- "$cur" ) )
+ else
+ _filedir
+ fi
+ return 0
+ esac
+ ;;
+ cert)
+ case $prev in
+ --digest)
+ _puppet_digest
+ return 0
+ ;;
+ *)
+ subcommand=$prev
+ COMPREPLY=( $( compgen -W '--digest --debug --verbose' \
+ -- "$cur" ) )
+ case $subcommand in
+ --generate)
+ _known_hosts_real "$cur"
+ return 0
+ ;;
+ --clean|--fingerprint|--revoke|--verify)
+ COMPREPLY+=( $( compgen -W '--all' -- "$cur" ) )
+ _puppet_certs --all
+ return 0
+ ;;
+ --sign)
+ COMPREPLY+=( $( compgen -W '--all' -- "$cur" ) )
+ _puppet_certs
+ return 0
+ ;;
+ --list|--print)
+ COMPREPLY+=( $( compgen -W '--all' -- "$cur" ) )
+ return 0
+ ;;
+ *)
+ COMPREPLY=( $( compgen -W '--clean --generate \
+ --help --list --print --fingerprint --revoke \
+ --sign --version --verify' -- "$cur" ) )
+ return 0
+ esac
+ esac
+ ;;
+ describe)
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--help --short --providers --list \
+ --meta' -- "$cur" ) )
+ else
+ _puppet_types
+ fi
+ return 0
+ ;;
+ doc)
+ case $prev in
+ --outputdir)
+ _filedir -d
+ return 0
+ ;;
+ --mode)
+ COMPREPLY=( $( compgen -W 'text trac pdf rdoc' -- "$cur" ) )
+ return 0
+ ;;
+ --reference)
+ _puppet_references
+ return 0
+ ;;
+ *)
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--all --help --outputdir \
+ --mode --reference --charset --list' -- "$cur" ) )
+ else
+ _filedir
+ fi
+ return 0
+ esac
+ ;;
+ filebucket)
+ case $prev in
+ --server)
+ _known_hosts_real "$cur"
+ return 0
+ ;;
+ --bucket)
+ _filedir -d
+ return 0
+ ;;
+ *)
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--help --version --debug \
+ --verbose --local --remote --server --bucket' \
+ -- "$cur" ) )
+ else
+ COMPREPLY=( $( compgen -W 'backup get restore' \
+ -- "$cur" ) )
+ _filedir
+ fi
+ return 0
+ esac
+ ;;
+ kick)
+ case $prev in
+ --class)
+ return 0
+ ;;
+ --host)
+ _known_hosts_real "$cur"
+ return 0
+ ;;
+ --tag)
+ return 0
+ ;;
+ *)
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--all --class --debug \
+ --foreground --help --host --no-fqdn \
+ --ignoreschedules --tag --test --ping' -- "$cur" ) )
+ else
+ _known_hosts_real "$cur"
+ fi
+ return 0
+ esac
+ ;;
+ master)
+ case $prev in
+ --logdest)
+ _puppet_logdest
+ return 0
+ ;;
+ *)
+ COMPREPLY=( $( compgen -W '--daemonize --no-daemonize \
+ --debug --help --logdest --verbose --version' \
+ -- "$cur" ) )
+ return 0
+ esac
+ ;;
+ queue)
+ case $prev in
+ --logdest)
+ _puppet_logdest
+ return 0
+ ;;
+ *)
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--help --version --debug \
+ --verbose --execute --detailed-exitcodes \
+ --logdest' -- "$cur" ) )
+ else
+ _filedir
+ fi
+ return 0
+ esac
+ ;;
+ resource|*)
+ COMPREPLY=( $( compgen -W '--help --version --debug --verbose' \
+ -- "$cur" ) )
+ return 0
+ ;;
+ esac
+} &&
+complete -F _puppet puppetmasterd puppetd puppetca ralsh puppetrun puppetqd filebucket puppetdoc puppet
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/pwck b/completions/pwck
new file mode 100644
index 00000000..0ed0debc
--- /dev/null
+++ b/completions/pwck
@@ -0,0 +1,17 @@
+# pwck(8) completion -*- shell-script -*-
+
+_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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/pwdx b/completions/pwdx
new file mode 100644
index 00000000..e91d9bf4
--- /dev/null
+++ b/completions/pwdx
@@ -0,0 +1,18 @@
+# pwdx(1) completion -*- shell-script -*-
+
+_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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/pwgen b/completions/pwgen
new file mode 100644
index 00000000..3aa39a5c
--- /dev/null
+++ b/completions/pwgen
@@ -0,0 +1,28 @@
+# pwgen(1) completion -*- shell-script -*-
+
+_pwgen()
+{
+ local cur prev words cword split
+ _init_completion -s || return
+
+ case $prev in
+ -N|--num-passwords|-h|--help)
+ return
+ ;;
+ -H|--sha1)
+ _filedir
+ return
+ ;;
+ esac
+
+ $split && return
+
+ if [[ $cur == -* ]]; then
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
+ [[ $COMPREPLY == *= ]] && compopt -o nospace
+ return
+ fi
+} &&
+complete -F _pwgen pwgen
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/python b/completions/python
index 17f96f50..969f3b93 100644
--- a/completions/python
+++ b/completions/python
@@ -1,12 +1,9 @@
-# bash completion for python
+# bash completion for python -*- shell-script -*-
-have python &&
_python()
{
- local prev cur i
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-'?'|-h|--help|-V|--version|-c|-m)
@@ -22,15 +19,16 @@ _python()
return 0
;;
!(?(*/)python*([0-9.])|-?))
- [[ $COMP_CWORD -lt 2 || ${COMP_WORDS[COMP_CWORD-2]} != -@(Q|W) ]] \
+ [[ $cword -lt 2 || ${words[cword-2]} != -@(Q|W) ]] \
&& _filedir
;;
esac
# if '-c' is already given, complete all kind of files.
- for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
- if [[ ${COMP_WORDS[i]} == -c ]]; then
+ local i
+ for (( i=0; i < ${#words[@]}-1; i++ )); do
+ if [[ ${words[i]} == -c ]]; then
_filedir
fi
done
@@ -39,17 +37,11 @@ _python()
if [[ "$cur" != -* ]]; then
_filedir 'py?([co])'
else
- COMPREPLY=( $( compgen -W "$( _parse_help $1 -h )" -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" -h )' -- "$cur" ) )
fi
return 0
} &&
complete -F _python python python2 python3
-# 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/qdbus b/completions/qdbus
index 879df68d..5ed6bf89 100644
--- a/completions/qdbus
+++ b/completions/qdbus
@@ -1,23 +1,14 @@
-# Qt qdbus, dcop completion
+# Qt qdbus, dcop completion -*- shell-script -*-
-have qdbus || have dcop &&
_qdbus()
{
- local cur
+ local cur prev words cword
+ _init_completion || return
- COMPREPLY=()
- _get_comp_words_by_ref cur
-
- [ -n "$cur" ] && unset COMP_WORDS[${#COMP_WORDS[@]}-1]
- COMPREPLY=( $( compgen -W '$( command ${COMP_WORDS[@]} 2>/dev/null | \
+ [ -n "$cur" ] && unset words[${#words[@]}-1]
+ COMPREPLY=( $( compgen -W '$( command ${words[@]} 2>/dev/null | \
sed s/\(.*\)// )' -- "$cur" ) )
} &&
complete -F _qdbus qdbus dcop
-# 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/qemu b/completions/qemu
index 03fa5632..45a48b9b 100644
--- a/completions/qemu
+++ b/completions/qemu
@@ -1,12 +1,9 @@
-# bash completion for qemu
+# bash completion for qemu -*- shell-script -*-
-have qemu &&
_qemu()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-fd[ab]|-hd[abcd]|-cdrom|-option-rom|-kernel|-initrd|-bootp|-pidfile| \
@@ -103,30 +100,12 @@ _qemu()
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-M -fda -fdb -hda -hdb -hdc -hdd \
- -cdrom -boot -snapshot -no-fd-bootchk -m -smp -nographic -vnc \
- -k -audio-help -soundhw -localtime -full-screen -pidfile \
- -daemonize -win2k-hack -option-rom -usb -usbdevice -net -tftp \
- -smb -redir -kernel -append -initrd -serial -parallel -monitor \
- -s -p -S -d -hdachs -L -std-vga -no-acpi -no-reboot -loadvm \
- -semihosting -cpu -bt -vga -drive -startdate -name -curses \
- -no-frame -no-quit -bootp -echr -no-shutdown -icount -g \
- -prom-env -help -version -numa -mtdblock -sd -pflash \
- -device -uuid -alt-grab -sdl -portrait -rtc-td-hack -no-hpet \
- -balloon -acpitable -smbios -singlestep -gdb -hdachs -bios \
- -kernel-kqemu -enable-kqemu -enable-kvm -clock -watchdog \
- -watchdog-action -virtioconsole -show-cursor -tb-size -incoming \
- -chroot -runas' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" -help ) -fd{a,b}
+ -hd{a..d}' -- "$cur" ) )
else
_filedir
fi
} &&
complete -F _qemu qemu
-# 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/qrunner b/completions/qrunner
new file mode 100644
index 00000000..3fe5f810
--- /dev/null
+++ b/completions/qrunner
@@ -0,0 +1,18 @@
+# mailman qrunner completion -*- shell-script -*-
+
+_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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/querybts b/completions/querybts
new file mode 100644
index 00000000..a973f743
--- /dev/null
+++ b/completions/querybts
@@ -0,0 +1,35 @@
+# querybts completion -*- shell-script -*-
+
+_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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/quota b/completions/quota
new file mode 100644
index 00000000..626a3802
--- /dev/null
+++ b/completions/quota
@@ -0,0 +1,192 @@
+# bash completion for quota-tools -*- shell-script -*-
+
+_user_or_group()
+{
+ local i
+
+ # complete on groups if -g was given
+ for (( i=1; i < cword; i++ )); do
+ if [[ "${words[i]}" == -@(g|-group) ]]; then
+ COMPREPLY=( $( compgen -g -- "$cur" ) )
+ return 0
+ fi
+ done
+
+ # otherwise complete on users
+ COMPREPLY=( $( compgen -u -- "$cur" ) )
+}
+
+_quota_parse_help()
+{
+ local opts=$( _parse_help "$1" )
+ [[ $opts ]] || opts=$( _parse_usage "$1" ) # non-GNU?
+ COMPREPLY=( $( compgen -W "$opts" -- "$cur" ) )
+ [[ $COMPREPLY == *= ]] && compopt -o nospace
+}
+
+_quota_formats()
+{
+ COMPREPLY=( $( compgen -W 'vfsold vfsv0 rpc xfs' -- "$cur" ) )
+}
+
+_filesystems()
+{
+ # Only list filesystems starting with "/", otherwise we also get
+ #+ "binfmt_misc", "proc", "tmpfs", ...
+ COMPREPLY=( $( compgen -W "$(awk '/^\// {print $1}' /etc/mtab)" \
+ -- "$cur" ) )
+}
+
+_quota()
+{
+ local cur prev words cword split
+ _init_completion -s || return
+
+ case $prev in
+ -F|--format)
+ _quota_formats
+ return 0
+ ;;
+ -h|--help|-V|--version)
+ return 0
+ ;;
+ esac
+
+ $split && return 0
+
+ if [[ "$cur" == -* ]]; then
+ _quota_parse_help "$1"
+ else
+ _user_or_group
+ fi
+} &&
+complete -F _quota -o default quota
+
+_setquota()
+{
+ local cur prev words cword split
+ _init_completion -s || return
+
+ case $prev in
+ -F|--format)
+ _quota_formats
+ return 0
+ ;;
+ -p|--prototype)
+ _user_or_group
+ return 0
+ ;;
+ -h|--help|-V|--version)
+ return 0
+ ;;
+ esac
+
+ $split && return 0
+
+ if [[ "$cur" == -* ]]; then
+ _quota_parse_help "$1"
+ else
+ local args
+ _count_args
+
+ case $args in
+ 1)
+ _user_or_group
+ ;;
+ 2)
+ _filesystems
+ ;;
+ esac
+
+ fi
+} &&
+complete -F _setquota -o default setquota
+
+_edquota()
+{
+ local cur prev words cword split
+ _init_completion -s || return
+
+ case $prev in
+ -F|--format)
+ _quota_formats
+ return 0
+ ;;
+ -f|--filesystem)
+ _filesystems
+ return 0
+ ;;
+ -p|--prototype)
+ _user_or_group
+ return 0
+ ;;
+ -h|--help|-V|--version)
+ return 0
+ ;;
+ esac
+
+ $split && return 0
+
+ if [[ "$cur" == -* ]]; then
+ _quota_parse_help "$1"
+ else
+ _user_or_group
+ fi
+} &&
+complete -F _edquota -o default edquota
+
+_quotacheck()
+{
+ local cur prev words cword split
+ _init_completion -s || return
+
+ case $prev in
+ -F|--format)
+ _quota_formats
+ return 0
+ ;;
+ -h|--help|-V|--version)
+ return 0
+ ;;
+ esac
+
+ $split && return 0
+
+ if [[ "$cur" == -* ]]; then
+ _quota_parse_help "$1"
+ else
+ _filesystems
+ fi
+} &&
+complete -F _quotacheck -o default quotacheck repquota
+
+_quotaon()
+{
+ local cur prev words cword split
+ _init_completion -s || return
+
+ case $prev in
+ -F|--format)
+ _quota_formats
+ return 0
+ ;;
+ -x|--xfs-command)
+ COMPREPLY=( $( compgen -W 'delete enforce' -- "$cur" ) )
+ return 0
+ ;;
+ -h|--help|-V|--version)
+ return 0
+ ;;
+ esac
+
+ $split && return 0
+
+ if [[ "$cur" == -* ]]; then
+ _quota_parse_help "$1"
+ else
+ _filesystems
+ fi
+} &&
+complete -F _quotaon -o default quotaon quotaoff
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/quota-tools b/completions/quota-tools
deleted file mode 100644
index 2b528d92..00000000
--- a/completions/quota-tools
+++ /dev/null
@@ -1,257 +0,0 @@
-# bash completion for quota-tools
-
-have quota && {
-_user_or_group()
-{
- local i
-
- # complete on groups if -g was given
- for (( i=1; i < COMP_CWORD; i++ )); do
- if [[ "${COMP_WORDS[i]}" == -g ]]; then
- COMPREPLY=( $( compgen -g -- "$cur" ) )
- return 0
- fi
- done
-
- # otherwise complete on users
- COMPREPLY=( $( compgen -u -- "$cur" ) )
-}
-
-_quota_formats()
-{
- COMPREPLY=( $( compgen -W 'vfsold vfsv0 rpc xfs' -- "$cur" ) )
-}
-
-_filesystems()
-{
- # Only list filesystems starting with "/", otherwise we also get
- #+ "binfmt_misc", "proc", "tmpfs", ...
- COMPREPLY=( $( compgen -W "$(awk '/^\// {print $1}' /etc/mtab)" \
- -- "$cur" ) )
-}
-
-_quota()
-{
- local cur prev split=false
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- _split_longopt && split=true
-
- case $prev in
- -F|--format)
- _quota_formats
- return 0
- ;;
- esac
-
- $split && return 0
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-F --format -g --group -u --user -v \
- --verbose -s --human-readable -p --raw-grace -i --no-autofs -l \
- --local-only -A --all-nfs -m --no-mixed-pathnames -q --quiet -Q \
- --quiet-refuse -w --no-wrap' -- "$cur" ) )
- else
- _user_or_group
- fi
-}
-complete -F _quota -o default quota
-
-_setquota()
-{
- local cur prev split=false
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- _split_longopt && split=true
-
- case $prev in
- -F|--format)
- _quota_formats
- return 0
- ;;
- esac
-
- $split && return 0
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-r --remote -m --no-mixed-pathnames \
- -F --format -g --group -u --user -p --prototype -b --batch \
- -c --continue-batch -t --edit-period -T --edit-times -a --all' \
- -- "$cur" ) )
- else
- _count_args
-
- case $args in
- 1)
- _user_or_group
- ;;
- 2)
- _filesystems
- ;;
- esac
-
- fi
-}
-complete -F _setquota -o default setquota
-
-_edquota()
-{
- local cur prev split=false
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- _split_longopt && split=true
-
- case $prev in
- -F|--format)
- _quota_formats
- return 0
- ;;
- -f|--filesystem)
- _filesystems
- return 0
- ;;
- esac
-
- $split && return 0
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-r --remote -m --no-mixed-pathnames \
- -g --group -u --user -p --prototype -F --format -f --filesystem \
- -t --edit-period -T --edit-times' -- "$cur" ) )
- else
- _user_or_group
- fi
-}
-complete -F _edquota -o default edquota
-
-_quotacheck()
-{
- local cur prev split=false
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- _split_longopt && split=true
-
- case $prev in
- -F|--format)
- _quota_formats
- return 0
- ;;
- esac
-
- $split && return 0
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-b --backup -v --verbose -d --debug \
- -g --group -u --user -c --create-files -f --force -i \
- --interactive -n --use-first-dquot -M --try-remount -m \
- --no-remount -R --exclude-root -F --format -a --all' -- "$cur" ) )
- else
- _filesystems
- fi
-}
-complete -F _quotacheck -o default quotacheck
-
-_repquota()
-{
- local cur prev split=false
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- _split_longopt && split=true
-
- case $prev in
- -F|--format)
- _quota_formats
- return 0
- ;;
- esac
-
- $split && return 0
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-a --all -v --verbose -s --human-readable \
- -c --batch-translation -C --no-batch-translation -t \
- --truncate-names -n --no-names -p --raw-grace -i --no-autofs \
- -u --user -g --group -F --format' -- "$cur" ) )
- else
- _filesystems
- fi
-}
-complete -F _repquota -o default repquota
-
-_quotaon()
-{
- local cur prev split=false
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- _split_longopt && split=true
-
- case $prev in
- -F|--format)
- _quota_formats
- return 0
- ;;
- esac
-
- $split && return 0
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-a --all -v --verbose -u --user \
- -g --group -f --off -p --print-state -F --format' -- "$cur" ) )
- else
- _filesystems
- fi
-}
-complete -F _quotaon -o default quotaon
-
-_quotaoff()
-{
- local cur prev split=false
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- _split_longopt && split=true
-
- case $prev in
- -F|--format)
- _quota_formats
- return 0
- ;;
- -x|--xfs-command)
- COMPREPLY=( $( compgen -W 'delete enforce' -- "$cur" ) )
- return 0
- ;;
- esac
-
- $split && return 0
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-a --all -v --verbose -u --user \
- -g --group -p --print-state -x --xfs-command -F --format' \
- -- "$cur" ) )
- else
- _filesystems
- fi
-}
-complete -F _quotaoff -o default quotaoff
-}
-
-# 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/rcs b/completions/rcs
index d859b8a9..a8eac85b 100644
--- a/completions/rcs
+++ b/completions/rcs
@@ -1,12 +1,11 @@
-# bash completion for rcs
+# bash completion for rcs -*- shell-script -*-
-have rcs &&
_rcs()
{
- local cur prev file dir i
+ local cur prev words cword
+ _init_completion || return
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local file dir i
file=${cur##*/}
dir=${cur%/*}
@@ -22,7 +21,7 @@ _rcs()
COMPREPLY[$i]=$dir$file
done
- COMPREPLY=( "${COMPREPLY[@]}" $( compgen -G "$dir/$file*,v" ) )
+ COMPREPLY+=( $( compgen -G "$dir/$file*,v" ) )
for (( i=0; i < ${#COMPREPLY[@]}; i++ )); do
COMPREPLY[$i]=${COMPREPLY[$i]%,v}
@@ -34,10 +33,4 @@ _rcs()
} &&
complete -F _rcs ci co rlog rcs rcsdiff
-# 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/rdesktop b/completions/rdesktop
index 7acf47a5..48a91750 100644
--- a/completions/rdesktop
+++ b/completions/rdesktop
@@ -1,22 +1,17 @@
-# bash completion for rdesktop
+# bash completion for rdesktop -*- shell-script -*-
-have rdesktop &&
_rdesktop()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion -n : || return
case $prev in
-k)
COMPREPLY=( $( command ls \
/usr/share/rdesktop/keymaps 2>/dev/null | \
command grep -E -v '(common|modifiers)' ) )
- COMPREPLY=( ${COMPREPLY[@]:-} $( command ls \
- $HOME/.rdesktop/keymaps 2>/dev/null ) )
- COMPREPLY=( ${COMPREPLY[@]:-} $( command ls \
- ./keymaps 2>/dev/null ) )
+ COMPREPLY+=( $( command ls $HOME/.rdesktop/keymaps 2>/dev/null ) )
+ COMPREPLY+=( $( command ls ./keymaps 2>/dev/null ) )
COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) )
return 0
;;
@@ -25,22 +20,33 @@ _rdesktop()
return 0
;;
-x)
- COMPREPLY=( $( compgen -W 'b broadband m modem l lan' \
- -- $cur ) )
+ COMPREPLY=( $( compgen -W 'broadband modem lan' -- "$cur" ) )
return 0
;;
-r)
- # FIXME: should do -o nospace for the colon options
- COMPREPLY=( $( compgen -W 'comport: disk: lptport: \
- printer: sound: lspci scard' -- "$cur" ) )
+ case $cur in
+ sound:*)
+ COMPREPLY=( $( compgen -W 'local off remote' \
+ -- "${cur#sound:}" ) )
+ ;;
+ *:*)
+ ;;
+ *)
+ COMPREPLY=( $( compgen -W 'comport: disk: lptport: \
+ printer: sound: lspci scard' -- "$cur" ) )
+ [[ $COMPREPLY == *: ]] && compopt -o nospace
+ ;;
+ esac
+ return 0
+ ;;
+ -u|-d|-s|-c|-p|-n|-g|-S|-T|-X)
return 0
;;
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-u -d -s -c -p -n -k -g -f -b -L \
- -A -B -e -E -m -C -D -K -S -T -N -X -a -z -x -P -r \
- -0 -4 -5' -- "$cur" ) )
+ local opts=( $( _parse_help "$1" ) )
+ COMPREPLY=( $( compgen -W '${opts[@]%:}' -- "$cur" ) )
else
_known_hosts_real "$cur"
fi
@@ -48,10 +54,4 @@ _rdesktop()
} &&
complete -F _rdesktop rdesktop
-# 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/remove_members b/completions/remove_members
new file mode 100644
index 00000000..4e459381
--- /dev/null
+++ b/completions/remove_members
@@ -0,0 +1,27 @@
+# mailman remove_members completion -*- shell-script -*-
+
+_remove_members()
+{
+ local cur prev words cword split
+ _init_completion -s || return
+
+ case $prev in
+ -f|--file)
+ _filedir
+ return 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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/removepkg b/completions/removepkg
new file mode 100644
index 00000000..5b3d8273
--- /dev/null
+++ b/completions/removepkg
@@ -0,0 +1,19 @@
+# Slackware Linux removepkg completion -*- shell-script -*-
+
+_removepkg()
+{
+ local cur prev words cword
+ _init_completion || return
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-copy -keep -preserve -warn' \
+ -- "$cur" ) )
+ return 0
+ fi
+
+ local root=${ROOT:-/}
+ COMPREPLY=( $( cd "$root/var/log/packages" 2> /dev/null || return 1 ; \
+ compgen -f -- "$cur" ) )
+} &&
+complete -F _removepkg removepkg
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/renice b/completions/renice
new file mode 100644
index 00000000..60968eef
--- /dev/null
+++ b/completions/renice
@@ -0,0 +1,29 @@
+# renice(8) completion -*- shell-script -*-
+
+_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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/reportbug b/completions/reportbug
index 0c44bd68..aa5ac3e5 100644
--- a/completions/reportbug
+++ b/completions/reportbug
@@ -1,12 +1,9 @@
-# bash completion for (Debian) reportbug package
+# bash completion for (Debian) reportbug -*- shell-script -*-
-have reportbug &&
_reportbug()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-f|--filename|-i|--include|--mta|-o|--output)
@@ -19,8 +16,8 @@ _reportbug()
return 0
;;
-e|--editor|--mua)
- COMP_WORDS=(COMP_WORDS[0] "$cur")
- COMP_CWORD=1
+ words=(words[0] "$cur")
+ cword=1
_command
return 0
;;
@@ -86,47 +83,4 @@ _reportbug()
} &&
complete -F _reportbug reportbug
-have querybts &&
-_querybts()
-{
- local cur prev split=false
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- _split_longopt && split=true
-
- 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/reptyr b/completions/reptyr
new file mode 100644
index 00000000..3097daa9
--- /dev/null
+++ b/completions/reptyr
@@ -0,0 +1,23 @@
+# bash completion for reptyr(1) -*- shell-script -*-
+
+_reptyr()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ case $prev in
+ -l)
+ return 0
+ ;;
+ esac
+
+ if [[ $cur == -* ]]; then
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
+ return 0
+ fi
+
+ [[ $prev != +([0-9]) ]] && _pids
+} &&
+complete -F _reptyr reptyr
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/resolvconf b/completions/resolvconf
index 9773696d..c2f1b42b 100644
--- a/completions/resolvconf
+++ b/completions/resolvconf
@@ -1,12 +1,9 @@
-# bash completion for resolvconf
+# bash completion for resolvconf -*- shell-script -*-
-have resolvconf &&
_resolvconf()
{
- local cur command
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-a|-d)
@@ -21,10 +18,4 @@ _resolvconf()
} &&
complete -F _resolvconf resolvconf
-# 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/rfkill b/completions/rfkill
index 5c51ff9d..305f19d1 100644
--- a/completions/rfkill
+++ b/completions/rfkill
@@ -1,17 +1,14 @@
-# bash completion for rfkill
+# bash completion for rfkill -*- shell-script -*-
-have rfkill &&
_rfkill()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--version' -- "$cur" ) )
else
- case $COMP_CWORD in
+ case $cword in
1)
COMPREPLY=( $( compgen -W "help event list block unblock" \
-- "$cur" ) )
@@ -28,10 +25,4 @@ _rfkill()
} &&
complete -F _rfkill rfkill
-# 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/ri b/completions/ri
index be66d98f..70756325 100644
--- a/completions/ri
+++ b/completions/ri
@@ -1,6 +1,6 @@
-# ri completion for Ruby documentation by Ian Macdonald <ian@caliban.org>
+# ri completion for Ruby documentation -*- shell-script -*-
+# by Ian Macdonald <ian@caliban.org>
-have ri && {
ri_get_methods()
{
local regex
@@ -14,15 +14,15 @@ ri_get_methods()
regex=Class
fi
- COMPREPLY=( ${COMPREPLY[@]} \
+ COMPREPLY+=( \
"$( 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
- COMPREPLY=( ${COMPREPLY[@]} \
+ COMPREPLY+=( \
"$( ruby -W0 $ri_path ${classes[@]} | ruby -ane \
'if /^-/.../^-/ and ! /^-/ and ! /^ +(class|module): / then \
print $_.split(/, |,$| +/).grep(/^[^\[]*$/).join("\n"); \
@@ -34,11 +34,11 @@ ri_get_methods()
# needs at least Ruby 1.8.0 in order to use -W0
_ri()
{
- local cur class method prefix ri_path ri_version separator IFS
- local -a classes
+ local cur prev words cword
+ _init_completion || return
- COMPREPLY=()
- _get_comp_words_by_ref cur
+ local class method prefix ri_path ri_version separator IFS
+ local -a classes
ri_path=$(type -p ri)
# which version of ri are we using?
@@ -62,8 +62,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 \
@@ -83,14 +83,7 @@ _ri()
# we're completing on methods
method=$cur
ri_get_methods
-}
+} &&
complete -F _ri ri
-}
-# 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/rmlist b/completions/rmlist
new file mode 100644
index 00000000..dd31333c
--- /dev/null
+++ b/completions/rmlist
@@ -0,0 +1,17 @@
+# mailman rmlist completion -*- shell-script -*-
+
+_rmlist()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--archives --help' -- "$cur" ) )
+ else
+ _xfunc list_lists _mailman_lists
+ fi
+
+} &&
+complete -F _rmlist rmlist
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/rmmod b/completions/rmmod
new file mode 100644
index 00000000..3b266067
--- /dev/null
+++ b/completions/rmmod
@@ -0,0 +1,14 @@
+# Linux rmmod(8) completion. -*- shell-script -*-
+# This completes on a list of all currently installed kernel modules.
+
+_rmmod()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ _installed_modules "$cur"
+ return 0
+} &&
+complete -F _rmmod rmmod
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/route b/completions/route
new file mode 100644
index 00000000..14fc2599
--- /dev/null
+++ b/completions/route
@@ -0,0 +1,30 @@
+# Linux route(8) completion -*- shell-script -*-
+
+[[ $OSTYPE == *linux* ]] || return 1
+
+_route()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ if [ "$prev" = dev ]; then
+ _available_interfaces
+ return 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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/rpcdebug b/completions/rpcdebug
index be2a8709..6d4acf52 100644
--- a/completions/rpcdebug
+++ b/completions/rpcdebug
@@ -1,30 +1,26 @@
-# bash completion for rpcdebug
+# bash completion for rpcdebug -*- shell-script -*-
-have rpcdebug && {
_rpcdebug_flags()
{
local i module
- for (( i=0; i < ${#COMP_WORDS[@]}; i++ )); do
- if [[ ${COMP_WORDS[i]} == -m ]]; then
- module=${COMP_WORDS[i+1]}
+ for (( i=0; i < ${#words[@]}; i++ )); do
+ if [[ ${words[i]} == -m ]]; then
+ module=${words[i+1]}
fi
done
if [ -n "$module" ]; then
- COMPREPLY=( $( compgen -W "$(rpcdebug -vh 2>&1 \
- | command grep '^'$module' '\
- | awk '{$1 = ""; print $0}')" -- "$cur" ) )
+ COMPREPLY=( $( compgen -W "$( rpcdebug -vh 2>&1 | \
+ sed -ne 's/^'$module'[[:space:]]\{1,\}//p' )" -- "$cur" ) )
fi
}
_rpcdebug()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-s)
@@ -42,16 +38,10 @@ _rpcdebug()
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-v -h -m -s -c' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_usage "$1" -h ) -s -c' \
+ -- "$cur" ) )
fi
-}
+} &&
complete -F _rpcdebug rpcdebug
-}
-# 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/rpm b/completions/rpm
index bbab0368..c7e67705 100644
--- a/completions/rpm
+++ b/completions/rpm
@@ -1,12 +1,9 @@
-# bash completion for rpm
+# bash completion for rpm -*- shell-script -*-
-have rpm && {
# helper functions
_rpm_installed_packages()
{
- local nodig="$1" nosig="$2"
-
if [[ -r /var/log/rpmpkgs && \
/var/log/rpmpkgs -nt /var/lib/rpm/Packages ]]; then
# using RHL 7.2 or later - this is quicker than querying the DB
@@ -17,73 +14,56 @@ _rpm_installed_packages()
# SUSE's rpmqpack is faster than rpm -qa
COMPREPLY=( $( compgen -W '$( rpmqpack )' -- "$cur" ) )
else
- _rpm_nodigsig
- COMPREPLY=( $( rpm -qa $nodig $nosig --qf='%{NAME} ' "$cur*" ) )
+ COMPREPLY=( $( ${1:-rpm} -qa --nodigest --nosignature \
+ --queryformat='%{NAME} ' "$cur*" 2>/dev/null ) )
fi
}
_rpm_groups()
{
local IFS=$'\n'
- COMPREPLY=( $( compgen -W "$( rpm -qa $nodig $nosig --queryformat \
- '%{group}\n' )" -- "$cur" ) )
+ COMPREPLY=( $( compgen -W "$( ${1:-rpm} -qa --nodigest --nosignature \
+ --queryformat='%{GROUP}\n' 2>/dev/null )" -- "$cur" ) )
}
-_rpm_nodigsig()
+_rpm_macros()
{
- if [[ -z "$nodig" && -z "$nosig" ]]; then
- local rpmver
-
- rpmver=$(rpm --version)
- rpmver=${rpmver##* }
+ # get a list of macros
+ COMPREPLY=( $( compgen -W "$( ${1:-rpm} --showrc | sed -ne \
+ 's/^-\{0,1\}[0-9]\{1,\}[:=][[:space:]]\{1,\}\([^[:space:](]\{3,\}\).*/%\1/p' )" \
+ -- "$cur" ) )
+}
- if [[ "$rpmver" > "4.0.4" ]]; then
- nodig="--nodigest"
- fi
- if [[ "$rpmver" > "4.0.99" ]]; then
- nosig="--nosignature"
- fi
- fi
+_rpm_buildarchs()
+{
+ COMPREPLY=( $( compgen -W "$( ${1:-rpm} --showrc | sed -ne \
+ 's/^\s*compatible\s\s*build\s\s*archs\s*:\s*\(.*\)/\1/ p' )" \
+ -- "$cur" ) )
}
# rpm(8) completion
#
_rpm()
{
- local cur prev opts nodig nosig
+ local cur prev words cword split
+ _init_completion -s || return
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
- nodig=""
- nosig=""
- _rpm_nodigsig
-
- if [ $COMP_CWORD -eq 1 ]; then
+ if [ $cword -eq 1 ]; then
# first parameter on line
case $cur in
- -b*)
- COMPREPLY=( $( compgen -W '-ba -bb -bc -bi -bl -bp -bs' \
- -- "$cur" ) )
- ;;
- -t*)
- COMPREPLY=( $( compgen -W '-ta -tb -tc -ti -tl -tp -ts' \
- -- "$cur" ) )
- ;;
--*)
COMPREPLY=( $( compgen -W '--help --version --initdb \
- --checksig --recompile --rebuild --resign --addsign \
- --rebuilddb --showrc --setperms --setugids --tarbuild \
- --eval --install --upgrade --query --freshen --erase \
- --verify --querytags --rmsource --rmspec --clean \
- --import' -- "$cur" ) )
+ --checksig --resign --addsign --rebuilddb --showrc \
+ --setperms --setugids --eval --install --upgrade --query \
+ --freshen --erase --verify --querytags --import' \
+ -- "$cur" ) )
;;
*)
- COMPREPLY=( $( compgen -W '-b -e -E -F -i -q -t -U -V' \
+ COMPREPLY=( $( compgen -W '-e -E -F -i -q -t -U -V' \
-- "$cur" ) )
;;
esac
-
- return 0
+ return 0
fi
case $prev in
@@ -92,14 +72,11 @@ _rpm()
return 0
;;
--eval|-E)
- # get a list of macros
- COMPREPLY=( $( compgen -W "$( rpm --showrc | sed -ne \
- 's/^-\{0,1\}[0-9]\{1,\}[:=][[:space:]]\{1,\}\([^[:space:](]\{3,\}\).*/%\1/p' )" \
- -- "$cur" ) )
+ _rpm_macros $1
return 0
;;
--pipe)
- _compopt_o_filenames
+ compopt -o filenames
COMPREPLY=( $( compgen -c -- "$cur" ) )
return 0
;;
@@ -118,8 +95,9 @@ _rpm()
else
# complete on capabilities
local IFS=$'\n'
- COMPREPLY=( $( compgen -W "$( rpm -qa $nodig $nosig \
- --queryformat='%{providename}\n' )" -- "$cur" ) )
+ COMPREPLY=( $( compgen -W "$( $1 -qa --nodigest --nosignature \
+ --queryformat='%{PROVIDENAME}\n' 2>/dev/null )" \
+ -- "$cur" ) )
fi
return 0
;;
@@ -129,37 +107,34 @@ _rpm()
else
# complete on capabilities
local IFS=$'\n'
- COMPREPLY=( $( compgen -W "$( rpm -qa $nodig $nosig \
- --queryformat='%{requirename}\n' )" -- "$cur" ) )
+ COMPREPLY=( $( compgen -W "$( $1 -qa --nodigest --nosignature \
+ --queryformat='%{REQUIRENAME}\n' 2>/dev/null )" \
+ -- "$cur" ) )
fi
return 0
;;
- --target)
- COMPREPLY=( $( compgen -W "$( command rpm --showrc | sed -ne \
- 's/^\s*compatible\s\s*build\s\s*archs\s*:\s*\(.*\)/\1/ p' )" \
- -- "$cur" ) )
- return 0
- ;;
--define|-D|--fileid|--hdrid|--pkgid)
# argument required but no completions available
return 0
;;
esac
+ $split && return 0
+
# options common to all modes
- opts="--define --eval --macros --nodigest --nosignature --rcfile \
- --quiet --pipe --verbose"
+ local opts="--define= --eval= --macros= --nodigest --nosignature \
+ --rcfile= --quiet --pipe --verbose"
- case ${COMP_WORDS[1]} in
+ case ${words[1]} in
-[iFU]*|--install|--freshen|--upgrade)
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W "$opts --percent --force \
--test --replacepkgs --replacefiles --root \
--excludedocs --includedocs --noscripts --ignorearch \
- --dbpath --prefix --ignoreos --nodeps --allfiles \
+ --dbpath --prefix= --ignoreos --nodeps --allfiles \
--ftpproxy --ftpport --justdb --httpproxy --httpport \
- --noorder --relocate --badreloc --notriggers \
- --excludepath --ignoresize --oldpackage \
+ --noorder --relocate= --badreloc --notriggers \
+ --excludepath= --ignoresize --oldpackage \
--queryformat --repackage --nosuggests" -- "$cur" ) )
else
_filedir '[rs]pm'
@@ -171,18 +146,18 @@ _rpm()
--noscripts --notriggers --nodeps --test --repackage" \
-- "$cur" ) )
else
- _rpm_installed_packages "$nodig" "$nosig"
+ _rpm_installed_packages $1
fi
;;
-q*|--query)
# options common to all query types
- opts="$opts --changelog --configfiles --conflicts --docfiles
+ opts+=" --changelog --configfiles --conflicts --docfiles
--dump --enhances --filesbypkg --filecaps --fileclass
--filecolor --fileprovide --filerequire --filesbypkg --info
- --list --obsoletes --pipe --provides --queryformat --rcfile
+ --list --obsoletes --pipe --provides --queryformat=
--requires --scripts --suggests --triggers --xml"
- if [[ $COMP_LINE == *\ -@(*([^ -])f|-file )* ]]; then
+ if [[ ${words[@]} == *\ -@(*([^ -])f|-file )* ]]; then
# -qf completion
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W "$opts --dbpath --fscontext \
@@ -190,10 +165,10 @@ _rpm()
else
_filedir
fi
- elif [[ $COMP_LINE == *\ -@(*([^ -])g|-group )* ]]; then
+ elif [[ ${words[@]} == *\ -@(*([^ -])g|-group )* ]]; then
# -qg completion
- _rpm_groups
- elif [[ $COMP_LINE == *\ -@(*([^ -])p|-package )* ]]; then
+ _rpm_groups $1
+ elif [[ ${words[@]} == *\ -@(*([^ -])p|-package )* ]]; then
# -qp; uninstalled package completion
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W "$opts --ftpport --ftpproxy \
@@ -206,11 +181,11 @@ _rpm()
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W "$opts --all --file --fileid
--dbpath --fscontext --ftswalk --group --hdrid --last
- --package --pkgid --root --specfile --state
+ --package --pkgid --root= --specfile --state
--triggeredby --whatprovides --whatrequires" \
-- "$cur" ) )
- elif [[ $COMP_LINE != *\ -@(*([^ -])a|-all )* ]]; then
- _rpm_installed_packages "$nodig" "$nosig"
+ elif [[ ${words[@]} != *\ -@(*([^ -])a|-all )* ]]; then
+ _rpm_installed_packages $1
fi
fi
;;
@@ -224,86 +199,107 @@ _rpm()
;;
-[Vy]*|--verify)
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W "$opts --root --dbpath --nodeps \
+ COMPREPLY=( $( compgen -W "$opts --root= --dbpath --nodeps \
--nogroup --nolinkto --nomode --nomtime --nordev --nouser \
--nofiles --noscripts --nomd5 --querytags --specfile \
--whatrequires --whatprovides" -- "$cur" ) )
# check whether we're doing file completion
- elif [[ $COMP_LINE == *\ -@(*([^ -])f|-file )* ]]; then
+ elif [[ ${words[@]} == *\ -@(*([^ -])f|-file )* ]]; then
_filedir
- elif [[ $COMP_LINE == *\ -@(*([^ -])g|-group )* ]]; then
- _rpm_groups
- elif [[ $COMP_LINE == *\ -@(*([^ -])p|-package )* ]]; then
+ elif [[ ${words[@]} == *\ -@(*([^ -])g|-group )* ]]; then
+ _rpm_groups $1
+ elif [[ ${words[@]} == *\ -@(*([^ -])p|-package )* ]]; then
_filedir '[rs]pm'
else
- _rpm_installed_packages "$nodig" "$nosig"
- fi
- ;;
- -[bt]*)
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W "$opts --short-circuit --timecheck \
- --clean --rmsource --rmspec --test --sign --buildroot \
- --target --nobuild --nodeps --nodirtokens" -- "$cur" ) )
- elif [[ ${COMP_WORDS[1]} == -b* ]]; then
- _filedir spec
- else
- _filedir '@(t?(ar.)@([gx]z|bz?(2))|tar?(.@(lzma|Z)))'
+ _rpm_installed_packages $1
fi
;;
- --rebuild|--recompile)
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W "$opts --nodeps --rmsource \
- --rmspec --sign --nodirtokens --target" -- "$cur" ) )
- else
- _filedir '@(?(no)src.r|s)pm'
- fi
- ;;
- --tarbuild)
- _filedir '@(t?(ar.)@([gx]z|bz?(2))|tar?(.@(lzma|Z)))'
- ;;
--resign|--addsign)
_filedir '[rs]pm'
;;
--setperms|--setgids)
- _rpm_installed_packages "$nodig" "$nosig"
- ;;
- --clean|--rmsource|--rmspec)
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--clean --rmsource --rmspec' \
- -- "$cur" ) )
- else
- _filedir spec
- fi
+ _rpm_installed_packages $1
;;
--import|--dbpath|--root)
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--import --dbpath --root' \
+ COMPREPLY=( $( compgen -W '--import --dbpath --root=' \
-- "$cur" ) )
else
_filedir
fi
;;
esac
+ [[ $COMPREPLY == *= ]] && compopt -o nospace
return 0
-}
-complete -F _rpm rpm rpmbuild
-}
+} &&
+complete -F _rpm rpm
-have gendiff &&
-_gendiff()
+_rpmbuild()
{
- COMPREPLY=()
- local cur cword
- _get_comp_words_by_ref cur cword
- [[ $cword != 1 ]] || _filedir -d
+ local cur prev words cword split
+ _init_completion -s || return
+
+ local rpm="${1%build*}"
+ [[ $rpm == $1 ]] || ! type $rpm &>/dev/null && rpm=
+
+ case $prev in
+ --buildroot|--root|-r|--dbpath)
+ _filedir -d
+ return 0
+ ;;
+ --target)
+ _rpm_buildarchs
+ return 0
+ ;;
+ --eval|-E)
+ _rpm_macros $rpm
+ return 0
+ ;;
+ --macros|--rcfile)
+ _filedir
+ return 0
+ ;;
+ --buildpolicy)
+ local cfgdir=$( $rpm --eval '%{_rpmconfigdir}' 2>/dev/null )
+ if [[ $cfgdir ]]; then
+ COMPREPLY=( $( compgen -W "$( command ls $cfgdir 2>/dev/null \
+ | sed -ne 's/^brp-//p' )" -- "$cur" ) )
+ fi
+ ;;
+ --define|-D|--with|--without)
+ return 0
+ ;;
+ esac
+
+ $split && return 0
+
+ if [[ $cur == -* ]]; then
+ COMPREPLY=( $( compgen -W "$( _parse_help "$1" )" -- "$cur" ) )
+ [[ $COMPREPLY == *= ]] && compopt -o nospace
+ return 0
+ fi
+
+ # Figure out file extensions to complete
+ local word ext
+ for word in ${words[@]}; do
+ case $word in
+ -b?)
+ ext=spec
+ break
+ ;;
+ -t?|--tarbuild)
+ ext='@(t?(ar.)@([gx]z|bz?(2))|tar?(.@(lzma|Z)))'
+ break
+ ;;
+ --rebuild|--recompile)
+ ext='@(?(no)src.r|s)pm'
+ break
+ ;;
+ esac
+ done
+ [[ -n $ext ]] && _filedir $ext
} &&
-complete -F _gendiff gendiff
+complete -F _rpmbuild rpmbuild rpmbuild-md5
-# 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/rpm2tgz b/completions/rpm2tgz
new file mode 100644
index 00000000..0b4510c7
--- /dev/null
+++ b/completions/rpm2tgz
@@ -0,0 +1,16 @@
+# Slackware rpm2tgz completion -*- shell-script -*-
+
+_rpm2tgz()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-s -S -n -r -d -c' -- "$cur" ) )
+ return 0
+ fi
+
+ COMPREPLY=( $(compgen -f -X "!*.rpm" -- "$cur") )
+} && complete -F _rpm2tgz -o plusdirs rpm2tgz rpm2txz rpm2targz
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/rpmcheck b/completions/rpmcheck
index 5d9aada7..5c3d16f0 100644
--- a/completions/rpmcheck
+++ b/completions/rpmcheck
@@ -1,12 +1,9 @@
-# bash completion for rpmcheck
+# bash completion for rpmcheck -*- shell-script -*-
-have rpmcheck &&
_rpmcheck()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-base)
@@ -22,12 +19,6 @@ _rpmcheck()
_filedir
fi
} &&
-complete -F _rpmcheck rpmcheck $files
+complete -F _rpmcheck rpmcheck
-# 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/rrdtool b/completions/rrdtool
index 0b15a23f..9280d8f5 100644
--- a/completions/rrdtool
+++ b/completions/rrdtool
@@ -1,20 +1,17 @@
-# bash completion for rrdtool
+# bash completion for rrdtool -*- shell-script -*-
-have rrdtool &&
_rrdtool ()
{
- local cur
- _get_comp_words_by_ref cur
+ local cur prev words cword
+ _init_completion || return
- COMPREPLY=( $( compgen -W 'create update updatev graph dump restore last \
- lastupdate first info fetch tune resize xport' -- "$cur" ) )
+ if [ ${#words[@]} -eq 2 ]; then
+ COMPREPLY=( $( compgen -W 'create update updatev graph dump restore \
+ last lastupdate first info fetch tune resize xport' -- "$cur" ) )
+ else
+ _filedir rrd
+ fi
} &&
complete -F _rrdtool rrdtool
-# 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/rsync b/completions/rsync
index b0f2d106..e8b75b1a 100644
--- a/completions/rsync
+++ b/completions/rsync
@@ -1,40 +1,44 @@
-# bash completion for rsync
+# bash completion for rsync -*- shell-script -*-
-have rsync &&
_rsync()
{
- # TODO: _split_longopt
-
- COMPREPLY=()
- local cur prev
- _get_comp_words_by_ref -n : cur prev
+ local cur prev words cword split
+ _init_completion -s -n : || return
_expand || return 0
case $prev in
- --config|--password-file|--include-from|--exclude-from)
+ --config|--password-file|--include-from|--exclude-from|--files-from|\
+ --log-file|--write-batch|--only-write-batch|--read-batch)
+ compopt +o nospace
_filedir
return 0
;;
- -T|--temp-dir|--compare-dest)
+ -T|--temp-dir|--compare-dest|--backup-dir|--partial-dir|--copy-dest|\
+ --link-dest)
+ compopt +o nospace
_filedir -d
return 0
;;
-e|--rsh)
+ compopt +o nospace
COMPREPLY=( $( compgen -W 'rsh ssh' -- "$cur" ) )
return 0
;;
--compress-level)
- COMPREPLY=( $( compgen -W '1 2 3 4 5 6 7 8 9' -- "$cur" ) )
+ compopt +o nospace
+ COMPREPLY=( $( compgen -W '{1..9}' -- "$cur" ) )
return 0
;;
esac
+ $split && return 0
+
case $cur in
-*)
COMPREPLY=( $( compgen -W '--verbose --quiet --no-motd --checksum \
--archive --recursive --relative --no-implied-dirs \
- --backup --backup-dir --suffix= --update --inplace --append \
+ --backup --backup-dir= --suffix= --update --inplace --append \
--append-verify --dirs --old-dirs --links --copy-links \
--copy-unsafe-links --safe-links --copy-dirlinks \
--keep-dirlinks --hard-links --perms --executability --chmod= \
@@ -59,23 +63,22 @@ _rsync()
--write-batch= --only-write-batch= --read-batch= --protocol= \
--iconv= --ipv4 --ipv6 --version --help --daemon --config= \
--no-detach' -- "$cur" ) )
+ [[ $COMPREPLY == *= ]] || compopt +o nospace
;;
*:*)
- if type _scp_remote_files &>/dev/null; then
- # find which remote shell is used
- local i shell=ssh
- for (( i=1; i < COMP_CWORD; i++ )); do
- if [[ "${COMP_WORDS[i]}" == -@(e|-rsh) ]]; then
- shell=${COMP_WORDS[i+1]}
- break
- fi
- done
- [ "$shell" = ssh ] && _scp_remote_files
- fi
+ # 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"
- type _scp_local_files &>/dev/null && _scp_local_files || _filedir
+ _xfunc ssh _scp_local_files
;;
esac
@@ -83,10 +86,4 @@ _rsync()
} &&
complete -F _rsync -o nospace rsync
-# 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/rtcwake b/completions/rtcwake
index c95c1d76..f276c1be 100644
--- a/completions/rtcwake
+++ b/completions/rtcwake
@@ -1,13 +1,9 @@
-# bash completion for rtcwake
+# bash completion for rtcwake -*- shell-script -*-
-have rtcwake &&
_rtcwake()
{
- COMPREPLY=()
- local cur prev split=false
- _get_comp_words_by_ref cur prev
-
- _split_longopt && split=true
+ local cur prev words cword split
+ _init_completion -s || return
case "$prev" in
--help|-h|--version|-V|--seconds|-s|--time|-t)
@@ -26,15 +22,8 @@ _rtcwake()
$split && return 0
- COMPREPLY=( $( compgen -W '--device --local --mode --seconds --time --utc \
- --verbose --version --help' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
} &&
complete -F _rtcwake rtcwake
-# 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/samba b/completions/samba
deleted file mode 100644
index 61d78abc..00000000
--- a/completions/samba
+++ /dev/null
@@ -1,298 +0,0 @@
-# bash completion for samba
-
-have smbclient && {
-_samba_resolve_order()
-{
- COMPREPLY=( $( compgen -W 'lmhosts host wins bcast' -- "$cur" ) )
-}
-
-_samba_domains()
-{
- if [ -n "${COMP_SAMBA_SCAN:-}" ]; then
- COMPREPLY=( $( compgen -W '$( smbtree -N -D )' -- "$cur" ) )
- fi
-}
-
-_samba_hosts()
-{
- if [ -n "${COMP_SAMBA_SCAN:-}" ]; then
- COMPREPLY=( $( compgen -W "$( smbtree -N -S | \
- sed -ne 's/^[[:space:]]*\\\\*\([^[:space:]]*\).*/\1/p' \
- )" -- $cur ) )
- fi
-}
-
-_samba_debuglevel()
-{
- COMPREPLY=( $( compgen -W '0 1 2 3 4 5 6 7 8 9 10' -- "$cur" ) )
-}
-
-_smbclient()
-{
- local cur prev split=false
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- _split_longopt && split=true
-
- case $prev in
- -R)
- _samba_resolve_order
- return 0;
- ;;
- -t)
- COMPREPLY=( $( compgen -W 'SJIS EUC JIS7 JIS8 JUNET HEX CAP' \
- -- "$cur" ) )
- return 0;
- ;;
- -s|-A|--authentication-file)
- _filedir
- return 0;
- ;;
- -l|--log-basename|-D)
- _filedir -d
- return 0;
- ;;
- -O)
- COMPREPLY=( $( compgen -W 'SO_KEEPALIVE SO_REUSEADDR \
- SO_BROADCAST TCP_NODELAY IPTOS_LOWDELAY \
- IPTOS_THROUGHPUT SO_SNDBUF SO_RCVBUF \
- SO_SNDLOWAT SO_RCVLOWAT' -- "$cur" ) )
- return 0;
- ;;
- -T)
- COMPREPLY=( $( compgen -W 'c x I X F b g q r N a' -- "$cur" ) )
- return 0;
- ;;
- -W|--workgroup)
- _samba_domains
- return 0;
- ;;
- -d|--debuglevel)
- _samba_debuglevel
- return 0
- ;;
- -p|--port|-M|-I|-b|-U|--user|-n|-i|-T|-c)
- # argument required but no completions available
- return 0
- ;;
- -\?|--help|-V|--version)
- # all other arguments are noop with these
- return 0
- ;;
- esac
-
- $split && return 0
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-b -d -L -U -I -M -m -A -N -i -O \
- -p -R -s -k -P -c -D -W -l -E --debuglevel \
- --log-basename --workgroup' -- "$cur" ) )
- fi
-}
-complete -F _smbclient smbclient
-
-_smbget()
-{
- local cur prev split=false
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- _split_longopt && split=true
-
- case $prev in
- -o|-f|--outputfile|--rcfile)
- _filedir
- return 0;
- ;;
- -d|--debuglevel)
- _samba_debuglevel
- return 0
- ;;
- esac
-
- $split && return 0
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-a --guest -r --resume -R --recursive -u \
- --username -p --password -w --workgroup -n --nonprompt -d \
- --debuglevel -D --dots -P --keep-permissions -o --outputfile -f \
- --rcfile -q --quiet -v --verbose -b --blocksize -? --help --usage' \
- -- "$cur" ) )
- fi
-}
-complete -F _smbget smbget
-
-_smbcacls()
-{
- local cur prev split=false
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- _split_longopt && split=true
-
- case $prev in
- -s)
- _filedir
- return 0;
- ;;
- -l|--log-basename)
- _filedir -d
- return 0;
- ;;
- -d|--debuglevel)
- _samba_debuglevel
- return 0
- ;;
- esac
-
- $split && return 0
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-a -M -D -S -U -C -G --numeric -t \
- -h --help -V -s -d --debuglevel -l --log-basename' -- "$cur" ) )
- fi
-}
-complete -F _smbcacls smbcacls
-
-_smbcquotas()
-{
- local cur prev split=false
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- _split_longopt && split=true
-
- case $prev in
- -s|-A|--authentication-file)
- _filedir
- return 0;
- ;;
- -l|--log-basename)
- _filedir -d
- return 0;
- ;;
- -d|--debuglevel)
- _samba_debuglevel
- return 0
- ;;
- esac
-
- $split && return 0
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-u -L -F -S -n -t -v -h --help -V \
- -s --debuglevel --log-basename -N -k \
- --authentication-file --user' -- "$cur" ) )
- fi
-}
-complete -F _smbcquotas smbcquotas
-
-_smbpasswd()
-{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- case $prev in
- -r)
- _samba_hosts
- return 0;
- ;;
- -R)
- _samba_resolve_order
- return 0;
- ;;
- -c)
- _filedir
- return 0;
- ;;
- -D)
- _samba_debuglevel
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-a -c -x -d -e -D -n -r -R -m -U -h \
- -s -w -W -i -L' -- "$cur" ) )
- fi
-}
-complete -F _smbpasswd smbpasswd
-
-_smbtar()
-{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- case $prev in
- -r|-t)
- _filedir tar
- return 0;
- ;;
- -s)
- _samba_hosts
- return 0;
- ;;
- -l)
- _samba_debuglevel
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-r -i -a -v -s -p -x -X -N -b -d -l -u -t' \
- -- "$cur" ) )
- fi
-}
-complete -F _smbtar smbtar
-
-_smbtree()
-{
- local cur prev split=false
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- _split_longopt && split=true
-
- case $prev in
- -s|-A|--authentication-file)
- _filedir
- return 0;
- ;;
- -l|--log-basename)
- _filedir -d
- return 0;
- ;;
- -d|--debuglevel)
- _samba_debuglevel
- return 0
- ;;
- esac
-
- $split && return 0
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-b -D -S -V -s -d --debuglevel -l \
- --log-basename -N -k -A --authentication-file -U --user\
- -h --help' -- "$cur" ) )
- fi
-}
-complete -F _smbtree smbtree
-}
-
-# 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/sbcl b/completions/sbcl
index 33671a6e..28cb9d80 100644
--- a/completions/sbcl
+++ b/completions/sbcl
@@ -1,13 +1,11 @@
+# -*- shell-script -*-
# bash programmable completion for various Common Lisp implementations by
# Nikodemus Siivola <nikodemus@random-state.net>
-have sbcl || have sbcl-mt &&
_sbcl()
{
- local cur
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
+ local cur prev words cword
+ _init_completion || return
# completing an option (may or may not be separated by a space)
if [[ "$cur" == -* ]]; then
@@ -22,10 +20,4 @@ _sbcl()
} &&
complete -F _sbcl sbcl sbcl-mt
-# 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/sbopkg b/completions/sbopkg
new file mode 100644
index 00000000..647355b0
--- /dev/null
+++ b/completions/sbopkg
@@ -0,0 +1,74 @@
+# bash completion for sbopkg tool -*- shell-script -*-
+
+_sbopkg()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-b -c -d -e -f -g -h -i -k -l \
+ -o -P -p -q -R -r -s -u -V -v' -- "$cur" ) )
+ return 0
+ fi
+
+ case "$prev" in
+ -e)
+ COMPREPLY=( $( compgen -W 'ask continue stop' -- "$cur" ) )
+ return 0
+ ;;
+ -f)
+ _filedir
+ return 0
+ ;;
+ -d)
+ _filedir -d
+ return 0
+ ;;
+ -V)
+ COMPREPLY=( $( compgen -W "? \
+ $(sbopkg -V ? 2>&1 | cut -s -f1)" -- "$cur" ) )
+ return 0
+ ;;
+ -i|-b)
+ ;;
+ *)
+ return 0
+ ;;
+ esac
+
+ local i config
+ config="/etc/sbopkg/sbopkg.conf"
+ for (( i=${#words[@]}-1; i>0; i-- )); do
+ if [[ "${words[i]}" == -f ]]; then
+ config="${words[i+1]}"
+ break
+ fi
+ done
+
+ if [ ! -r "$config" ]; then
+ return 0
+ fi
+
+ . $config
+
+ for (( i=1; i<${#words[@]}; i++ )); do
+ case "${words[i]}" in
+ -V)
+ REPO_NAME="${words[i+1]%%/*}"
+ REPO_BRANCH="${words[i+1]#*/}"
+ ;;
+ -d)
+ REPO_ROOT="${words[i+1]}"
+ ;;
+ esac
+ done
+
+ if [ ! -r "$REPO_ROOT/$REPO_NAME/$REPO_BRANCH/SLACKBUILDS.TXT" ]; then
+ return 0
+ fi
+ COMPREPLY=( $( sed -ne "/^SLACKBUILD NAME: $cur/{s/^SLACKBUILD NAME: //;p}"\
+ $REPO_ROOT/$REPO_NAME/$REPO_BRANCH/SLACKBUILDS.TXT )
+ $( cd $QUEUEDIR; compgen -f -X "!*.sqf" -- "$cur" ) )
+} && complete -F _sbopkg sbopkg
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/screen b/completions/screen
index 952d9766..7132d064 100644
--- a/completions/screen
+++ b/completions/screen
@@ -1,18 +1,29 @@
-# bash completion for screen
+# bash completion for screen -*- shell-script -*-
-have screen &&
_screen_sessions()
{
- COMPREPLY=( $( compgen -W "$( command screen -ls | sed -ne \
- 's|^\t\{1,\}\([0-9]\{1,\}\.[^\t]\{1,\}\).*'"$1"'.*$|\1|p' )" \
- -- "$cur" ) )
+ local sessions=( $( command screen -ls | sed -ne \
+ 's|^\t\{1,\}\([0-9]\{1,\}\.[^\t]\{1,\}\).*'"$1"'.*$|\1|p' ) )
+ if [[ $cur == +([0-9])?(.*) ]]; then
+ # Complete sessions including pid prefixes
+ COMPREPLY=( $( compgen -W '${sessions[@]}' -- "$cur" ) )
+ else
+ # Create unique completions, dropping pids where possible
+ local -A res
+ local i tmp
+ for i in ${sessions[@]}; do
+ res[${i/#+([0-9])./}]+=" $i"
+ done
+ for i in ${!res[@]}; do
+ [[ ${res[$i]} == \ *\ * ]] && tmp+=" ${res[$i]}" || tmp+=" $i"
+ done
+ COMPREPLY=( $( compgen -W '$tmp' -- "$cur" ) )
+ fi
} &&
_screen()
{
local cur prev words cword
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev words cword
+ _init_completion || return
if ((cword > 2)); then
case ${words[cword-2]} in
@@ -23,6 +34,22 @@ _screen()
esac
fi
+ local i
+ for (( i=1; i <= cword; i++ )); do
+ case ${words[i]} in
+ -r|-R|-d|-D|-x|-s|-c|-T|-e|-h|-p|-S|-t)
+ (( i++ ))
+ continue
+ ;;
+ -*)
+ continue
+ ;;
+ esac
+
+ _command_offset $i
+ return
+ done
+
case $prev in
-[rR])
# list detached
@@ -47,20 +74,21 @@ _screen()
_filedir
return 0
;;
+ -T)
+ _terms
+ return 0
+ ;;
+ -e|-h|-p|-S|-t)
+ return 0
+ ;;
esac
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-a -A -c -d -D -e -f -fn -fa -h -i -ln \
- -list -L -m -O -p -q -r -R -s -S -t -U -v -wipe -x -X --help \
+ -list -L -m -O -p -q -r -R -s -S -t -T -U -v -wipe -x -X --help \
--version' -- "$cur" ) )
fi
} &&
-complete -F _screen -o default screen
+complete -F _screen screen
-# 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/service b/completions/service
index 1a36f59b..f008770e 100644
--- a/completions/service
+++ b/completions/service
@@ -1,47 +1,34 @@
-# service(8) and /etc/init.d/* completion
+# service(8) and /etc/init.d/* completion -*- shell-script -*-
# This completes on a list of all available service scripts for the
# 'service' command and/or the SysV init.d directory, followed by
# that script's available commands
-#
-{ have service || [ -d /etc/init.d/ ]; } &&
+
_service()
{
- local cur prev sysvdir
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- # don't complete for things like killall, ssh and mysql if it's
- # the standalone command, rather than the init script
- [[ ${COMP_WORDS[0]} != @(*init.d/!(functions|~)|service) ]] && return 0
+ local cur prev words cword
+ _init_completion || return
# don't complete past 2nd token
- [ $COMP_CWORD -gt 2 ] && return 0
+ [ $cword -gt 2 ] && return 0
- if [[ $COMP_CWORD -eq 1 && $prev == "service" ]]; then
+ if [[ $cword -eq 1 && $prev == ?(*/)service ]]; then
_services
else
+ local sysvdir
[ -d /etc/rc.d/init.d ] && \
sysvdir=/etc/rc.d/init.d || sysvdir=/etc/init.d
COMPREPLY=( $( compgen -W '`sed -e "y/|/ /" \
-ne "s/^.*\(U\|msg_u\)sage.*{\(.*\)}.*$/\2/p" \
- $sysvdir/${prev##*/} 2>/dev/null`' -- "$cur" ) )
+ $sysvdir/${prev##*/} 2>/dev/null` start stop' -- "$cur" ) )
fi
return 0
} &&
complete -F _service service
-for svc in /etc/init.d/*; do
- [ ! -x "$svc" ] || complete -p "${svc##*/}" &>/dev/null || \
- complete -F _service -o default "${svc##*/}"
+for svc in /etc/init.d/!($_backup_glob) /etc/rc.d/init.d/!($_backup_glob); do
+ [ -x "$svc" ] && complete -F _service $svc
done
unset svc
-# 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/sh b/completions/sh
index 9c7ca020..b70e53e2 100644
--- a/completions/sh
+++ b/completions/sh
@@ -1,11 +1,9 @@
-# POSIX sh(1) completion
+# POSIX sh(1) completion -*- shell-script -*-
-have sh &&
_sh()
{
- COMPREPLY=()
- local cur prev
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-c)
@@ -32,10 +30,4 @@ _sh()
} &&
complete -F _sh sh
-# 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/shadow b/completions/shadow
deleted file mode 100644
index 6aea045b..00000000
--- a/completions/shadow
+++ /dev/null
@@ -1,482 +0,0 @@
-# bash completion for shadow utils
-
-have useradd &&
-_useradd()
-{
- local cur prev split=false
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- _split_longopt && split=true
-
- # 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 '--base-dir --comment --home-dir --defaults \
- --expiredate --inactive --gid --groups --help --skel --key \
- --no-log-init --create-home --no-create-home --no-user-group \
- --non-unique --password --system --shell --uid --user-group \
- --selinux-user' -- "$cur" ) )
- return 0
- fi
-} &&
-complete -F _useradd useradd
-
-have usermod &&
-_usermod()
-{
- local cur prev split=false
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- _split_longopt && split=true
-
- # 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 '--append --comment --home --expiredate \
- --inactive --gid --groups --help --login --lock --move-home \
- --non-unique --password --shell --uid --unlock --selinux-user' \
- -- "$cur" ) )
- return 0
- fi
-
- COMPREPLY=( $( compgen -u -- "$cur" ) )
-} &&
-complete -F _usermod usermod
-
-have userdel &&
-_userdel()
-{
- local cur
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--force --help --remove' -- "$cur" ) )
- return 0
- fi
-
- COMPREPLY=( $( compgen -u -- "$cur" ) )
-} &&
-complete -F _userdel userdel
-
-have chage &&
-_chage()
-{
- local cur prev split=false
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- _split_longopt && split=true
-
- case $prev in
- -d|--lastday|-E|--expiredate|-h|--help|-I|--inactive|-m|--mindays|\
- -M|--maxdays|-W|--warndays)
- return 0
- ;;
- esac
-
- $split && return 0
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--lastday --expiredate --help --inactive \
- --list --mindays --maxdays --warndays' -- "$cur" ) )
- return 0
- fi
-
- COMPREPLY=( $( compgen -u -- "$cur" ) )
-} &&
-complete -F _chage chage
-
-have passwd &&
-_passwd()
-{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- case $prev in
- -n|-x|-w|-i|-\?|--help|--usage)
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-k -l --stdin -u -d -n -x -w -i -S \
- -? --help --usage' -- "$cur" ) )
- return 0
- fi
-
- _allowed_users
-} &&
-complete -F _passwd passwd
-
-have chpasswd &&
-_chpasswd()
-{
- local cur prev split=false
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- _split_longopt && split=true
-
- case $prev in
- -c|--crypt)
- COMPREPLY=( $( compgen -W 'DES MD5 NONE SHA256 SHA512' \
- -- "$cur" ) )
- return 0
- ;;
- -s|--sha-rounds)
- return 0
- ;;
- esac
-
- $split && return 0
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--crypt-method --encrypted \
- --help --md5 --sha-rounds' -- "$cur" ) )
- return 0
- fi
-} &&
-complete -F _chpasswd chpasswd
-
-have newusers &&
-_newusers()
-{
- local cur prev split=false
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- _split_longopt && split=true
-
- case $prev in
- -c|--crypt)
- COMPREPLY=( $( compgen -W 'DES MD5 NONE SHA256 SHA512' \
- -- "$cur" ) )
- return 0
- ;;
- -s|--sha-rounds)
- return 0
- ;;
- esac
-
- $split && return 0
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--crypt-method --help --system \
- --sha-rounds' -- "$cur" ) )
- return 0
- fi
-
- _filedir
-} &&
-complete -F _newusers newusers
-
-have pwck &&
-_pwck()
-{
- local cur
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-q -r -s' -- "$cur" ) )
- return 0
- fi
-
- _filedir
-} &&
-complete -F _pwck pwck
-
-have groupadd &&
-_groupadd()
-{
- local cur prev split=false
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- _split_longopt && split=true
-
- # 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 '--force --gid --help \
- --key --non-unique --password --system' -- "$cur" ) )
- return 0
- fi
-} &&
-complete -F _groupadd groupadd
-
-have groupmod &&
-_groupmod()
-{
- local cur prev split=false
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- _split_longopt && split=true
-
- # 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 '--gid --help --new-name \
- --non-unique --password' -- "$cur" ) )
- return 0
- fi
-
- COMPREPLY=( $( compgen -g -- "$cur" ) )
-} &&
-complete -F _groupmod groupmod
-
-complete -g groupdel
-
-have newgrp &&
-_newgrp()
-{
- COMPREPLY=()
- if [[ "`_get_cword`" == "-" ]]; then
- COMPREPLY=( - )
- else
- _allowed_groups
- fi
-} &&
-complete -F _newgrp newgrp
-
-have gpasswd &&
-_gpasswd()
-{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- case $prev in
- -a|-d|-A|-M)
- COMPREPLY=( $( compgen -u -- "$cur" ) )
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-a -d -r -R -A -M' -- "$cur" ) )
- return 0
- fi
-
- COMPREPLY=( $( compgen -g -- "$cur" ) )
-} &&
-complete -F _gpasswd gpasswd
-
-have groupmems &&
-_groupmems()
-{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- case $prev in
- -a|-d)
- COMPREPLY=( $( compgen -u -- "$cur" ) )
- return 0
- ;;
- -g)
- COMPREPLY=( $( compgen -g -- "$cur" ) )
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-a -d -p -g -l' -- "$cur" ) )
- return 0
- fi
-} &&
-complete -F _groupmems groupmems
-
-have grpck &&
-_grpck()
-{
- local cur
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-r -s' -- "$cur" ) )
- return 0
- fi
-
- _filedir
-} &&
-complete -F _grpck grpck
-
-have vipw || have vigr &&
-_vipw()
-{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- case $prev in
- -h|--help)
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--group --help --passwd \
- --quiet --shadow' -- "$cur" ) )
- return 0
- fi
-} &&
-complete -F _vipw vipw vigr
-
-have faillog &&
-_faillog()
-{
- local cur prev split=false
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- _split_longopt && split=true
-
- case $prev in
- -h|--help|-l|--lock-time|-m|--maximum|-t|--time)
- return 0
- ;;
- -u|--user)
- COMPREPLY=( $( compgen -u -- "$cur" ) )
- return 0
- ;;
- esac
-
- $split && return 0
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--all --help --lock-time \
- --maximum --reset --time --user' -- "$cur" ) )
- return 0
- fi
-} &&
-complete -F _faillog faillog
-
-have lastlog &&
-_lastlog()
-{
- local cur prev split=false
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- _split_longopt && split=true
-
- case $prev in
- -b|--before|-h|--help|-t|--time)
- return 0
- ;;
- -u|--user)
- COMPREPLY=( $( compgen -u -- "$cur" ) )
- return 0
- ;;
- esac
-
- $split && return 0
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--before --help --time --user' -- "$cur" ) )
- return 0
- fi
-} &&
-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 616bc5e4..1f18514a 100644
--- a/completions/sitecopy
+++ b/completions/sitecopy
@@ -1,40 +1,51 @@
-# sitecopy(1) completion
+# sitecopy(1) completion -*- shell-script -*-
# Copyright 2003 Eelco Lempsink <eelcolempsink@gmx.net>
+# 2011 Raphaƫl Droz <raphael.droz+floss@gmail.com>
# License: GNU GPL v2 or later
-have sitecopy &&
_sitecopy()
{
- local cur
+ local cur prev words cword split
+ _init_completion -s || return
- COMPREPLY=()
- _get_comp_words_by_ref cur
+ case $prev in
+ --debug|-d)
+ COMPREPLY=( $( compgen -W "socket files rcfile ftp http httpbody
+ rsh sftp xml xmlparse cleartext" -- "$cur" ) )
+ compopt -o nospace
+ return 0
+ ;;
+ --logfile|-g|--rcfile|-r)
+ _filedir
+ return 0
+ ;;
+ --storepath|-p)
+ _filedir -d
+ return 0
+ ;;
+ esac
case $cur in
--*)
- COMPREPLY=( $( compgen -W "$(sitecopy -h | command grep -e '--\w' |\
- awk '{sub (/=(FILE|PATH)/, "", $2); print $2}')" -- "$cur" ) )
- ;;
- -*)
- COMPREPLY=( $( compgen -W "$(sitecopy -h | command grep -e '-\w' | \
- awk '{sub (",", "", $1); print $1}')" -- "$cur" ) )
+ COMPREPLY=( $( compgen -W "$(_parse_help $1)" -- "$cur" ) )
+ [[ $COMPREPLY == *= ]] && compopt -o nospace
+ return 0
;;
- *)
- if [ -r ~/.sitecopyrc ]; then
- COMPREPLY=( $( compgen -W "$(command grep '^["$'\t '"]*site' \
- ~/.sitecopyrc | awk '{print $2}')" -- "$cur" ) )
- fi
+
+ # only complete long options
+ -)
+ compopt -o nospace
+ COMPREPLY=( -- )
+ return 0
;;
esac
+ if [ -r ~/.sitecopyrc ]; then
+ COMPREPLY=( $( compgen -W "$($1 -v | \
+ command sed -n '/^Site:/s/Site: //p')" -- "$cur" ) )
+ fi
return 0
} &&
complete -F _sitecopy -o default sitecopy
-# 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/slackpkg b/completions/slackpkg
new file mode 100644
index 00000000..1d5759cb
--- /dev/null
+++ b/completions/slackpkg
@@ -0,0 +1,108 @@
+# bash completion for slackpkg tool -*- shell-script -*-
+# options list is based on `grep '\-.*\=.*)' /usr/sbin/slackpkg | cut -f1 -d\)`
+
+_slackpkg()
+{
+ local cur prev words cword
+ _init_completion -n = || return
+
+ local split=false
+ if [[ "$cur" == -?*=* ]]; then
+ prev="${cur%%?(\\)=*}"
+ cur="${cur#*=}"
+ split=true
+ fi
+
+ case "$prev" in
+ -delall|-checkmd5|-checkgpg|-checksize|-postinst|-onoff|-download_all|\
+ -dialog|-batch|-only_new_dotnew|-use_includes|-spinning)
+ COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) )
+ return 0
+ ;;
+ -default_answer)
+ COMPREPLY=( $( compgen -W 'yes no' -- "$cur" ) )
+ return 0
+ ;;
+ -dialog_maxargs|-mirror)
+ # argument required but no completions available
+ return 0
+ ;;
+ esac
+
+ $split && return 0
+
+ if [[ "$cur" == -* ]]; then
+ compopt -o nospace
+ COMPREPLY=( $( compgen -W '-delall= -checkmd5= -checkgpg= \
+ -checksize= -postinst= -onoff= -download_all= -dialog= \
+ -dialog_maxargs= -batch= -only_new_dotnew= -use_includes= \
+ -spinning= -default_answer= -mirror=' -- "$cur" ) )
+ return 0
+ fi
+
+ local confdir="/etc/slackpkg"
+ local config="$confdir/slackpkg.conf"
+
+ if [ ! -r "$config" ]; then
+ return 0
+ fi
+ . "$config"
+
+ local i action
+ for (( i=1; i<${#words[@]}; i++ )); do
+ if [[ "${words[i]}" != -* ]]; then
+ action="${words[i]}"
+ break
+ fi
+ done
+
+ case "$action" in
+ generate-template|search|file-search)
+ # argument required but no completions available
+ return 0
+ ;;
+ install-template|remove-template)
+ if [ -e "$confdir/templates" ]; then
+ COMPREPLY=( $( cd "$confdir/templates"; \
+ compgen -f -X "!*.template" -- "$cur" ) )
+ COMPREPLY=( ${COMPREPLY[@]%.template} )
+ fi
+ return 0
+ ;;
+ remove)
+ _filedir
+ COMPREPLY+=( $( compgen -W 'a ap d e f k kde kdei l n t tcl x \
+ xap y' -- "$cur" ) )
+ COMPREPLY+=( $( cd /var/log/packages; compgen -f -- "$cur" ) )
+ return 0
+ ;;
+ install|reinstall|upgrade|blacklist|download)
+ _filedir
+ COMPREPLY+=( $( compgen -W 'a ap d e f k kde kdei l n t tcl x \
+ xap y' -- "$cur" ) )
+ COMPREPLY+=( $( cut -f 6 -d\ ${WORKDIR}/pkglist 2> /dev/null | \
+ grep "^$cur" ) )
+ return 0
+ ;;
+ info)
+ COMPREPLY+=( $( cut -f 6 -d\ ${WORKDIR}/pkglist 2> /dev/null | \
+ grep "^$cur" ) )
+ return 0
+ ;;
+ update)
+ # we should complete the same as the next `list` + "gpg"
+ COMPREPLY=( $( compgen -W 'gpg' -- "$cur" ) )
+ ;&
+ *)
+ COMPREPLY+=( $( compgen -W 'install reinstall upgrade remove \
+ blacklist download update install-new upgrade-all \
+ clean-system new-config check-updates help generate-template \
+ install-template remove-template search file-search info' -- \
+ "$cur" ) )
+ return 0
+ ;;
+ esac
+
+} && complete -F _slackpkg slackpkg
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/slapt-get b/completions/slapt-get
new file mode 100644
index 00000000..99b50384
--- /dev/null
+++ b/completions/slapt-get
@@ -0,0 +1,81 @@
+# slapt-get completion -*- shell-script -*-
+
+_slapt_get()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ case "$prev" in
+ --config|-c)
+ _filedir
+ return 0
+ ;;
+ --retry|--search)
+ # 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 (--install|--install-set|--remove|--show|--filelist)
+ for (( i=${#words[@]}-1; i>0; i-- )); do
+ if [[ ${words[i]} == --show ]]; then
+ t="all"
+ break
+ elif [[ ${words[i]} == -@(i|-install) ]]; then
+ t="avl"
+ break
+ elif [[ ${words[i]} == --install-set ]]; then
+ t="set"
+ break
+ elif [[ ${words[i]} == --@(remove|filelist) ]]; then
+ t="ins"
+ break
+ fi
+ done
+
+ local config="/etc/slapt-get/slapt-getrc" # default config location
+ # search for config
+ for (( i=${#words[@]}-1; i>0; i-- )); do
+ if [[ ${words[i]} == -@(c|-config) ]]; then
+ config="${words[i+1]}"
+ break
+ fi
+ done
+ if [ ! -r "$config" ]; then
+ return
+ fi
+
+ case $t in
+ all) # --show
+ # slapt-get will fail to search for "^name-version"
+ # it can search for names only
+ local name=${cur%%-*}
+ COMPREPLY=( $( slapt-get -c $config --search "^$name" 2>/dev/null |\
+ sed -ne "/^$cur/{s/ .*$//;p}" ) )
+ return 0
+ ;;
+ avl) # --install|-i|
+ COMPREPLY=( $( slapt-get -c $config --available 2>/dev/null | \
+ sed -ne "/^$cur/{s/ .*$//;p}") )
+ return 0
+ ;;
+ ins) # --remove|--filelist
+ COMPREPLY=( $( cd /var/log/packages; compgen -f -- "$cur" ) )
+ return 0
+ ;;
+ set) # --install-set
+ COMPREPLY=( $( compgen -W 'a ap d e f k kde kdei l n t tcl x \
+ xap y' -- "$cur" ) )
+ return 0
+ ;;
+ esac
+} && complete -F _slapt_get slapt-get
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/slapt-src b/completions/slapt-src
new file mode 100644
index 00000000..976ef65e
--- /dev/null
+++ b/completions/slapt-src
@@ -0,0 +1,60 @@
+# slapt-src completion -*- shell-script -*-
+
+_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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/smartctl b/completions/smartctl
index 74e42816..8461c988 100644
--- a/completions/smartctl
+++ b/completions/smartctl
@@ -1,18 +1,31 @@
-# bash completion for smartctl(8)
+# bash completion for smartctl(8) -*- shell-script -*-
-have smartctl &&
-{
_smartctl_quietmode()
{
COMPREPLY=( $( compgen -W 'errorsonly silent noserial' -- "$cur" ) )
}
_smartctl_device()
{
- local i opts='ata scsi sat marvell hpt cciss'
- for (( i=0; i <= 31; i++ )) ; do
- opts="$opts 3ware,$i"
- done
- COMPREPLY=( $( compgen -W "$opts" -- "$cur" ) )
+ case $cur in
+ areca*|3ware*|megaraid*|cciss*)
+ COMPREPLY+=( ${cur%%,*},{0..31} )
+ COMPREPLY=( $( compgen -W '"${COMPREPLY[@]}"' -- "$cur" ) )
+ ;;
+ hpt*)
+ COMPREPLY+=( hpt,{1..4}/{1..8} hpt,{1..4}/{1..8}/{1..5} )
+ COMPREPLY=( $( compgen -W '"${COMPREPLY[@]}"' -- "$cur" ) )
+ ;;
+ *)
+ COMPREPLY=( $( compgen -W "ata scsi sat usbcypress usbjmicron
+ usbsunplus marvell areca 3ware hpt megaraid cciss auto test" \
+ -- "$cur" ) )
+ case "${COMPREPLY[@]}" in
+ areca|3ware|hpt|megaraid|cciss)
+ compopt -o nospace
+ ;;
+ esac
+ ;;
+ esac
}
_smartctl_tolerance()
{
@@ -37,7 +50,9 @@ _smartctl_feature()
}
_smartctl_log()
{
- COMPREPLY=( $( compgen -W 'error selftest selective directory' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W 'error selftest selective directory background
+ sasphy sasphy,reset sataphy sataphy,reset scttemp scttempsts
+ scttemphist scterc gplog smartlog xerror xselftest' -- "$cur" ) )
}
_smartctl_vendorattribute()
{
@@ -57,19 +72,27 @@ _smartctl_presets()
}
_smartctl_test()
{
- COMPREPLY=( $( compgen -W 'offline short long conveyance select \
- afterselect,on afterselect,off pending scttempint' -- "$cur" ) )
+ [[ $cur == @(pending|scttempint|vendor), ]] && return 0
+ COMPREPLY=( $( compgen -W 'offline short long conveyance select,
+ select,redo select,next afterselect,on afterselect,off pending,
+ scttempint, vendor,' -- "$cur" ) )
+ [[ $COMPREPLY == *, ]] && compopt -o nospace
+}
+_smartctl_drivedb()
+{
+ local prefix=
+ if [[ $cur == +* ]] ; then
+ prefix=+
+ cur="${cur#+}"
+ fi
+ _filedir h
+ [[ -n $prefix ]] && COMPREPLY=( "${COMPREPLY[@]/#/$prefix}" )
}
-
_smartctl()
{
- local cur prev split=false
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- _split_longopt && split=true
+ local cur prev words cword split
+ _init_completion -s || return
case $prev in
-q|--quietmode)
@@ -79,7 +102,7 @@ _smartctl()
_smartctl_device
return 0
;;
- -t|--tolerance)
+ -T|--tolerance)
_smartctl_tolerance
return 0
;;
@@ -115,6 +138,10 @@ _smartctl()
_smartctl_presets
return 0
;;
+ -B|--drivedb)
+ _smartctl_drivedb
+ return 0
+ ;;
-t|--test)
_smartctl_test
return 0
@@ -124,23 +151,18 @@ _smartctl()
$split && return 0
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--help --version --info --all --quietmode \
- --device --tolerance --badsum --report --nocheck --smart \
- --offlineauto --saveauto --health --capabilities --attributes \
- --log --vendorattribute --firmwarebug --presets --test --captive \
- --abort' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '--help --version --info --all --xall
+ --scan --scan-open --quietmode= --device= --tolerance= --badsum=
+ --report= --nocheck= --smart= --offlineauto= --saveauto= --health
+ --capabilities --attributes --log= --vendorattribute=
+ --firmwarebug= --presets= --drivedb= --test= --captive --abort' \
+ -- "$cur" ) )
+ [[ $COMPREPLY == *= ]] && compopt -o nospace
else
cur=${cur:=/dev/}
_filedir
fi
-}
+} &&
complete -F _smartctl smartctl
-}
-# 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/smbclient b/completions/smbclient
new file mode 100644
index 00000000..ceda7bbf
--- /dev/null
+++ b/completions/smbclient
@@ -0,0 +1,323 @@
+# bash completion for samba -*- shell-script -*-
+
+_samba_resolve_order()
+{
+ COMPREPLY=( $( compgen -W 'lmhosts host wins bcast' -- "$cur" ) )
+}
+
+_samba_domains()
+{
+ if [ -n "${COMP_SAMBA_SCAN:-}" ]; then
+ COMPREPLY=( $( compgen -W '$( smbtree -N -D )' -- "$cur" ) )
+ fi
+}
+
+_samba_hosts()
+{
+ if [ -n "${COMP_SAMBA_SCAN:-}" ]; then
+ COMPREPLY=( $( compgen -W "$( smbtree -N -S | \
+ sed -ne 's/^[[:space:]]*\\\\*\([^[:space:]]*\).*/\1/p' \
+ )" -- $cur ) )
+ fi
+}
+
+_samba_debuglevel()
+{
+ COMPREPLY=( $( compgen -W '{0..10}' -- "$cur" ) )
+}
+
+_samba_sockopts()
+{
+ COMPREPLY=( $( compgen -W 'SO_KEEPALIVE SO_REUSEADDR SO_BROADCAST
+ TCP_NODELAY IPTOS_LOWDELAY IPTOS_THROUGHPUT SO_SNDBUF SO_RCVBUF
+ SO_SNDLOWAT SO_RCVLOWAT' -- "$cur" ) )
+}
+
+_samba_signing()
+{
+ COMPREPLY=( $( compgen -W 'on off required' -- "$cur" ) )
+}
+
+_smbclient()
+{
+ local cur prev words cword split
+ _init_completion -s || return
+
+ case $prev in
+ -R|--name-resolve)
+ _samba_resolve_order
+ return 0
+ ;;
+ -t)
+ COMPREPLY=( $( compgen -W 'SJIS EUC JIS7 JIS8 JUNET HEX CAP' \
+ -- "$cur" ) )
+ return 0
+ ;;
+ -s|--configfile|-A|--authentication-file)
+ _filedir
+ return 0
+ ;;
+ -l|--log-basename|-D|--directory)
+ _filedir -d
+ return 0
+ ;;
+ -O|--socket-options)
+ _samba_sockopts
+ return 0
+ ;;
+ -T)
+ COMPREPLY=( $( compgen -W 'c x I X F b g q r N a' -- "$cur" ) )
+ return 0
+ ;;
+ -W|--workgroup)
+ _samba_domains
+ return 0
+ ;;
+ -d|--debuglevel)
+ _samba_debuglevel
+ return 0
+ ;;
+ -L|--list)
+ _samba_hosts
+ return 0
+ ;;
+ -S|--signing)
+ _samba_signing
+ return 0
+ ;;
+ -p|--port|-M|--message|-I|--ip-address|-b|--send-buffer|-U|--user|-n|\
+ --netbiosname|-i|--scope|-T|--tar|-c|--command|-m|--max-protocol)
+ # argument required but no completions available
+ return 0
+ ;;
+ -\?|--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
+ fi
+} &&
+complete -F _smbclient smbclient
+
+_smbget()
+{
+ local cur prev words cword split
+ _init_completion -s || return
+
+ case $prev in
+ -o|--outputfile|-f|--rcfile)
+ _filedir
+ return 0
+ ;;
+ -d|--debuglevel)
+ _samba_debuglevel
+ return 0
+ ;;
+ -w|--workgroup)
+ _samba_domains
+ return 0
+ ;;
+ -u|--username|-p|--password|-b|--blocksize)
+ return 0
+ ;;
+ esac
+
+ $split && return 0
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
+ [[ $COMPREPLY == *= ]] && compopt -o nospace
+ fi
+} &&
+complete -F _smbget smbget
+
+_smbcacls()
+{
+ local cur prev words cword split
+ _init_completion -s || return
+
+ case $prev in
+ -s|--configfile|-A|--authentication-file)
+ _filedir
+ return 0
+ ;;
+ -l|--log-basename)
+ _filedir -d
+ return 0
+ ;;
+ -d|--debuglevel)
+ _samba_debuglevel
+ return 0
+ ;;
+ --signing)
+ _samba_signing
+ return 0
+ ;;
+ -O|--socket-options)
+ _samba_sockopts
+ return 0
+ ;;
+ -W|--workgroup)
+ _samba_domains
+ return 0
+ ;;
+ -\?|--help|--usage|-D|--delete|-M|--modify|-a|--add|-S|--set|-C|\
+ --chown|-G|--chgrp|-n|--netbiosname|-i|--scope|-U|--user)
+ return 0
+ ;;
+ esac
+
+ $split && return 0
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
+ [[ $COMPREPLY == *= ]] && compopt -o nospace
+ fi
+} &&
+complete -F _smbcacls smbcacls
+
+_smbcquotas()
+{
+ local cur prev words cword split
+ _init_completion -s || return
+
+ case $prev in
+ -s|--configfile|-A|--authentication-file)
+ _filedir
+ return 0
+ ;;
+ -l|--log-basename)
+ _filedir -d
+ return 0
+ ;;
+ -d|--debuglevel)
+ _samba_debuglevel
+ return 0
+ ;;
+ --signing)
+ _samba_signing
+ return 0
+ ;;
+ -\?|--help|--usage|-U|-u|--user|-S|--set)
+ return 0
+ ;;
+ esac
+
+ $split && return 0
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
+ [[ $COMPREPLY == *= ]] && compopt -o nospace
+ fi
+} &&
+complete -F _smbcquotas smbcquotas
+
+_smbpasswd()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ case $prev in
+ -r)
+ _samba_hosts
+ return 0
+ ;;
+ -R)
+ _samba_resolve_order
+ return 0
+ ;;
+ -c)
+ _filedir
+ return 0
+ ;;
+ -D)
+ _samba_debuglevel
+ return 0
+ ;;
+ -U|-h|-w)
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" -h )' -- "$cur" ) )
+ fi
+} &&
+complete -F _smbpasswd smbpasswd
+
+_smbtar()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ case $prev in
+ -r|-t)
+ _filedir tar
+ return 0
+ ;;
+ -s)
+ _samba_hosts
+ return 0
+ ;;
+ -l)
+ _samba_debuglevel
+ return 0
+ ;;
+ -N)
+ _filedir
+ return 0
+ ;;
+ -p|-x|-b|-d|-u)
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
+ fi
+} &&
+complete -F _smbtar smbtar
+
+_smbtree()
+{
+ local cur prev words cword split
+ _init_completion -s || return
+
+ case $prev in
+ -s|--configfile|-A|--authentication-file)
+ _filedir
+ return 0
+ ;;
+ -l|--log-basename)
+ _filedir -d
+ return 0
+ ;;
+ -d|--debuglevel)
+ _samba_debuglevel
+ return 0
+ ;;
+ -S|--signing)
+ _samba_signing
+ return 0
+ ;;
+ -\?|--help|--usage|-U|--user)
+ return 0
+ ;;
+ esac
+
+ $split && return 0
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
+ [[ $COMPREPLY == *= ]] && compopt -o nospace
+ fi
+} &&
+complete -F _smbtree smbtree
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/snownews b/completions/snownews
index 9c99ed7c..0cb35cdc 100644
--- a/completions/snownews
+++ b/completions/snownews
@@ -1,25 +1,15 @@
-# snownews(1) completion
+# snownews(1) completion -*- shell-script -*-
-have snownews &&
_snownews()
{
- local cur
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
+ local cur prev words cword
+ _init_completion || return
if [[ "$cur" == -* ]]; then
# return list of available options
- COMPREPLY=( $( compgen -W '--update --help --version \
- --disable-versioncheck -u -h -V' -- "$cur"))
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
fi
} &&
complete -F _snownews snownews
-# 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/sqlite3 b/completions/sqlite3
index b37c55f7..1207823d 100644
--- a/completions/sqlite3
+++ b/completions/sqlite3
@@ -1,11 +1,9 @@
-# sqlite3(1) completion
+# sqlite3(1) completion -*- shell-script -*-
-have sqlite3 &&
_sqlite3()
{
- COMPREPLY=()
- local cur prev
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
local dbexts='@(sqlite?(3)|?(s?(3))db)'
@@ -30,10 +28,4 @@ _sqlite3()
} &&
complete -F _sqlite3 sqlite3
-# 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/ssh b/completions/ssh
index cf966ae5..e30b9153 100644
--- a/completions/ssh
+++ b/completions/ssh
@@ -1,34 +1,22 @@
-# ssh(1) completion
-
-have ssh &&
-{
-
-_ssh_bindaddress()
-{
- COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W \
- "$( PATH="$PATH:/sbin" ifconfig -a | \
- sed -ne 's/.*addr:\([^[:space:]]*\).*/\1/p' \
- -ne 's/.*inet[[:space:]]\{1,\}\([^[:space:]]*\).*/\1/p' )" \
- -- "$cur" ) )
-}
+# ssh(1) completion -*- shell-script -*-
_ssh_ciphers()
{
- COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W '3des-cbc aes128-cbc \
+ COMPREPLY+=( $( compgen -W '3des-cbc aes128-cbc \
aes192-cbc aes256-cbc aes128-ctr aes192-ctr aes256-ctr arcfour128 \
arcfour256 arcfour blowfish-cbc cast128-cbc' -- "$cur" ) )
}
_ssh_macs()
{
- COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W 'hmac-md5 hmac-sha1 \
+ COMPREPLY+=( $( compgen -W 'hmac-md5 hmac-sha1 \
umac-64@openssh.com hmac-ripemd160 hmac-sha1-96 hmac-md5-96' \
-- "$cur" ) )
}
_ssh_options()
{
- type compopt &>/dev/null && compopt -o nospace
+ compopt -o nospace
COMPREPLY=( $( compgen -S = -W 'AddressFamily BatchMode BindAddress \
ChallengeResponseAuthentication CheckHostIP Cipher Ciphers \
ClearAllForwardings Compression CompressionLevel ConnectionAttempts \
@@ -74,7 +62,7 @@ _ssh_suboption()
COMPREPLY=( $( compgen -W 'any inet inet6' -- "$cur" ) )
;;
BindAddress)
- _ssh_bindaddress
+ _ip_addresses
;;
Cipher)
COMPREPLY=( $( compgen -W 'blowfish des 3des' -- "$cur" ) )
@@ -116,13 +104,11 @@ _ssh_suboption_check()
_ssh()
{
- local cur prev configfile
- local -a config
+ local cur prev words cword
+ _init_completion -n : || return
- COMPREPLY=()
- _get_comp_words_by_ref -n : cur prev
- #cur=`_get_cword :`
- #prev=`_get_pword`
+ local configfile
+ local -a config
_ssh_suboption_check && return 0
@@ -152,7 +138,10 @@ _ssh()
return 0
;;
-b)
- _ssh_bindaddress
+ _ip_addresses
+ return 0
+ ;;
+ -D|-e|-I|-L|-O|-p|-R|-W)
return 0
;;
esac
@@ -164,12 +153,10 @@ _ssh()
COMPREPLY=( "${COMPREPLY[@]/#/-F}" )
cur=-F$cur # Restore cur
elif [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-1 -2 -4 -6 -A -a -C -f -g -K -k -M \
- -N -n -q -s -T -t -V -v -X -v -Y -y -b -b -c -D -e -F \
- -i -L -l -m -O -o -p -R -S -w' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) )
else
# Search COMP_WORDS for '-F configfile' or '-Fconfigfile' argument
- set -- "${COMP_WORDS[@]}"
+ set -- "${words[@]}"
while [ $# -gt 0 ]; do
if [ "${1:0:2}" = -F ]; then
if [ ${#1} -gt 2 ]; then
@@ -183,29 +170,29 @@ _ssh()
shift
done
_known_hosts_real -a -F "$configfile" "$cur"
- if [ $COMP_CWORD -ne 1 ]; then
- _compopt_o_filenames
- COMPREPLY=( "${COMPREPLY[@]}" $( compgen -c -- "$cur" ) )
+ if [ $cword -ne 1 ]; then
+ compopt -o filenames
+ COMPREPLY+=( $( compgen -c -- "$cur" ) )
fi
fi
return 0
-}
+} &&
shopt -u hostcomplete && complete -F _ssh ssh slogin autossh
# sftp(1) completion
#
_sftp()
{
- local cur prev configfile
+ local cur prev words cword
+ _init_completion || return
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local configfile
_ssh_suboption_check && return 0
case $prev in
- -b|-F|-P)
+ -b|-F|-i)
_filedir
return 0
;;
@@ -213,6 +200,13 @@ _sftp()
_ssh_options
return 0
;;
+ -c)
+ _ssh_ciphers
+ return 0
+ ;;
+ -B|-D|-P|-R|-S|-s)
+ return 0
+ ;;
esac
if [[ "$cur" == -F* ]]; then
@@ -222,11 +216,10 @@ _sftp()
COMPREPLY=( "${COMPREPLY[@]/#/-F}" )
cur=-F$cur # Restore cur
elif [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-1 -C -v -B -b -F -o -P -R -S -s' \
- -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) )
else
# Search COMP_WORDS for '-F configfile' argument
- set -- "${COMP_WORDS[@]}"
+ set -- "${words[@]}"
while [ $# -gt 0 ]; do
if [ "${1:0:2}" = -F ]; then
if [ ${#1} -gt 2 ]; then
@@ -243,7 +236,7 @@ _sftp()
fi
return 0
-}
+} &&
shopt -u hostcomplete && complete -F _sftp sftp
# things we want to backslash escape in scp paths
@@ -283,7 +276,7 @@ _scp_remote_files()
sed -e 's/'$_scp_path_esc'/\\\\\\&/g' -e 's/[*@|=]$//g' \
-e 's/[^\/]$/& /g' )
fi
- COMPREPLY=( "${COMPREPLY[@]}" $files )
+ COMPREPLY+=( $files )
}
# This approach is used instead of _filedir to get a space appended
@@ -301,10 +294,10 @@ _scp_local_files()
fi
if $dirsonly ; then
- COMPREPLY=( "${COMPREPLY[@]}" $( command ls -aF1d $cur* 2>/dev/null | \
+ COMPREPLY+=( $( command ls -aF1d $cur* 2>/dev/null | \
sed -e "s/$_scp_path_esc/\\\\&/g" -e '/[^\/]$/d' -e "s/^/$1/") )
else
- COMPREPLY=( "${COMPREPLY[@]}" $( command ls -aF1d $cur* 2>/dev/null | \
+ COMPREPLY+=( $( command ls -aF1d $cur* 2>/dev/null | \
sed -e "s/$_scp_path_esc/\\\\&/g" -e 's/[*@|=]$//g' \
-e 's/[^\/]$/& /g' -e "s/^/$1/") )
fi
@@ -314,10 +307,10 @@ _scp_local_files()
#
_scp()
{
- local configfile cur prev prefix
+ local cur prev words cword
+ _init_completion -n : || return
- COMPREPLY=()
- _get_comp_words_by_ref -n : cur prev
+ local configfile prefix
_ssh_suboption_check && {
COMPREPLY=( "${COMPREPLY[@]/%/ }" )
@@ -330,7 +323,7 @@ _scp()
;;
-F|-i|-S)
_filedir
- type compopt &>/dev/null && compopt +o nospace
+ compopt +o nospace
return 0
;;
-c)
@@ -356,7 +349,7 @@ _scp()
prefix=-F
else
# Search COMP_WORDS for '-F configfile' or '-Fconfigfile' argument
- set -- "${COMP_WORDS[@]}"
+ set -- "${words[@]}"
while [ $# -gt 0 ]; do
if [ "${1:0:2}" = -F ]; then
if [ ${#1} -gt 2 ]; then
@@ -372,13 +365,13 @@ _scp()
case $cur in
-*)
- COMPREPLY=( $( compgen -W '-1 -2 -4 -6 -B -C -c -F -i -l -o \
- -P -p -q -r -S -v' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_usage "${words[0]}" )' \
+ -- "$cur" ) )
COMPREPLY=( "${COMPREPLY[@]/%/ }" )
return 0
;;
- */*)
- # pass through
+ */*|[.~]*)
+ # not a known host, pass through
;;
*)
_known_hosts_real -c -a -F "$configfile" "$cur"
@@ -389,40 +382,7 @@ _scp()
_scp_local_files "$prefix"
return 0
-}
+} &&
complete -F _scp -o nospace scp
-# ssh-copy-id(1) completion
-#
-_ssh_copy_id()
-{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- case $prev in
- -i)
- _filedir
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-i' -- "$cur" ) )
- else
- _known_hosts_real -a "$cur"
- fi
-
- return 0
-}
-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/ssh-copy-id b/completions/ssh-copy-id
new file mode 100644
index 00000000..9c5af9ca
--- /dev/null
+++ b/completions/ssh-copy-id
@@ -0,0 +1,25 @@
+# ssh-copy-id(1) completion -*- shell-script -*-
+
+_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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/sshfs b/completions/sshfs
index d7945f88..90a92645 100644
--- a/completions/sshfs
+++ b/completions/sshfs
@@ -1,34 +1,27 @@
-# sshfs(1) completion
+# sshfs(1) completion -*- shell-script -*-
-have sshfs &&
_sshfs()
{
- local cur userhost path
+ local cur prev words cword
+ _init_completion -n : || return
- COMPREPLY=()
- _get_comp_words_by_ref -n : cur
+ local userhost path
_expand || return 0
- if [[ "$cur" == *:* ]] && type _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
fi
- [[ "$cur" == */* ]] || _known_hosts_real -c -a "$cur"
+ [[ "$cur" == @(*/|[.~])* ]] || _known_hosts_real -c -a "$cur"
- type _scp_local_files &>/dev/null && _scp_local_files -d
+ _xfunc ssh _scp_local_files -d
return 0
} &&
complete -F _sshfs -o nospace sshfs
-# 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/sshmitm b/completions/sshmitm
new file mode 100644
index 00000000..829bfcd5
--- /dev/null
+++ b/completions/sshmitm
@@ -0,0 +1,17 @@
+# sshmitm completion -*- shell-script -*-
+
+_sshmitm()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) )
+ else
+ _known_hosts_real "$cur"
+ fi
+
+} &&
+complete -F _sshmitm sshmitm
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/sshow b/completions/sshow
new file mode 100644
index 00000000..a28d2444
--- /dev/null
+++ b/completions/sshow
@@ -0,0 +1,22 @@
+# sshow completion -*- shell-script -*-
+
+_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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/strace b/completions/strace
index 0ee27377..0ac4163a 100644
--- a/completions/strace
+++ b/completions/strace
@@ -1,14 +1,14 @@
-# bash completion for strace
+# bash completion for strace -*- shell-script -*-
-have strace &&
_strace()
{
- local cur prev offset i syscalls arch unistd
+ local cur prev words cword
+ _init_completion -n = || return
# check if we're still completing strace
- offset=0
- for (( i=1; i <= COMP_CWORD; i++ )); do
- case ${COMP_WORDS[$i]} in
+ local offset=0 i
+ for (( i=1; i <= cword; i++ )); do
+ case ${words[$i]} in
-o|-e|-p)
i=$((i+1))
continue
@@ -22,43 +22,48 @@ _strace()
done
if [ $offset -gt 0 ]; then
- # FAIL: _command_offset is not defined anywhere. Guillame?
_command_offset $offset
else
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
case $prev in
-e)
if [[ "$cur" == *=* ]]; then
prev=${cur/=*/}
cur=${cur/*=/}
- # Import arch-specific syscalls -- not foolproof IMHO
- #+ --David Paleino
- arch=$(command uname -m)
- syscalls=$(awk '/^#define __NR/ {print $2}' \
- /usr/include/asm/unistd.h | sed -e \
- 's/__NR_//')
- if [ -z "$syscalls" ]; then
- if [[ "$arch" == *86 ]]; then
- unistd=/usr/include/asm/unistd_32.h
- else
- unistd=/usr/include/asm/unistd_64.h
- fi
- syscalls=$(awk '/^#define __NR/ {print $2}' \
- $unistd | sed -e 's/__NR_//')
- fi
-
case $prev in
trace)
- COMPREPLY=( $( compgen -W "$syscalls file process
- network signal ipc desc all none" -- "$cur") )
+ # Import arch-specific syscalls
+ #+ -- not foolproof IMHO --David Paleino
+ local define syscall rest
+ local -A syscalls
+ while read -r define syscall rest; do
+ [[ $define == "#define" && \
+ $syscall =~ ^__NR_(.+) ]] && \
+ syscalls[${BASH_REMATCH[1]}]=1
+ done 2>/dev/null < /usr/include/asm/unistd.h
+ if [[ ! $syscalls ]]; then
+ local unistd arch=$( command uname -m )
+ if [[ "$arch" == *86 ]]; then
+ unistd=/usr/include/asm/unistd_32.h
+ else
+ unistd=/usr/include/asm/unistd_64.h
+ fi
+ while read -r define syscall rest; do
+ [[ $define == "#define" && \
+ $syscall =~ ^__NR_(.+) ]] && \
+ syscalls[${BASH_REMATCH[1]}]=1
+ done 2>/dev/null < $unistd
+ fi
+
+ COMPREPLY=( $( compgen -W '${!syscalls[@]} file
+ process network signal ipc desc all none' \
+ -- "$cur") )
return 0
;;
esac
else
+ compopt -o nospace
COMPREPLY=( $( compgen -S"=" -W 'trace abbrev verbose raw
signal read write' -- "$cur" ) )
fi
@@ -94,10 +99,4 @@ _strace()
} &&
complete -F _strace -o default strace
-# 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/svk b/completions/svk
index bda5997a..1146277d 100644
--- a/completions/svk
+++ b/completions/svk
@@ -1,12 +1,11 @@
-# svk(1) completion
+# svk(1) completion -*- shell-script -*-
-have svk &&
_svk()
{
- local cur prev commands options command
+ local cur prev words cword
+ _init_completion || return
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local commands options command
commands='add admin annotate ann blame praise cat checkout co cleanup \
cmerge cm commit ci copy cp delete del remove rm depotmap \
@@ -16,7 +15,7 @@ _svk()
pset pull push resolved revert smerge sm status st stat switch \
sw sync sy update up verify'
- if [[ $COMP_CWORD -eq 1 ]] ; then
+ if [[ $cword -eq 1 ]] ; then
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--version' -- "$cur" ) )
else
@@ -26,16 +25,16 @@ _svk()
case $prev in
-F|--file|--targets)
_filedir
- return 0;
+ return 0
;;
--encoding)
COMPREPLY=( $( compgen -W \
'$( iconv --list | sed -e "s@//@@;" )' -- "$cur" ) )
- return 0;
+ return 0
;;
esac
- command=${COMP_WORDS[1]}
+ command=${words[1]}
if [[ "$cur" == -* ]]; then
# possible options for the command
@@ -173,7 +172,7 @@ _svk()
-s --sync -m --merge -q --quiet'
;;
esac
- options="$options --help -h"
+ options+=" --help -h"
COMPREPLY=( $( compgen -W "$options" -- "$cur" ) )
else
@@ -216,10 +215,4 @@ _svk()
} &&
complete -F _svk svk
-# 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/sync_members b/completions/sync_members
new file mode 100644
index 00000000..77420f16
--- /dev/null
+++ b/completions/sync_members
@@ -0,0 +1,31 @@
+# mailman sync_members completion -*- shell-script -*-
+
+_sync_members()
+{
+ local cur prev words cword split
+ _init_completion -s || return
+
+ case $prev in
+ -w|-g|-d|--welcome-msg|--goodbye-msg|--digest)
+ COMPREPLY=( $( compgen -W 'y n' -- "$cur") )
+ return 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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/sysbench b/completions/sysbench
index 3b309a9a..e3d666cb 100644
--- a/completions/sysbench
+++ b/completions/sysbench
@@ -1,19 +1,9 @@
-# bash completion for sysbench
+# bash completion for sysbench -*- shell-script -*-
-# We set -o nospace and turn it off in quite a few places for bash < 4
-# reasons; assuming bash >= 4 we could instead not turn it on
-# initially but only in the few cases where it's actually needed.
-
-have sysbench &&
_sysbench()
{
- COMPREPLY=()
- local cur prev words split=false
- _get_comp_words_by_ref -n = cur prev words
-
- # long options need the "=" (whitespace split doesn't work), but we split
- # internally to make processing easier
- _split_longopt && split=true
+ local cur prev words cword split
+ _init_completion -s || return
case $prev in
--num-threads|--max-requests|--max-time|--thread-stack-size| \
@@ -21,12 +11,10 @@ _sysbench()
return 0
;;
--init-rng|--debug|--validate)
- compopt +o nospace &>/dev/null
COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) )
return 0
;;
--test)
- compopt +o nospace &>/dev/null
COMPREPLY=( $( compgen -W 'fileio cpu memory threads mutex oltp' \
-- "$cur" ) )
return 0
@@ -35,98 +23,80 @@ _sysbench()
return 0
;;
--file-test-mode)
- compopt +o nospace &>/dev/null
COMPREPLY=( $( compgen -W 'seqwr seqrewr seqrd rndrd rndwr rndrw' \
-- "$cur" ) )
return 0
;;
--file-io-mode)
- compopt +o nospace &>/dev/null
COMPREPLY=( $( compgen -W 'sync async fastmmap slowmmap' \
-- "$cur" ) )
return 0
;;
--file-extra-flags)
- compopt +o nospace &>/dev/null
COMPREPLY=( $( compgen -W 'sync dsync direct' -- "$cur" ) )
return 0
;;
--file-fsync-all|--file-fsync-end)
- compopt +o nospace &>/dev/null
COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) )
return 0
;;
--file-fsync-mode)
- compopt +o nospace &>/dev/null
COMPREPLY=( $( compgen -W 'fsync fdatasync' -- "$cur" ) )
return 0
;;
--memory-scope)
- compopt +o nospace &>/dev/null
COMPREPLY=( $( compgen -W 'global local' -- "$cur" ) )
return 0
;;
--memory-hugetlb)
- compopt +o nospace &>/dev/null
COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) )
return 0
;;
--memory-oper)
- compopt +o nospace &>/dev/null
COMPREPLY=( $( compgen -W 'read write none' -- "$cur" ) )
return 0
;;
--memory-access-mode)
- compopt +o nospace &>/dev/null
COMPREPLY=( $( compgen -W 'seq rnd' -- "$cur" ) )
return 0
;;
--oltp-test-mode)
- compopt +o nospace &>/dev/null
COMPREPLY=( $( compgen -W 'simple complex nontrx sp' -- "$cur" ) )
return 0
;;
--oltp-read-only|--oltp-skip-trx|--oltp-quto-inc|--mysql-ssl)
- compopt +o nospace &>/dev/null
COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) )
return 0
;;
--oltp-nontrx-mode)
- compopt +o nospace &>/dev/null
COMPREPLY=( $( compgen -W 'select update_key update_nokey insert
delete' -- "$cur" ) )
return 0
;;
--oltp-dist-type)
- compopt +o nospace &>/dev/null
COMPREPLY=( $( compgen -W 'uniform gaussian special' -- "$cur" ) )
return 0
;;
--db-driver)
- compopt +o nospace &>/dev/null
COMPREPLY=( $( compgen -W "$( $1 --test=oltp help 2>/dev/null |
sed -e '/^.*database drivers:/,/^$/!d' \
-ne 's/^ *\([^ ]*\) .*/\1/p' )" -- "$cur" ) )
return 0
;;
--db-ps-mode)
- compopt +o nospace &>/dev/null
COMPREPLY=( $( compgen -W 'auto disable' -- "$cur" ) )
return 0
;;
--mysql-socket)
- compopt +o nospace &>/dev/null
_filedir sock
return 0
;;
--mysql-table-engine)
- compopt +o nospace &>/dev/null
COMPREPLY=( $( compgen -W 'myisam innodb bdb heap ndbcluster
federated' -- "$cur" ) )
return 0
;;
--mysql-engine-trx)
- compopt +o nospace &>/dev/null
COMPREPLY=( $( compgen -W 'yes no auto' -- "$cur" ) )
return 0
;;
@@ -144,32 +114,20 @@ _sysbench()
fi
done
- local opts="--num-threads= --max-requests= --max-time= --thread-stack-size=
- --init-rng= --debug= --validate= --help --version"
-
+ local opts=$( _parse_help "$1" )
if [[ $test ]]; then
- local help=( $( _parse_help $1 "--test=$test help" ) )
- opts="$opts ${help[@]/%/=} prepare run cleanup help version"
- else
- opts="$opts --test="
+ local help=( $( _parse_help "$1" "--test=$test help" ) )
+ opts="${opts[@]/--test=/} ${help[@]} prepare run cleanup help version"
fi
if [[ "$cur" == -* || ! $test ]]; then
COMPREPLY=( $( compgen -W "$opts" -- "$cur" ) )
- [[ ${#COMPREPLY[@]} == 1 && ${COMPREPLY[0]} != *= ]] && \
- compopt +o nospace &>/dev/null
+ [[ $COMPREPLY == *= ]] && compopt -o nospace
else
- compopt +o nospace &>/dev/null
COMPREPLY=( $( compgen -W "prepare run cleanup help version" \
-- "$cur" ) )
fi
} &&
-complete -F _sysbench -o nospace sysbench
+complete -F _sysbench sysbench
-# 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/sysctl b/completions/sysctl
index ac25f4ef..0ab37129 100644
--- a/completions/sysctl
+++ b/completions/sysctl
@@ -1,24 +1,29 @@
-# bash completion for sysctl
+# bash completion for sysctl -*- shell-script -*-
-have sysctl &&
_sysctl()
{
- local cur
+ local cur prev words cword
+ _init_completion || return
- COMPREPLY=()
- _get_comp_words_by_ref cur
+ case $prev in
+ -p)
+ _filedir conf
+ return
+ ;;
+ esac
- COMPREPLY=( $( compgen -W \
- "$( PATH="$PATH:/sbin" sysctl -N -a 2>/dev/null )" -- "$cur" ) )
+ if [[ $cur == -* ]]; then
+ COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) )
+ else
+ local suffix=
+ [[ $prev == -w ]] && suffix==
+ COMPREPLY=( $( compgen -S "$suffix" -W \
+ "$( PATH="$PATH:/sbin" sysctl -N -a 2>/dev/null )" -- "$cur" ) )
+ [[ $COMPREPLY == *= ]] && compopt -o nospace
+ fi
return 0
} &&
complete -F _sysctl sysctl
-# 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/tar b/completions/tar
index a5c02490..9d1c56a4 100644
--- a/completions/tar
+++ b/completions/tar
@@ -1,26 +1,41 @@
-# bash completion for GNU tar
+# bash completion for GNU tar -*- shell-script -*-
-have tar && {
_tar()
{
- local cur ext regex tar untar
+ local cur prev words cword split
+ _init_completion -s || return
- COMPREPLY=()
- _get_comp_words_by_ref cur
+ local ext regex tar untar
- if [ $COMP_CWORD -eq 1 ]; then
+ if [ $cword -eq 1 ]; then
COMPREPLY=( $( compgen -W 'c t x u r d A' -- "$cur" ) )
return 0
fi
- case ${COMP_WORDS[1]} in
- ?(-)[cr]*f)
- _filedir
+ local tars='@(@(tar|gem|spkg)?(.@(Z|[gx]z|bz?(2)|lzma))|t@([glx]z|bz?(2)))'
+
+ case ${words[1]} in
+ --*)
+ ;;
+ ?(-)*[cr]*f)
+ if [[ $cword -eq 2 ]]; then
+ ext='@(tar|gem|spkg)'
+ case ${words[1]} in
+ *a*) ext="$tars" ;;
+ *z*) ext='t?(ar.)gz' ;;
+ *Z*) ext='tar.Z' ;;
+ *[jy]*) ext='t?(ar.)bz?(2)' ;;
+ *J*) ext='t?(ar.)xz' ;;
+ esac
+ _filedir $ext
+ else
+ _filedir
+ fi
return 0
;;
+([^IZzJjy])f)
- ext='@(@(tar|gem|spkg)?(.@(Z|[gx]z|bz?(2)|lzma))|t@([glx]z|bz?(2)))'
- regex='\(\(tar\|gem\|spkg\)\(\.\(Z\|[gx]z\|bz?(2)\|lzma\)\)\?\|t\([glx]z\|bz2\?\)\)'
+ ext="$tars"
+ regex='\(\(tar\|gem\|spkg\)\(\.\(Z\|[gx]z\|bz2\?\|lzma\)\)\?\|t\([glx]z\|bz2\?\)\)'
;;
*[Zz]*f)
ext='@(t?(ar.)|gem.|spkg.)@(gz|Z)'
@@ -40,19 +55,71 @@ _tar()
;;
esac
- if [[ "$COMP_LINE" == *$ext' ' ]]; then
- # complete on files in tar file
- #
- # get name of tar file from command line
- tar=$( sed -e 's/^.* \([^ ]*'$regex'\) .*$/\1/' <<<"$COMP_LINE" )
- # devise how to untar and list it
- untar=t${COMP_WORDS[1]//[^Izjyf]/}
+ case $prev in
+ *$ext)
+ # complete on files in tar file
+ #
+ # get name of tar file from command line
+ tar=$( sed -e 's/^.* \([^ ]*'$regex'\) .*$/\1/' <<<"${words[@]}" )
+ # devise how to untar and list it
+ untar=t${words[1]//[^IJzjyf]/}
- local IFS=$'\n'
- COMPREPLY=( $( compgen -W "$( printf '%s\n' $( tar $untar $tar \
- 2>/dev/null ) )" -- "$cur" ) )
- return 0
- fi
+ local IFS=$'\n'
+ COMPREPLY=( $( compgen -W "$( printf '%s\n' $( tar $untar $tar \
+ 2>/dev/null ) )" -- "$cur" ) )
+ return 0
+ ;;
+ -C|--directory)
+ _filedir -d
+ return 0
+ ;;
+ --atime-preserve)
+ COMPREPLY=( $( compgen -W 'replace system' -- "$cur" ) )
+ return 0
+ ;;
+ --group)
+ COMPREPLY=( $( compgen -g -- "$cur" ) )
+ return 0
+ ;;
+ --owner)
+ COMPREPLY=( $( compgen -u -- "$cur" ) )
+ return 0
+ ;;
+ -F|--info-script|--new-volume-script|--rmt-command|--rsh-command|\
+ -I|--use-compress-program)
+ compopt -o filenames
+ COMPREPLY=( $( compgen -c -- "$cur" ) )
+ return 0
+ ;;
+ --volno-file|--add-file|-T|--files-from|-X|--exclude-from|--index-file)
+ _filedir
+ return 0
+ ;;
+ -H|--format)
+ COMPREPLY=( $( compgen -W 'gnu oldgnu pax posix ustar v7' \
+ -- "$cur" ) )
+ return 0
+ ;;
+ --quoting-style)
+ COMPREPLY=( $( compgen -W 'literal shell shell-always c c-maybe
+ escape locale clocale' -- "$cur" ) )
+ return 0
+ ;;
+ --totals)
+ COMPREPLY=( $( compgen -W 'SIGHUP SIGQUIT SIGINT SIGUSR1 SIGUSR2' \
+ -- "$cur" ) )
+ return 0
+ ;;
+ --occurrence|--sparse-version|--to-command|--mode|--mtime|\
+ --tape-length|-b|--blocking-factor|--record-size|-V|--text|--backup|\
+ --exclude|--exclude-tag*|-K|--starting-file|-N|--newer|--after-date|\
+ --suffix|--strip-components|--transform|--xform|--checkpoint|\
+ --checkpoint-action|--no-quote-chars|--quote-chars|--warnings)
+ return 0
+ ;;
+ esac
+
+ $split && return 0
# file completion on relevant files
_filedir "$ext"
@@ -61,12 +128,5 @@ _tar()
}
[ -n "${COMP_TAR_INTERNAL_PATHS:-}" ] && complete -F _tar -o dirnames tar ||
complete -F _tar tar
-}
-# 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/tcpdump b/completions/tcpdump
index 259f13e0..8fe4ed63 100644
--- a/completions/tcpdump
+++ b/completions/tcpdump
@@ -1,12 +1,9 @@
-# bash completion for tcpdump
+# bash completion for tcpdump -*- shell-script -*-
-have tcpdump &&
_tcpdump()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-r|-w|-F)
@@ -17,21 +14,33 @@ _tcpdump()
_available_interfaces -a
return 0
;;
+ -m)
+ _filedir mib
+ return 0
+ ;;
+ -T)
+ COMPREPLY=( $( compgen -W 'aodv cnfp rpc rtp rtcp snmp tftp vat
+ wb' -- "$cur" ) )
+ return 0
+ ;;
+ -z)
+ COMPREPLY=( $( compgen -c -- "$cur" ) )
+ return 0
+ ;;
+ -Z)
+ _allowed_users
+ return 0
+ ;;
+ -B|-c|-C|-D|-E|-G|-M|-s|-W|-y)
+ return 0
+ ;;
esac
-
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-a -d -e -f -l -n -N -O -p \
- -q -R -S -t -u -v -x -C -F -i -m -r -s -T -w -E' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) )
fi
} &&
complete -F _tcpdump tcpdump
-# 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/tcpkill b/completions/tcpkill
new file mode 100644
index 00000000..82420230
--- /dev/null
+++ b/completions/tcpkill
@@ -0,0 +1,22 @@
+# tcpkill completion -*- shell-script -*-
+
+_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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/tcpnice b/completions/tcpnice
new file mode 100644
index 00000000..03c23e5e
--- /dev/null
+++ b/completions/tcpnice
@@ -0,0 +1,22 @@
+# tcpnice completion -*- shell-script -*-
+
+_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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/tracepath b/completions/tracepath
new file mode 100644
index 00000000..1861b6a2
--- /dev/null
+++ b/completions/tracepath
@@ -0,0 +1,23 @@
+# tracepath(8) completion -*- shell-script -*-
+
+_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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/tune2fs b/completions/tune2fs
new file mode 100644
index 00000000..ee88b45d
--- /dev/null
+++ b/completions/tune2fs
@@ -0,0 +1,58 @@
+# tune2fs(8) completion -*- shell-script -*-
+
+_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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/unace b/completions/unace
index 9d27ef50..4ce5e370 100644
--- a/completions/unace
+++ b/completions/unace
@@ -1,17 +1,14 @@
-# unace(1) completion
+# unace(1) completion -*- shell-script -*-
-have unace &&
_unace()
{
- local cur
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
+ local cur prev words cword
+ _init_completion || return
if [[ "$cur" == -* ]] ; then
COMPREPLY=( $( compgen -W '-c -c- -f -f- -o -o- -p -y -y-' -- "$cur" ) )
else
- if [ $COMP_CWORD -eq 1 ]; then
+ if [ $cword -eq 1 ]; then
COMPREPLY=( $( compgen -W 'e l t v x' -- "$cur" ) )
else
_filedir ace
@@ -20,10 +17,4 @@ _unace()
} &&
complete -F _unace unace
-# 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/unpack200 b/completions/unpack200
new file mode 100644
index 00000000..de708fe8
--- /dev/null
+++ b/completions/unpack200
@@ -0,0 +1,48 @@
+# unpack200(1) completion -*- shell-script -*-
+
+_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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/unrar b/completions/unrar
index 0a4fe27a..d99e62fe 100644
--- a/completions/unrar
+++ b/completions/unrar
@@ -1,19 +1,16 @@
-# unrar(1) completion
+# unrar(1) completion -*- shell-script -*-
-have unrar &&
_unrar()
{
- local cur
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
+ local cur prev words cword
+ _init_completion || return
if [[ "$cur" == -* ]] ; then
COMPREPLY=( $( compgen -W '-ad -ap -av- -c- -cfg- -cl -cu \
-dh -ep -f -idp -ierr -inul -kb -o+ -o- -ow -p -p- -r -ta \
-tb -tn -to -u -v -ver -vp -x -x@ -y' -- "$cur" ) )
else
- if [ $COMP_CWORD -eq 1 ]; then
+ if [ $cword -eq 1 ]; then
COMPREPLY=( $( compgen -W 'e l lb lt p t v vb vt x' -- "$cur" ) )
else
_filedir rar
@@ -23,10 +20,4 @@ _unrar()
} &&
complete -F _unrar unrar
-# 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/unshunt b/completions/unshunt
new file mode 100644
index 00000000..6e208d0c
--- /dev/null
+++ b/completions/unshunt
@@ -0,0 +1,17 @@
+# mailman unshunt completion -*- shell-script -*-
+
+_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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/update-alternatives b/completions/update-alternatives
index ebed294d..523e1de5 100644
--- a/completions/update-alternatives
+++ b/completions/update-alternatives
@@ -1,6 +1,5 @@
-# bash completion for update-alternatives
+# bash completion for update-alternatives -*- shell-script -*-
-have update-alternatives && {
_installed_alternatives()
{
local admindir
@@ -8,9 +7,9 @@ _installed_alternatives()
for i in alternatives dpkg/alternatives rpm/alternatives; do
[ -d /var/lib/$i ] && admindir=/var/lib/$i && break
done
- for (( i=1; i < COMP_CWORD; i++ )); do
- if [[ "${COMP_WORDS[i]}" == --admindir ]]; then
- admindir=${COMP_WORDS[i+1]}
+ for (( i=1; i < cword; i++ )); do
+ if [[ "${words[i]}" == --admindir ]]; then
+ admindir=${words[i+1]}
break
fi
done
@@ -19,10 +18,8 @@ _installed_alternatives()
_update_alternatives()
{
- local cur prev mode args i
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
--altdir|--admindir)
@@ -34,11 +31,13 @@ _update_alternatives()
;;
esac
+ local mode args i
+
# find which mode to use and how many real args used so far
- for (( i=1; i < COMP_CWORD; i++ )); do
- if [[ "${COMP_WORDS[i]}" == --@(install|remove|auto|display|config|remove-all|set) ]]; then
- mode=${COMP_WORDS[i]}
- args=$(($COMP_CWORD - i))
+ for (( i=1; i < cword; i++ )); do
+ if [[ "${words[i]}" == --@(install|remove|auto|display|config|remove-all|set) ]]; then
+ mode=${words[i]}
+ args=$(($cword - i))
break
fi
done
@@ -87,14 +86,7 @@ _update_alternatives()
--altdir --admindir --install --remove --auto --display \
--config --set' -- "$cur" ) )
esac
-}
+} &&
complete -F _update_alternatives update-alternatives alternatives
-}
-# 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/sysv-rc b/completions/update-rc.d
index 735a4042..b1d21e86 100644
--- a/completions/sysv-rc
+++ b/completions/update-rc.d
@@ -1,29 +1,29 @@
-# update-rc.d(8) completion
+# update-rc.d(8) completion -*- shell-script -*-
#
# Copyright (C) 2004 Servilio Afre Puentes <servilio@gmail.com>
-have update-rc.d &&
_update_rc_d()
{
- local cur prev sysvdir services options valid_options
+ local cur prev words cword
+ _init_completion || return
- _get_comp_words_by_ref cur prev
+ 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|*.dpkg*|*.rpm@(orig|new|save))) )
+ services=( $(printf '%s ' $sysvdir/!(README*|*.sh|$_backup_glob)) )
services=( ${services[@]#$sysvdir/} )
options=( -f -n )
- if [[ $COMP_CWORD -eq 1 || "$prev" == -* ]]; then
+ if [[ $cword -eq 1 || "$prev" == -* ]]; then
valid_options=( $( \
- tr " " "\n" <<<"${COMP_WORDS[@]} ${options[@]}" \
+ tr " " "\n" <<<"${words[@]} ${options[@]}" \
| sed -ne "/$( sed "s/ /\\|/g" <<<"${options[@]}" )/p" \
| sort | uniq -u \
) )
COMPREPLY=( $( compgen -W '${options[@]} ${services[@]}' \
- -X '$( tr " " "|" <<<${COMP_WORDS[@]} )' -- "$cur" ) )
+ -X '$( tr " " "|" <<<${words[@]} )' -- "$cur" ) )
elif [[ "$prev" == ?($( tr " " "|" <<<${services[@]} )) ]]; then
COMPREPLY=( $( compgen -W 'remove defaults start stop' -- "$cur" ) )
elif [[ "$prev" == defaults && "$cur" == [0-9] ]]; then
@@ -62,49 +62,4 @@ _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 sysvdir services options valid_options
-
- _get_comp_words_by_ref cur prev
-
- [ -d /etc/rc.d/init.d ] && sysvdir=/etc/rc.d/init.d \
- || sysvdir=/etc/init.d
-
- services=( $( printf '%s ' \
- $sysvdir/!(README*|*.sh|*.dpkg*|*.rpm@(orig|new|save)) ) )
- services=( ${services[@]#$sysvdir/} )
- options=( --help --quiet --force --try-anyway --disclose-deny --query \
- --no-fallback )
-
- if [[ ($COMP_CWORD -eq 1) || ("$prev" == --* ) ]]; then
- valid_options=( $( \
- tr " " "\n" <<<"${COMP_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/upgradepkg b/completions/upgradepkg
new file mode 100644
index 00000000..06dbe571
--- /dev/null
+++ b/completions/upgradepkg
@@ -0,0 +1,17 @@
+# Slackware Linux upgradepkg completion -*- shell-script -*-
+
+_upgradepkg()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--dry-run --install-new --reinstall \
+ --verbose' -- "$cur") )
+ return 0
+ fi
+
+ _filedir "t[bglx]z"
+} && complete -F _upgradepkg upgradepkg
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/urlsnarf b/completions/urlsnarf
new file mode 100644
index 00000000..bb1a29ef
--- /dev/null
+++ b/completions/urlsnarf
@@ -0,0 +1,22 @@
+# urlsnarf completion -*- shell-script -*-
+
+_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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/useradd b/completions/useradd
new file mode 100644
index 00000000..2a61c948
--- /dev/null
+++ b/completions/useradd
@@ -0,0 +1,45 @@
+# useradd(8) completion -*- shell-script -*-
+
+_useradd()
+{
+ local cur prev words cword split
+ _init_completion -s || return
+
+ # TODO: if -o/--non-unique is given, could complete on existing uids
+ # with -u/--uid
+
+ case $prev in
+ -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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/userdel b/completions/userdel
new file mode 100644
index 00000000..aafd00eb
--- /dev/null
+++ b/completions/userdel
@@ -0,0 +1,17 @@
+# userdel(8) completion -*- shell-script -*-
+
+_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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/usermod b/completions/usermod
new file mode 100644
index 00000000..f8cd9e0e
--- /dev/null
+++ b/completions/usermod
@@ -0,0 +1,44 @@
+# usermod(8) completion -*- shell-script -*-
+
+_usermod()
+{
+ local cur prev words cword split
+ _init_completion -s || return
+
+ # TODO: if -o/--non-unique is given, could complete on existing uids
+ # with -u/--uid
+
+ case $prev in
+ -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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/util-linux b/completions/util-linux
deleted file mode 100644
index f45ffd56..00000000
--- a/completions/util-linux
+++ /dev/null
@@ -1,76 +0,0 @@
-# Completions for tools included in util-linux (not necessarily Linux specific)
-
-# renice(8) completion
-#
-have renice &&
-_renice()
-{
- local command cur curopt i
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
- command=$1
-
- i=0
- # walk back through command line and find last option
- while [[ $i -le $COMP_CWORD && ${#COMPREPLY[@]} -eq 0 ]]; do
- curopt=${COMP_WORDS[COMP_CWORD-$i]}
- case "$curopt" in
- -u)
- _allowed_users
- ;;
- -g)
- _pgids
- ;;
- -p|$command)
- _pids
- ;;
- esac
- i=$(( ++i ))
- done
-} &&
-complete -F _renice renice
-
-# kill(1) completion
-#
-have kill &&
-_kill()
-{
- local cur
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
-
- if [[ $COMP_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
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
-
- if [ $COMP_CWORD = 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/vipw b/completions/vipw
new file mode 100644
index 00000000..4205cee2
--- /dev/null
+++ b/completions/vipw
@@ -0,0 +1,21 @@
+# vipw(8) and vigr completion -*- shell-script -*-
+
+_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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/vncviewer b/completions/vncviewer
index 296eb8af..46d6c617 100644
--- a/completions/vncviewer
+++ b/completions/vncviewer
@@ -1,6 +1,5 @@
-# bash completion for vncviewer
+# bash completion for vncviewer -*- shell-script -*-
-have vncviewer &&
_vncviewer_bootstrap()
{
local fname
@@ -17,13 +16,10 @@ _vncviewer_bootstrap()
} &&
complete -F _vncviewer_bootstrap vncviewer
-have tightvncviewer &&
_tightvncviewer()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-passwd)
@@ -58,13 +54,10 @@ 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
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
# Convert double dash to single dash
case ${prev/#--/-} in
@@ -98,33 +91,17 @@ _xvnc4viewer()
ZlibLevel \
)
[[ "$cur" == --* ]] && dash=-- || dash=-
- # Is a `nocasematch' variable available (bash > v3.1)?
- if shopt nocasematch 2> /dev/null | command grep -q ^nocasematch; then
- # Variable `nocasematch' is available
- # Use vncviewer camelcase options
- local option oldNoCaseMatch=$(shopt -p nocasematch)
- shopt -s nocasematch
- COMPREPLY=( $( for option in "${options[@]}"; do
+
+ local option oldNoCaseMatch=$(shopt -p nocasematch)
+ shopt -s nocasematch
+ COMPREPLY=( $( for option in "${options[@]}"; do
[[ $dash$option == "$cur"* ]] && printf '%s\n' $dash$option
done ) )
- eval "$oldNoCaseMatch" 2> /dev/null
- else
- # Variable 'nocasematch' isn't available;
- # Convert completions to lowercase
- COMPREPLY=( $( compgen -W \
- "$( tr [:upper:] [:lower:] <<<${options[@]/#/$dash} )" \
- -- "$( tr [:upper:] [:lower:] <<<"$cur" )" ) )
- fi
+ eval "$oldNoCaseMatch" 2>/dev/null
else
_known_hosts_real "$cur"
fi
} &&
complete -F _xvnc4viewer xvnc4viewer
-# 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/vpnc b/completions/vpnc
index 722fee3a..0465c31e 100644
--- a/completions/vpnc
+++ b/completions/vpnc
@@ -1,12 +1,9 @@
-# bash completion for vpnc
+# bash completion for vpnc -*- shell-script -*-
-have vpnc &&
_vpnc()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
--pfs)
@@ -40,10 +37,4 @@ _vpnc()
} &&
complete -F _vpnc vpnc
-# 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/watch b/completions/watch
new file mode 100644
index 00000000..c2832dd8
--- /dev/null
+++ b/completions/watch
@@ -0,0 +1,54 @@
+# watch(1) completion -*- shell-script -*-
+
+[[ $OSTYPE == *linux* ]] || return 1
+
+_watch()
+{
+ local cur prev words cword split
+ _init_completion -s || return
+
+ local offset=0 i
+ for (( i=1; i <= cword; i++ )); do
+ case ${words[i]} in
+ -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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/webmitm b/completions/webmitm
new file mode 100644
index 00000000..68440631
--- /dev/null
+++ b/completions/webmitm
@@ -0,0 +1,17 @@
+# webmitm completion -*- shell-script -*-
+
+_webmitm()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) )
+ else
+ _known_hosts_real "$cur"
+ fi
+
+} &&
+complete -F _webmitm webmitm
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/wireless-tools b/completions/wireless-tools
deleted file mode 100644
index 56ba0db8..00000000
--- a/completions/wireless-tools
+++ /dev/null
@@ -1,180 +0,0 @@
-# bash completion for Linux wireless-tools
-
-[ $UNAME = Linux ] &&
-{
-
-have iwconfig &&
-_iwconfig()
-{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- case $prev in
- mode)
- COMPREPLY=( $( compgen -W 'managed ad-hoc master \
- repeater secondary monitor' -- "$cur" ) )
- return 0
- ;;
- essid)
- COMPREPLY=( $( compgen -W 'on off any' -- "$cur" ) )
- if [ -n "${COMP_IWLIST_SCAN:-}" ]; then
- COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W \
- "$( iwlist ${COMP_WORDS[1]} scan | \
- awk -F'\"' '/ESSID/ {print $2}' )" -- "$cur" ) )
- fi
- return 0
- ;;
- nwid)
- COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) )
- return 0
- ;;
- channel)
- COMPREPLY=( $( compgen -W "$( iwlist ${COMP_WORDS[1]} channel | \
- awk '/^[ \t]*Channel/ {print $2}' )" -- "$cur" ) )
- return 0
- ;;
-
- freq)
- COMPREPLY=( $( compgen -W "$( iwlist ${COMP_WORDS[1]} channel | \
- awk '/^[ \t]*Channel/ {print $4"G"}')" -- "$cur" ) )
- return 0
- ;;
- ap)
- COMPREPLY=( $( compgen -W 'on off any' -- "$cur" ) )
- if [ -n "${COMP_IWLIST_SCAN:-}" ]; then
- COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W \
- "$( iwlist ${COMP_WORDS[1]} scan | \
- awk -F ': ' '/Address/ {print $2}' )" -- "$cur" ) )
- fi
- return 0
- ;;
- rate)
- COMPREPLY=( $( compgen -W 'auto fixed' -- "$cur" ) )
- COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W \
- "$( iwlist ${COMP_WORDS[1]} rate | \
- awk '/^[ \t]*[0-9]/ {print $1"M"}' )" -- "$cur" ) )
- return 0
- ;;
- rts|frag)
- COMPREPLY=( $( compgen -W 'auto fixed off' -- "$cur" ) )
- return 0
- ;;
- key|enc)
- COMPREPLY=( $( compgen -W 'off on open restricted' -- "$cur" ) )
- return 0
- ;;
- power)
- COMPREPLY=( $( compgen -W 'period timeout off on' -- "$cur" ) )
- return 0
- ;;
- txpower)
- COMPREPLY=( $( compgen -W 'off on auto' -- "$cur" ) )
- return 0
- ;;
- retry)
- COMPREPLY=( $( compgen -W 'limit lifetime' -- "$cur" ) )
- return 0
- ;;
- esac
-
- if [ $COMP_CWORD -eq 1 ]; then
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--help --version' -- "$cur" ) )
- else
- _available_interfaces -w
- fi
- else
- COMPREPLY=( $( compgen -W 'essid nwid mode freq channel sens mode \
- ap nick rate rts frag enc key power txpower commit' -- "$cur" ) )
- fi
-
-} &&
-complete -F _iwconfig iwconfig
-
-
-have iwlist &&
-_iwlist()
-{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- if [ $COMP_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
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
-
- if [ $COMP_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
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- case $prev in
- roam)
- COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) )
- return 0
- ;;
- port)
- COMPREPLY=( $( compgen -W 'ad-hoc managed' -- "$cur" ) )
- return 0
- ;;
- esac
-
- if [ $COMP_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/withlist b/completions/withlist
new file mode 100644
index 00000000..a48d7ea5
--- /dev/null
+++ b/completions/withlist
@@ -0,0 +1,18 @@
+# mailman withlist completion -*- shell-script -*-
+
+_withlist()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--lock --interactive \
+ --run --all --quiet --help' -- "$cur" ) )
+ else
+ _xfunc list_lists _mailman_lists
+ fi
+
+} &&
+complete -F _withlist withlist
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/wodim b/completions/wodim
index abc0ff25..3bc304d1 100644
--- a/completions/wodim
+++ b/completions/wodim
@@ -1,16 +1,11 @@
-# bash completion for cdrecord/wodim
+# bash completion for cdrecord/wodim -*- shell-script -*-
-# We set -o nospace and turn it off in several places for bash < 4
-# reasons; assuming bash >= 4 we could instead not turn it on
-# initially but only in the few cases where it's actually needed.
-
-have cdrecord || have wodim &&
_cdrecord()
{
- local cur prev i generic_options track_options track_mode
+ local cur prev words cword
+ _init_completion -n = || return
- COMPREPLY=()
- _get_comp_words_by_ref -n = cur prev
+ local i generic_options track_options track_mode
# foo=bar style option
if [[ "$cur" == *=* ]]; then
@@ -18,11 +13,9 @@ _cdrecord()
cur=${cur#*=}
case $prev in
textfile|cuefile|msifile)
- compopt +o nospace &>/dev/null
_filedir
;;
blank)
- compopt +o nospace &>/dev/null
COMPREPLY=( $( compgen -W 'help all fast track unreserve trtail
unclose session' -- "$cur" ) )
;;
@@ -32,17 +25,14 @@ _cdrecord()
cur=${cur#*=}
case $prev in
varirec)
- compopt +o nospace &>/dev/null
COMPREPLY=( $( compgen -W "-2 -1 0 1 2" \
-- "$cur" ) )
;;
gigarec)
- compopt +o nospace &>/dev/null
COMPREPLY=( $( compgen -W "0.6 0.7 0.8 1.0 1.2 1.3
1.4" -- "$cur" ) )
;;
tattoofile)
- compopt +o nospace &>/dev/null
_filedir
;;
esac
@@ -51,19 +41,15 @@ _cdrecord()
gigarec= audiomaster forcespeed noforcespeed speedread
nospeedread singlesession nosinglesession hidecdr
nohidecdr tattooinfo tattoofile=' -- "$cur" ) )
- [[ ${#COMPREPLY[@]} == 1 && ${COMPREPLY[0]} != *= ]] && \
- compopt +o nospace &>/dev/null
+ [[ $COMPREPLY == *= ]] && compopt -o nospace
fi
;;
driver)
- compopt +o nospace &>/dev/null
COMPREPLY=( $( compgen -W "$( $1 driver=help 2>&1 | \
awk 'NR > 1 { print $1 }' ) help" -- "$cur" ) )
;;
minbuf)
- compopt +o nospace &>/dev/null
- COMPREPLY=( $( compgen -W "$( seq 25 95 2>/dev/null )" \
- -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '{25..95}' -- "$cur" ) )
;;
esac
return 0
@@ -81,7 +67,7 @@ _cdrecord()
-copy -nocopy -scms isrc= index= padsize= pregap= tsize= )
# look if previous was either a file or a track option
track_mode=0
- if [ $COMP_CWORD -gt 1 ]; then
+ if [ $cword -gt 1 ]; then
if [ -f "$prev" ]; then
track_mode=1
else
@@ -97,22 +83,13 @@ _cdrecord()
# files are always eligible completion
_filedir
# track options are always available
- COMPREPLY=( "${COMPREPLY[@]}" \
- $( compgen -W '${track_options[@]}' -- "$cur" ) )
+ COMPREPLY+=( $( compgen -W '${track_options[@]}' -- "$cur" ) )
# general options are no more available after file or track option
if [ $track_mode -eq 0 ]; then
- COMPREPLY=( "${COMPREPLY[@]}" \
- $( compgen -W '${generic_options[@]}' -- "$cur" ) )
+ COMPREPLY+=( $( compgen -W '${generic_options[@]}' -- "$cur" ) )
fi
- [[ ${#COMPREPLY[@]} == 1 && ${COMPREPLY[0]} != *= ]] && \
- compopt +o nospace &>/dev/null
+ [[ $COMPREPLY == *= ]] && compopt -o nospace
} &&
-complete -F _cdrecord -o nospace cdrecord wodim
+complete -F _cdrecord cdrecord wodim
-# 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/wol b/completions/wol
index 89a1a8ba..02030aba 100644
--- a/completions/wol
+++ b/completions/wol
@@ -1,12 +1,9 @@
-# wol(1) completion
+# wol(1) completion -*- shell-script -*-
-have wol &&
_wol()
{
- local cur prev split=false
- COMPREPLY=()
- _get_comp_words_by_ref -n : cur prev
- _split_longopt && split=true
+ local cur prev words cword split
+ _init_completion -s -n : || return
case $prev in
-V|--version|--help|-p|--port|--passwd|-w|--wait)
@@ -29,8 +26,8 @@ _wol()
$split && return 0
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--help --version --verbose --wait --host
- --port --file --passwd' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
+ [[ $COMPREPLY == *= ]] && compopt -o nospace
return 0
fi
@@ -38,10 +35,4 @@ _wol()
} &&
complete -F _wol wol
-# 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/wtf b/completions/wtf
index a611978d..b176d09b 100644
--- a/completions/wtf
+++ b/completions/wtf
@@ -1,18 +1,17 @@
-# wtf completion
+# wtf completion -*- shell-script -*-
# Raphael Droz, 25/09/2009
-have wtf &&
_wtf()
{
- local cur prev db
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
[ "$prev" = -f ] && _filedir && return 0
[[ "$cur" == -* ]] && COMPREPLY=( -f ) && return 0
- set -- "${COMP_WORDS[@]}"
+ local db
+
+ set -- "${words[@]}"
while [ $# -gt 0 ]; do
if [ "$1" = -f ]; then
shift ; db=$1 ; break
@@ -21,16 +20,8 @@ _wtf()
done
[ -z $db ] && db=${ACRONYMDB:-/usr/share/misc/acronyms*}
- [ ${BASH_VERSINFO[0]} -ge 4 ] && cur="${cur^^}"
-
- COMPREPLY=( $( compgen -W "$( cut -f 1 -s $db ) -f" -- "${cur}" ) )
+ COMPREPLY=( $( compgen -W "$( cut -f 1 -s $db ) -f" -- "${cur^^}" ) )
} &&
complete -F _wtf wtf
-# 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/wvdial b/completions/wvdial
index 3b135f0a..da2dbfb3 100644
--- a/completions/wvdial
+++ b/completions/wvdial
@@ -1,12 +1,9 @@
-# bash completion for wvdial
+# bash completion for wvdial -*- shell-script -*-
-have wvdial &&
_wvdial()
{
- local cur prev config i IFS=$'\n'
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword split
+ _init_completion -s || return
case $prev in
--config)
@@ -15,19 +12,22 @@ _wvdial()
;;
esac
+ $split && return
+
+ local config i IFS=$'\n'
+
case $cur in
-*)
- COMPREPLY=( $( compgen -W '--config --chat \
- --remotename --help --version --no-syslog' \
- -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
+ [[ $COMPREPLY == *= ]] && compopt -o nospace
;;
*)
# start with global and personal config files
config="/etc/wvdial.conf"$'\n'"$HOME/.wvdialrc"
# replace with command line config file if present
- for (( i=1; i < COMP_CWORD; i++ )); do
- if [[ "${COMP_WORDS[i]}" == "--config" ]]; then
- config=${COMP_WORDS[i+1]}
+ for (( i=1; i < cword; i++ )); do
+ if [[ "${words[i]}" == "--config" ]]; then
+ config=${words[i+1]}
break
fi
done
@@ -43,10 +43,4 @@ _wvdial()
} &&
complete -F _wvdial wvdial
-# 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/freerdp b/completions/xfreerdp
index 82a46462..0dfb8537 100644
--- a/completions/freerdp
+++ b/completions/xfreerdp
@@ -1,12 +1,9 @@
-# bash completion for xfreerdp
+# xfreerdp completion -*- shell-script -*-
-have xfreerdp &&
_xfreerdp()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-k)
@@ -38,10 +35,4 @@ _xfreerdp()
} &&
complete -F _xfreerdp xfreerdp
-# 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/xgamma b/completions/xgamma
new file mode 100644
index 00000000..4c434cfe
--- /dev/null
+++ b/completions/xgamma
@@ -0,0 +1,57 @@
+# bash completion for xgamma(1) -*- shell-script -*-
+
+_xgamma()
+{
+ local cur prev words cword
+ _init_completion -n : || return
+
+ case "$prev" in
+ -screen)
+ local screens=$(xrandr --query 2>/dev/null | \
+ sed -n '/^Screen /s|^Screen \{1,\}\(.*\):.*$|\1|p' 2>/dev/null)
+ COMPREPLY=( $(compgen -W "$screens" -- "$cur"))
+ return
+ ;;
+ -gamma|-rgamma|-ggamma|-bgamma)
+ # expect f.f
+ if [[ $cur && "$cur" != *.* ]]; then
+ COMPREPLY=( . )
+ fi
+ COMPREPLY+=( $(compgen -W "{0..9}") )
+ compopt -o nospace
+ return
+ ;;
+ -display)
+ # expect hostname:displaynumber.screennumber
+ if [[ "$cur" == :* && "$cur" != :*.* ]]; then
+ # FIXME: where to get local display numbers?
+ local display=${cur#:}
+ COMPREPLY=( $(compgen -W "${display:-0}.") )
+ compopt -o nospace
+ elif [[ "$cur" == :*.* ]]; then
+ # local screen numbers
+ local t screens=$(xrandr --query 2>/dev/null | sed -n \
+ -e '/^Screen /s|^Screen \{1,\}\(.*\):.*$|\1|p' 2>/dev/null)
+ t="${cur#:}"
+ COMPREPLY=( $(compgen -P "${t%.*}." -W "$screens" -- "${cur##*.}"))
+ elif [[ "$cur" != *:* ]]; then
+ # complete hostnames
+ _known_hosts_real -c "$cur"
+ if [[ ! $cur ]]; then
+ COMPREPLY+=( : )
+ fi
+ compopt -o nospace
+ fi
+ # no dislpay completion for remote hosts
+ return
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" -help )' -- "$cur" ) )
+ [[ $COMPREPLY == *= ]] && compopt -o nospace
+ [[ $COMPREPLY ]] && return
+ fi
+} && complete -F _xgamma xgamma
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/xhost b/completions/xhost
index cec4adcf..397ca9ce 100644
--- a/completions/xhost
+++ b/completions/xhost
@@ -1,10 +1,9 @@
-# xhost(1) completion
+# xhost(1) completion -*- shell-script -*-
-have xhost &&
_xhost ()
{
- local cur
- _get_comp_words_by_ref cur
+ local cur prev words cword
+ _init_completion || return
case $cur in
+*) _known_hosts_real -p+ "${cur:1}" ;;
@@ -16,10 +15,4 @@ _xhost ()
} &&
complete -F _xhost xhost
-# 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/xm b/completions/xm
index f9f69a29..37bd3d02 100644
--- a/completions/xm
+++ b/completions/xm
@@ -1,6 +1,5 @@
-# bash completion for xm
+# bash completion for xm -*- shell-script -*-
-have xm && {
_xen_domain_names()
{
COMPREPLY=( $(compgen -W "$( xm list 2>/dev/null | \
@@ -15,12 +14,12 @@ _xen_domain_ids()
_xm()
{
- # TODO: _split_longopt
+ local cur prev words cword
+ _init_completion || return
- local cur prev command options
+ # TODO: _split_longopt
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local command options
commands='console vncviewer create new delete destroy domid domname \
dump-core list mem-max mem-set migrate pause reboot rename reset \
@@ -33,7 +32,7 @@ _xm()
labels addlabel rmlabel getlabel dry-run resources dumppolicy \
setpolicy resetpolicy getpolicy shell help'
- if [[ $COMP_CWORD -eq 1 ]] ; then
+ if [[ $cword -eq 1 ]] ; then
COMPREPLY=( $( compgen -W "$commands" -- "$cur" ) )
else
if [[ "$cur" == *=* ]]; then
@@ -41,7 +40,7 @@ _xm()
cur=${cur/*=/}
fi
- command=${COMP_WORDS[1]}
+ command=${words[1]}
if [[ "$cur" == -* ]]; then
# possible options for the command
case $command in
@@ -192,7 +191,7 @@ _xm()
;;
create)
_filedir
- COMPREPLY=( ${COMPREPLY[@]:-} \
+ COMPREPLY+=( \
$( compgen -W '$( command ls /etc/xen 2>/dev/null )' \
-- "$cur" ) )
;;
@@ -220,14 +219,7 @@ _xm()
fi
return 0
-}
+} &&
complete -F _xm xm
-}
-# 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/xmllint b/completions/xmllint
index 5b9c301c..c29c52d8 100644
--- a/completions/xmllint
+++ b/completions/xmllint
@@ -1,12 +1,9 @@
-# bash completion for xmllint(1)
+# bash completion for xmllint(1) -*- shell-script -*-
-have xmllint &&
_xmllint()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-o|--output)
@@ -36,20 +33,13 @@ _xmllint()
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '$( xmllint --help 2>&1 | \
- sed -ne "s/^[[:space:]]*\(--[^[:space:]:]*\).*/\1/p" ) \
- -o' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
+ COMPREPLY=( "${COMPREPLY[@]%:}" )
return 0
fi
- _filedir '@(*ml|htm|svg|xs[dl]|rng|wsdl|jnlp)?(.gz)'
+ _filedir '@(*ml|htm|svg|xs[dl]|rng|wsdl|jnlp|tld)?(.gz)'
} &&
complete -F _xmllint xmllint
-# 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/xmlwf b/completions/xmlwf
index ba02524b..6b7ad1ba 100644
--- a/completions/xmlwf
+++ b/completions/xmlwf
@@ -1,12 +1,9 @@
-# bash completion for xmlwf(1)
+# bash completion for xmlwf(1) -*- shell-script -*-
-have xmlwf &&
_xmlwf()
{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-d)
@@ -18,22 +15,18 @@ _xmlwf()
ISO-8859-1' -- "$cur" ) )
return 0
;;
+ -v)
+ return 0
+ ;;
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-c -d -e -m -n -p -r -s -t -v -w \
- -x' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) )
return 0
fi
- _filedir '@(*ml|htm|svg|xs[dl]|rng|wsdl|jnlp)'
+ _filedir '@(*ml|htm|svg|xs[dl]|rng|wsdl|jnlp|tld)'
} &&
complete -F _xmlwf xmlwf
-# 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/xmms b/completions/xmms
index 662e2faa..7d849568 100644
--- a/completions/xmms
+++ b/completions/xmms
@@ -1,30 +1,27 @@
-# bash completion for xmms
+# bash completion for xmms -*- shell-script -*-
-have xmms &&
_xmms()
{
- local cur
+ local cur prev words cword split
+ _init_completion -s || return
- COMPREPLY=()
- _get_comp_words_by_ref cur
+ case $prev in
+ -h|--help|-v|--version)
+ return
+ ;;
+ -S|--toggle-shuffle|-R|--toggle-repeat|-A|--toggle-advance)
+ COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) )
+ return
+ ;;
+ esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-h --help -r --rew -p --play \
- -u --pause -s --stop -t --play-pause -f --fwd -e \
- --enqueue -m --show-main-window -i --sm-client-id \
- -v --version' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
else
_filedir '@(mp[23]|ogg|wav|pls|m3u|xm|mod|s[3t]m|it|mtm|ult|flac)'
-
fi
} &&
complete -F _xmms xmms
-# 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/xmodmap b/completions/xmodmap
index cde9e7e1..243563d3 100644
--- a/completions/xmodmap
+++ b/completions/xmodmap
@@ -1,11 +1,9 @@
-# xmodmap(1) completion
+# xmodmap(1) completion -*- shell-script -*-
-have xmodmap &&
_xmodmap()
{
- COMPREPLY=()
- local cur prev
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-display|-e)
@@ -23,10 +21,4 @@ _xmodmap()
} &&
complete -F _xmodmap xmodmap
-# 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/xrandr b/completions/xrandr
index 70de80f7..36164298 100644
--- a/completions/xrandr
+++ b/completions/xrandr
@@ -1,22 +1,22 @@
-# bash completion for xrandr
+# bash completion for xrandr -*- shell-script -*-
-have xrandr &&
_xrandr()
{
- local cur prev output modes
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
+
+ local output modes
case $prev in
- --output)
+ --output|--left-of|--right-of|--above|--below|--same-as)
local outputs=$(xrandr|awk '/connected/ {print $1}')
COMPREPLY=( $(compgen -W "$outputs" -- "$cur"))
return 0
;;
--mode)
- for(( i = 1; i < COMP_CWORD; i++ )); do
- if [[ "${COMP_WORDS[i]}" == "--output" ]]; then
- output=${COMP_WORDS[i+1]}
+ for(( i = 1; i < cword; i++ )); do
+ if [[ "${words[i]}" == "--output" ]]; then
+ output=${words[i+1]}
break
fi
done
@@ -25,28 +25,37 @@ _xrandr()
COMPREPLY=( $( compgen -W "$modes" -- "$cur"))
return 0
;;
+ -o|--orientation)
+ COMPREPLY=( $( compgen -W 'normal inverted left right 0 1 2 3' -- \
+ "$cur" ) )
+ return 0
+ ;;
+ --reflect)
+ COMPREPLY=( $( compgen -W 'normal x y xy' -- \
+ "$cur" ) )
+ return 0
+ ;;
+ --rotate)
+ COMPREPLY=( $( compgen -W 'normal inverted left right' -- \
+ "$cur" ) )
+ return 0
+ ;;
esac
case $cur in
*)
COMPREPLY=( $(compgen -W '-display -help --orientation --query \
--size --rate --version -x -y --screen --verbose --dryrun \
- --prop --fb --fbmm --dpi --output --auto --mode --preferred \
- --pos --reflect --rotate --left-of --right-of --above --below \
- --same-as --set --off --crtc --newmode --rmmode --addmode \
- --delmode' -- "$cur") )
+ --q1 --q12 --nograb --prop --properties --fb --fbmm --dpi \
+ --output --auto --mode --preferred --pos --rate --refresh \
+ --reflect --rotate --left-of --right-of --above --below \
+ --same-as --set --scale --transform --off --crtc --panning \
+ --gamma --brightness --primary --noprimary --newmode --rmmode \
+ --addmode --delmode' -- "$cur") )
return 0
;;
esac
-
- return 0
} &&
complete -F _xrandr xrandr
-# 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/xrdb b/completions/xrdb
index 7307f013..7a6eefe6 100644
--- a/completions/xrdb
+++ b/completions/xrdb
@@ -1,11 +1,9 @@
-# xrdb(1) completion
+# xrdb(1) completion -*- shell-script -*-
-have xrdb &&
_xrdb()
{
- COMPREPLY=()
- local cur prev
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
-backup|-display|-help)
@@ -18,9 +16,7 @@ _xrdb()
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-help -display -all -global -screen -screens
- -n -quiet -cpp -nocpp -symbols -query -load -override -merge
- -remove -retain -edit -backup' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
return 0
fi
@@ -28,10 +24,4 @@ _xrdb()
} &&
complete -F _xrdb xrdb
-# 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/xsltproc b/completions/xsltproc
index 2782f805..7c38591f 100644
--- a/completions/xsltproc
+++ b/completions/xsltproc
@@ -1,11 +1,9 @@
-# xsltproc(1) completion
+# xsltproc(1) completion -*- shell-script -*-
-have xsltproc &&
_xsltproc()
{
- local cur prev
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local cur prev words cword
+ _init_completion || return
case $prev in
--output|-o)
@@ -36,21 +34,16 @@ _xsltproc()
;;
esac
- [[ $COMP_CWORD -gt 2 && `_get_cword '' 2` == --?(string)param ]] && \
+ [[ $cword -gt 2 && `_get_cword '' 2` == --?(string)param ]] && \
return 0
if [[ "$cur" == -* ]]; then
- _longopt xsltproc
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
+ COMPREPLY=( "${COMPREPLY[@]%:}" )
else
_filedir '@(xsl|xslt|xml)'
fi
} &&
complete -F _xsltproc xsltproc
-# 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/xz b/completions/xz
index 89a8ac98..e2e1b709 100644
--- a/completions/xz
+++ b/completions/xz
@@ -1,24 +1,9 @@
-# xz(1) completion
+# xz(1) completion -*- shell-script -*-
-have xz &&
_xz()
{
- COMPREPLY=()
- local cur prev
- _get_comp_words_by_ref cur prev
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--compress --decompress --test --list \
- --keep --force --stdout --suffix --files --files0 --format --check \
- -0 -1 -2 -3 -4 -5 -6 -7 -8 -9 --fast --best --extreme --memory \
- --lzma1 --lzma2 --x86 --powerpc --ia64 --arm --armthumb --sparc \
- --delta --quiet --verbose --no-warn --help --long-help --version' \
- -- "$cur" ) )
- return 0
- fi
-
- local split=false
- _split_longopt && split=true
+ local cur prev words cword split
+ _init_completion -s || return
local xspec="*.@(xz|lzma|txz|tlz)"
@@ -31,18 +16,19 @@ _xz()
return 0
;;
-C|--check)
- COMPREPLY=( $( compgen -W 'crc32 crc64 sha256' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W 'crc32 crc64 sha256 none' -- "$cur" ) )
return 0
;;
-F|--format)
COMPREPLY=( $( compgen -W 'auto xz lzma raw' -- "$cur" ) )
return 0
;;
- -M|--memory|-S|--suffix|--delta|--lzma1|--lzma2)
+ -M|--memlimit|--memlimit-compress|--memlimit-decompress|--memory|\
+ -S|--suffix|--delta|--lzma1|--lzma2)
# argument required but no completions available
return 0
;;
- -h|--help|-H|--long-help|-V|--version)
+ -h|--help|-H|--long-help|-V|--version|--info-memory)
# all other arguments are noop with these
return 0
;;
@@ -52,51 +38,18 @@ _xz()
_expand || return 0
- local IFS=$'\n'
- _compopt_o_filenames
- COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \
- $( compgen -d -- "$cur" ) )
-} &&
-complete -F _xz xz
-
-# xzdec(1) completion
-#
-have xzdec &&
-_xzdec()
-{
- COMPREPLY=()
- local cur prev
- _get_comp_words_by_ref cur prev
-
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--memory --help --version' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" --long-help ) {-1..-9}' \
+ -- "$cur" ) )
+ [[ $COMPREPLY == *= ]] && compopt -o nospace
return 0
fi
- local split=false
- _split_longopt && split=true
-
- 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
-
- _filedir xz # no lzma support here as of xz 4.999.9beta
+ local IFS=$'\n'
+ compopt -o filenames
+ COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \
+ $( compgen -d -- "$cur" ) )
} &&
-complete -F _xzdec xzdec
+complete -F _xz xz pxz
-# 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/xzdec b/completions/xzdec
new file mode 100644
index 00000000..fc32492e
--- /dev/null
+++ b/completions/xzdec
@@ -0,0 +1,31 @@
+# xzdec(1) completion -*- shell-script -*-
+
+_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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/yp-tools b/completions/yp-tools
deleted file mode 100644
index 7252a129..00000000
--- a/completions/yp-tools
+++ /dev/null
@@ -1,36 +0,0 @@
-# bash completion for yp-tools
-
-have ypcat &&
-_ypmatch()
-{
- local cur map cmd
-
- COMPREPLY=()
- _get_comp_words_by_ref cur
- cmd=${1##*/}
-
- [[ $cmd == ypcat && $COMP_CWORD -gt 1 ]] && return 0
- [[ $cmd == ypmatch && $COMP_CWORD -gt 2 ]] && return 0
-
- if [[ $cmd == ypmatch && $COMP_CWORD -eq 1 && \
- ${#COMP_WORDS[@]} -eq 3 ]]; then
- map=${COMP_WORDS[2]}
- COMPREPLY=( $( compgen -W '$( ypcat $map | \
- cut -d':' -f 1 )' -- "$cur") )
- else
- [[ $cmd == ypmatch && $COMP_CWORD -ne 2 ]] && return 0
- COMPREPLY=( $( compgen -W \
- '$( printf "%s\n" $(ypcat -x | cut -d"\"" -f 2) )' -- "$cur"))
- fi
-
- return 0
-} &&
-complete -F _ypmatch ypmatch ypcat
-
-# 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/ypmatch b/completions/ypmatch
new file mode 100644
index 00000000..584b0d04
--- /dev/null
+++ b/completions/ypmatch
@@ -0,0 +1,28 @@
+# bash completion for yp-tools -*- shell-script -*-
+
+_ypmatch()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ local map cmd=${1##*/}
+
+ [[ $cmd == ypcat && $cword -gt 1 ]] && return 0
+ [[ $cmd == ypmatch && $cword -gt 2 ]] && return 0
+
+ if [[ $cmd == ypmatch && $cword -eq 1 && ${#words[@]} -eq 3 ]]; then
+ map=${words[2]}
+ COMPREPLY=( $( compgen -W '$( ypcat $map 2>/dev/null | \
+ cut -d':' -f 1 )' -- "$cur") )
+ else
+ [[ $cmd == ypmatch && $cword -ne 2 ]] && return 0
+ COMPREPLY=( $( compgen -W \
+ '$( printf "%s\n" $(ypcat -x 2>/dev/null | \
+ cut -d"\"" -f 2) )' -- "$cur") )
+ fi
+
+ return 0
+} &&
+complete -F _ypmatch ypmatch ypcat
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/yum-arch b/completions/yum-arch
index bb864af4..8c217373 100644
--- a/completions/yum-arch
+++ b/completions/yum-arch
@@ -1,11 +1,9 @@
-# yum-arch(8) completion
+# yum-arch(8) completion -*- shell-script -*-
-have yum-arch &&
_yum_arch()
{
- local cur
- COMPREPLY=()
- _get_comp_words_by_ref cur
+ local cur prev words cword
+ _init_completion || return
if [[ "$cur" == -* ]] ; then
COMPREPLY=( $( compgen -W '-d -v -vv -n -c -z -s -l -q' -- "$cur" ) )
@@ -15,10 +13,4 @@ _yum_arch()
} &&
complete -F _yum_arch yum-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/configure b/configure
index 410e341e..87947fff 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.67 for bash-completion 1.3.
+# Generated by GNU Autoconf 2.68 for bash-completion 1.90.
#
#
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -89,6 +89,7 @@ fi
IFS=" "" $as_nl"
# Find who we are. Look in the path if we contain no directory separator.
+as_myself=
case $0 in #((
*[\\/]* ) as_myself=$0 ;;
*) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -213,11 +214,18 @@ IFS=$as_save_IFS
# We cannot yet assume a decent shell, so we have to provide a
# neutralization value for shells without unset; and this also
# works around shells that cannot unset nonexistent variables.
+ # Preserve -v and -x to the replacement shell.
BASH_ENV=/dev/null
ENV=/dev/null
(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
export CONFIG_SHELL
- exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
+ case $- in # ((((
+ *v*x* | *x*v* ) as_opts=-vx ;;
+ *v* ) as_opts=-v ;;
+ *x* ) as_opts=-x ;;
+ * ) as_opts= ;;
+ esac
+ exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"}
fi
if test x$as_have_required = xno; then :
@@ -548,15 +556,15 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='bash-completion'
PACKAGE_TARNAME='bash-completion'
-PACKAGE_VERSION='1.3'
-PACKAGE_STRING='bash-completion 1.3'
+PACKAGE_VERSION='1.90'
+PACKAGE_STRING='bash-completion 1.90'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''
ac_subst_vars='LTLIBOBJS
LIBOBJS
-helpersdir
-bashcompdir
+compatdir
+LN_S
am__untar
am__tar
AMTAR
@@ -1029,7 +1037,7 @@ Try \`$0 --help' for more information"
$as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
$as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
- : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
+ : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}"
;;
esac
@@ -1167,7 +1175,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures bash-completion 1.3 to adapt to many kinds of systems.
+\`configure' configures bash-completion 1.90 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1233,7 +1241,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of bash-completion 1.3:";;
+ short | recursive ) echo "Configuration of bash-completion 1.90:";;
esac
cat <<\_ACEOF
@@ -1300,8 +1308,8 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-bash-completion configure 1.3
-generated by GNU Autoconf 2.67
+bash-completion configure 1.90
+generated by GNU Autoconf 2.68
Copyright (C) 2010 Free Software Foundation, Inc.
This configure script is free software; the Free Software Foundation
@@ -1317,8 +1325,8 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by bash-completion $as_me 1.3, which was
-generated by GNU Autoconf 2.67. Invocation command line was
+It was created by bash-completion $as_me 1.90, which was
+generated by GNU Autoconf 2.68. Invocation command line was
$ $0 $@
@@ -1576,7 +1584,7 @@ $as_echo "$as_me: loading site script $ac_site_file" >&6;}
|| { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "failed to load site script $ac_site_file
-See \`config.log' for more details" "$LINENO" 5 ; }
+See \`config.log' for more details" "$LINENO" 5; }
fi
done
@@ -1713,7 +1721,7 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5
$as_echo_n "checking for a BSD-compatible install... " >&6; }
if test -z "$INSTALL"; then
-if test "${ac_cv_path_install+set}" = set; then :
+if ${ac_cv_path_install+:} false; then :
$as_echo_n "(cached) " >&6
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -1800,11 +1808,11 @@ am_lf='
'
case `pwd` in
*[\\\"\#\$\&\'\`$am_lf]*)
- as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5 ;;
+ as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;;
esac
case $srcdir in
*[\\\"\#\$\&\'\`$am_lf\ \ ]*)
- as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5 ;;
+ as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;;
esac
# Do `set' in a subshell so we don't clobber the current shell's
@@ -1890,7 +1898,7 @@ if test "$cross_compiling" != no; then
set dummy ${ac_tool_prefix}strip; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_STRIP+set}" = set; then :
+if ${ac_cv_prog_STRIP+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$STRIP"; then
@@ -1930,7 +1938,7 @@ if test -z "$ac_cv_prog_STRIP"; then
set dummy strip; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then :
+if ${ac_cv_prog_ac_ct_STRIP+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_STRIP"; then
@@ -1983,7 +1991,7 @@ INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5
$as_echo_n "checking for a thread-safe mkdir -p... " >&6; }
if test -z "$MKDIR_P"; then
- if test "${ac_cv_path_mkdir+set}" = set; then :
+ if ${ac_cv_path_mkdir+:} false; then :
$as_echo_n "(cached) " >&6
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -2034,7 +2042,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_AWK+set}" = set; then :
+if ${ac_cv_prog_AWK+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$AWK"; then
@@ -2074,7 +2082,7 @@ done
$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
set x ${MAKE-make}
ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
-if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\"" = set; then :
+if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then :
$as_echo_n "(cached) " >&6
else
cat >conftest.make <<\_ACEOF
@@ -2132,7 +2140,7 @@ fi
# Define the identity of the package.
PACKAGE='bash-completion'
- VERSION='1.3'
+ VERSION='1.90'
cat >>confdefs.h <<_ACEOF
@@ -2172,11 +2180,20 @@ am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'
-bashcompdir=$sysconfdir/bash_completion.d
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5
+$as_echo_n "checking whether ln -s works... " >&6; }
+LN_S=$as_ln_s
+if test "$LN_S" = "ln -s"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5
+$as_echo "no, using $LN_S" >&6; }
+fi
-helpersdir=$sysconfdir/bash_completion.d/helpers
+compatdir=$sysconfdir/bash_completion.d
-ac_config_files="$ac_config_files Makefile completions/Makefile completions/helpers/Makefile test/Makefile"
+ac_config_files="$ac_config_files Makefile completions/Makefile helpers/Makefile test/Makefile bash-completion.pc"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
@@ -2242,10 +2259,21 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
:end' >>confcache
if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
if test -w "$cache_file"; then
- test "x$cache_file" != "x/dev/null" &&
+ if test "x$cache_file" != "x/dev/null"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5
$as_echo "$as_me: updating cache $cache_file" >&6;}
- cat confcache >$cache_file
+ if test ! -f "$cache_file" || test -h "$cache_file"; then
+ cat confcache >"$cache_file"
+ else
+ case $cache_file in #(
+ */* | ?:*)
+ mv -f confcache "$cache_file"$$ &&
+ mv -f "$cache_file"$$ "$cache_file" ;; #(
+ *)
+ mv -f confcache "$cache_file" ;;
+ esac
+ fi
+ fi
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5
$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
@@ -2314,7 +2342,7 @@ LTLIBOBJS=$ac_ltlibobjs
-: ${CONFIG_STATUS=./config.status}
+: "${CONFIG_STATUS=./config.status}"
ac_write_fail=0
ac_clean_files_save=$ac_clean_files
ac_clean_files="$ac_clean_files $CONFIG_STATUS"
@@ -2415,6 +2443,7 @@ fi
IFS=" "" $as_nl"
# Find who we are. Look in the path if we contain no directory separator.
+as_myself=
case $0 in #((
*[\\/]* ) as_myself=$0 ;;
*) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -2721,8 +2750,8 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by bash-completion $as_me 1.3, which was
-generated by GNU Autoconf 2.67. Invocation command line was
+This file was extended by bash-completion $as_me 1.90, which was
+generated by GNU Autoconf 2.68. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
CONFIG_HEADERS = $CONFIG_HEADERS
@@ -2774,8 +2803,8 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-bash-completion config.status 1.3
-configured by $0, generated by GNU Autoconf 2.67,
+bash-completion config.status 1.90
+configured by $0, generated by GNU Autoconf 2.68,
with options \\"\$ac_cs_config\\"
Copyright (C) 2010 Free Software Foundation, Inc.
@@ -2889,10 +2918,11 @@ do
case $ac_config_target in
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
"completions/Makefile") CONFIG_FILES="$CONFIG_FILES completions/Makefile" ;;
- "completions/helpers/Makefile") CONFIG_FILES="$CONFIG_FILES completions/helpers/Makefile" ;;
+ "helpers/Makefile") CONFIG_FILES="$CONFIG_FILES helpers/Makefile" ;;
"test/Makefile") CONFIG_FILES="$CONFIG_FILES test/Makefile" ;;
+ "bash-completion.pc") CONFIG_FILES="$CONFIG_FILES bash-completion.pc" ;;
- *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5 ;;
+ *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
esac
done
@@ -2913,9 +2943,10 @@ fi
# after its creation but before its name has been assigned to `$tmp'.
$debug ||
{
- tmp=
+ tmp= ac_tmp=
trap 'exit_status=$?
- { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
+ : "${ac_tmp:=$tmp}"
+ { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status
' 0
trap 'as_fn_exit 1' 1 2 13 15
}
@@ -2923,12 +2954,13 @@ $debug ||
{
tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
- test -n "$tmp" && test -d "$tmp"
+ test -d "$tmp"
} ||
{
tmp=./conf$$-$RANDOM
(umask 077 && mkdir "$tmp")
} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5
+ac_tmp=$tmp
# Set up the scripts for CONFIG_FILES section.
# No need to generate them if there are no CONFIG_FILES.
@@ -2950,7 +2982,7 @@ else
ac_cs_awk_cr=$ac_cr
fi
-echo 'BEGIN {' >"$tmp/subs1.awk" &&
+echo 'BEGIN {' >"$ac_tmp/subs1.awk" &&
_ACEOF
@@ -2978,7 +3010,7 @@ done
rm -f conf$$subs.sh
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
-cat >>"\$tmp/subs1.awk" <<\\_ACAWK &&
+cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK &&
_ACEOF
sed -n '
h
@@ -3026,7 +3058,7 @@ t delim
rm -f conf$$subs.awk
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
_ACAWK
-cat >>"\$tmp/subs1.awk" <<_ACAWK &&
+cat >>"\$ac_tmp/subs1.awk" <<_ACAWK &&
for (key in S) S_is_set[key] = 1
FS = ""
@@ -3058,7 +3090,7 @@ if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
else
cat
-fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \
+fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \
|| as_fn_error $? "could not setup config files machinery" "$LINENO" 5
_ACEOF
@@ -3098,7 +3130,7 @@ do
esac
case $ac_mode$ac_tag in
:[FHL]*:*);;
- :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5 ;;
+ :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;;
:[FH]-) ac_tag=-:-;;
:[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
esac
@@ -3117,7 +3149,7 @@ do
for ac_f
do
case $ac_f in
- -) ac_f="$tmp/stdin";;
+ -) ac_f="$ac_tmp/stdin";;
*) # Look for the file first in the build tree, then in the source tree
# (if the path is not absolute). The absolute path cannot be DOS-style,
# because $ac_f cannot contain `:'.
@@ -3126,7 +3158,7 @@ do
[\\/$]*) false;;
*) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
esac ||
- as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5 ;;
+ as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;;
esac
case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
as_fn_append ac_file_inputs " '$ac_f'"
@@ -3152,8 +3184,8 @@ $as_echo "$as_me: creating $ac_file" >&6;}
esac
case $ac_tag in
- *:-:* | *:-) cat >"$tmp/stdin" \
- || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
+ *:-:* | *:-) cat >"$ac_tmp/stdin" \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
esac
;;
esac
@@ -3289,21 +3321,22 @@ s&@INSTALL@&$ac_INSTALL&;t t
s&@MKDIR_P@&$ac_MKDIR_P&;t t
$ac_datarootdir_hack
"
-eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \
- || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \
+ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5
test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
- { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
- { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
+ { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } &&
+ { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \
+ "$ac_tmp/out"`; test -z "$ac_out"; } &&
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
which seems to be undefined. Please make sure it is defined" >&5
$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
which seems to be undefined. Please make sure it is defined" >&2;}
- rm -f "$tmp/stdin"
+ rm -f "$ac_tmp/stdin"
case $ac_file in
- -) cat "$tmp/out" && rm -f "$tmp/out";;
- *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";;
+ -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";;
+ *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";;
esac \
|| as_fn_error $? "could not create $ac_file" "$LINENO" 5
;;
diff --git a/configure.ac b/configure.ac
index 0732138f..7d77e582 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,7 +1,7 @@
AC_PREREQ([2.59])
-AC_INIT([bash-completion], [1.3])
+AC_INIT([bash-completion], [1.90])
AM_INIT_AUTOMAKE([foreign dist-bzip2 no-dist-gzip -Wall -Werror])
-AC_SUBST(bashcompdir, $sysconfdir/bash_completion.d)
-AC_SUBST(helpersdir, $sysconfdir/bash_completion.d/helpers)
-AC_CONFIG_FILES([Makefile completions/Makefile completions/helpers/Makefile test/Makefile])
+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/helpers/Makefile.am b/helpers/Makefile.am
new file mode 100644
index 00000000..0c8ed300
--- /dev/null
+++ b/helpers/Makefile.am
@@ -0,0 +1,4 @@
+helpersdir = $(pkgdatadir)/helpers
+helpers_DATA = perl
+
+EXTRA_DIST = $(helpers_DATA)
diff --git a/completions/helpers/Makefile.in b/helpers/Makefile.in
index e367369b..b18c5259 100644
--- a/completions/helpers/Makefile.in
+++ b/helpers/Makefile.in
@@ -32,7 +32,7 @@ POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
-subdir = completions/helpers
+subdir = helpers
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
@@ -41,6 +41,8 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
mkinstalldirs = $(install_sh) -d
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
+SOURCES =
+DIST_SOURCES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
@@ -63,9 +65,7 @@ am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__installdirs = "$(DESTDIR)$(helpersdir)"
-SCRIPTS = $(helpers_SCRIPTS)
-SOURCES =
-DIST_SOURCES =
+DATA = $(helpers_DATA)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
@@ -85,6 +85,7 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
+LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
@@ -107,16 +108,15 @@ abs_top_srcdir = @abs_top_srcdir@
am__leading_dot = @am__leading_dot@
am__tar = @am__tar@
am__untar = @am__untar@
-bashcompdir = @bashcompdir@
bindir = @bindir@
build_alias = @build_alias@
builddir = @builddir@
+compatdir = @compatdir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
-helpersdir = @helpersdir@
host_alias = @host_alias@
htmldir = @htmldir@
includedir = @includedir@
@@ -141,8 +141,9 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-helpers_SCRIPTS = perl
-EXTRA_DIST = $(helpers_SCRIPTS)
+helpersdir = $(pkgdatadir)/helpers
+helpers_DATA = perl
+EXTRA_DIST = $(helpers_DATA)
all: all-am
.SUFFIXES:
@@ -155,9 +156,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign completions/helpers/Makefile'; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign helpers/Makefile'; \
$(am__cd) $(top_srcdir) && \
- $(AUTOMAKE) --foreign completions/helpers/Makefile
+ $(AUTOMAKE) --foreign helpers/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
@@ -176,38 +177,24 @@ $(top_srcdir)/configure: $(am__configure_deps)
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
-install-helpersSCRIPTS: $(helpers_SCRIPTS)
+install-helpersDATA: $(helpers_DATA)
@$(NORMAL_INSTALL)
test -z "$(helpersdir)" || $(MKDIR_P) "$(DESTDIR)$(helpersdir)"
- @list='$(helpers_SCRIPTS)'; test -n "$(helpersdir)" || list=; \
+ @list='$(helpers_DATA)'; test -n "$(helpersdir)" || list=; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
- if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \
- done | \
- sed -e 'p;s,.*/,,;n' \
- -e 'h;s|.*|.|' \
- -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \
- $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \
- { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
- if ($$2 == $$4) { files[d] = files[d] " " $$1; \
- if (++n[d] == $(am__install_max)) { \
- print "f", d, files[d]; n[d] = 0; files[d] = "" } } \
- else { print "f", d "/" $$4, $$1 } } \
- END { for (d in files) print "f", d, files[d] }' | \
- while read type dir files; do \
- if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
- test -z "$$files" || { \
- echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(helpersdir)$$dir'"; \
- $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(helpersdir)$$dir" || exit $$?; \
- } \
- ; done
-
-uninstall-helpersSCRIPTS:
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(helpersdir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(helpersdir)" || exit $$?; \
+ done
+
+uninstall-helpersDATA:
@$(NORMAL_UNINSTALL)
- @list='$(helpers_SCRIPTS)'; test -n "$(helpersdir)" || exit 0; \
- files=`for p in $$list; do echo "$$p"; done | \
- sed -e 's,.*/,,;$(transform)'`; \
- test -n "$$list" || exit 0; \
+ @list='$(helpers_DATA)'; test -n "$(helpersdir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ test -n "$$files" || exit 0; \
echo " ( cd '$(DESTDIR)$(helpersdir)' && rm -f" $$files ")"; \
cd "$(DESTDIR)$(helpersdir)" && rm -f $$files
tags: TAGS
@@ -249,7 +236,7 @@ distdir: $(DISTFILES)
done
check-am: all-am
check: check-am
-all-am: Makefile $(SCRIPTS)
+all-am: Makefile $(DATA)
installdirs:
for dir in "$(DESTDIR)$(helpersdir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
@@ -299,7 +286,7 @@ info: info-am
info-am:
-install-data-am: install-helpersSCRIPTS
+install-data-am: install-helpersDATA
install-dvi: install-dvi-am
@@ -343,7 +330,7 @@ ps: ps-am
ps-am:
-uninstall-am: uninstall-helpersSCRIPTS
+uninstall-am: uninstall-helpersDATA
.MAKE: install-am install-strip
@@ -351,13 +338,12 @@ uninstall-am: uninstall-helpersSCRIPTS
distclean-generic distdir dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am \
- install-helpersSCRIPTS install-html install-html-am \
- install-info install-info-am install-man install-pdf \
- install-pdf-am install-ps install-ps-am install-strip \
- installcheck installcheck-am installdirs maintainer-clean \
+ install-helpersDATA install-html install-html-am install-info \
+ install-info-am install-man install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
- pdf-am ps ps-am uninstall uninstall-am \
- uninstall-helpersSCRIPTS
+ pdf-am ps ps-am uninstall uninstall-am uninstall-helpersDATA
# Tell versions [3.59,3.63) of GNU make to not export all variables.
diff --git a/completions/helpers/perl b/helpers/perl
index b3522ac0..f847dc74 100755..100644
--- a/completions/helpers/perl
+++ b/helpers/perl
@@ -1,4 +1,5 @@
-#!/usr/bin/env perl
+# -*- perl -*-
+
use strict;
use Config;
use File::Spec::Functions;
@@ -8,11 +9,11 @@ my %seen;
sub print_modules_real {
my ($base, $dir, $word) = @_;
- # return immediatly if potential completion doesn't match current word
- # a double comparaison is used to avoid dealing with string lengths
+ # return immediately if potential completion doesn't match current word
+ # a double comparison is used to avoid dealing with string lengths
# (the shorter being the pattern to be used as the regexp)
# word 'Fi', base 'File' -> match 'File' against 'Fi'
- # word 'File::Sp', base 'File' -> match 'File::Sp' againt 'File'
+ # word 'File::Sp', base 'File' -> match 'File::Sp' against 'File'
return if
$base &&
$word &&
diff --git a/test/Makefile.in b/test/Makefile.in
index aa81fbeb..d71b99ae 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -64,6 +64,7 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
+LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
@@ -86,16 +87,15 @@ abs_top_srcdir = @abs_top_srcdir@
am__leading_dot = @am__leading_dot@
am__tar = @am__tar@
am__untar = @am__untar@
-bashcompdir = @bashcompdir@
bindir = @bindir@
build_alias = @build_alias@
builddir = @builddir@
+compatdir = @compatdir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
-helpersdir = @helpersdir@
host_alias = @host_alias@
htmldir = @htmldir@
includedir = @includedir@
diff --git a/test/completion/a2x.exp b/test/completion/a2x.exp
new file mode 100644
index 00000000..5d4098f1
--- /dev/null
+++ b/test/completion/a2x.exp
@@ -0,0 +1 @@
+assert_source_completions a2x
diff --git a/test/completion/arping.exp b/test/completion/arping.exp
new file mode 100644
index 00000000..5a64b1a3
--- /dev/null
+++ b/test/completion/arping.exp
@@ -0,0 +1 @@
+assert_source_completions arping
diff --git a/test/completion/asciidoc.exp b/test/completion/asciidoc.exp
new file mode 100644
index 00000000..05b3f1f2
--- /dev/null
+++ b/test/completion/asciidoc.exp
@@ -0,0 +1 @@
+assert_source_completions asciidoc
diff --git a/test/completion/avctrl.exp b/test/completion/avctrl.exp
new file mode 100644
index 00000000..ea323c51
--- /dev/null
+++ b/test/completion/avctrl.exp
@@ -0,0 +1 @@
+assert_source_completions avctrl
diff --git a/test/completion/base64.exp b/test/completion/base64.exp
new file mode 100644
index 00000000..2f5f6122
--- /dev/null
+++ b/test/completion/base64.exp
@@ -0,0 +1 @@
+assert_source_completions base64
diff --git a/test/completion/cal.exp b/test/completion/cal.exp
new file mode 100644
index 00000000..5fba48be
--- /dev/null
+++ b/test/completion/cal.exp
@@ -0,0 +1 @@
+assert_source_completions cal
diff --git a/test/completion/cfagent.exp b/test/completion/cfagent.exp
new file mode 100644
index 00000000..21d71e20
--- /dev/null
+++ b/test/completion/cfagent.exp
@@ -0,0 +1 @@
+assert_source_completions cfagent
diff --git a/test/completion/chage.exp b/test/completion/chage.exp
new file mode 100644
index 00000000..32dc4409
--- /dev/null
+++ b/test/completion/chage.exp
@@ -0,0 +1 @@
+assert_source_completions chage
diff --git a/test/completion/chpasswd.exp b/test/completion/chpasswd.exp
new file mode 100644
index 00000000..854266c1
--- /dev/null
+++ b/test/completion/chpasswd.exp
@@ -0,0 +1 @@
+assert_source_completions chpasswd
diff --git a/test/completion/chrpath.exp b/test/completion/chrpath.exp
new file mode 100644
index 00000000..eee81ec7
--- /dev/null
+++ b/test/completion/chrpath.exp
@@ -0,0 +1 @@
+assert_source_completions chrpath
diff --git a/test/completion/ciptool.exp b/test/completion/ciptool.exp
new file mode 100644
index 00000000..206f21c6
--- /dev/null
+++ b/test/completion/ciptool.exp
@@ -0,0 +1 @@
+assert_source_completions ciptool
diff --git a/test/completion/compare.exp b/test/completion/compare.exp
new file mode 100644
index 00000000..d2ea0cc7
--- /dev/null
+++ b/test/completion/compare.exp
@@ -0,0 +1 @@
+assert_source_completions compare
diff --git a/test/completion/conjure.exp b/test/completion/conjure.exp
new file mode 100644
index 00000000..687c6107
--- /dev/null
+++ b/test/completion/conjure.exp
@@ -0,0 +1 @@
+assert_source_completions conjure
diff --git a/test/completion/cppcheck.exp b/test/completion/cppcheck.exp
new file mode 100644
index 00000000..1cfb9c56
--- /dev/null
+++ b/test/completion/cppcheck.exp
@@ -0,0 +1 @@
+assert_source_completions cppcheck
diff --git a/test/completion/curl.exp b/test/completion/curl.exp
new file mode 100644
index 00000000..e8bf2135
--- /dev/null
+++ b/test/completion/curl.exp
@@ -0,0 +1 @@
+assert_source_completions curl
diff --git a/test/completion/dfutool.exp b/test/completion/dfutool.exp
new file mode 100644
index 00000000..0859f07e
--- /dev/null
+++ b/test/completion/dfutool.exp
@@ -0,0 +1 @@
+assert_source_completions dfutool
diff --git a/test/completion/dmesg.exp b/test/completion/dmesg.exp
new file mode 100644
index 00000000..1eca1e5b
--- /dev/null
+++ b/test/completion/dmesg.exp
@@ -0,0 +1 @@
+assert_source_completions dmesg
diff --git a/test/completion/dot.exp b/test/completion/dot.exp
new file mode 100644
index 00000000..d12422c1
--- /dev/null
+++ b/test/completion/dot.exp
@@ -0,0 +1 @@
+assert_source_completions dot
diff --git a/test/completion/explodepkg.exp b/test/completion/explodepkg.exp
new file mode 100644
index 00000000..7d6ce793
--- /dev/null
+++ b/test/completion/explodepkg.exp
@@ -0,0 +1 @@
+assert_source_completions explodepkg
diff --git a/test/completion/faillog.exp b/test/completion/faillog.exp
new file mode 100644
index 00000000..46d19d9a
--- /dev/null
+++ b/test/completion/faillog.exp
@@ -0,0 +1 @@
+assert_source_completions faillog
diff --git a/test/completion/fbgs.exp b/test/completion/fbgs.exp
new file mode 100644
index 00000000..38efcbe9
--- /dev/null
+++ b/test/completion/fbgs.exp
@@ -0,0 +1 @@
+assert_source_completions fbgs
diff --git a/test/completion/fbi.exp b/test/completion/fbi.exp
new file mode 100644
index 00000000..36f8b8ea
--- /dev/null
+++ b/test/completion/fbi.exp
@@ -0,0 +1 @@
+assert_source_completions fbi
diff --git a/test/completion/feh.exp b/test/completion/feh.exp
new file mode 100644
index 00000000..4613bfaf
--- /dev/null
+++ b/test/completion/feh.exp
@@ -0,0 +1 @@
+assert_source_completions feh
diff --git a/test/completion/file.exp b/test/completion/file.exp
new file mode 100644
index 00000000..92662f0a
--- /dev/null
+++ b/test/completion/file.exp
@@ -0,0 +1 @@
+assert_source_completions file
diff --git a/test/completion/fusermount.exp b/test/completion/fusermount.exp
new file mode 100644
index 00000000..7b9e0391
--- /dev/null
+++ b/test/completion/fusermount.exp
@@ -0,0 +1 @@
+assert_source_completions fusermount
diff --git a/test/completion/gendiff.exp b/test/completion/gendiff.exp
new file mode 100644
index 00000000..f3a3fe19
--- /dev/null
+++ b/test/completion/gendiff.exp
@@ -0,0 +1 @@
+assert_source_completions gendiff
diff --git a/test/completion/gnome-mplayer.exp b/test/completion/gnome-mplayer.exp
new file mode 100644
index 00000000..79c0cb1e
--- /dev/null
+++ b/test/completion/gnome-mplayer.exp
@@ -0,0 +1 @@
+assert_source_completions gnome-mplayer
diff --git a/test/completion/gpasswd.exp b/test/completion/gpasswd.exp
new file mode 100644
index 00000000..cf07a4de
--- /dev/null
+++ b/test/completion/gpasswd.exp
@@ -0,0 +1 @@
+assert_source_completions gpasswd
diff --git a/test/completion/grpck.exp b/test/completion/grpck.exp
new file mode 100644
index 00000000..db2caeea
--- /dev/null
+++ b/test/completion/grpck.exp
@@ -0,0 +1 @@
+assert_source_completions grpck
diff --git a/test/completion/hciattach.exp b/test/completion/hciattach.exp
new file mode 100644
index 00000000..f85a3558
--- /dev/null
+++ b/test/completion/hciattach.exp
@@ -0,0 +1 @@
+assert_source_completions hciattach
diff --git a/test/completion/hciconfig.exp b/test/completion/hciconfig.exp
new file mode 100644
index 00000000..5f109956
--- /dev/null
+++ b/test/completion/hciconfig.exp
@@ -0,0 +1 @@
+assert_source_completions hciconfig
diff --git a/test/completion/hddtemp.exp b/test/completion/hddtemp.exp
new file mode 100644
index 00000000..f8c63d62
--- /dev/null
+++ b/test/completion/hddtemp.exp
@@ -0,0 +1 @@
+assert_source_completions hddtemp
diff --git a/test/completion/host.exp b/test/completion/host.exp
new file mode 100644
index 00000000..9866e1e1
--- /dev/null
+++ b/test/completion/host.exp
@@ -0,0 +1 @@
+assert_source_completions host
diff --git a/test/completion/htpasswd.exp b/test/completion/htpasswd.exp
new file mode 100644
index 00000000..08294f35
--- /dev/null
+++ b/test/completion/htpasswd.exp
@@ -0,0 +1 @@
+assert_source_completions htpasswd
diff --git a/test/completion/idn.exp b/test/completion/idn.exp
new file mode 100644
index 00000000..5fccae3d
--- /dev/null
+++ b/test/completion/idn.exp
@@ -0,0 +1 @@
+assert_source_completions idn
diff --git a/test/completion/import.exp b/test/completion/import.exp
new file mode 100644
index 00000000..682a5069
--- /dev/null
+++ b/test/completion/import.exp
@@ -0,0 +1 @@
+assert_source_completions import
diff --git a/test/completion/installpkg.exp b/test/completion/installpkg.exp
new file mode 100644
index 00000000..47f85f41
--- /dev/null
+++ b/test/completion/installpkg.exp
@@ -0,0 +1 @@
+assert_source_completions installpkg
diff --git a/test/completion/ionice.exp b/test/completion/ionice.exp
new file mode 100644
index 00000000..d569f418
--- /dev/null
+++ b/test/completion/ionice.exp
@@ -0,0 +1 @@
+assert_source_completions ionice
diff --git a/test/completion/jps.exp b/test/completion/jps.exp
new file mode 100644
index 00000000..8a04f645
--- /dev/null
+++ b/test/completion/jps.exp
@@ -0,0 +1 @@
+assert_source_completions jps
diff --git a/test/completion/kcov.exp b/test/completion/kcov.exp
new file mode 100644
index 00000000..4f0b9a7c
--- /dev/null
+++ b/test/completion/kcov.exp
@@ -0,0 +1 @@
+assert_source_completions kcov
diff --git a/test/completion/l2ping.exp b/test/completion/l2ping.exp
new file mode 100644
index 00000000..5bd300d3
--- /dev/null
+++ b/test/completion/l2ping.exp
@@ -0,0 +1 @@
+assert_source_completions l2ping
diff --git a/test/completion/lastlog.exp b/test/completion/lastlog.exp
new file mode 100644
index 00000000..cefb67b9
--- /dev/null
+++ b/test/completion/lastlog.exp
@@ -0,0 +1 @@
+assert_source_completions lastlog
diff --git a/test/completion/ldapadd.exp b/test/completion/ldapadd.exp
new file mode 100644
index 00000000..2c74de74
--- /dev/null
+++ b/test/completion/ldapadd.exp
@@ -0,0 +1 @@
+assert_source_completions ldapadd
diff --git a/test/completion/ldapcompare.exp b/test/completion/ldapcompare.exp
new file mode 100644
index 00000000..bb1db4c3
--- /dev/null
+++ b/test/completion/ldapcompare.exp
@@ -0,0 +1 @@
+assert_source_completions ldapcompare
diff --git a/test/completion/ldapdelete.exp b/test/completion/ldapdelete.exp
new file mode 100644
index 00000000..76027d9f
--- /dev/null
+++ b/test/completion/ldapdelete.exp
@@ -0,0 +1 @@
+assert_source_completions ldapdelete
diff --git a/test/completion/ldapmodrdn.exp b/test/completion/ldapmodrdn.exp
new file mode 100644
index 00000000..9614af6c
--- /dev/null
+++ b/test/completion/ldapmodrdn.exp
@@ -0,0 +1 @@
+assert_source_completions ldapmodrdn
diff --git a/test/completion/ldappasswd.exp b/test/completion/ldappasswd.exp
new file mode 100644
index 00000000..0a5ac72c
--- /dev/null
+++ b/test/completion/ldappasswd.exp
@@ -0,0 +1 @@
+assert_source_completions ldappasswd
diff --git a/test/completion/ldapsearch.exp b/test/completion/ldapsearch.exp
new file mode 100644
index 00000000..c552967d
--- /dev/null
+++ b/test/completion/ldapsearch.exp
@@ -0,0 +1 @@
+assert_source_completions ldapsearch
diff --git a/test/completion/ldapvi.exp b/test/completion/ldapvi.exp
new file mode 100644
index 00000000..2e3ddef2
--- /dev/null
+++ b/test/completion/ldapvi.exp
@@ -0,0 +1 @@
+assert_source_completions ldapvi
diff --git a/test/completion/ldapwhoami.exp b/test/completion/ldapwhoami.exp
new file mode 100644
index 00000000..9d07d8a8
--- /dev/null
+++ b/test/completion/ldapwhoami.exp
@@ -0,0 +1 @@
+assert_source_completions ldapwhoami
diff --git a/test/completion/lpq.exp b/test/completion/lpq.exp
new file mode 100644
index 00000000..062d0c09
--- /dev/null
+++ b/test/completion/lpq.exp
@@ -0,0 +1 @@
+assert_source_completions lpq
diff --git a/test/completion/lpr.exp b/test/completion/lpr.exp
new file mode 100644
index 00000000..6f65fee3
--- /dev/null
+++ b/test/completion/lpr.exp
@@ -0,0 +1 @@
+assert_source_completions lpr
diff --git a/test/completion/makepkg.exp b/test/completion/makepkg.exp
new file mode 100644
index 00000000..a4f5e38c
--- /dev/null
+++ b/test/completion/makepkg.exp
@@ -0,0 +1 @@
+assert_source_completions makepkg
diff --git a/test/completion/mdadm.exp b/test/completion/mdadm.exp
new file mode 100644
index 00000000..ad3c36f4
--- /dev/null
+++ b/test/completion/mdadm.exp
@@ -0,0 +1 @@
+assert_source_completions mdadm
diff --git a/test/completion/mdtool.exp b/test/completion/mdtool.exp
new file mode 100644
index 00000000..f7604e13
--- /dev/null
+++ b/test/completion/mdtool.exp
@@ -0,0 +1 @@
+assert_source_completions mdtool
diff --git a/test/completion/medusa.exp b/test/completion/medusa.exp
new file mode 100644
index 00000000..237cdd54
--- /dev/null
+++ b/test/completion/medusa.exp
@@ -0,0 +1 @@
+assert_source_completions medusa
diff --git a/test/completion/mii-diag.exp b/test/completion/mii-diag.exp
new file mode 100644
index 00000000..b4ddef79
--- /dev/null
+++ b/test/completion/mii-diag.exp
@@ -0,0 +1 @@
+assert_source_completions mii-diag
diff --git a/test/completion/mii-tool.exp b/test/completion/mii-tool.exp
new file mode 100644
index 00000000..cd12f228
--- /dev/null
+++ b/test/completion/mii-tool.exp
@@ -0,0 +1 @@
+assert_source_completions mii-tool
diff --git a/test/completion/monodevelop.exp b/test/completion/monodevelop.exp
new file mode 100644
index 00000000..1c4fd45b
--- /dev/null
+++ b/test/completion/monodevelop.exp
@@ -0,0 +1 @@
+assert_source_completions monodevelop
diff --git a/test/completion/msynctool.exp b/test/completion/msynctool.exp
new file mode 100644
index 00000000..76be37ef
--- /dev/null
+++ b/test/completion/msynctool.exp
@@ -0,0 +1 @@
+assert_source_completions msynctool
diff --git a/test/completion/mysql.exp b/test/completion/mysql.exp
new file mode 100644
index 00000000..ad9fac69
--- /dev/null
+++ b/test/completion/mysql.exp
@@ -0,0 +1 @@
+assert_source_completions mysql
diff --git a/test/completion/newusers.exp b/test/completion/newusers.exp
new file mode 100644
index 00000000..c9ea45c6
--- /dev/null
+++ b/test/completion/newusers.exp
@@ -0,0 +1 @@
+assert_source_completions newusers
diff --git a/test/completion/nslookup.exp b/test/completion/nslookup.exp
new file mode 100644
index 00000000..5a26b495
--- /dev/null
+++ b/test/completion/nslookup.exp
@@ -0,0 +1 @@
+assert_source_completions nslookup
diff --git a/test/completion/passwd.exp b/test/completion/passwd.exp
new file mode 100644
index 00000000..2f0bec9b
--- /dev/null
+++ b/test/completion/passwd.exp
@@ -0,0 +1 @@
+assert_source_completions passwd
diff --git a/test/completion/phing.exp b/test/completion/phing.exp
new file mode 100644
index 00000000..957999bc
--- /dev/null
+++ b/test/completion/phing.exp
@@ -0,0 +1 @@
+assert_source_completions phing
diff --git a/test/completion/pinfo.exp b/test/completion/pinfo.exp
new file mode 100644
index 00000000..3e937568
--- /dev/null
+++ b/test/completion/pinfo.exp
@@ -0,0 +1 @@
+assert_source_completions pinfo
diff --git a/test/completion/pkgtool.exp b/test/completion/pkgtool.exp
new file mode 100644
index 00000000..4a946c52
--- /dev/null
+++ b/test/completion/pkgtool.exp
@@ -0,0 +1 @@
+assert_source_completions pkgtool
diff --git a/test/completion/postcat.exp b/test/completion/postcat.exp
new file mode 100644
index 00000000..eb4ae6da
--- /dev/null
+++ b/test/completion/postcat.exp
@@ -0,0 +1 @@
+assert_source_completions postcat
diff --git a/test/completion/postconf.exp b/test/completion/postconf.exp
new file mode 100644
index 00000000..7ed485c2
--- /dev/null
+++ b/test/completion/postconf.exp
@@ -0,0 +1 @@
+assert_source_completions postconf
diff --git a/test/completion/postfix.exp b/test/completion/postfix.exp
new file mode 100644
index 00000000..4a39d044
--- /dev/null
+++ b/test/completion/postfix.exp
@@ -0,0 +1 @@
+assert_source_completions postfix
diff --git a/test/completion/postmap.exp b/test/completion/postmap.exp
new file mode 100644
index 00000000..870af8d1
--- /dev/null
+++ b/test/completion/postmap.exp
@@ -0,0 +1 @@
+assert_source_completions postmap
diff --git a/test/completion/postsuper.exp b/test/completion/postsuper.exp
new file mode 100644
index 00000000..fac52381
--- /dev/null
+++ b/test/completion/postsuper.exp
@@ -0,0 +1 @@
+assert_source_completions postsuper
diff --git a/test/completion/prelink.exp b/test/completion/prelink.exp
new file mode 100644
index 00000000..d1fbb8ee
--- /dev/null
+++ b/test/completion/prelink.exp
@@ -0,0 +1 @@
+assert_source_completions prelink
diff --git a/test/completion/protoc.exp b/test/completion/protoc.exp
new file mode 100644
index 00000000..333ebf26
--- /dev/null
+++ b/test/completion/protoc.exp
@@ -0,0 +1 @@
+assert_source_completions protoc
diff --git a/test/completion/puppet.exp b/test/completion/puppet.exp
new file mode 100644
index 00000000..28463445
--- /dev/null
+++ b/test/completion/puppet.exp
@@ -0,0 +1 @@
+assert_source_completions puppet
diff --git a/test/completion/pwck.exp b/test/completion/pwck.exp
new file mode 100644
index 00000000..55d5f95c
--- /dev/null
+++ b/test/completion/pwck.exp
@@ -0,0 +1 @@
+assert_source_completions pwck
diff --git a/test/completion/pwdx.exp b/test/completion/pwdx.exp
new file mode 100644
index 00000000..dd97822a
--- /dev/null
+++ b/test/completion/pwdx.exp
@@ -0,0 +1 @@
+assert_source_completions pwdx
diff --git a/test/completion/pwgen.exp b/test/completion/pwgen.exp
new file mode 100644
index 00000000..bba75ecd
--- /dev/null
+++ b/test/completion/pwgen.exp
@@ -0,0 +1 @@
+assert_source_completions pwgen
diff --git a/test/completion/qemu.exp b/test/completion/qemu.exp
new file mode 100644
index 00000000..deedd3a2
--- /dev/null
+++ b/test/completion/qemu.exp
@@ -0,0 +1 @@
+assert_source_completions qemu
diff --git a/test/completion/quota.exp b/test/completion/quota.exp
new file mode 100644
index 00000000..9c08b4f3
--- /dev/null
+++ b/test/completion/quota.exp
@@ -0,0 +1 @@
+assert_source_completions quota
diff --git a/test/completion/quotacheck.exp b/test/completion/quotacheck.exp
new file mode 100644
index 00000000..5b53da8f
--- /dev/null
+++ b/test/completion/quotacheck.exp
@@ -0,0 +1 @@
+assert_source_completions quotacheck
diff --git a/test/completion/quotaon.exp b/test/completion/quotaon.exp
new file mode 100644
index 00000000..e66056fc
--- /dev/null
+++ b/test/completion/quotaon.exp
@@ -0,0 +1 @@
+assert_source_completions quotaon
diff --git a/test/completion/rdesktop.exp b/test/completion/rdesktop.exp
new file mode 100644
index 00000000..29eddf6e
--- /dev/null
+++ b/test/completion/rdesktop.exp
@@ -0,0 +1 @@
+assert_source_completions rdesktop
diff --git a/test/completion/reptyr.exp b/test/completion/reptyr.exp
new file mode 100644
index 00000000..62ab427d
--- /dev/null
+++ b/test/completion/reptyr.exp
@@ -0,0 +1 @@
+assert_source_completions reptyr
diff --git a/test/completion/rfcomm.exp b/test/completion/rfcomm.exp
new file mode 100644
index 00000000..6de31dc2
--- /dev/null
+++ b/test/completion/rfcomm.exp
@@ -0,0 +1 @@
+assert_source_completions rfcomm
diff --git a/test/completion/route.exp b/test/completion/route.exp
new file mode 100644
index 00000000..beff8251
--- /dev/null
+++ b/test/completion/route.exp
@@ -0,0 +1 @@
+assert_source_completions route
diff --git a/test/completion/rpm2tgz.exp b/test/completion/rpm2tgz.exp
new file mode 100644
index 00000000..6acd954a
--- /dev/null
+++ b/test/completion/rpm2tgz.exp
@@ -0,0 +1 @@
+assert_source_completions rpm2tgz
diff --git a/test/completion/rpmbuild.exp b/test/completion/rpmbuild.exp
new file mode 100644
index 00000000..f829b588
--- /dev/null
+++ b/test/completion/rpmbuild.exp
@@ -0,0 +1 @@
+assert_source_completions rpmbuild
diff --git a/test/completion/sbopkg.exp b/test/completion/sbopkg.exp
new file mode 100644
index 00000000..0fec4db1
--- /dev/null
+++ b/test/completion/sbopkg.exp
@@ -0,0 +1 @@
+assert_source_completions sbopkg
diff --git a/test/completion/sdptool.exp b/test/completion/sdptool.exp
new file mode 100644
index 00000000..6d20cf99
--- /dev/null
+++ b/test/completion/sdptool.exp
@@ -0,0 +1 @@
+assert_source_completions sdptool
diff --git a/test/completion/setquota.exp b/test/completion/setquota.exp
new file mode 100644
index 00000000..c97dccc0
--- /dev/null
+++ b/test/completion/setquota.exp
@@ -0,0 +1 @@
+assert_source_completions setquota
diff --git a/test/completion/slackpkg.exp b/test/completion/slackpkg.exp
new file mode 100644
index 00000000..ecef64d0
--- /dev/null
+++ b/test/completion/slackpkg.exp
@@ -0,0 +1 @@
+assert_source_completions slackpkg
diff --git a/test/completion/slapt-get.exp b/test/completion/slapt-get.exp
new file mode 100644
index 00000000..6c37d523
--- /dev/null
+++ b/test/completion/slapt-get.exp
@@ -0,0 +1 @@
+assert_source_completions slapt-get
diff --git a/test/completion/slapt-src.exp b/test/completion/slapt-src.exp
new file mode 100644
index 00000000..90abfd5f
--- /dev/null
+++ b/test/completion/slapt-src.exp
@@ -0,0 +1 @@
+assert_source_completions slapt-src
diff --git a/test/completion/smbcacls.exp b/test/completion/smbcacls.exp
new file mode 100644
index 00000000..333a14e7
--- /dev/null
+++ b/test/completion/smbcacls.exp
@@ -0,0 +1 @@
+assert_source_completions smbcacls
diff --git a/test/completion/smbclient.exp b/test/completion/smbclient.exp
new file mode 100644
index 00000000..09b9ad33
--- /dev/null
+++ b/test/completion/smbclient.exp
@@ -0,0 +1 @@
+assert_source_completions smbclient
diff --git a/test/completion/smbcquotas.exp b/test/completion/smbcquotas.exp
new file mode 100644
index 00000000..f7c4e94a
--- /dev/null
+++ b/test/completion/smbcquotas.exp
@@ -0,0 +1 @@
+assert_source_completions smbcquotas
diff --git a/test/completion/smbget.exp b/test/completion/smbget.exp
new file mode 100644
index 00000000..8f6c849e
--- /dev/null
+++ b/test/completion/smbget.exp
@@ -0,0 +1 @@
+assert_source_completions smbget
diff --git a/test/completion/smbpasswd.exp b/test/completion/smbpasswd.exp
new file mode 100644
index 00000000..de2297a6
--- /dev/null
+++ b/test/completion/smbpasswd.exp
@@ -0,0 +1 @@
+assert_source_completions smbpasswd
diff --git a/test/completion/smbtar.exp b/test/completion/smbtar.exp
new file mode 100644
index 00000000..72dd9f1f
--- /dev/null
+++ b/test/completion/smbtar.exp
@@ -0,0 +1 @@
+assert_source_completions smbtar
diff --git a/test/completion/smbtree.exp b/test/completion/smbtree.exp
new file mode 100644
index 00000000..713c5bab
--- /dev/null
+++ b/test/completion/smbtree.exp
@@ -0,0 +1 @@
+assert_source_completions smbtree
diff --git a/test/completion/ssh-copy-id.exp b/test/completion/ssh-copy-id.exp
new file mode 100644
index 00000000..c4923e78
--- /dev/null
+++ b/test/completion/ssh-copy-id.exp
@@ -0,0 +1 @@
+assert_source_completions ssh-copy-id
diff --git a/test/completion/stream.exp b/test/completion/stream.exp
new file mode 100644
index 00000000..fba2104f
--- /dev/null
+++ b/test/completion/stream.exp
@@ -0,0 +1 @@
+assert_source_completions stream
diff --git a/test/completion/tcpdump.exp b/test/completion/tcpdump.exp
new file mode 100644
index 00000000..13eb744e
--- /dev/null
+++ b/test/completion/tcpdump.exp
@@ -0,0 +1 @@
+assert_source_completions tcpdump
diff --git a/test/completion/tracepath.exp b/test/completion/tracepath.exp
new file mode 100644
index 00000000..621f0ba8
--- /dev/null
+++ b/test/completion/tracepath.exp
@@ -0,0 +1 @@
+assert_source_completions tracepath
diff --git a/test/completion/upgradepkg.exp b/test/completion/upgradepkg.exp
new file mode 100644
index 00000000..4b181a86
--- /dev/null
+++ b/test/completion/upgradepkg.exp
@@ -0,0 +1 @@
+assert_source_completions upgradepkg
diff --git a/test/completion/vipw.exp b/test/completion/vipw.exp
new file mode 100644
index 00000000..38438679
--- /dev/null
+++ b/test/completion/vipw.exp
@@ -0,0 +1 @@
+assert_source_completions vipw
diff --git a/test/completion/watch.exp b/test/completion/watch.exp
new file mode 100644
index 00000000..9bb0644f
--- /dev/null
+++ b/test/completion/watch.exp
@@ -0,0 +1 @@
+assert_source_completions watch
diff --git a/test/completion/xgamma.exp b/test/completion/xgamma.exp
new file mode 100644
index 00000000..706e74f9
--- /dev/null
+++ b/test/completion/xgamma.exp
@@ -0,0 +1 @@
+assert_source_completions xgamma
diff --git a/test/completion/xzdec.exp b/test/completion/xzdec.exp
new file mode 100644
index 00000000..65330d6b
--- /dev/null
+++ b/test/completion/xzdec.exp
@@ -0,0 +1 @@
+assert_source_completions xzdec
diff --git a/test/fixtures/ant/build.xml b/test/fixtures/ant/build.xml
new file mode 100644
index 00000000..146c7f3b
--- /dev/null
+++ b/test/fixtures/ant/build.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project basedir="." default="build" name="bash-completion">
+ <target name="clean">
+ <!-- ... -->
+ </target>
+<target
+ name="realclean" depends="clean">
+ <!-- ... -->
+ </target>
+
+ <target foo="bar" name="init"></target>
+<target
+foo="bar"
+name='bashcomp' >
+<!-- ... -->
+</target>
+</project>
diff --git a/test/fixtures/cvs/foo/CVS/Entries b/test/fixtures/cvs/foo/CVS/Entries
new file mode 100644
index 00000000..6462f980
--- /dev/null
+++ b/test/fixtures/cvs/foo/CVS/Entries
@@ -0,0 +1,2 @@
+/bar/1.1/Tue Jan 29 05:52:29 2008//
+D
diff --git a/test/fixtures/cvs/foo/bar b/test/fixtures/cvs/foo/bar
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/cvs/foo/bar
diff --git a/test/fixtures/cvs/foo/quux b/test/fixtures/cvs/foo/quux
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/cvs/foo/quux
diff --git a/test/fixtures/htpasswd/htpasswd b/test/fixtures/htpasswd/htpasswd
new file mode 100644
index 00000000..5279c7c3
--- /dev/null
+++ b/test/fixtures/htpasswd/htpasswd
@@ -0,0 +1,2 @@
+foo:bar
+quux:baz
diff --git a/test/fixtures/mutt/bar/muttrc_b b/test/fixtures/mutt/bar/muttrc_b
new file mode 100644
index 00000000..f4a0493e
--- /dev/null
+++ b/test/fixtures/mutt/bar/muttrc_b
@@ -0,0 +1 @@
+source ~/foo/muttrc_f
diff --git a/test/fixtures/mutt/foo/muttrc_f b/test/fixtures/mutt/foo/muttrc_f
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/mutt/foo/muttrc_f
diff --git a/test/fixtures/mutt/muttrc b/test/fixtures/mutt/muttrc
index 58ad7f55..d26c8bc6 100644
--- a/test/fixtures/mutt/muttrc
+++ b/test/fixtures/mutt/muttrc
@@ -1,3 +1,4 @@
set folder=.
alias a1 a1@example.com
alias a2 a2@example.com
+source ~/bar/muttrc_b
diff --git a/test/fixtures/slackware/etc/slapt-get/slapt-getrc b/test/fixtures/slackware/etc/slapt-get/slapt-getrc
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/slackware/etc/slapt-get/slapt-getrc
diff --git a/test/fixtures/slackware/etc/slapt-get/slapt-srcrc b/test/fixtures/slackware/etc/slapt-get/slapt-srcrc
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/slackware/etc/slapt-get/slapt-srcrc
diff --git a/test/fixtures/slackware/home/abc-4-i686-1.txz b/test/fixtures/slackware/home/abc-4-i686-1.txz
new file mode 100644
index 00000000..8b137891
--- /dev/null
+++ b/test/fixtures/slackware/home/abc-4-i686-1.txz
@@ -0,0 +1 @@
+
diff --git a/test/fixtures/slackware/home/opq-1.0-2.i386.rpm b/test/fixtures/slackware/home/opq-1.0-2.i386.rpm
new file mode 100644
index 00000000..8b137891
--- /dev/null
+++ b/test/fixtures/slackware/home/opq-1.0-2.i386.rpm
@@ -0,0 +1 @@
+
diff --git a/test/fixtures/slackware/home/tcl.d/tcl.tgz b/test/fixtures/slackware/home/tcl.d/tcl.tgz
new file mode 100644
index 00000000..8b137891
--- /dev/null
+++ b/test/fixtures/slackware/home/tcl.d/tcl.tgz
@@ -0,0 +1 @@
+
diff --git a/test/fixtures/slackware/usr/src/slapt-src/slackbuilds_data b/test/fixtures/slackware/usr/src/slapt-src/slackbuilds_data
new file mode 100644
index 00000000..0f4ee44b
--- /dev/null
+++ b/test/fixtures/slackware/usr/src/slapt-src/slackbuilds_data
@@ -0,0 +1,20 @@
+SLACKBUILD NAME: abc
+SLACKBUILD SOURCEURL: http://www.slackware.org.uk/slackbuilds.org/13.37/
+SLACKBUILD LOCATION: libraries/abc/
+SLACKBUILD FILES: abc.SlackBuild slack-desc
+SLACKBUILD VERSION: 4
+SLACKBUILD DOWNLOAD: http://www.ufl.edu/abc-4.tar.gz
+SLACKBUILD MD5SUM: b3e9679ba20635ac4847f01c01d6e992
+SLACKBUILD REQUIRES:
+SLACKBUILD SHORT DESCRIPTION: abc is a small utility
+
+SLACKBUILD NAME: qwe
+SLACKBUILD SOURCEURL: http://www.slackware.org.uk/slackbuilds.org/13.37/
+SLACKBUILD LOCATION: network/qwe/
+SLACKBUILD FILES: qwe.SlackBuild
+SLACKBUILD VERSION: 2.1
+SLACKBUILD DOWNLOAD: http://php.net/qwe-2.1.tgz
+SLACKBUILD MD5SUM: 1f7a58f850e795b0958a3f99ae8c2cc4
+SLACKBUILD REQUIRES:
+SLACKBUILD SHORT DESCRIPTION: qwe is a program
+
diff --git a/test/fixtures/slackware/var/log/packages/radeontool-1.6.1-i486-1 b/test/fixtures/slackware/var/log/packages/radeontool-1.6.1-i486-1
new file mode 100644
index 00000000..7f53326b
--- /dev/null
+++ b/test/fixtures/slackware/var/log/packages/radeontool-1.6.1-i486-1
@@ -0,0 +1,24 @@
+PACKAGE NAME: radeontool-1.6.1-i486-1
+COMPRESSED PACKAGE SIZE: 48K
+UNCOMPRESSED PACKAGE SIZE: 150K
+PACKAGE LOCATION: ./radeontool-1.6.1-i486-1.txz
+PACKAGE DESCRIPTION:
+radeontool: radeontool (small utility for ati radeon-based laptops)
+radeontool:
+radeontool: Radeontool is a small utility to control ATI Radeon-based
+radeontool: laptops' backlight and external output functions
+radeontool:
+radeontool: Homepage: http://fdd.com/software/radeon/
+radeontool:
+radeontool:
+radeontool:
+radeontool:
+radeontool:
+FILE LIST:
+./
+usr/
+usr/bin/
+usr/bin/radeontool
+usr/bin/avivotool
+install/
+install/slack-desc
diff --git a/test/fixtures/slackware/var/log/packages/rzip-2.1-i486-1 b/test/fixtures/slackware/var/log/packages/rzip-2.1-i486-1
new file mode 100644
index 00000000..0fa71f40
--- /dev/null
+++ b/test/fixtures/slackware/var/log/packages/rzip-2.1-i486-1
@@ -0,0 +1,29 @@
+PACKAGE NAME: rzip-2.1-i486-1
+COMPRESSED PACKAGE SIZE: 20K
+UNCOMPRESSED PACKAGE SIZE: 50K
+PACKAGE LOCATION: ./rzip-2.1-i486-1.txz
+PACKAGE DESCRIPTION:
+rzip: rzip (a large-file compression program)
+rzip:
+rzip: rzip is a file compression program designed to do particularly well
+rzip: on very large files containing long distance redundancy.
+rzip:
+rzip: rzip was written by Andrew Tridgell.
+rzip:
+rzip:
+rzip:
+rzip:
+rzip:
+FILE LIST:
+./
+bin/
+bin/rzip
+usr/
+usr/doc/
+usr/doc/rzip-2.1/
+usr/doc/rzip-2.1/COPYING
+usr/man/
+usr/man/man1/
+usr/man/man1/rzip.1.gz
+install/
+install/slack-desc
diff --git a/test/fixtures/slackware/var/slapt-get/package_data b/test/fixtures/slackware/var/slapt-get/package_data
new file mode 100644
index 00000000..410fc3d1
--- /dev/null
+++ b/test/fixtures/slackware/var/slapt-get/package_data
@@ -0,0 +1,47 @@
+PACKAGE NAME: abc-4-i686-1.txz
+PACKAGE MIRROR: http://slackware.com/
+PACKAGE PRIORITY: 2
+PACKAGE LOCATION: ./slackware/ap
+PACKAGE SIZE (compressed): 48 K
+PACKAGE SIZE (uncompressed): 150 K
+PACKAGE REQUIRED:
+PACKAGE CONFLICTS:
+PACKAGE SUGGESTS:
+PACKAGE MD5SUM: 53e873df10b9e343a5c58721f10b9131
+PACKAGE DESCRIPTION:
+abc: abc (small utility)
+abc:
+abc: abc is a small utility
+abc:
+
+PACKAGE NAME: ran-1.2-noarch-1.txz
+PACKAGE MIRROR: http://slackware.com/
+PACKAGE PRIORITY: 2
+PACKAGE LOCATION: ./slackware/x
+PACKAGE SIZE (compressed): 36 K
+PACKAGE SIZE (uncompressed): 160 K
+PACKAGE REQUIRED:
+PACKAGE CONFLICTS:
+PACKAGE SUGGESTS:
+PACKAGE MD5SUM: cefa3f087e10f8371d68bea94a829ef8
+PACKAGE DESCRIPTION:
+ran: ran
+ran:
+ran: ran is part of X11.
+ran:
+
+PACKAGE NAME: qwe-2.1-i486-1.txz
+PACKAGE MIRROR: http://slackware.com/
+PACKAGE PRIORITY: 1
+PACKAGE LOCATION: ./slackware/ap
+PACKAGE SIZE (compressed): 20 K
+PACKAGE SIZE (uncompressed): 50 K
+PACKAGE REQUIRED:
+PACKAGE CONFLICTS:
+PACKAGE SUGGESTS:
+PACKAGE MD5SUM: 1a8fe22cb924cde3dc95c89689b20ee3
+PACKAGE DESCRIPTION:
+qwe: qwe
+qwe:
+qwe: qwe is a program
+qwe:
diff --git a/test/lib/completions/a2x.exp b/test/lib/completions/a2x.exp
new file mode 100644
index 00000000..e1ca8844
--- /dev/null
+++ b/test/lib/completions/a2x.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "a2x "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/ant.exp b/test/lib/completions/ant.exp
index de57f24a..acff23ec 100644
--- a/test/lib/completions/ant.exp
+++ b/test/lib/completions/ant.exp
@@ -4,7 +4,9 @@ proc setup {} {
proc teardown {} {
- assert_env_unmodified
+ assert_env_unmodified {
+ /OLDPWD=/d
+ }
}
@@ -12,8 +14,10 @@ setup
assert_complete_any "ant -"
+sync_after_int
+assert_complete_dir "bashcomp clean init realclean" "ant " $::srcdir/fixtures/ant
sync_after_int
diff --git a/test/lib/completions/arping.exp b/test/lib/completions/arping.exp
new file mode 100644
index 00000000..531bb07f
--- /dev/null
+++ b/test/lib/completions/arping.exp
@@ -0,0 +1,21 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "arping "
+sync_after_int
+
+assert_complete_any "arping -"
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/asciidoc.exp b/test/lib/completions/asciidoc.exp
new file mode 100644
index 00000000..86e7609a
--- /dev/null
+++ b/test/lib/completions/asciidoc.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "asciidoc "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/avctrl.exp b/test/lib/completions/avctrl.exp
new file mode 100644
index 00000000..6ca9de70
--- /dev/null
+++ b/test/lib/completions/avctrl.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "avctrl "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/base64.exp b/test/lib/completions/base64.exp
new file mode 100644
index 00000000..1f3f35cf
--- /dev/null
+++ b/test/lib/completions/base64.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "base64 "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/c++.exp b/test/lib/completions/c++.exp
index 4dffb042..c899de27 100644
--- a/test/lib/completions/c++.exp
+++ b/test/lib/completions/c++.exp
@@ -11,7 +11,6 @@ proc teardown {} {
setup
-set test "Tab should complete"
assert_complete_any "c++ "
diff --git a/test/lib/completions/cal.exp b/test/lib/completions/cal.exp
new file mode 100644
index 00000000..bf7185e2
--- /dev/null
+++ b/test/lib/completions/cal.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "cal "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/cfagent.exp b/test/lib/completions/cfagent.exp
new file mode 100644
index 00000000..aa5c88cb
--- /dev/null
+++ b/test/lib/completions/cfagent.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "cfagent -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/chage.exp b/test/lib/completions/chage.exp
new file mode 100644
index 00000000..e5399054
--- /dev/null
+++ b/test/lib/completions/chage.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "chage "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/chown.exp b/test/lib/completions/chown.exp
index bc1a8c7f..6bfd9d05 100644
--- a/test/lib/completions/chown.exp
+++ b/test/lib/completions/chown.exp
@@ -69,5 +69,11 @@ if {!$failed_find_unique_completion} {
sync_after_int
}
+assert_complete {bar "bar bar.d/" foo foo.d/} "chown foo: $::srcdir/fixtures/shared/default/"
+sync_after_int
+
+assert_complete {bar "bar bar.d/" foo foo.d/} "chown :foo $::srcdir/fixtures/shared/default/"
+sync_after_int
+
teardown
diff --git a/test/lib/completions/chpasswd.exp b/test/lib/completions/chpasswd.exp
new file mode 100644
index 00000000..84c3345f
--- /dev/null
+++ b/test/lib/completions/chpasswd.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "chpasswd -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/chrpath.exp b/test/lib/completions/chrpath.exp
new file mode 100644
index 00000000..311628eb
--- /dev/null
+++ b/test/lib/completions/chrpath.exp
@@ -0,0 +1,21 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "chrpath "
+sync_after_int
+
+assert_complete_any "chrpath -"
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/chsh.exp b/test/lib/completions/chsh.exp
index a26ac93f..6736c18c 100644
--- a/test/lib/completions/chsh.exp
+++ b/test/lib/completions/chsh.exp
@@ -17,7 +17,7 @@ assert_complete_any "chsh -s "
sync_after_int
-assert_complete [exec bash -c "compgen -A user"] "chsh "
+assert_complete_any "chsh "
sync_after_int
diff --git a/test/lib/completions/ciptool.exp b/test/lib/completions/ciptool.exp
new file mode 100644
index 00000000..cefe8f92
--- /dev/null
+++ b/test/lib/completions/ciptool.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "ciptool "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/compare.exp b/test/lib/completions/compare.exp
new file mode 100644
index 00000000..006d70a1
--- /dev/null
+++ b/test/lib/completions/compare.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "compare "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/conjure.exp b/test/lib/completions/conjure.exp
new file mode 100644
index 00000000..4f628af3
--- /dev/null
+++ b/test/lib/completions/conjure.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "conjure "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/convert.exp b/test/lib/completions/convert.exp
index 07032040..b3a2e565 100644
--- a/test/lib/completions/convert.exp
+++ b/test/lib/completions/convert.exp
@@ -12,8 +12,10 @@ setup
assert_complete_any "convert "
+sync_after_int
+assert_complete_any "convert -format "
sync_after_int
diff --git a/test/lib/completions/cppcheck.exp b/test/lib/completions/cppcheck.exp
new file mode 100644
index 00000000..4acd709a
--- /dev/null
+++ b/test/lib/completions/cppcheck.exp
@@ -0,0 +1,30 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "cppcheck "
+sync_after_int
+
+
+assert_complete_any "cppcheck -"
+sync_after_int
+
+
+assert_complete_any "cppcheck -DFOO=BAR "
+sync_after_int
+
+
+assert_no_complete "cppcheck -D "
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/curl.exp b/test/lib/completions/curl.exp
new file mode 100644
index 00000000..53512bc4
--- /dev/null
+++ b/test/lib/completions/curl.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "curl -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/cvs.exp b/test/lib/completions/cvs.exp
index 3b2643d3..9248edc8 100644
--- a/test/lib/completions/cvs.exp
+++ b/test/lib/completions/cvs.exp
@@ -8,6 +8,7 @@ proc teardown {} {
assert_bash_exec {HOME=$OLDHOME}
assert_env_unmodified {
/OLDHOME=/d
+ /OLDPWD=/d
}
}
@@ -33,4 +34,8 @@ expect {
sync_after_int
+assert_complete_dir "foo/bar" "cvs diff foo/" $::srcdir/fixtures/cvs
+sync_after_int
+
+
teardown
diff --git a/test/lib/completions/dfutool.exp b/test/lib/completions/dfutool.exp
new file mode 100644
index 00000000..10e48544
--- /dev/null
+++ b/test/lib/completions/dfutool.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "dfutool "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/display.exp b/test/lib/completions/display.exp
index e9fe766a..70cea182 100644
--- a/test/lib/completions/display.exp
+++ b/test/lib/completions/display.exp
@@ -17,22 +17,7 @@ assert_complete_any "display "
sync_after_int
-set test "- should complete options"
-set options {
- -alpha -antialias -authenticate -auto-orient -backdrop -background -border
- -bordercolor -borderwidth -channel -clip -clip-path -coalesce -colormap
- -colors -colorspace -comment -compress -contrast -crop -debug -decipher
- -define -delay -density -depth -despeckle -display -dispose -dither -edge
- -endian -enhance -extract -filter -flatten -flip -flop -font -foreground
- -format -frame -gamma -geometry -help -iconGeometry -iconic -identify
- -immutable -interlace -interpolate -label -limit -list -log -loop -map
- -mattecolor -monitor -monochrome -name -negate -page -profile -quality
- -quantize -quiet -raise -regard-warnings -remote -repage -resample -resize
- -respect-parenthesis -roll -rotate -sample -sampling-factor -scenes -seed
- -segment -set -shared-memory -sharpen -size -strip -texture -title
- -transparent-color -treedepth -trim -update -usePixmap -verbose -version
- -virtual-pixel -visual -window -window-group -write }
-assert_complete $options "display -" $test
+assert_complete_any "display -"
sync_after_int
diff --git a/test/lib/completions/dmesg.exp b/test/lib/completions/dmesg.exp
new file mode 100644
index 00000000..79f2e04a
--- /dev/null
+++ b/test/lib/completions/dmesg.exp
@@ -0,0 +1,18 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "dmesg -"
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/dot.exp b/test/lib/completions/dot.exp
new file mode 100644
index 00000000..2a85a56b
--- /dev/null
+++ b/test/lib/completions/dot.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "dot "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/explodepkg.exp b/test/lib/completions/explodepkg.exp
new file mode 100644
index 00000000..e5ee35e4
--- /dev/null
+++ b/test/lib/completions/explodepkg.exp
@@ -0,0 +1,25 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified {/OLDPWD=/d}
+}
+
+
+setup
+
+
+set test "should complete *.t\[gbxl\]z files and dirs"
+set dir $::srcdir/fixtures/slackware/home
+set files [split [exec bash -c "cd $dir && find . -mindepth 1 -maxdepth 1 \
+ \\( -type d -printf '%P/\\n' \\) -o \
+ \\( -type f -name '*.t\[bglx\]z' -printf '%P\\n' \\)"] "\n"]
+assert_complete_dir $files "explodepkg " $dir $test
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/faillog.exp b/test/lib/completions/faillog.exp
new file mode 100644
index 00000000..9ccd1ad2
--- /dev/null
+++ b/test/lib/completions/faillog.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "faillog -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/fbgs.exp b/test/lib/completions/fbgs.exp
new file mode 100644
index 00000000..45fa22df
--- /dev/null
+++ b/test/lib/completions/fbgs.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "fbgs "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/fbi.exp b/test/lib/completions/fbi.exp
new file mode 100644
index 00000000..9c583062
--- /dev/null
+++ b/test/lib/completions/fbi.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "fbi "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/feh.exp b/test/lib/completions/feh.exp
new file mode 100644
index 00000000..129e1f4d
--- /dev/null
+++ b/test/lib/completions/feh.exp
@@ -0,0 +1,55 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "feh "
+
+
+sync_after_int
+
+
+set test "--lis<TAB> should complete \"--list\""
+assert_complete "--list" "feh --lis" $test
+
+
+sync_after_int
+
+
+set test "-S pix<TAB> should complete \"pixels\""
+assert_complete "pixels" "feh -S pix" $test
+
+
+sync_after_int
+
+
+set test "--zoom ma<TAB> should complete \"max\""
+assert_complete "max" "feh --zoom ma" $test
+
+
+sync_after_int
+
+
+set test "-g 640<TAB> should complete digits plus \"x\""
+assert_complete "0 1 2 3 4 5 6 7 8 9 x" "feh -g 640" $test
+
+
+sync_after_int
+
+
+set test "-g 640x48<TAB> should complete digits"
+assert_complete "0 1 2 3 4 5 6 7 8 9" "feh -g 640x48" $test
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/file.exp b/test/lib/completions/file.exp
new file mode 100644
index 00000000..346960b6
--- /dev/null
+++ b/test/lib/completions/file.exp
@@ -0,0 +1,21 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "file "
+sync_after_int
+
+assert_complete_any "file -"
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/find.exp b/test/lib/completions/find.exp
index 9acda648..96d55334 100644
--- a/test/lib/completions/find.exp
+++ b/test/lib/completions/find.exp
@@ -43,7 +43,7 @@ sync_after_int
set test "-wholename should complete files/dirs"
set dir $::srcdir/fixtures/shared/default
set files [split [exec bash -c "cd $dir && ls -p"] "\n"]
-assert_complete_dir $files "find -wholename " $dir
+assert_complete_dir $files "find -wholename " $dir $test
sync_after_int
diff --git a/test/lib/completions/finger.exp b/test/lib/completions/finger.exp
index 70e3ed2c..f11d11fe 100644
--- a/test/lib/completions/finger.exp
+++ b/test/lib/completions/finger.exp
@@ -24,7 +24,7 @@ sync_after_int
set test "Tab should complete partial username"
-assert_complete_partial [exec bash -c "compgen -A user"] "finger" -nospace
+assert_complete_partial [exec bash -c "compgen -A user"] "finger" "" $test -nospace
sync_after_int
@@ -48,7 +48,7 @@ foreach h [get_known_hosts] {
}
}
}
-assert_complete $hosts "finger test@$char" $test
+assert_complete $hosts "finger test@$char" $test -expect-cmd-minus "test@$char"
sync_after_int
diff --git a/test/lib/completions/fusermount.exp b/test/lib/completions/fusermount.exp
new file mode 100644
index 00000000..f6ac4f5d
--- /dev/null
+++ b/test/lib/completions/fusermount.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "fusermount "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/gendiff.exp b/test/lib/completions/gendiff.exp
new file mode 100644
index 00000000..cc1ebb68
--- /dev/null
+++ b/test/lib/completions/gendiff.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "gendiff "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/gnome-mplayer.exp b/test/lib/completions/gnome-mplayer.exp
new file mode 100644
index 00000000..fd635bff
--- /dev/null
+++ b/test/lib/completions/gnome-mplayer.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "gnome-mplayer "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/gpasswd.exp b/test/lib/completions/gpasswd.exp
new file mode 100644
index 00000000..68ac2cc3
--- /dev/null
+++ b/test/lib/completions/gpasswd.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "gpasswd "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/grpck.exp b/test/lib/completions/grpck.exp
new file mode 100644
index 00000000..385ebe2b
--- /dev/null
+++ b/test/lib/completions/grpck.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "grpck "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/hciattach.exp b/test/lib/completions/hciattach.exp
new file mode 100644
index 00000000..35642f28
--- /dev/null
+++ b/test/lib/completions/hciattach.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "hciattach "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/hciconfig.exp b/test/lib/completions/hciconfig.exp
new file mode 100644
index 00000000..56444f4f
--- /dev/null
+++ b/test/lib/completions/hciconfig.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "hciconfig "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/hddtemp.exp b/test/lib/completions/hddtemp.exp
new file mode 100644
index 00000000..a6721dbf
--- /dev/null
+++ b/test/lib/completions/hddtemp.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "hddtemp -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/host.exp b/test/lib/completions/host.exp
new file mode 100644
index 00000000..73081821
--- /dev/null
+++ b/test/lib/completions/host.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "host -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/htpasswd.exp b/test/lib/completions/htpasswd.exp
new file mode 100644
index 00000000..bb66d2f0
--- /dev/null
+++ b/test/lib/completions/htpasswd.exp
@@ -0,0 +1,32 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified {
+ /OLDPWD=/d
+ }
+}
+
+
+setup
+
+
+assert_complete_any "htpasswd "
+sync_after_int
+
+
+assert_no_complete "htpasswd -n $::srcdir/fixtures/htpasswd/ht"
+sync_after_int
+
+
+assert_complete_dir "htpasswd" "htpasswd " $::srcdir/fixtures/htpasswd
+sync_after_int
+
+
+assert_complete_dir "foo quux" "htpasswd -D htpasswd " $::srcdir/fixtures/htpasswd
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/idn.exp b/test/lib/completions/idn.exp
new file mode 100644
index 00000000..4625c7e4
--- /dev/null
+++ b/test/lib/completions/idn.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "idn -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/import.exp b/test/lib/completions/import.exp
new file mode 100644
index 00000000..db6845ea
--- /dev/null
+++ b/test/lib/completions/import.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "import "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/installpkg.exp b/test/lib/completions/installpkg.exp
new file mode 100644
index 00000000..48581aa1
--- /dev/null
+++ b/test/lib/completions/installpkg.exp
@@ -0,0 +1,49 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified {/OLDPWD=/d}
+}
+
+
+setup
+
+
+assert_complete_any "installpkg -"
+
+
+sync_after_int
+
+
+set test "--<TAB> should complete all long options"
+set options [list --warn --md5sum --root --infobox --terse --menu --ask \
+ --priority --tagfile]
+assert_complete $options "installpkg --" $test
+
+
+sync_after_int
+
+
+set test "--root should comlete only dirs"
+set dirs [split [exec bash -c "find . -type d -mindepth 1 -maxdepth 1 \
+ -printf '%P/\n'"] "\n"]
+assert_complete $dirs "installpkg --root " $test
+
+
+sync_after_int
+
+
+set test "should complete *.t\[gbxl\]z files and dirs"
+set dir $::srcdir/fixtures/slackware/home
+set files [split [exec bash -c "cd $dir && find . -mindepth 1 -maxdepth 1 \
+ \\( -type d -printf '%P/\\n' \\) -o \
+ \\( -type f -name '*.t\[bglx\]z' -printf '%P\\n' \\)"] "\n"]
+assert_complete_dir $files "installpkg " $dir $test
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/ionice.exp b/test/lib/completions/ionice.exp
new file mode 100644
index 00000000..d0ff8b64
--- /dev/null
+++ b/test/lib/completions/ionice.exp
@@ -0,0 +1,18 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "ionice -"
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/java.exp b/test/lib/completions/java.exp
index 842501d2..864aabd6 100644
--- a/test/lib/completions/java.exp
+++ b/test/lib/completions/java.exp
@@ -18,14 +18,21 @@ assert_complete_any "java -"
sync_after_int
-assert_complete "b bashcomp.jarred toplevel" "java "
+assert_complete "b bashcomp.jarred c. toplevel" "java "
sync_after_int
assert_complete "bashcomp.jarred toplevel" \
- "java -cp $::srcdir/fixtures/java/bashcomp.jar "
+ "java -classpath $::srcdir/fixtures/java/bashcomp.jar "
+
+
+sync_after_int
+
+
+assert_complete "bashcomp.jarred d toplevel" \
+ "java -cp $::srcdir/fixtures/java/bashcomp.jar:$::srcdir/fixtures/java/a/c "
sync_after_int
diff --git a/test/lib/completions/javadoc.exp b/test/lib/completions/javadoc.exp
index 0af8a3da..79e86138 100644
--- a/test/lib/completions/javadoc.exp
+++ b/test/lib/completions/javadoc.exp
@@ -12,8 +12,14 @@ setup
assert_complete_any "javadoc "
+sync_after_int
+
+
+assert_complete {"bar bar.d/" foo.d/} "javadoc -linkoffline $::srcdir/fixtures/shared/default/"
+sync_after_int
+assert_complete {"bar bar.d/" foo.d/} "javadoc -nodeprecated -linkoffline foo $::srcdir/fixtures/shared/default/"
sync_after_int
diff --git a/test/lib/completions/jps.exp b/test/lib/completions/jps.exp
new file mode 100644
index 00000000..62d5d710
--- /dev/null
+++ b/test/lib/completions/jps.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "jps -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/kcov.exp b/test/lib/completions/kcov.exp
new file mode 100644
index 00000000..c39f53e7
--- /dev/null
+++ b/test/lib/completions/kcov.exp
@@ -0,0 +1,27 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "kcov "
+
+
+sync_after_int
+
+
+set test "--exclude-patter<TAB> should complete \"--exclude-pattern=\""
+assert_complete "--exclude-pattern=" "kcov --exclude-patter" $test -nospace
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/kill.exp b/test/lib/completions/kill.exp
index 1e80fe69..bc07bc48 100644
--- a/test/lib/completions/kill.exp
+++ b/test/lib/completions/kill.exp
@@ -12,14 +12,16 @@ setup
assert_complete_any "kill 1"
-
-
sync_after_int
-assert_complete [get_signals] "kill -"
+assert_complete [get_signals] "kill -s "
+sync_after_int
+set expected [get_signals -]
+lappend expected "-l" "-s"
+assert_complete [lsort -unique $expected] "kill -"
sync_after_int
diff --git a/test/lib/completions/killall.exp b/test/lib/completions/killall.exp
index ae8b3d60..1ee3ade8 100644
--- a/test/lib/completions/killall.exp
+++ b/test/lib/completions/killall.exp
@@ -17,7 +17,7 @@ assert_complete_any "killall "
sync_after_int
-assert_complete [get_signals] "killall -"
+assert_complete [get_signals -] "killall -"
sync_after_int
diff --git a/test/lib/completions/l2ping.exp b/test/lib/completions/l2ping.exp
new file mode 100644
index 00000000..de8c58c1
--- /dev/null
+++ b/test/lib/completions/l2ping.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "l2ping -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/lastlog.exp b/test/lib/completions/lastlog.exp
new file mode 100644
index 00000000..74d75553
--- /dev/null
+++ b/test/lib/completions/lastlog.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "lastlog -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/ldapadd.exp b/test/lib/completions/ldapadd.exp
new file mode 100644
index 00000000..bc066ab6
--- /dev/null
+++ b/test/lib/completions/ldapadd.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "ldapadd -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/ldapcompare.exp b/test/lib/completions/ldapcompare.exp
new file mode 100644
index 00000000..c693f703
--- /dev/null
+++ b/test/lib/completions/ldapcompare.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "ldapcompare -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/ldapdelete.exp b/test/lib/completions/ldapdelete.exp
new file mode 100644
index 00000000..cc20d0e7
--- /dev/null
+++ b/test/lib/completions/ldapdelete.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "ldapdelete -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/ldapmodrdn.exp b/test/lib/completions/ldapmodrdn.exp
new file mode 100644
index 00000000..3ae6c399
--- /dev/null
+++ b/test/lib/completions/ldapmodrdn.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "ldapmodrdn -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/ldappasswd.exp b/test/lib/completions/ldappasswd.exp
new file mode 100644
index 00000000..2dd49393
--- /dev/null
+++ b/test/lib/completions/ldappasswd.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "ldappasswd -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/ldapsearch.exp b/test/lib/completions/ldapsearch.exp
new file mode 100644
index 00000000..92394ecd
--- /dev/null
+++ b/test/lib/completions/ldapsearch.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "ldapsearch -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/ldapvi.exp b/test/lib/completions/ldapvi.exp
new file mode 100644
index 00000000..54c62772
--- /dev/null
+++ b/test/lib/completions/ldapvi.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "ldapvi -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/ldapwhoami.exp b/test/lib/completions/ldapwhoami.exp
new file mode 100644
index 00000000..7be41740
--- /dev/null
+++ b/test/lib/completions/ldapwhoami.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "ldapwhoami -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/lpq.exp b/test/lib/completions/lpq.exp
new file mode 100644
index 00000000..41fdb216
--- /dev/null
+++ b/test/lib/completions/lpq.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "lpq "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/lpr.exp b/test/lib/completions/lpr.exp
new file mode 100644
index 00000000..1ec46844
--- /dev/null
+++ b/test/lib/completions/lpr.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "lpr "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/lvchange.exp b/test/lib/completions/lvchange.exp
index 6587a260..2240e5eb 100644
--- a/test/lib/completions/lvchange.exp
+++ b/test/lib/completions/lvchange.exp
@@ -11,7 +11,9 @@ proc teardown {} {
setup
-assert_complete_any "lvchange --"
+if {[assert_exec {lvchange --help} "" "" "untested"]} { # may fail as non-root
+ assert_complete_any "lvchange --"
+}
sync_after_int
diff --git a/test/lib/completions/lvcreate.exp b/test/lib/completions/lvcreate.exp
index 91cb0d81..678ac1be 100644
--- a/test/lib/completions/lvcreate.exp
+++ b/test/lib/completions/lvcreate.exp
@@ -11,7 +11,9 @@ proc teardown {} {
setup
-assert_complete_any "lvcreate --"
+if {[assert_exec {lvcreate --help} "" "" "untested"]} { # may fail as non-root
+ assert_complete_any "lvcreate --"
+}
sync_after_int
diff --git a/test/lib/completions/lvdisplay.exp b/test/lib/completions/lvdisplay.exp
index 6fa9c294..5e8c3210 100644
--- a/test/lib/completions/lvdisplay.exp
+++ b/test/lib/completions/lvdisplay.exp
@@ -11,7 +11,9 @@ proc teardown {} {
setup
-assert_complete_any "lvdisplay --"
+if {[assert_exec {lvdisplay --help} "" "" "untested"]} { # may fail as non-root
+ assert_complete_any "lvdisplay --"
+}
sync_after_int
diff --git a/test/lib/completions/lvextend.exp b/test/lib/completions/lvextend.exp
index ded34695..7c0e329e 100644
--- a/test/lib/completions/lvextend.exp
+++ b/test/lib/completions/lvextend.exp
@@ -11,7 +11,9 @@ proc teardown {} {
setup
-assert_complete_any "lvextend --"
+if {[assert_exec {lvextend --help} "" "" "untested"]} { # may fail as non-root
+ assert_complete_any "lvextend --"
+}
sync_after_int
diff --git a/test/lib/completions/lvmdiskscan.exp b/test/lib/completions/lvmdiskscan.exp
index 6553865f..30c73c5c 100644
--- a/test/lib/completions/lvmdiskscan.exp
+++ b/test/lib/completions/lvmdiskscan.exp
@@ -11,7 +11,9 @@ proc teardown {} {
setup
-assert_complete_any "lvmdiskscan --"
+if {[assert_exec {lvmdiskscan --help} "" "" "untested"]} { # may fail as non-root
+ assert_complete_any "lvmdiskscan --"
+}
sync_after_int
diff --git a/test/lib/completions/lvreduce.exp b/test/lib/completions/lvreduce.exp
index e2708f89..b9904fef 100644
--- a/test/lib/completions/lvreduce.exp
+++ b/test/lib/completions/lvreduce.exp
@@ -11,7 +11,9 @@ proc teardown {} {
setup
-assert_complete_any "lvreduce --"
+if {[assert_exec {lvreduce --help} "" "" "untested"]} { # may fail as non-root
+ assert_complete_any "lvreduce --"
+}
sync_after_int
diff --git a/test/lib/completions/lvremove.exp b/test/lib/completions/lvremove.exp
index 8ca1517b..0f41d8dc 100644
--- a/test/lib/completions/lvremove.exp
+++ b/test/lib/completions/lvremove.exp
@@ -11,7 +11,9 @@ proc teardown {} {
setup
-assert_complete_any "lvremove --"
+if {[assert_exec {lvremove --help} "" "" "untested"]} { # may fail as non-root
+ assert_complete_any "lvremove --"
+}
sync_after_int
diff --git a/test/lib/completions/lvrename.exp b/test/lib/completions/lvrename.exp
index 17179ce9..77d6c5e0 100644
--- a/test/lib/completions/lvrename.exp
+++ b/test/lib/completions/lvrename.exp
@@ -11,7 +11,9 @@ proc teardown {} {
setup
-assert_complete_any "lvrename --"
+if {[assert_exec {lvrename --help} "" "" "untested"]} { # may fail as non-root
+ assert_complete_any "lvrename --"
+}
sync_after_int
diff --git a/test/lib/completions/lvresize.exp b/test/lib/completions/lvresize.exp
index 2b3e1044..a0e8f99e 100644
--- a/test/lib/completions/lvresize.exp
+++ b/test/lib/completions/lvresize.exp
@@ -11,7 +11,9 @@ proc teardown {} {
setup
-assert_complete_any "lvresize --"
+if {[assert_exec {lvresize --help} "" "" "untested"]} { # may fail as non-root
+ assert_complete_any "lvresize --"
+}
sync_after_int
diff --git a/test/lib/completions/lvs.exp b/test/lib/completions/lvs.exp
index e531f7e9..c46a8153 100644
--- a/test/lib/completions/lvs.exp
+++ b/test/lib/completions/lvs.exp
@@ -11,7 +11,9 @@ proc teardown {} {
setup
-assert_complete_any "lvs --"
+if {[assert_exec {lvs --help} "" "" "untested"]} { # may fail as non-root
+ assert_complete_any "lvs --"
+}
sync_after_int
diff --git a/test/lib/completions/lvscan.exp b/test/lib/completions/lvscan.exp
index 7b09e5e1..60effb5d 100644
--- a/test/lib/completions/lvscan.exp
+++ b/test/lib/completions/lvscan.exp
@@ -11,7 +11,9 @@ proc teardown {} {
setup
-assert_complete_any "lvscan --"
+if {[assert_exec {lvscan --help} "" "" "untested"]} { # may fail as non-root
+ assert_complete_any "lvscan --"
+}
sync_after_int
diff --git a/test/lib/completions/makepkg.exp b/test/lib/completions/makepkg.exp
new file mode 100644
index 00000000..56e06339
--- /dev/null
+++ b/test/lib/completions/makepkg.exp
@@ -0,0 +1,28 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "makepkg -"
+
+
+sync_after_int
+
+
+set test "--<TAB> should complete all long options"
+set options [list --linkadd --prepend --chown]
+assert_complete $options "makepkg --" $test
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/mdadm.exp b/test/lib/completions/mdadm.exp
new file mode 100644
index 00000000..6559aa20
--- /dev/null
+++ b/test/lib/completions/mdadm.exp
@@ -0,0 +1,18 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "mdadm "
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/mdtool.exp b/test/lib/completions/mdtool.exp
new file mode 100644
index 00000000..076cb17a
--- /dev/null
+++ b/test/lib/completions/mdtool.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "mdtool "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/medusa.exp b/test/lib/completions/medusa.exp
new file mode 100644
index 00000000..6ad2fdc3
--- /dev/null
+++ b/test/lib/completions/medusa.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "medusa -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/mii-diag.exp b/test/lib/completions/mii-diag.exp
new file mode 100644
index 00000000..952ff632
--- /dev/null
+++ b/test/lib/completions/mii-diag.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "mii-diag "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/mii-tool.exp b/test/lib/completions/mii-tool.exp
new file mode 100644
index 00000000..03827edd
--- /dev/null
+++ b/test/lib/completions/mii-tool.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "mii-tool "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/mkdir.exp b/test/lib/completions/mkdir.exp
index 8d8c881d..44e87cee 100644
--- a/test/lib/completions/mkdir.exp
+++ b/test/lib/completions/mkdir.exp
@@ -23,4 +23,11 @@ assert_complete {"bar bar.d/" foo.d/} "mkdir $::srcdir/fixtures/shared/default/"
sync_after_int
+# No subdirs in foo.d and should not complete files in it (_longopt()).
+assert_no_complete "mkdir $::srcdir/fixtures/shared/default/foo.d/"
+
+
+sync_after_int
+
+
teardown
diff --git a/test/lib/completions/monodevelop.exp b/test/lib/completions/monodevelop.exp
new file mode 100644
index 00000000..0bfe788e
--- /dev/null
+++ b/test/lib/completions/monodevelop.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "monodevelop "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/mount.exp b/test/lib/completions/mount.exp
index c99d6058..1298f36f 100644
--- a/test/lib/completions/mount.exp
+++ b/test/lib/completions/mount.exp
@@ -30,7 +30,7 @@ proc setup {} {
proc teardown {} {
teardown_dummy_mnt
- assert_env_unmodified
+ assert_env_unmodified {/OLDPWD/d}
}
@@ -49,6 +49,13 @@ assert_complete_any "mount -t "
sync_after_int
+set test "mount /dev/sda1 def should complete directory name"
+assert_complete_dir "default/" "mount /dev/sda1 def" $::srcdir/fixtures/shared $test -nospace
+
+
+sync_after_int
+
+
set test "Check completing nfs mounts"
set expected [list /test/path /test/path2 /second/path]
set cmd "mount mocksrv:/"
diff --git a/test/lib/completions/msynctool.exp b/test/lib/completions/msynctool.exp
new file mode 100644
index 00000000..cb238d9f
--- /dev/null
+++ b/test/lib/completions/msynctool.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "msynctool "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/mutt.exp b/test/lib/completions/mutt.exp
index 8cb8b0c6..1f4425e2 100644
--- a/test/lib/completions/mutt.exp
+++ b/test/lib/completions/mutt.exp
@@ -1,10 +1,15 @@
proc setup {} {
save_env
+ assert_bash_exec {OLDHOME=$HOME ; HOME=$SRCDIRABS/fixtures/mutt}
}
proc teardown {} {
- assert_env_unmodified {/OLDPWD=/d}
+ assert_bash_exec {HOME=$OLDHOME}
+ assert_env_unmodified {
+ /OLDPWD=/d
+ /OLDHOME=/d
+ }
}
@@ -19,15 +24,20 @@ sync_after_int
set test "mutt should complete mailboxes"
set expected {foo/ bar/ muttrc}
-assert_complete_dir $expected "mutt -F muttrc -f =" $::srcdir/fixtures/mutt
+assert_complete_dir $expected "mutt -F muttrc -f =" $::srcdir/fixtures/mutt $test
set test "mutt should complete aliases"
set expected {a1 a2}
-assert_complete_dir $expected "mutt -F muttrc -A " $::srcdir/fixtures/mutt
+assert_complete_dir $expected "mutt -F muttrc -A " $::srcdir/fixtures/mutt $test
sync_after_int
+set expected "$::srcdirabs/fixtures/mutt/muttrc $::srcdirabs/fixtures/mutt/bar/muttrc_b $::srcdirabs/fixtures/mutt/foo/muttrc_f"
+assert_bash_list $expected { _muttconffiles "$HOME/muttrc" "$HOME/muttrc" } "find muttrcs recursively"
+sync_after_int
+
+
teardown
diff --git a/test/lib/completions/mysql.exp b/test/lib/completions/mysql.exp
new file mode 100644
index 00000000..62a64fc2
--- /dev/null
+++ b/test/lib/completions/mysql.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "mysql --"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/newusers.exp b/test/lib/completions/newusers.exp
new file mode 100644
index 00000000..a1928120
--- /dev/null
+++ b/test/lib/completions/newusers.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "newusers "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/nslookup.exp b/test/lib/completions/nslookup.exp
new file mode 100644
index 00000000..20b84451
--- /dev/null
+++ b/test/lib/completions/nslookup.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "nslookup -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/openssl.exp b/test/lib/completions/openssl.exp
index 25fc1367..d1357002 100644
--- a/test/lib/completions/openssl.exp
+++ b/test/lib/completions/openssl.exp
@@ -25,4 +25,8 @@ expect {
sync_after_int
+assert_complete_any "openssl pkey -cipher "
+sync_after_int
+
+
teardown
diff --git a/test/lib/completions/passwd.exp b/test/lib/completions/passwd.exp
new file mode 100644
index 00000000..df2945b8
--- /dev/null
+++ b/test/lib/completions/passwd.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "passwd "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/perl.exp b/test/lib/completions/perl.exp
index 8cd6f957..f3a51841 100644
--- a/test/lib/completions/perl.exp
+++ b/test/lib/completions/perl.exp
@@ -86,7 +86,7 @@ set test "- should complete options"
set options {
-0 -a -c -C -d -D -e -F -h -i -I -l -m -M -n -p -P -s -S -T -u -U -v -V -w -W -x -X
}
-assert_complete $options "perl -"
+assert_complete $options "perl -" $test
sync_after_int
diff --git a/test/lib/completions/perldoc.exp b/test/lib/completions/perldoc.exp
index dc1c79c8..9a9d9fbf 100644
--- a/test/lib/completions/perldoc.exp
+++ b/test/lib/completions/perldoc.exp
@@ -32,7 +32,7 @@ set test "- should complete options"
set options {
-h -v -t -u -m -l -F -X -f -q
}
-assert_complete $options "perldoc -"
+assert_complete $options "perldoc -" $test
sync_after_int
diff --git a/test/lib/completions/phing.exp b/test/lib/completions/phing.exp
new file mode 100644
index 00000000..f064ea4a
--- /dev/null
+++ b/test/lib/completions/phing.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "phing -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/pinfo.exp b/test/lib/completions/pinfo.exp
new file mode 100644
index 00000000..3af44044
--- /dev/null
+++ b/test/lib/completions/pinfo.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "pinfo "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/ping.exp b/test/lib/completions/ping.exp
index 3e419966..9ef7f2fd 100644
--- a/test/lib/completions/ping.exp
+++ b/test/lib/completions/ping.exp
@@ -12,8 +12,9 @@ setup
assert_complete_any "ping "
+sync_after_int
-
+assert_complete_any "ping -"
sync_after_int
diff --git a/test/lib/completions/pkgtool.exp b/test/lib/completions/pkgtool.exp
new file mode 100644
index 00000000..c071ecd4
--- /dev/null
+++ b/test/lib/completions/pkgtool.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "pkgtool -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/postcat.exp b/test/lib/completions/postcat.exp
new file mode 100644
index 00000000..78636676
--- /dev/null
+++ b/test/lib/completions/postcat.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "postcat "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/postconf.exp b/test/lib/completions/postconf.exp
new file mode 100644
index 00000000..40349061
--- /dev/null
+++ b/test/lib/completions/postconf.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "postconf p"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/postfix.exp b/test/lib/completions/postfix.exp
new file mode 100644
index 00000000..d1cb7e80
--- /dev/null
+++ b/test/lib/completions/postfix.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "postfix "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/postmap.exp b/test/lib/completions/postmap.exp
new file mode 100644
index 00000000..af31061f
--- /dev/null
+++ b/test/lib/completions/postmap.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "postmap "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/postsuper.exp b/test/lib/completions/postsuper.exp
new file mode 100644
index 00000000..145895e2
--- /dev/null
+++ b/test/lib/completions/postsuper.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "postsuper "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/prelink.exp b/test/lib/completions/prelink.exp
new file mode 100644
index 00000000..4a493667
--- /dev/null
+++ b/test/lib/completions/prelink.exp
@@ -0,0 +1,21 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "prelink "
+sync_after_int
+
+assert_complete_any "prelink -"
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/protoc.exp b/test/lib/completions/protoc.exp
new file mode 100644
index 00000000..caeb8274
--- /dev/null
+++ b/test/lib/completions/protoc.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "protoc "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/puppet.exp b/test/lib/completions/puppet.exp
new file mode 100644
index 00000000..7b7da3e7
--- /dev/null
+++ b/test/lib/completions/puppet.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "puppet "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/pvchange.exp b/test/lib/completions/pvchange.exp
index a43ae9cd..f317b52f 100644
--- a/test/lib/completions/pvchange.exp
+++ b/test/lib/completions/pvchange.exp
@@ -11,7 +11,9 @@ proc teardown {} {
setup
-assert_complete_any "pvchange --"
+if {[assert_exec {pvchange --help} "" "" "untested"]} { # may fail as non-root
+ assert_complete_any "pvchange --"
+}
sync_after_int
diff --git a/test/lib/completions/pvcreate.exp b/test/lib/completions/pvcreate.exp
index 6bc9d4eb..6e36b368 100644
--- a/test/lib/completions/pvcreate.exp
+++ b/test/lib/completions/pvcreate.exp
@@ -11,7 +11,9 @@ proc teardown {} {
setup
-assert_complete_any "pvcreate --"
+if {[assert_exec {pvcreate --help} "" "" "untested"]} { # may fail as non-root
+ assert_complete_any "pvcreate --"
+}
sync_after_int
diff --git a/test/lib/completions/pvdisplay.exp b/test/lib/completions/pvdisplay.exp
index b9db558b..7b1df0c3 100644
--- a/test/lib/completions/pvdisplay.exp
+++ b/test/lib/completions/pvdisplay.exp
@@ -11,7 +11,9 @@ proc teardown {} {
setup
-assert_complete_any "pvdisplay --"
+if {[assert_exec {pvdisplay --help} "" "" "untested"]} { # may fail as non-root
+ assert_complete_any "pvdisplay --"
+}
sync_after_int
diff --git a/test/lib/completions/pvremove.exp b/test/lib/completions/pvremove.exp
index 1febcf37..6d655e79 100644
--- a/test/lib/completions/pvremove.exp
+++ b/test/lib/completions/pvremove.exp
@@ -11,7 +11,9 @@ proc teardown {} {
setup
-assert_complete_any "pvremove --"
+if {[assert_exec {pvremove --help} "" "" "untested"]} { # may fail as non-root
+ assert_complete_any "pvremove --"
+}
sync_after_int
diff --git a/test/lib/completions/pvs.exp b/test/lib/completions/pvs.exp
index e50501a3..195665fd 100644
--- a/test/lib/completions/pvs.exp
+++ b/test/lib/completions/pvs.exp
@@ -11,7 +11,9 @@ proc teardown {} {
setup
-assert_complete_any "pvs --"
+if {[assert_exec {pvs --help} "" "" "untested"]} { # may fail as non-root
+ assert_complete_any "pvs --"
+}
sync_after_int
diff --git a/test/lib/completions/pwck.exp b/test/lib/completions/pwck.exp
new file mode 100644
index 00000000..e7c5706c
--- /dev/null
+++ b/test/lib/completions/pwck.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "pwck "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/pwdx.exp b/test/lib/completions/pwdx.exp
new file mode 100644
index 00000000..314623bd
--- /dev/null
+++ b/test/lib/completions/pwdx.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "pwdx "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/pwgen.exp b/test/lib/completions/pwgen.exp
new file mode 100644
index 00000000..b8882b68
--- /dev/null
+++ b/test/lib/completions/pwgen.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "pwgen -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/qemu.exp b/test/lib/completions/qemu.exp
new file mode 100644
index 00000000..cd3d5938
--- /dev/null
+++ b/test/lib/completions/qemu.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "qemu "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/quota.exp b/test/lib/completions/quota.exp
new file mode 100644
index 00000000..1eb9f161
--- /dev/null
+++ b/test/lib/completions/quota.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "quota "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/quotacheck.exp b/test/lib/completions/quotacheck.exp
new file mode 100644
index 00000000..4200da32
--- /dev/null
+++ b/test/lib/completions/quotacheck.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "quotacheck "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/quotaon.exp b/test/lib/completions/quotaon.exp
new file mode 100644
index 00000000..4acc70e1
--- /dev/null
+++ b/test/lib/completions/quotaon.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "quotaon "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/rdesktop.exp b/test/lib/completions/rdesktop.exp
new file mode 100644
index 00000000..32544941
--- /dev/null
+++ b/test/lib/completions/rdesktop.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "rdesktop -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/removepkg.exp b/test/lib/completions/removepkg.exp
index 882f1e70..b7cf4b1c 100644
--- a/test/lib/completions/removepkg.exp
+++ b/test/lib/completions/removepkg.exp
@@ -4,14 +4,29 @@ proc setup {} {
proc teardown {} {
- assert_env_unmodified
+ assert_env_unmodified {/ROOT=/d}
}
setup
-assert_complete_any "removepkg "
+set test "-<TAB> should complete all options"
+set options [list -copy -keep -preserve -warn]
+assert_complete $options "removepkg -" $test
+
+
+sync_after_int
+
+
+set test "should complete files in \$ROOT/var/log/packages/"
+# set env(ROOT) [file normalize $::srcdir/fixtures/slackware]
+# set dir $env(ROOT)/var/log/packages/
+set root [file normalize $::srcdir/fixtures/slackware]
+set dir $root/var/log/packages/
+assert_bash_exec "ROOT=$root"
+set files [split [exec bash -c "cd $dir && ls"] "\n"]
+assert_complete $files "removepkg " $test
sync_after_int
diff --git a/test/lib/completions/reptyr.exp b/test/lib/completions/reptyr.exp
new file mode 100644
index 00000000..35ccb91c
--- /dev/null
+++ b/test/lib/completions/reptyr.exp
@@ -0,0 +1,22 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "reptyr -"
+sync_after_int
+
+
+assert_complete_any "reptyr "
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/rfcomm.exp b/test/lib/completions/rfcomm.exp
new file mode 100644
index 00000000..b449134c
--- /dev/null
+++ b/test/lib/completions/rfcomm.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "rfcomm "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/ri.exp b/test/lib/completions/ri.exp
index cd138ea0..e6661d1b 100644
--- a/test/lib/completions/ri.exp
+++ b/test/lib/completions/ri.exp
@@ -11,7 +11,7 @@ proc teardown {} {
setup
-assert_complete_any "ri "
+assert_complete_any "ri RI"
sync_after_int
diff --git a/test/lib/completions/route.exp b/test/lib/completions/route.exp
new file mode 100644
index 00000000..76e1b5e0
--- /dev/null
+++ b/test/lib/completions/route.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "route "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/rpm2tgz.exp b/test/lib/completions/rpm2tgz.exp
new file mode 100644
index 00000000..eb597982
--- /dev/null
+++ b/test/lib/completions/rpm2tgz.exp
@@ -0,0 +1,31 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified {/OLDPWD=/d}
+}
+
+
+setup
+
+
+assert_complete_any "rpm2tgz -"
+
+
+sync_after_int
+
+
+set test "should complete *.rpm files and dirs"
+set dir $::srcdir/fixtures/slackware/home
+set files [split [exec bash -c "cd $dir && find . -mindepth 1 -maxdepth 1 \
+ \\( -type d -printf '%P/\\n' \\) -o \
+ \\( -type f -name '*.rpm' -printf '%P\\n' \\)"] "\n"]
+assert_complete_dir $files "rpm2tgz " $dir $test
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/rpmbuild.exp b/test/lib/completions/rpmbuild.exp
new file mode 100644
index 00000000..4058d722
--- /dev/null
+++ b/test/lib/completions/rpmbuild.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "rpmbuild -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/rsync.exp b/test/lib/completions/rsync.exp
index 221d090b..42b7af8e 100644
--- a/test/lib/completions/rsync.exp
+++ b/test/lib/completions/rsync.exp
@@ -12,8 +12,14 @@ setup
assert_complete_any "rsync "
+sync_after_int
+
+
+assert_complete "rsh ssh" "rsync --rsh "
+sync_after_int
+assert_complete "rsh ssh" "rsync --rsh="
sync_after_int
diff --git a/test/lib/completions/sbopkg.exp b/test/lib/completions/sbopkg.exp
new file mode 100644
index 00000000..c4dbfe26
--- /dev/null
+++ b/test/lib/completions/sbopkg.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "sbopkg -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/scp.exp b/test/lib/completions/scp.exp
index e6cbf8e3..7cc6eb07 100644
--- a/test/lib/completions/scp.exp
+++ b/test/lib/completions/scp.exp
@@ -24,7 +24,7 @@ set host bash_completion
# Retrieving home directory (host_pwd) from ssh-host `bash_completion'
# yields error?
-if {
+if {
[catch {
exec -- ssh -o "Batchmode yes" -o "ConnectTimeout 1" $host pwd 2>> /dev/null
} host_pwd]
@@ -64,7 +64,7 @@ foreach host [get_hosts] {
lappend expected blah: doo: gee: hus: ike:
# Append local filenames
lappend expected config known_hosts "spaced\\ \\ conf"
-assert_complete $expected "scp -F config "
+assert_complete $expected "scp -F config " $test
sync_after_int
@@ -104,11 +104,8 @@ if {[match_items [lsort -unique $expected] -bash-sort]} {
expect {
-re /@ { pass "$test" }
-re eof { unresolved "eof" }
+ default { fail "$test" }
}
-} else {
- # Expected failure (known bug) because of bash-4 bug in quoted words:
- # http://www.mail-archive.com/bug-bash@gnu.org/msg06095.html
- if {[lindex $::BASH_VERSINFO 0] >= 4} {xfail "$test"} {fail "$test"}
}
sync_after_int
assert_bash_exec {cd "$TESTDIR"}
diff --git a/test/lib/completions/screen.exp b/test/lib/completions/screen.exp
index e5bc4c15..5e585179 100644
--- a/test/lib/completions/screen.exp
+++ b/test/lib/completions/screen.exp
@@ -12,15 +12,19 @@ setup
assert_complete_any "screen -"
-
-
sync_after_int
assert_complete {bar "bar bar.d/" foo foo.d/} \
"screen -c $::srcdir/fixtures/shared/default/" "-c should complete files/dirs"
+sync_after_int
+
+
+assert_complete_any "screen cat"
+sync_after_int
+assert_complete_any "screen -T foo cat"
sync_after_int
diff --git a/test/lib/completions/sdptool.exp b/test/lib/completions/sdptool.exp
new file mode 100644
index 00000000..c46a1fa2
--- /dev/null
+++ b/test/lib/completions/sdptool.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "sdptool "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/setquota.exp b/test/lib/completions/setquota.exp
new file mode 100644
index 00000000..d169e1ad
--- /dev/null
+++ b/test/lib/completions/setquota.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "setquota "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/slackpkg.exp b/test/lib/completions/slackpkg.exp
new file mode 100644
index 00000000..150f03fc
--- /dev/null
+++ b/test/lib/completions/slackpkg.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "slackpkg -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/slapt-get.exp b/test/lib/completions/slapt-get.exp
new file mode 100644
index 00000000..70afc666
--- /dev/null
+++ b/test/lib/completions/slapt-get.exp
@@ -0,0 +1,46 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "slapt-get -"
+
+
+sync_after_int
+
+
+set test "--up<TAB> should complete \"--update --upgrade\""
+assert_complete "--update --upgrade" "slapt-get --up" $test
+
+
+sync_after_int
+
+
+
+set test "--install should complete available packages"
+set config $::srcdir/fixtures/slackware/etc/slapt-get/slapt-getrc
+set workdir [file normalize $::srcdir/fixtures/slackware/var/slapt-get/]
+set pkg_data "$workdir/package_data"
+# write simple config
+set f [open $config w]
+puts $f "WORKINGDIR=$workdir"
+puts $f "SOURCE=file:///home/"
+close $f
+set packages [split [exec bash -c "sed -n \
+ '/^PACKAGE NAME:/{s/^PACKAGE NAME: \\{1,\\}\\(.*\\).t\[gbxl\]z/\\1/;p}' \
+ $pkg_data"] "\n"]
+assert_complete $packages "slapt-get -c $config --install " $test
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/slapt-src.exp b/test/lib/completions/slapt-src.exp
new file mode 100644
index 00000000..9410f9c1
--- /dev/null
+++ b/test/lib/completions/slapt-src.exp
@@ -0,0 +1,49 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "slapt-src -"
+
+
+sync_after_int
+
+
+set test "--bu<TAB> should complete \"--build\""
+assert_complete "--build" "slapt-src --bu" $test
+
+
+sync_after_int
+
+
+set test "--ins<TAB> should complete \"--install\""
+assert_complete "--install" "slapt-src --ins" $test
+
+
+sync_after_int
+
+
+set test "--install should complete available packages"
+set config $::srcdir/fixtures/slackware/etc/slapt-get/slapt-srcrc
+set workdir [file normalize $::srcdir/fixtures/slackware/usr/src/slapt-src/]
+set slb_data "$workdir/slackbuilds_data"
+set f [open $config w]; puts $f "BUILDDIR=$workdir"; close $f
+set slackbuilds [split [exec bash -c "sed -n \
+ -e '/^SLACKBUILD NAME: /{s/^SLACKBUILD NAME: \\{1,\\}//;p}' \
+ -e '/^SLACKBUILD VERSION: /{s/^SLACKBUILD VERSION: \\{1,\\}//;p}' \
+ $slb_data | sed -e 'N;s/\\n/:/'"] "\n"]
+assert_complete $slackbuilds "slapt-src --config $config --install " $test
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/smbcacls.exp b/test/lib/completions/smbcacls.exp
new file mode 100644
index 00000000..d501f825
--- /dev/null
+++ b/test/lib/completions/smbcacls.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "smbcacls -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/smbclient.exp b/test/lib/completions/smbclient.exp
new file mode 100644
index 00000000..0fb8e2da
--- /dev/null
+++ b/test/lib/completions/smbclient.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "smbclient -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/smbcquotas.exp b/test/lib/completions/smbcquotas.exp
new file mode 100644
index 00000000..24be2f60
--- /dev/null
+++ b/test/lib/completions/smbcquotas.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "smbcquotas -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/smbget.exp b/test/lib/completions/smbget.exp
new file mode 100644
index 00000000..938cd0e5
--- /dev/null
+++ b/test/lib/completions/smbget.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "smbget -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/smbpasswd.exp b/test/lib/completions/smbpasswd.exp
new file mode 100644
index 00000000..b6e86bbc
--- /dev/null
+++ b/test/lib/completions/smbpasswd.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "smbpasswd -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/smbtar.exp b/test/lib/completions/smbtar.exp
new file mode 100644
index 00000000..e0d58f5f
--- /dev/null
+++ b/test/lib/completions/smbtar.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "smbtar -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/smbtree.exp b/test/lib/completions/smbtree.exp
new file mode 100644
index 00000000..b234e443
--- /dev/null
+++ b/test/lib/completions/smbtree.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "smbtree -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/ssh-copy-id.exp b/test/lib/completions/ssh-copy-id.exp
new file mode 100644
index 00000000..e8b643fd
--- /dev/null
+++ b/test/lib/completions/ssh-copy-id.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "ssh-copy-id -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/stream.exp b/test/lib/completions/stream.exp
new file mode 100644
index 00000000..8cbda602
--- /dev/null
+++ b/test/lib/completions/stream.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "stream "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/sudo.exp b/test/lib/completions/sudo.exp
index d6bbbbb6..6108ddce 100644
--- a/test/lib/completions/sudo.exp
+++ b/test/lib/completions/sudo.exp
@@ -24,4 +24,63 @@ assert_complete_dir fixtures/ "sudo sh fix" $::srcdir "" -nospace
sync_after_int
+# test that `mount` and `sudo mount` behave the same way
+set test "sudo mount /dev/sda1 def should complete directory name"
+assert_complete_dir "default/" "sudo mount /dev/sda1 def" $::srcdir/fixtures/shared $test -nospace
+
+
+sync_after_int
+
+
+# Find user/group suitable for testing.
+set failed_find_unique_completion 0
+foreach ug {user group} {
+ # compgen -A is used because it's a bash builtin and available everywhere.
+ # The || true part prevents exec from throwing an exception if nothing is
+ # found (very very unlikely).
+ set list [split [exec bash -c "compgen -A $ug || true"] "\n"]
+ if {![find_unique_completion_pair $list part$ug full$ug]} {
+ untested "Not running complex chown tests; no suitable test $ug found."
+ set failed_find_unique_completion 1
+ }
+}
+
+# These tests require an unique completion.
+if {!$failed_find_unique_completion} {
+ assert_complete $fulluser "sudo chown $partuser"
+ sync_after_int
+
+ assert_complete $fulluser:$fullgroup "sudo chown $fulluser:$partgroup"
+ sync_after_int
+
+ assert_complete "dot.user:$fullgroup" "sudo chown dot.user:$partgroup"
+ sync_after_int
+
+ foreach prefix {
+ "funky\\ user:" "funky.user:" "funky\\.user:" "fu\\ nky.user:"
+ "f\\ o\\ o\\.\\bar:" "foo\\_b\\ a\\.r\\ :"
+ } {
+ set test "Check preserve special chars in $prefix$partgroup<TAB>"
+ #assert_complete_into "chown $prefix$partgroup" "chown $prefix$fullgroup " $test
+ assert_complete $prefix$fullgroup "sudo chown $prefix$partgroup" $test
+ sync_after_int
+ }
+
+ # Check that we give up in degenerate cases instead of spewing various junk.
+
+ assert_no_complete "sudo chown $fulluser\\\\:$partgroup"
+ sync_after_int
+
+ assert_no_complete "sudo chown $fulluser\\\\\\:$partgroup"
+ sync_after_int
+
+ assert_no_complete "sudo chown $fulluser\\\\\\\\:$partgroup"
+ sync_after_int
+
+ # Colons in user/groupnames are not usually allowed.
+ assert_no_complete "sudo chown foo:bar:$partgroup"
+ sync_after_int
+}
+
+
teardown
diff --git a/test/lib/completions/tcpdump.exp b/test/lib/completions/tcpdump.exp
new file mode 100644
index 00000000..79158abf
--- /dev/null
+++ b/test/lib/completions/tcpdump.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "tcpdump -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/time.exp b/test/lib/completions/time.exp
index 3bed4fdf..d052458c 100644
--- a/test/lib/completions/time.exp
+++ b/test/lib/completions/time.exp
@@ -4,7 +4,7 @@ proc setup {} {
proc teardown {} {
- assert_env_unmodified
+ assert_env_unmodified {/OLDPWD=/d}
}
@@ -17,4 +17,20 @@ assert_complete_any "time set"
sync_after_int
+set test "-p find -typ should complete find's options"
+assert_complete "-type" "time -p find -typ" $test
+
+
+sync_after_int
+
+
+set test "it should be possible to complete file paths"
+set dir $::srcdir/fixtures/shared
+set files [split [exec bash -c "cd $dir/bin && ls -p"] "\n"]
+assert_complete_dir $files "time ./bin/" $dir $test
+
+
+sync_after_int
+
+
teardown
diff --git a/test/lib/completions/tracepath.exp b/test/lib/completions/tracepath.exp
new file mode 100644
index 00000000..33b32567
--- /dev/null
+++ b/test/lib/completions/tracepath.exp
@@ -0,0 +1,21 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "tracepath "
+sync_after_int
+
+assert_complete_any "tracepath -"
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/upgradepkg.exp b/test/lib/completions/upgradepkg.exp
new file mode 100644
index 00000000..860dde9e
--- /dev/null
+++ b/test/lib/completions/upgradepkg.exp
@@ -0,0 +1,39 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified {/OLDPWD=/d}
+}
+
+
+setup
+
+
+assert_complete_any "upgradepkg -"
+
+
+sync_after_int
+
+
+set test "--<TAB> should complete all long options"
+set options [list --dry-run --install-new --reinstall --verbose]
+assert_complete $options "upgradepkg --" $test
+
+
+sync_after_int
+
+
+set test "should complete *.t\[gbxl\]z files and dirs"
+set dir $::srcdir/fixtures/slackware/home
+set files [split [exec bash -c "cd $dir && find . -mindepth 1 -maxdepth 1 \
+ \\( -type d -printf '%P/\\n' \\) -o \
+ \\( -type f -name '*.t\[bglx\]z' -printf '%P\\n' \\)"] "\n"]
+assert_complete_dir $files "upgradepkg " $dir $test
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/vgcfgbackup.exp b/test/lib/completions/vgcfgbackup.exp
index b7e509a2..14162ee0 100644
--- a/test/lib/completions/vgcfgbackup.exp
+++ b/test/lib/completions/vgcfgbackup.exp
@@ -11,7 +11,9 @@ proc teardown {} {
setup
-assert_complete_any "vgcfgbackup -"
+if {[assert_exec {vgcfgbackup --help} "" "" "untested"]} { # may fail as non-root
+ assert_complete_any "vgcfgbackup -"
+}
sync_after_int
diff --git a/test/lib/completions/vgcfgrestore.exp b/test/lib/completions/vgcfgrestore.exp
index e40cd213..2cf5f1ca 100644
--- a/test/lib/completions/vgcfgrestore.exp
+++ b/test/lib/completions/vgcfgrestore.exp
@@ -11,7 +11,9 @@ proc teardown {} {
setup
-assert_complete_any "vgcfgrestore -"
+if {[assert_exec {vgcfgrestore --help} "" "" "untested"]} { # may fail as non-root
+ assert_complete_any "vgcfgrestore -"
+}
sync_after_int
diff --git a/test/lib/completions/vgck.exp b/test/lib/completions/vgck.exp
index b4d58aec..b2c86da8 100644
--- a/test/lib/completions/vgck.exp
+++ b/test/lib/completions/vgck.exp
@@ -11,7 +11,9 @@ proc teardown {} {
setup
-assert_complete_any "vgck -"
+if {[assert_exec {vgck --help} "" "" "untested"]} { # may fail as non-root
+ assert_complete_any "vgck -"
+}
sync_after_int
diff --git a/test/lib/completions/vgconvert.exp b/test/lib/completions/vgconvert.exp
index 362c44b6..f432229e 100644
--- a/test/lib/completions/vgconvert.exp
+++ b/test/lib/completions/vgconvert.exp
@@ -11,7 +11,9 @@ proc teardown {} {
setup
-assert_complete_any "vgconvert -"
+if {[assert_exec {vgconvert --help} "" "" "untested"]} { # may fail as non-root
+ assert_complete_any "vgconvert -"
+}
sync_after_int
diff --git a/test/lib/completions/vgdisplay.exp b/test/lib/completions/vgdisplay.exp
index 6a8ed84d..5fd20596 100644
--- a/test/lib/completions/vgdisplay.exp
+++ b/test/lib/completions/vgdisplay.exp
@@ -11,7 +11,9 @@ proc teardown {} {
setup
-assert_complete_any "vgdisplay -"
+if {[assert_exec {vgdisplay --help} "" "" "untested"]} { # may fail as non-root
+ assert_complete_any "vgdisplay -"
+}
sync_after_int
diff --git a/test/lib/completions/vgexport.exp b/test/lib/completions/vgexport.exp
index 2900960f..e6e45d00 100644
--- a/test/lib/completions/vgexport.exp
+++ b/test/lib/completions/vgexport.exp
@@ -11,7 +11,9 @@ proc teardown {} {
setup
-assert_complete_any "vgexport -"
+if {[assert_exec {vgexport --help} "" "" "untested"]} { # may fail as non-root
+ assert_complete_any "vgexport -"
+}
sync_after_int
diff --git a/test/lib/completions/vgextend.exp b/test/lib/completions/vgextend.exp
index 3c46a8f0..18dc2016 100644
--- a/test/lib/completions/vgextend.exp
+++ b/test/lib/completions/vgextend.exp
@@ -11,7 +11,9 @@ proc teardown {} {
setup
-assert_complete_any "vgextend -"
+if {[assert_exec {vgextend --help} "" "" "untested"]} { # may fail as non-root
+ assert_complete_any "vgextend -"
+}
sync_after_int
diff --git a/test/lib/completions/vgimport.exp b/test/lib/completions/vgimport.exp
index ed04e282..f4c1f833 100644
--- a/test/lib/completions/vgimport.exp
+++ b/test/lib/completions/vgimport.exp
@@ -11,7 +11,9 @@ proc teardown {} {
setup
-assert_complete_any "vgimport -"
+if {[assert_exec {vgimport --help} "" "" "untested"]} { # may fail as non-root
+ assert_complete_any "vgimport -"
+}
sync_after_int
diff --git a/test/lib/completions/vgmerge.exp b/test/lib/completions/vgmerge.exp
index a4f8833b..a8366848 100644
--- a/test/lib/completions/vgmerge.exp
+++ b/test/lib/completions/vgmerge.exp
@@ -11,7 +11,9 @@ proc teardown {} {
setup
-assert_complete_any "vgmerge -"
+if {[assert_exec {vgmerge --help} "" "" "untested"]} { # may fail as non-root
+ assert_complete_any "vgmerge -"
+}
sync_after_int
diff --git a/test/lib/completions/vgmknodes.exp b/test/lib/completions/vgmknodes.exp
index 5c9feeb3..b8c3d57f 100644
--- a/test/lib/completions/vgmknodes.exp
+++ b/test/lib/completions/vgmknodes.exp
@@ -11,7 +11,9 @@ proc teardown {} {
setup
-assert_complete_any "vgmknodes -"
+if {[assert_exec {vgmknodes --help} "" "" "untested"]} { # may fail as non-root
+ assert_complete_any "vgmknodes -"
+}
sync_after_int
diff --git a/test/lib/completions/vgreduce.exp b/test/lib/completions/vgreduce.exp
index f6af3150..fc349680 100644
--- a/test/lib/completions/vgreduce.exp
+++ b/test/lib/completions/vgreduce.exp
@@ -11,7 +11,9 @@ proc teardown {} {
setup
-assert_complete_any "vgreduce -"
+if {[assert_exec {vgreduce --help} "" "" "untested"]} { # may fail as non-root
+ assert_complete_any "vgreduce -"
+}
sync_after_int
diff --git a/test/lib/completions/vgremove.exp b/test/lib/completions/vgremove.exp
index 0dc5eda8..0ec1011f 100644
--- a/test/lib/completions/vgremove.exp
+++ b/test/lib/completions/vgremove.exp
@@ -11,7 +11,9 @@ proc teardown {} {
setup
-assert_complete_any "vgremove -"
+if {[assert_exec {vgremove --help} "" "" "untested"]} { # may fail as non-root
+ assert_complete_any "vgremove -"
+}
sync_after_int
diff --git a/test/lib/completions/vgrename.exp b/test/lib/completions/vgrename.exp
index 81438631..62e7d3e6 100644
--- a/test/lib/completions/vgrename.exp
+++ b/test/lib/completions/vgrename.exp
@@ -11,7 +11,9 @@ proc teardown {} {
setup
-assert_complete_any "vgrename -"
+if {[assert_exec {vgrename --help} "" "" "untested"]} { # may fail as non-root
+ assert_complete_any "vgrename -"
+}
sync_after_int
diff --git a/test/lib/completions/vgs.exp b/test/lib/completions/vgs.exp
index 22ab176b..8a6cf650 100644
--- a/test/lib/completions/vgs.exp
+++ b/test/lib/completions/vgs.exp
@@ -11,7 +11,9 @@ proc teardown {} {
setup
-assert_complete_any "vgs -"
+if {[assert_exec {vgs --help} "" "" "untested"]} { # may fail as non-root
+ assert_complete_any "vgs -"
+}
sync_after_int
diff --git a/test/lib/completions/vgscan.exp b/test/lib/completions/vgscan.exp
index ae8168c8..a26838fc 100644
--- a/test/lib/completions/vgscan.exp
+++ b/test/lib/completions/vgscan.exp
@@ -11,7 +11,9 @@ proc teardown {} {
setup
-assert_complete_any "vgscan -"
+if {[assert_exec {vgscan --help} "" "" "untested"]} { # may fail as non-root
+ assert_complete_any "vgscan -"
+}
sync_after_int
diff --git a/test/lib/completions/vipw.exp b/test/lib/completions/vipw.exp
new file mode 100644
index 00000000..c29ad9b1
--- /dev/null
+++ b/test/lib/completions/vipw.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "vipw -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/watch.exp b/test/lib/completions/watch.exp
new file mode 100644
index 00000000..02ae8f1b
--- /dev/null
+++ b/test/lib/completions/watch.exp
@@ -0,0 +1,18 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "watch -"
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/xgamma.exp b/test/lib/completions/xgamma.exp
new file mode 100644
index 00000000..c4c2228e
--- /dev/null
+++ b/test/lib/completions/xgamma.exp
@@ -0,0 +1,21 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+set test "-gam<TAB> should complete \"-gamma\""
+assert_complete "-gamma" "xgamma -gam" $test
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/xhost.exp b/test/lib/completions/xhost.exp
index 82e2e9c6..02aa4cb2 100644
--- a/test/lib/completions/xhost.exp
+++ b/test/lib/completions/xhost.exp
@@ -30,7 +30,7 @@ foreach h [get_hosts] {
lappend hosts $h
}
}
-assert_complete $hosts "xhost $char" $test
+assert_complete $hosts "xhost $char" $test -expect-cmd-minus "$char"
sync_after_int
@@ -58,7 +58,7 @@ foreach h [get_hosts] {
lappend hosts "+$h"
}
}
-assert_complete $hosts "xhost +$char"
+assert_complete $hosts "xhost +$char" $test -expect-cmd-minus "\+$char"
sync_after_int
@@ -86,7 +86,7 @@ foreach h [get_hosts] {
lappend hosts "-$h"
}
}
-assert_complete $hosts "xhost -$char" $test
+assert_complete $hosts "xhost -$char" $test -expect-cmd-minus "-$char"
sync_after_int
diff --git a/test/lib/completions/xvnc4viewer.exp b/test/lib/completions/xvnc4viewer.exp
index b10e272c..6432ed25 100644
--- a/test/lib/completions/xvnc4viewer.exp
+++ b/test/lib/completions/xvnc4viewer.exp
@@ -22,7 +22,7 @@ set options {
-via -ViewOnly -WMDecorationHeight -WMDecorationWidth
-ZlibLevel
}
-assert_complete $options {vncviewer -}
+assert_complete $options {vncviewer -} $test
sync_after_int
diff --git a/test/lib/completions/xzdec.exp b/test/lib/completions/xzdec.exp
new file mode 100644
index 00000000..578cba7d
--- /dev/null
+++ b/test/lib/completions/xzdec.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "xzdec "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/library.exp b/test/lib/library.exp
index 491da212..f6e9f21a 100644
--- a/test/lib/library.exp
+++ b/test/lib/library.exp
@@ -155,8 +155,6 @@ proc assert_bash_list_dir {expected cmd dir test {args {}}} {
# - the last whitespace is escaped, e.g. "finger foo\ " or "finger
# 'foo "
#
-# If the entire $cmd is expected, specify `-expect-cmd-full'.
-#
# @param list $expected Expected completions.
# @param string $cmd Command given to generate items
# @param string $test Test title
@@ -168,12 +166,6 @@ proc assert_bash_list_dir {expected cmd dir test {args {}}} {
# Valid only if a single completion is expected.
# -ltrim-colon-completions Left-trim completions with cword containing
# colon (:)
-# -expect-cmd-full Expect the full $cmd to be echoed. Expected is:
-#
-# $cmd<TAB>\n
-# $expected\n
-# $prompt + $cmd + longest-common-prefix-of-$expected
-#
# -expect-cmd-minus DWORD Expect $cmd minus DWORD to be echoed.
# Expected is:
#
@@ -188,7 +180,6 @@ proc assert_complete {expected cmd {test ""} {args {}}} {
{chunk-size.arg 20 "compare N list items at a time"}
{nospace "don't expect space after completion"}
{ltrim-colon-completions "left-trim completions with cword containing :"}
- {expect-cmd-full "Expect full cmd after prompt"}
{expect-cmd-minus.arg "" "Expect cmd minus DWORD after prompt"}
}]
if {[llength $expected] == 0} {
@@ -210,7 +201,6 @@ proc assert_complete_many {expected cmd {test ""} {args {}}} {
{chunk-size.arg 20 "compare N list items at a time"}
{nospace "don't expect space after completion"}
{ltrim-colon-completions "left-trim completions with cword containing :"}
- {expect-cmd-full "Expect full cmd after prompt"}
{expect-cmd-minus.arg "" "Expect cmd minus CWORD after prompt"}
}]
if {$test == ""} {set test "$cmd should show completions"}
@@ -256,7 +246,6 @@ proc assert_complete_one {expected cmd {test ""} {args {}}} {
{chunk-size.arg 20 "compare N list items at a time"}
{nospace "don't expect space after completion"}
{ltrim-colon-completions "left-trim completions with cword containing :"}
- {expect-cmd-full "Expect full cmd after prompt"}
{expect-cmd-minus.arg "" "Expect cmd minus CWORD after prompt"}
}]
set prompt $arg(prompt)
@@ -435,13 +424,9 @@ proc _ltrim_colon_completions {cmd items dword} {
set cur [lindex $words $index]
}
# If word-to-complete contains a colon,
- # and bash-version < 4,
- # or bash-version >= 4 and COMP_WORDBREAKS contains a colon
+ # and COMP_WORDBREAKS contains a colon
if {
- [string first : $cur] > -1 && (
- [lindex $::BASH_VERSINFO 0] < 4 ||
- ([lindex $::BASH_VERSINFO 0] >= 4 && [string first ":" $::COMP_WORDBREAKS] > -1)
- )
+ [string first : $cur] > -1 && [string first ":" $::COMP_WORDBREAKS] > -1
} {
set dword_out $cur
for {set i 0} {$i < [llength $items_out]} {incr i} {
@@ -595,12 +580,13 @@ proc assert_no_output {{cmd} {test ""} {prompt /@}} {
# Source/run file with additional tests if completion for the specified command
-# is installed in bash.
+# is installed in bash, and the command is available.
# @param string $command Command to check completion availability for.
# @param string $file (optional) File to source/run. Default is
# "lib/completions/$cmd.exp".
proc assert_source_completions {command {file ""}} {
- if {[is_bash_completion_installed_for $command]} {
+ if {[assert_bash_type $command]
+ && [is_bash_completion_installed_for $command]} {
if {[string length $file] == 0} {
set file "$::srcdir/lib/completions/$command.exp"
}
@@ -633,10 +619,17 @@ proc get_known_hosts {{cword ''}} {
# Get hostnames
+# @param list $args Options:
+# -unsorted Do not sort unique. Default is sort unique.
# @return list Hostnames
# @see get_known_hosts()
-proc get_hosts {} {
- set hosts [exec bash -c "compgen -A hostname | sort -u"]
+proc get_hosts {{args {}}} {
+ array set arg [::cmdline::getoptions args {
+ {unsorted "do not sort unique"}
+ }]
+ set sort "| sort -u"
+ if {$arg(unsorted)} {set sort ""}
+ set hosts [exec bash -c "compgen -A hostname $sort"]
# NOTE: Circumventing var `avahi_hosts' and appending directly to `hosts'
# causes an empty element to be inserted in `hosts'.
# -- FVu, Fri Jul 17 23:11:46 CEST 2009
@@ -667,8 +660,9 @@ proc get_hosts_avahi {} {
# Get signals
# This function is written in analogy to the bash function `_signals()' in
# `bash_completion'.
+# @param prefix
# @return list Signals starting with `SIG', but with the `SIG' prefix removed.
-proc get_signals {} {
+proc get_signals {{prefix ""}} {
set signals {}
foreach signal [exec bash -c {compgen -A signal}] {
# Does signal start with `SIG'?
@@ -676,7 +670,7 @@ proc get_signals {} {
# Remove `SIG' prefix
set signal [string range $signal 3 end]
# Add signal (with dash (-) prefix) to list
- lappend signals -$signal
+ lappend signals $prefix$signal
}
}
return $signals
@@ -855,10 +849,8 @@ proc _save_env {{file ""}} {
# Source bash_completion package
proc source_bash_completion {} {
- assert_bash_exec {BASH_COMPLETION_DIR=$(cd "$SRCDIR/.."; pwd)/completions}
- assert_bash_exec {BASH_COMPLETION_COMPAT_DIR=$BASH_COMPLETION_DIR}
- assert_bash_exec {BASH_COMPLETION=$(cd "$SRCDIR/.."; pwd)/bash_completion}
- assert_bash_exec {source "$BASH_COMPLETION"}
+ assert_bash_exec {BASH_COMPLETION_COMPAT_DIR=$(cd "$SRCDIR/.."; pwd)/completions}
+ assert_bash_exec {source $(cd "$SRCDIR/.."; pwd)/bash_completion}
}
@@ -980,29 +972,17 @@ proc start_bash {} {
set env(SRCDIRABS) $::srcdirabs
exp_spawn $TOOL_EXECUTABLE --rcfile $::srcdir/config/bashrc
assert_bash_exec {} "$TOOL_EXECUTABLE --rcfile $::srcdir/config/bashrc"
- # Bash < 3.2.41 has a bug where 'history' disappears from SHELLOPTS
- # whenever a shopt setting is sourced or eval'ed. Disabling 'history'
- # makes it not show in tests "Environment should not be modified"
- # for bash < 3.2.41.
- # -- FVu, Tue Sep 15 22:52:00 CEST 2009
- assert_bash_exec {is_bash_version_minimal 3 2 41 || set +o history}
}
# Redirect xtrace output to a file.
#
# 'set -x' can be very useful for debugging but by default it writes to
-# stderr. Bash 4.1 has a feature to redirect this output to a random FD.
+# stderr.
#
# This function uses file descriptor 6. This will break if any completion
# tries to use the same descriptor.
proc init_bash_xtrace {{fname xtrace.log}} {
- global BASH_VERSINFO
- if {([lindex $BASH_VERSINFO 0] == 4 && [lindex $BASH_VERSINFO 1] < 1) ||
- [lindex $BASH_VERSINFO 0] < 4} {
- note "BASH_XTRACEFD not available in this version; no xtrace.log"
- return
- }
verbose "Enabling bash xtrace output to '$fname'"
assert_bash_exec "exec 6>'$fname'"
assert_bash_exec "BASH_XTRACEFD=6"
diff --git a/test/lib/library.sh b/test/lib/library.sh
index 98107dcb..290ec813 100644
--- a/test/lib/library.sh
+++ b/test/lib/library.sh
@@ -4,9 +4,7 @@
# @param $1 Char to add to $COMP_WORDBREAKS
# @see remove_comp_wordbreak_char()
add_comp_wordbreak_char() {
- if [ ${BASH_VERSINFO[0]} -ge 4 ]; then
- [[ "${COMP_WORDBREAKS//[^$1]}" ]] || COMP_WORDBREAKS=$COMP_WORDBREAKS$1
- fi
+ [[ "${COMP_WORDBREAKS//[^$1]}" ]] || COMP_WORDBREAKS+=$1
} # add_comp_wordbreak_char()
@@ -24,6 +22,8 @@ diff_env() {
/[<>] _=/d
# Remove PPID bash variable
/[<>] PPID=/d
+# Remove BASH_REMATCH bash variable
+ /[<>] BASH_REMATCH=/d
$3"
} # diff_env()
@@ -60,9 +60,7 @@ is_bash_version_minimal() {
# @param $1 Char to remove from $COMP_WORDBREAKS
# @see add_comp_wordbreak_char()
remove_comp_wordbreak_char() {
- if [ ${BASH_VERSINFO[0]} -ge 4 ]; then
- COMP_WORDBREAKS=${COMP_WORDBREAKS//$1}
- fi
+ COMP_WORDBREAKS=${COMP_WORDBREAKS//$1}
} # remove_comp_wordbreak_char()
diff --git a/test/unit/_filedir.exp b/test/unit/_filedir.exp
index de494084..0bba8314 100644
--- a/test/unit/_filedir.exp
+++ b/test/unit/_filedir.exp
@@ -124,120 +124,108 @@ foreach name {f f2} {
sync_after_int
- # NOTE: Bash versions 4.0.0 up to 4.0.34 contain a bug when completing quoted
- # words, so tests below aren't executed for these bash versions.
- if {! (
- [lindex $::BASH_VERSINFO 0] == 4 &&
- [lindex $::BASH_VERSINFO 1] == 0 &&
- [lindex $::BASH_VERSINFO 2] < 35
- )} {
- set cmd "$name 'ab/"
- assert_complete_dir {e'} $cmd "$::srcdir/fixtures/_filedir"
+ set cmd "$name 'ab/"
+ assert_complete_dir {e'} $cmd "$::srcdir/fixtures/_filedir"
- sync_after_int
+ sync_after_int
- set cmd "$name 'a b/"
- assert_complete_dir {i'} $cmd "$::srcdir/fixtures/_filedir"
+ set cmd "$name 'a b/"
+ assert_complete_dir {i'} $cmd "$::srcdir/fixtures/_filedir"
- sync_after_int
+ sync_after_int
- set cmd "$name 'a\"b/"; #"
- assert_complete_dir {d'} $cmd "$::srcdir/fixtures/_filedir"
+ set cmd "$name 'a\"b/"; #"
+ assert_complete_dir {d'} $cmd "$::srcdir/fixtures/_filedir"
- sync_after_int
+ sync_after_int
- set cmd "$name 'a\$b/"
- if {[lindex $::BASH_VERSINFO 0] == 4} {
- assert_complete_dir {h'} $cmd "$::srcdir/fixtures/_filedir"
- } else {
- assert_complete_dir "\b\b\b\b$::srcdirabs/fixtures/_filedir/a\$b/h'" $cmd "$::srcdir/fixtures/_filedir"
- }
+ set cmd "$name 'a\$b/"
+ assert_complete_dir {h'} $cmd "$::srcdir/fixtures/_filedir"
- sync_after_int
+ sync_after_int
- # Execute these tests only when not running on Cygwin/Windows, because
- # directories containing `*' or `\' aren't allowed on Cygwin/Windows
- if {! [is_cygwin]} {
- set cmd "$name '$TESTDIR/tmp/a\\b/"
- assert_complete_dir {g'} $cmd "$TESTDIR/tmp"
+ # Execute these tests only when not running on Cygwin/Windows, because
+ # directories containing `*' or `\' aren't allowed on Cygwin/Windows
+ if {! [is_cygwin]} {
+ set cmd "$name '$TESTDIR/tmp/a\\b/"
+ assert_complete_dir {g'} $cmd "$TESTDIR/tmp"
- sync_after_int
- }
+ sync_after_int
+ }
- set cmd "$name 'a&b/"
- assert_complete_dir {f'} $cmd "$::srcdir/fixtures/_filedir"
+ set cmd "$name 'a&b/"
+ assert_complete_dir {f'} $cmd "$::srcdir/fixtures/_filedir"
- sync_after_int
+ sync_after_int
- set cmd "$name \"ab/"; #"
- assert_complete_dir {e"} $cmd "$::srcdir/fixtures/_filedir"; #"
+ set cmd "$name \"ab/"; #"
+ assert_complete_dir {e"} $cmd "$::srcdir/fixtures/_filedir"; #"
- sync_after_int
+ sync_after_int
- set cmd "$name \"a b/"; #"
- assert_complete_dir {i"} $cmd "$::srcdir/fixtures/_filedir"; #"
+ set cmd "$name \"a b/"; #"
+ assert_complete_dir {i"} $cmd "$::srcdir/fixtures/_filedir"; #"
- sync_after_int
+ sync_after_int
- set cmd "$name \"a'b/"; #"
- assert_complete_dir {c"} $cmd "$::srcdir/fixtures/_filedir"; #"
+ set cmd "$name \"a'b/"; #"
+ assert_complete_dir {c"} $cmd "$::srcdir/fixtures/_filedir"; #"
- sync_after_int
+ sync_after_int
- set cmd "$name \"a\\\"b/"; #"
- assert_complete_dir {d"} $cmd "$::srcdir/fixtures/_filedir"; #"
+ set cmd "$name \"a\\\"b/"; #"
+ assert_complete_dir {d"} $cmd "$::srcdir/fixtures/_filedir"; #"
- sync_after_int
+ sync_after_int
- set cmd "$name \"a\\\$b/"; #"
- assert_complete_dir "\b\b\b\b\b$::srcdirabs/fixtures/_filedir/a\\\\\$b/h\\\"" $cmd "$::srcdir/fixtures/_filedir"
+ set cmd "$name \"a\\\$b/"; #"
+ assert_complete_dir "\b\b\b\b\b$::srcdirabs/fixtures/_filedir/a\\\\\$b/h\\\"" $cmd "$::srcdir/fixtures/_filedir"
- sync_after_int
+ sync_after_int
- set cmd "$name \"a\\b/"; #"
- assert_complete_dir "\b\b\bb/e\\\"" $cmd "$::srcdir/fixtures/_filedir"
+ set cmd "$name \"a\\b/"; #"
+ assert_complete_dir "\b\b\bb/e\\\"" $cmd "$::srcdir/fixtures/_filedir"
- sync_after_int
+ sync_after_int
- set cmd "$name \"a\\\\b/"; #"
- assert_complete_dir {g"} $cmd "$TESTDIR/tmp"; #"
+ set cmd "$name \"a\\\\b/"; #"
+ assert_complete_dir {g"} $cmd "$TESTDIR/tmp"; #"
- sync_after_int
+ sync_after_int
- set cmd "$name \"a&b/"; #"
- assert_complete_dir {f"} $cmd "$::srcdir/fixtures/_filedir"; #"
+ set cmd "$name \"a&b/"; #"
+ assert_complete_dir {f"} $cmd "$::srcdir/fixtures/_filedir"; #"
- sync_after_int
+ sync_after_int
- }; # if 4.0.0 < bash-version > 4.0.34
}; # foreach
@@ -249,13 +237,12 @@ sync_after_int
set test "completing f aƩ should return g"
-# Execute this test only on bash >= 4 with LC_CTYPE matching *UTF-8*
+# Execute this test only with LC_CTYPE matching *UTF-8*
# See also: http://www.mail-archive.com/bash-completion-devel\
# @lists.alioth.debian.org/msg02265.html
# Don't execute this test on expect-5.44 cause it will segfault
# See also: Alioth #312792
if {
- [lindex $::BASH_VERSINFO 0] >= 4 &&
[string first "UTF-8" $::LC_CTYPE] != -1 &&
[string first 5.44 [exp_version]] != 0
} {
diff --git a/test/unit/_get_comp_words_by_ref.exp b/test/unit/_get_comp_words_by_ref.exp
index 2ddcef23..f5c7ab38 100644
--- a/test/unit/_get_comp_words_by_ref.exp
+++ b/test/unit/_get_comp_words_by_ref.exp
@@ -48,6 +48,33 @@ assert_bash_list {" a"} $cmd $test
sync_after_int
+set test "|a"; # | = cursor position
+set cmd {COMP_WORDS=(a); COMP_CWORD=0; COMP_LINE='a'; COMP_POINT=0; \
+ unset cur prev; _get_comp_words_by_ref cur prev; echo "$cur $prev"}
+assert_bash_list {" "} $cmd $test
+
+
+sync_after_int
+
+
+set test "|a \$"; # | = cursor position
+set cmd {COMP_WORDS=(a); COMP_CWORD=0; COMP_LINE='a '; COMP_POINT=0; \
+ unset cur prev; _get_comp_words_by_ref cur prev; echo "$cur $prev"}
+assert_bash_list {" "} $cmd $test
+
+
+sync_after_int
+
+
+set test " | a \$"; # | = cursor position
+set cmd {COMP_WORDS=(a); COMP_CWORD=0; COMP_LINE=' a '; COMP_POINT=1; \
+ unset cur prev; _get_comp_words_by_ref cur prev; echo "$cur $prev"}
+assert_bash_list {" "} $cmd $test
+
+
+sync_after_int
+
+
set test "a b |"; # | = cursor position
set cmd {COMP_WORDS=(a b ''); COMP_CWORD=2; COMP_LINE='a b '; COMP_POINT=4; _get_comp_words_by_ref cur prev; echo "$cur $prev"}
assert_bash_list {" b"} $cmd $test
@@ -72,6 +99,14 @@ assert_bash_list {"b a"} $cmd $test
sync_after_int
+set test "a | b"; # | = cursor position
+set cmd {COMP_WORDS=(a b); COMP_CWORD=1; COMP_LINE='a b'; COMP_POINT=2; _get_comp_words_by_ref cur prev; echo "$cur $prev"}
+assert_bash_list {" a"} $cmd $test
+
+
+sync_after_int
+
+
set test {a b\ c| should return b\ c}; # | = cursor position
set cmd {COMP_WORDS=(a 'b\ c'); COMP_CWORD=1; COMP_LINE='a b\ c'; COMP_POINT=6; _get_comp_words_by_ref cur prev; echo "$cur $prev"}
assert_bash_list {"b\\ c a"} $cmd $test
@@ -97,27 +132,13 @@ sync_after_int
set test {a 'b c|}; # | = cursor position
-if {
- [lindex $::BASH_VERSINFO 0] == 4 &&
- [lindex $::BASH_VERSINFO 1] == 0 &&
- [lindex $::BASH_VERSINFO 2] < 35
-} {
- set cmd {COMP_WORDS=(a "'" b c); COMP_CWORD=3}
-} else {
- set cmd {COMP_WORDS=(a "'b c"); COMP_CWORD=1}
-}
+set cmd {COMP_WORDS=(a "'b c"); COMP_CWORD=1}
append cmd {; COMP_LINE="a 'b c"; COMP_POINT=6; _get_comp_words_by_ref cur prev; echo "$cur $prev"}
send "$cmd\r"
expect -ex "$cmd\r\n"
expect {
-ex "'b c a\r\n/@" { pass "$test" }
- -ex "c b\r\n/@" {
- if {
- [lindex $::BASH_VERSINFO 0] == 4 &&
- [lindex $::BASH_VERSINFO 1] == 0 &&
- [lindex $::BASH_VERSINFO 2] < 35
- } {xfail "$test"} {fail "$test"}
- }
+ -ex "c b\r\n/@" { fail "$test" }
}
@@ -125,15 +146,7 @@ sync_after_int
set test {a "b c|}; #"# | = cursor position
-if {
- [lindex $::BASH_VERSINFO 0] == 4 &&
- [lindex $::BASH_VERSINFO 1] == 0 &&
- [lindex $::BASH_VERSINFO 2] < 35
-} {
- set cmd {COMP_WORDS=(a "\"" b c); COMP_CWORD=3}
-} else {
- set cmd {COMP_WORDS=(a "\"b c"); COMP_CWORD=1}
-}
+set cmd {COMP_WORDS=(a "\"b c"); COMP_CWORD=1}
append cmd {; COMP_LINE="a \"b c"; COMP_POINT=6}
assert_bash_exec $cmd
set cmd {_get_comp_words_by_ref cur prev; echo "$cur $prev"};
@@ -141,13 +154,7 @@ send "$cmd\r"
expect -ex "$cmd\r\n"
expect {
-ex "\"b c a\r\n/@" { pass "$test" }
- -ex "c b\r\n/@" {
- if {
- [lindex $::BASH_VERSINFO 0] == 4 &&
- [lindex $::BASH_VERSINFO 1] == 0 &&
- [lindex $::BASH_VERSINFO 2] < 35
- } {xfail "$test"} {fail "$test"}
- }
+ -ex "c b\r\n/@" { fail "$test" }
}
@@ -155,13 +162,8 @@ sync_after_int
set test {a b:c| with WORDBREAKS += :}; # | = cursor position
-if {[lindex $::BASH_VERSINFO 0] <= 3} {
- set cmd {COMP_WORDS=(a "b:c"); COMP_CWORD=1}
- set expected {"b:c a"}
-} else {
- set cmd {add_comp_wordbreak_char :; COMP_WORDS=(a b : c); COMP_CWORD=3}
- set expected {"c :"}
-}
+set cmd {add_comp_wordbreak_char :; COMP_WORDS=(a b : c); COMP_CWORD=3}
+set expected {"c :"}
append cmd {; COMP_LINE='a b:c'; COMP_POINT=5}
# NOTE: Split-send cmd to prevent backspaces (\008) in output
assert_bash_exec $cmd $test
@@ -173,11 +175,7 @@ sync_after_int
set test {a b:c| with WORDBREAKS -= :}; # | = cursor position
-if {[lindex $::BASH_VERSINFO 0] <= 3} {
- set cmd {COMP_WORDS=(a "b:c"); COMP_CWORD=1}
-} else {
- set cmd {COMP_WORDS=(a b : c); COMP_CWORD=3}
-}
+set cmd {COMP_WORDS=(a b : c); COMP_CWORD=3}
append cmd {; COMP_LINE='a b:c'; COMP_POINT=5}
assert_bash_exec $cmd $test
set cmd {_get_comp_words_by_ref -n : cur prev; echo "$cur $prev"}
@@ -188,11 +186,7 @@ sync_after_int
set test {a b c:| with WORDBREAKS -= :}; # | = cursor position
-if {[lindex $::BASH_VERSINFO 0] <= 3} {
- set cmd {COMP_WORDS=(a b c:); COMP_CWORD=2}
-} else {
- set cmd {COMP_WORDS=(a b c :); COMP_CWORD=3}
-}
+set cmd {COMP_WORDS=(a b c :); COMP_CWORD=3}
append cmd {; COMP_LINE='a b c:'; COMP_POINT=6}
assert_bash_exec $cmd $test
set cmd {_get_comp_words_by_ref -n : cur prev; echo "$cur $prev"}
@@ -203,11 +197,7 @@ sync_after_int
set test {a b:c | with WORDBREAKS -= :}; # | = cursor position
-if {[lindex $::BASH_VERSINFO 0] <= 3} {
- set cmd {COMP_WORDS=(a b:c ''); COMP_CWORD=2}
-} else {
- set cmd {COMP_WORDS=(a b : c ''); COMP_CWORD=4}
-}
+set cmd {COMP_WORDS=(a b : c ''); COMP_CWORD=4}
append cmd {; COMP_LINE='a b:c '; COMP_POINT=6}
assert_bash_exec $cmd $test
set cmd {_get_comp_words_by_ref -n : cur prev; echo "$cur $prev"}
@@ -228,11 +218,7 @@ sync_after_int
set test {a b::| with WORDBREAKS -= : should return b::}; # | = cursor position
-if {[lindex $::BASH_VERSINFO 0] <= 3} {
- set cmd {COMP_WORDS=(a "b::"); COMP_CWORD=1}
-} else {
- set cmd {COMP_WORDS=(a b ::); COMP_CWORD=2}
-}
+set cmd {COMP_WORDS=(a b ::); COMP_CWORD=2}
append cmd {; COMP_LINE='a b::'; COMP_POINT=5}
assert_bash_exec $cmd
set cmd {_get_comp_words_by_ref -n : cur prev; echo "$cur $prev"}
@@ -264,14 +250,9 @@ assert_bash_list c $cmd $test
sync_after_int
-set test {a b=c| should return b=c (bash-3) or c (bash-4)}; # | = cursor position
-if {[lindex $::BASH_VERSINFO] <= 3} {
- set cmd {COMP_WORDS=(a "b=c"); COMP_CWORD=1}
- set expected b=c
-} else {
- set cmd {COMP_WORDS=(a b = c); COMP_CWORD=3}
- set expected c
-}
+set test {a b=c| should return c}; # | = cursor position
+set cmd {COMP_WORDS=(a b = c); COMP_CWORD=3}
+set expected c
append cmd {; COMP_LINE='a b=c'; COMP_POINT=5}
assert_bash_exec $cmd
set cmd {_get_comp_words_by_ref cur prev; echo "$cur"}
@@ -325,15 +306,7 @@ sync_after_int
set test {a 'b&c| should return 'b&c}; # | = cursor position
-if {
- [lindex $::BASH_VERSINFO 0] == 4 &&
- [lindex $::BASH_VERSINFO 1] == 0 &&
- [lindex $::BASH_VERSINFO 2] < 35
-} {
- set cmd {COMP_WORDS=(a "'" b "&" c); COMP_CWORD=4}
-} else {
- set cmd {COMP_WORDS=(a "'b&c"); COMP_CWORD=1}
-}
+set cmd {COMP_WORDS=(a "'b&c"); COMP_CWORD=1}
append cmd {; COMP_LINE="a 'b&c"; COMP_POINT=6}
assert_bash_exec $cmd
set cmd {_get_comp_words_by_ref cur prev; printf %s "$cur"}
@@ -341,13 +314,7 @@ send "$cmd\r"
expect -ex "$cmd\r\n"
expect {
-ex "'b&c/@" { pass "$test" }
- -ex "c/@" {
- if {
- [lindex $::BASH_VERSINFO 0] == 4 &&
- [lindex $::BASH_VERSINFO 1] == 0 &&
- [lindex $::BASH_VERSINFO 2] < 35
- } {xfail "$test"} {fail "$test"}
- }
+ -ex "c/@" { fail "$test" }
}
@@ -398,4 +365,47 @@ assert_bash_list {"b a a b 1"} $cmd $test
sync_after_int
+set test {a b : c| with WORDBREAKS -= :}; # | = cursor position
+set cmd {COMP_WORDS=(a b : c); COMP_CWORD=3; COMP_LINE='a b : c'; COMP_POINT=7}
+assert_bash_exec $cmd $test
+set cmd {_get_comp_words_by_ref -n : words; echo "${words[@]}"}
+assert_bash_list {"a b : c"} $cmd $test
+
+
+sync_after_int
+
+
+set test {a b: c| with WORDBREAKS -= :}; # | = cursor position
+set cmd {COMP_WORDS=(a b : c); COMP_CWORD=3}
+append cmd {; COMP_LINE='a b: c'; COMP_POINT=6}
+assert_bash_exec $cmd $test
+set cmd {_get_comp_words_by_ref -n : words; echo "${words[@]}"}
+assert_bash_list {"a b: c"} $cmd $test
+
+
+sync_after_int
+
+
+set test {a b :c| with WORDBREAKS -= :}; # | = cursor position
+set cmd {COMP_WORDS=(a b : c); COMP_CWORD=3}
+append cmd {; COMP_LINE='a b :c'; COMP_POINT=6}
+assert_bash_exec $cmd $test
+set cmd {_get_comp_words_by_ref -n : words; echo "${words[@]}"}
+assert_bash_list {"a b :c"} $cmd $test
+
+
+sync_after_int
+
+
+set test {a b\ :c| with WORDBREAKS -= :}; # | = cursor position
+set cmd {COMP_WORDS=(a "b\\ " : c); COMP_CWORD=3}
+append cmd {; COMP_LINE='a b\ :c'; COMP_POINT=7}
+assert_bash_exec $cmd $test
+set cmd {_get_comp_words_by_ref -n : words; echo "${words[@]}"}
+assert_bash_list {a "b\\ :c"} $cmd $test
+
+
+sync_after_int
+
+
teardown
diff --git a/test/unit/_get_cword.exp b/test/unit/_get_cword.exp
index ce749cec..3a582811 100644
--- a/test/unit/_get_cword.exp
+++ b/test/unit/_get_cword.exp
@@ -97,27 +97,13 @@ sync_after_int
set test {a 'b c| should return 'b c}; # | = cursor position
-if {
- [lindex $::BASH_VERSINFO 0] == 4 &&
- [lindex $::BASH_VERSINFO 1] == 0 &&
- [lindex $::BASH_VERSINFO 2] < 35
-} {
- set cmd {COMP_WORDS=(a "'" b c); COMP_CWORD=3}
-} else {
- set cmd {COMP_WORDS=(a "'b c"); COMP_CWORD=1}
-}
+set cmd {COMP_WORDS=(a "'b c"); COMP_CWORD=1}
append cmd {; COMP_LINE="a 'b c"; COMP_POINT=6; _get_cword}
send "$cmd\r"
expect -ex "$cmd\r\n"
expect {
-ex "'b c/@" { pass "$test" }
- -ex "c/@" {
- if {
- [lindex $::BASH_VERSINFO 0] == 4 &&
- [lindex $::BASH_VERSINFO 1] == 0 &&
- [lindex $::BASH_VERSINFO 2] < 35
- } {xfail "$test"} {fail "$test"}
- }
+ -ex "c/@" { fail "$test" }
}
@@ -125,41 +111,22 @@ sync_after_int
set test {a "b c| should return "b c}; # | = cursor position
-if {
- [lindex $::BASH_VERSINFO 0] == 4 &&
- [lindex $::BASH_VERSINFO 1] == 0 &&
- [lindex $::BASH_VERSINFO 2] < 35
-} {
- set cmd {COMP_WORDS=(a "\"" b c); COMP_CWORD=3}
-} else {
- set cmd {COMP_WORDS=(a "\"b c"); COMP_CWORD=1}
-}
+set cmd {COMP_WORDS=(a "\"b c"); COMP_CWORD=1}
append cmd {; COMP_LINE="a \"b c"; COMP_POINT=6; _get_cword};
send "$cmd\r"
expect -ex "$cmd\r\n"
expect {
-ex "\"b c/@" { pass "$test" }
- -ex "c/@" {
- if {
- [lindex $::BASH_VERSINFO 0] == 4 &&
- [lindex $::BASH_VERSINFO 1] == 0 &&
- [lindex $::BASH_VERSINFO 2] < 35
- } {xfail "$test"} {fail "$test"}
- }
+ -ex "c/@" { fail "$test" }
}
sync_after_int
-set test {a b:c| with WORDBREAKS += : should return b:c (bash-3) or c (bash-4)}; # | = cursor position
-if {[lindex $::BASH_VERSINFO 0] <= 3} {
- set cmd {COMP_WORDS=(a "b:c"); COMP_CWORD=1}
- set expected b:c
-} else {
- set cmd {add_comp_wordbreak_char :; COMP_WORDS=(a b : c); COMP_CWORD=3}
- set expected c
-}
+set test {a b:c| with WORDBREAKS += : should return c}; # | = cursor position
+set cmd {add_comp_wordbreak_char :; COMP_WORDS=(a b : c); COMP_CWORD=3}
+set expected c
append cmd {; COMP_LINE='a b:c'; COMP_POINT=5; _get_cword; echo}
assert_bash_list $expected $cmd $test
@@ -168,11 +135,7 @@ sync_after_int
set test {a b:c| with WORDBREAKS -= : should return b:c}; # | = cursor position
-if {[lindex $::BASH_VERSINFO 0] <= 3} {
- set cmd {COMP_WORDS=(a "b:c"); COMP_CWORD=1}
-} else {
- set cmd {COMP_WORDS=(a b : c); COMP_CWORD=3}
-}
+set cmd {COMP_WORDS=(a b : c); COMP_CWORD=3}
append cmd {; COMP_LINE='a b:c'; COMP_POINT=5; _get_cword :; echo}
assert_bash_list b:c $cmd $test
@@ -181,11 +144,7 @@ sync_after_int
set test {a b c:| with WORDBREAKS -= : should return c:}; # | = cursor position
-if {[lindex $::BASH_VERSINFO 0] <= 3} {
- set cmd {COMP_WORDS=(a b c:); COMP_CWORD=2}
-} else {
- set cmd {COMP_WORDS=(a b c :); COMP_CWORD=3}
-}
+set cmd {COMP_WORDS=(a b c :); COMP_CWORD=3}
append cmd {; COMP_LINE='a b c:'; COMP_POINT=6; _get_cword :; echo}
assert_bash_list c: $cmd $test
@@ -202,11 +161,7 @@ sync_after_int
set test {a b::| with WORDBREAKS -= : should return b::}; # | = cursor position
-if {[lindex $::BASH_VERSINFO 0] <= 3} {
- set cmd {COMP_WORDS=(a "b::"); COMP_CWORD=1}
-} else {
- set cmd {COMP_WORDS=(a b ::); COMP_CWORD=2}
-}
+set cmd {COMP_WORDS=(a b ::); COMP_CWORD=2}
append cmd {; COMP_LINE='a b::'; COMP_POINT=5; _get_cword :; echo}
assert_bash_list b:: $cmd $test
@@ -232,14 +187,9 @@ assert_bash_list c $cmd $test
sync_after_int
-set test {a b=c| should return b=c (bash-3) or c (bash-4)}; # | = cursor position
-if {[lindex $::BASH_VERSINFO] <= 3} {
- set cmd {COMP_WORDS=(a "b=c"); COMP_CWORD=1}
- set expected b=c
-} else {
- set cmd {COMP_WORDS=(a b = c); COMP_CWORD=3}
- set expected c
-}
+set test {a b=c| should return c}; # | = cursor position
+set cmd {COMP_WORDS=(a b = c); COMP_CWORD=3}
+set expected c
append cmd {; COMP_LINE='a b=c'; COMP_POINT=5; _get_cword; echo}
assert_bash_list $expected $cmd $test
@@ -286,27 +236,13 @@ sync_after_int
set test {a 'b&c| should return 'b&c}; # | = cursor position
-if {
- [lindex $::BASH_VERSINFO 0] == 4 &&
- [lindex $::BASH_VERSINFO 1] == 0 &&
- [lindex $::BASH_VERSINFO 2] < 35
-} {
- set cmd {COMP_WORDS=(a "'" b "&" c); COMP_CWORD=4}
-} else {
- set cmd {COMP_WORDS=(a "'b&c"); COMP_CWORD=1}
-}
+set cmd {COMP_WORDS=(a "'b&c"); COMP_CWORD=1}
append cmd {; COMP_LINE="a 'b&c"; COMP_POINT=6; _get_cword}
send "$cmd\r"
expect -ex "$cmd\r\n"
expect {
-ex "'b&c/@" { pass "$test" }
- -ex "c/@" {
- if {
- [lindex $::BASH_VERSINFO 0] == 4 &&
- [lindex $::BASH_VERSINFO 1] == 0 &&
- [lindex $::BASH_VERSINFO 2] < 35
- } {xfail "$test"} {fail "$test"}
- }
+ -ex "c/@" { fail "$test" }
}
diff --git a/test/unit/_init_completion.exp b/test/unit/_init_completion.exp
new file mode 100644
index 00000000..75c41255
--- /dev/null
+++ b/test/unit/_init_completion.exp
@@ -0,0 +1,35 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_bash_exec { \
+ unset COMP_CWORD COMP_LINE COMP_POINT COMP_WORDS cur prev words cword\
+ }
+ assert_env_unmodified {
+ /COMPREPLY=/d
+ }
+}
+
+
+setup
+
+
+set test "function should not pollute environment"
+# NOTE: A possible environment pollution is detected by assert_env_modified() in teardown()
+assert_bash_exec {foo() { local cur prev words cword; _init_completion; }; foo; unset foo} $test
+
+
+sync_after_int
+
+
+set test "|a"; # | = cursor position
+set cmd {COMP_WORDS=(a); COMP_CWORD=0; COMP_LINE='a'; COMP_POINT=0; _init_completion; echo "$cur $prev"}
+assert_bash_list {" "} $cmd $test
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/unit/_known_hosts_real.exp b/test/unit/_known_hosts_real.exp
index 604b2d5e..0e381fa7 100644
--- a/test/unit/_known_hosts_real.exp
+++ b/test/unit/_known_hosts_real.exp
@@ -19,7 +19,7 @@ setup
set test "Hosts should be put in COMPREPLY"
-set hosts [get_hosts]
+set hosts [get_hosts -unsorted]
# Hosts `gee', `hus' and `jar' are defined in ./fixtures/_known_hosts_real/config
# doo, ike, jub, 10.0.0.1, kyl, 100.0.0.2, 10.10.0.3, blah, and bunch of IPv6 test cases in ./fixtures/_known_hosts_real/known_hosts
lappend hosts blah doo gee hus ike jar jub kyl 10.0.0.1 100.0.0.2 10.10.0.3 fd00:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:5555 fe80::123:0xff:dead:beef%eth0 1111:2222:3333:4444:5555:6666:xxxx:abab 11xx:2222:3333:4444:5555:6666:xxxx:abab ::42
@@ -31,7 +31,7 @@ sync_after_int
set test "Hosts should have username prefix and colon suffix"
-set hosts [get_hosts]
+set hosts [get_hosts -unsorted]
# Hosts `gee', `hus' and `jar' are defined in ./fixtures/_known_hosts_real/config
# doo, ike, jub, 10.0.0.1, kyl, 100.0.0.2, 10.10.0.3, blah, and bunch of IPv6 test cases in ./fixtures/_known_hosts_real/known_hosts
lappend hosts blah doo gee hus ike jar jub kyl 10.0.0.1 100.0.0.2 10.10.0.3 fd00:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:5555 fe80::123:0xff:dead:beef%eth0 1111:2222:3333:4444:5555:6666:xxxx:abab 11xx:2222:3333:4444:5555:6666:xxxx:abab ::42
@@ -49,7 +49,7 @@ sync_after_int
set test "Files containing consecutive spaces should work"
-set hosts [get_hosts]
+set hosts [get_hosts -unsorted]
set hosts_orig $hosts
# Hosts `gee' and `hus' are defined in `./fixtures/_known_hosts_real/spaced conf'
# Host `two' is defined in ./fixtures/_known_hosts_real/known_hosts2
@@ -77,7 +77,7 @@ sync_after_int
set test "Files starting with tilde (~) should work"
-set hosts [get_hosts]
+set hosts [get_hosts -unsorted]
# Host `two' is defined in ./fixtures/_known_hosts_real/known_hosts2
# Host `three' is defined in ./fixtures/_known_hosts_real/known_hosts3
lappend hosts two three
diff --git a/test/unit/_parse_help.exp b/test/unit/_parse_help.exp
index 4beb28d2..a6d58d5a 100644
--- a/test/unit/_parse_help.exp
+++ b/test/unit/_parse_help.exp
@@ -38,11 +38,11 @@ assert_bash_list "-space" $cmd "one dash after space"
sync_after_int
set cmd {fn() { printf '%s\n' "-one -two dashes"; }; _parse_help fn}
-assert_bash_list "-one\n-two" $cmd "two dashes, space-separated"
+assert_bash_list "-one" $cmd "two dashes, space-separated"
sync_after_int
set cmd {fn() { printf '%s\n' "-one,-t dashes"; }; _parse_help fn}
-assert_bash_list "-one\n-t" $cmd "two dashes, comma-separated"
+assert_bash_list "-one" $cmd "two dashes, comma-separated"
sync_after_int
set cmd {fn() { printf '%s\n' "-one dash-inside"; }; _parse_help fn}
@@ -50,23 +50,83 @@ assert_bash_list "-one" $cmd "internal dash 2"
sync_after_int
set cmd {fn() { printf '%s\n' "--long-arg=value"; }; _parse_help fn}
-assert_bash_list "--long-arg" $cmd "value stripped"
+assert_bash_list "--long-arg=" $cmd "value stripped"
sync_after_int
set cmd {fn() { printf '%s\n' "--long-arg=-value"; }; _parse_help fn}
-assert_bash_list "--long-arg" $cmd "value not seen as option"
+assert_bash_list "--long-arg=" $cmd "value not seen as option"
sync_after_int
set cmd {fn() { printf '%s\n' "--long-arg=-value,--opt2=val"; }; _parse_help fn}
-assert_bash_list "--long-arg\n--opt2" $cmd "two options with values"
+assert_bash_list "--long-arg=" $cmd "two options with values"
sync_after_int
set cmd {fn() { printf '%s\n' "-m,--mirror"; }; _parse_help fn}
-assert_bash_list "-m\n--mirror" $cmd "short + long"
+assert_bash_list "--mirror" $cmd "short + long"
sync_after_int
set cmd {fn() { printf '%s\n' "-T/--upload-file"; }; _parse_help fn}
-assert_bash_list "-T\n--upload-file" $cmd "short + long, slash separated"
+assert_bash_list "--upload-file" $cmd "short + long, slash separated"
+sync_after_int
+
+set cmd {fn() { printf '%s\n' "-T|--upload-file"; }; _parse_help fn}
+assert_bash_list "--upload-file" $cmd "pipe separated"
+sync_after_int
+
+set cmd {fn() { printf '%s\n' "-f, -F, --foo"; }; _parse_help fn}
+assert_bash_list "--foo" $cmd "short + short + long"
+sync_after_int
+
+set cmd {fn() { printf '%s\n' "--foo[=bar]"; }; _parse_help fn}
+assert_bash_list "--foo" $cmd "long with value and eq sign in brackets"
+sync_after_int
+
+set cmd {fn() { printf '%s\n' "--foo=<bar>"; }; _parse_help fn}
+assert_bash_list "--foo=" $cmd "long with value in angle brackets"
+sync_after_int
+
+set cmd {fn() { printf '%s\n' "--foo={bar,quux}"; }; _parse_help fn}
+assert_bash_list "--foo=" $cmd "long with value in curly brackets"
+sync_after_int
+
+set cmd {fn() { printf '%s\n' "--[no]foo"; }; _parse_help fn}
+assert_bash_list "--foo\n--nofoo" $cmd "long with \[no\]"
+sync_after_int
+
+set cmd {fn() { printf '%s\n' "--[no-]bar[=quux]"; }; _parse_help fn}
+assert_bash_list "--bar\n--no-bar" $cmd "long with \[no-\] + optional arg"
+sync_after_int
+
+set cmd {fn() { printf '%s\n' "--[no-]bar=quux"; }; _parse_help fn}
+assert_bash_list "--bar=\n--no-bar=" $cmd "long with \[no-\] + required arg"
+sync_after_int
+
+set cmd {fn() { printf '%s\n' "--[dont-]foo"; }; _parse_help fn}
+assert_bash_list "--foo\n--dont-foo" $cmd "long with \[dont-\]"
+sync_after_int
+
+set cmd {fn() { printf '%s\n' "-[dont]x, --[dont]yy"; }; _parse_help fn}
+assert_bash_list "--yy\n--dontyy" $cmd "short and long with \[dont\]"
+sync_after_int
+
+set cmd {fn() { printf '%s\n' "----\n---foo\n----- bar"; }; _parse_help fn}
+assert_bash_list "" $cmd "more than two dashes"
+sync_after_int
+
+set cmd {fn() { printf '%s\n' "-f FOO, --foo=FOO"; }; _parse_help fn}
+assert_bash_list "--foo=" $cmd "-f FOO, --foo=FOO"
+sync_after_int
+
+set cmd {fn() { printf '%s\n' "-f [FOO], --foo[=FOO]"; }; _parse_help fn}
+assert_bash_list "--foo" $cmd "-f \[FOO\], --foo\[=FOO\]"
+sync_after_int
+
+set cmd {fn() { printf '%s\n' "--foo."; }; _parse_help fn}
+assert_bash_list "--foo" $cmd "--foo."
+sync_after_int
+
+set cmd {fn() { printf '%s\n' "-f or --foo"; }; _parse_help fn}
+assert_bash_list "--foo" $cmd "-f or --foo"
sync_after_int
diff --git a/test/unit/_parse_usage.exp b/test/unit/_parse_usage.exp
new file mode 100644
index 00000000..0069848d
--- /dev/null
+++ b/test/unit/_parse_usage.exp
@@ -0,0 +1,59 @@
+proc setup {} {
+ save_env
+}
+
+proc teardown {} {
+ assert_env_unmodified {
+ /declare -f fn/d
+ }
+}
+
+setup
+
+
+set cmd {fn() { printf '%s\n' ""; }; _parse_usage fn}
+assert_bash_list "" $cmd "empty"
+sync_after_int
+
+set cmd {fn() { printf '%s\n' "no dashes here"; }; _parse_usage fn}
+assert_bash_list "" $cmd "no dashes"
+sync_after_int
+
+set cmd {fn() { printf '%s\n' "foo [-f]"; }; _parse_usage fn}
+assert_bash_list "-f" $cmd "simple"
+sync_after_int
+
+set cmd {fn() { printf '%s\n' "bar [-aBcD] [-e X]"; }; _parse_usage fn}
+assert_bash_list "-a -B -c -D -e" $cmd "bundled + separate 1 short"
+sync_after_int
+
+set cmd {fn() { printf '%s\n' "[-[XyZ]] [--long=arg]"; }; _parse_usage fn}
+assert_bash_list "-X -y -Z --long=" $cmd "bundled in brackets + separate long"
+sync_after_int
+
+set cmd {fn() { printf '%s\n' "[-s|--long]"; }; _parse_usage fn}
+assert_bash_list "--long" $cmd "short or long"
+sync_after_int
+
+set cmd {fn() { printf '%s\n' "[-s, --long=arg]"; }; _parse_usage fn}
+assert_bash_list "--long=" $cmd "short or long with arg, comma"
+sync_after_int
+
+set cmd {fn() { printf '%s\n' "[--long/-s] [-S/--longer]"; }; _parse_usage fn}
+assert_bash_list "--long\n--longer" $cmd "long or short, slash"
+sync_after_int
+
+set cmd {fn() { printf '%s\n' "[ -a ] [ -b foo ]"; }; _parse_usage fn}
+assert_bash_list "-a\n-b" $cmd "whitespace in brackets"
+sync_after_int
+
+set cmd {fn() { printf '%s\n' "[ -a | --aa ]"; }; _parse_usage fn}
+assert_bash_list "--aa" $cmd "whitespace in brackets 2"
+sync_after_int
+
+set cmd {fn() { printf '%s\n' "----\n---foo\n----- bar"; }; _parse_usage fn}
+assert_bash_list "" $cmd "many dashes"
+sync_after_int
+
+
+teardown
diff --git a/test/unit/compgen.exp b/test/unit/compgen.exp
index 6e6f79c6..9fc1efba 100644
--- a/test/unit/compgen.exp
+++ b/test/unit/compgen.exp
@@ -11,31 +11,15 @@ proc teardown {} {
setup
-if {[lindex $::BASH_VERSINFO 0] <= 3} {
- set test {compgen -f a\\\\\\\'b/ on bash-3 should return a\'b/c};
- set cmd {compgen -f a\\\\\\\'b/}
-} else {
- set test {compgen -f a\\\'b/ on bash-4 should return a\'b/c};
- set cmd {compgen -f a\\\'b/}
-}
+set test {compgen -f a\\\'b/ should return a\'b/c}
+set cmd {compgen -f a\\\'b/}
set dir $::srcdir/fixtures/compgen
assert_bash_exec "cd $dir"
send "$cmd\r"
expect -ex "$cmd\r\n"
expect {
- -re {a\\\'b/c} {
- # On bash-3.2, compgen returns inconsequent output
- if {
- [lindex $::BASH_VERSINFO 0] >= 4 || (
- [lindex $::BASH_VERSINFO 0] == 3 &&
- [lindex $::BASH_VERSINFO 1] == 2
- )
- } {pass $test} else {fail $test}
- }
- -re {a'b/c} {
- if {[lindex $::BASH_VERSINFO 0] <= 3 } \
- {pass $test} else {fail $test}
- }
+ -re {a\\\'b/c} { pass $test }
+ -re {a'b/c} { fail $test }
-re /@ { pass "$test" }
-re eof { unresolved "eof" }
}