summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Paleino <dapal@debian.org>2010-06-16 18:20:29 +0200
committerDavid Paleino <dapal@debian.org>2010-06-16 18:20:29 +0200
commitf9748115fb4b2950fb4df7535fb723c4affde078 (patch)
tree20875f42b219a5d56e8a7e98840f6dbced003ae0
parente5a9b6220e93ca656fd9774c6aefa78241edca6f (diff)
downloadbash-completion-f9748115fb4b2950fb4df7535fb723c4affde078.tar.gz
Imported Upstream version 1.2upstream/1.2
-rw-r--r--CHANGES710
-rw-r--r--Makefile.am45
-rw-r--r--Makefile.in421
-rw-r--r--README238
-rw-r--r--TODO4
-rw-r--r--aclocal.m410
-rw-r--r--bash_completion1524
-rw-r--r--bash_completion.sh.in12
-rwxr-xr-xconfigure60
-rw-r--r--configure.ac6
-rw-r--r--contrib/_mock (renamed from contrib/mock)27
-rw-r--r--contrib/_modules (renamed from contrib/modules)55
-rw-r--r--contrib/_subversion770
-rw-r--r--contrib/_yum269
-rw-r--r--contrib/_yum-utils (renamed from contrib/repomanage)12
-rw-r--r--contrib/abook64
-rw-r--r--contrib/ant107
-rw-r--r--contrib/apache2ctl6
-rw-r--r--contrib/apt32
-rw-r--r--contrib/apt-build13
-rw-r--r--contrib/aptitude26
-rw-r--r--contrib/aspell30
-rw-r--r--contrib/autorpm2
-rw-r--r--contrib/bash-builtins33
-rw-r--r--contrib/bind-utils2
-rw-r--r--contrib/bitkeeper15
-rw-r--r--contrib/bittorrent9
-rw-r--r--contrib/bluez (renamed from contrib/bluez-utils)108
-rw-r--r--contrib/brctl10
-rw-r--r--contrib/bzip223
-rw-r--r--contrib/cardctl6
-rw-r--r--contrib/cfengine29
-rw-r--r--contrib/chkconfig23
-rw-r--r--contrib/chsh18
-rw-r--r--contrib/cksfv22
-rw-r--r--contrib/clisp4
-rw-r--r--contrib/configure30
-rw-r--r--contrib/coreutils122
-rw-r--r--contrib/cowsay5
-rw-r--r--contrib/cpan2dist9
-rw-r--r--contrib/cpio17
-rw-r--r--contrib/cryptsetup113
-rw-r--r--contrib/cups4
-rw-r--r--contrib/cvs316
-rw-r--r--contrib/cvsps69
-rw-r--r--contrib/dcop26
-rw-r--r--contrib/dd6
-rw-r--r--contrib/dhclient7
-rw-r--r--contrib/dict77
-rw-r--r--contrib/dpkg136
-rw-r--r--contrib/dselect9
-rw-r--r--contrib/dsniff77
-rw-r--r--contrib/findutils144
-rw-r--r--contrib/freeciv22
-rw-r--r--contrib/fuse36
-rw-r--r--contrib/gcc8
-rw-r--r--contrib/gcl4
-rw-r--r--contrib/gdb8
-rw-r--r--contrib/genisoimage56
-rw-r--r--contrib/getent11
-rw-r--r--contrib/gkrellm36
-rw-r--r--contrib/gnatmake4
-rw-r--r--contrib/gpg19
-rw-r--r--contrib/gpg219
-rw-r--r--contrib/gzip22
-rw-r--r--contrib/heimdal11
-rw-r--r--contrib/hping255
-rw-r--r--contrib/iconv33
-rw-r--r--contrib/ifupdown27
-rw-r--r--contrib/imagemagick52
-rw-r--r--contrib/info4
-rw-r--r--contrib/ipmitool5
-rw-r--r--contrib/ipsec51
-rw-r--r--contrib/iptables14
-rw-r--r--contrib/ipv6calc57
-rw-r--r--contrib/isql4
-rw-r--r--contrib/jar6
-rw-r--r--contrib/java244
-rw-r--r--contrib/k3b55
-rw-r--r--contrib/kldload11
-rw-r--r--contrib/larch7
-rw-r--r--contrib/ldapvi9
-rw-r--r--contrib/lftp39
-rw-r--r--contrib/lilo9
-rw-r--r--contrib/links6
-rw-r--r--contrib/lintian186
-rw-r--r--contrib/lisp4
-rw-r--r--contrib/lvm440
-rw-r--r--contrib/lzma14
-rw-r--r--contrib/lzop28
-rw-r--r--contrib/mailman204
-rw-r--r--contrib/make15
-rw-r--r--contrib/man9
-rw-r--r--contrib/mc17
-rw-r--r--contrib/mcrypt43
-rw-r--r--contrib/mdadm107
-rw-r--r--contrib/medusa41
-rw-r--r--contrib/minicom13
-rw-r--r--contrib/mkinitrd9
-rw-r--r--contrib/module-init-tools61
-rw-r--r--contrib/monodevelop11
-rw-r--r--contrib/mount165
-rw-r--r--contrib/mplayer76
-rw-r--r--contrib/msynctool10
-rw-r--r--contrib/mtx3
-rw-r--r--contrib/munin-node40
-rw-r--r--contrib/mutt122
-rw-r--r--contrib/mysqladmin69
-rw-r--r--contrib/ncftp6
-rw-r--r--contrib/net-tools64
-rw-r--r--contrib/nmap60
-rw-r--r--contrib/ntpdate3
-rw-r--r--contrib/openldap47
-rw-r--r--contrib/openssl19
-rw-r--r--contrib/p414
-rw-r--r--contrib/perl34
-rw-r--r--contrib/pine6
-rw-r--r--contrib/pkg-config9
-rw-r--r--contrib/pkg_install7
-rw-r--r--contrib/pkgtools6
-rw-r--r--contrib/pm-utils37
-rw-r--r--contrib/portupgrade24
-rw-r--r--contrib/postfix39
-rw-r--r--contrib/postgresql50
-rw-r--r--contrib/povray9
-rw-r--r--contrib/procps49
-rw-r--r--contrib/python7
-rw-r--r--contrib/qdbus21
-rw-r--r--contrib/qemu14
-rw-r--r--contrib/quota-tools39
-rw-r--r--contrib/rcs7
-rw-r--r--contrib/rdesktop7
-rw-r--r--contrib/reportbug49
-rw-r--r--contrib/resolvconf5
-rw-r--r--contrib/rfkill5
-rw-r--r--contrib/ri50
-rw-r--r--contrib/rpcdebug5
-rw-r--r--contrib/rpm56
-rw-r--r--contrib/rpmcheck3
-rw-r--r--contrib/rrdtool4
-rw-r--r--contrib/rsync141
-rw-r--r--contrib/rtcwake40
-rw-r--r--contrib/samba29
-rw-r--r--contrib/sbcl4
-rw-r--r--contrib/screen39
-rw-r--r--contrib/service45
-rw-r--r--contrib/shadow160
-rw-r--r--contrib/sitecopy12
-rw-r--r--contrib/smartctl177
-rw-r--r--contrib/snownews4
-rw-r--r--contrib/ssh616
-rw-r--r--contrib/sshfs34
-rw-r--r--contrib/strace11
-rw-r--r--contrib/svk54
-rw-r--r--contrib/sysctl2
-rw-r--r--contrib/sysv-rc29
-rw-r--r--contrib/tar14
-rw-r--r--contrib/tcpdump7
-rw-r--r--contrib/unace21
-rw-r--r--contrib/unrar16
-rw-r--r--contrib/update-alternatives95
-rw-r--r--contrib/util-linux76
-rw-r--r--contrib/vncviewer40
-rw-r--r--contrib/vpnc5
-rw-r--r--contrib/wireless-tools21
-rw-r--r--contrib/wodim11
-rw-r--r--contrib/wol47
-rw-r--r--contrib/wtf36
-rw-r--r--contrib/wvdial5
-rw-r--r--contrib/xhost7
-rw-r--r--contrib/xm13
-rw-r--r--contrib/xmllint7
-rw-r--r--contrib/xmlwf7
-rw-r--r--contrib/xmms4
-rw-r--r--contrib/xrandr24
-rw-r--r--contrib/xsltproc56
-rw-r--r--contrib/xz36
-rw-r--r--contrib/yp-tools19
-rw-r--r--contrib/yum-arch20
-rw-r--r--test/Makefile.am8
-rw-r--r--test/Makefile.in343
-rw-r--r--test/completion/a2ps.exp1
-rw-r--r--test/completion/abook.exp1
-rw-r--r--test/completion/acroread.exp12
-rw-r--r--test/completion/add_members.exp1
-rw-r--r--test/completion/alias.exp1
-rw-r--r--test/completion/animate.exp1
-rw-r--r--test/completion/ant.exp1
-rw-r--r--test/completion/apache2ctl.exp1
-rw-r--r--test/completion/apt-build.exp1
-rw-r--r--test/completion/apt-cache.exp1
-rw-r--r--test/completion/apt-get.exp1
-rw-r--r--test/completion/aptitude.exp1
-rw-r--r--test/completion/arch.exp1
-rw-r--r--test/completion/arpspoof.exp1
-rw-r--r--test/completion/aspell.exp1
-rw-r--r--test/completion/autoconf.exp1
-rw-r--r--test/completion/automake.exp1
-rw-r--r--test/completion/autorpm.exp1
-rw-r--r--test/completion/awk.exp1
-rw-r--r--test/completion/bash.exp1
-rw-r--r--test/completion/bc.exp1
-rw-r--r--test/completion/bison.exp1
-rw-r--r--test/completion/bk.exp1
-rw-r--r--test/completion/brctl.exp1
-rw-r--r--test/completion/btdownloadcurses.py.exp1
-rw-r--r--test/completion/btdownloadgui.py.exp1
-rw-r--r--test/completion/btdownloadheadless.py.exp1
-rw-r--r--test/completion/bzip2.exp1
-rw-r--r--test/completion/c++.exp1
-rw-r--r--test/completion/cancel.exp1
-rw-r--r--test/completion/cardctl.exp1
-rw-r--r--test/completion/cat.exp1
-rw-r--r--test/completion/cc.exp1
-rw-r--r--test/completion/cd.exp1
-rw-r--r--test/completion/cdrecord.exp1
-rw-r--r--test/completion/change_pw.exp1
-rw-r--r--test/completion/check_db.exp1
-rw-r--r--test/completion/check_perms.exp1
-rw-r--r--test/completion/chgrp.exp1
-rw-r--r--test/completion/chkconfig.exp1
-rw-r--r--test/completion/chown.exp1
-rw-r--r--test/completion/chsh.exp1
-rw-r--r--test/completion/ci.exp1
-rw-r--r--test/completion/civclient.exp1
-rw-r--r--test/completion/civserver.exp1
-rw-r--r--test/completion/cksfv.exp1
-rw-r--r--test/completion/cleanarch.exp1
-rw-r--r--test/completion/clisp.exp1
-rw-r--r--test/completion/clone_member.exp1
-rw-r--r--test/completion/co.exp1
-rw-r--r--test/completion/composite.exp1
-rw-r--r--test/completion/config_list.exp1
-rw-r--r--test/completion/configure.exp1
-rw-r--r--test/completion/convert.exp1
-rw-r--r--test/completion/cowsay.exp1
-rw-r--r--test/completion/cp.exp1
-rw-r--r--test/completion/cpio.exp1
-rw-r--r--test/completion/createdb.exp1
-rw-r--r--test/completion/cryptsetup.exp1
-rw-r--r--test/completion/csplit.exp1
-rw-r--r--test/completion/cut.exp1
-rw-r--r--test/completion/cvs.exp1
-rw-r--r--test/completion/cvsps.exp1
-rw-r--r--test/completion/date.exp1
-rw-r--r--test/completion/dcop.exp1
-rw-r--r--test/completion/dd.exp1
-rw-r--r--test/completion/df.exp1
-rw-r--r--test/completion/dhclient.exp1
-rw-r--r--test/completion/dict.exp1
-rw-r--r--test/completion/diff.exp1
-rw-r--r--test/completion/dir.exp1
-rw-r--r--test/completion/display.exp1
-rw-r--r--test/completion/dnsspoof.exp1
-rw-r--r--test/completion/dpkg-deb.exp1
-rw-r--r--test/completion/dpkg-reconfigure.exp1
-rw-r--r--test/completion/dpkg-source.exp1
-rw-r--r--test/completion/dpkg.exp1
-rw-r--r--test/completion/dropdb.exp1
-rw-r--r--test/completion/dselect.exp1
-rw-r--r--test/completion/dsniff.exp1
-rw-r--r--test/completion/du.exp1
-rw-r--r--test/completion/dumpdb.exp1
-rw-r--r--test/completion/enscript.exp1
-rw-r--r--test/completion/env.exp1
-rw-r--r--test/completion/evince.exp1
-rw-r--r--test/completion/expand.exp1
-rw-r--r--test/completion/filesnarf.exp1
-rw-r--r--test/completion/find.exp1
-rw-r--r--test/completion/find_member.exp1
-rw-r--r--test/completion/finger.exp6
-rw-r--r--test/completion/fmt.exp1
-rw-r--r--test/completion/fold.exp1
-rw-r--r--test/completion/g++.exp1
-rw-r--r--test/completion/g4.exp1
-rw-r--r--test/completion/g77.exp1
-rw-r--r--test/completion/gcc.exp1
-rw-r--r--test/completion/gcj.exp1
-rw-r--r--test/completion/gcl.exp1
-rw-r--r--test/completion/gdb.exp1
-rw-r--r--test/completion/genaliases.exp1
-rw-r--r--test/completion/getent.exp1
-rw-r--r--test/completion/gkrellm.exp1
-rw-r--r--test/completion/gmplayer.exp1
-rw-r--r--test/completion/gnatmake.exp1
-rw-r--r--test/completion/gpc.exp1
-rw-r--r--test/completion/gperf.exp1
-rw-r--r--test/completion/gpg.exp1
-rw-r--r--test/completion/gprof.exp1
-rw-r--r--test/completion/grep.exp1
-rw-r--r--test/completion/grub.exp1
-rw-r--r--test/completion/gzip.exp1
-rw-r--r--test/completion/hcitool.exp1
-rw-r--r--test/completion/head.exp1
-rw-r--r--test/completion/iconv.exp1
-rw-r--r--test/completion/id.exp1
-rw-r--r--test/completion/identify.exp1
-rw-r--r--test/completion/ifdown.exp1
-rw-r--r--test/completion/ifup.exp1
-rw-r--r--test/completion/indent.exp1
-rw-r--r--test/completion/info.exp1
-rw-r--r--test/completion/inject.exp1
-rw-r--r--test/completion/insmod.exp1
-rw-r--r--test/completion/invoke-rc.d.exp1
-rw-r--r--test/completion/ipsec.exp1
-rw-r--r--test/completion/ipv6calc.exp1
-rw-r--r--test/completion/irb.exp1
-rw-r--r--test/completion/isql.exp1
-rw-r--r--test/completion/iwconfig.exp1
-rw-r--r--test/completion/iwlist.exp1
-rw-r--r--test/completion/iwpriv.exp1
-rw-r--r--test/completion/iwspy.exp1
-rw-r--r--test/completion/jar.exp1
-rw-r--r--test/completion/jarsigner.exp1
-rw-r--r--test/completion/java.exp1
-rw-r--r--test/completion/javac.exp1
-rw-r--r--test/completion/javadoc.exp1
-rw-r--r--test/completion/k3b.exp1
-rw-r--r--test/completion/kdvi.exp1
-rw-r--r--test/completion/kill.exp1
-rw-r--r--test/completion/killall.exp1
-rw-r--r--test/completion/kldload.exp1
-rw-r--r--test/completion/kldunload.exp1
-rw-r--r--test/completion/kpdf.exp1
-rw-r--r--test/completion/kplayer.exp1
-rw-r--r--test/completion/larch.exp1
-rw-r--r--test/completion/ld.exp1
-rw-r--r--test/completion/ldd.exp1
-rw-r--r--test/completion/less.exp1
-rw-r--r--test/completion/lftp.exp1
-rw-r--r--test/completion/lftpget.exp1
-rw-r--r--test/completion/lilo.exp1
-rw-r--r--test/completion/links.exp1
-rw-r--r--test/completion/lisp.exp1
-rw-r--r--test/completion/list_admins.exp1
-rw-r--r--test/completion/list_lists.exp1
-rw-r--r--test/completion/list_members.exp1
-rw-r--r--test/completion/list_owners.exp1
-rw-r--r--test/completion/ln.exp1
-rw-r--r--test/completion/look.exp1
-rw-r--r--test/completion/ls.exp1
-rw-r--r--test/completion/lvchange.exp1
-rw-r--r--test/completion/lvcreate.exp1
-rw-r--r--test/completion/lvdisplay.exp1
-rw-r--r--test/completion/lvextend.exp1
-rw-r--r--test/completion/lvm.exp1
-rw-r--r--test/completion/lvmdiskscan.exp1
-rw-r--r--test/completion/lvreduce.exp1
-rw-r--r--test/completion/lvremove.exp1
-rw-r--r--test/completion/lvrename.exp1
-rw-r--r--test/completion/lvresize.exp1
-rw-r--r--test/completion/lvs.exp1
-rw-r--r--test/completion/lvscan.exp1
-rw-r--r--test/completion/lzma.exp1
-rw-r--r--test/completion/lzop.exp1
-rw-r--r--test/completion/m4.exp1
-rw-r--r--test/completion/macof.exp1
-rw-r--r--test/completion/mailmanctl.exp1
-rw-r--r--test/completion/mailsnarf.exp1
-rw-r--r--test/completion/make.exp1
-rw-r--r--test/completion/man.exp1
-rw-r--r--test/completion/mc.exp1
-rw-r--r--test/completion/mcrypt.exp1
-rw-r--r--test/completion/md5sum.exp1
-rw-r--r--test/completion/mdecrypt.exp1
-rw-r--r--test/completion/mencoder.exp1
-rw-r--r--test/completion/minicom.exp1
-rw-r--r--test/completion/mkdir.exp1
-rw-r--r--test/completion/mkfifo.exp1
-rw-r--r--test/completion/mkinitrd.exp1
-rw-r--r--test/completion/mkisofs.exp1
-rw-r--r--test/completion/mknod.exp1
-rw-r--r--test/completion/mmsitepass.exp1
-rw-r--r--test/completion/module.exp1
-rw-r--r--test/completion/mogrify.exp1
-rw-r--r--test/completion/montage.exp1
-rw-r--r--test/completion/mount.exp1
-rw-r--r--test/completion/mplayer.exp1
-rw-r--r--test/completion/msgsnarf.exp1
-rw-r--r--test/completion/mtx.exp1
-rw-r--r--test/completion/mutt.exp1
-rw-r--r--test/completion/muttng.exp1
-rw-r--r--test/completion/mv.exp1
-rw-r--r--test/completion/mysqladmin.exp1
-rw-r--r--test/completion/ncftp.exp1
-rw-r--r--test/completion/netstat.exp1
-rw-r--r--test/completion/newlist.exp1
-rw-r--r--test/completion/nl.exp1
-rw-r--r--test/completion/nm.exp1
-rw-r--r--test/completion/ntpdate.exp1
-rw-r--r--test/completion/objcopy.exp1
-rw-r--r--test/completion/objdump.exp1
-rw-r--r--test/completion/od.exp1
-rw-r--r--test/completion/openssl.exp1
-rw-r--r--test/completion/p4.exp1
-rw-r--r--test/completion/pack200.exp1
-rw-r--r--test/completion/paste.exp1
-rw-r--r--test/completion/patch.exp1
-rw-r--r--test/completion/perl.exp1
-rw-r--r--test/completion/perldoc.exp1
-rw-r--r--test/completion/pgrep.exp1
-rw-r--r--test/completion/pine.exp1
-rw-r--r--test/completion/ping.exp1
-rw-r--r--test/completion/pkg-config.exp1
-rw-r--r--test/completion/pkg_deinstall.exp1
-rw-r--r--test/completion/pkg_delete.exp1
-rw-r--r--test/completion/pkg_info.exp1
-rw-r--r--test/completion/pkill.exp1
-rw-r--r--test/completion/portinstall.exp1
-rw-r--r--test/completion/portupgrade.exp1
-rw-r--r--test/completion/povray.exp1
-rw-r--r--test/completion/pr.exp1
-rw-r--r--test/completion/psql.exp1
-rw-r--r--test/completion/ptx.exp1
-rw-r--r--test/completion/pvchange.exp1
-rw-r--r--test/completion/pvcreate.exp1
-rw-r--r--test/completion/pvdisplay.exp1
-rw-r--r--test/completion/pvmove.exp1
-rw-r--r--test/completion/pvremove.exp1
-rw-r--r--test/completion/pvs.exp1
-rw-r--r--test/completion/pvscan.exp1
-rw-r--r--test/completion/python.exp1
-rw-r--r--test/completion/qrunner.exp1
-rw-r--r--test/completion/querybts.exp1
-rw-r--r--test/completion/rcs.exp1
-rw-r--r--test/completion/rcsdiff.exp1
-rw-r--r--test/completion/rdict.exp1
-rw-r--r--test/completion/readelf.exp1
-rw-r--r--test/completion/readonly.exp1
-rw-r--r--test/completion/remove_members.exp1
-rw-r--r--test/completion/removepkg.exp1
-rw-r--r--test/completion/renice.exp1
-rw-r--r--test/completion/reportbug.exp1
-rw-r--r--test/completion/ri.exp1
-rw-r--r--test/completion/rlog.exp1
-rw-r--r--test/completion/rm.exp1
-rw-r--r--test/completion/rmdir.exp1
-rw-r--r--test/completion/rmlist.exp1
-rw-r--r--test/completion/rpcdebug.exp1
-rw-r--r--test/completion/rpm.exp1
-rw-r--r--test/completion/rsync.exp1
-rw-r--r--test/completion/rtcwake.exp1
-rw-r--r--test/completion/sbcl-mt.exp1
-rw-r--r--test/completion/sbcl.exp1
-rw-r--r--test/completion/scp.exp1
-rw-r--r--test/completion/screen.exp1
-rw-r--r--test/completion/sed.exp1
-rw-r--r--test/completion/seq.exp1
-rw-r--r--test/completion/service.exp1
-rw-r--r--test/completion/set.exp1
-rw-r--r--test/completion/sftp.exp1
-rw-r--r--test/completion/sha1sum.exp1
-rw-r--r--test/completion/shar.exp1
-rw-r--r--test/completion/sitecopy.exp1
-rw-r--r--test/completion/smartctl.exp1
-rw-r--r--test/completion/snownews.exp1
-rw-r--r--test/completion/sort.exp1
-rw-r--r--test/completion/split.exp1
-rw-r--r--test/completion/spovray.exp1
-rw-r--r--test/completion/ssh.exp1
-rw-r--r--test/completion/sshmitm.exp1
-rw-r--r--test/completion/sshow.exp1
-rw-r--r--test/completion/strace.exp1
-rw-r--r--test/completion/strip.exp1
-rw-r--r--test/completion/sudo.exp1
-rw-r--r--test/completion/svk.exp1
-rw-r--r--test/completion/svn.exp1
-rw-r--r--test/completion/svnadmin.exp1
-rw-r--r--test/completion/svnlook.exp1
-rw-r--r--test/completion/sync_members.exp1
-rw-r--r--test/completion/sysctl.exp1
-rw-r--r--test/completion/tac.exp1
-rw-r--r--test/completion/tail.exp1
-rw-r--r--test/completion/tar.exp1
-rw-r--r--test/completion/tcpkill.exp1
-rw-r--r--test/completion/tcpnice.exp1
-rw-r--r--test/completion/tee.exp1
-rw-r--r--test/completion/texindex.exp1
-rw-r--r--test/completion/tightvncviewer.exp1
-rw-r--r--test/completion/time.exp1
-rw-r--r--test/completion/touch.exp1
-rw-r--r--test/completion/tr.exp1
-rw-r--r--test/completion/unace.exp1
-rw-r--r--test/completion/uname.exp1
-rw-r--r--test/completion/unexpand.exp1
-rw-r--r--test/completion/uniq.exp1
-rw-r--r--test/completion/units.exp1
-rw-r--r--test/completion/unpack200.exp1
-rw-r--r--test/completion/unrar.exp1
-rw-r--r--test/completion/unset.exp1
-rw-r--r--test/completion/unshunt.exp1
-rw-r--r--test/completion/update-alternatives.exp1
-rw-r--r--test/completion/update-rc.d.exp1
-rw-r--r--test/completion/urlsnarf.exp1
-rw-r--r--test/completion/vdir.exp1
-rw-r--r--test/completion/vgcfgbackup.exp1
-rw-r--r--test/completion/vgcfgrestore.exp1
-rw-r--r--test/completion/vgchange.exp1
-rw-r--r--test/completion/vgck.exp1
-rw-r--r--test/completion/vgconvert.exp1
-rw-r--r--test/completion/vgcreate.exp1
-rw-r--r--test/completion/vgdisplay.exp1
-rw-r--r--test/completion/vgexport.exp1
-rw-r--r--test/completion/vgextend.exp1
-rw-r--r--test/completion/vgimport.exp1
-rw-r--r--test/completion/vgmerge.exp1
-rw-r--r--test/completion/vgmknodes.exp1
-rw-r--r--test/completion/vgreduce.exp1
-rw-r--r--test/completion/vgremove.exp1
-rw-r--r--test/completion/vgrename.exp1
-rw-r--r--test/completion/vgs.exp1
-rw-r--r--test/completion/vgscan.exp1
-rw-r--r--test/completion/vgsplit.exp1
-rw-r--r--test/completion/vncviewer.exp1
-rw-r--r--test/completion/wc.exp1
-rw-r--r--test/completion/webmitm.exp1
-rw-r--r--test/completion/wget.exp1
-rw-r--r--test/completion/who.exp1
-rw-r--r--test/completion/withlist.exp1
-rw-r--r--test/completion/wol.exp1
-rw-r--r--test/completion/wtf.exp1
-rw-r--r--test/completion/wvdial.exp1
-rw-r--r--test/completion/xhost.exp1
-rw-r--r--test/completion/xmllint.exp1
-rw-r--r--test/completion/xmlwf.exp1
-rw-r--r--test/completion/xmms.exp1
-rw-r--r--test/completion/xpovray.exp1
-rw-r--r--test/completion/xrandr.exp1
-rw-r--r--test/completion/xsltproc.exp1
-rw-r--r--test/completion/xvnc4viewer.exp1
-rw-r--r--test/completion/xz.exp1
-rw-r--r--test/completion/ypcat.exp1
-rw-r--r--test/completion/ypmatch.exp1
-rw-r--r--test/completion/yum-arch.exp1
-rw-r--r--test/completion/yum.exp1
-rw-r--r--test/config/bashrc42
-rw-r--r--test/config/default.exp23
-rw-r--r--test/config/inputrc21
-rw-r--r--test/fixtures/_filedir/a b/i0
-rw-r--r--test/fixtures/_filedir/a"b/d0
-rw-r--r--test/fixtures/_filedir/a$b/h0
-rw-r--r--test/fixtures/_filedir/a&b/f0
-rw-r--r--test/fixtures/_filedir/a'b/c0
-rw-r--r--test/fixtures/_filedir/ab/e0
-rw-r--r--test/fixtures/_filedir/aé/g0
-rw-r--r--test/fixtures/_filedir/ext/ee.e10
-rw-r--r--test/fixtures/_filedir/ext/ff.e20
-rw-r--r--test/fixtures/_filedir/ext/foo/.gitignore0
-rw-r--r--test/fixtures/_filedir/ext/gg.e10
-rw-r--r--test/fixtures/_filedir/ext/hh.e20
-rw-r--r--test/fixtures/_known_hosts_real/config6
-rw-r--r--test/fixtures/_known_hosts_real/config_tilde4
-rw-r--r--test/fixtures/_known_hosts_real/known_hosts6
-rw-r--r--test/fixtures/_known_hosts_real/known_hosts21
-rw-r--r--test/fixtures/_known_hosts_real/known_hosts31
-rw-r--r--test/fixtures/_known_hosts_real/spaced conf9
-rw-r--r--test/fixtures/_known_hosts_real/spaced known_hosts4
-rw-r--r--test/fixtures/compgen/a'b/c0
-rw-r--r--test/fixtures/compgen/t1.txt121
-rw-r--r--test/fixtures/compgen/t2.txt121
-rw-r--r--test/fixtures/compgen/t3.txt121
-rw-r--r--test/fixtures/cvs/.cvspass2
-rw-r--r--test/fixtures/evince/.BMP0
-rw-r--r--test/fixtures/evince/.CBR0
-rw-r--r--test/fixtures/evince/.CBZ0
-rw-r--r--test/fixtures/evince/.DJV0
-rw-r--r--test/fixtures/evince/.DJVU0
-rw-r--r--test/fixtures/evince/.DVI0
-rw-r--r--test/fixtures/evince/.DVI.BZ20
-rw-r--r--test/fixtures/evince/.DVI.GZ0
-rw-r--r--test/fixtures/evince/.DVI.bz20
-rw-r--r--test/fixtures/evince/.DVI.gz0
-rw-r--r--test/fixtures/evince/.EPS0
-rw-r--r--test/fixtures/evince/.EPS.BZ20
-rw-r--r--test/fixtures/evince/.EPS.GZ0
-rw-r--r--test/fixtures/evince/.EPS.bz20
-rw-r--r--test/fixtures/evince/.EPS.gz0
-rw-r--r--test/fixtures/evince/.GIF0
-rw-r--r--test/fixtures/evince/.ICO0
-rw-r--r--test/fixtures/evince/.JPEG0
-rw-r--r--test/fixtures/evince/.JPG0
-rw-r--r--test/fixtures/evince/.MIFF0
-rw-r--r--test/fixtures/evince/.PBM0
-rw-r--r--test/fixtures/evince/.PCX0
-rw-r--r--test/fixtures/evince/.PDF0
-rw-r--r--test/fixtures/evince/.PDF.BZ20
-rw-r--r--test/fixtures/evince/.PDF.GZ0
-rw-r--r--test/fixtures/evince/.PDF.bz20
-rw-r--r--test/fixtures/evince/.PDF.gz0
-rw-r--r--test/fixtures/evince/.PGM0
-rw-r--r--test/fixtures/evince/.PNG0
-rw-r--r--test/fixtures/evince/.PNM0
-rw-r--r--test/fixtures/evince/.PPM0
-rw-r--r--test/fixtures/evince/.PS0
-rw-r--r--test/fixtures/evince/.PS.BZ20
-rw-r--r--test/fixtures/evince/.PS.GZ0
-rw-r--r--test/fixtures/evince/.PS.bz20
-rw-r--r--test/fixtures/evince/.PS.gz0
-rw-r--r--test/fixtures/evince/.TGA0
-rw-r--r--test/fixtures/evince/.TIF0
-rw-r--r--test/fixtures/evince/.TIFF0
-rw-r--r--test/fixtures/evince/.XPM0
-rw-r--r--test/fixtures/evince/.XWD0
-rw-r--r--test/fixtures/evince/.bmp0
-rw-r--r--test/fixtures/evince/.cbr0
-rw-r--r--test/fixtures/evince/.cbz0
-rw-r--r--test/fixtures/evince/.djv0
-rw-r--r--test/fixtures/evince/.djvu0
-rw-r--r--test/fixtures/evince/.dvi0
-rw-r--r--test/fixtures/evince/.dvi.BZ20
-rw-r--r--test/fixtures/evince/.dvi.GZ0
-rw-r--r--test/fixtures/evince/.dvi.bz20
-rw-r--r--test/fixtures/evince/.dvi.gz0
-rw-r--r--test/fixtures/evince/.eps0
-rw-r--r--test/fixtures/evince/.eps.BZ20
-rw-r--r--test/fixtures/evince/.eps.GZ0
-rw-r--r--test/fixtures/evince/.eps.bz20
-rw-r--r--test/fixtures/evince/.eps.gz0
-rw-r--r--test/fixtures/evince/.gif0
-rw-r--r--test/fixtures/evince/.ico0
-rw-r--r--test/fixtures/evince/.jpeg0
-rw-r--r--test/fixtures/evince/.jpg0
-rw-r--r--test/fixtures/evince/.miff0
-rw-r--r--test/fixtures/evince/.pbm0
-rw-r--r--test/fixtures/evince/.pcx0
-rw-r--r--test/fixtures/evince/.pdf0
-rw-r--r--test/fixtures/evince/.pdf.BZ20
-rw-r--r--test/fixtures/evince/.pdf.GZ0
-rw-r--r--test/fixtures/evince/.pdf.bz20
-rw-r--r--test/fixtures/evince/.pdf.gz0
-rw-r--r--test/fixtures/evince/.pgm0
-rw-r--r--test/fixtures/evince/.png0
-rw-r--r--test/fixtures/evince/.pnm0
-rw-r--r--test/fixtures/evince/.ppm0
-rw-r--r--test/fixtures/evince/.ps0
-rw-r--r--test/fixtures/evince/.ps.BZ20
-rw-r--r--test/fixtures/evince/.ps.GZ0
-rw-r--r--test/fixtures/evince/.ps.bz20
-rw-r--r--test/fixtures/evince/.ps.gz0
-rw-r--r--test/fixtures/evince/.tga0
-rw-r--r--test/fixtures/evince/.tif0
-rw-r--r--test/fixtures/evince/.tiff0
-rw-r--r--test/fixtures/evince/.txt0
-rw-r--r--test/fixtures/evince/.xpm0
-rw-r--r--test/fixtures/evince/.xwd0
-rw-r--r--test/fixtures/evince/foo/.gitignore0
-rw-r--r--test/fixtures/isql/odbc.ini3
-rw-r--r--test/fixtures/java/a/b$c.class0
-rw-r--r--test/fixtures/java/a/b.class0
-rw-r--r--test/fixtures/java/a/c/README.txt2
-rw-r--r--test/fixtures/java/a/c/d.class0
-rw-r--r--test/fixtures/java/a/d.txt0
-rw-r--r--test/fixtures/java/bashcomp.jarbin0 -> 788 bytes
-rw-r--r--test/fixtures/kdvi/.DVI0
-rw-r--r--test/fixtures/kdvi/.DVI.Z0
-rw-r--r--test/fixtures/kdvi/.DVI.bz20
-rw-r--r--test/fixtures/kdvi/.DVI.gz0
-rw-r--r--test/fixtures/kdvi/.dvi0
-rw-r--r--test/fixtures/kdvi/.dvi.Z0
-rw-r--r--test/fixtures/kdvi/.dvi.bz20
-rw-r--r--test/fixtures/kdvi/.dvi.gz0
-rw-r--r--test/fixtures/kdvi/.txt0
-rw-r--r--test/fixtures/kdvi/foo/.gitignore0
-rw-r--r--test/fixtures/kpdf/.EPS0
-rw-r--r--test/fixtures/kpdf/.PDF0
-rw-r--r--test/fixtures/kpdf/.PS0
-rw-r--r--test/fixtures/kpdf/.eps0
-rw-r--r--test/fixtures/kpdf/.pdf0
-rw-r--r--test/fixtures/kpdf/.ps0
-rw-r--r--test/fixtures/kpdf/.txt0
-rw-r--r--test/fixtures/kpdf/foo/.gitignore0
-rw-r--r--test/fixtures/lftp/.lftp/bookmarks1
-rwxr-xr-xtest/fixtures/mount/bin/showmount12
-rw-r--r--test/fixtures/mount/test-fstab24
-rw-r--r--test/fixtures/mutt/bar/.gitignore0
-rw-r--r--test/fixtures/mutt/foo/.gitignore0
-rw-r--r--test/fixtures/mutt/muttrc3
-rw-r--r--test/fixtures/pkgtools/db/a-1.0,1/.gitignore0
-rw-r--r--test/fixtures/pkgtools/db/b-c-d-2.0_2/.gitignore0
-rw-r--r--test/fixtures/pkgtools/ports/.gitignore2
-rw-r--r--test/fixtures/pkgtools/ports/INDEX.dist3
-rw-r--r--test/fixtures/scp/config6
-rw-r--r--test/fixtures/scp/known_hosts4
-rw-r--r--test/fixtures/scp/spaced conf6
-rw-r--r--test/fixtures/sftp/config6
-rw-r--r--test/fixtures/sftp/known_hosts4
-rw-r--r--test/fixtures/sftp/spaced conf6
-rwxr-xr-xtest/fixtures/shared/bin/arp16
-rwxr-xr-xtest/fixtures/shared/bin/ifconfig24
-rw-r--r--test/fixtures/shared/default/bar0
-rw-r--r--test/fixtures/shared/default/bar bar.d/foo0
-rw-r--r--test/fixtures/shared/default/foo1
-rw-r--r--test/fixtures/shared/default/foo.d/foo0
-rw-r--r--test/fixtures/ssh/config1
-rw-r--r--test/fixtures/ssh/known_hosts5
-rw-r--r--test/fixtures/ssh/spaced conf6
-rw-r--r--test/fixtures/xz/a/b0
-rw-r--r--test/fixtures/xz/bashcomp.lzma0
-rw-r--r--test/fixtures/xz/bashcomp.tar0
-rw-r--r--test/fixtures/xz/bashcomp.tar.xzbin0 -> 196 bytes
-rw-r--r--test/fixtures/xz/bashcomp.tlz0
-rw-r--r--test/fixtures/xz/bashcomp.xz0
-rw-r--r--test/lib/completion.exp16
-rw-r--r--test/lib/completions/a2ps.exp20
-rw-r--r--test/lib/completions/abook.exp20
-rw-r--r--test/lib/completions/acroread.exp22
-rw-r--r--test/lib/completions/add_members.exp20
-rw-r--r--test/lib/completions/alias.exp43
-rw-r--r--test/lib/completions/animate.exp20
-rw-r--r--test/lib/completions/ant.exp20
-rw-r--r--test/lib/completions/apache2ctl.exp20
-rw-r--r--test/lib/completions/apt-build.exp20
-rw-r--r--test/lib/completions/apt-cache.exp20
-rw-r--r--test/lib/completions/apt-get.exp22
-rw-r--r--test/lib/completions/aptitude.exp20
-rw-r--r--test/lib/completions/arch.exp21
-rw-r--r--test/lib/completions/arpspoof.exp20
-rw-r--r--test/lib/completions/aspell.exp20
-rw-r--r--test/lib/completions/autoconf.exp20
-rw-r--r--test/lib/completions/automake.exp20
-rw-r--r--test/lib/completions/autorpm.exp20
-rw-r--r--test/lib/completions/awk.exp20
-rw-r--r--test/lib/completions/bash.exp20
-rw-r--r--test/lib/completions/bc.exp20
-rw-r--r--test/lib/completions/bison.exp20
-rw-r--r--test/lib/completions/bk.exp20
-rw-r--r--test/lib/completions/brctl.exp20
-rw-r--r--test/lib/completions/btdownloadcurses.py.exp20
-rw-r--r--test/lib/completions/btdownloadgui.py.exp20
-rw-r--r--test/lib/completions/btdownloadheadless.py.exp20
-rw-r--r--test/lib/completions/bzip2.exp20
-rw-r--r--test/lib/completions/c++.exp21
-rw-r--r--test/lib/completions/cancel.exp31
-rw-r--r--test/lib/completions/cardctl.exp20
-rw-r--r--test/lib/completions/cat.exp20
-rw-r--r--test/lib/completions/cc.exp20
-rw-r--r--test/lib/completions/cd.exp47
-rw-r--r--test/lib/completions/cdrecord.exp20
-rw-r--r--test/lib/completions/change_pw.exp20
-rw-r--r--test/lib/completions/check_db.exp20
-rw-r--r--test/lib/completions/check_perms.exp20
-rw-r--r--test/lib/completions/chgrp.exp20
-rw-r--r--test/lib/completions/chkconfig.exp20
-rw-r--r--test/lib/completions/chown.exp72
-rw-r--r--test/lib/completions/chsh.exp26
-rw-r--r--test/lib/completions/ci.exp20
-rw-r--r--test/lib/completions/civclient.exp20
-rw-r--r--test/lib/completions/civserver.exp20
-rw-r--r--test/lib/completions/cksfv.exp20
-rw-r--r--test/lib/completions/cleanarch.exp20
-rw-r--r--test/lib/completions/clisp.exp20
-rw-r--r--test/lib/completions/clone_member.exp20
-rw-r--r--test/lib/completions/co.exp20
-rw-r--r--test/lib/completions/composite.exp20
-rw-r--r--test/lib/completions/config_list.exp20
-rw-r--r--test/lib/completions/configure.exp20
-rw-r--r--test/lib/completions/convert.exp20
-rw-r--r--test/lib/completions/cowsay.exp20
-rw-r--r--test/lib/completions/cp.exp20
-rw-r--r--test/lib/completions/cpio.exp26
-rw-r--r--test/lib/completions/createdb.exp20
-rw-r--r--test/lib/completions/cryptsetup.exp20
-rw-r--r--test/lib/completions/csplit.exp20
-rw-r--r--test/lib/completions/cut.exp20
-rw-r--r--test/lib/completions/cvs.exp36
-rw-r--r--test/lib/completions/cvsps.exp36
-rw-r--r--test/lib/completions/date.exp20
-rw-r--r--test/lib/completions/dcop.exp22
-rw-r--r--test/lib/completions/dd.exp33
-rw-r--r--test/lib/completions/df.exp20
-rw-r--r--test/lib/completions/dhclient.exp20
-rw-r--r--test/lib/completions/dict.exp20
-rw-r--r--test/lib/completions/diff.exp20
-rw-r--r--test/lib/completions/dir.exp20
-rw-r--r--test/lib/completions/display.exp41
-rw-r--r--test/lib/completions/dnsspoof.exp20
-rw-r--r--test/lib/completions/dpkg-deb.exp20
-rw-r--r--test/lib/completions/dpkg-reconfigure.exp20
-rw-r--r--test/lib/completions/dpkg-source.exp20
-rw-r--r--test/lib/completions/dpkg.exp29
-rw-r--r--test/lib/completions/dropdb.exp20
-rw-r--r--test/lib/completions/dselect.exp20
-rw-r--r--test/lib/completions/dsniff.exp20
-rw-r--r--test/lib/completions/du.exp20
-rw-r--r--test/lib/completions/dumpdb.exp20
-rw-r--r--test/lib/completions/enscript.exp20
-rw-r--r--test/lib/completions/env.exp22
-rw-r--r--test/lib/completions/evince.exp35
-rw-r--r--test/lib/completions/expand.exp22
-rw-r--r--test/lib/completions/filesnarf.exp20
-rw-r--r--test/lib/completions/find.exp80
-rw-r--r--test/lib/completions/find_member.exp20
-rw-r--r--test/lib/completions/finger.exp57
-rw-r--r--test/lib/completions/fmt.exp22
-rw-r--r--test/lib/completions/fold.exp22
-rw-r--r--test/lib/completions/g++.exp20
-rw-r--r--test/lib/completions/g4.exp20
-rw-r--r--test/lib/completions/g77.exp20
-rw-r--r--test/lib/completions/gcc.exp20
-rw-r--r--test/lib/completions/gcj.exp20
-rw-r--r--test/lib/completions/gcl.exp20
-rw-r--r--test/lib/completions/gdb.exp20
-rw-r--r--test/lib/completions/genaliases.exp20
-rw-r--r--test/lib/completions/getent.exp20
-rw-r--r--test/lib/completions/gkrellm.exp20
-rw-r--r--test/lib/completions/gmplayer.exp20
-rw-r--r--test/lib/completions/gnatmake.exp20
-rw-r--r--test/lib/completions/gpc.exp20
-rw-r--r--test/lib/completions/gperf.exp20
-rw-r--r--test/lib/completions/gpg.exp20
-rw-r--r--test/lib/completions/gprof.exp22
-rw-r--r--test/lib/completions/grep.exp20
-rw-r--r--test/lib/completions/grub.exp20
-rw-r--r--test/lib/completions/gzip.exp28
-rw-r--r--test/lib/completions/hcitool.exp20
-rw-r--r--test/lib/completions/head.exp22
-rw-r--r--test/lib/completions/iconv.exp20
-rw-r--r--test/lib/completions/id.exp20
-rw-r--r--test/lib/completions/identify.exp20
-rw-r--r--test/lib/completions/ifdown.exp20
-rw-r--r--test/lib/completions/ifup.exp20
-rw-r--r--test/lib/completions/indent.exp20
-rw-r--r--test/lib/completions/info.exp20
-rw-r--r--test/lib/completions/inject.exp20
-rw-r--r--test/lib/completions/insmod.exp20
-rw-r--r--test/lib/completions/invoke-rc.d.exp20
-rw-r--r--test/lib/completions/ipsec.exp20
-rw-r--r--test/lib/completions/ipv6calc.exp26
-rw-r--r--test/lib/completions/irb.exp20
-rw-r--r--test/lib/completions/isql.exp23
-rw-r--r--test/lib/completions/iwconfig.exp20
-rw-r--r--test/lib/completions/iwlist.exp20
-rw-r--r--test/lib/completions/iwpriv.exp20
-rw-r--r--test/lib/completions/iwspy.exp20
-rw-r--r--test/lib/completions/jar.exp20
-rw-r--r--test/lib/completions/jarsigner.exp20
-rw-r--r--test/lib/completions/java.exp46
-rw-r--r--test/lib/completions/javac.exp20
-rw-r--r--test/lib/completions/javadoc.exp20
-rw-r--r--test/lib/completions/k3b.exp20
-rw-r--r--test/lib/completions/kdvi.exp27
-rw-r--r--test/lib/completions/kill.exp26
-rw-r--r--test/lib/completions/killall.exp26
-rw-r--r--test/lib/completions/kldload.exp20
-rw-r--r--test/lib/completions/kldunload.exp24
-rw-r--r--test/lib/completions/kpdf.exp26
-rw-r--r--test/lib/completions/kplayer.exp20
-rw-r--r--test/lib/completions/larch.exp20
-rw-r--r--test/lib/completions/ld.exp20
-rw-r--r--test/lib/completions/ldd.exp20
-rw-r--r--test/lib/completions/less.exp20
-rw-r--r--test/lib/completions/lftp.exp24
-rw-r--r--test/lib/completions/lftpget.exp20
-rw-r--r--test/lib/completions/lilo.exp20
-rw-r--r--test/lib/completions/links.exp20
-rw-r--r--test/lib/completions/lisp.exp20
-rw-r--r--test/lib/completions/list_admins.exp20
-rw-r--r--test/lib/completions/list_lists.exp20
-rw-r--r--test/lib/completions/list_members.exp20
-rw-r--r--test/lib/completions/list_owners.exp20
-rw-r--r--test/lib/completions/ln.exp20
-rw-r--r--test/lib/completions/look.exp22
-rw-r--r--test/lib/completions/ls.exp22
-rw-r--r--test/lib/completions/lvchange.exp20
-rw-r--r--test/lib/completions/lvcreate.exp20
-rw-r--r--test/lib/completions/lvdisplay.exp20
-rw-r--r--test/lib/completions/lvextend.exp20
-rw-r--r--test/lib/completions/lvm.exp20
-rw-r--r--test/lib/completions/lvmdiskscan.exp20
-rw-r--r--test/lib/completions/lvreduce.exp20
-rw-r--r--test/lib/completions/lvremove.exp20
-rw-r--r--test/lib/completions/lvrename.exp20
-rw-r--r--test/lib/completions/lvresize.exp20
-rw-r--r--test/lib/completions/lvs.exp20
-rw-r--r--test/lib/completions/lvscan.exp20
-rw-r--r--test/lib/completions/lzma.exp26
-rw-r--r--test/lib/completions/lzop.exp20
-rw-r--r--test/lib/completions/m4.exp22
-rw-r--r--test/lib/completions/macof.exp20
-rw-r--r--test/lib/completions/mailmanctl.exp20
-rw-r--r--test/lib/completions/mailsnarf.exp20
-rw-r--r--test/lib/completions/make.exp20
-rw-r--r--test/lib/completions/man.exp20
-rw-r--r--test/lib/completions/mc.exp20
-rw-r--r--test/lib/completions/mcrypt.exp20
-rw-r--r--test/lib/completions/md5sum.exp20
-rw-r--r--test/lib/completions/mdecrypt.exp20
-rw-r--r--test/lib/completions/mencoder.exp20
-rw-r--r--test/lib/completions/minicom.exp20
-rw-r--r--test/lib/completions/mkdir.exp20
-rw-r--r--test/lib/completions/mkfifo.exp20
-rw-r--r--test/lib/completions/mkinitrd.exp20
-rw-r--r--test/lib/completions/mkisofs.exp48
-rw-r--r--test/lib/completions/mknod.exp20
-rw-r--r--test/lib/completions/mmsitepass.exp20
-rw-r--r--test/lib/completions/module.exp20
-rw-r--r--test/lib/completions/mogrify.exp20
-rw-r--r--test/lib/completions/montage.exp20
-rw-r--r--test/lib/completions/mount.exp121
-rw-r--r--test/lib/completions/mplayer.exp20
-rw-r--r--test/lib/completions/msgsnarf.exp20
-rw-r--r--test/lib/completions/mtx.exp20
-rw-r--r--test/lib/completions/mutt.exp33
-rw-r--r--test/lib/completions/muttng.exp20
-rw-r--r--test/lib/completions/mv.exp20
-rw-r--r--test/lib/completions/mysqladmin.exp20
-rw-r--r--test/lib/completions/ncftp.exp20
-rw-r--r--test/lib/completions/netstat.exp20
-rw-r--r--test/lib/completions/newlist.exp20
-rw-r--r--test/lib/completions/nl.exp20
-rw-r--r--test/lib/completions/nm.exp20
-rw-r--r--test/lib/completions/ntpdate.exp20
-rw-r--r--test/lib/completions/objcopy.exp20
-rw-r--r--test/lib/completions/objdump.exp20
-rw-r--r--test/lib/completions/od.exp20
-rw-r--r--test/lib/completions/openssl.exp28
-rw-r--r--test/lib/completions/p4.exp20
-rw-r--r--test/lib/completions/pack200.exp20
-rw-r--r--test/lib/completions/paste.exp20
-rw-r--r--test/lib/completions/patch.exp20
-rw-r--r--test/lib/completions/perl.exp95
-rw-r--r--test/lib/completions/perldoc.exp38
-rw-r--r--test/lib/completions/pgrep.exp20
-rw-r--r--test/lib/completions/pine.exp20
-rw-r--r--test/lib/completions/ping.exp20
-rw-r--r--test/lib/completions/pkg-config.exp20
-rw-r--r--test/lib/completions/pkg_deinstall.exp22
-rw-r--r--test/lib/completions/pkg_delete.exp20
-rw-r--r--test/lib/completions/pkg_info.exp20
-rw-r--r--test/lib/completions/pkill.exp20
-rw-r--r--test/lib/completions/portinstall.exp22
-rw-r--r--test/lib/completions/portupgrade.exp21
-rw-r--r--test/lib/completions/povray.exp20
-rw-r--r--test/lib/completions/pr.exp20
-rw-r--r--test/lib/completions/psql.exp20
-rw-r--r--test/lib/completions/ptx.exp20
-rw-r--r--test/lib/completions/pvchange.exp20
-rw-r--r--test/lib/completions/pvcreate.exp20
-rw-r--r--test/lib/completions/pvdisplay.exp20
-rw-r--r--test/lib/completions/pvmove.exp20
-rw-r--r--test/lib/completions/pvremove.exp20
-rw-r--r--test/lib/completions/pvs.exp20
-rw-r--r--test/lib/completions/pvscan.exp20
-rw-r--r--test/lib/completions/python.exp20
-rw-r--r--test/lib/completions/qrunner.exp20
-rw-r--r--test/lib/completions/querybts.exp20
-rw-r--r--test/lib/completions/rcs.exp20
-rw-r--r--test/lib/completions/rcsdiff.exp20
-rw-r--r--test/lib/completions/rdict.exp20
-rw-r--r--test/lib/completions/readelf.exp20
-rw-r--r--test/lib/completions/readonly.exp20
-rw-r--r--test/lib/completions/remove_members.exp20
-rw-r--r--test/lib/completions/removepkg.exp20
-rw-r--r--test/lib/completions/renice.exp42
-rw-r--r--test/lib/completions/reportbug.exp20
-rw-r--r--test/lib/completions/ri.exp20
-rw-r--r--test/lib/completions/rlog.exp20
-rw-r--r--test/lib/completions/rm.exp20
-rw-r--r--test/lib/completions/rmdir.exp20
-rw-r--r--test/lib/completions/rmlist.exp20
-rw-r--r--test/lib/completions/rpcdebug.exp20
-rw-r--r--test/lib/completions/rpm.exp29
-rw-r--r--test/lib/completions/rsync.exp20
-rw-r--r--test/lib/completions/rtcwake.exp20
-rw-r--r--test/lib/completions/sbcl-mt.exp20
-rw-r--r--test/lib/completions/sbcl.exp20
-rw-r--r--test/lib/completions/scp.exp121
-rw-r--r--test/lib/completions/screen.exp52
-rw-r--r--test/lib/completions/sed.exp22
-rw-r--r--test/lib/completions/seq.exp20
-rw-r--r--test/lib/completions/service.exp20
-rw-r--r--test/lib/completions/set.exp20
-rw-r--r--test/lib/completions/sftp.exp77
-rw-r--r--test/lib/completions/sha1sum.exp20
-rw-r--r--test/lib/completions/shar.exp20
-rw-r--r--test/lib/completions/sitecopy.exp20
-rw-r--r--test/lib/completions/smartctl.exp20
-rw-r--r--test/lib/completions/snownews.exp20
-rw-r--r--test/lib/completions/sort.exp20
-rw-r--r--test/lib/completions/split.exp22
-rw-r--r--test/lib/completions/spovray.exp20
-rw-r--r--test/lib/completions/ssh.exp93
-rw-r--r--test/lib/completions/sshmitm.exp20
-rw-r--r--test/lib/completions/sshow.exp20
-rw-r--r--test/lib/completions/strace.exp20
-rw-r--r--test/lib/completions/strip.exp20
-rw-r--r--test/lib/completions/sudo.exp20
-rw-r--r--test/lib/completions/svk.exp20
-rw-r--r--test/lib/completions/svn.exp20
-rw-r--r--test/lib/completions/svnadmin.exp20
-rw-r--r--test/lib/completions/svnlook.exp20
-rw-r--r--test/lib/completions/sync_members.exp20
-rw-r--r--test/lib/completions/sysctl.exp22
-rw-r--r--test/lib/completions/tac.exp20
-rw-r--r--test/lib/completions/tail.exp22
-rw-r--r--test/lib/completions/tar.exp20
-rw-r--r--test/lib/completions/tcpkill.exp20
-rw-r--r--test/lib/completions/tcpnice.exp20
-rw-r--r--test/lib/completions/tee.exp20
-rw-r--r--test/lib/completions/texindex.exp20
-rw-r--r--test/lib/completions/tightvncviewer.exp20
-rw-r--r--test/lib/completions/time.exp20
-rw-r--r--test/lib/completions/touch.exp22
-rw-r--r--test/lib/completions/tr.exp22
-rw-r--r--test/lib/completions/unace.exp20
-rw-r--r--test/lib/completions/uname.exp22
-rw-r--r--test/lib/completions/unexpand.exp22
-rw-r--r--test/lib/completions/uniq.exp22
-rw-r--r--test/lib/completions/units.exp22
-rw-r--r--test/lib/completions/unpack200.exp20
-rw-r--r--test/lib/completions/unrar.exp20
-rw-r--r--test/lib/completions/unset.exp20
-rw-r--r--test/lib/completions/unshunt.exp20
-rw-r--r--test/lib/completions/update-alternatives.exp20
-rw-r--r--test/lib/completions/update-rc.d.exp20
-rw-r--r--test/lib/completions/urlsnarf.exp20
-rw-r--r--test/lib/completions/vdir.exp20
-rw-r--r--test/lib/completions/vgcfgbackup.exp20
-rw-r--r--test/lib/completions/vgcfgrestore.exp20
-rw-r--r--test/lib/completions/vgchange.exp20
-rw-r--r--test/lib/completions/vgck.exp20
-rw-r--r--test/lib/completions/vgconvert.exp20
-rw-r--r--test/lib/completions/vgcreate.exp20
-rw-r--r--test/lib/completions/vgdisplay.exp20
-rw-r--r--test/lib/completions/vgexport.exp20
-rw-r--r--test/lib/completions/vgextend.exp20
-rw-r--r--test/lib/completions/vgimport.exp20
-rw-r--r--test/lib/completions/vgmerge.exp20
-rw-r--r--test/lib/completions/vgmknodes.exp20
-rw-r--r--test/lib/completions/vgreduce.exp20
-rw-r--r--test/lib/completions/vgremove.exp20
-rw-r--r--test/lib/completions/vgrename.exp20
-rw-r--r--test/lib/completions/vgs.exp20
-rw-r--r--test/lib/completions/vgscan.exp20
-rw-r--r--test/lib/completions/vgsplit.exp20
-rw-r--r--test/lib/completions/vncviewer.exp22
-rw-r--r--test/lib/completions/wc.exp22
-rw-r--r--test/lib/completions/webmitm.exp20
-rw-r--r--test/lib/completions/wget.exp20
-rw-r--r--test/lib/completions/who.exp22
-rw-r--r--test/lib/completions/withlist.exp20
-rw-r--r--test/lib/completions/wol.exp29
-rw-r--r--test/lib/completions/wtf.exp20
-rw-r--r--test/lib/completions/wvdial.exp20
-rw-r--r--test/lib/completions/xhost.exp100
-rw-r--r--test/lib/completions/xmllint.exp20
-rw-r--r--test/lib/completions/xmlwf.exp20
-rw-r--r--test/lib/completions/xmms.exp20
-rw-r--r--test/lib/completions/xpovray.exp20
-rw-r--r--test/lib/completions/xrandr.exp20
-rw-r--r--test/lib/completions/xsltproc.exp20
-rw-r--r--test/lib/completions/xvnc4viewer.exp45
-rw-r--r--test/lib/completions/xz.exp33
-rw-r--r--test/lib/completions/ypcat.exp20
-rw-r--r--test/lib/completions/ypmatch.exp20
-rw-r--r--test/lib/completions/yum-arch.exp20
-rw-r--r--test/lib/completions/yum.exp20
-rw-r--r--test/lib/library.exp908
-rw-r--r--test/lib/library.sh75
-rw-r--r--test/lib/unit.exp17
-rw-r--r--test/unit/__expand_tilde_by_ref.exp87
-rw-r--r--test/unit/_count_args.exp68
-rw-r--r--test/unit/_filedir.exp267
-rw-r--r--test/unit/_get_comp_words_by_ref.exp386
-rw-r--r--test/unit/_get_cword.exp316
-rw-r--r--test/unit/_known_hosts_real.exp118
-rw-r--r--test/unit/compgen.exp52
-rw-r--r--test/unit/find_unique_completion_pair.exp37
1068 files changed, 18921 insertions, 4241 deletions
diff --git a/CHANGES b/CHANGES
new file mode 100644
index 00000000..e13527c0
--- /dev/null
+++ b/CHANGES
@@ -0,0 +1,710 @@
+bash-completion (1.2)
+
+ [ David Paleino ]
+ * Don't use pidof in _known_hosts_real() to detect whether Avahi is
+ available, since it's not available on MacOS X. Thanks to Rainer
+ Müller <raimue@codingfarm.de> (bash-completion MacPorts maintainer)
+ * Fixed "freq" and "rate" completion for iwconfig
+ * contrib/munin-node fixed (Debian: #550943)
+ * contrib/dpkg fixed -W and --show completing on .?(u)deb's (Debian: #552109)
+ * contrib/aptitude: add @(add|remove)-user-tag
+ * Added munindoc completion to contrib/munin-node, thanks to Tom
+ Feiner (Debian: #553371)
+ * Added colordiff completion, same as diff
+ * contrib/cpio: added missing completions for -?, --help, --license, --usage,
+ --version and (-p) --to-stdout (Debian: #557436)
+ * Style policy: don't use fancy globbing in case labels
+ * Added .fdf completion to okular and evince
+ * Added .okular completion to okular (Debian: #545530)
+ * Added lintian completion
+ * Refreshed reportbug completion, added --from-buildd (Debian: #579471)
+ * Special-case "apt-get source" (Debian: #572000)
+ * Added lintian completion (Debian: #547361)
+ * contrib/dpkg: update completion to current API
+ * Styleguide: establish line wrapping and $() instead of ``
+
+ [ Ville Skyttä ]
+ * Create bz2 dist tarball too.
+ * Include CHANGES in dist tarball.
+ * Include profile snippet in tarball, install it.
+ * Rename contrib/bluez-utils to contrib/bluez to follow bluez 4.x naming.
+ * Apply cardctl completion to pccardctl too.
+ * Apply pine completion to alpine too.
+ * Remove many unnecessary short option completions where long ones exist.
+ * Improve chsh, chgrp, chown, configure, curl, cvs, find, gkrellm, gzip,
+ iconv, lftp, look, lzma, make, man, mdadm, modprobe, mount, mplayer,
+ mysqladmin, perldoc, rsync, screen, service, scp, ssh, sshfs, unzip,
+ update-alternatives, vncviewer, wget, yp-tools, xine based players' and
+ general hostname completions.
+ * Add abook and wtf completion, based on work by Raphaël Droz.
+ * Add cvsps, dragon, fusermount, jarsigner, k3b, lftpget, modplug123,
+ pm-utils, rtcwake, pack200, unpack200, pbzip2, pbunzip2, pbzcat, pigz,
+ unpigz, and wol completions.
+ * Don't overwrite other host completions when completing from multiple
+ SSH known hosts files.
+ * Speed up installed rpm package completion on SUSE, based on work by
+ Marco Poletti (Alioth: #312021).
+ * Improve sourcing snippets from completion dirs.
+ * Drop support for bash < 3. The compatiblity global variables $bashN,
+ $default, $dirnames, $filenames, $compopt, $nospace, $bashdefault, and
+ $plusdirs have been dropped too. 3rd party completions should switch
+ to using the complete/compgen features directly, and BASH_VERSINFO
+ for bash version checks.
+ * Protect various completions from unusual user input by not embedding the
+ input in external command arguments (Debian: #552631).
+ * Add /sbin to $PATH when invoking ifconfig and iwconfig.
+ * Combine dcop and qdbus completions into the latter.
+ * awk and sed usage portability fixes (Alioth: #311393, Debian: #501479).
+ * Fix leaking local variables from various completions.
+ * Turn on -o filenames in _filedir on bash >= 4.
+ * Deprecate modules completion, upstream modules >= 3.2.7 ships one.
+ * Protect grep invocations from user aliases (Alioth: #312143).
+ * Split sshfs completion from contrib/ssh into contrib/sshfs.
+ * Split mount and umount completion into contrib/mount.
+ * Split service completion into contrib/service.
+ * Split chown, chgrp, and id completions into contrib/coreutils.
+ * Split kill, look, and renice completions into contrib/util-linux.
+ * Split killall, pkill, pgrep and related completions into contrib/procps.
+ * Split ipsec completion into contrib/ipsec.
+ * Split ifup and ifdown completions into contrib/ifupdown.
+ * Do basic HTML file completion with Firefox and Chrome and friends,
+ and Epiphany.
+ * Do basic diff/patch completion with cdiff and kompare.
+ * Don't install mock completion by default, it's in upstream mock > 1.1.0.
+ * Do basic text editor completion with xemacs, sxemacs, kate, and kwrite.
+ * Do meta-command completion for aoss and padsp.
+
+ [ Freddy Vulto ]
+ * Prevent root PATH expansion prolifering in _root_command (bash >= 4.1.4)
+ * Only complete xhost if (_)xhost is available.
+ * Added _get_comp_words_by_ref to replace both _get_cword & _get_pword.
+ Also additional variables `words' and `cword' can be returned.
+ * Added _upvar & _upvars helper functions to aid in passing variables
+ by reference.
+ * Make _filedir emulate `-o filenames'
+ * Fixed completion perl modules containing colons.
+ * Merged __get_cword3 & __get_cword4 to _get_cword.
+ * Added __expand_tilde_by_ref helper function.
+ * Added __ltrim_colon_completions to fix completions containing colons
+ * Improved mutt completion
+ * Added _get_pword helper function, thanks to Sung Pae (Alioth: #312030)
+
+ [ Ted Stern ]
+ * Fix modules completion for "(default)" entries.
+
+ [ Jeremie Lasalle Ratelle ]
+ * Fix rsync remote path completion (Alioth: #312173, Gentoo: #297818).
+
+ [ Leonard Crestez ]
+ * Improve ssh -o suboption completion (Alioth: #312122).
+ * Fix NFS mounts completion (Alioth: #312285).
+ * Fix completion of usernames (Alioth: #311396, Debian: #511788).
+ * Fix chown test crashing on systems with no root group (Alioth: #312306).
+ * Fixed tests when BASH_COMPLETION or TESTDIR contain spaces.
+ * Fix mount handling of escapes (Alioth: #311410, Launchpad: #219971,
+ Debian: #511149).
+ * Cleanup scripts to run tests. Make runUnit and runCompletion use test/run.
+ Make it possible to run tests from any directory.
+ * Add a --debug-xtrace option to test/run using BASH_XTRACEFD from bash-4.1.
+ * Add a --timeout option to test/run to override the default expect timeout.
+
+ [ Raphaël Droz ]
+ * Add xsltproc completion (Alioth: #311843).
+
+ [ Adrian Friedli ]
+ * Add ipv6calc completion.
+
+ [ Ildar Mulyukov ]
+ * Add showmount completion (Alioth: #312285).
+
+ [ Neville Gao ]
+ * Fix mount completion error "bash: [: too many arguments" (Alioth #312381).
+
+ [ Austin English ]
+ * Make lookup of wine file completions case insensitive.
+
+ [ Igor Murzov ]
+ * Improve xz completion (Alioth: #312466).
+
+ [ Mario Schwalbe ]
+ * Update find completion (Alioth: #312491, Launchpad: #570113).
+
+ [ Mark van Rossum ]
+ * Add basic lyx completion.
+
+ -- David Paleino <d.paleino@gmail.com> Wed, 16 Jun 2010 17:44:59 +0200
+
+bash-completion (1.1)
+
+ [ David Paleino ]
+ * Permit .gz files concatenation (Debian: #514377)
+ * Fix svk completion using $filenames instead of $default (Debian: #524961)
+ * Really add build-dep to aptitude's completion (Debian: #495883)
+ * Fix checks for GNUish userland, thanks to Robert Millan (Debian: #529510)
+ * Fix typo in .ass subtitles completion for mplayer (Debian: #531337)
+ * Fix regression on man(1) completion: also complete on local .3pm files
+ (Debian: #531343)
+ * Split mutt completion to contrib/mutt
+ * Split iconv completion to contrib/iconv
+ * Split dict completion to contrib/dict
+ * Split {update,invoke}-rc.d completions to contrib/sysv-rc
+ * Don't install _subversion anymore, upstream completion is better than
+ ours. Added to EXTRA_DIST in Makefile.am
+ * Split autorpm completion to contrib/autorpm
+ * Split jar completion to contrib/jar
+ * Split chkconfig completion to contrib/chkconfig
+ * Split chsh completion to contrib/chsh
+ * Split apt_build completion to contrib/apt-build
+ * Split aptitude-related completions to contrib/aptitude
+ * Split apt-cache and apt-get completions to contrib/apt
+ * Split rpm-related completions to contrib/rpm
+ * Split cvs-related completions to contrib/cvs
+ * Split man completion to contrib/man
+ * Split bash builtins completions to contrib/bash-builtins
+ * Split dpkg-related completions to contrib/dpkg (and re-enable usage
+ of grep-status if available)
+ * Split gcc completion to contrib/gcc
+ * Split dselect completion to contrib/dselect
+ * Split cardctl completion to contrib/cardctl
+ * Split pineaddr completion to contrib/pine
+ * Added avahi-discovered hosts to _known_hosts_real() (Debian: #518561)
+ * Added m4v completion to mplayer (Debian: #504213)
+ * Improve qemu completion (Debian: #534901)
+ * Added sshfs completion (shares the same as scp) (Debian: #545978)
+ * Fixed obvious brokenness (typos) in contrib/mdadm
+ * Clean [1.2.3.4]:port format in known_hosts, thanks to
+ Xuefer (Gentoo: #284563)
+ * Added --no-generate to "apt-cache pkgnames" calls, make it faster
+ on certain configurations (Debian: #547550)
+ * Split okular from evince filename extension completion, needed to add
+ okular-specific completions: xps, epub, odt, fb, mobi, g3 and chm.
+ Also, okular can read any of its formats also in .gz/.bz2 compressed
+ format, so change the regular expression to match this.
+ * Remove --with-suggests and --without-suggests from aptitude completion
+ * Patches from PLD Linux (thanks to Elan Ruusamäe):
+ - avoid sed pipe as ps itself can omit the headers
+ - improve service(8) completion, also look for "msg_usage"
+
+ [ Ville Skyttä ]
+ * Split yum completion to contrib/_yum (no longer installed by default, the
+ intent is to move it to yum upstream soon).
+ * Split yum-arch completion into contrib/yum-arch, load completion only if
+ yum-arch is installed.
+ * Update list of yum commands and options.
+ * Add yum repolist, --enable/disablerepo, --disableexcludes, -d, -e, --color,
+ and --enable/disableplugin completions.
+ * Add chkconfig --override and resetpriorities completions.
+ * Split mplayer and friends completions to contrib/mplayer.
+ * Parse top level mplayer and friends option completions from -list-options.
+ * Fix dir-only completion for make to include only dirs, not files.
+ * Remove unused variable RELEASE.
+ * Improve aspell dictionary completion: don't hardcode data-dir, get
+ canonical dicts from "aspell dicts".
+ * Always use /etc/shells for chsh -s completion, don't complete on comment
+ lines in it.
+ * Fix rpm --whatrequires/--whatprovides completions with spaces and other
+ unusual characters, add filename based --whatrequires completions.
+ * Add modplugplay filename completion.
+ * Add more mod-like audio file extensions for xine-based players and timidity.
+ * Complete on plain alternatives like update-alternatives.
+ * Rename installed_alternatives() to _installed_alternatives().
+ * Add /etc/pki/tls/openssl.cnf to list of default openssl config files,
+ search for default ones only if -config is not given.
+ * Use POSIX compliant arguments to tail in mkisofs completion.
+ * Protect various completions from unusual user input by not embedding the
+ input in external command arguments.
+ * Add _split_longopt() helper for improved handling of long options that
+ take arguments in both "--foo bar" and "--foo=bar" formats.
+ * Use _split_longopt to improve and clean up aspell, bluez-utils, chgrp,
+ chown, chkconfig, cpio, dpkg, heimdal, iptables, mailman, make, mc,
+ mii-diag, mii-tool, mkinitrd, pkg-config, postgresql, quota, reportbug,
+ samba, smartctl, yum, and generic long option completion (Alioth: #311398).
+ * Add chown --from and --reference value completions.
+ * Add chgrp --reference value completion.
+ * Do not assume all --foo= options take filenames in generic long option
+ completion, assume only that --*file*= does, and that --*dir*= takes dirs.
+ * Add make --old/new-file, --assume-old/new, --what-if value completions.
+ * Add smartctl -n/--nocheck completion, add more other value completions.
+ * Fix leaking $prev from cpio, dsniff, freeciv, gkrellm, mkinitrd, service,
+ and tcpdump completions.
+ * Split ant completion to contrib/ant, improve the built in one.
+ * Improve postfix completion.
+ * Improve samba completion.
+ * Split lilo completion to contrib/lilo.
+ * Split reportbug and querybts completions to contrib/reportbug.
+ * Remove debug output noise from quotaon completion.
+ * Split Linux wireless tools completion to contrib/wireless-tools.
+ * Add mock completion.
+ * Split FreeBSD kld(un)load completion to contrib/kldload.
+ * Split FreeBSD pkg_* completion to contrib/pkg_install.
+ * Split FreeBSD portupgrade and friends completion to contrib/portupgrade.
+ * Split Slackware pkgtools completion to contrib/pkgtools.
+ * Improve rpm group completion (displayed completions are still wrong).
+ * Change many completions to load in memory only if the completed commands
+ are available.
+ * Invoke the actual mplayer/mencoder command being completed (with full path)
+ to get various completions instead of simply "mplayer" or "mencoder".
+ * Associate OOXML/MS Office 2007 extensions with OpenOffice applications.
+ * Associate .tsv with oocalc.
+ * Add xmlwf completion.
+ * Associate *.po with poedit, gtranslator, kbabel, and lokalize.
+ * Add xz, xzcat, xzdec, and unxz completion.
+ * Add lzcat, lz*grep, lzless, lzmore, and unlzma completion.
+ * Load "modules" completion if /etc/profile.d/modules.sh exists even if
+ the "module" alias has not been defined (yet).
+ * Add *.ogv to xine-based players (Debian: #540033).
+ * Add $compopt (":" i.e. no-op with bash < 4, "compopt" with >= 4).
+ * Complete bzcat and zcat only on compressed files.
+ * Do not require a dot in bzcmp, bzdiff, bz*grep, zcmp, zdiff, z*grep, zless,
+ and zmore filename completions.
+ * Add xz and compress support and more tarball filename extensions to
+ rpmbuild -t*/--tarbuild completion.
+ * Don't hardcode path to lsmod.
+ * Fix sbcl file/dirname completion (Debian: #545743).
+ * Add /sbin to $PATH when invoking lspci and lsusb.
+ * Support .xz suffix in info page completions.
+ * Prevent rpm --define/-D completions from falling through.
+ * Add more common options to rpm option completions.
+
+ [ Todd Zullinger ]
+ * Make yum complete on filenames after install, deplist, update and upgrade
+ when the following argument contains a slash.
+
+ [ Mike Kelly ]
+ * Fix _filedir on bash 4.
+ * Add support for xz to tar completion.
+ * Fix _quote_readline on bash 4 (Debian: #544024).
+
+ [ Guillaume Rousse ]
+ * Split mkinitrd completion to contrib/mkinitrd, improve it.
+ * Split smartctl completion to contrib/smartctl.
+ * Better ssh and sftp completion
+ * Better xhost completion
+ * Split _known_hosts completion in two parts, to avoid parsing command line
+ twice
+ * Added strace completion
+ * Added xm completion
+ * Added rpcdebug completion
+ * Added msynctool completion
+ * Added openldap completion
+ * Added ldapvi completion
+ * Added heimdal completion
+ * Added vpnc completion
+ * Added rpmcheck completion
+ * Added munin-node completion
+ * Added bluez-utils completion
+ * Added samba completion
+ * Added cfengine completion
+ * Added xmllint completion, contributed by Ville
+ * Added shadow completion, contributed by Ville
+ * Added repomanage completion, contributed by Ville
+ * Splitted and enhanced openssl completion
+ * Added rfkill, mdadm and resolvconf completions
+
+ [ Raphaël Droz ]
+ * Add mount -L and -U completion.
+
+ [ Philipp Weis ]
+ * Add .dvi.{gz,bz2} completion for evince/okular (Debian: #522656)
+
+ [ Freddy Vulto ]
+ * Patched _known_hosts() to support multiple {Global,User}KnownHosts in SSH
+ config files, thanks to Thomas Nilsson (Alioth: #311595) (Debian: #524190)
+ * Fix leaking $i from info, man and python completions.
+ * Added setting COMP_KNOWN_HOSTS_WITH_HOSTFILE. _known_hosts_real() will add
+ hosts from HOSTFILE, unless COMP_KNOWN_HOSTS_WITH_HOSTFILE is set to an
+ empty value (Alioth: #311821)
+ * Quoted $cur to prevent globbing - thanks to Eric Blake (Alioth #311614)
+ * Fix leaking $muttcmd from mutt completion
+ * Fix completing multiple hosts (Debian: #535585)
+
+ [ Michele Ballabio ]
+
+ * Add more extensions to pkgtools completion.
+
+ -- David Paleino <d.paleino@gmail.com> Sat, 03 Oct 2009 15:41:49 +0200
+
+bash-completion (1.0)
+
+ [ Guillaume Rousse ]
+ * Make bibtex complete on .aux files
+ * Add .xvid and .XVID to player completion
+ * Added cowsay/cowthink completion
+ * Added brctl completion
+ * Added cpan2dist completion
+ * Added qemu completion
+ * Added net-tools (mii-tool and mii-diag) completions
+ * Added minicom completion
+ * Added quota-tools completion
+ * Added rdesktop completion
+ * Added tightvncviewer completion
+ * Cleanup screen completion, and make it completes on options
+
+ [ David Paleino ]
+ * Added .kar to Timidity completion.
+ * Fix killall completion, remove trailing ":" on certain process
+ names
+ * Fix man -l completing filenames (Debian: #497074)
+ * (Partly) fixed java classes completion (Debian: #496828). Look for
+ FIXME in source.
+ * Dump to /dev/null error message from look(1) with no arguments
+ (Debian: #495142)
+ * Set ssh as default for rsync (was rsh) (Debian: #492328)
+ * Added .oga, .ogv, .ogx to mplayer completion (Debian: #496162)
+ * Added .epub to unzip|zipinfo completion (Debian: #492476)
+ * Added ssh-copy-id completion (Debian: #491856)
+ * Moved ssh completion to separate file (Debian: #360628)
+ * Bogus completion when mounting subdirs fixed (Debian: #322238)
+ * Fix `apt-cache showsrc` completing only on source package names
+ (Debian: #361535)
+ * Fixed bugs with gdb completion:
+ - when an empty directory is in $PATH (thanks to Morita Sho)
+ (Debian: #497597)
+ - when a non-existing directory is in $PATH (Debian: #499780)
+ * Fix missing completion for "-n" and "-e" (we were using echo, now
+ using printf) (thanks to Morita Sho) (Debian: #498105)
+ * Fixed gpg completion:
+ - --@(export|@(?(l|nr|nrl)sign|edit)-key)) (Debian: #500316)
+ - -@(r|-recipient))
+ * Fixed .cb[rz] completion for evince (Debian: #502885)
+ * Added gksudo, gksu, kdesudo completion
+ * Added apache2ctl completion
+ * Added gpg2 completion (Debian: #489927)
+ * Fixed mplayer -skin completion (Debian: #501473)
+ * Fixed errors with POSIX enabled (Debian: #502804)
+ * Fixed dpkg-source wrong exit() with return() (Debian: #)
+ * Added --schedule-only to aptitude's completion (Debian: #502664)
+ * Added build-dep to aptitude's completion (Debian: #495883)
+ * Added support for `-F configfile' to _known_hosts(), ssh, scp and
+ sftp, thanks to Freddy Vulto (Debian: #504141)
+ * Fixed sed quoting bug in _known_hosts(), thanks to Freddy Vulto
+ (Debian: #504650)
+ * Allow `Host(Name)' in ssh config file to be indented
+ * Allow `Host(Name)' in ssh config file to have trailing comment.
+ * Allow for comments in known_hosts files (Debian: #511789)
+ * Fixed perl -I/-x completion, thanks to Freddy Vulto
+ (Debian: #504547)
+ * README updated: explain how to use bash-completion correctly.
+ (Debian: #506560)
+ * TODO updated: the Alioth team is now upstream.
+ * Added qdbus completion, thanks to Terence Simpson (Ubuntu: #257903)
+ * Added monodevelop and mdtool completions.
+ * Split subversion-related completions to contrib/_subversion
+ (prefixed with _ to avoid file conflicts with upstream's one)
+ * Fixed completion of environment variables, thanks to Morita Sho
+ (Debian: #272660)
+ * Fix dpkg completion bug: it listed only non-Essential packages
+ (Debian: #511790)
+ * Fixed _dpkg_source completion (Debian: #503317)
+ * Added _parse_help() to try to parse options listed in $command
+ --help
+ * Fixed gzip completion to use _parse_help(), since the available
+ options vary with distributions
+ * Added to_review/ directory, where completions needing a review would
+ go. After it gets accepted, the completion would go into contrib/.
+ * Remove unused UNAME local variable in _info() (Debian: #501843)
+ * AUTHORS added
+ * Make _alias() use _get_cword
+ * Added .zip to jar completions (Debian: #521041)
+ * Merge from Gentoo:
+ - fix 'find' completion so that it properly completes on -?(i)whilename.
+ Patch by Ciaran McCreesh.
+ - use make -qp to parse the Makefile for us, so we get proper completion
+ on things like pattern rules. Patch by Mike Kelly <pioto@exherbo.org>.
+ - complete on gkrellm2 as well. Patch by Aaron Walker.
+ - fix CVS completion
+ * Merge from Ubuntu:
+ - consume error messages in configure completion (Ubuntu: #223882)
+ (Mika Fischer)
+ - quote $xspec in _filedir_xspec in case it is empty, which would
+ cause errors if there was no match under failglob. (Ubuntu: #194419)
+ (Mika Fischer)
+ * debian/links fixed (Debian: #494292)
+ * debian/control:
+ - fixed typo in the long description
+ - added Vcs-* fields
+ * debian/install:
+ - correctly install contrib/* under /etc/bash_completion.d/
+ * debian/copyright updated
+ * extra/dh_bash-completion:
+ - updated to support a list of files in debian/<package>.bash-completion
+ (Debian: #512917)
+
+ [ Ville Skyttä ]
+ * Added JPEG 2000 files to display completion, thanks to Bastien Nocera
+ (RedHat: #304771)
+ * Improved rpm macro completion.
+ * Added -E to rpm completion.
+ * Improved rpm backup file avoidance.
+ * Improved /var/log/rpmpkgs based rpm installed package completion.
+ * Improved performance of rpm -qa based rpm installed package completion.
+ * Improved features and performance of yum completion.
+ * Added support for p (POSIX) and x (x.org) man sections.
+ * Improved filename based man page completion.
+ * Added minimal sqlite3 completion.
+ * Improved getent completion (Ville Skyttä, Guillaume Rousse).
+ * (Re)fix gzip and bzip2 options completion.
+ * Improved svn filename completion (RedHat: #430059).
+ * Add lzma completion (Per Øyvind Karlsen, Ville Skyttä).
+ * Add .mp2 and .vdr to mplayer completion (RedHat: #444467).
+ * Add .mkv, .mp2 and .vdr to *xine completion (RedHat: #444467).
+ * Added lzop completion.
+ * Fix scp metacharacter escaping.
+ * Remove duplicate cpio completion, thanks to Freddy Vulto (Debian: #512823)
+ * Fix awk error in "modprobe -r /" completion (Debian: #512556).
+ * Expand ~foo to dir name more eagerly to avoid quoting issues.
+ * Fix -sourcepath handling in javadoc packages completion.
+ * Extract process name completion from _killall to _pnames, make it work
+ for others than Linux and FreeBSD.
+ * Fix process name completion with relative paths (RedHat: #484578).
+ * Use improved process name completion in pgrep in addition to killall.
+ * Enable pgrep and pkill completion if the commands are available, not just
+ on Linux and FreeBSD.
+ * Drop hg completion, an improved version is shipped with Mercurial
+ (contrib/bash_completion in the tarball).
+ * Make okular complete on same files as evince, thanks to Mary Ellen Foster
+ (RedHat: #486998).
+ * Apply ps2pdf completion to ps2pdf{12,13,14,wr} too.
+ * Simplify bash_completion.sh, return earlier in non-applicable environments.
+ * Remove obsolete --buildarch and --buildos rpm(build) completions.
+ * Add rpmbuild --target completion.
+ * Use "-profile help" to get mplayer and friends -profile completions.
+ * Fix local array initialization under bash 3.0, prevents "()" occurring in
+ file and dir name completions.
+
+ [ Freddy Vulto ]
+ * Restored `_display()' completion for `display' by removing
+ completion-by-extension for `display' (Alioth#311429)
+ * Removed duplicate completion option `-borderwidth' for `display'
+ * Prevent completion dir from being sourced twice if
+ BASH_COMPLETION_DIR and BASH_COMPLETION_COMPAT_DIR are equal (Alioth#311433)
+ * Make `_mii-tool()' and `_mii-diag()' POSIX-compliant
+ * Fix _isql completion waiting for grep input if $ODBCINI not set; handle
+ whitespace in $ODBCINI.
+ * Split vncviewer completion in _tightvncviewer() and _xvnc4viewer()
+ Added _realcommand() global function.
+
+ [ Jakob Unterwurzacher ]
+ * ps2pdf can run on .pdf files as well. (Debian: #516614, Ubuntu: #316943)
+
+ [ Santiago M. Mola ]
+ * Add .ape to mplayer supported extensions (Alioth#311510).
+
+ -- David Paleino <d.paleino@gmail.com> Wed, 25 Mar 2009 23:18:24 +0100
+
+bash-completion (20080705) unstable; urgency=low
+
+ [ David Paleino ]
+ * Added more completions to imagemagick (thanks to Nelson A. de
+ Oliveira) (Debian: #487786)
+ * Added xrandr completion (thanks to Anton Khirnov) (Debian: #487825)
+ * Improving _gdb completion:
+ - $filenames to $default (Debian: #463969)
+ - also show directory names (i.e. compgen -d) in COMPREPLY.
+ - added . to $PATH, to allow debugging "local" executables.
+ - do not complete Bash's builtins (thanks to Morita Sho)
+
+ [ Luk Claes ]
+ * Remove use of ucf for /etc/bash-completion (Debian: #488171).
+
+ -- Luk Claes <luk@debian.org> Sat, 05 Jul 2008 16:14:15 +0200
+
+bash-completion (20080617.5) unstable; urgency=medium
+
+ * Revert way of setting environment variables (Debian: #487774).
+ * Add equals sign to _get_cword for mutt_aliases (Debian: #482635).
+ * Enhance mlayer completion (Debian: #487826, #487838).
+
+ -- Luk Claes <luk@debian.org> Tue, 24 Jun 2008 19:50:57 +0200
+
+bash-completion (20080617.4) experimental; urgency=low
+
+ [ David Paleino ]
+ * Merged Ubuntu changes:
+ - added quote(), quote_readline(), dequote() helper functions.
+ - added _remove_word()
+ - fixed _get_cword()
+ - refactored _filedir using quote_readline()
+ - refactored _filedir_xspec using quote_readline()
+ - fixed COMPREPLY's in _iwconfig
+ - fixed _cvs()
+ - _known_hosts(): use files from UserKnownHostsFile options in
+ addition to standard ones.
+ - fixed _command() to correctly prune the command line
+ - disabled completion of PostgreSQL users and databases (Ubuntu: #164772)
+ - fixed _java_packages()
+ - fixed _muttquery()
+ - added flv/FLV completion to mplayer
+ - added --installed to apt-cache
+ - only complete on filenames for aspell
+ - fixed code for exclusions compspecs
+ - added code to gracefully handle debug options (set +/-v)
+
+ -- Luk Claes <luk@debian.org> Mon, 23 Jun 2008 19:25:25 +0200
+
+bash-completion (20080617.3) unstable; urgency=low
+
+ [ David Paleino ]
+ * Fixed IFS for filedir_xspec - Thanks to Stefan Lippers-Hollmann
+ (Debian: #487571)
+
+ [ Luk Claes ]
+ * Install dh-bash-completion to ease installation of completions.
+
+ -- Luk Claes <luk@debian.org> Mon, 23 Jun 2008 07:24:21 +0200
+
+bash-completion (20080617.2) unstable; urgency=low
+
+ [ David Paleino ]
+ * New upstream release
+ - provide a manpage for extra/dh_bash-completion
+ - fix semi-serious problem with _filedir() (Debian: #487449)
+ * debian/rules:
+ - added rule to generate dh_bash-completion's manpage
+ * debian/install, debian/dirs:
+ - installing dh_bash-completion into /usr/bin
+ * debian/control:
+ - new package dh-bash-completion
+
+ [ Luk Claes ]
+ * Comment new package to make sure current fix gets in the archive first.
+ * Add compression completion for vi(m).
+
+ -- Luk Claes <luk@debian.org> Sun, 22 Jun 2008 19:47:23 +0200
+
+bash-completion (20080617.1) unstable; urgency=medium
+
+ [ David Paleino ]
+ * Urgency set to medium because the package is currently unusable.
+ * New upstream sub-release
+ - fixed some typos here and there which prevented bash completions
+ at all (Debian: #487441).
+ - really closing Debian bug #455510.
+
+ -- Luk Claes <luk@debian.org> Sun, 22 Jun 2008 00:22:53 +0200
+
+bash-completion (20080617) unstable; urgency=low
+
+ [ David Paleino ]
+ * New upstream release
+ - add more completions to aptitude (Debian: #432289)
+ - fixed UTF-8 problem with _get_cword(), thanks to
+ Andrei Paskevich (Debian: #472132)
+ - fixed autoremove completion, thanks to Flavio Visentin
+ (Debian: #474974)
+ - cmf and CMF added to playmidi completion (Debian: #365658)
+ - added rrdtool completion, thanks to Justin Pryzby (Debian: #428641)
+ - added OpenDocument completion for unzip/zipinfo (.od{f,g,p,s,t})
+ (Debian: #472940)
+ - fixed escaping problems with job control (i.e. disown, jobs, bg,
+ fg): the argument is now surrounded by "" (Debian: #347316)
+ - make mkdir complete also on filenames (Debian: #376433)
+ - {bz,z}{cat,cmp,diff,egrep,fgrep,grep,less,more} now should complete
+ on all filenames, not just compressed archives (just commented out)
+ (Debian: #455510)
+ - fixes Perl completion (Debian: #470742)
+ - fixes get_cword -> _get_cword typo (Debian: #478596)
+ - fixes _get_cword() function to properly handle filenames with
+ whitespaces (Debian: #394636, #468254, #474094)
+ - added .pdf.bz2 completion to evince (Debian: #424736)
+ - added .svg completion to display (Debian: #441017)
+ - added .m2ts completion to mplayer (Debian: #480879)
+ - added extra/dh_bash-completion to ease future rewrite of bc.
+ * debian/copyright - now in a fancier machine-parsable format.
+ * debian/control:
+ - added myself to Uploaders
+ - debhelper Build-Depends updated to >= 6.
+ * debian/watch:
+ - improved current watch line regex
+ - added (commented out) probable future watch line
+ * debian/compat bumped to 6
+ * debian/dirs, debian/install and debian/links added
+ * debian/rules:
+ - refactored to make use of debian/{dirs,install,links}
+
+ [ Steve Kemp ]
+ * Applied patch to fix completion of umount command.
+ (Debian: #470539)
+ * Fixed the completion of Perl manpages.
+ (Debian: #404976)
+ * Added 'aif' to the filenames offed for completion for mplayer.
+ (Debian: #474517)
+ * Allow tsocks completion.
+ (Debian: #409423)
+ * Update mutt completion to handle local usernames.
+ (Debian: #416655)
+ * Update apt-get completion to include the flag "--no-install-recommends"
+ (Debian: #475242)
+
+ -- Luk Claes <luk@debian.org> Sat, 21 Jun 2008 21:59:43 +0200
+
+bash-completion (20060301-4) unstable; urgency=low
+
+ * Add some fixes from Ubuntu:
+ * Fix completion of filenames with spaces (Debian: #468254).
+ * Fix parsing of SSH config files (Debian: #435117).
+ * Change priority to standard (Debian: #471666).
+ * Add some more completions for xine (Debian: #452083, #471249).
+ * Fix completion of gzip (Debian: #351913).
+ * Also use $HOSTFILE in hostname completion (Debian: #400380).
+
+ -- Luk Claes <luk@debian.org> Sat, 22 Mar 2008 23:10:30 +0000
+
+bash-completion (20060301-3) unstable; urgency=low
+
+ * Fix kpdf completion (Debian: #468163, #413374).
+ * Fix completion of - or -- with _command (Debian: #415276).
+ * Add sux to the complete -u list (Debian: #466089).
+ * Add dvipdfm to the list of dvi programs (Debian: #396644).
+ * Add --purge-unused option completion for aptitude (Debian: #438471).
+ * Add divx extension completion for mplayer (Debian: #444294).
+ * Add pdf.gz completion for evince (Debian: #456887).
+ * Add --remove-all completion for update-alternatives (Debian: #269173).
+
+ -- Luk Claes <luk@debian.org> Wed, 05 Mar 2008 22:57:27 +0100
+
+bash-completion (20060301-2) unstable; urgency=low
+
+ * Take over the package.
+
+ -- Luk Claes <luk@debian.org> Wed, 27 Feb 2008 19:22:03 +0100
+
+bash-completion (20060301-1) unstable; urgency=low
+
+ * Upload to unstable.
+
+ -- Matthias Klose <doko@debian.org> Sat, 09 Feb 2008 23:18:20 +0100
+
+bash-completion (20060301-0ubuntu2) hardy; urgency=low
+
+ * Replace bash (<< 3.1dfsg-9), handle upgrade in preinst.
+ * Exclude hashed hostnames from ssh host completion results. Debian: #428085.
+ * Fix: ifup/down don't really complete. Debian: #463756.
+ * Allow perl completion to complete filenames, complete -I and -x arguments.
+ Debian: #443394.
+ * Add find -wholename completion. Debian: #431220.
+ * Handle whitespaces in $HOME for _known_hosts() completion. Debian: #414821.
+ * dpkg -L: complete for removed-but-not-purged packages. Debian: #372156.
+ * Complete for apt-get autoremove. Debian: #433542, #443816, #445332.
+ * Update completion for mplayer (mka/flac). Debian: #340452.
+ * Add ping6/fping6 completion. Debian: #413170.
+ * Handle whitespace in paths for mount/umount completion. Debian: #367957.
+ * apt-get: Support --auto-remove. Ubuntu: #60666.
+
+ -- Matthias Klose <doko@ubuntu.com> Sat, 09 Feb 2008 23:11:32 +0100
+
+bash-completion (20060301-0ubuntu1) hardy; urgency=low
+
+ * Initial release, split out from the bash package.
+ The software currently is unsupported upstream.
+ * Don't try to set a readonly variable. Ubuntu: #149527.
+ * Support purge in apt-get auto completion (Mathias Gug). Ubuntu: #151677.
+ * evince: Autocomplete on cbr/cbz/djvu files. Ubuntu: #156200, #175220.
+ Debian: #400678.
+ * kdvi: complete .*\.dvi\.(gz|bz2). Ubuntu: #128234.
+ * kpdf: Complete postscript files. Ubuntu: #162319.
+ * Make completion working in the middle of a word (Adam Simpkins).
+ Ubuntu: #139666.
+
+ -- Matthias Klose <doko@ubuntu.com> Fri, 08 Feb 2008 16:46:34 +0100
+
diff --git a/Makefile.am b/Makefile.am
index 4631b9ed..93574a71 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,8 +1,10 @@
+SUBDIRS = test
sysconf_DATA = bash_completion
bashcompdir = $(sysconfdir)/bash_completion.d
-bashcomp_DATA = contrib/ant \
+bashcomp_DATA = contrib/abook \
+ contrib/ant \
contrib/apache2ctl \
contrib/apt \
contrib/apt-build \
@@ -13,7 +15,7 @@ bashcomp_DATA = contrib/ant \
contrib/bind-utils \
contrib/bitkeeper \
contrib/bittorrent \
- contrib/bluez-utils \
+ contrib/bluez \
contrib/brctl \
contrib/bzip2 \
contrib/cardctl \
@@ -23,12 +25,14 @@ bashcomp_DATA = contrib/ant \
contrib/cksfv \
contrib/clisp \
contrib/configure \
+ contrib/coreutils \
contrib/cowsay \
contrib/cpan2dist \
contrib/cpio \
contrib/cups \
+ contrib/cryptsetup \
contrib/cvs \
- contrib/dcop \
+ contrib/cvsps \
contrib/dd \
contrib/dhclient \
contrib/dict \
@@ -37,6 +41,7 @@ bashcomp_DATA = contrib/ant \
contrib/dsniff \
contrib/findutils \
contrib/freeciv \
+ contrib/fuse \
contrib/gcc \
contrib/gcl \
contrib/gdb \
@@ -48,20 +53,26 @@ bashcomp_DATA = contrib/ant \
contrib/gpg2 \
contrib/gzip \
contrib/heimdal \
+ contrib/hping2 \
contrib/iconv \
+ contrib/ifupdown \
contrib/imagemagick \
contrib/info \
contrib/iptables \
contrib/ipmitool \
+ contrib/ipsec \
+ contrib/ipv6calc \
contrib/isql \
contrib/jar \
contrib/java \
+ contrib/k3b \
contrib/kldload \
contrib/larch \
contrib/ldapvi \
contrib/lftp \
contrib/lilo \
contrib/links \
+ contrib/lintian \
contrib/lisp \
contrib/lvm \
contrib/lzma \
@@ -72,11 +83,12 @@ bashcomp_DATA = contrib/ant \
contrib/mc \
contrib/mcrypt \
contrib/mdadm \
+ contrib/medusa \
contrib/minicom \
contrib/mkinitrd \
- contrib/mock \
- contrib/modules \
+ contrib/module-init-tools \
contrib/monodevelop \
+ contrib/mount \
contrib/mplayer \
contrib/msynctool \
contrib/mtx \
@@ -85,6 +97,7 @@ bashcomp_DATA = contrib/ant \
contrib/mysqladmin \
contrib/ncftp \
contrib/net-tools \
+ contrib/nmap \
contrib/ntpdate \
contrib/openldap \
contrib/openssl \
@@ -94,17 +107,18 @@ bashcomp_DATA = contrib/ant \
contrib/pkg-config \
contrib/pkg_install \
contrib/pkgtools \
+ contrib/pm-utils \
contrib/portupgrade \
contrib/postfix \
contrib/postgresql \
contrib/povray \
+ contrib/procps \
contrib/python \
contrib/qdbus \
contrib/qemu \
contrib/quota-tools \
contrib/rcs \
contrib/rdesktop \
- contrib/repomanage \
contrib/reportbug \
contrib/resolvconf \
contrib/rfkill \
@@ -114,14 +128,17 @@ bashcomp_DATA = contrib/ant \
contrib/rpmcheck \
contrib/rrdtool \
contrib/rsync \
+ contrib/rtcwake \
contrib/samba \
contrib/sbcl \
contrib/screen \
+ contrib/service \
contrib/shadow \
contrib/sitecopy \
contrib/smartctl \
contrib/snownews \
contrib/ssh \
+ contrib/sshfs \
contrib/strace \
contrib/svk \
contrib/sysctl \
@@ -131,10 +148,13 @@ bashcomp_DATA = contrib/ant \
contrib/unace \
contrib/unrar \
contrib/update-alternatives \
+ contrib/util-linux \
contrib/vncviewer \
contrib/vpnc \
contrib/wireless-tools \
contrib/wodim \
+ contrib/wol \
+ contrib/wtf \
contrib/wvdial \
contrib/xhost \
contrib/xm \
@@ -142,8 +162,19 @@ bashcomp_DATA = contrib/ant \
contrib/xmlwf \
contrib/xmms \
contrib/xrandr \
+ contrib/xsltproc \
contrib/xz \
contrib/yp-tools \
contrib/yum-arch
-EXTRA_DIST = $(sysconf_DATA) $(bashcomp_DATA) contrib/_subversion contrib/_yum
+profiledir = $(sysconfdir)/profile.d
+profile_DATA = bash_completion.sh
+
+bash_completion.sh: bash_completion.sh.in Makefile
+ sed -e 's|@sysconfdir[@]|$(sysconfdir)|' <$(srcdir)/$@.in >$@
+
+CLEANFILES = bash_completion.sh
+
+EXTRA_DIST = CHANGES $(sysconf_DATA) $(bashcomp_DATA) bash_completion.sh.in \
+ contrib/_mock contrib/_modules contrib/_subversion contrib/_yum \
+ contrib/_yum-utils
diff --git a/Makefile.in b/Makefile.in
index 41c405b9..bbe6d5f3 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.11 from Makefile.am.
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@@ -47,6 +47,13 @@ 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/||"`;; \
@@ -68,8 +75,21 @@ 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)$(bashcompdir)" "$(DESTDIR)$(sysconfdir)"
-DATA = $(bashcomp_DATA) $(sysconf_DATA)
+am__installdirs = "$(DESTDIR)$(bashcompdir)" "$(DESTDIR)$(profiledir)" \
+ "$(DESTDIR)$(sysconfdir)"
+DATA = $(bashcomp_DATA) $(profile_DATA) $(sysconf_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 dist dist-all distcheck
+ETAGS = etags
+CTAGS = ctags
+DEJATOOL = $(PACKAGE)
+RUNTESTDEFAULTFLAGS = --tool $$tool --srcdir $$srcdir
+EXPECT = expect
+RUNTEST = runtest
+DIST_SUBDIRS = $(SUBDIRS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
@@ -77,7 +97,32 @@ am__remove_distdir = \
{ test ! -d "$(distdir)" \
|| { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
&& rm -fr "$(distdir)"; }; }
-DIST_ARCHIVES = $(distdir).tar.gz
+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"
+DIST_ARCHIVES = $(distdir).tar.gz $(distdir).tar.bz2
GZIP_ENV = --best
distuninstallcheck_listfiles = find . -type f -print
distcleancheck_listfiles = find . -type f -print
@@ -153,9 +198,11 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
+SUBDIRS = test
sysconf_DATA = bash_completion
bashcompdir = $(sysconfdir)/bash_completion.d
-bashcomp_DATA = contrib/ant \
+bashcomp_DATA = contrib/abook \
+ contrib/ant \
contrib/apache2ctl \
contrib/apt \
contrib/apt-build \
@@ -166,7 +213,7 @@ bashcomp_DATA = contrib/ant \
contrib/bind-utils \
contrib/bitkeeper \
contrib/bittorrent \
- contrib/bluez-utils \
+ contrib/bluez \
contrib/brctl \
contrib/bzip2 \
contrib/cardctl \
@@ -176,12 +223,14 @@ bashcomp_DATA = contrib/ant \
contrib/cksfv \
contrib/clisp \
contrib/configure \
+ contrib/coreutils \
contrib/cowsay \
contrib/cpan2dist \
contrib/cpio \
contrib/cups \
+ contrib/cryptsetup \
contrib/cvs \
- contrib/dcop \
+ contrib/cvsps \
contrib/dd \
contrib/dhclient \
contrib/dict \
@@ -190,6 +239,7 @@ bashcomp_DATA = contrib/ant \
contrib/dsniff \
contrib/findutils \
contrib/freeciv \
+ contrib/fuse \
contrib/gcc \
contrib/gcl \
contrib/gdb \
@@ -201,20 +251,26 @@ bashcomp_DATA = contrib/ant \
contrib/gpg2 \
contrib/gzip \
contrib/heimdal \
+ contrib/hping2 \
contrib/iconv \
+ contrib/ifupdown \
contrib/imagemagick \
contrib/info \
contrib/iptables \
contrib/ipmitool \
+ contrib/ipsec \
+ contrib/ipv6calc \
contrib/isql \
contrib/jar \
contrib/java \
+ contrib/k3b \
contrib/kldload \
contrib/larch \
contrib/ldapvi \
contrib/lftp \
contrib/lilo \
contrib/links \
+ contrib/lintian \
contrib/lisp \
contrib/lvm \
contrib/lzma \
@@ -225,11 +281,12 @@ bashcomp_DATA = contrib/ant \
contrib/mc \
contrib/mcrypt \
contrib/mdadm \
+ contrib/medusa \
contrib/minicom \
contrib/mkinitrd \
- contrib/mock \
- contrib/modules \
+ contrib/module-init-tools \
contrib/monodevelop \
+ contrib/mount \
contrib/mplayer \
contrib/msynctool \
contrib/mtx \
@@ -238,6 +295,7 @@ bashcomp_DATA = contrib/ant \
contrib/mysqladmin \
contrib/ncftp \
contrib/net-tools \
+ contrib/nmap \
contrib/ntpdate \
contrib/openldap \
contrib/openssl \
@@ -247,17 +305,18 @@ bashcomp_DATA = contrib/ant \
contrib/pkg-config \
contrib/pkg_install \
contrib/pkgtools \
+ contrib/pm-utils \
contrib/portupgrade \
contrib/postfix \
contrib/postgresql \
contrib/povray \
+ contrib/procps \
contrib/python \
contrib/qdbus \
contrib/qemu \
contrib/quota-tools \
contrib/rcs \
contrib/rdesktop \
- contrib/repomanage \
contrib/reportbug \
contrib/resolvconf \
contrib/rfkill \
@@ -267,14 +326,17 @@ bashcomp_DATA = contrib/ant \
contrib/rpmcheck \
contrib/rrdtool \
contrib/rsync \
+ contrib/rtcwake \
contrib/samba \
contrib/sbcl \
contrib/screen \
+ contrib/service \
contrib/shadow \
contrib/sitecopy \
contrib/smartctl \
contrib/snownews \
contrib/ssh \
+ contrib/sshfs \
contrib/strace \
contrib/svk \
contrib/sysctl \
@@ -284,10 +346,13 @@ bashcomp_DATA = contrib/ant \
contrib/unace \
contrib/unrar \
contrib/update-alternatives \
+ contrib/util-linux \
contrib/vncviewer \
contrib/vpnc \
contrib/wireless-tools \
contrib/wodim \
+ contrib/wol \
+ contrib/wtf \
contrib/wvdial \
contrib/xhost \
contrib/xm \
@@ -295,12 +360,19 @@ bashcomp_DATA = contrib/ant \
contrib/xmlwf \
contrib/xmms \
contrib/xrandr \
+ contrib/xsltproc \
contrib/xz \
contrib/yp-tools \
contrib/yum-arch
-EXTRA_DIST = $(sysconf_DATA) $(bashcomp_DATA) contrib/_subversion contrib/_yum
-all: all-am
+profiledir = $(sysconfdir)/profile.d
+profile_DATA = bash_completion.sh
+CLEANFILES = bash_completion.sh
+EXTRA_DIST = CHANGES $(sysconf_DATA) $(bashcomp_DATA) bash_completion.sh.in \
+ contrib/_mock contrib/_modules contrib/_subversion contrib/_yum \
+ contrib/_yum-utils
+
+all: all-recursive
.SUFFIXES:
am--refresh:
@@ -357,6 +429,26 @@ uninstall-bashcompDATA:
test -n "$$files" || exit 0; \
echo " ( cd '$(DESTDIR)$(bashcompdir)' && rm -f" $$files ")"; \
cd "$(DESTDIR)$(bashcompdir)" && 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
install-sysconfDATA: $(sysconf_DATA)
@$(NORMAL_INSTALL)
test -z "$(sysconfdir)" || $(MKDIR_P) "$(DESTDIR)$(sysconfdir)"
@@ -377,12 +469,173 @@ uninstall-sysconfDATA:
test -n "$$files" || exit 0; \
echo " ( cd '$(DESTDIR)$(sysconfdir)' && rm -f" $$files ")"; \
cd "$(DESTDIR)$(sysconfdir)" && 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: 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
+
+check-DEJAGNU: site.exp
+ srcdir=`$(am__cd) $(srcdir) && pwd`; export srcdir; \
+ EXPECT=$(EXPECT); export EXPECT; \
+ runtest=$(RUNTEST); \
+ if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \
+ exit_status=0; l='$(DEJATOOL)'; for tool in $$l; do \
+ if $$runtest $(AM_RUNTESTFLAGS) $(RUNTESTDEFAULTFLAGS) $(RUNTESTFLAGS); \
+ then :; else exit_status=1; fi; \
+ done; \
+ else echo "WARNING: could not find \`runtest'" 1>&2; :;\
+ fi; \
+ exit $$exit_status
+site.exp: Makefile
+ @echo 'Making a new site.exp file...'
+ @echo '## these variables are automatically generated by make ##' >site.tmp
+ @echo '# Do not edit here. If you wish to override these values' >>site.tmp
+ @echo '# edit the last section' >>site.tmp
+ @echo 'set srcdir $(srcdir)' >>site.tmp
+ @echo "set objdir `pwd`" >>site.tmp
+ @echo '## All variables above are generated by configure. Do Not Edit ##' >>site.tmp
+ @test ! -f site.exp || \
+ sed '1,/^## All variables above are.*##/ d' site.exp >> site.tmp
+ @-rm -f site.bak
+ @test ! -f site.exp || mv site.exp site.bak
+ @mv site.tmp site.exp
+
+distclean-DEJAGNU:
+ -rm -f site.exp site.bak
+ -l='$(DEJATOOL)'; for tool in $$l; do \
+ rm -f $$tool.sum $$tool.log; \
+ done
distdir: $(DISTFILES)
$(am__remove_distdir)
@@ -416,8 +669,37 @@ 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
-test -n "$(am__skip_mode_fix)" \
- || find "$(distdir)" -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
+ || find "$(distdir)" -type d ! -perm -755 \
+ -exec chmod u+rwx,go+rx {} \; -o \
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
@@ -425,7 +707,6 @@ distdir: $(DISTFILES)
dist-gzip: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
-
dist-bzip2: distdir
tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
$(am__remove_distdir)
@@ -453,6 +734,7 @@ dist-zip: distdir
dist dist-all: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+ tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
$(am__remove_distdir)
# This target untars the dist file and tries a VPATH configuration. Then
@@ -461,17 +743,17 @@ dist dist-all: distdir
distcheck: dist
case '$(DIST_ARCHIVES)' in \
*.tar.gz*) \
- GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
+ GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
*.tar.bz2*) \
- bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
+ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
*.tar.lzma*) \
- unlzma -c $(distdir).tar.lzma | $(am__untar) ;;\
+ lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\
*.tar.xz*) \
xz -dc $(distdir).tar.xz | $(am__untar) ;;\
*.tar.Z*) \
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
*.shar.gz*) \
- GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
+ GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
*.zip*) \
unzip $(distdir).zip ;;\
esac
@@ -531,21 +813,23 @@ distcleancheck: distclean
$(distcleancheck_listfiles) ; \
exit 1; } >&2
check-am: all-am
-check: check-am
+ $(MAKE) $(AM_MAKEFLAGS) check-DEJAGNU
+check: check-recursive
all-am: Makefile $(DATA)
-installdirs:
- for dir in "$(DESTDIR)$(bashcompdir)" "$(DESTDIR)$(sysconfdir)"; do \
+installdirs: installdirs-recursive
+installdirs-am:
+ for dir in "$(DESTDIR)$(bashcompdir)" "$(DESTDIR)$(profiledir)" "$(DESTDIR)$(sysconfdir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
-install: install-am
-install-exec: install-exec-am
-install-data: install-data-am
-uninstall: uninstall-am
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-installcheck: installcheck-am
+installcheck: installcheck-recursive
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
@@ -554,6 +838,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)
@@ -562,91 +847,101 @@ 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-am
+clean: clean-recursive
clean-am: clean-generic mostlyclean-am
-distclean: distclean-am
+distclean: distclean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -f Makefile
-distclean-am: clean-am distclean-generic
+distclean-am: clean-am distclean-DEJAGNU distclean-generic \
+ distclean-tags
-dvi: dvi-am
+dvi: dvi-recursive
dvi-am:
-html: html-am
+html: html-recursive
html-am:
-info: info-am
+info: info-recursive
info-am:
-install-data-am: install-bashcompDATA
+install-data-am: install-bashcompDATA install-profileDATA
-install-dvi: install-dvi-am
+install-dvi: install-dvi-recursive
install-dvi-am:
install-exec-am: install-sysconfDATA
-install-html: install-html-am
+install-html: install-html-recursive
install-html-am:
-install-info: install-info-am
+install-info: install-info-recursive
install-info-am:
install-man:
-install-pdf: install-pdf-am
+install-pdf: install-pdf-recursive
install-pdf-am:
-install-ps: install-ps-am
+install-ps: install-ps-recursive
install-ps-am:
installcheck-am:
-maintainer-clean: maintainer-clean-am
+maintainer-clean: maintainer-clean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -rf $(top_srcdir)/autom4te.cache
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
-mostlyclean: mostlyclean-am
+mostlyclean: mostlyclean-recursive
mostlyclean-am: mostlyclean-generic
-pdf: pdf-am
+pdf: pdf-recursive
pdf-am:
-ps: ps-am
+ps: ps-recursive
ps-am:
-uninstall-am: uninstall-bashcompDATA uninstall-sysconfDATA
-
-.MAKE: install-am install-strip
-
-.PHONY: all all-am am--refresh check check-am clean clean-generic dist \
- dist-all dist-bzip2 dist-gzip dist-lzma dist-shar dist-tarZ \
- dist-xz dist-zip distcheck distclean distclean-generic \
- distcleancheck distdir distuninstallcheck 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 \
- install-sysconfDATA installcheck installcheck-am installdirs \
- maintainer-clean maintainer-clean-generic mostlyclean \
- mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am \
- uninstall-bashcompDATA uninstall-sysconfDATA
-
+uninstall-am: uninstall-bashcompDATA uninstall-profileDATA \
+ uninstall-sysconfDATA
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) check-am \
+ ctags-recursive install-am install-strip tags-recursive
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+ all all-am am--refresh check check-DEJAGNU check-am clean \
+ clean-generic ctags ctags-recursive dist dist-all dist-bzip2 \
+ dist-gzip dist-lzma dist-shar dist-tarZ dist-xz dist-zip \
+ distcheck distclean distclean-DEJAGNU distclean-generic \
+ distclean-tags distcleancheck distdir distuninstallcheck 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-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-bashcompDATA uninstall-profileDATA \
+ uninstall-sysconfDATA
+
+
+bash_completion.sh: bash_completion.sh.in Makefile
+ sed -e 's|@sysconfdir[@]|$(sysconfdir)|' <$(srcdir)/$@.in >$@
# 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 7cfd1bd6..725678ac 100644
--- a/README
+++ b/README
@@ -1,59 +1,31 @@
INSTALLATION
------------
-The easiest way to install this software is to use a package, such as
-the RPM that I maintain for Red Hat Linux, the .deb package for
-Debian/GNU Linux or Ubuntu, etc. You still need to source it from either
-/etc/bashrc or ~/.bashrc (or any other file sourcing those). You can do
-this by simply using:
+The easiest way to install this software is to use a package; it is available
+in many operating system distributions. The package's name is usually
+bash-completion. Depending on the package, you may still need to source it
+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
-(if you happen to have *only* bash >= 2.04, see further if not)
+(if you happen to have *only* bash >= 3.2 installed, see further if not)
If you don't have the package readily available for your distribution, or
you simply don't want to do this, put the bash_completion file somewhere
on your system and source it from either /etc/bashrc or ~/.bashrc, as
explained above.
-Here's another possible way of doing that from /etc/bashrc:
-
-# Check for interactive shell.
-if [ -n "$PS1" ]; then
- if [ $bmajor -eq 2 -a $bminor '>' 04 ] || [ $bmajor -gt 2 ]; then
- if [ -r /etc/bash_completion ]; then
- # Source completion code.
- . /etc/bash_completion
- fi
- fi
-fi
-unset bash bminor bmajor
-
-This code checks that the version of bash that is parsing the code is
-later than 2.04 and, if so, sources the bash completion code.
-
-While this code may, at first, seem overly complex, the advantage of
-using it is that it will also parse correctly when interpreted by bash
-1.x. If you have bash 1.x and bash 2/3.x users on your system, you
-must avoid using constructs that were not valid under 1.x syntax.
-
-If your system has an /etc/profile.d directory, you might instead want
-to add a script called bash_completion.sh to that directory. Add the
-above code, preceded by the following:
-
-# Check for bash.
-[ -z "$BASH_VERSION" ] && return
-
-In this case, all *.sh scripts in /etc/profile.d are sourced from
-/etc/bashrc by Bourne-like shells, so you need the extra check for bash
-in order to avoid sourcing the rest of the script if a shell other than
-bash is running.
-
-For your convenience, a sample bash_completion.sh file is included in
-the package.
+A more elaborate way that takes care of not loading on old, unsupported
+bash versions as well as some other conditions is included in the bash
+completion package as bash_completion.sh. If your system has the
+/etc/profile.d directory and loads all files from it automatically,
+you may place the file in it. If not, place the file somewhere on your
+system and source it from /etc/bashrc or ~/.bashrc, or copy its contents
+to one of those files.
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
@@ -72,35 +44,10 @@ place to do this.
TROUBLESHOOTING
---------------
-If you get errors about 'complete' or 'compgen' not accepting the -g
-flag, you are probably running bash 2.05 and should either apply the
-group completion patch, download a prepatched bash binary of 2.05, or
-upgrade to 2.05a or later.
-
-If you find that some commands, such as 'cd /usr<Tab>', end with a
-trailing space instead of appending a /, you are probably running the
-base version of bash 2.05, which suffers from a bug that causes the
-'-o filenames' option to the complete built-in to be ignored. You can
-fix this by applying the following official patch from the bash
-maintainer:
-
- ftp://ftp.gnu.org/gnu/bash/bash-2.05b-patches/bash205b-006
-
-If you get errors about 'complete' not accepting the -o flag, you are
-probably running bash 2.04. In this case, you should upgrade to bash
-2.05a or later. However, I have endeavoured to make the code detect
-this version of bash and work around this issue, so please inform me
-if you still encounter this error.
-
-Copies of the patches and prepatched versions of bash are available
-from:
-
- http://www.caliban.org/bash/
-
If you find that a given function is producing errors under certain
circumstances when you attempt completion, try running 'set -v' or
'set -x' prior to attempting the completion again. This will produce
-useful debugging output that will aid me in fixing the problem if you
+useful debugging output that will aid us in fixing the problem if you
are unable to do so yourself. Turn off the trace output by running
either 'set +v' or 'set +x'.
@@ -142,7 +89,7 @@ If you are seeing 'unbound variable' warnings from bash when hitting
somewhere in your start-up files. This causes bash to flag the use of
any uninitialised shell variables as an error.
-Whilst I try to avoid references to uninitialised variables in the
+Whilst we try to avoid references to uninitialised variables in the
code, there seem to be at least some cases where bash issues this
warning even though the variable in question has been initialised.
@@ -151,36 +98,6 @@ function used by mutt completion, where the function calls itself
recursively. This seems to confuse bash and it issues spurious
warnings if 'nounset' is set.
-V.
-
-After upgrading to bash 3.1, you may notice that completing on certain
-commands now fails with a message something like this:
-
- sed: -e expression #1, char 20: unterminated `s' command
-
-The reason for this is that bash 3.1 contains the following,
-innocent-looking bug fix (from bash's CHANGES file):
-
- t. Fixed a bug that caused the expanded value of a $'...' string
- to be incorrectly re-quoted if it occurred within a
- double-quoted ${...} parameter expansion.
-
-Unfortunately, this also had the side effect of causing single quotes
-to be stripped from $'...' strings inside double-quoted command
-substitutions. Confused?
-
-Efforts have been made to work around this issue in the bash
-completion code as of the 20060301 release. All previous versions are
-vulnerable to the problem. However, it's possible that, even in the
-20060301 release and later, affected code remains.
-
-The issue has now been officially recognised as a regression in the
-bash 3.1 release and is fixed by official patch 11. If you encounter
-problems of this nature, please apply the patch below to your copy of
-bash:
-
- ftp://ftp.gnu.org/gnu/bash/bash-3.1-patches/bash31-011
-
FAQ
---
@@ -241,7 +158,7 @@ Q. When doing tar completion on a file within a tar file like this:
correctly. The slashes are removed and everything looks like it's
in a single directory. Why is this?
-A. It's a choice I had to make. bash's programmable completion is
+A. It's a choice we had to make. bash's programmable completion is
limited in how it handles the list of possible completions it
returns.
@@ -263,13 +180,13 @@ Q. When completing on a symlink to a directory, bash does not append
the trailing / and I have to hit <Tab> again. I don't like this.
A. This has nothing to do with bash_completion. It's the default for
- completing symlinks to directories in bash 2.05a, and was added
+ completing symlinks to directories since bash 2.05a, and was added
because sometimes you want to operate on the symlink itself, rather
than what it points to.
- In bash 2.05b and later, you can get the pre-2.05a behaviour back
- by putting 'set mark-symlinked-directories on' in your /etc/inputrc
- or ~/.inputrc file.
+ You can get the pre-2.05a behaviour back by putting
+ 'set mark-symlinked-directories on' in your /etc/inputrc or ~/.inputrc
+ file.
Q. Completion goes awry when I try to complete on something that contains
a colon.
@@ -295,14 +212,6 @@ A. This is actually a 'feature' of bash. bash recognises a colon as
Unfortunately, there's no way to turn this off. The only thing you
can do is escape the colons with a backslash.
-Q. Where did urpmi completion go?
-
-A. Guillaume Rousse <rousse@ccr.jussieu.fr> now maintains it separately as
- part of the urpmi RPM package.
-
- CVS: http://cvs.mandrakesoft.com/cgi-bin/cvsweb.cgi/soft/urpmi/
- Web: http://urpmi.org/
-
Q. Why is rpm completion so slow with -q?
A. Probably because the database is being queried every time and this uses a
@@ -335,7 +244,7 @@ A. The readline(3) library offers a few settings that can make tab
set show-all-if-ambiguous on
This will allow single tab completion as opposed to requiring a
- double tab. This makes things much more pleasant, in my opinion.
+ double tab. This makes things much more pleasant, in our opinion.
set visible-stats on
@@ -343,28 +252,10 @@ A. The readline(3) library offers a few settings that can make tab
denoting its type, in a similar way to ls(1) with -F or --classify.
set page-completions off
-
+
This turns off the use of the internal pager when returning long
completion lists.
-Q. This code is rubbish/not bad/pretty good/the best thing since
- sliced bread. How can I show my appreciation?
-
-A. If you're a registered Freshmeat user, take a moment to rate the
- project at:
-
- http://freshmeat.net/rate/19041/
-
- Of course, writing to me and letting me know how you feel also works.
- Patches and new completion routines are most welcome, too.
-
-Q. How can I stay abreast of new releases?
-
-A. If you're a registered Freshmeat user, you can subscribe to new release
- announcements at:
-
- http://freshmeat.net/subscribe/19041/
-
Q. Is bash the be-all-and-end-all of completion as far as shells go?
A. Absolutely not. zsh has an extremely sophisticated completion system
@@ -397,23 +288,16 @@ guidelines in mind:
start interpreters. Use lightweight programs such as grep(1), awk(1)
and sed(1).
-- Use the full power of bash 2.x. Programmable completion has only
- been available since bash 2.04, 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 2.04, since not everyone
- will be able to use them. Be ESPECIALLY careful of using features
- exclusive to 3.x, as many people are still using 2.x.
-
- For example, here strings (<<<) were not added until 2.05b, so don't
- use them for the time being.
+- Use the full power of bash >= 3.2. 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.
- Similarly, 3.0 added the use of the regex operator '=~', commonly
- found in Perl and Ruby. Whilst this is very useful, it's not yet
- safe to assume its ubiquity.
-
- On the other hand, extended globs were added in bash 2.02 and often
- enable you to avoid the use of external programs, which are
- expensive to fork and execute, so do make full use of those:
+ For example, extended globs often enable you to avoid the use of
+ external programs, which are expensive to fork and execute, so do
+ make full use of those:
?(pattern-list) - match zero or one occurrences of patterns
*(pattern-list) - match zero or more occurrences of patterns
@@ -460,15 +344,37 @@ guidelines in mind:
difference in speed), but all embedding cases should be documented
with rationale in comments in the code.
+- When completing available options, offer only the most descriptive
+ ones as completion results if there are multiple options that do the
+ same thing. Usually this means that long options should be preferred
+ over the corresponding short ones. This way the user is more likely
+ to find what she's looking for and there's not too much noise to
+ choose from, and there are less situations where user choice would be
+ needed in the first place. Note that this concerns only display of
+ available completions; argument processing/completion for options that
+ take an argument should be made to work with all known variants for
+ the functionality at hand. For example if -s, -S, and --something do
+ the same thing and require an argument, offer only --something as a
+ completion when completing option names starting with a dash, but do
+ implement required argument processing for all -s, -S, and --something.
+ Note that GNU versions of various standard commands tend to have long
+ options while other userland implementations of the same commands may
+ not have them, and it would be good to have the completions work for
+ as many userlands as possible so things aren't always that simple.
+
- Do not write to the file-system under any circumstances. This can
create race conditions, is inefficient, violates the principle of
least surprise and lacks robustness.
-- Send your patches as unified diffs. You can make these with
- 'diff -u'.
+- Send small, incremental diffs that do one thing. Don't cram unrelated
+ changes into a single diff.
-- Send small, incremental diffs that affect a single function. Don't
- cram massive, unrelated patches into a single diff.
+- 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').
- 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
@@ -477,20 +383,32 @@ guidelines in mind:
have a command with the same name.
In particular, do not use GNU extensions to commands like sed and
- awk if you can write your code another way. If you really must use
- them, however, do feel free to do so.
+ awk if you can write your code another way. If you really, REALLY must
+ use them, do so if there's no other sane way to do what you're doing.
+ The "Shell and Utilities" volume of the POSIX specification is a good
+ starting reference for portable use of various utilities, see
+ http://www.opengroup.org/onlinepubs/9699919799/
- Read the existing source code for examples of how to solve
particular problems. Read the bash man page for details of all the
programming tools available to you within the shell.
-- Please test your code thoroughly before sending it to me. I don't
- have access to all the commands for which I am sent completion
- functions, so I am unable to test them all personally. If your code
+- Please test your code thoroughly before sending it to us. We don't
+ have access to all the commands for which we are sent completion
+ functions, so we are unable to test them all personally. If your code
is accepted into the distribution, a lot of people will try it out,
so try to do a thorough job of eradicating all the bugs before you
- send it to me.
-
+ send it to us.
+
+- File bugs, enhancement requests (preferably with patches attached) at
+ the project tracker at https://alioth.debian.org/projects/bash-completion/
+ Sending them to the developers list usually works too, but bits are more
+ likely to fall through the cracks that way compared to the tracker.
+
+- Use printf(1) instead of echo(1) for portability reasons, and be sure to
+ invoke commands that are often found aliased (such as ls or grep etc)
+ using the "command" (or "builtin") command as appropriate.
+
--
-Ian Macdonald
-ian@caliban.org
+bash-completion developers
+bash-completion-devel@lists.alioth.debian.org
diff --git a/TODO b/TODO
index 10cdf89b..7a5afe5d 100644
--- a/TODO
+++ b/TODO
@@ -2,8 +2,8 @@ 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.1 and without regard for compatibility with
-the 2.x line.
+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
diff --git a/aclocal.m4 b/aclocal.m4
index 99803da4..af39c71a 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1,4 +1,4 @@
-# generated automatically by aclocal 1.11 -*- Autoconf -*-
+# generated automatically by aclocal 1.11.1 -*- Autoconf -*-
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
# 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
@@ -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.64],,
-[m4_warning([this file was generated for autoconf 2.64.
+m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.65],,
+[m4_warning([this file was generated for autoconf 2.65.
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'.])])
@@ -34,7 +34,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION],
[am__api_version='1.11'
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
dnl require some minimum version. Point them to the right macro.
-m4_if([$1], [1.11], [],
+m4_if([$1], [1.11.1], [],
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
])
@@ -50,7 +50,7 @@ m4_define([_AM_AUTOCONF_VERSION], [])
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-[AM_AUTOMAKE_VERSION([1.11])dnl
+[AM_AUTOMAKE_VERSION([1.11.1])dnl
m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
diff --git a/bash_completion b/bash_completion
index e1c40544..e7a4b6ec 100644
--- a/bash_completion
+++ b/bash_completion
@@ -1,9 +1,8 @@
#
-# bash_completion - programmable completion functions for bash 3.x
-# (backwards compatible with bash 2.05b)
+# bash_completion - programmable completion functions for bash 3.2+
#
# Copyright © 2006-2008, Ian Macdonald <ian@caliban.org>
-# © 2009, Bash Completion Maintainers
+# © 2009-2010, Bash Completion Maintainers
# <bash-completion-devel@lists.alioth.debian.org>
#
# This program is free software; you can redistribute it and/or modify
@@ -56,33 +55,6 @@ case ${UNAME} in
*) USERLAND=${UNAME} ;;
esac
-# features supported by bash 2.05 and higher
-if [ ${BASH_VERSINFO[0]} -eq 2 ] && [[ ${BASH_VERSINFO[1]} > 04 ]] ||
- [ ${BASH_VERSINFO[0]} -gt 2 ]; then
- declare -r bash205=$BASH_VERSION 2>/dev/null || :
- default="-o default"
- dirnames="-o dirnames"
- filenames="-o filenames"
- compopt=:
-fi
-# features supported by bash 2.05b and higher
-if [ ${BASH_VERSINFO[0]} -eq 2 ] && [[ ${BASH_VERSINFO[1]} = "05b" ]] ||
- [ ${BASH_VERSINFO[0]} -gt 2 ]; then
- declare -r bash205b=$BASH_VERSION 2>/dev/null || :
- nospace="-o nospace"
-fi
-# features supported by bash 3.0 and higher
-if [ ${BASH_VERSINFO[0]} -gt 2 ]; then
- declare -r bash3=$BASH_VERSION 2>/dev/null || :
- bashdefault="-o bashdefault"
- plusdirs="-o plusdirs"
-fi
-# features supported by bash 4.0 and higher
-if [ ${BASH_VERSINFO[0]} -gt 3 ]; then
- declare -r bash4=$BASH_VERSION 2>/dev/null || :
- compopt=compopt
-fi
-
# Turn on extended globbing and programmable completion
shopt -s extglob progcomp
@@ -97,11 +69,11 @@ complete -d pushd
#
# 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
-complete -f -X '!*.@(zip|ZIP|jar|JAR|exe|EXE|pk3|war|wsz|ear|zargo|xpi|sxw|ott|od[fgpst]|epub)' unzip zipinfo
+complete -f -X '!*.?(t)bz?(2)' bunzip2 bzcat pbunzip2 pbzcat
+complete -f -X '!*.@(zip|ZIP|[ejw]ar|[EJW]AR|exe|EXE|pk3|wsz|zargo|xpi|sxw|o[tx]t|od[fgpst]|epub)' unzip zipinfo
complete -f -X '*.Z' compress znew
# zcmp, zdiff, z*grep, zless, zmore intentionally not here, see Debian: #455510
-complete -f -X '!*.@(Z|gz|tgz|Gz|dz)' gunzip zcat
+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 '!*.lzma' lzcat lzegrep lzfgrep lzgrep lzless lzmore unlzma
@@ -114,13 +86,13 @@ complete -f -X '!*.@(dvi|DVI)?(.@(gz|Z|bz2))' kdvi
complete -f -X '!*.@(dvi|DVI)' dvips dviselect dvitype dvipdf advi dvipdfm dvipdfmx
complete -f -X '!*.@(pdf|PDF)' acroread gpdf xpdf
complete -f -X '!*.@(?(e)ps|?(E)PS|pdf|PDF)' kpdf
-complete -f -X '!*.@(@(?(e)ps|?(E)PS|pdf|PDF|dvi|DVI)?(.gz|.GZ|.bz2|.BZ2)|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)' evince
-complete -f -X '!*.@(?(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|FB|mobi|MOBI|g3|G3|chm|CHM)?(.?(gz|GZ|bz2|BZ2))' okular
+complete -f -X '!*.@(@(?(e)ps|?(E)PS|pdf|PDF|dvi|DVI)?(.gz|.GZ|.bz2|.BZ2)|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|fdf|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|FB|mobi|MOBI|g3|G3|chm|CHM|fdf|FDF)?(.?(gz|GZ|bz2|BZ2)))' okular
complete -f -X '!*.@(?(e)ps|?(E)PS|pdf|PDF)' ps2pdf ps2pdf12 ps2pdf13 ps2pdf14 ps2pdfwr
complete -f -X '!*.texi*' makeinfo texi2html
-complete -f -X '!*.@(?(la)tex|?(LA)TEX|texi|TEXI|dtx|DTX|ins|INS)' tex latex slitex jadetex pdfjadetex pdftex pdflatex texi2dvi
+complete -f -X '!*.@(?(la)tex|?(LA)TEX|texi|TEXI|dtx|DTX|ins|INS|ltx|LTX)' tex latex slitex jadetex pdfjadetex pdftex pdflatex texi2dvi
complete -f -X '!*.@(mp3|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|viv|rm|ram|yuv|mov|MOV|qt|QT|wmv|mp[234]|MP[234]|m4[pv]|M4[PV]|mkv|MKV|og[gmv]|OG[GMV]|wav|WAV|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))' xine aaxine fbxine kaffeine
+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]|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))' xine aaxine fbxine 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
@@ -129,12 +101,12 @@ complete -f -X '!*.@(mp3|MP3|ogg|OGG|pls|m3u)' gqmpeg freeamp
complete -f -X '!*.fig' xfig
complete -f -X '!*.@(mid?(i)|MID?(I)|cmf|CMF)' playmidi
complete -f -X '!*.@(mid?(i)|MID?(I)|rmi|RMI|rcp|RCP|[gr]36|[GR]36|g18|G18|mod|MOD|xm|XM|it|IT|x3m|X3M|s[3t]m|S[3T]M|kar|KAR)' timidity
-complete -f -X '!*.@(m[eo]d|M[EO]D|s[3t]m|S[3T]M|xm|XM|it|IT)' modplugplay
-complete -f -X '*.@(o|so|so.!(conf)|a|rpm|gif|GIF|jp?(e)g|JP?(E)G|mp3|MP3|mp?(e)g|MPG|avi|AVI|asf|ASF|ogg|OGG|class|CLASS)' vi vim gvim rvim view rview rgvim rgview gview
-complete -f -X '*.@(o|so|so.!(conf)|a|rpm|gif|GIF|jp?(e)g|JP?(E)G|mp3|MP3|mp?(e)g|MPG|avi|AVI|asf|ASF|ogg|OGG|class|CLASS)' emacs
-complete -f -X '!*.@(exe|EXE|com|COM|scr|SCR|exe.so)' wine
+complete -f -X '!*.@(m[eo]d|M[EO]D|s[3t]m|S[3T]M|xm|XM|it|IT)' modplugplay modplug123
+complete -f -X '*.@(o|so|so.!(conf)|a|rpm|gif|GIF|jp?(e)g|JP?(E)G|mp3|MP3|mp?(e)g|MPG|avi|AVI|asf|ASF|ogg|OGG|class|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|ZIP|z|Z|gz|GZ|tgz|TGZ)' bzme
-complete -f -X '!*.@(?([xX]|[sS])[hH][tT][mM]?([lL]))' netscape mozilla lynx opera galeon curl dillo elinks amaya
+# 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
@@ -142,12 +114,15 @@ 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 '!*.rpm' rpm2cpio
-complete -f -X '!*.sqlite' sqlite3
+complete -f -X '!*.s@(qlite?(3)|?(3)db)' sqlite3
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 '!*.@(dif?(f)|?(d)patch)' kompare
+complete -f -X '!*.lyx' lyx
# FINISH exclude -- do not remove this line
# start of section containing compspecs that can be handled within bash
@@ -193,14 +168,12 @@ complete -b builtin
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"
}
-# use GNU sed if we have it, since its extensions are still used in our code
-#
-[ $USERLAND != GNU ] && have gsed && alias sed=gsed
-
# This function checks whether a given readline variable
# is `on'.
#
@@ -215,19 +188,14 @@ quote()
echo \'${1//\'/\'\\\'\'}\' #'# Help vim syntax highlighting
}
-# This function quotes the argument in a way so that readline dequoting
-# results in the original argument
+# @see _quote_readline_by_ref()
quote_readline()
{
- if [ -n "$bash4" ] ; then
- # This function isn't really necessary on bash 4
- # See: http://lists.gnu.org/archive/html/bug-bash/2009-03/msg00155.html
- echo "${1}"
- return
- fi
- local t="${1//\\/\\\\}"
- echo \'${t//\'/\'\\\'\'}\' #'# Help vim syntax highlighting
-}
+ local quoted
+ _quote_readline_by_ref "$1" ret
+ printf %s "$ret"
+} # quote_readline()
+
# This function shell-dequotes the argument
dequote()
@@ -235,189 +203,490 @@ dequote()
eval echo "$1" 2> /dev/null
}
-# Get the word to complete.
-# This is nicer than ${COMP_WORDS[$COMP_CWORD]}, since it handles cases
-# where the user is completing in the middle of a word.
-# (For example, if the line is "ls foobar",
-# and the cursor is here --------> ^
-# it will complete just "foo", not "foobar", which is what the user wants.)
-# @param $1 string (optional) Characters out of $COMP_WORDBREAKS which should
+
+# Assign variable one scope above the caller
+# Usage: local "$1" && _upvar $1 "value(s)"
+# Param: $1 Variable name to assign value to
+# Param: $* Value(s) to assign. If multiple values, an array is
+# assigned, otherwise a single value is assigned.
+# NOTE: For assigning multiple variables, use '_upvars'. Do NOT
+# 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() {
+ if unset -v "$1"; then # Unset & validate varname
+ if (( $# == 2 )); then
+ eval $1=\"\$2\" # Return single value
+ else
+ eval $1=\(\"\${@:2}\"\) # Return array
+ fi
+ fi
+}
+
+
+# Assign variables one scope above the caller
+# Usage: local varname [varname ...] &&
+# _upvars [-v varname value] | [-aN varname [value ...]] ...
+# Available OPTIONS:
+# -aN Assign next N values to varname as array
+# -v Assign single value to varname
+# Return: 1 if error occurs
+# See: http://fvue.nl/wiki/Bash:_Passing_variables_by_reference
+_upvars() {
+ if ! (( $# )); then
+ echo "${FUNCNAME[0]}: usage: ${FUNCNAME[0]} [-v varname"\
+ "value] | [-aN varname [value ...]] ..." 1>&2
+ return 2
+ fi
+ while (( $# )); do
+ case $1 in
+ -a*)
+ # Error checking
+ [[ ${1#-a} ]] || { echo "bash: ${FUNCNAME[0]}: \`$1': missing"\
+ "number specifier" 1>&2; return 1; }
+ printf %d "${1#-a}" &> /dev/null || { echo "bash:"\
+ "${FUNCNAME[0]}: \`$1': invalid number specifier" 1>&2
+ return 1; }
+ # Assign array of -aN elements
+ [[ "$2" ]] && unset -v "$2" && eval $2=\(\"\${@:3:${1#-a}}\"\) &&
+ shift $((${1#-a} + 2)) || { echo "bash: ${FUNCNAME[0]}:"\
+ "\`$1${2+ }$2': missing argument(s)" 1>&2; return 1; }
+ ;;
+ -v)
+ # Assign single value
+ [[ "$2" ]] && unset -v "$2" && eval $2=\"\$3\" &&
+ shift 3 || { echo "bash: ${FUNCNAME[0]}: $1: missing"\
+ "argument(s)" 1>&2; return 1; }
+ ;;
+ *)
+ echo "bash: ${FUNCNAME[0]}: $1: invalid option" 1>&2
+ return 1 ;;
+ esac
+ done
+}
+
+
+# Reassemble command line words, excluding specified characters from the
+# list of word completion separators (COMP_WORDBREAKS).
+# @param $1 chars 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.
-# NOTE: This parameter only applies to bash-4.
+# we want to return host:path and not only path, so we would pass the
+# colon (:) as $1 here.
+# @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
+ # Exclude word separator characters?
+ if [[ $1 ]]; then
+ # Yes, exclude word separator characters;
+ # Exclude only those characters, which were really included
+ exclude="${1//[^$COMP_WORDBREAKS]}"
+ fi
+
+ # Default to cword unchanged
+ eval $3=$COMP_CWORD
+ # Are characters excluded which were former included?
+ if [[ $exclude ]]; then
+ # Yes, list of word completion separators has shrunk;
+ # 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?
+ while [[ $i -gt 0 && ${COMP_WORDS[$i]} &&
+ ${COMP_WORDS[$i]//[^$exclude]} == ${COMP_WORDS[$i]}
+ ]]; do
+ [ $j -ge 2 ] && ((j--))
+ # Append word separator to current 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
+ (( $i < ${#COMP_WORDS[@]} - 1)) && ((i++)) || break 2
+ done
+ # Append word to current word
+ ref="$2[$j]"
+ eval $2[$j]=\${!ref}\${COMP_WORDS[i]}
+ # Indicate new cword
+ [ $i = $COMP_CWORD ] && [[ ${COMP_WORDS[i]} ]] && eval $3=$j
+ done
+ else
+ # No, list of word completions separators hasn't changed;
+ eval $2=\( \"\${COMP_WORDS[@]}\" \)
+ fi
+} # __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.
+# @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() {
+ 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
-_get_cword()
-{
- if [ -n "$bash4" ] ; then
- __get_cword4 "$@"
+ # 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
+
+ if [[ "${words[cword]:0:${#cur}}" != "$cur" ]]; then
+ # We messed up. At least return the whole word so things keep working
+ cur2=${words[cword]}
else
- __get_cword3
+ cur2=${cur:0:$index}
fi
-} # _get_cword()
+
+ local "$2" "$3" "$4" &&
+ _upvars -a${#words[@]} $2 "${words[@]}" -v $3 "$cword" -v $4 "$cur2"
+}
-# Get the word to complete on bash-3, where words are not broken by
-# COMP_WORDBREAKS characters and the COMP_CWORD variables look like this, for
-# example:
+# Get the word to complete and optional previous words.
+# This is nicer than ${COMP_WORDS[$COMP_CWORD]}, since it handles cases
+# where the user is completing in the middle of a word.
+# (For example, if the line is "ls foobar",
+# and the cursor is here --------> ^
+# Also one is able to cross over possible wordbreak characters.
+# Usage: _get_comp_words_by_ref [OPTIONS] [VARNAMES]
+# Available VARNAMES:
+# cur Return cur via $cur
+# prev Return prev via $prev
+# words Return words via $words
+# cword Return cword via $cword
+#
+# Available OPTIONS:
+# -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.
+# -c VARNAME Return cur via $VARNAME
+# -p VARNAME Return prev via $VARNAME
+# -w VARNAME Return words via $VARNAME
+# -i VARNAME Return cword via $VARNAME
#
-# $ a b:c<TAB>
-# COMP_CWORD: 1
-# COMP_CWORDS:
-# 0: a
-# 1: b:c
+# Example usage:
#
-# See also:
-# _get_cword, main routine
-# __get_cword4, bash-4 variant
+# $ _get_comp_words_by_ref -n : cur prev
#
-__get_cword3()
+_get_comp_words_by_ref()
{
- if [[ "${#COMP_WORDS[COMP_CWORD]}" -eq 0 ]] || [[ "$COMP_POINT" == "${#COMP_LINE}" ]]; then
- printf "%s" "${COMP_WORDS[COMP_CWORD]}"
+ local exclude flag i OPTIND=1
+ local cur cword words=()
+ local upargs=() upvars=() vcur vcword vprev vwords
+
+ while getopts "c:i:n:p:w:" flag "$@"; do
+ case $flag in
+ c) vcur=$OPTARG ;;
+ i) vcword=$OPTARG ;;
+ n) exclude=$OPTARG ;;
+ p) vprev=$OPTARG ;;
+ w) vwords=$OPTARG ;;
+ esac
+ done
+ while [[ $# -ge $OPTIND ]]; do
+ case ${!OPTIND} in
+ cur) vcur=cur ;;
+ prev) vprev=prev ;;
+ cword) vcword=cword ;;
+ words) vwords=words ;;
+ *) echo "bash: $FUNCNAME(): \`${!OPTIND}': unknown argument" \
+ 1>&2; return 1
+ esac
+ let "OPTIND += 1"
+ done
+
+ __get_cword_at_cursor_by_ref "$exclude" words cword cur
+
+ [[ $vcur ]] && { upvars+=("$vcur" ); upargs+=(-v $vcur "$cur" ); }
+ [[ $vcword ]] && { upvars+=("$vcword"); upargs+=(-v $vcword "$cword"); }
+ [[ $vprev ]] && { upvars+=("$vprev" ); upargs+=(-v $vprev
+ "${words[cword - 1]}"); }
+ [[ $vwords ]] && { upvars+=("$vwords"); upargs+=(-a${#words[@]} $vwords
+ "${words[@]}"); }
+
+ (( ${#upvars[@]} )) && local "${upvars[@]}" && _upvars "${upargs[@]}"
+}
+
+
+# Get the word to complete.
+# This is nicer than ${COMP_WORDS[$COMP_CWORD]}, since it handles cases
+# where the user is completing in the middle of a word.
+# (For example, if the line is "ls foobar",
+# and the cursor is here --------> ^
+# @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.
+# @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
+# the current word, respecting the exclusions "=:".
+# @deprecated Use `_get_comp_words_by_ref cur' instead
+# @see _get_comp_words_by_ref()
+_get_cword()
+{
+ local LC_CTYPE=C
+ local cword words
+ __reassemble_comp_words_by_ref "$1" words cword
+
+ # return previous word offset by $2
+ if [[ ${2//[^0-9]/} ]]; then
+ printf "%s" "${words[cword-$2]}"
+ elif [[ "${#words[cword]}" -eq 0 ]] || [[ "$COMP_POINT" == "${#COMP_LINE}" ]]; then
+ printf "%s" "${words[cword]}"
else
local i
local cur="$COMP_LINE"
local index="$COMP_POINT"
- for (( i = 0; i <= COMP_CWORD; ++i )); do
+ for (( i = 0; i <= cword; ++i )); do
while [[
- # Current COMP_WORD fits in $cur?
- "${#cur}" -ge ${#COMP_WORDS[i]} &&
- # $cur doesn't match COMP_WORD?
- "${cur:0:${#COMP_WORDS[i]}}" != "${COMP_WORDS[i]}"
- ]]; do
+ # 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="$(( index - 1 ))"
+ ((index--))
done
- # Does found COMP_WORD matches COMP_CWORD?
- if [[ "$i" -lt "$COMP_CWORD" ]]; then
- # No, COMP_CWORD lies further;
+ # Does found word matches cword?
+ if [[ "$i" -lt "$cword" ]]; then
+ # No, cword lies further;
local old_size="${#cur}"
- cur="${cur#${COMP_WORDS[i]}}"
+ cur="${cur#${words[i]}}"
local new_size="${#cur}"
- index="$(( index - old_size + new_size ))"
+ index=$(( index - old_size + new_size ))
fi
done
- if [[ "${COMP_WORDS[COMP_CWORD]:0:${#cur}}" != "$cur" ]]; then
+ if [[ "${words[cword]:0:${#cur}}" != "$cur" ]]; then
# We messed up! At least return the whole word so things
# keep working
- printf "%s" "${COMP_WORDS[COMP_CWORD]}"
+ printf "%s" "${words[cword]}"
else
printf "%s" "${cur:0:$index}"
fi
fi
-} # __get_cword3()
+} # _get_cword()
-# Get the word to complete on bash-4, where words are splitted by
-# COMP_WORDBREAKS characters (default is " \t\n\"'><=;|&(:") and the COMP_CWORD
-# variables look like this, for example:
+# Get word previous to the current word.
+# This is a good alternative to `prev=${COMP_WORDS[COMP_CWORD-1]}' because bash4
+# will properly return the previous word with respect to any given exclusions to
+# COMP_WORDBREAKS.
+# @deprecated Use `_get_comp_words_by_ref cur prev' instead
+# @see _get_comp_words_by_ref()
#
-# $ a b:c<TAB>
-# COMP_CWORD: 3
-# COMP_CWORDS:
-# 0: a
-# 1: b
-# 2: :
-# 3: c
+_get_pword()
+{
+ if [ $COMP_CWORD -ge 1 ]; then
+ _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
+# 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.
+# The preferred solution is to remove the colon (:) from COMP_WORDBREAKS in
+# your .bashrc:
#
-# @oaram $1 string
-# $1 string (optional) 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.
-# See also:
-# _get_cword, main routine
-# __get_cword3, bash-3 variant
+# # Remove colon (:) from list of word completion separators
+# COMP_WORDBREAKS=${COMP_WORDBREAKS//:}
#
-__get_cword4()
-{
- local i
- local LC_CTYPE=C
- local WORDBREAKS=$COMP_WORDBREAKS
- # Strip single quote (') and double quote (") from WORDBREAKS to
- # workaround a bug in bash-4.0, where quoted words are split
- # unintended, see:
- # http://www.mail-archive.com/bug-bash@gnu.org/msg06095.html
- # This fixes simple quoting (e.g. $ a "b<TAB> returns "b instead of b)
- # but still fails quoted spaces (e.g. $ a "b c<TAB> returns c instead
- # of "b c).
- WORDBREAKS=${WORDBREAKS//\"/}
- WORDBREAKS=${WORDBREAKS//\'/}
- if [ -n "$1" ]; then
- for (( i=0; i<${#1}; ++i )); do
- local char=${1:$i:1}
- WORDBREAKS=${WORDBREAKS//$char/}
+# See also: Bash FAQ - E13) Why does filename completion misbehave if a colon
+# appears in the filename? - http://tiswww.case.edu/php/chet/bash/FAQ
+# @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
+ # Remove colon-word prefix from COMPREPLY items
+ local colon_word=${1%${1##*:}}
+ local i=${#COMPREPLY[*]}
+ while [ $((--i)) -ge 0 ]; do
+ COMPREPLY[$i]=${COMPREPLY[$i]#"$colon_word"}
done
fi
- local cur=${COMP_LINE:0:$COMP_POINT}
- local tmp=$cur
- local word_start=`expr "$tmp" : '.*['"$WORDBREAKS"']'`
- while [ "$word_start" -ge 2 ]; do
- # Get character before $word_start
- local char=${cur:$(( $word_start - 2 )):1}
- # If the WORDBREAK character isn't escaped, exit loop
- if [ "$char" != "\\" ]; then
- break
+} # __ltrim_colon_completions()
+
+
+# This function quotes the argument in a way so that readline dequoting
+# results in the original argument. This is necessary for at least
+# `compgen' which requires its arguments quoted/escaped:
+#
+# $ ls "a'b/"
+# c
+# $ compgen -f "a'b/" # Wrong, doesn't return output
+# $ compgen -f "a\'b/" # Good (bash-4)
+# a\'b/c
+# $ compgen -f "a\\\\\'b/" # Good (bash-3)
+# a\'b/c
+#
+# See also: http://lists.gnu.org/archive/html/bug-bash/2009-03/msg00155.html
+# @param $1 Argument to quote
+# @param $2 Name of variable to return result to
+_quote_readline_by_ref()
+{
+ if [[ ${1:0:1} == "'" ]]; then
+ # Quote word, leaving out first character
+ printf -v $2 %q "${1:1}"
+ if [[ ${BASH_VERSINFO[0]} -le 3 ]]; then
+ # Double-quote word on bash-3
+ printf -v $2 %q ${!2}
fi
- # The WORDBREAK character is escaped;
- # Recalculate $word_start
- tmp=${COMP_LINE:0:$(( $word_start - 2 ))}
- word_start=`expr "$tmp" : '.*['"$WORDBREAKS"']'`
- done
+ elif [[ ${BASH_VERSINFO[0]} -le 3 && ${1:0:1} == '"' ]]; then
+ printf -v $2 %q "${1:1}"
+ else
+ printf -v $2 %q "$1"
+ fi
- cur=${cur:$word_start}
- printf "%s" "$cur"
-} # __get_cword4()
+ # If result becomes quoted like this: $'string', re-evaluate in order to
+ # drop the additional quoting. See also: http://www.mail-archive.com/
+ # bash-completion-devel@lists.alioth.debian.org/msg01942.html
+ [[ ${!2:0:1} == '$' ]] && eval $2=${!2}
+} # _quote_readline_by_ref()
# This function performs file and directory completion. It's better than
# simply using 'compgen -f', because it honours spaces in filenames.
-# If passed -d, it completes only on directories. If passed anything else,
-# it's assumed to be a file glob to complete on.
+# @param $1 If `-d', complete only on directories. Otherwise filter/pick only
+# completions with `.$1' as file extension.
#
_filedir()
{
- local IFS=$'\t\n' xspec
+ local i IFS=$'\t\n' xspec
- _expand || return 0
+ __expand_tilde_by_ref cur
local -a toks
- local tmp
+ local quoted tmp
- # TODO: I've removed a "[ -n $tmp ] &&" before `echo $tmp',
- # and everything works again. If this bug
- # suddenly appears again (i.e. "cd /b<TAB>"
- # becomes "cd /"), remember to check for
- # other similar conditionals (here and
- # _filedir_xspec()). --David
- # NOTE: The comment above has been moved outside of the subshell below,
- # because quotes-in-comments-in-a-subshell cause errors on
- # bash-3.1. See also:
- # http://www.mail-archive.com/bug-bash@gnu.org/msg01667.html
+ _quote_readline_by_ref "$cur" quoted
toks=( ${toks[@]-} $(
- compgen -d -- "$(quote_readline "$cur")" | {
- while read -r tmp; do
- echo $tmp
- done
-}
-))
+ compgen -d -- "$quoted" | {
+ while read -r tmp; do
+ # TODO: I have removed a "[ -n $tmp ] &&" before 'printf ..',
+ # and everything works again. If this bug suddenly
+ # appears again (i.e. "cd /b<TAB>" becomes "cd /"),
+ # remember to check for other similar conditionals (here
+ # and _filedir_xspec()). --David
+ printf '%s\n' $tmp
+ done
+ }
+ ))
-if [[ "$1" != -d ]]; then
- xspec=${1:+"!*.$1"}
- toks=( ${toks[@]-} $(
- compgen -f -X "$xspec" -- "$(quote_readline "$cur")" | {
- while read -r tmp; do
- [ -n $tmp ] && echo $tmp
- done
-}
-))
+ # 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
+ #
+ if [[ "$1" != -d ]]; then
+ xspec=${1:+"!*.$1"}
+ if [[ ${cur:0:1} == "'" && ${BASH_VERSINFO[0]} -ge 4 ]]; then
+ toks=( ${toks[@]-} $(
+ eval compgen -f -X \"\$xspec\" -- $quoted
+ ) )
+ else
+ toks=( ${toks[@]-} $(
+ compgen -f -X "$xspec" -- $quoted
+ ) )
+ fi
+ if [ ${#toks[@]} -ne 0 ]; then
+ # If `compopt' is available, set `-o filenames'
+ compopt &>/dev/null && compopt -o filenames ||
+ # No, `compopt' isn't available;
+ # Is `-o filenames' set?
+ [[ (
+ ${COMP_WORDS[0]} &&
+ "$(complete -p ${COMP_WORDS[0]})" == *"-o filenames"*
+ ) ]] || {
+ # No, `-o filenames' isn't set;
+ # Emulate `-o filenames'
+ # NOTE: A side-effect of emulating `-o filenames' is that
+ # backslash escape characters are visible within the list
+ # of presented completions, e.g. the completions look
+ # like:
+ #
+ # $ foo a<TAB>
+ # a\ b/ a\$b/
+ #
+ # whereas with `-o filenames' active the completions look
+ # like:
+ #
+ # $ ls a<TAB>
+ # a b/ a$b/
+ #
+ for ((i=0; i < ${#toks[@]}; i++)); do
+ # If directory exists, append slash (/)
+ if [[ ${cur:0:1} != "'" ]]; then
+ [[ -d ${toks[i]} ]] && toks[i]="${toks[i]}"/
+ if [[ ${cur:0:1} == '"' ]]; then
+ toks[i]=${toks[i]//\\/\\\\}
+ toks[i]=${toks[i]//\"/\\\"}
+ toks[i]=${toks[i]//\$/\\\$}
+ else
+ toks[i]=$(printf %q ${toks[i]})
+ fi
+ fi
+ done
+ }
+ fi
fi
COMPREPLY=( "${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.
@@ -441,11 +710,8 @@ _split_longopt()
_parse_help() {
local cmd
cmd=$1
- $cmd --help | \
- grep -- "^[[:space:]]*-" | \
- tr "," " " | \
- awk '{print $1; if ($2 ~ /-.*/) { print $2 } }' | \
- sed -e "s:=.*::g"
+ $cmd --help 2>&1 | command grep -- "^[[:space:]]*-" | tr "," " " | \
+ awk '{print $1; if ($2 ~ /-.*/) { print $2 } }' | sed -e "s:=.*::g"
}
# This function completes on signal names
@@ -464,29 +730,49 @@ _signals()
done
}
+# This function completes on known mac addresses
+#
+_mac_addresses()
+{
+ local re='\([A-Fa-f0-9]\{2\}:\)\{5\}[A-Fa-f0-9]\{2\}'
+ local PATH="$PATH:/sbin:/usr/sbin"
+
+ # Local interfaces (Linux only?)
+ COMPREPLY=( "${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 \
+ "s/.*[[:space:]]\($re\)[[:space:]].*/\1/p" -ne \
+ "s/.*[[:space:]]\($re\)[[:space:]]*$/\1/p" ) )
+
+ COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) )
+ __ltrim_colon_completions "$cur"
+}
+
# This function completes on configured network interfaces
#
_configured_interfaces()
{
if [ -f /etc/debian_version ]; then
# Debian system
- COMPREPLY=( $( sed -ne 's|^iface \([^ ]\+\).*$|\1|p' \
- /etc/network/interfaces ) )
+ COMPREPLY=( $( compgen -W "$( sed -ne 's|^iface \([^ ]\{1,\}\).*$|\1|p'\
+ /etc/network/interfaces )" -- "$cur" ) )
elif [ -f /etc/SuSE-release ]; then
# SuSE system
- COMPREPLY=( $( command ls \
- /etc/sysconfig/network/ifcfg-* | \
- sed -ne 's|.*ifcfg-\('"$cur"'.*\)|\1|p' ) )
+ COMPREPLY=( $( compgen -W "$( printf '%s\n' \
+ /etc/sysconfig/network/ifcfg-* | \
+ sed -ne 's|.*ifcfg-\(.*\)|\1|p' )" -- "$cur" ) )
elif [ -f /etc/pld-release ]; then
# PLD Linux
- COMPREPLY=( $( command ls -B \
- /etc/sysconfig/interfaces | \
- sed -ne 's|.*ifcfg-\('"$cur"'.*\)|\1|p' ) )
+ COMPREPLY=( $( compgen -W "$( command ls -B \
+ /etc/sysconfig/interfaces | \
+ sed -ne 's|.*ifcfg-\(.*\)|\1|p' )" -- "$cur" ) )
else
# Assume Red Hat
- COMPREPLY=( $( command ls \
- /etc/sysconfig/network-scripts/ifcfg-* | \
- sed -ne 's|.*ifcfg-\('"$cur"'.*\)|\1|p' ) )
+ COMPREPLY=( $( compgen -W "$( printf '%s\n' \
+ /etc/sysconfig/network-scripts/ifcfg-* | \
+ sed -ne 's|.*ifcfg-\(.*\)|\1|p' )" -- "$cur" ) )
fi
}
@@ -513,10 +799,51 @@ _available_interfaces()
cmd="ifconfig -a"
fi
- COMPREPLY=( $( eval $cmd 2>/dev/null | \
- sed -ne 's|^\('"$cur"'[^[:space:][:punct:]]\{1,\}\).*$|\1|p') )
+ COMPREPLY=( $( eval PATH="$PATH:/sbin" $cmd 2>/dev/null | \
+ awk '/^[^ \t]/ { print $1 }' ) )
+ COMPREPLY=( $( compgen -W '${COMPREPLY[@]/%[[:punct:]]/}' -- "$cur" ) )
}
+
+# Expand variable starting with tilde (~)
+# Only the first portion of the variable from the tilde up to the first slash
+# (~../) is expanded. The remainder of the variable, containing for example
+# a dollar sign variable ($) or asterisk (*) is not expanded.
+# Example usage:
+#
+# $ v="~"; __expand_tilde_by_ref v; echo "$v"
+#
+# Example output:
+#
+# v output
+# -------- ----------------
+# ~ /home/user
+# ~foo/bar /home/foo/bar
+# ~foo/$HOME /home/foo/$HOME
+# ~foo/a b /home/foo/a b
+# ~foo/* /home/foo/*
+#
+# @param $1 Name of variable (not the value of the variable) to expand
+__expand_tilde_by_ref() {
+ # Does $1 start with tilde (~)?
+ if [ "${!1:0:1}" = "~" ]; then
+ # Does $1 contain slash (/)?
+ if [ "${!1}" != "${!1//\/}" ]; then
+ # Yes, $1 contains slash;
+ # 1: Remove * including and after first slash (/), i.e. "~a/b"
+ # becomes "~a". Double quotes allow eval.
+ # 2: Remove * before the first slash (/), i.e. "~a/b"
+ # becomes "b". Single quotes prevent eval.
+ # +-----1----+ +---2----+
+ eval $1="${!1/%\/*}"/'${!1#*/}'
+ else
+ # No, $1 doesn't contain slash
+ eval $1="${!1}"
+ fi
+ fi
+} # __expand_tilde_by_ref()
+
+
# This function expands tildes in pathnames
#
_expand()
@@ -540,7 +867,7 @@ _expand()
# This function completes on process IDs.
# AIX and Solaris ps prefers X/Open syntax.
-[ $UNAME = SunOS -o $UNAME = AIX ] &&
+[[ $UNAME == SunOS || $UNAME == AIX ]] &&
_pids()
{
COMPREPLY=( $( compgen -W '$( command ps -efo pid | sed 1d )' -- "$cur" ))
@@ -552,7 +879,7 @@ _pids()
# This function completes on process group IDs.
# AIX and SunOS prefer X/Open, all else should be BSD.
-[ $UNAME = SunOS -o $UNAME = AIX ] &&
+[[ $UNAME == SunOS || $UNAME == AIX ]] &&
_pgids()
{
COMPREPLY=( $( compgen -W '$( command ps -efo pgid | sed 1d )' -- "$cur" ))
@@ -564,13 +891,11 @@ _pgids()
# This function completes on process names.
# AIX and SunOS prefer X/Open, all else should be BSD.
-[ $UNAME = SunOS -o $UNAME = AIX ] &&
+[[ $UNAME == SunOS || $UNAME == AIX ]] &&
_pnames()
{
- COMPREPLY=( $( compgen -W '$( command ps -efo comm | \
- sed -e 1d -e "s:.*/::" -e "s/^-//" \
- -e "s/^<defunct>$//")' \
- -- "$cur" ) )
+ COMPREPLY=( $( compgen -X '<defunct>' -W '$( command ps -efo comm | \
+ sed -e 1d -e "s:.*/::" -e "s/^-//" | sort -u )' -- "$cur" ) )
} ||
_pnames()
{
@@ -582,11 +907,9 @@ _pnames()
# for now.
# Not using "ps axo comm" because under some Linux kernels, it
# truncates command names (see e.g. http://bugs.debian.org/497540#19)
- COMPREPLY=( $( compgen -W '$( command ps axo command= | \
- sed -e "s/ .*//; s:.*/::; s/:$//;" \
- -e "s/^[[(-]//; s/[])]$//" \
- -e "s/^<defunct>$//")' \
- -- "$cur" ) )
+ COMPREPLY=( $( compgen -X '<defunct>' -W '$( command ps axo command= | \
+ sed -e "s/ .*//" -e "s:.*/::" -e "s/:$//" -e "s/^[[(-]//" \
+ -e "s/[])]$//" | sort -u )' -- "$cur" ) )
}
# This function completes on user IDs
@@ -608,14 +931,13 @@ _uids()
_gids()
{
if type getent &>/dev/null; then
- COMPREPLY=( $( getent group | \
- awk -F: '{if ($3 ~ /^'"$cur"'/) print $3}' ) )
+ COMPREPLY=( $( compgen -W '$( getent group | cut -d: -f3 )' \
+ -- "$cur" ) )
elif type perl &>/dev/null; then
COMPREPLY=( $( compgen -W '$( perl -e '"'"'while (($gid) = (getgrent)[2]) { print $gid . "\n" }'"'"' )' -- "$cur" ) )
else
# make do with /etc/group
- COMPREPLY=( $( awk 'BEGIN {FS=":"} {if ($3 ~ /^'"$cur"'/) print $3}'\
- /etc/group ) )
+ COMPREPLY=( $( compgen -W '$( cut -d: -f3 /etc/group )' -- "$cur" ) )
fi
}
@@ -626,10 +948,12 @@ _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=( $( builtin echo $sysvdir/!(*.rpm@(orig|new|save)|*~|functions)) )
+ COMPREPLY=( $( printf '%s\n' \
+ $sysvdir/!(*.rpm@(orig|new|save)|*~|functions) ) )
if [ -d $famdir ]; then
- COMPREPLY=( "${COMPREPLY[@]}" $( builtin echo $famdir/!(*.rpm@(orig|new|save)|*~)) )
+ COMPREPLY=( "${COMPREPLY[@]}" $( printf '%s\n' \
+ $famdir/!(*.rpm@(orig|new|save)|*~) ) )
fi
COMPREPLY=( $( compgen -W '${COMPREPLY[@]#@($sysvdir|$famdir)/}' -- "$cur" ) )
@@ -641,8 +965,8 @@ _modules()
{
local modpath
modpath=/lib/modules/$1
- COMPREPLY=( $( command ls -R $modpath | \
- sed -ne 's/^\('"$cur"'.*\)\.k\?o\(\|.gz\)$/\1/p') )
+ COMPREPLY=( $( compgen -W "$( command ls -R $modpath | \
+ sed -ne 's/^\(.*\)\.k\{0,1\}o\(\.gz\)\{0,1\}$/\1/p' )" -- "$cur" ) )
}
# This function completes on installed modules
@@ -650,22 +974,41 @@ _modules()
_installed_modules()
{
COMPREPLY=( $( compgen -W "$( PATH="$PATH:/sbin" lsmod | \
- awk '{if (NR != 1) print $1}' )" -- $1 ) )
+ awk '{if (NR != 1) print $1}' )" -- "$1" ) )
}
-# This function completes on user:group format
+# This function completes on user or user:group format; as for chown and cpio.
#
+# The : must be added manually; it will only complete usernames initially.
+# The legacy user.group format is not supported.
+#
+# It assumes compopt -o filenames; but doesn't touch it.
_usergroup()
{
local IFS=$'\n'
- cur=${cur//\\\\ / }
- if [[ $cur = *@(\\:|.)* ]] && [ -n "$bash205" ]; then
- user=${cur%%*([^:.])}
- COMPREPLY=( $(compgen -P ${user/\\\\} -g -- ${cur##*[.:]}) )
- elif [[ $cur = *:* ]] && [ -n "$bash205" ]; then
- COMPREPLY=( $( compgen -g -- ${cur##*[.:]} ) )
+ if [[ $cur = *\\\\* || $cur = *:*:* ]]; then
+ # Give up early on if something seems horribly wrong.
+ return
+ elif [[ $cur = *\\:* ]]; then
+ # Completing group after 'user\:gr<TAB>'.
+ # Reply with a list of groups prefixed with 'user:', readline will
+ # escape to the colon.
+ local prefix
+ prefix=${cur%%*([^:])}
+ prefix=${prefix//\\}
+ COMPREPLY=( $( compgen -P "$prefix" -g -- "${cur#*[:]}" ) )
+ elif [[ $cur = *:* ]]; then
+ # Completing group after 'user:gr<TAB>'.
+ # Reply with a list of unprefixed groups since readline with split on :
+ # and only replace the 'gr' part
+ COMPREPLY=( $( compgen -g -- "${cur#*:}" ) )
else
- COMPREPLY=( $( compgen -S : -u -- "$cur" ) )
+ # Completing a partial 'usernam<TAB>'.
+ #
+ # Don't suffix with a : because readline will escape it and add a
+ # slash. It's better to complete into 'chown username ' than 'chown
+ # username\:'.
+ COMPREPLY=( $( compgen -u -- "$cur" ) )
fi
}
@@ -673,8 +1016,32 @@ _usergroup()
#
_shells()
{
- COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W '$( grep "^[[:space:]]*/" \
- /etc/shells 2>/dev/null )' -- "$cur" ) )
+ COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W \
+ '$( command grep "^[[:space:]]*/" /etc/shells 2>/dev/null )' \
+ -- "$cur" ) )
+}
+
+# This function completes on valid filesystem types
+#
+_fstypes()
+{
+ local fss
+
+ if [ -e /proc/filesystems ] ; then
+ # Linux
+ fss="$( cut -d$'\t' -f2 /proc/filesystems )
+ $( awk '! /\*/ { print $NF }' /etc/filesystems 2>/dev/null )"
+ else
+ # Generic
+ fss="$( awk '/^[ \t]*[^#]/ { print $3 }' /etc/fstab 2>/dev/null )
+ $( awk '/^[ \t]*[^#]/ { print $3 }' /etc/mnttab 2>/dev/null )
+ $( awk '/^[ \t]*[^#]/ { print $4 }' /etc/vfstab 2>/dev/null )
+ $( awk '{ print $1 }' /etc/dfs/fstypes 2>/dev/null )
+ $( [ -d /etc/fs ] && command ls /etc/fs )"
+ fi
+
+ [ -n "$fss" ] && \
+ COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "$fss" -- "$cur" ) )
}
# Get real command.
@@ -682,28 +1049,47 @@ _shells()
# - stdout: Filename of command in PATH with possible symbolic links resolved.
# Empty string if command not found.
# - return: True (0) if command found, False (> 0) if not.
-_realcommand() {
+_realcommand()
+{
type -P "$1" > /dev/null && {
- if type -p realpath > /dev/null; then
- realpath "$(type -P "$1")"
- elif type -p readlink > /dev/null; then
- readlink -f "$(type -P "$1")"
- else
- type -P "$1"
- fi
+ if type -p realpath > /dev/null; then
+ realpath "$(type -P "$1")"
+ elif type -p readlink > /dev/null; then
+ readlink -f "$(type -P "$1")"
+ else
+ type -P "$1"
+ fi
+ }
}
+
+# This function returns the first arugment, excluding options
+# @param $1 chars Characters out of $COMP_WORDBREAKS which should
+# NOT be considered word breaks. See __reassemble_comp_words_by_ref.
+_get_first_arg()
+{
+ local i
+
+ arg=
+ for (( i=1; i < COMP_CWORD; i++ )); do
+ if [[ "${COMP_WORDS[i]}" != -* ]]; then
+ arg=${COMP_WORDS[i]}
+ break
+ fi
+ done
}
-# this function count the number of mandatory args
-#
+# This function counts the number of args, excluding options
+# @param $1 chars Characters out of $COMP_WORDBREAKS which should
+# NOT be considered word breaks. See __reassemble_comp_words_by_ref.
_count_args()
{
+ local i cword words
+ __reassemble_comp_words_by_ref "$1" words cword
+
args=1
- for (( i=1; i < COMP_CWORD; i++ )); do
- if [[ "${COMP_WORDS[i]}" != -* ]]; then
- args=$(($args+1))
- fi
+ for i in "${words[@]:1:cword-1}"; do
+ [[ "$i" != -* ]] && args=$(($args+1))
done
}
@@ -712,7 +1098,7 @@ _count_args()
_pci_ids()
{
COMPREPLY=( ${COMPREPLY[@]:-} $( compgen -W \
- "$( PATH="$PATH:/sbin" lspci -n | awk '{print $3}')" -- "$cur" ) )
+ "$( PATH="$PATH:/sbin" lspci -n | awk '{print $3}')" -- "$cur" ) )
}
# This function completes on USB IDs
@@ -720,411 +1106,29 @@ _pci_ids()
_usb_ids()
{
COMPREPLY=( ${COMPREPLY[@]:-} $( compgen -W \
- "$( PATH="$PATH:/sbin" lsusb | awk '{print $6}' )" -- "$cur" ) )
-}
-
-# start of section containing completion functions for external programs
-
-# 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
-
-# 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=()
- prev=${COMP_WORDS[COMP_CWORD-1]}
- cur=`_get_cword`
-
- # 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
-
- # don't complete past 2nd token
- [ $COMP_CWORD -gt 2 ] && return 0
-
- [ -d /etc/rc.d/init.d ] && sysvdir=/etc/rc.d/init.d \
- || sysvdir=/etc/init.d
-
- if [[ $COMP_CWORD -eq 1 ]] && [[ $prev == "service" ]]; then
- _services
- else
- COMPREPLY=( $( compgen -W '`sed -ne "y/|/ /; \
- s/^.*\(U\|msg_u\)sage.*{\(.*\)}.*$/\1/p" \
- $sysvdir/${prev##*/} 2>/dev/null`' -- "$cur" ) )
- fi
-
- return 0
- } &&
- complete -F _service service
- [ -d /etc/init.d/ ] && complete -F _service $default \
- $(for i in /etc/init.d/*; do echo ${i##*/}; done)
-
- # chown(1) completion
- #
- _chown()
- {
- local cur prev split=false
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- _split_longopt && split=true
-
- case "$prev" in
- --from)
- _usergroup
- return 0
- ;;
- --reference)
- _filedir
- return 0
- ;;
- esac
-
- $split && return 0
-
- # options completion
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-c -h -f -R -v --changes \
- --dereference --no-dereference --from --silent --quiet \
- --reference --recursive --verbose --help --version' -- "$cur" ) )
- else
- _count_args
-
- case $args in
- 1)
- _usergroup
- ;;
- *)
- _filedir
- ;;
- esac
- fi
- }
- complete -F _chown $filenames chown
-
- # chgrp(1) completion
- #
- _chgrp()
- {
- local cur prev split=false
-
- COMPREPLY=()
- cur=`_get_cword`
- cur=${cur//\\\\/}
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- _split_longopt && split=true
-
- if [[ "$prev" == --reference ]]; then
- _filedir
- return 0
- fi
-
- $split && return 0
-
- # options completion
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-c -h -f -R -v --changes \
- --dereference --no-dereference --silent --quiet \
- --reference --recursive --verbose --help --version' -- "$cur" ) )
- return 0
- fi
-
- # first parameter on line or first since an option?
- if [ $COMP_CWORD -eq 1 ] && [[ "$cur" != -* ]] || \
- [[ "$prev" == -* ]] && [ -n "$bash205" ]; then
- local IFS=$'\n'
- COMPREPLY=( $( compgen -g "$cur" 2>/dev/null ) )
- else
- _filedir || return 0
- fi
-
- return 0
- }
- complete -F _chgrp $filenames chgrp
-
- # umount(8) completion. This relies on the mount point being the third
- # space-delimited field in the output of mount(8)
- #
- _umount()
- {
- local cur IFS=$'\n'
-
- COMPREPLY=()
- cur=`_get_cword`
-
- COMPREPLY=( $( compgen -W '$( mount | cut -d" " -f 3 )' -- "$cur" ) )
-
- return 0
- }
- complete -F _umount $dirnames umount
-
- # mount(8) completion. This will pull a list of possible mounts out of
- # /etc/{,v}fstab, unless the word being completed contains a ':', which
- # would indicate the specification of an NFS server. In that case, we
- # query the server for a list of all available exports and complete on
- # that instead.
- #
- _mount()
- {
- local cur i sm host prev
-
- COMPREPLY=()
- cur=`_get_cword`
- [[ "$cur" == \\ ]] && cur="/"
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- for i in {,/usr}/{,s}bin/showmount; do [ -x $i ] && sm=$i && break; done
-
- if [ -n "$sm" ] && [[ "$cur" == *:* ]]; then
- COMPREPLY=( $( $sm -e ${cur%%:*} | sed 1d | \
- grep ^${cur#*:} | awk '{print $1}' ) )
- elif [[ "$cur" == //* ]]; then
- host=${cur#//}
- host=${host%%/*}
- if [ -n "$host" ]; then
- COMPREPLY=( $( compgen -W "$( echo $( smbclient -d 0 -NL $host 2>/dev/null|
- sed -ne '/^['"$'\t '"']*Sharename/,/^$/p' |
- sed -ne '3,$s|^[^A-Za-z]*\([^'"$'\t '"']*\).*$|//'$host'/\1|p' ) )" -- "$cur" ) )
- fi
- elif [ -r /etc/vfstab ]; then
- # Solaris
- COMPREPLY=( $( compgen -W "$( awk '! /^[ \t]*#/ {if ($3 ~ /\//) print $3}' /etc/vfstab )" -- "$cur" ) )
- elif [ ! -e /etc/fstab ]; then
- # probably Cygwin
- COMPREPLY=( $( compgen -W "$( mount | awk '! /^[ \t]*#/ {if ($3 ~ /\//) print $3}' )" -- "$cur" ) )
- else
- # probably Linux
- if [ $prev = -L ]; then
- COMPREPLY=( $( compgen -W '$(sed -ne "s/^[[:space:]]*LABEL=\([^[:space:]]*\).*/\1/p" /etc/fstab )' -- "$cur" ) )
- elif [ $prev = -U ]; then
- COMPREPLY=( $( compgen -W '$(sed -ne "s/^[[:space:]]*UUID=\([^[:space:]]*\).*/\1/p" /etc/fstab )' -- "$cur" ) )
- else
- COMPREPLY=( $( compgen -W "$( awk '! /^[ \t]*#/ {if ($2 ~ /\//) print $2}' /etc/fstab )" -- "$cur" ) )
- fi
- fi
-
- return 0
- }
- complete -F _mount $default $dirnames mount
-
- # Linux rmmod(8) completion. This completes on a list of all currently
- # installed kernel modules.
- #
- have rmmod && {
- _rmmod()
- {
- local cur
-
- COMPREPLY=()
- cur=`_get_cword`
-
- _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.
- #
- _insmod()
- {
- local cur prev modpath
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- # 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=( $( /sbin/modinfo -p ${COMP_WORDS[1]} 2>/dev/null | \
- awk '{if ($1 ~ /^parm:/ && $2 ~ /^'"$cur"'/) { print $2 } \
- else if ($1 !~ /:/ && $1 ~ /^'"$cur"'/) { print $1 }}' ) )
- else
- _modules $(uname -r)
- fi
-
- return 0
- }
- complete -F _insmod $filenames insmod modprobe modinfo
+ "$( PATH="$PATH:/sbin" lsusb | awk '{print $6}' )" -- "$cur" ) )
}
-# renice(8) completion
-#
-_renice()
+# CD device names
+_cd_devices()
{
- local command cur curopt i
-
- COMPREPLY=()
- cur=`_get_cword`
- command=$1
-
- i=0
- # walk back through command line and find last option
- while [ $i -le $COMP_CWORD -a ${#COMPREPLY[@]} -eq 0 ]; do
- curopt=${COMP_WORDS[COMP_CWORD-$i]}
- case "$curopt" in
- -u)
- COMPREPLY=( $( compgen -u -- "$cur" ) )
- ;;
- -g)
- _pgids
- ;;
- -p|$command)
- _pids
- ;;
- esac
- i=$(( ++i ))
- done
+ COMPREPLY=( "${COMPREPLY[@]}"
+ $( compgen -f -d -X "!*/?([amrs])cd*" -- "${cur:-/dev/}" ) )
}
-complete -F _renice renice
-# kill(1) completion
-#
-_kill()
+# DVD device names
+_dvd_devices()
{
- local cur
-
- COMPREPLY=()
- cur=`_get_cword`
-
- if [ $COMP_CWORD -eq 1 ] && [[ "$cur" == -* ]]; then
- # return list of available signals
- _signals
- else
- # return list of available PIDs
- _pids
- fi
+ COMPREPLY=( "${COMPREPLY[@]}"
+ $( compgen -f -d -X "!*/?(r)dvd*" -- "${cur:-/dev/}" ) )
}
-complete -F _kill kill
-
-# killall(1) (Linux and FreeBSD) and pkill(1) completion.
-#
-[ $UNAME = Linux -o $UNAME = FreeBSD ] || have pkill &&
-_killall()
-{
- local cur
-
- COMPREPLY=()
- cur=`_get_cword`
-
- if [ $COMP_CWORD -eq 1 ] && [[ "$cur" == -* ]]; then
- _signals
- else
- _pnames
- fi
-
- return 0
-}
-[ $UNAME = Linux -o $UNAME = FreeBSD ] && complete -F _killall killall
-have pkill && complete -F _killall pkill
-
-# pgrep(1) completion.
-#
-[ $UNAME = Linux ] || have pgrep &&
-_pgrep()
-{
- local cur
- COMPREPLY=()
- cur=`_get_cword`
-
- _pnames
-
- return 0
-}
-have pgrep && complete -F _pgrep pgrep
-
-# Linux pidof(8) completion.
-[ $UNAME = Linux ] && complete -F _pgrep pidof
-
-# Red Hat & Debian GNU/Linux if{up,down} completion
-#
-[ $USERLAND = GNU ] && { have ifup || have ifdown; } &&
-_ifupdown()
-{
- local cur
-
- COMPREPLY=()
- cur=`_get_cword`
-
- 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
-
-# Linux ipsec(8) completion (for FreeS/WAN)
-#
-[ $UNAME = Linux ] && have ipsec &&
-_ipsec()
-{
- local cur
-
- COMPREPLY=()
- cur=`_get_cword`
-
-
- if [ $COMP_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
- auto)
- COMPREPLY=( $( compgen -W '--asynchronous --up --add --delete \
- --replace --down --route --unroute \
- --ready --status --rereadsecrets' \
- -- "$cur" ) )
- ;;
- manual)
- COMPREPLY=( $( compgen -W '--up --down --route --unroute \
- --union' -- "$cur" ) )
- ;;
- ranbits)
- COMPREPLY=( $( compgen -W '--quick --continuous --bytes' \
- -- "$cur" ) )
- ;;
- setup)
- COMPREPLY=( $( compgen -W '--start --stop --restart' -- "$cur" ) )
- ;;
- *)
- ;;
- esac
+# start of section containing completion functions for external programs
- return 0
-} &&
-complete -F _ipsec ipsec
+# 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
# This function provides simple user@host completion
#
@@ -1132,7 +1136,7 @@ _user_at_host() {
local cur
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref -n : cur
if [[ $cur == *@* ]]; then
_known_hosts_real "$cur"
@@ -1142,7 +1146,7 @@ _user_at_host() {
return 0
}
-shopt -u hostcomplete && complete -F _user_at_host $nospace talk ytalk finger
+shopt -u hostcomplete && complete -F _user_at_host -o nospace talk ytalk finger
# NOTE: Using this function as a helper function is deprecated. Use
# `_known_hosts_real' instead.
@@ -1153,14 +1157,15 @@ _known_hosts()
# NOTE: Using `_known_hosts' as a helper function and passing options
# to `_known_hosts' is deprecated: Use `_known_hosts_real' instead.
- [ "$1" = -a ] || [ "$2" = -a ] && options=-a
- [ "$1" = -c ] || [ "$2" = -c ] && options="$options -c"
- _known_hosts_real $options "$(_get_cword)"
-}
+ [[ "$1" == -a || "$2" == -a ]] && options=-a
+ [[ "$1" == -c || "$2" == -c ]] && options="$options -c"
+ _known_hosts_real $options "$(_get_cword :)"
+} # _known_hosts()
# Helper function for completing _known_hosts.
-# This function performs host completion based on ssh's known_hosts files.
-# Also hosts from HOSTFILE (compgen -A hostname) are added, unless
+# This function performs host completion based on ssh's config and known_hosts
+# files, as well as hostnames reported by avahi-browse. Also hosts from
+# HOSTFILE (compgen -A hostname) are added, unless
# COMP_KNOWN_HOSTS_WITH_HOSTFILE is set to an empty value.
# Usage: _known_hosts_real [OPTIONS] CWORD
# Options: -a Use aliases
@@ -1171,7 +1176,7 @@ _known_hosts()
_known_hosts_real()
{
local configfile flag prefix
- local cur curd awkcur user suffix aliases global_kh user_kh hosts i host
+ local cur curd awkcur user suffix aliases i host
local -a kh khd config
local OPTIND=1
@@ -1186,7 +1191,7 @@ _known_hosts_real()
[ $# -lt $OPTIND ] && echo "error: $FUNCNAME: missing mandatory argument CWORD"
cur=${!OPTIND}; let "OPTIND += 1"
[ $# -ge $OPTIND ] && echo "error: $FUNCNAME("$@"): unprocessed arguments:"\
- $(while [ $# -ge $OPTIND ]; do echo ${!OPTIND}; shift; done)
+ $(while [ $# -ge $OPTIND ]; do printf '%s\n' ${!OPTIND}; shift; done)
[[ $cur == *@* ]] && user=${cur%@*}@ && cur=${cur#*@}
kh=()
@@ -1204,24 +1209,26 @@ _known_hosts_real()
config=( "${config[@]}" "${HOME}/.ssh2/config" )
fi
+ # Known hosts files from configs
if [ ${#config[@]} -gt 0 ]; then
local OIFS=$IFS IFS=$'\n'
- # expand path (if present) to global known hosts file
- global_kh=($( sed -ne 's/^[ \t]*[Gg][Ll][Oo][Bb][Aa][Ll][Kk][Nn][Oo][Ww][Nn][Hh][Oo][Ss][Tt][Ss][Ff][Ii][Ll][Ee]['"$'\t '"']*\(.*\)$/"\1"/p' "${config[@]}" ))
- for (( i=0; i < ${#global_kh[@]}; i++ )); do
- global_kh[i]=$(echo "${global_kh[i]//\"/}")
- done
- # expand path (if present) to user known hosts file
- user_kh=($( sed -ne 's/^[ \t]*[Uu][Ss][Ee][Rr][Kk][Nn][Oo][Ww][Nn][Hh][Oo][Ss][Tt][Ss][Ff][Ii][Ll][Ee]['"$'\t '"']*\(.*\)$/"\1"/p' "${config[@]}" ))
- for (( i=0; i < ${#user_kh[@]}; i++ )); do
- user_kh[i]=$(echo "${user_kh[i]//\"/}")
+ local -a tmpkh
+ # expand paths (if present) to global and user known hosts files
+ # TODO(?): try to make known hosts files with more than one consecutive
+ # spaces in their name work (watch out for ~ expansion
+ # breakage! Alioth#311595)
+ tmpkh=( $( awk 'sub("^[ \t]*([Gg][Ll][Oo][Bb][Aa][Ll]|[Uu][Ss][Ee][Rr])[Kk][Nn][Oo][Ww][Nn][Hh][Oo][Ss][Tt][Ss][Ff][Ii][Ll][Ee][ \t]+", "") { print $0 }' "${config[@]}" | sort -u ) )
+ for i in "${tmpkh[@]}"; do
+ # Remove possible quotes
+ i=${i//\"}
+ # Eval/expand possible `~' or `~user'
+ __expand_tilde_by_ref i
+ [ -r "$i" ] && kh=( "${kh[@]}" "$i" )
done
IFS=$OIFS
fi
# Global known_hosts files
- [ -r "$global_kh" ] &&
- kh=( "${kh[@]}" "${global_kh[@]}" )
if [ -z "$configfile" ]; then
[ -r /etc/ssh/ssh_known_hosts ] &&
kh=( "${kh[@]}" /etc/ssh/ssh_known_hosts )
@@ -1236,8 +1243,6 @@ _known_hosts_real()
fi
# User known_hosts files
- [ -r "$user_kh" ] &&
- kh=( "${kh[@]}" "${user_kh[@]}" )
if [ -z "$configfile" ]; then
[ -r ~/.ssh/known_hosts ] &&
kh=( "${kh[@]}" ~/.ssh/known_hosts )
@@ -1248,7 +1253,7 @@ _known_hosts_real()
fi
# If we have known_hosts files to use
- if [ ${#kh[@]} -gt 0 -o ${#khd[@]} -gt 0 -o -n "$configfile" ]; then
+ if [[ ${#kh[@]} -gt 0 || ${#khd[@]} -gt 0 ]]; then
# Escape slashes and dots in paths for awk
awkcur=${cur//\//\\\/}
awkcur=${awkcur//\./\\\.}
@@ -1270,7 +1275,7 @@ _known_hosts_real()
if [ ${#kh[@]} -gt 0 ]; then
# FS needs to look for a comma separated list
- COMPREPLY=( $( awk 'BEGIN {FS=","}
+ COMPREPLY=( "${COMPREPLY[@]}" $( awk 'BEGIN {FS=","}
/^\s*[^|\#]/ {for (i=1; i<=2; ++i) { \
gsub(" .*$", "", $i); \
gsub("[\\[\\]]", "", $i); \
@@ -1284,34 +1289,13 @@ _known_hosts_real()
# dont fork any processes, because in a cluster environment,
# there can be hundreds of hostkeys
for i in "${khd[@]}" ; do
- if [[ "$i" == *key_22_$awkcurd*.pub ]] && [ -r "$i" ] ; then
+ if [[ "$i" == *key_22_$curd*.pub && -r "$i" ]]; then
host=${i/#*key_22_/}
host=${host/%.pub/}
COMPREPLY=( "${COMPREPLY[@]}" $host )
fi
done
fi
- # append any available aliases from config files
- if [ ${#config[@]} -gt 0 ] && [ -n "$aliases" ]; then
- local host_aliases=$( sed -ne 's/^[ \t]*[Hh][Oo][Ss][Tt]\([Nn][Aa][Mm][Ee]\)\?['"$'\t '"']\+\([^#*?]*\)\(#.*\)\?$/\2/p' "${config[@]}" )
- hosts=$( compgen -W "$host_aliases" -- "$cur" )
- COMPREPLY=( "${COMPREPLY[@]}" $hosts )
- fi
-
- # Add hosts reported by avahi, if it's available
- # and if the daemon is started.
- # The original call to avahi-browse also had "-k", to avoid
- # lookups into avahi's services DB. We don't need the name
- # of the service, and if it contains ";", it may mistify
- # the result. But on Gentoo (at least), -k isn't available
- # (even if mentioned in the manpage), so...
- if type avahi-browse >&/dev/null; then
- if [ -n "$(pidof avahi-daemon)" ]; then
- COMPREPLY=( "${COMPREPLY[@]}" $(
- compgen -W "$( avahi-browse -cpr _workstation._tcp | \
- grep ^= | cut -d\; -f7 | sort -u )" -- "$cur" ) )
- fi
- fi
# apply suffix and prefix
for (( i=0; i < ${#COMPREPLY[@]}; i++ )); do
@@ -1319,23 +1303,47 @@ _known_hosts_real()
done
fi
- # Add results of normal hostname completion, unless `COMP_KNOWN_HOSTS_WITH_HOSTFILE'
- # is set to an empty value.
+ # 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" \
+ -S "$suffix" -W "$hosts" -- "$cur" ) )
+ fi
+
+ # Add hosts reported by avahi-browse, if it's available.
+ # The original call to avahi-browse also had "-k", to avoid lookups into
+ # avahi's services DB. We don't need the name of the service, and if it
+ # contains ";", it may mistify the result. But on Gentoo (at least),
+ # -k isn't available (even if mentioned in the manpage), so...
+ if type avahi-browse >&/dev/null; then
+ COMPREPLY=( "${COMPREPLY[@]}" $( \
+ compgen -P "$prefix$user" -S "$suffix" -W \
+ "$( avahi-browse -cpr _workstation._tcp 2>/dev/null | \
+ awk -F';' '/^=/ { print $7 }' | sort -u )" -- "$cur" ) )
+ fi
+
+ # 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[@]}" $( compgen -A hostname -P "$prefix$user" -S "$suffix" -- "$cur" ) )
+ COMPREPLY=( "${COMPREPLY[@]}"
+ $( compgen -A hostname -P "$prefix$user" -S "$suffix" -- "$cur" ) )
fi
+ __ltrim_colon_completions "$prefix$user$cur"
+
return 0
-}
-complete -F _known_hosts traceroute traceroute6 tracepath tracepath6 \
-ping ping6 fping fping6 telnet host nslookup rsh rlogin ftp dig ssh-installkeys mtr
+} # _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
# This meta-cd function observes the CDPATH variable, so that cd additionally
# completes on directories under those specified in CDPATH.
#
_cd()
{
- local IFS=$'\t\n' cur=`_get_cword` i j k
+ local cur IFS=$'\t\n' i j k
+ _get_comp_words_by_ref cur
# try to allow variable completion
if [[ "$cur" == ?(\\)\$* ]]; then
@@ -1348,7 +1356,7 @@ _cd()
# Use standard dir completion if no CDPATH or parameter starts with /,
# ./ or ../
- if [ -z "${CDPATH:-}" ] || [[ "$cur" == ?(.)?(.)/* ]]; then
+ if [[ -z "${CDPATH:-}" || "$cur" == ?(.)?(.)/* ]]; then
_filedir -d
return 0
fi
@@ -1372,7 +1380,7 @@ _cd()
if [[ ${#COMPREPLY[@]} -eq 1 ]]; then
i=${COMPREPLY[0]}
- if [ "$i" == "$cur" ] && [[ $i != "*/" ]]; then
+ if [[ "$i" == "$cur" && $i != "*/" ]]; then
COMPREPLY[0]="${i}/"
fi
fi
@@ -1380,9 +1388,9 @@ _cd()
return 0
}
if shopt -q cdable_vars; then
- complete -v -F _cd $nospace cd
+ complete -v -F _cd -o nospace cd
else
- complete -F _cd $nospace cd
+ complete -F _cd -o nospace cd
fi
# a wrapper method for the next one, when the offset is unknown
@@ -1409,7 +1417,7 @@ _command()
_command_offset()
{
local cur func cline cspec noglob cmd i char_offset word_offset \
- _COMMAND_FUNC _COMMAND_FUNC_ARGS
+ _COMMAND_FUNC _COMMAND_FUNC_ARGS
word_offset=$1
@@ -1438,7 +1446,7 @@ _command_offset()
COMP_CWORD=$(( $COMP_CWORD - $word_offset ))
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
if [[ $COMP_CWORD -eq 0 ]]; then
COMPREPLY=( $( compgen -c -- "$cur" ) )
@@ -1479,21 +1487,21 @@ _command_offset()
[ ${#COMPREPLY[@]} -eq 0 ] && _filedir
}
-complete -F _command $filenames nohup exec nice eval time ltrace then \
- else do vsound command xargs tsocks
+complete -F _command -o filenames nohup exec nice eval time ltrace then \
+ else do vsound command xargs tsocks aoss padsp
_root_command()
{
- PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin _command $1 $2 $3
+ local PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin
+ _command $1 $2 $3
}
-complete -F _root_command $filenames sudo fakeroot really gksudo gksu kdesudo
+complete -F _root_command -o filenames sudo fakeroot really gksudo gksu kdesudo
_longopt()
{
local cur prev
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
if _split_longopt; then
case "$prev" in
@@ -1508,8 +1516,8 @@ _longopt()
fi
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W "$( $1 --help 2>&1 | sed -e '/--/!d' \
- -e 's/.*\(--[-A-Za-z0-9]\+\).*/\1/' |sort -u )"\
+ COMPREPLY=( $( compgen -W "$( $1 --help 2>&1 | \
+ sed -ne 's/.*\(--[-A-Za-z0-9]\{1,\}\).*/\1/p' | sort -u )" \
-- "$cur" ) )
elif [[ "$1" == rmdir ]]; then
_filedir -d
@@ -1519,68 +1527,33 @@ _longopt()
}
# makeinfo and texi2dvi are defined elsewhere.
for i in a2ps autoconf automake bc gprof ld nm objcopy objdump readelf strip \
- bison diff patch enscript cp df dir du ln ls mkfifo mknod mv rm \
+ bison colordiff diff patch enscript cp df dir du ln ls mkfifo mknod mv rm \
touch vdir awk gperf grep grub indent less m4 sed shar date \
tee who texindex cat csplit cut expand fmt fold head \
md5sum nl od paste pr ptx sha1sum sort split tac tail tr unexpand \
- uniq wc ldd bash id irb mkdir rmdir; do
- have $i && complete -F _longopt $filenames $i
+ uniq wc ldd bash id irb mkdir rmdir wget curl; do
+ have $i && complete -F _longopt -o filenames $i
done
# These commands do not use filenames, so '-o filenames' is not needed.
-for i in env netstat seq uname units wget; do
- have $i && complete -F _longopt $default $i
+for i in env netstat seq uname units; do
+ have $i && complete -F _longopt -o default $i
done
unset i
-# look(1) completion
-#
-have look &&
-_look()
-{
- local cur
-
- COMPREPLY=()
- cur=`_get_cword`
-
- if [ $COMP_CWORD = 1 ]; then
- COMPREPLY=( $( compgen -W '$(look "$cur" 2>/dev/null)' ) )
- fi
-} &&
-complete -F _look $default look
-
-# id(1) completion
-#
-have id &&
-_id()
-{
- local cur
-
- COMPREPLY=()
- cur=`_get_cword`
-
- 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
-
_filedir_xspec()
{
local IFS cur xspec
IFS=$'\t\n'
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
_expand || return 0
# get first exclusion compspec that matches this command
- xspec=$( sed -ne $'/^complete .*[ \t]'${1##*/}$'\([ \t]\|$\)/{p;q;}' \
- $BASH_COMPLETION )
+ 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%% *}
@@ -1592,7 +1565,7 @@ _filedir_xspec()
compgen -d -- "$(quote_readline "$cur")" | {
while read -r tmp; do
# see long TODO comment in _filedir() --David
- echo $tmp
+ printf '%s\n' $tmp
done
}
))
@@ -1600,14 +1573,14 @@ _filedir_xspec()
toks=( ${toks[@]-} $(
eval compgen -f -X "$xspec" -- "\$(quote_readline "\$cur")" | {
while read -r tmp; do
- [ -n $tmp ] && echo $tmp
+ [ -n $tmp ] && printf '%s\n' $tmp
done
}
))
COMPREPLY=( "${toks[@]}" )
}
-list=( $( sed -ne '/^# START exclude/,/^# FINISH exclude/p' $BASH_COMPLETION | \
+list=( $( sed -ne '/^# START exclude/,/^# FINISH exclude/p' "$BASH_COMPLETION" | \
# read exclusion compspecs
(
while read line
@@ -1619,41 +1592,42 @@ list=( $( sed -ne '/^# START exclude/,/^# FINISH exclude/p' $BASH_COMPLETION | \
line=${line##*\'}
list=( "${list[@]}" $line )
done
- echo "${list[@]}"
+ printf '%s ' "${list[@]}"
)
) )
# remove previous compspecs
if [ ${#list[@]} -gt 0 ]; then
eval complete -r ${list[@]}
# install new compspecs
- eval complete -F _filedir_xspec $filenames "${list[@]}"
+ eval complete -F _filedir_xspec -o filenames "${list[@]}"
fi
unset list
# source completion directory definitions
-if [ -d $BASH_COMPLETION_COMPAT_DIR -a -r $BASH_COMPLETION_COMPAT_DIR -a \
- -x $BASH_COMPLETION_COMPAT_DIR ]; then
- for i in $BASH_COMPLETION_COMPAT_DIR/*; do
- [[ ${i##*/} != @(*~|*.bak|*.swp|\#*\#|*.dpkg*|*.rpm@(orig|new|save)) ]] &&
- [ \( -f $i -o -h $i \) -a -r $i ] && . $i
+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)) \
+ && ( -f $i || -h $i ) && -r $i ]] && . "$i"
done
fi
-if [ -d $BASH_COMPLETION_DIR -a -r $BASH_COMPLETION_DIR -a \
- $BASH_COMPLETION_DIR != $BASH_COMPLETION_COMPAT_DIR -a \
- -x $BASH_COMPLETION_DIR ]; then
- for i in $BASH_COMPLETION_DIR/*; do
- [[ ${i##*/} != @(*~|*.bak|*.swp|\#*\#|*.dpkg*|*.rpm@(orig|new|save)) ]] &&
- [ \( -f $i -o -h $i \) -a -r $i ] && . $i
+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)) \
+ && ( -f $i || -h $i ) && -r $i ]] && . "$i"
done
fi
unset i
# source user completion file
-[ $BASH_COMPLETION != ~/.bash_completion -a -r ~/.bash_completion ] \
+[[ $BASH_COMPLETION != ~/.bash_completion && -r ~/.bash_completion ]] \
&& . ~/.bash_completion
unset -f have
-unset UNAME USERLAND default dirnames filenames have nospace bashdefault \
- plusdirs compopt
+unset UNAME USERLAND have
set $BASH_COMPLETION_ORIGINAL_V_VALUE
unset BASH_COMPLETION_ORIGINAL_V_VALUE
diff --git a/bash_completion.sh.in b/bash_completion.sh.in
new file mode 100644
index 00000000..bdddeee0
--- /dev/null
+++ b/bash_completion.sh.in
@@ -0,0 +1,12 @@
+# Check for interactive bash and that we haven't already been sourced.
+[ -z "$BASH_VERSION" -o -z "$PS1" -o -n "$BASH_COMPLETION" ] && 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 [ -r @sysconfdir@/bash_completion ]; then
+ # Source completion code.
+ . @sysconfdir@/bash_completion
+ fi
+fi
+unset bash bmajor bminor
diff --git a/configure b/configure
index 0ec532f3..d1d525c0 100755
--- a/configure
+++ b/configure
@@ -1,10 +1,12 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.64 for bash-completion 1.1.
+# Generated by GNU Autoconf 2.65 for bash-completion 1.2.
+#
#
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software
-# Foundation, Inc.
+# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+#
#
# This configure script is free software; the Free Software Foundation
# gives unlimited permission to copy, distribute and modify it.
@@ -523,7 +525,8 @@ as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
-exec 7<&0 </dev/null 6>&1
+test -n "$DJDIR" || exec 7<&0 </dev/null
+exec 6>&1
# Name of the host.
# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
@@ -545,8 +548,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='bash-completion'
PACKAGE_TARNAME='bash-completion'
-PACKAGE_VERSION='1.1'
-PACKAGE_STRING='bash-completion 1.1'
+PACKAGE_VERSION='1.2'
+PACKAGE_STRING='bash-completion 1.2'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''
@@ -1161,7 +1164,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.1 to adapt to many kinds of systems.
+\`configure' configures bash-completion 1.2 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1227,7 +1230,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of bash-completion 1.1:";;
+ short | recursive ) echo "Configuration of bash-completion 1.2:";;
esac
cat <<\_ACEOF
@@ -1294,8 +1297,8 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-bash-completion configure 1.1
-generated by GNU Autoconf 2.64
+bash-completion configure 1.2
+generated by GNU Autoconf 2.65
Copyright (C) 2009 Free Software Foundation, Inc.
This configure script is free software; the Free Software Foundation
@@ -1311,8 +1314,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.1, which was
-generated by GNU Autoconf 2.64. Invocation command line was
+It was created by bash-completion $as_me 1.2, which was
+generated by GNU Autoconf 2.65. Invocation command line was
$ $0 $@
@@ -1565,7 +1568,7 @@ fi
for ac_site_file in "$ac_site_file1" "$ac_site_file2"
do
test "x$ac_site_file" = xNONE && continue
- if test -r "$ac_site_file"; then
+ if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
$as_echo "$as_me: loading site script $ac_site_file" >&6;}
sed 's/^/| /' "$ac_site_file" >&5
@@ -1574,9 +1577,9 @@ $as_echo "$as_me: loading site script $ac_site_file" >&6;}
done
if test -r "$cache_file"; then
- # Some versions of bash will fail to source /dev/null (special
- # files actually), so we avoid doing that.
- if test -f "$cache_file"; then
+ # Some versions of bash will fail to source /dev/null (special files
+ # actually), so we avoid doing that. DJGPP emulates it as a regular file.
+ if test /dev/null != "$cache_file" && test -f "$cache_file"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5
$as_echo "$as_me: loading cache $cache_file" >&6;}
case $cache_file in
@@ -1995,6 +1998,7 @@ IFS=$as_save_IFS
fi
+ test -d ./--version && rmdir ./--version
if test "${ac_cv_path_mkdir+set}" = set; then
MKDIR_P="$ac_cv_path_mkdir -p"
else
@@ -2002,7 +2006,6 @@ fi
# value for MKDIR_P within a source directory, because that will
# break other packages using the cache if that directory is
# removed, or if the value is a relative name.
- test -d ./--version && rmdir ./--version
MKDIR_P="$ac_install_sh -d"
fi
fi
@@ -2119,7 +2122,7 @@ fi
# Define the identity of the package.
PACKAGE='bash-completion'
- VERSION='1.1'
+ VERSION='1.2'
cat >>confdefs.h <<_ACEOF
@@ -2159,7 +2162,7 @@ am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'
-ac_config_files="$ac_config_files Makefile"
+ac_config_files="$ac_config_files Makefile test/Makefile"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
@@ -2703,8 +2706,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.1, which was
-generated by GNU Autoconf 2.64. Invocation command line was
+This file was extended by bash-completion $as_me 1.2, which was
+generated by GNU Autoconf 2.65. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
CONFIG_HEADERS = $CONFIG_HEADERS
@@ -2739,6 +2742,7 @@ Usage: $0 [OPTION]... [TAG]...
-h, --help print this help, then exit
-V, --version print version number and configuration settings, then exit
+ --config print configuration, then exit
-q, --quiet, --silent
do not print progress messages
-d, --debug don't remove temporary files
@@ -2753,10 +2757,11 @@ Report bugs to the package provider."
_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.1
-configured by $0, generated by GNU Autoconf 2.64,
- with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
+bash-completion config.status 1.2
+configured by $0, generated by GNU Autoconf 2.65,
+ with options \\"\$ac_cs_config\\"
Copyright (C) 2009 Free Software Foundation, Inc.
This config.status script is free software; the Free Software Foundation
@@ -2794,6 +2799,8 @@ do
ac_cs_recheck=: ;;
--version | --versio | --versi | --vers | --ver | --ve | --v | -V )
$as_echo "$ac_cs_version"; exit ;;
+ --config | --confi | --conf | --con | --co | --c )
+ $as_echo "$ac_cs_config"; exit ;;
--debug | --debu | --deb | --de | --d | -d )
debug=: ;;
--file | --fil | --fi | --f )
@@ -2860,6 +2867,7 @@ for ac_config_target in $ac_config_targets
do
case $ac_config_target in
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+ "test/Makefile") CONFIG_FILES="$CONFIG_FILES test/Makefile" ;;
*) as_fn_error "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
esac
@@ -2961,7 +2969,7 @@ s/'"$ac_delim"'$//
t delim
:nl
h
-s/\(.\{148\}\).*/\1/
+s/\(.\{148\}\)..*/\1/
t more1
s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
p
@@ -2975,7 +2983,7 @@ s/.\{148\}//
t nl
:delim
h
-s/\(.\{148\}\).*/\1/
+s/\(.\{148\}\)..*/\1/
t more2
s/["\\]/\\&/g; s/^/"/; s/$/"/
p
diff --git a/configure.ac b/configure.ac
index c8d66cd4..b6abcac5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
AC_PREREQ([2.59])
-AC_INIT([bash-completion], [1.1])
-AM_INIT_AUTOMAKE([foreign -Wall -Werror])
-AC_CONFIG_FILES([Makefile])
+AC_INIT([bash-completion], [1.2])
+AM_INIT_AUTOMAKE([foreign dejagnu dist-bzip2 -Wall -Werror])
+AC_CONFIG_FILES([Makefile test/Makefile])
AC_OUTPUT
diff --git a/contrib/mock b/contrib/_mock
index 0c94e1b4..f16f116d 100644
--- a/contrib/mock
+++ b/contrib/_mock
@@ -1,3 +1,6 @@
+# Use of this file is deprecated. Upstream completion is available in
+# mock > 1.1.0, use that instead.
+
# bash completion for mock
have mock &&
@@ -6,8 +9,7 @@ _mock()
local cur prev plugins cfgdir split=false
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
plugins='tmpfs root_cache yum_cache bind_mount ccache'
cfgdir=/etc/mock
@@ -25,7 +27,7 @@ _mock()
_split_longopt && split=true
case $prev in
- -@(h|-help|-copy@(in|out)|-arch|D|-define|-with?(out)|-uniqueext|-rpmbuild_timeout|-sources|-cwd))
+ -h|--help|--copyin|--copyout|--arch|-D|--define|--with|--without|--uniqueext|--rpmbuild_timeout|--sources|--cwd)
return 0
;;
-r|--root)
@@ -33,7 +35,7 @@ _mock()
COMPREPLY=( ${COMPREPLY[@]/%.cfg/} )
return 0
;;
- --@(config|result)dir)
+ --configdir|--resultdir)
_filedir -d
return 0
;;
@@ -47,11 +49,11 @@ _mock()
# This would actually depend on what the target root
# can be used to build for...
COMPREPLY=( $( compgen -W "$( command rpm --showrc | \
- sed -ne 's/^\s*compatible\s\+archs\s*:\s*\(.*\)/\1/i p' )" \
+ sed -ne 's/^\s*compatible\s\s*archs\s*:\s*\(.*\)/\1/i p' )" \
-- "$cur" ) )
return 0
;;
- --@(en|dis)able-plugin)
+ --enable-plugin|--disable-plugin)
COMPREPLY=( $( compgen -W "$plugins" -- "$cur" ) )
return 0
;;
@@ -60,21 +62,20 @@ _mock()
$split && return 0
if [[ "$cur" == -* ]] ; then
- COMPREPLY=( $( compgen -W '--version -h --help --rebuild \
+ COMPREPLY=( $( compgen -W '--version --help --rebuild \
--buildsrpm --shell --chroot --clean --init \
--installdeps --install --update --orphanskill \
- --copyin --copyout -r --root --offline --no-clean \
+ --copyin --copyout --root --offline --no-clean \
--cleanup-after --no-cleanup-after --arch --target \
- -D --define --with --without --resultdir --uniqueext \
+ --define --with --without --resultdir --uniqueext \
--configdir --rpmbuild_timeout --unpriv --cwd --spec \
- --sources -v --verbose -q --quiet --trace \
- --enable-plugin --disable-plugin --print-root-path' \
- -- "$cur" ) )
+ --sources --verbose --quiet --trace --enable-plugin \
+ --disable-plugin --print-root-path' -- "$cur" ) )
else
_filedir '?(no)src.rpm'
fi
} &&
-complete -F _mock $filenames mock
+complete -F _mock -o filenames mock
# Local variables:
# mode: shell-script
diff --git a/contrib/modules b/contrib/_modules
index 1f99534f..f1ad88d8 100644
--- a/contrib/modules
+++ b/contrib/_modules
@@ -1,3 +1,6 @@
+# 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.
@@ -20,48 +23,48 @@ have module || [ -f /etc/profile.d/modules.sh ] && {
_module_list ()
{
- local modules="$( echo $LOADEDMODULES | sed 's/:/ /g' | sort )"
- compgen -W "$modules" -- $1
+ local modules="$( sed 's/:/ /g' <<<$LOADEDMODULES | sort )"
+ compgen -W "$modules" -- $1
}
_module_path ()
{
- local modules="$( echo $MODULEPATH | sed 's/:/ /g' | sort )"
- compgen -W "$modules" -- $1
+ local modules="$( sed 's/:/ /g' <<<$MODULEPATH | sort )"
+ compgen -W "$modules" -- $1
}
_module_avail ()
{
- local modules="$( \
- module avail 2>&1 | \
- egrep -v '^(-|$)' | \
- xargs printf '%s\n' | sort )"
+ local modules="$( \
+ module avail 2>&1 | \
+ command grep -E -v '^(-|$)' | \
+ xargs printf '%s\n' | sed -e 's/(default)//g' | sort )"
- compgen -W "$modules" -- $1
+ compgen -W "$modules" -- $1
}
# A completion function for the module alias
-_module () {
- local cur prev options
+_module ()
+{
+ local cur prev options
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ COMPREPLY=()
+ _get_comp_words_by_ref cur prev
- if [ $COMP_CWORD -eq 1 ] ; then
- # First parameter on line -- we expect it to be a mode selection
+ if [ $COMP_CWORD -eq 1 ] ; then
+ # First parameter on line -- we expect it to be a mode selection
- options="$( module help 2>&1 | egrep '^[[:space:]]*\+' | \
- awk '{print $2}' | sed -e 's/|/ /g' | sort )"
+ options="$( module help 2>&1 | command grep -E '^[[:space:]]*\+' | \
+ awk '{print $2}' | sed -e 's/|/ /g' | sort )"
- COMPREPLY=( $(compgen -W "$options" -- "$cur") )
+ COMPREPLY=( $(compgen -W "$options" -- "$cur") )
elif [ $COMP_CWORD -eq 2 ] ; then
- case "$prev" in
- @(add|display|help|load|show|whatis))
+ case $prev in
+ add|display|help|load|show|whatis)
COMPREPLY=( $(_module_avail "$cur") )
;;
- @(rm|switch|swap|unload|update))
+ rm|switch|swap|unload|update)
COMPREPLY=( $(_module_list "$cur") )
;;
unuse)
@@ -70,14 +73,14 @@ _module () {
esac
elif [ $COMP_CWORD -eq 3 ] ; then
case ${COMP_WORDS[1]} in
- @(sw?(ap|itch)))
+ swap|switch)
COMPREPLY=( $(_module_avail "$cur") )
;;
esac
- fi
- return 0
+ fi
+ return 0
}
-complete -F _module $default module
+complete -F _module -o default module
}
# Local variables:
diff --git a/contrib/_subversion b/contrib/_subversion
index 0168ecd4..06adf830 100644
--- a/contrib/_subversion
+++ b/contrib/_subversion
@@ -1,425 +1,423 @@
+# 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
+ local cur prev commands options command
- COMPREPLY=()
- cur=`_get_cword`
+ COMPREPLY=()
+ _get_comp_words_by_ref cur prev
- commands='add blame praise annotate ann cat checkout co cleanup commit \
- ci copy cp delete del remove rm diff di export help ? h import \
- info list ls lock log merge mkdir move mv rename ren \
- propdel pdel pd propedit pedit pe propget pget pg \
- proplist plist pl propset pset ps resolved revert \
- status stat st switch sw unlock update up'
+ commands='add blame praise annotate ann cat checkout co cleanup commit \
+ ci copy cp delete del remove rm diff di export help ? h import \
+ info list ls lock log merge mkdir move mv rename ren \
+ propdel pdel pd propedit pedit pe propget pget pg \
+ proplist plist pl propset pset ps resolved revert \
+ status stat st switch sw unlock update up'
- if [[ $COMP_CWORD -eq 1 ]] ; then
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--version' -- $cur ) )
- else
- COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
- fi
- else
+ if [[ $COMP_CWORD -eq 1 ]] ; then
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--version' -- $cur ) )
+ else
+ COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
+ fi
+ else
- prev=${COMP_WORDS[COMP_CWORD-1]}
- case $prev in
- --config-dir)
- _filedir -d
- return 0;
- ;;
- -@(F|-file|-targets))
- _filedir
- return 0;
- ;;
- --encoding)
- COMPREPLY=( $( compgen -W \
- '$( iconv --list | sed -e "s@//@@;" )' \
- -- "$cur" ) )
- return 0;
- ;;
- --@(editor|diff|diff3)-cmd)
- COMP_WORDS=(COMP_WORDS[0] $cur)
- COMP_CWORD=1
- _command
- return 0;
- ;;
- esac
+ case $prev in
+ --config-dir)
+ _filedir -d
+ return 0;
+ ;;
+ -F|--file|--targets)
+ _filedir
+ return 0;
+ ;;
+ --encoding)
+ COMPREPLY=( $( compgen -W '$( iconv --list | \
+ sed -e "s@//@@;" )' -- "$cur" ) )
+ return 0;
+ ;;
+ --editor-cmd|--diff-cmd|--diff3-cmd)
+ COMP_WORDS=(COMP_WORDS[0] $cur)
+ COMP_CWORD=1
+ _command
+ return 0;
+ ;;
+ esac
- command=${COMP_WORDS[1]}
+ command=${COMP_WORDS[1]}
- if [[ "$cur" == -* ]]; then
- # possible options for the command
- case $command in
- add)
- options='--auto-props --no-auto-props \
- --force --targets --no-ignore \
- --non-recursive -N -q --quiet'
- ;;
- @(blame|annotate|ann|praise))
- options='-r --revisions --username \
- --password --no-auth-cache \
- --non-interactive -v \
- --verbose --incremental --xml'
- ;;
- cat)
- options='-r --revision --username \
- --password --no-auth-cache \
- --non-interactive'
- ;;
- @(checkout|co))
- options='-r --revision -q --quiet -N \
- --non-recursive --username \
- --password --no-auth-cache \
- --non-interactive \
- --ignore-externals'
- ;;
- cleanup)
- options='--diff3-cmd'
- ;;
- @(commit|ci))
- options='-m --message -F --file \
- --encoding --force-log -q \
- --quiet --non-recursive -N \
- --targets --editor-cmd \
- --username --password \
- --no-auth-cache \
- --non-interactive --no-unlock'
- ;;
- @(copy|cp))
- options='-m --message -F --file \
- --encoding --force-log -r \
- --revision -q --quiet \
- --editor-cmd -username \
- --password --no-auth-cache \
- --non-interactive'
- ;;
- @(delete|del|remove|rm))
- options='--force -m --message -F \
- --file --encoding --force-log \
- -q --quiet --targets \
- --editor-cmd -username \
- --password --no-auth-cache \
- --non-interactive'
- ;;
- @(diff|di))
- options='-r --revision -x --extensions \
- --diff-cmd --no-diff-deleted \
- -N --non-recursive --username \
- --password --no-auth-cache \
- --non-interactive --force \
- --old --new --notice-ancestry'
- ;;
- export)
- options='-r --revision -q --quiet \
- --username --password \
- --no-auth-cache \
- --non-interactive -N \
- --non-recursive --force \
- --native-eol --ignore-externals'
- ;;
- import)
- options='--auto-props --no-auto-props \
- -m --message -F --file \
- --encoding --force-log -q \
- --quiet --non-recursive \
- --no-ignore --editor-cmd \
- --username --password \
- --no-auth-cache \
- --non-interactive'
- ;;
- info)
- options='--username --password \
- --no-auth-cache \
- --non-interactive -r \
- --revision --xml --targets \
- -R --recursive --incremental'
- ;;
- @(list|ls))
- options='-r --revision -v --verbose -R \
- --recursive --username \
- --password --no-auth-cache \
- --non-interactive \
- --incremental --xml'
- ;;
- lock)
- options='-m --message -F --file \
- --encoding --force-log \
- --targets --force --username \
- --password --no-auth-cache \
- --non-interactive'
- ;;
- log)
- options='-r --revision -v --verbose \
- --targets --username \
- --password --no-auth-cache \
- --non-interactive \
- --stop-on-copy --incremental \
- --xml -q --quiet --limit'
- ;;
- merge)
- options='-r --revision -N \
- --non-recursive -q --quiet \
- --force --dry-run --diff3-cmd \
- --username --password \
- --no-auth-cache \
- --non-interactive \
- --ignore-ancestry'
- ;;
- mkdir)
- options='-m --message -F --file \
- --encoding --force-log -q \
- --quiet --editor-cmd \
- --username --password \
- --no-auth-cache \
- --non-interactive'
- ;;
- @(move|mv|rename|ren))
- options='-m --message -F --file \
- --encoding --force-log -r \
- --revision -q --quiet \
- --force --editor-cmd \
- --username --password \
- --no-auth-cache \
- --non-interactive'
- ;;
- @(propdel|pdel|pd))
- options='-q --quiet -R --recursive -r \
- --revision --revprop \
- --username --password \
- --no-auth-cache \
- --non-interactive'
- ;;
- @(propedit|pedit|pe))
- options='-r --revision --revprop \
- --encoding --editor-cmd \
- --username --password \
- --no-auth-cache \
- --non-interactive --force'
- ;;
- @(propget|pget|pg))
- options='-R --recursive -r --revision \
- --revprop --strict --username \
- --password --no-auth-cache \
- --non-interactive'
- ;;
- @(proplist|plist|pl))
- options='-v --verbose -R --recursive \
- -r --revision --revprop -q \
- --quiet --username --password \
- --no-auth-cache \
- --non-interactive'
- ;;
- @(propset|pset|ps))
- options='-F --file -q --quiet \
- --targets -R --recursive \
- --revprop --encoding \
- --username --password \
- --no-auth-cache \
- --non-interactive -r \
- --revision --force'
- ;;
- resolved)
- options='--targets -R --recursive -q \
- --quiet'
- ;;
- revert)
- options='--targets -R --recursive -q \
- --quiet'
- ;;
- @(status|stat|st))
- options='-u --show-updates -v \
- --verbose -N --non-recursive \
- -q --quiet --username \
- --password --no-auth-cache \
- --non-interactive --no-ignore \
- --ignore-externals \
- --incremental --xml'
- ;;
- @(switch|sw))
- options='--relocate -r --revision -N \
- --non-recursive -q --quiet \
- --username --password \
- --no-auth-cache \
- --non-interactive --diff3-cmd'
- ;;
- unlock)
- options='--targets --force --username \
- --password --no-auth-cache \
- --non-interactive'
- ;;
- @(update|up))
- options='-r --revision -N \
- --non-recursive -q --quiet \
- --username --password \
- --no-auth-cache \
- --non-interactive \
- --diff3-cmd --ignore-externals'
- ;;
- esac
- options="$options --help -h --config-dir"
+ if [[ "$cur" == -* ]]; then
+ # possible options for the command
+ case $command in
+ add)
+ options='--auto-props --no-auto-props \
+ --force --targets --no-ignore \
+ --non-recursive -N -q --quiet'
+ ;;
+ blame|annotate|ann|praise)
+ options='-r --revisions --username \
+ --password --no-auth-cache \
+ --non-interactive -v \
+ --verbose --incremental --xml'
+ ;;
+ cat)
+ options='-r --revision --username \
+ --password --no-auth-cache \
+ --non-interactive'
+ ;;
+ checkout|co)
+ options='-r --revision -q --quiet -N \
+ --non-recursive --username \
+ --password --no-auth-cache \
+ --non-interactive \
+ --ignore-externals'
+ ;;
+ cleanup)
+ options='--diff3-cmd'
+ ;;
+ commit|ci)
+ options='-m --message -F --file \
+ --encoding --force-log -q \
+ --quiet --non-recursive -N \
+ --targets --editor-cmd \
+ --username --password \
+ --no-auth-cache \
+ --non-interactive --no-unlock'
+ ;;
+ copy|cp)
+ options='-m --message -F --file \
+ --encoding --force-log -r \
+ --revision -q --quiet \
+ --editor-cmd -username \
+ --password --no-auth-cache \
+ --non-interactive'
+ ;;
+ delete|del|remove|rm)
+ options='--force -m --message -F \
+ --file --encoding --force-log \
+ -q --quiet --targets \
+ --editor-cmd -username \
+ --password --no-auth-cache \
+ --non-interactive'
+ ;;
+ diff|di)
+ options='-r --revision -x --extensions \
+ --diff-cmd --no-diff-deleted \
+ -N --non-recursive --username \
+ --password --no-auth-cache \
+ --non-interactive --force \
+ --old --new --notice-ancestry'
+ ;;
+ export)
+ options='-r --revision -q --quiet \
+ --username --password \
+ --no-auth-cache \
+ --non-interactive -N \
+ --non-recursive --force \
+ --native-eol --ignore-externals'
+ ;;
+ import)
+ options='--auto-props --no-auto-props \
+ -m --message -F --file \
+ --encoding --force-log -q \
+ --quiet --non-recursive \
+ --no-ignore --editor-cmd \
+ --username --password \
+ --no-auth-cache \
+ --non-interactive'
+ ;;
+ info)
+ options='--username --password \
+ --no-auth-cache \
+ --non-interactive -r \
+ --revision --xml --targets \
+ -R --recursive --incremental'
+ ;;
+ list|ls)
+ options='-r --revision -v --verbose -R \
+ --recursive --username \
+ --password --no-auth-cache \
+ --non-interactive \
+ --incremental --xml'
+ ;;
+ lock)
+ options='-m --message -F --file \
+ --encoding --force-log \
+ --targets --force --username \
+ --password --no-auth-cache \
+ --non-interactive'
+ ;;
+ log)
+ options='-r --revision -v --verbose \
+ --targets --username \
+ --password --no-auth-cache \
+ --non-interactive \
+ --stop-on-copy --incremental \
+ --xml -q --quiet --limit'
+ ;;
+ merge)
+ options='-r --revision -N \
+ --non-recursive -q --quiet \
+ --force --dry-run --diff3-cmd \
+ --username --password \
+ --no-auth-cache \
+ --non-interactive \
+ --ignore-ancestry'
+ ;;
+ mkdir)
+ options='-m --message -F --file \
+ --encoding --force-log -q \
+ --quiet --editor-cmd \
+ --username --password \
+ --no-auth-cache \
+ --non-interactive'
+ ;;
+ move|mv|rename|ren)
+ options='-m --message -F --file \
+ --encoding --force-log -r \
+ --revision -q --quiet \
+ --force --editor-cmd \
+ --username --password \
+ --no-auth-cache \
+ --non-interactive'
+ ;;
+ propdel|pdel|pd)
+ options='-q --quiet -R --recursive -r \
+ --revision --revprop \
+ --username --password \
+ --no-auth-cache \
+ --non-interactive'
+ ;;
+ propedit|pedit|pe)
+ options='-r --revision --revprop \
+ --encoding --editor-cmd \
+ --username --password \
+ --no-auth-cache \
+ --non-interactive --force'
+ ;;
+ propget|pget|pg)
+ options='-R --recursive -r --revision \
+ --revprop --strict --username \
+ --password --no-auth-cache \
+ --non-interactive'
+ ;;
+ proplist|plist|pl)
+ options='-v --verbose -R --recursive \
+ -r --revision --revprop -q \
+ --quiet --username --password \
+ --no-auth-cache \
+ --non-interactive'
+ ;;
+ propset|pset|ps)
+ options='-F --file -q --quiet \
+ --targets -R --recursive \
+ --revprop --encoding \
+ --username --password \
+ --no-auth-cache \
+ --non-interactive -r \
+ --revision --force'
+ ;;
+ resolved)
+ options='--targets -R --recursive -q --quiet'
+ ;;
+ revert)
+ options='--targets -R --recursive -q --quiet'
+ ;;
+ status|stat|st)
+ options='-u --show-updates -v \
+ --verbose -N --non-recursive \
+ -q --quiet --username \
+ --password --no-auth-cache \
+ --non-interactive --no-ignore \
+ --ignore-externals \
+ --incremental --xml'
+ ;;
+ switch|sw)
+ options='--relocate -r --revision -N \
+ --non-recursive -q --quiet \
+ --username --password \
+ --no-auth-cache \
+ --non-interactive --diff3-cmd'
+ ;;
+ unlock)
+ options='--targets --force --username \
+ --password --no-auth-cache \
+ --non-interactive'
+ ;;
+ update|up)
+ options='-r --revision -N \
+ --non-recursive -q --quiet \
+ --username --password \
+ --no-auth-cache \
+ --non-interactive \
+ --diff3-cmd --ignore-externals'
+ ;;
+ esac
+ options="$options --help -h --config-dir"
- COMPREPLY=( $( compgen -W "$options" -- $cur ) )
- else
- if [[ "$command" == @(help|h|\?) ]]; then
- COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
- else
- _filedir
- fi
- fi
- fi
+ COMPREPLY=( $( compgen -W "$options" -- $cur ) )
+ else
+ if [[ "$command" == @(help|h|\?) ]]; then
+ COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
+ else
+ _filedir
+ fi
+ fi
+ fi
- return 0
+ return 0
}
-complete -F _svn $filenames svn
+complete -F _svn -o filenames svn
_svnadmin()
{
- local cur prev commands options mode
+ local cur prev commands options mode
- COMPREPLY=()
- cur=`_get_cword`
+ COMPREPLY=()
+ _get_comp_words_by_ref cur prev
- commands='create deltify dump help ? hotcopy list-dblogs \
- list-unused-dblogs load lslocks lstxns recover rmlocks \
- rmtxns setlog verify'
+ commands='create deltify dump help ? hotcopy list-dblogs \
+ list-unused-dblogs load lslocks lstxns recover rmlocks \
+ rmtxns setlog verify'
- if [[ $COMP_CWORD -eq 1 ]] ; then
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--version' -- $cur ) )
- else
- COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
- fi
- else
- prev=${COMP_WORDS[COMP_CWORD-1]}
- case $prev in
- --config-dir)
- _filedir -d
- return 0;
- ;;
- --fs-type)
- COMPREPLY=( $( compgen -W 'fsfs bdb' -- $cur ) )
- return 0;
- ;;
- esac
+ if [[ $COMP_CWORD -eq 1 ]] ; then
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--version' -- $cur ) )
+ else
+ COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
+ fi
+ else
+ case $prev in
+ --config-dir)
+ _filedir -d
+ return 0;
+ ;;
+ --fs-type)
+ COMPREPLY=( $( compgen -W 'fsfs bdb' -- $cur ) )
+ return 0;
+ ;;
+ esac
- command=${COMP_WORDS[1]}
+ command=${COMP_WORDS[1]}
- if [[ "$cur" == -* ]]; then
- # possible options for the command
- case $command in
- create)
- options='--bdb-txn-nosync \
- --bdb-log-keep --config-dir \
- --fs-type'
- ;;
- deltify)
- options='-r --revision -q --quiet'
- ;;
- dump)
- options='-r --revision --incremental \
- -q --quiet --deltas'
- ;;
- hotcopy)
- options='--clean-logs'
- ;;
- load)
- options='--ignore-uuid --force-uuid \
- --parent-dir -q --quiet \
- --use-pre-commit-hook \
- --use-post-commit-hook'
- ;;
- rmtxns)
- options='-q --quiet'
- ;;
- setlog)
- options='-r --revision --bypass-hooks'
- ;;
- esac
+ if [[ "$cur" == -* ]]; then
+ # possible options for the command
+ case $command in
+ create)
+ options='--bdb-txn-nosync \
+ --bdb-log-keep --config-dir \
+ --fs-type'
+ ;;
+ deltify)
+ options='-r --revision -q --quiet'
+ ;;
+ dump)
+ options='-r --revision --incremental \
+ -q --quiet --deltas'
+ ;;
+ hotcopy)
+ options='--clean-logs'
+ ;;
+ load)
+ options='--ignore-uuid --force-uuid \
+ --parent-dir -q --quiet \
+ --use-pre-commit-hook \
+ --use-post-commit-hook'
+ ;;
+ rmtxns)
+ options='-q --quiet'
+ ;;
+ setlog)
+ options='-r --revision --bypass-hooks'
+ ;;
+ esac
- options="$options --help -h"
- COMPREPLY=( $( compgen -W "$options" -- $cur ) )
- else
- if [[ "$command" == @(help|h|\?) ]]; then
- COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
- else
- _filedir
- fi
- fi
- fi
+ options="$options --help -h"
+ COMPREPLY=( $( compgen -W "$options" -- $cur ) )
+ else
+ if [[ "$command" == @(help|h|\?) ]]; then
+ COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
+ else
+ _filedir
+ fi
+ fi
+ fi
- return 0
+ return 0
}
-complete -F _svnadmin $default svnadmin
+complete -F _svnadmin -o default svnadmin
_svnlook()
{
- local cur prev commands options mode
+ local cur prev commands options mode
- COMPREPLY=()
- cur=`_get_cword`
+ COMPREPLY=()
+ _get_comp_words_by_ref cur
- commands='author cat changed date diff dirs-changed help ? h history \
- info lock log propget pget pg proplist plist pl tree uuid \
- youngest'
+ commands='author cat changed date diff dirs-changed help ? h history \
+ info lock log propget pget pg proplist plist pl tree uuid \
+ youngest'
- if [[ $COMP_CWORD -eq 1 ]] ; then
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--version' -- $cur ) )
- else
- COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
- fi
- else
- command=${COMP_WORDS[1]}
+ if [[ $COMP_CWORD -eq 1 ]] ; then
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--version' -- $cur ) )
+ else
+ COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
+ fi
+ else
+ command=${COMP_WORDS[1]}
- if [[ "$cur" == -* ]]; then
- # possible options for the command
- case $command in
- @(author|cat|date|dirs-changed|info|log))
- options='-r --revision -t \
- --transaction'
- ;;
- changed)
- options='-r --revision -t \
- --transaction --copy-info'
- ;;
- diff)
- options='-r --revision -t \
- --transaction \
- --no-diff-deleted \
- --no-diff-added \
- --diff-copy-from'
- ;;
- history)
- options='-r --revision --show-ids'
- ;;
- prop@(get|list))
- options='-r --revision -t \
- --transaction --revprop'
- ;;
- tree)
- options='-r --revision -t \
- --transaction --show-ids \
- --full-paths'
- ;;
- esac
+ if [[ "$cur" == -* ]]; then
+ # possible options for the command
+ case $command in
+ author|cat|date|dirs-changed|info|log)
+ options='-r --revision -t \
+ --transaction'
+ ;;
+ changed)
+ options='-r --revision -t \
+ --transaction --copy-info'
+ ;;
+ diff)
+ options='-r --revision -t \
+ --transaction \
+ --no-diff-deleted \
+ --no-diff-added \
+ --diff-copy-from'
+ ;;
+ history)
+ options='-r --revision --show-ids'
+ ;;
+ propget|proplist)
+ options='-r --revision -t \
+ --transaction --revprop'
+ ;;
+ tree)
+ options='-r --revision -t \
+ --transaction --show-ids \
+ --full-paths'
+ ;;
+ esac
- options="$options --help -h"
- COMPREPLY=( $( compgen -W "$options" -- $cur ) )
- else
- if [[ "$command" == @(help|h|\?) ]]; then
- COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
- else
- _filedir
- fi
- fi
- fi
+ options="$options --help -h"
+ COMPREPLY=( $( compgen -W "$options" -- $cur ) )
+ else
+ if [[ "$command" == @(help|h|\?) ]]; then
+ COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
+ else
+ _filedir
+ fi
+ fi
+ fi
- return 0
+ return 0
}
-complete -F _svnlook $default svnlook
+complete -F _svnlook -o default svnlook
}
# Local variables:
diff --git a/contrib/_yum b/contrib/_yum
index b2283078..19b79cee 100644
--- a/contrib/_yum
+++ b/contrib/_yum
@@ -1,175 +1,152 @@
+# 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
- # Try to strip in between headings like "Available Packages"
- # This will obviously only work for English :P
- COMPREPLY=( $( yum -d 0 -C list $1 "$cur*" 2>/dev/null | \
- sed -ne '/^\(Available\|Installed\|Updated\) /d' \
- -e 's/[[:space:]].*//p' ) )
- else
- # Drop first line (e.g. "Updated Packages")
- COMPREPLY=( $( yum -d 0 -C list $1 "$cur*" 2>/dev/null | \
- sed -ne 1d -e 's/[[:space:]].*//p' ) )
- fi
+ if [[ "$1" == all ]] ; then
+ # Try to strip in between headings like "Available Packages"
+ # This will obviously only work for English :P
+ COMPREPLY=( $( yum -d 0 -C list $1 "$cur*" 2>/dev/null | \
+ sed -ne '/^Available /d' -e '/^Installed /d' -e '/^Updated /d' \
+ -e 's/[[:space:]].*//p' ) )
+ else
+ # Drop first line (e.g. "Updated Packages")
+ COMPREPLY=( $( yum -d 0 -C list $1 "$cur*" 2>/dev/null | \
+ sed -ne 1d -e 's/[[:space:]].*//p' ) )
+ fi
}
_yum_repolist()
{
- # -d 0 causes repolist to output nothing as of yum 3.2.22:
- # http://yum.baseurl.org/ticket/83
- # Drop first ("repo id repo name") and last ("repolist: ...") rows
- yum --noplugins -C repolist $1 2>/dev/null | \
- sed -ne '/^repo\(\s\+id\|list:\)/d' -e 's/[[:space:]].*//p'
+ # -d 0 causes repolist to output nothing as of yum 3.2.22:
+ # http://yum.baseurl.org/ticket/83
+ # Drop first ("repo id repo name") and last ("repolist: ...") rows
+ yum --noplugins -C repolist $1 2>/dev/null | \
+ sed -ne '/^repo\s\s*id/d' -e '/^repolist:/d' -e 's/[[:space:]].*//p'
}
_yum_plugins()
{
- command ls /usr/lib/yum-plugins/*.py{,c,o} 2>/dev/null \
- | sed -ne 's|.*/\([^./]*\)\.py[co]\?$|\1|p' | sort -u
+ command ls /usr/lib/yum-plugins/*.py{,c,o} 2>/dev/null \
+ | sed -ne 's|.*/\([^./]*\)\.py[co]\{0,1\}$|\1|p' | sort -u
}
_yum()
{
- local cur prev special split=false
+ local cur prev special i split=false
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ COMPREPLY=()
+ _get_comp_words_by_ref cur prev
- for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
- if [[ ${COMP_WORDS[i]} == @(install|update|upgrade|remove|erase|deplist|info) ]]; then
- special=${COMP_WORDS[i]}
- fi
- done
+ for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
+ if [[ ${COMP_WORDS[i]} == @(install|update|upgrade|remove|erase|deplist|info) ]]; then
+ special=${COMP_WORDS[i]}
+ fi
+ done
- if [ -n "$special" ]; then
- # TODO: install|update|upgrade should not match *src.rpm
- if [[ "$cur" == */* && "$special" == @(deplist|install|update|upgrade) ]]; then
- _filedir rpm
- return 0
- fi
- case $special in
- install)
- _yum_list available
- return 0
- ;;
- deplist|info)
- _yum_list all
- return 0
- ;;
- upgrade|update)
- _yum_list updates
- return 0
- ;;
- remove|erase)
- # _rpm_installed_packages is not arch-qualified
- _yum_list installed
- return 0
- ;;
- esac
- fi
+ if [ -n "$special" ]; then
+ # TODO: install|update|upgrade should not match *src.rpm
+ if [[ "$cur" == */* && "$special" == @(deplist|install|update|upgrade) ]]; then
+ _filedir rpm
+ return 0
+ fi
+ case $special in
+ install)
+ _yum_list available
+ return 0
+ ;;
+ deplist|info)
+ _yum_list all
+ return 0
+ ;;
+ upgrade|update)
+ _yum_list updates
+ return 0
+ ;;
+ remove|erase)
+ # _rpm_installed_packages is not arch-qualified
+ _yum_list installed
+ return 0
+ ;;
+ esac
+ fi
- _split_longopt && split=true
+ _split_longopt && split=true
- case $prev in
- list)
- COMPREPLY=( $( compgen -W 'all available updates \
- installed extras obsoletes recent' -- $cur ) )
- ;;
- clean)
- COMPREPLY=( $( compgen -W 'packages headers metadata \
- cache dbcache all' -- $cur ) )
- ;;
- repolist)
- COMPREPLY=( $( compgen -W 'all enabled disabled' -- $cur ) )
- ;;
- localinstall|localupdate)
- # TODO: should not match *src.rpm
- _filedir rpm
- ;;
- -d|-e)
- COMPREPLY=( $( compgen -W '0 1 2 3 4 5 6 7 8 9 10' -- $cur ) )
- ;;
- -c)
- _filedir
- ;;
- --installroot)
- _filedir -d
- ;;
- --enablerepo)
- COMPREPLY=( $( compgen -W '$( _yum_repolist disabled )' -- $cur ) )
- ;;
- --disablerepo)
- COMPREPLY=( $( compgen -W '$( _yum_repolist enabled )' -- $cur ) )
- ;;
- --disableexcludes)
- COMPREPLY=( $( compgen -W '$( _yum_repolist all ) \
- all main' -- $cur ) )
- ;;
- --enableplugin|--disableplugin)
- COMPREPLY=( $( compgen -W '$( _yum_plugins )' -- $cur ))
- ;;
- --color)
- COMPREPLY=( $( compgen -W 'always auto never' -- $cur ))
- ;;
- -R|-x|--exclude)
- # argument required but no completions available
- return 0
- ;;
- -h|--help|--version)
- # no other options useful with these
- return 0
- ;;
- *)
- COMPREPLY=( $( compgen -W 'install update \
- check-update upgrade remove erase list info \
- provides whatprovides clean makecache \
- groupinstall groupupdate grouplist \
- groupremove groupinfo search shell resolvedep \
- localinstall localupdate deplist repolist \
- help' -- $cur ) )
- ;;
- esac
+ case $prev in
+ list)
+ COMPREPLY=( $( compgen -W 'all available updates \
+ installed extras obsoletes recent' -- $cur ) )
+ ;;
+ clean)
+ COMPREPLY=( $( compgen -W 'packages headers metadata \
+ cache dbcache all' -- $cur ) )
+ ;;
+ repolist)
+ COMPREPLY=( $( compgen -W 'all enabled disabled' -- $cur ) )
+ ;;
+ localinstall|localupdate)
+ # TODO: should not match *src.rpm
+ _filedir rpm
+ ;;
+ -d|-e)
+ COMPREPLY=( $( compgen -W '0 1 2 3 4 5 6 7 8 9 10' -- $cur ) )
+ ;;
+ -c)
+ _filedir
+ ;;
+ --installroot)
+ _filedir -d
+ ;;
+ --enablerepo)
+ COMPREPLY=( $( compgen -W '$( _yum_repolist disabled )' -- $cur ) )
+ ;;
+ --disablerepo)
+ COMPREPLY=( $( compgen -W '$( _yum_repolist enabled )' -- $cur ) )
+ ;;
+ --disableexcludes)
+ COMPREPLY=( $( compgen -W '$( _yum_repolist all ) all main' \
+ -- $cur ) )
+ ;;
+ --enableplugin|--disableplugin)
+ COMPREPLY=( $( compgen -W '$( _yum_plugins )' -- $cur ))
+ ;;
+ --color)
+ COMPREPLY=( $( compgen -W 'always auto never' -- $cur ))
+ ;;
+ -R|-x|--exclude)
+ # argument required but no completions available
+ return 0
+ ;;
+ -h|--help|--version)
+ # no other options useful with these
+ return 0
+ ;;
+ *)
+ COMPREPLY=( $( compgen -W 'install update check-update upgrade \
+ remove erase list info provides whatprovides clean makecache \
+ groupinstall groupupdate grouplist groupremove groupinfo \
+ search shell resolvedep localinstall localupdate deplist \
+ repolist help' -- $cur ) )
+ ;;
+ esac
- $split && return 0
+ $split && return 0
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-h --help -t --tolerant -C -c -R \
- -d --showduplicates -e -q --quiet -v --verbose -y \
- --version --installroot --enablerepo --disablerepo -x \
- --exclude --disableexcludes --obsoletes --noplugins \
- --nogpgcheck --disableplugin --enableplugin \
- --skip-broken --color' -- $cur ) )
- return 0
- fi
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--help --tolerant -C -c -R -d \
+ --showduplicates -e --quiet --verbose -y --version --installroot \
+ --enablerepo --disablerepo --exclude --disableexcludes --obsoletes \
+ --noplugins --nogpgcheck --disableplugin --enableplugin \
+ --skip-broken --color' -- $cur ) )
+ return 0
+ fi
}
} &&
-complete -F _yum $filenames yum
-
-# yum-arch(8) completion
-#
-have yum-arch &&
-_yum_arch()
-{
- local cur
- COMPREPLY=()
- cur=`_get_cword`
-
- case "$cur" in
- -*)
- COMPREPLY=( $( compgen -W '-d -v -vv -n -c -z -s -l -q' -- $cur ) )
- ;;
- *)
- _filedir -d
- ;;
- esac
-
- return 0
-} &&
-complete -F _yum_arch $filenames yum-arch
+complete -F _yum -o filenames yum
# Local variables:
# mode: shell-script
diff --git a/contrib/repomanage b/contrib/_yum-utils
index 8cb50206..49a57f76 100644
--- a/contrib/repomanage
+++ b/contrib/_yum-utils
@@ -1,3 +1,6 @@
+# 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 &&
@@ -6,19 +9,18 @@ _repomanage()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
[[ "$prev" == -@(h|-help|k|-keep) ]] && return 0
if [[ "$cur" == -* ]] ; then
- COMPREPLY=( $( compgen -W '-o --old -n --new -s --space -k \
- --keep -c --nocheck -h --help' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '--old --new --space \
+ --keep --nocheck --help' -- "$cur" ) )
else
_filedir -d
fi
} &&
-complete -F _repomanage $filenames repomanage
+complete -F _repomanage -o filenames repomanage
# Local variables:
# mode: shell-script
diff --git a/contrib/abook b/contrib/abook
new file mode 100644
index 00000000..2a3bc4f6
--- /dev/null
+++ b/contrib/abook
@@ -0,0 +1,64 @@
+# abook(1) completion
+
+have abook &&
+_abook()
+{
+ local cur prev
+
+ 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" ]] &&
+ {
+ compopt -o nospace
+ COMPREPLY=( "-" )
+ return 0
+ }
+
+ case $cur in
+ -*)
+ _longopt abook
+ return 0
+ ;;
+ esac
+
+ case $prev in
+ --informat)
+ [ ${BASH_VERSINFO[0]} -ge 4 ] && compopt +o filenames
+ COMPREPLY=( $( compgen -W "$(abook --formats | \
+ sed -n -e 's/^\t\([a-z]*\).*/\1/p' -e '/^$/q')" -- "$cur" ) )
+ return 0
+ ;;
+ --outformat)
+ [ ${BASH_VERSINFO[0]} -ge 4 ] && compopt +o filenames
+ COMPREPLY=( $( compgen -W "$(abook --formats | \
+ sed -n -e '/^$/,$s/^\t\([a-z]*\).*/\1/p')" -- "$cur" ) )
+ return 0
+ ;;
+ --infile)
+ COMPREPLY=( $( compgen -W stdin -- "$cur" ) )
+ _filedir
+ return 0
+ ;;
+ --outfile)
+ COMPREPLY=( $( compgen -W stdout -- "$cur" ) )
+ _filedir
+ return 0
+ ;;
+ --config|--datafile)
+ _filedir
+ return 0
+ ;;
+ esac
+} &&
+complete -F _abook -o filenames 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/contrib/ant b/contrib/ant
index 58423f71..e0d835d6 100644
--- a/contrib/ant
+++ b/contrib/ant
@@ -1,68 +1,65 @@
# bash completion for ant
-have ant && {
+have ant &&
+{
_ant()
{
- local cur prev buildfile i
+ local cur prev buildfile i
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ COMPREPLY=()
+ _get_comp_words_by_ref cur prev
- case "$prev" in
- -buildfile|-file|-f)
- _filedir 'xml'
- return 0
- ;;
- -logfile|-l)
- _filedir
- return 0
- ;;
- -propertyfile)
- _filedir properties
- return 0
- ;;
- -nice)
- COMPREPLY=( $( compgen -W '1 2 3 4 5 6 7 8 9 10' \
- -- "$cur" ) )
- return 0
- ;;
- -lib|-logger|-listener|-D|-inputhandler|-main)
- return 0
- ;;
- esac
+ case $prev in
+ -buildfile|-file|-f)
+ _filedir 'xml'
+ return 0
+ ;;
+ -logfile|-l)
+ _filedir
+ return 0
+ ;;
+ -propertyfile)
+ _filedir properties
+ return 0
+ ;;
+ -nice)
+ COMPREPLY=( $( compgen -W '1 2 3 4 5 6 7 8 9 10' -- "$cur" ) )
+ return 0
+ ;;
+ -lib|-logger|-listener|-D|-inputhandler|-main)
+ return 0
+ ;;
+ esac
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-help -h -projecthelp -p -version \
- -diagnostics -quiet -q -verbose -v -debug -d -emacs -e \
- -lib -logfile -l -logger -listener -noinput -buildfile \
- -file -f -D -keep-going -k -propertyfile -inputhandler \
- -find -s -nice -nouserlib -noclasspath -autoproxy \
- -main' -- "$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]}
- break
- fi
- done
- [ ! -f $buildfile ] && return 0
+ 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" ) )
+ 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]}
+ 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
+ # 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 $filenames ant || \
- complete -F _ant $filenames ant
+ complete -C complete-ant-cmd.pl -F _ant -o filenames ant || \
+ complete -F _ant -o filenames ant
}
# Local variables:
diff --git a/contrib/apache2ctl b/contrib/apache2ctl
index 1987d245..287443a2 100644
--- a/contrib/apache2ctl
+++ b/contrib/apache2ctl
@@ -2,12 +2,12 @@
have apache2ctl && {
_apache2ctl() {
- local APWORDS
+ local APWORDS cur
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
- APWORDS=$(apache2ctl 2>&1 >/dev/null | head -n1 | cut -f3 -d" " | \
+ APWORDS=$(apache2ctl 2>&1 >/dev/null | awk 'NR<2 { print $3; exit }' | \
tr "|" " ")
COMPREPLY=( $( compgen -W "$APWORDS" -- "$cur" ) )
diff --git a/contrib/apt b/contrib/apt
index 36c66c99..4010a0d5 100644
--- a/contrib/apt
+++ b/contrib/apt
@@ -6,8 +6,7 @@ _apt_get()
local cur prev special i
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _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
@@ -27,6 +26,12 @@ _apt_get()
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 ) )
@@ -35,14 +40,14 @@ _apt_get()
esac
fi
- case "$prev" in
- -@(c|-config-file))
+ case $prev in
+ -c|--config-file)
_filedir
return 0
;;
- -@(t|-target-release|-default-release))
+ -t|--target-release|--default-release)
COMPREPLY=( $( apt-cache policy | \
- grep "release.o=Debian,a=$cur" | \
+ command grep "release.o=Debian,a=$cur" | \
sed -e "s/.*a=\(\w*\).*/\1/" | uniq 2> /dev/null) )
return 0
;;
@@ -66,7 +71,7 @@ _apt_get()
return 0
} &&
-complete -F _apt_get $filenames apt-get
+complete -F _apt_get -o filenames apt-get
# Debian apt-cache(8) completion.
#
@@ -76,9 +81,7 @@ _apt_cache()
local cur prev special i
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
+ _get_comp_words_by_ref cur prev
if [ "$cur" != show ]; then
for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
@@ -98,8 +101,7 @@ _apt_cache()
showsrc)
COMPREPLY=( $( apt-cache dumpavail | \
- grep "^Source: $cur" | sort | \
- uniq | cut -f2 -d" " ) )
+ command grep "^Source: $cur" | sort -u | cut -f2 -d" " ) )
return 0
;;
@@ -112,8 +114,8 @@ _apt_cache()
fi
- case "$prev" in
- -@(c|p|s|-config-file|-@(pkg|src)-cache))
+ case $prev in
+ -c|-p|-s|--config-file|--pkg-cache|--src-cache)
_filedir
return 0
;;
@@ -144,7 +146,7 @@ _apt_cache()
return 0
} &&
-complete -F _apt_cache $filenames apt-cache
+complete -F _apt_cache -o filenames apt-cache
# Local variables:
# mode: shell-script
diff --git a/contrib/apt-build b/contrib/apt-build
index 6031d61f..9597ae8d 100644
--- a/contrib/apt-build
+++ b/contrib/apt-build
@@ -6,8 +6,7 @@ _apt_build()
local cur prev special i
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _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
@@ -17,7 +16,7 @@ _apt_build()
if [ -n "$special" ]; then
case $special in
- @(install|source|info))
+ install|source|info)
COMPREPLY=( $( apt-cache pkgnames "$cur" 2> /dev/null ) )
return 0
;;
@@ -31,12 +30,12 @@ _apt_build()
esac
fi
- case "$prev" in
- --@(patch|build-dir|repository-dir))
+ case $prev in
+ --patch|--build-dir|--repository-dir)
_filedir
return 0
;;
- -@(h|-help))
+ -h|--help)
return 0
;;
esac
@@ -56,7 +55,7 @@ _apt_build()
return 0
} &&
-complete -F _apt_build $filenames apt-build
+complete -F _apt_build -o filenames apt-build
# Local variables:
# mode: shell-script
diff --git a/contrib/aptitude b/contrib/aptitude
index b83440ed..c00ad40e 100644
--- a/contrib/aptitude
+++ b/contrib/aptitude
@@ -9,7 +9,8 @@ _comp_dpkg_hold_packages()
} || {
_comp_dpkg_hold_packages()
{
- grep -B 2 'hold' /var/lib/dpkg/status | grep "Package: $1" | cut -d\ -f2
+ command grep -B 2 'hold' /var/lib/dpkg/status | \
+ command grep "Package: $1" | cut -d\ -f2
}
}
@@ -18,9 +19,7 @@ _aptitude()
local cur dashoptions prev special i
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
+ _get_comp_words_by_ref cur prev
dashoptions='-S -u -i -h --help --version -s --simulate -d \
--download-only -P --prompt -y --assume-yes -F \
@@ -30,7 +29,7 @@ _aptitude()
-Z -v --verbose --purge-unused --schedule-only'
for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
- if [[ ${COMP_WORDS[i]} == @(install|reinstall|hold|unhold|markauto|unmarkauto|dist-upgrade|full-upgrade|download|show|forbid-version|purge|remove|changelog|why|why-not|keep|keep-all|build-dep) ]]; then
+ 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]}
fi
#exclude some mutually exclusive options
@@ -40,11 +39,13 @@ _aptitude()
if [[ -n "$special" ]]; then
case $special in
- @(install|hold|markauto|unmarkauto|dist-upgrade|full-upgrade|download|show|changelog|why|why-not|build-dep))
+ install|hold|markauto|unmarkauto|dist-upgrade|full-upgrade| \
+ download|show|changelog|why|why-not|build-dep|add-user-tag| \
+ remove-user-tag)
COMPREPLY=( $( apt-cache pkgnames $cur 2> /dev/null ) )
return 0
;;
- @(purge|remove|reinstall|forbid-version))
+ purge|remove|reinstall|forbid-version)
COMPREPLY=( $( _comp_dpkg_installed_packages "$cur" ) )
return 0
;;
@@ -57,16 +58,16 @@ _aptitude()
case $prev in
# don't complete anything if these options are found
- @(autoclean|clean|forget-new|search|upgrade|safe-upgrade|update|keep-all))
+ autoclean|clean|forget-new|search|safe-upgrade|upgrade|update|keep-all)
return 0
;;
-S)
_filedir
return 0
;;
- -@(t|-target-release|-default-release))
+ -t|--target-release|--default-release)
COMPREPLY=( $( apt-cache policy | \
- grep "release.o=Debian,a=$cur" | \
+ command grep "release.o=Debian,a=$cur" | \
sed -e "s/.*a=\(\w*\).*/\1/" | uniq 2> /dev/null ) )
return 0
;;
@@ -79,12 +80,13 @@ _aptitude()
clean autoclean install reinstall remove \
hold unhold purge markauto unmarkauto why why-not \
dist-upgrade full-upgrade download search show \
- forbid-version changelog keep-all build-dep' -- "$cur" ) )
+ forbid-version changelog keep-all build-dep \
+ add-user-tag remove-user-tag' -- "$cur" ) )
fi
return 0
}
-complete -F _aptitude $default aptitude
+complete -F _aptitude -o default aptitude
}
# Local variables:
diff --git a/contrib/aspell b/contrib/aspell
index 7a5b04ee..e063f497 100644
--- a/contrib/aspell
+++ b/contrib/aspell
@@ -19,17 +19,16 @@ _aspell()
local cur prev split=false
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
_split_longopt && split=true
- case "$prev" in
- -c|-p|check|--@(conf|personal|repl|per-conf))
+ case $prev in
+ -c|-p|check|--conf|--personal|--repl|--per-conf)
_filedir
return 0
;;
- --@(conf-dir|data-dir|dict-dir|home-dir|local-data-dir|prefix))
+ --conf-dir|--data-dir|--dict-dir|--home-dir|--local-data-dir|--prefix)
_filedir -d
return 0
;;
@@ -59,20 +58,20 @@ _aspell()
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--conf --conf-dir --data-dir --dict-dir \
- --encoding --add-filter --rem-filter --mode -e \
- -H -t --add-extra-dicts --rem-extra-dicts \
- --home-dir -W --ignore --ignore-accents \
+ --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 -d --master \
+ --lang --language-tag --local-data-dir --master \
--module --add-module-search-order \
- --rem-module-search-order --per-conf -p --personal \
- --prefix --repl -C -B --run-together --dont-run-together \
+ --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 \
- -b -x --backup -b|-x --dont-backup --reverse --dont-reverse \
+ --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 \
@@ -80,13 +79,12 @@ _aspell()
--rem-tex-extension --add-sgml-check --rem-sgml-check \
--add-sgml-extension --rem-sgml-extension' -- "$cur" ) )
else
- COMPREPLY=( $( compgen -W '-? help -c check -a pipe -l list \
- config config soundslike filter -v version dump \
- create merge' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W 'usage help check pipe list \
+ config soundslike filter version dump create merge' -- "$cur" ) )
fi
}
-complete -F _aspell $filenames aspell
+complete -F _aspell -o filenames aspell
}
# Local variables:
diff --git a/contrib/autorpm b/contrib/autorpm
index e111af02..6a5f7620 100644
--- a/contrib/autorpm
+++ b/contrib/autorpm
@@ -6,7 +6,7 @@ _autorpm()
local cur
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
COMPREPLY=( $( compgen -W '--notty --debug --help --version auto add \
fullinfo info help install list remove set' -- "$cur" ) )
diff --git a/contrib/bash-builtins b/contrib/bash-builtins
index c0af45d4..aac75ae0 100644
--- a/contrib/bash-builtins
+++ b/contrib/bash-builtins
@@ -5,9 +5,9 @@ _alias()
local cur
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
- case "$COMP_LINE" in
+ case $COMP_LINE in
*[^=])
COMPREPLY=( $( compgen -A alias -- "$cur" ) )
;;
@@ -17,7 +17,7 @@ _alias()
;;
esac
}
-complete -F _alias $nospace alias
+complete -F _alias -o nospace alias
# bash export completion
#
@@ -26,9 +26,9 @@ _export()
local cur
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
- case "$COMP_LINE" in
+ case $COMP_LINE in
*=\$*)
COMPREPLY=( $( compgen -v -P '$' -- "${cur#*=\$}" ) )
;;
@@ -43,7 +43,7 @@ _export()
;;
esac
}
-complete -F _export $default $nospace export
+complete -F _export -o default -o nospace export
# bash shell function completion
#
@@ -52,8 +52,7 @@ _function()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
if [[ $1 == @(declare|typeset) ]]; then
if [ "$prev" = -f ]; then
@@ -73,18 +72,15 @@ complete -F _function function declare typeset
#
_complete()
{
- local cur prev options
+ local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
case $prev in
-o)
- options="default dirnames filenames"
- [ -n "$bash205b" ] && options="$options nospace"
- [ -n "$bash3" ] && options="$options bashdefault plusdirs"
- COMPREPLY=( $( compgen -W "$options" -- "$cur" ) )
+ COMPREPLY=( $( compgen -W 'bashdefault default dirnames filenames \
+ nospace plusdirs' -- "$cur" ) )
return 0
;;
@@ -105,7 +101,7 @@ _complete()
COMPREPLY=( $( compgen -A function -- "$cur" ) )
return 0
;;
- -@(p|r))
+ -p|-r)
COMPREPLY=( $( complete -p | sed -e 's|.* ||' ) )
COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) )
return 0
@@ -115,9 +111,8 @@ _complete()
if [[ "$cur" == -* ]]; then
# relevant options completion
- options="-a -b -c -d -e -f -g -j -k -s -v -u -A -G -W -P -S -X -F -C"
- [ -n "$bash205" ] && options="$options -o"
- COMPREPLY=( $( compgen -W "$options" -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '-a -b -c -d -e -f -g -j -k -o -s -v -u -A \
+ -G -W -P -S -X -F -C' -- "$cur" ) )
else
COMPREPLY=( $( compgen -A command -- "$cur" ) )
fi
diff --git a/contrib/bind-utils b/contrib/bind-utils
index 6c005392..040d1975 100644
--- a/contrib/bind-utils
+++ b/contrib/bind-utils
@@ -6,7 +6,7 @@ _nslookup()
local cur
COMPREPLY=()
- cur=${COMP_WORDS[COMP_CWORD]#-}
+ _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 \
diff --git a/contrib/bitkeeper b/contrib/bitkeeper
index 737837e1..4c312a14 100644
--- a/contrib/bitkeeper
+++ b/contrib/bitkeeper
@@ -2,17 +2,18 @@
have bk &&
_bk() {
- local BKCMDS
+ local BKCMDS
- COMPREPLY=()
- cur=`_get_cword`
+ COMPREPLY=()
+ _get_comp_words_by_ref cur
- BKCMDS="$( bk help topics | grep '^ bk' | cut -d ' ' -f 4 | xargs echo )"
+ BKCMDS="$( bk help topics | awk '/^ bk/ { print $4 }' | \
+ xargs printf '%s ' )"
- COMPREPLY=( $( compgen -W "$BKCMDS" -- "$cur" ) )
- _filedir
+ COMPREPLY=( $( compgen -W "$BKCMDS" -- "$cur" ) )
+ _filedir
- return 0
+ return 0
} &&
complete -F _bk bk
diff --git a/contrib/bittorrent b/contrib/bittorrent
index cc1e95ea..761d0836 100644
--- a/contrib/bittorrent
+++ b/contrib/bittorrent
@@ -1,4 +1,4 @@
-# btdownloadheadless(1) completion by Guillaume Rousse <rousse@ccr.jussieu.fr>
+# btdownloadheadless(1) completion
have btdownloadheadless.py || have btdownloadcurses.py || \
have btdownloadgui.py &&
@@ -7,11 +7,10 @@ _btdownload()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
- case "$prev" in
- --@(responsefile|saveas))
+ case $prev in
+ --responsefile|--saveas)
_filedir
return 0
;;
diff --git a/contrib/bluez-utils b/contrib/bluez
index f4d56ea5..7a2b1e57 100644
--- a/contrib/bluez-utils
+++ b/contrib/bluez
@@ -1,4 +1,4 @@
-# bash completion for bluez-utils
+# bash completion for bluez utils
have hcitool && {
_bluetooth_adresses()
@@ -28,26 +28,12 @@ _bluetooth_packet_types()
-- "$cur" ) )
}
-_get_command()
-{
- local i
-
- command=
- for (( i=1; i < COMP_CWORD; i++ )); do
- if [[ "${COMP_WORDS[i]}" != -* ]]; then
- command=${COMP_WORDS[i]}
- break
- fi
- done
-}
-
_hcitool()
{
- local cur prev split=false
+ local cur prev split=false arg
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
_split_longopt && split=true
@@ -68,18 +54,18 @@ _hcitool()
$split && return 0
- _get_command
- if [ -z $command ]; then
+ _get_first_arg
+ if [ -z $arg ]; then
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-h -i' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '--help -i' -- "$cur" ) )
else
COMPREPLY=( $( compgen -W 'dev inq scan name info \
spinq epinq cmd con cc dc sr cpt rssi lq tpl \
afh lst auth enc key clkoff clock' -- "$cur" ) )
fi
else
- case $command in
- @(name|info|dc|rssi|lq|afh|auth|key|clkoff|lst))
+ case $arg in
+ name|info|dc|rssi|lq|afh|auth|key|clkoff|lst)
_count_args
if [ $args -eq 2 ]; then
_bluetooth_adresses
@@ -111,7 +97,7 @@ _hcitool()
_bluetooth_packet_types
fi
;;
- @(tpl|enc|clock))
+ tpl|enc|clock)
_count_args
if [ $args -eq 2 ]; then
_bluetooth_adresses
@@ -129,8 +115,7 @@ _sdptool()
local cur prev split=false
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
_split_longopt && split=true
@@ -143,8 +128,8 @@ _sdptool()
$split && return 0
- _get_command
- if [ -z $command ]; then
+ _get_first_arg
+ if [ -z $arg ]; then
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--help' -- "$cur" ) )
else
@@ -152,7 +137,7 @@ _sdptool()
del get setattr setseq' -- "$cur" ) )
fi
else
- case $command in
+ case $arg in
search)
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--bdaddr \
@@ -161,7 +146,7 @@ _sdptool()
_bluetooth_services
fi
;;
- @(browse|records))
+ browse|records)
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--tree --raw --xml' -- "$cur" ) )
else
@@ -191,8 +176,7 @@ _l2ping()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
case $prev in
-i)
@@ -215,11 +199,10 @@ _rfcomm()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
case $prev in
- -@(f|-config))
+ -f|--config)
_filedir
return 0;
;;
@@ -230,12 +213,11 @@ _rfcomm()
;;
esac
- _get_command
- if [ -z $command ]; then
+ _get_first_arg
+ if [ -z $arg ]; then
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-h --help -a -r --raw -f \
- --config -i -A --auth -E --encrypt -S --secure \
- -M --master' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '--help -a --raw \
+ --config -i --auth --encrypt --secure --master' -- "$cur" ) )
else
COMPREPLY=( $( compgen -W 'show connect listen watch \
bind release' -- "$cur" ) )
@@ -245,8 +227,8 @@ _rfcomm()
if [ $args -eq 2 ]; then
_bluetooth_devices
else
- case $command in
- @(connect|bind))
+ case $arg in
+ connect|bind)
if [ $args -eq 3 ]; then
_bluetooth_adresses
fi
@@ -262,8 +244,7 @@ _ciptool()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
case $prev in
-i)
@@ -273,17 +254,17 @@ _ciptool()
;;
esac
- _get_command
- if [ -z $command ]; then
+ _get_first_arg
+ if [ -z $arg ]; then
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-h --help -i' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '--help -i' -- "$cur" ) )
else
COMPREPLY=( $( compgen -W 'show search connect release \
loopback' -- "$cur" ) )
fi
else
- case $command in
- @(connect|release|loopback))
+ case $arg in
+ connect|release|loopback)
_count_args
if [ $args -eq 2 ]; then
_bluetooth_adresses
@@ -299,18 +280,17 @@ _dfutool()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
case $prev in
- -@(d|-device))
+ -d|--device)
_bluetooth_devices
return 0;
;;
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-h --help -d --device' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '--help --device' -- "$cur" ) )
else
_count_args
case $args in
@@ -331,12 +311,12 @@ _hciconfig()
local cur
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
- _get_command
- if [ -z $command ]; then
+ _get_first_arg
+ if [ -z $arg ]; then
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-h --help -a --all' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '--help --all' -- "$cur" ) )
else
COMPREPLY=( $( compgen -W 'up down reset rstat auth \
noauth encrypt noencrypt secmgr nosecmgr \
@@ -347,8 +327,8 @@ _hciconfig()
-- "$cur" ) )
fi
else
- case $command in
- @(putkey|delkey))
+ case $arg in
+ putkey|delkey)
_count_args
if [ $args -eq 2 ]; then
_bluetooth_adresses
@@ -377,7 +357,7 @@ _hciattach()
local cur
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-n -p -t -b -s -l' -- "$cur" ) )
@@ -385,7 +365,7 @@ _hciattach()
_count_args
case $args in
1)
- COMPREPLY=( $( command ls /dev/tty* ) )
+ COMPREPLY=( $( printf '%s\n' /dev/tty* ) )
COMPREPLY=( $( compgen -W '${COMPREPLY[@]} \
${COMPREPLY[@]#/dev/}' -- "$cur" ) )
;;
@@ -415,10 +395,10 @@ _hid2hci()
local cur
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-h --help -q --quiet -0 --tohci -1 \
+ COMPREPLY=( $( compgen -W '--help --quiet -0 --tohci -1 \
--tohid' -- "$cur" ) )
fi
}
@@ -429,10 +409,10 @@ _avctrl()
local cur
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-h --help -q --quiet' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '--help --quiet' -- "$cur" ) )
else
_count_args
if [ $args -eq 1 ]; then
diff --git a/contrib/brctl b/contrib/brctl
index a612034c..1be86af1 100644
--- a/contrib/brctl
+++ b/contrib/brctl
@@ -6,7 +6,7 @@ _brctl()
local cur command
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
command=${COMP_WORDS[1]}
case $COMP_CWORD in
@@ -21,13 +21,13 @@ _brctl()
show)
;;
*)
- COMPREPLY=( $( compgen -W "$(brctl show | sed '1d' | \
- awk '{print $1}' )" -- "$cur" ) )
+ COMPREPLY=( $( compgen -W "$(brctl show | \
+ awk 'NR>1 {print $1}' )" -- "$cur" ) )
esac
;;
3)
case $command in
- @(add|del)if)
+ addif|delif)
_configured_interfaces
;;
stp)
@@ -37,7 +37,7 @@ _brctl()
;;
esac
} &&
-complete -F _brctl $default brctl
+complete -F _brctl -o default brctl
# Local variables:
# mode: shell-script
diff --git a/contrib/bzip2 b/contrib/bzip2
index 5572d09a..f4902e29 100644
--- a/contrib/bzip2
+++ b/contrib/bzip2
@@ -1,20 +1,23 @@
# bash completion for bzip2
-have bzip2 &&
+have bzip2 || have pbzip2 &&
_bzip2()
{
- local cur prev xspec
+ local cur prev xspec helpopts
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
+ helpopts=`_parse_help ${COMP_WORDS[0]}`
+
+ case $prev in
+ -b|-h|--help|-p)
+ return 0
+ ;;
+ esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-c -d -f -h -k -L -q -s \
- -t -v -V -z -1 -2 -3 -4 -5 -6 -7 -8 -9 \
- --help --decompress --compress --keep --force \
- --test --stdout --quiet --verbose --license \
- --version --small --fast --best' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W "${helpopts//#/} -2 -3 -4 -5 -6 -7 -8 -9" \
+ -- "$cur" ) )
return 0
fi
@@ -36,7 +39,7 @@ _bzip2()
COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \
$( compgen -d -- "$cur" ) )
} &&
-complete -F _bzip2 $filenames bzip2
+complete -F _bzip2 -o filenames bzip2 pbzip2
# Local variables:
# mode: shell-script
diff --git a/contrib/cardctl b/contrib/cardctl
index c16c52d5..1af7491b 100644
--- a/contrib/cardctl
+++ b/contrib/cardctl
@@ -1,19 +1,19 @@
# Linux cardctl(8) completion
-have cardctl &&
+have cardctl || have pccardctl &&
_cardctl()
{
local cur
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
if [ $COMP_CWORD -eq 1 ]; then
COMPREPLY=( $( compgen -W 'status config ident suspend \
resume reset eject insert scheme' -- "$cur" ) )
fi
} &&
-complete -F _cardctl cardctl
+complete -F _cardctl cardctl pccardctl
# Local variables:
# mode: shell-script
diff --git a/contrib/cfengine b/contrib/cfengine
index 0f40e0cd..50a13840 100644
--- a/contrib/cfengine
+++ b/contrib/cfengine
@@ -3,16 +3,13 @@
have cfagent && {
_cfagent_options()
{
- COMPREPLY=( $( compgen -W '-a --sysadm -b --force-net-copy -c \
- --no-check-files -C --no-check-mounts -d --debug -D --define \
- -e --no-edits -E --enforce-links -f --file -h --help -H \
- --no-hard-classes -i --no-ifconfig -I --inform -k --no-copy \
- -K --no-lock -l --traverse-links -L --delete-stale-links -m \
- --no-mount -M --no-modules -n --recon --dry-run --just-print \
- -N --negate --undefine -p --parse-only -P --no-processes -q \
- --no-splay -s --no-commands -S --silent -t --no-tidy -u \
- --use-env -U --underscore-classes -v --verbose -V --version \
- -x --no-preconf -X --no-links -w --no-warn --quiet' -- "$cur" ) )
+ 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()
@@ -20,11 +17,10 @@ _cfagent()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
case $prev in
- -@(f|-file))
+ -f|--file)
_filedir
return 0
;;
@@ -38,10 +34,10 @@ complete -F _cfagent cfagent
_cfrun()
{
- local i section cfinputs
+ local i section cfinputs cur prev
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur prev
section=1
for (( i=1; i < COMP_CWORD; i++ )); do
@@ -52,7 +48,6 @@ _cfrun()
case $section in
1)
- prev=${COMP_WORDS[COMP_CWORD-1]}
case $prev in
-f)
_filedir
@@ -72,7 +67,7 @@ _cfrun()
done
[ ! -f $hostfile ] && return 0
- COMPREPLY=( $(compgen -W "$( grep -v \
+ COMPREPLY=( $(compgen -W "$( command grep -v \
-E '(=|^$|^#)' $hostfile )" -- "$cur" ) )
fi
;;
diff --git a/contrib/chkconfig b/contrib/chkconfig
index 7c12c0d8..2d02e56e 100644
--- a/contrib/chkconfig
+++ b/contrib/chkconfig
@@ -6,20 +6,19 @@ _chkconfig()
local cur prev split=false
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
_split_longopt && split=true
- case "$prev" in
- @(?(--level=)[1-6]|--@(list|add|del|override)))
- _services
- return 0
- ;;
- --level)
- COMPREPLY=( $( compgen -W '1 2 3 4 5 6' -- "$cur" ) )
- return 0
- ;;
+ case $prev in
+ --level=[1-6]|[1-6]|--list|--add|--del|--override)
+ _services
+ return 0
+ ;;
+ --level)
+ COMPREPLY=( $( compgen -W '1 2 3 4 5 6' -- "$cur" ) )
+ return 0
+ ;;
esac
$split && return 0
@@ -27,7 +26,7 @@ _chkconfig()
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--list --add --del --override --level' -- "$cur" ) )
else
- if [ $COMP_CWORD -eq 2 -o $COMP_CWORD -eq 4 ]; then
+ if [[ $COMP_CWORD -eq 2 || $COMP_CWORD -eq 4 ]]; then
COMPREPLY=( $( compgen -W 'on off reset resetpriorities' -- "$cur" ) )
else
_services
diff --git a/contrib/chsh b/contrib/chsh
index 46ee029f..1af3630f 100644
--- a/contrib/chsh
+++ b/contrib/chsh
@@ -5,11 +5,21 @@ _chsh()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
- if [ "$prev" = "-s" ]; then
- _shells
+ case $prev in
+ --list-shells|--help|-v|--version)
+ return 0
+ ;;
+ -s|--shell)
+ _shells
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* && "$( uname -s )" == @(Linux|GNU|GNU/*) ]]; then
+ COMPREPLY=( $( compgen -W '--shell --list-shells --help --version' \
+ -- "$cur" ) )
else
COMPREPLY=( $( compgen -u -- "$cur" ) )
fi
diff --git a/contrib/cksfv b/contrib/cksfv
index 0ddea02f..1f83824b 100644
--- a/contrib/cksfv
+++ b/contrib/cksfv
@@ -3,23 +3,25 @@
have cksfv &&
_cksfv()
{
+ local cur prev
+
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur prev
if [ $COMP_CWORD -eq 1 ]; then
COMPREPLY=( $( compgen -W '-C -f -i -q -v' -- "$cur" ) )
return 0
fi
- case "${COMP_WORDS[$COMP_CWORD-1]}" in
- -C)
- _filedir -d
- return 0
- ;;
- -f)
- _filedir 'sfv'
- return 0
- ;;
+ case "$prev" in
+ -C)
+ _filedir -d
+ return 0
+ ;;
+ -f)
+ _filedir 'sfv'
+ return 0
+ ;;
esac
_filedir
diff --git a/contrib/clisp b/contrib/clisp
index 322faabb..074f692c 100644
--- a/contrib/clisp
+++ b/contrib/clisp
@@ -7,7 +7,7 @@ _clisp()
local cur
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
# completing an option (may or may not be separated by a space)
if [[ "$cur" == -* ]]; then
@@ -20,7 +20,7 @@ _clisp()
return 0
} &&
-complete -F _clisp $default clisp
+complete -F _clisp -o default clisp
# Local variables:
# mode: shell-script
diff --git a/contrib/configure b/contrib/configure
index 3195bcb9..d69f85b1 100644
--- a/contrib/configure
+++ b/contrib/configure
@@ -2,26 +2,38 @@
_configure()
{
- local cur
+ local cur prev split=false
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur prev
+
+ _split_longopt && split=true
+
+ case $prev in
+ --prefix|--exec-prefix|--*dir)
+ _filedir -d
+ ;;
+ esac
+
+ $split && return 0
# if $COMP_CONFIGURE_HINTS is not null, then completions of the form
# --option=SETTING will include 'SETTING' as a contextual hint
[[ "$cur" != -* ]] && return 0
if [ -n "$COMP_CONFIGURE_HINTS" ]; then
- COMPREPLY=( $( $1 --help 2>&1 | awk '/^ --[A-Za-z]/ { print $1; \
- if ($2 ~ /--[A-Za-z]/) print $2 }' | sed -e 's/[[,].*//g' | \
- grep ^$cur ) )
+ COMPREPLY=( $( compgen -W "$( $1 --help 2>&1 | \
+ awk '/^ --[A-Za-z]/ { print $1; \
+ if ($2 ~ /--[A-Za-z]/) print $2 }' | sed -e 's/[[,].*//g' )" \
+ -- "$cur" ) )
else
- COMPREPLY=( $( $1 --help 2>&1 | awk '/^ --[A-Za-z]/ { print $1; \
- if ($2 ~ /--[A-Za-z]/) print $2 }' | sed -e 's/[[,=].*//g' | \
- grep ^$cur ) )
+ COMPREPLY=( $( compgen -W "$( $1 --help 2>&1 | \
+ awk '/^ --[A-Za-z]/ { print $1; \
+ if ($2 ~ /--[A-Za-z]/) print $2 }' | sed -e 's/[[,=].*//g' )" \
+ -- "$cur" ) )
fi
}
-complete -F _configure $default configure
+complete -F _configure -o filenames configure
# Local variables:
# mode: shell-script
diff --git a/contrib/coreutils b/contrib/coreutils
new file mode 100644
index 00000000..65809fbb
--- /dev/null
+++ b/contrib/coreutils
@@ -0,0 +1,122 @@
+# 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
+ else
+ _filedir
+ fi
+ fi
+} &&
+complete -F _chown -o filenames 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
+ local IFS=$'\n'
+ COMPREPLY=( $( compgen -g "$cur" 2>/dev/null ) )
+ else
+ _filedir || return 0
+ fi
+
+ return 0
+} &&
+complete -F _chgrp -o filenames 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
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/cowsay b/contrib/cowsay
index 0a441446..c6d797aa 100644
--- a/contrib/cowsay
+++ b/contrib/cowsay
@@ -6,8 +6,7 @@ _cowsay()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
case $prev in
-f)
@@ -21,7 +20,7 @@ _cowsay()
-- "$cur" ) )
} &&
-complete -F _cowsay $default cowsay cowthink
+complete -F _cowsay -o default cowsay cowthink
# Local variables:
# mode: shell-script
diff --git a/contrib/cpan2dist b/contrib/cpan2dist
index e2147bfa..13f568af 100644
--- a/contrib/cpan2dist
+++ b/contrib/cpan2dist
@@ -6,8 +6,7 @@ _cpan2dist()
local cur prev packagelist cpandirs
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
case $prev in
--format)
@@ -17,7 +16,7 @@ _cpan2dist()
-- "$cur" ) )
return 0
;;
- --@(banlist|ignorelist|modulelist|logfile))
+ --banlist|--ignorelist|--modulelist|--logfile)
_filedir
return 0
;;
@@ -34,7 +33,7 @@ _cpan2dist()
else
cpandirs=( "$HOME/.cpanplus/" "$HOME/.cpan/source/modules/" )
for dir in ${cpandirs[@]}; do
- [ -d "$dir" -a -r "$dir/02packages.details.txt.gz" ] && \
+ [[ -d "$dir" && -r "$dir/02packages.details.txt.gz" ]] && \
packagelist="$dir/02packages.details.txt.gz"
done
COMPREPLY=( $( zgrep "^${cur//-/::}" \
@@ -42,7 +41,7 @@ _cpan2dist()
| awk '{print $1}' | sed -e 's/::/-/g' ) )
fi
} &&
-complete -F _cpan2dist $default cpan2dist
+complete -F _cpan2dist -o default cpan2dist
# Local variables:
# mode: shell-script
diff --git a/contrib/cpio b/contrib/cpio
index f28b1b21..e77b4153 100644
--- a/contrib/cpio
+++ b/contrib/cpio
@@ -11,8 +11,7 @@ _cpio()
local cur prev split=false
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref -n : cur prev
_split_longopt && split=true
@@ -22,7 +21,7 @@ _cpio()
_cpio_format
return 0
;;
- -@(E|F|I|-?(pattern-)file))
+ -E|-F|-I|--file|--pattern-file)
_filedir
return 0
;;
@@ -39,10 +38,11 @@ _cpio()
$split && return 0
if [ $COMP_CWORD -eq 1 ]; then
- COMPREPLY=( $( compgen -W '-o --create -i --extract -p --pass-through' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '-o --create -i --extract -p --pass-through \
+ -? --help --license --usage --version' -- "$cur" ) )
else
case ${COMP_WORDS[1]} in
- -@(o|-create))
+ -o|--create)
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-0 -a -c -v -A -B\
-L -V -C -H -M -O -F --file --format\
@@ -53,7 +53,7 @@ _cpio()
--version' -- "$cur" ) )
fi
;;
- -@(i|-extract))
+ -i|--extract)
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-b -c -d -f -m -n -r\
-t -s -u -v -B -S -V -C -E -H -M -R -I\
@@ -69,10 +69,11 @@ _cpio()
--force-local --no-absolute-filenames\
--sparse --only-verify-crc --quiet\
--rsh-command --help\
+ --to-stdout \
--version' -- "$cur" ) )
fi
;;
- -@(p|-pass-through))
+ -p|--pass-through)
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-0 -a -d -l -m -u -v\
-L -V -R --null --reset-access-time\
@@ -89,7 +90,7 @@ _cpio()
esac
fi
}
-complete -F _cpio cpio
+complete -F _cpio -o filenames cpio
}
# Local variables:
diff --git a/contrib/cryptsetup b/contrib/cryptsetup
new file mode 100644
index 00000000..5e88de34
--- /dev/null
+++ b/contrib/cryptsetup
@@ -0,0 +1,113 @@
+# bash completion for cryptsetup
+
+_cryptsetup_name()
+{
+ COMPREPLY=( $( compgen -X control -W '$( command ls /dev/mapper )' \
+ -- "$cur" ) )
+}
+
+_cryptsetup_device()
+{
+ cur=${cur:=/dev/}
+ _filedir
+}
+
+have cryptsetup &&
+_cryptsetup()
+{
+ local cur prev arg
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=`_get_pword`
+
+ case $prev in
+ --key-file|--master-key-file|--header-backup-file|-d)
+ _filedir
+ return 0;
+ ;;
+ esac
+
+ _get_first_arg
+ if [ -z $arg ]; then
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--hash --cipher --verify-passphrase \
+ --key-file --master-key-file --key-slot --key-size --size \
+ --offset --skip --readonly --iter-time --batch-mode --timeout \
+ --tries --align-payload --version' -- "$cur" ) )
+ else
+ COMPREPLY=( $( compgen -W 'create remove status resize luksFormat \
+ luksOpen luksClose luksSuspend luksResume luksAddKey \
+ luksRemoveKey luksKillSlot luksDelKey luksUUID isLuks \
+ luksDump luksHeaderBackup luksHeaderRestore' -- "$cur" ) )
+ fi
+ else
+ _count_args
+ case $arg in
+ create)
+ case $args in
+ 2)
+ _cryptsetup_name
+ ;;
+ 3)
+ _cryptsetup_device
+ ;;
+ esac
+ ;;
+ remove|status|resize|luksClose|luksSuspend|luksResume)
+ case $args in
+ 2)
+ _cryptsetup_name
+ ;;
+ esac
+ ;;
+ luksFormat|luksAddKey|luksRemoveKey)
+ case $args in
+ 2)
+ _cryptsetup_device
+ ;;
+ 3)
+ _filedir
+ ;;
+ esac
+ ;;
+ luksOpen)
+ case $args in
+ 2)
+ _cryptsetup_device
+ ;;
+ 3)
+ _cryptsetup_name
+ ;;
+ esac
+ ;;
+ luksKillSlot|luksDelKey|luksUUID|isLuks|luksDump)
+ case $args in
+ 2)
+ _cryptsetup_device
+ ;;
+ esac
+ ;;
+ luksHeaderBackup|luksHeaderRestore)
+ case $args in
+ 2)
+ _cryptsetup_device
+ ;;
+ 3)
+ COMPREPLY=( '--header-backup-file' )
+ ;;
+ esac
+ ;;
+ esac
+ fi
+
+ return 0
+} &&
+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/contrib/cups b/contrib/cups
index 0d7ceaba..80c9af54 100644
--- a/contrib/cups
+++ b/contrib/cups
@@ -6,11 +6,11 @@ _cancel()
local cur
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
COMPREPLY=( $( compgen -W "$( lpstat | cut -d' ' -f1 )" -- "$cur" ) )
} &&
-complete -F _cancel $filenames cancel
+complete -F _cancel -o filenames cancel
# Local variables:
# mode: shell-script
diff --git a/contrib/cvs b/contrib/cvs
index aa2d46c9..04837cd1 100644
--- a/contrib/cvs
+++ b/contrib/cvs
@@ -23,83 +23,116 @@ get_modules()
fi
}
+_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'
+}
+
+_cvs_kflags()
+{
+ COMPREPLY=( $( compgen -W 'kv kvl k o b v' -- "$cur" ) )
+}
+
+_cvs_roots()
+{
+ local -a cvsroots
+ cvsroots=( $CVSROOT )
+ [ -r ~/.cvspass ] && \
+ cvsroots=( "${cvsroots[@]}" $( awk '{ print $2 }' ~/.cvspass ) )
+ [ -r CVS/Root ] && cvsroots=( "${cvsroots[@]}" $(cat CVS/Root) )
+ COMPREPLY=( $( compgen -W '${cvsroots[@]}' -- "$cur" ) )
+ __ltrim_colon_completions "$cur"
+}
+
_cvs()
{
- local cur count mode i cvsroot cvsroots pwd
+ local cur prev count mode i cvsroot cvsroots pwd
local -a flags miss files entries changed newremoved
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref -n : cur prev
count=0
for i in "${COMP_WORDS[@]}"; do
[ $count -eq $COMP_CWORD ] && break
# Last parameter was the CVSROOT, now go back to mode selection
- if [ "${COMP_WORDS[((count))]}" == "$cvsroot" -a "$mode" == "cvsroot" ]; then
+ if [[ "${COMP_WORDS[((count))]}" == "$cvsroot" && "$mode" == cvsroot ]]; then
mode=""
fi
if [ -z "$mode" ]; then
case $i in
- -d)
- mode=cvsroot
- cvsroot=${COMP_WORDS[((count+1))]}
- ;;
- @(ad?(d)|new))
- mode=add
- ;;
- @(adm?(in)|rcs))
- mode=admin
- ;;
- ann?(notate))
- mode=annotate
- ;;
- @(checkout|co|get))
- mode=checkout
- ;;
- @(com?(mit)|ci))
- mode=commit
- ;;
- di?(f?(f)))
- mode=diff
- ;;
- ex?(p?(ort)))
- mode=export
- ;;
- ?(un)edit)
- mode=$i
- ;;
- hi?(s?(tory)))
- mode=history
- ;;
- im?(p?(ort)))
- mode=import
- ;;
- re?(l?(ease)))
- mode=release
- ;;
- ?(r)log)
- mode=log
- ;;
- @(rdiff|patch))
- mode=rdiff
- ;;
- @(remove|rm|delete))
- mode=remove
- ;;
- @(rtag|rfreeze))
- mode=rtag
- ;;
- st?(at?(us)))
- mode=status
- ;;
- @(tag|freeze))
- mode=tag
- ;;
- up?(d?(ate)))
- mode=update
- ;;
- *)
- ;;
+ -H|--help)
+ COMPREPLY=( $( compgen -W "$( _cvs_commands )" -- "$cur" ) )
+ return 0
+ ;;
+ -d)
+ mode=cvsroot
+ cvsroot=${COMP_WORDS[((count+1))]}
+ ;;
+ ad|add|new)
+ mode=add
+ ;;
+ adm|admin|rcs)
+ mode=admin
+ ;;
+ ann|annotate)
+ mode=annotate
+ ;;
+ checkout|co|get)
+ mode=checkout
+ ;;
+ com|commit|ci)
+ mode=commit
+ ;;
+ di|dif|diff)
+ mode=diff
+ ;;
+ ex|exp|export)
+ mode=export
+ ;;
+ edit|unedit)
+ mode=$i
+ ;;
+ hi|his|history)
+ mode=history
+ ;;
+ im|imp|import)
+ mode=import
+ ;;
+ re|rel|release)
+ mode=release
+ ;;
+ log|rlog)
+ mode=log
+ ;;
+ rdiff|patch)
+ mode=rdiff
+ ;;
+ remove|rm|delete)
+ mode=remove
+ ;;
+ rtag|rfreeze)
+ mode=rtag
+ ;;
+ st|stat|status)
+ mode=status
+ ;;
+ tag|freeze)
+ mode=tag
+ ;;
+ up|upd|update)
+ mode=update
+ ;;
esac
elif [[ "$i" = -* ]]; then
flags=( "${flags[@]}" $i )
@@ -107,11 +140,21 @@ _cvs()
count=$((++count))
done
- case "$mode" in
+ case $mode in
add)
+ case $prev in
+ -m)
+ return 0
+ ;;
+ -k)
+ _cvs_kflags
+ return 0
+ ;;
+ esac
+
if [[ "$cur" != -* ]]; then
set_prefix
- if [ $COMP_CWORD -gt 1 -a -r ${prefix:-}CVS/Entries ]; then
+ if [[ $COMP_CWORD -gt 1 && -r ${prefix:-}CVS/Entries ]]; then
get_entries
[ -z "$cur" ] && \
files=$( command ls -Ad !(CVS) ) || \
@@ -122,35 +165,77 @@ _cvs()
COMPREPLY=( $( compgen -X '*~' -W '${files[@]}' -- $cur ) )
fi
else
- COMPREPLY=( $( compgen -W '-k -m' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W "$( _cvs_command_options $mode )" \
+ -- "$cur" ) )
fi
;;
admin)
+ case $prev in
+ -a|-A|-b|-c|-e|-l|-m|-n|-N|-o|-s|-t-|-u)
+ return 0
+ ;;
+ -t)
+ _filedir
+ return 0
+ ;;
+ -k)
+ _cvs_kflags
+ return 0
+ ;;
+ esac
+
if [[ "$cur" = -* ]]; then
- COMPREPLY=( $( compgen -W '-i -a -A -e -b -c -k -l -u -L -U -m -M \
- -n -N -o -q -I -s -t -t- -T -V -x -z' -- $cur ) )
+ COMPREPLY=( $( compgen -W "$( _cvs_command_options $mode )" \
+ -- "$cur" ) )
fi
;;
annotate)
+ [[ "$prev" == -@(r|D) ]] && return 0
+
if [[ "$cur" = -* ]]; then
- COMPREPLY=( $( compgen -W '-D -F -f -l -R -r' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W "$( _cvs_command_options $mode )" \
+ -- "$cur" ) )
else
get_entries
COMPREPLY=( $( compgen -W '${entries[@]}' -- "$cur" ) )
fi
;;
checkout)
+ case $prev in
+ -r|-D|j)
+ return 0
+ ;;
+ -d)
+ _filedir -d
+ return 0
+ ;;
+ -k)
+ _cvs_kflags
+ return 0
+ ;;
+ esac
+
if [[ "$cur" != -* ]]; then
[ -z "$cvsroot" ] && cvsroot=$CVSROOT
COMPREPLY=( $( cvs -d "$cvsroot" co -c 2> /dev/null | \
awk '{print $1}' ) )
COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) )
else
- COMPREPLY=( $( compgen -W '-A -N -P -R -c -f -l -n -p \
- -s -r -D -d -k -j' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W "$( _cvs_command_options $mode )" \
+ -- "$cur" ) )
fi
;;
commit)
+ case $prev in
+ -m|-r)
+ return 0
+ ;;
+ -F)
+ _filedir
+ return 0
+ ;;
+ esac
+
set_prefix
if [[ "$cur" != -* ]] && [ -r ${prefix:-}CVS/Entries ]; then
@@ -169,26 +254,39 @@ _cvs()
COMPREPLY=( $( compgen -W '${changed[@]:-} \
${newremoved[@]:-}' -- "$cur" ) )
else
- COMPREPLY=( $(compgen $default -- "$cur") )
+ COMPREPLY=( $(compgen -o default -- "$cur") )
fi
else
- COMPREPLY=( $( compgen -W '-n -R -l -f -F -m -r' -- $cur ) )
+ COMPREPLY=( $( compgen -W "$( _cvs_command_options $mode )" \
+ -- "$cur" ) )
fi
;;
cvsroot)
- if [ -r ~/.cvspass ]; then
- # Ugly escaping because of bash treating ':' specially
- cvsroots=$( sed 's/^[^ ]* //; s/:/\\:/g' ~/.cvspass )
- COMPREPLY=( $( compgen -W '$cvsroots' -- "$cur" ) )
- fi
+ # TODO: works poorly because of the colons and -o default,
+ # could we drop -o default? works ok without it in cvsps
+ _cvs_roots
;;
export)
+ case $prev in
+ -r|-D)
+ return 0
+ ;;
+ -d)
+ _filedir -d
+ return 0
+ ;;
+ -k)
+ _cvs_kflags
+ return 0
+ ;;
+ esac
+
if [[ "$cur" != -* ]]; then
[ -z "$cvsroot" ] && cvsroot=$CVSROOT
COMPREPLY=( $( cvs -d "$cvsroot" co -c | awk '{print $1}' ) )
COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) )
else
- COMPREPLY=( $( compgen -W '-N -f -l -R -n -r -D -d -k' \
+ COMPREPLY=( $( compgen -W "$( _cvs_command_options $mode )" \
-- "$cur" ) )
fi
;;
@@ -203,7 +301,7 @@ _cvs()
remove)
if [[ "$cur" != -* ]]; then
set_prefix
- if [ $COMP_CWORD -gt 1 -a -r ${prefix:-}CVS/Entries ]; then
+ if [[ $COMP_CWORD -gt 1 && -r ${prefix:-}CVS/Entries ]]; then
get_entries
# find out what files are missing
for i in "${entries[@]}"; do
@@ -212,10 +310,21 @@ _cvs()
COMPREPLY=( $(compgen -W '${miss[@]:-}' -- "$cur") )
fi
else
- COMPREPLY=( $( compgen -W '-f -l -R' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W "$( _cvs_command_options $mode )" \
+ -- "$cur" ) )
fi
;;
import)
+ case $prev in
+ -I|-b|-m|-W)
+ return 0
+ ;;
+ -k)
+ _cvs_kflags
+ return 0
+ ;;
+ esac
+
if [[ "$cur" != -* ]]; then
# starts with same algorithm as checkout
[ -z "$cvsroot" ] && cvsroot=$CVSROOT
@@ -229,32 +338,49 @@ _cvs()
pwd=${pwd##*/}
COMPREPLY=( $( compgen -W '${COMPREPLY[@]} $pwd' -- $cur ) )
else
- COMPREPLY=( $( compgen -W '-d -k -I -b -m -W' -- "$cur" ))
+ COMPREPLY=( $( compgen -W "$( _cvs_command_options $mode )" \
+ -- "$cur" ) )
fi
;;
update)
+ case $prev in
+ -r|-D|-j|-I|-W)
+ return 0
+ ;;
+ -k)
+ _cvs_kflags
+ return 0
+ ;;
+ esac
+
if [[ "$cur" = -* ]]; then
- COMPREPLY=( $( compgen -W '-A -P -C -d -f -l -R -p \
- -k -r -D -j -I -W' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W "$( _cvs_command_options $mode )" \
+ -- "$cur" ) )
fi
;;
"")
- COMPREPLY=( $( compgen -W 'add admin annotate checkout ci co \
- commit diff delete edit export \
- freeze get history import log new \
- patch rcs rdiff release remove \
- rfreeze rlog rm rtag stat status \
- tag unedit up update -H -Q -q -b \
- -d -e -f -l -n -t -r -v -w -x -z \
- --help --version' -- "$cur" ) )
- ;;
- *)
+ case $prev in
+ -T)
+ _filedir -d
+ return 0
+ ;;
+ -e|-s)
+ return 0
+ ;;
+ -z)
+ COMPREPLY=( $( compgen -W '1 2 3 4 5 6 7 8 9' -- "$cur" ) )
+ return 0
+ ;;
+ esac
+
+ COMPREPLY=( $( compgen -W '$( _cvs_commands ) $( _cvs_options ) \
+ --help --help-commands --help-options --version' -- "$cur" ) )
;;
esac
return 0
}
-complete -F _cvs $default cvs
+complete -F _cvs -o default cvs
}
# Local variables:
diff --git a/contrib/cvsps b/contrib/cvsps
new file mode 100644
index 00000000..257437bc
--- /dev/null
+++ b/contrib/cvsps
@@ -0,0 +1,69 @@
+# bash completion for cvsps
+
+have cvsps &&
+_cvsps()
+{
+ COMPREPLY=()
+ local cur prev
+ _get_comp_words_by_ref -n : cur prev
+
+ case $prev in
+ -h|-z|-f|-d|-l|--diff-opts|--debuglvl)
+ return 0
+ ;;
+ -s)
+ COMPREPLY=( $( compgen -W "$( cvsps 2>/dev/null |
+ awk '/^PatchSet:?[ \t]/ { print $2 }' )" -- "$cur" ) )
+ return 0
+ ;;
+ -a)
+ COMPREPLY=( $( compgen -W "$( cvsps 2>/dev/null |
+ awk '/^Author:[ \t]/ { print $2 }' )" -- "$cur" ) )
+ return 0
+ ;;
+ -b)
+ COMPREPLY=( $( compgen -W "$( cvsps 2>/dev/null |
+ awk '/^Branch:[ \t]/ { print $2 }' )" -- "$cur" ) )
+ return 0
+ ;;
+ -r)
+ COMPREPLY=( $( compgen -W "$( cvsps 2>/dev/null |
+ awk '/^Tag:[ \t]+[^(]/ { print $2 }' )" -- "$cur" ) )
+ return 0
+ ;;
+ -p)
+ _filedir -d
+ return 0
+ ;;
+ --test-log)
+ _filedir
+ return 0
+ ;;
+ -Z)
+ COMPREPLY=( $( compgen -W '1 2 3 4 5 6 7 8 9' -- "$cur" ) )
+ return 0
+ ;;
+ --root)
+ type _cvs_roots &>/dev/null && _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" ) )
+ else
+ type _cvs_roots &>/dev/null && _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/contrib/dcop b/contrib/dcop
deleted file mode 100644
index 6f384f71..00000000
--- a/contrib/dcop
+++ /dev/null
@@ -1,26 +0,0 @@
-# bash completion for dcop
-
-have dcop &&
-_dcop()
-{
- local cur compstr
-
- COMPREPLY=()
- cur=`_get_cword`
- if [ -z $cur ]; then
- compstr=${COMP_WORDS[*]}
- else
- compstr=$( command echo ${COMP_WORDS[*]} | sed "s/ $cur$//" )
- fi
- COMPREPLY=( $( compgen -W '$( command $compstr | sed s/\(.*\)// )' \
- -- "$cur" ) )
-} &&
-complete -F _dcop 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/contrib/dd b/contrib/dd
index 3c1d3c37..e236f85a 100644
--- a/contrib/dd
+++ b/contrib/dd
@@ -6,9 +6,9 @@ _dd()
local cur
COMPREPLY=()
- cur=`_get_cword =`
+ _get_comp_words_by_ref -n = cur
- case "$cur" in
+ case $cur in
if=*|of=*)
cur=${cur#*=}
_filedir
@@ -28,7 +28,7 @@ _dd()
$( compgen -W 'bs cbs conv count ibs if obs of seek skip'\
-S '=' -- "$cur" ) )
} &&
-complete -F _dd $nospace $filenames dd
+complete -F _dd -o nospace -o filenames dd
# Local variables:
# mode: shell-script
diff --git a/contrib/dhclient b/contrib/dhclient
index 9ea79f34..3d7e1e1a 100644
--- a/contrib/dhclient
+++ b/contrib/dhclient
@@ -5,11 +5,10 @@ have dhclient && _dhclient()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
- case "$prev" in
- -@(cf|lf|pf|sf))
+ case $prev in
+ -cf|-lf|-pf|-sf)
_filedir
return 0
;;
diff --git a/contrib/dict b/contrib/dict
index c45310f4..4cfdf98f 100644
--- a/contrib/dict
+++ b/contrib/dict
@@ -12,61 +12,60 @@ _dict()
local cur prev host port db dictfile
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
dictfile=/usr/share/dict/words
for (( i=1; i < COMP_CWORD; i++ )); do
- case "${COMP_WORDS[i]}" in
- -@(h|--host))
- host=${COMP_WORDS[i+1]}
- [ -n "$host" ] && host="-h $host"
- i=$((++i))
- ;;
- -@(p|-port))
- port=${COMP_WORDS[i+1]}
- [ -n "$port" ] && port="-p $port"
- i=$((++i))
- ;;
- -@(d|-database))
- db=${COMP_WORDS[i+1]}
- [ -n "$db" ] && host="-d $db"
- i=$((++i))
- ;;
- *)
- ;;
+ case ${COMP_WORDS[i]} in
+ -h|--host)
+ host=${COMP_WORDS[i+1]}
+ [ -n "$host" ] && host="-h $host"
+ i=$((++i))
+ ;;
+ -p|--port)
+ port=${COMP_WORDS[i+1]}
+ [ -n "$port" ] && port="-p $port"
+ i=$((++i))
+ ;;
+ -d|--database)
+ db=${COMP_WORDS[i+1]}
+ [ -n "$db" ] && host="-d $db"
+ i=$((++i))
+ ;;
+ *)
+ ;;
esac
done
if [[ "$cur" = -* ]]; then
- COMPREPLY=( $( compgen -W '-h --host -p --port -d --database \
- -m --match -s --strategy -c --config -C \
- --nocorrect -D --dbs -S --strats -H \
- --serverhelp -i --info -I --serverinfo \
- -a --noauth -u --user -k --key -V --version \
- -L --license --help -v --verbose -r --raw \
- -P --pager --debug --html --pipesize --client' \
+ 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" ) )
return 0
fi
- case "$prev" in
- -@(d|-database|i|info))
- COMPREPLY=( $( compgen -W '$( _dictdata -D )' -- "$cur" ) )
- return 0
- ;;
- -@(s|-strategy))
- COMPREPLY=( $( compgen -W '$( _dictdata -S )' -- "$cur" ) )
- return 0
- ;;
- *)
- ;;
+ case $prev in
+ -d|--database|-i|-info)
+ COMPREPLY=( $( compgen -W '$( _dictdata -D )' -- "$cur" ) )
+ return 0
+ ;;
+ -s|--strategy)
+ COMPREPLY=( $( compgen -W '$( _dictdata -S )' -- "$cur" ) )
+ return 0
+ ;;
+ *)
+ ;;
esac
[ -r $dictfile ] && \
COMPREPLY=( $( compgen -W '$( cat $dictfile )' -- "$cur" ) )
}
-complete -F _dict $default dict rdict
+complete -F _dict -o default dict rdict
}
# Local variables:
diff --git a/contrib/dpkg b/contrib/dpkg
index 6437b8af..a70ccef8 100644
--- a/contrib/dpkg
+++ b/contrib/dpkg
@@ -8,11 +8,11 @@ _comp_dpkg_installed_packages()
} || {
_comp_dpkg_installed_packages()
{
- grep -A 1 "Package: $1" /var/lib/dpkg/status | \
- grep -B 1 -Ee "ok installed|half-installed|unpacked| \
+ command grep -A 1 "Package: $1" /var/lib/dpkg/status | \
+ command grep -B 1 -Ee "ok installed|half-installed|unpacked| \
half-configured|config-files" \
-Ee "^Essential: yes" | \
- grep "Package: $1" | cut -d\ -f2
+ command grep "Package: $1" | cut -d\ -f2
}
}
@@ -23,8 +23,7 @@ _dpkg()
local cur prev i
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
i=$COMP_CWORD
_expand || return 0
@@ -39,24 +38,26 @@ _dpkg()
done
fi
- case "$prev" in
- -@(c|i|A|I|f|e|x|X|-@(install|unpack|record-avail|contents|info|fsys-tarfile|field|control|extract)))
+ case $prev in
+ -c|-i|-A|-I|-f|-e|-x|-X|-W|--install|--unpack|--record-avail| \
+ --contents|--info|--fsys-tarfile|--field|--control|--extract| \
+ --show)
_filedir '?(u)deb'
return 0
;;
- -@(b|-build))
+ -b|--build)
_filedir -d
return 0
;;
- -@(s|p|l|-@(status|print-avail|list)))
+ -s|-p|-l|--status|--print-avail|--list)
COMPREPLY=( $( apt-cache pkgnames "$cur" 2>/dev/null ) )
return 0
;;
- -@(S|-search))
+ -S|--search)
_filedir
return 0
;;
- -@(r|L|P|-@(remove|purge|listfiles)))
+ -r|-L|-P|--remove|--purge|--listfiles)
COMPREPLY=( $( _comp_dpkg_installed_packages "$cur" ) )
return 0
;;
@@ -91,7 +92,7 @@ _dpkg()
}
-complete -F _dpkg $filenames dpkg dpkg-deb
+complete -F _dpkg -o filenames dpkg dpkg-deb
}
# Debian GNU dpkg-reconfigure(8) completion
@@ -102,50 +103,48 @@ _dpkg_reconfigure()
local cur prev opt
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
-
- case "$prev" in
- -@(f|-frontend))
- opt=( $( echo /usr/share/perl5/Debconf/FrontEnd/* ) )
+ case $prev in
+ -f|--frontend)
+ opt=( $( printf '%s\n' /usr/share/perl5/Debconf/FrontEnd/* ) )
opt=( ${opt[@]##*/} )
opt=( ${opt[@]%.pm} )
COMPREPLY=( $( compgen -W '${opt[@]}' -- "$cur" ) )
return 0
;;
- -@(p|-priority))
+ -p|--priority)
COMPREPLY=( $( compgen -W 'low medium high critical' -- "$cur" ) )
return 0
;;
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-f --frontend -p --priority -a --all -u \
- --unseen-only -h --help -s --showold --force --terse' -- "$cur" ) )
+ COMPREPLY=( $(compgen -W '--frontend --priority --all --unseen-only \
+ --help --showold --force --terse' -- "$cur" ) )
else
COMPREPLY=( $( _comp_dpkg_installed_packages "$cur" ) )
fi
} &&
-complete -F _dpkg_reconfigure $default 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
+ local cur prev options work i action packopts unpackopts fields
- packopts="-c -l -F -V -T -D -U -W -E -sa -i -I -sk -sp -su -sr -ss -sn -sA -sK -sP -sU -sR"
+ 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=`echo "-x -b $packopts $unpackopts" | xargs echo | sort -u | xargs echo`
+ options="-x -b $packopts $unpackopts"
+ fields="Format Source Version Binary Maintainer Uploader Architecture \
+ Standards-Version Build-Depends Files"
COMPREPLY=()
- if [ "$1" != "dpkg-source" ]; then
- return 1
- fi
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
+
action="options"
for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
if [[ ${COMP_WORDS[$i]} == "-x" ]]; then
@@ -156,103 +155,80 @@ _dpkg_source()
action=help
fi
done
- # if currently seeing a complete option, return just itself.
- for i in $options; do
- if [ "$cur" = "$i" ]; then
- COMPREPLY=( "$cur" )
- return 0
- fi
- done
- case "$action" in
- "unpack")
- if [ "$cur" = "-" -o "$cur" = "-s" ]; then
- COMPREPLY=( $unpackopts )
- return 0
- fi
- case "$prev" in
- "-x")
- COMPREPLY=( $( compgen -d -- "$cur" ) \
- $( compgen -f -X '!*.dsc' -- "$cur" ) )
+
+ case $action in
+ unpack)
+ case $prev in
+ -x)
+ _filedir -d
+ _filedir 'dsc'
return 0
;;
*)
- COMPREPLY=( $unpackopts $(compgen -d -f -- "$cur" ) )
+ COMPREPLY=( $( compgen -W "$unpackopts" -- "$cur" ) )
+ _filedir -d
+ _filedir
return 0
;;
esac
return 0
;;
- "pack")
- if [ "$cur" = "-" ]; then
- COMPREPLY=( $packopts )
- return 0
- fi
- if [ "$cur" = "-s" ]; then
- COMPREPLY=( "-sa" "-sk" "-sp" "-su" "-sr" "-ss" "-sn" \
- "-sA" "-sK" "-sP" "-sU" "-sR" )
- return 0
- fi
- case "$prev" in
- "-b")
- COMPREPLY=( $( compgen -d -- "$cur" ) )
+ pack)
+ case $prev in
+ -b)
+ _filedir -d
return 0
;;
- "-c"|"-l"|"-T"|"-i"|"-I")
+ -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
- COMPREPLY=( $( compgen -d -f ) )
+ _filedir -d
+ _filedir
return 0
;;
- "-F")
+ -F)
# -F: force change log format
- COMPREPLY=( $( ( cd /usr/lib/dpkg/parsechangelog; compgen -f "$cur" ) ) )
+ COMPREPLY=( $( command ls /usr/lib/dpkg/parsechangelog ) )
return 0
;;
- "-V"|"-D")
+ -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)
# -D: override or add a .dsc field and value
# if $cur doesn't contain a = yet, suggest variable names
- if echo -- "$cur" | grep -q "="; then
+ if [[ "$cur" == *=* ]]; then
# $cur contains a "="
COMPREPLY=()
return 0
else
- COMPREPLY=( Format Source Version Binary Maintainer Uploader Architecture Standards-Version Build-Depends Files )
+ COMPREPLY=( $( compgen -W "$fields" -- "$cur" ) )
return 0
fi
;;
- "-U")
+ -U)
# -U: remove a field
# Suggest possible fieldnames
- COMPREPLY=( Format Source Version Binary Maintainer Uploader Architecture Standards-Version Build-Depends Files )
+ COMPREPLY=( $( compgen -W "$fields" -- "$cur" ) )
return 0
;;
*)
- COMPREPLY=( $packopts )
+ COMPREPLY=( $( compgen -W "$packopts $unpackopts" -- "$cur" ) )
return 0
;;
esac
return 0
;;
*)
- # if seeing a partial option, return possible completions.
- if [ "$cur" = "-s" ]; then
- COMPREPLY=( "-sa" "-sk" "-sp" "-su" "-sr" "-ss" "-sn" \
- "-sA" "-sK" "-sP" "-sU" "-sR" )
- return 0
- fi
- # else return all possible options.
- COMPREPLY=( $options )
+ COMPREPLY=( $( compgen -W "$options" -- "$cur" ) )
return 0
;;
esac
diff --git a/contrib/dselect b/contrib/dselect
index 31ad2de8..8bea891a 100644
--- a/contrib/dselect
+++ b/contrib/dselect
@@ -6,15 +6,14 @@ _dselect()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
- case "$prev" in
+ case $prev in
--admindir)
_filedir -d
return 0
;;
- -@(D|debug))
+ -D|-debug)
_filedir
return 0
;;
@@ -31,7 +30,7 @@ _dselect()
return 0
} &&
-complete -F _dselect $filenames dselect
+complete -F _dselect -o filenames dselect
# Local variables:
# mode: shell-script
diff --git a/contrib/dsniff b/contrib/dsniff
index 901fa8e2..1d3b303b 100644
--- a/contrib/dsniff
+++ b/contrib/dsniff
@@ -1,19 +1,16 @@
-# dsniff util completion by Guillaume Rousse <rousse@ccr.jussieu.fr>
+# dsniff util completion
-# arpspoof(8) completion
-#
have arpspoof &&
_arpspoof()
{
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
- case "$prev" in
+ case $prev in
-i)
- _interfaces
+ _available_interfaces
return 0
;;
-t)
@@ -31,18 +28,15 @@ _arpspoof()
} &&
complete -F _arpspoof arpspoof
-# dnsspoof(8) completion
-#
have dnsspoof &&
_dnsspoof()
{
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
- case "$prev" in
+ case $prev in
-i)
_interfaces
return 0
@@ -60,19 +54,16 @@ _dnsspoof()
} &&
complete -F _dnsspoof dnsspoof
-# dsniff(8) completion
-#
have dsniff &&
_dsniff()
{
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
- case "$prev" in
- -@(r|w|f))
+ case $prev in
+ -r|-w|-f)
_filedir
return 0
;;
@@ -89,18 +80,15 @@ _dsniff()
} &&
complete -F _dsniff dsniff
-# filesnarf(8), mailsnarf(8) and msgsnarf (8) completion
-#
have filesnarf || have mailsnarf || have msgsnarf &&
_snarf()
{
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
- case "$prev" in
+ case $prev in
-i)
_interfaces
return 0
@@ -114,18 +102,15 @@ _snarf()
} &&
complete -F _snarf filesnarf mailsnarf msgsnarf
-# macof(8) completion
-#
have macof &&
_macof()
{
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
- case "$prev" in
+ case $prev in
-i)
_interfaces
return 0
@@ -140,15 +125,13 @@ _macof()
} &&
complete -F _macof macof
-# sshmitm(8) completion
-#
have sshmitm &&
_sshmitm()
{
local cur
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-d -I -p' -- "$cur" ) )
@@ -159,18 +142,15 @@ _sshmitm()
} &&
complete -F _sshmitm sshmitm
-# sshow(8) completion
-#
have sshow &&
_sshow()
{
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
- case "$prev" in
+ case $prev in
-i)
_interfaces
return 0
@@ -184,18 +164,15 @@ _sshow()
} &&
complete -F _sshow sshow
-# tcpkill(8) completion
-#
have tcpkill &&
_tcpkill()
{
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
- case "$prev" in
+ case $prev in
-i)
_interfaces
return 0
@@ -209,18 +186,15 @@ _tcpkill()
} &&
complete -F _tcpkill tcpkill
-# tcpnice(8) completion
-#
have tcpnice &&
_tcpnice()
{
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
- case "$prev" in
+ case $prev in
-i)
_interfaces
return 0
@@ -234,18 +208,15 @@ _tcpnice()
} &&
complete -F _tcpnice tcpnice
-# urlsnarf(8) completion
-#
have urlsnarf &&
_urlsnarf()
{
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
- case "$prev" in
+ case $prev in
-i)
_interfaces
return 0
@@ -259,15 +230,13 @@ _urlsnarf()
} &&
complete -F _urlsnarf urlsnarf
-# webmitm(8) completion
-#
have webmitm &&
_webmitm()
{
local cur
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-d' -- "$cur" ) )
diff --git a/contrib/findutils b/contrib/findutils
index d77c892d..6af5d50b 100644
--- a/contrib/findutils
+++ b/contrib/findutils
@@ -8,94 +8,100 @@ _find()
local cur prev i exprfound onlyonce
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
- case "$prev" in
- -@(max|min)depth)
- COMPREPLY=( $( compgen -W '0 1 2 3 4 5 6 7 8 9' -- "$cur" ) )
- return 0
- ;;
- -?(a|c)newer|-fls|-fprint?(0|f)|-?(i)?(l)name|-?(i)wholename)
- _filedir
- return 0
- ;;
- -fstype)
- # this is highly non-portable
- [ -e /proc/filesystems ] &&
- COMPREPLY=( $( compgen -W "$( cut -d$'\t' -f2 /proc/filesystems )" \
- -- "$cur" ) )
- return 0
- ;;
- -gid)
- _gids
- return 0
- ;;
- -group)
- if [ -n "$bash205" ]; then
- COMPREPLY=( $( compgen -g -- $cur 2>/dev/null) )
- fi
- return 0
- ;;
- -?(x)type)
- COMPREPLY=( $( compgen -W 'b c d p f l s' -- "$cur" ) )
- return 0
- ;;
- -uid)
- _uids
- return 0
- ;;
- -user)
- COMPREPLY=( $( compgen -u -- "$cur" ) )
- return 0
- ;;
- -exec|-ok)
- COMP_WORDS=(COMP_WORDS[0] "$cur")
- COMP_CWORD=1
- _command
- return 0
- ;;
- -[acm]min|-[acm]time|-?(i)?(l)?(whole)name|-inum|-?(i)path|-?(i)regex| \
- -links|-perm|-size|-used|-printf)
- # do nothing, just wait for a parameter to be given
- return 0
- ;;
+ case $prev in
+ -maxdepth|-mindepth)
+ COMPREPLY=( $( compgen -W '0 1 2 3 4 5 6 7 8 9' -- "$cur" ) )
+ return 0
+ ;;
+ -newer|-anewer|-cnewer|-fls|-fprint|-fprint0|-fprintf|-name|-iname|\
+ -lname|-ilname|-wholename|-iwholename|-samefile)
+ _filedir
+ return 0
+ ;;
+ -fstype)
+ _fstypes
+ if [[ "$( uname -s )" == *BSD ]] ; then
+ COMPREPLY=( "${COMPREPLY[@]}" \
+ $( compgen -W 'local rdonly' -- "$cur" ) )
+ fi
+ return 0
+ ;;
+ -gid)
+ _gids
+ return 0
+ ;;
+ -group)
+ COMPREPLY=( $( compgen -g -- "$cur" 2>/dev/null) )
+ return 0
+ ;;
+ -xtype|-type)
+ COMPREPLY=( $( compgen -W 'b c d p f l s' -- "$cur" ) )
+ return 0
+ ;;
+ -uid)
+ _uids
+ return 0
+ ;;
+ -user)
+ COMPREPLY=( $( compgen -u -- "$cur" ) )
+ return 0
+ ;;
+ -exec|-execdir|-ok|-okdir)
+ COMP_WORDS=(COMP_WORDS[0] "$cur")
+ COMP_CWORD=1
+ _command
+ return 0
+ ;;
+ -[acm]min|-[acm]time|-iname|-lname|-wholename|-iwholename|-lwholename|\
+ -ilwholename|-inum|-path|-ipath|-regex|-iregex|-links|-perm|-size|\
+ -used|-printf|-context)
+ # do nothing, just wait for a parameter to be given
+ return 0
+ ;;
+ -regextype)
+ COMPREPLY=( $( compgen -W 'emacs posix-awk posix-basic \
+ posix-egrep posix-extended' -- "$cur" ) )
+ return 0
+ ;;
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
done
# handle case where first parameter is not a dash option
- if [ "$exprfound" != 1 ] && [[ "$cur" != [-\(\),\!]* ]]; then
+ if [[ "$exprfound" != 1 && "$cur" != [-\(\),\!]* ]]; then
_filedir -d
return 0
fi
# complete using basic options
- COMPREPLY=( $( compgen -W '-daystart -depth -follow -help -maxdepth \
- -mindepth -mount -noleaf -version -xdev -amin -anewer \
- -atime -cmin -cnewer -ctime -empty -false -fstype \
- -gid -group -ilname -iname -inum -ipath -iregex \
- -wholename \
- -links -lname -mmin -mtime -name -newer -nouser \
- -nogroup -perm -regex -size -true -type -uid -used \
- -user -xtype -exec -fls -fprint -fprint0 -fprintf -ok \
- -print -print0 -printf -prune -ls -wholename -iwholename' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '-daystart -depth -follow -help \
+ -ignore_readdir_race -maxdepth -mindepth -mindepth -mount \
+ -noignore_readdir_race -noleaf -regextype -version -warn -nowarn \
+ -xdev \
+ -amin -anewer -atime -cmin -cnewer -ctime -empty -executable -false \
+ -fstype -gid -group -ilname -iname -inum -ipath -iregex -iwholename \
+ -links -lname -mmin -mtime -name -newer -nogroup -nouser -path -perm \
+ -readable -regex -samefile -size -true -type -uid -used -user \
+ -wholename -writable -xtype -context \
+ -delete -exec -execdir -fls -fprint -fprint0 -fprintf -ls -ok -okdir \
+ -print -print0 -printf -prune -quit' -- "$cur" ) )
# 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 -maxdepth -mindepth -mount \
- -noleaf -version -xdev '
- COMPREPLY=( $( echo "${COMP_WORDS[@]}" | \
+ 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
- [ "$i" == "" ] ||
- [ "${onlyonce/ ${i%% *} / }" == "$onlyonce" ] &&
+ [[ -z "$i" || "${onlyonce/ ${i%% *} / }" == "$onlyonce" ]] &&
continue
# flatten array with spaces on either side,
# otherwise we cannot grep on word boundaries of
@@ -104,14 +110,14 @@ _find()
# remove word from list of completions
COMPREPLY=( ${COMPREPLY/ ${i%% *} / } )
done
- echo "${COMPREPLY[@]}")
+ printf '%s ' "${COMPREPLY[@]}") <<<"${COMP_WORDS[@]}"
) )
_filedir
return 0
} &&
-complete -F _find $filenames find
+complete -F _find -o filenames find
# Local variables:
# mode: shell-script
diff --git a/contrib/freeciv b/contrib/freeciv
index 202596d0..602ad76a 100644
--- a/contrib/freeciv
+++ b/contrib/freeciv
@@ -1,4 +1,4 @@
-# civserver completion by Guillaume Rousse <rousse@ccr.jussieu.fr>
+# freeciv completions
have civserver &&
_civserver()
@@ -6,11 +6,10 @@ _civserver()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
- case "$prev" in
- -@(f|g|l|r|-file|-log|-gamelog|-read))
+ case $prev in
+ -f|-g|-l|-r|--file|--log|--gamelog|--read)
_filedir
return 0
;;
@@ -25,27 +24,24 @@ _civserver()
} &&
complete -F _civserver civserver
-# civclient completion by Guillaume Rousse <rousse@ccr.jussieu.fr>
-#
have civclient &&
_civclient()
{
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
- case "$prev" in
- -@(l|S|t|-log|-Sound|-tiles))
+ case $prev in
+ -l|-S|-t|--log|--Sound|--tiles)
_filedir
return 0
;;
- -@(P|-Plugin))
+ -P|--Plugin)
COMPREPLY=( $( compgen -W 'none esd sdl' -- "$cur" ) )
return 0
;;
- -@(s|-server))
+ -s|--server)
_known_hosts_real "$cur"
return 0
;;
diff --git a/contrib/fuse b/contrib/fuse
new file mode 100644
index 00000000..b4d80a28
--- /dev/null
+++ b/contrib/fuse
@@ -0,0 +1,36 @@
+# bash completion for fuse
+
+have fusermount &&
+_fusermount()
+{
+ COMPREPLY=()
+ local cur prev
+ _get_comp_words_by_ref cur prev
+
+ case $prev in
+ -h|-V|-o)
+ return 0
+ ;;
+ -u)
+ COMPREPLY=( $( compgen -W "$( awk \
+ '{ if ($3 ~ /^fuse\./) print $2 }' /etc/mtab 2>/dev/null )" \
+ -- "$cur" ) )
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]] ; then
+ COMPREPLY=( $( compgen -W '-h -V -o -u -q -z' -- "$cur" ) )
+ else
+ _filedir -d
+ fi
+} &&
+complete -F _fusermount -o filenames 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/contrib/gcc b/contrib/gcc
index a4f80952..3f5a5619 100644
--- a/contrib/gcc
+++ b/contrib/gcc
@@ -14,11 +14,11 @@ _gcc()
local cur cc backend
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
_expand || return 0
- case "$1" in
+ case $1 in
gcj)
backend=jc1
;;
@@ -46,9 +46,9 @@ _gcc()
_filedir
fi
} &&
-complete $filenames -F _gcc gcc g++ c++ g77 gcj gpc
+complete -o filenames -F _gcc gcc g++ c++ g77 gcj gpc
[ $USERLAND = GNU -o $UNAME = Cygwin ] && \
-[ -n "${have:-}" ] && complete $filenames -F _gcc cc
+[ -n "${have:-}" ] && complete -o filenames -F _gcc cc
# Local variables:
# mode: shell-script
diff --git a/contrib/gcl b/contrib/gcl
index ce6923fc..e0931536 100644
--- a/contrib/gcl
+++ b/contrib/gcl
@@ -7,7 +7,7 @@ _gcl()
local cur
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
# completing an option (may or may not be separated by a space)
if [[ "$cur" == -* ]]; then
@@ -19,7 +19,7 @@ _gcl()
return 0
} &&
-complete -F _gcl $default gcl
+complete -F _gcl -o default gcl
# Local variables:
# mode: shell-script
diff --git a/contrib/gdb b/contrib/gdb
index 7ea304e1..dc769613 100644
--- a/contrib/gdb
+++ b/contrib/gdb
@@ -6,8 +6,7 @@ _gdb()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
if [ $COMP_CWORD -eq 1 ]; then
local IFS
@@ -20,7 +19,8 @@ _gdb()
# functions and aliases. Thus we need to retrieve the program
# names manually.
IFS=":"
- local path_array=( $(echo "$PATH" | sed 's/::\+/:/g;s/^:\|:$//g') )
+ local path_array=( $( \
+ sed -e 's/:\{2,\}/:/g' -e 's/^://' -e 's/:$//' <<<"$PATH" ) )
IFS=$'\n'
COMPREPLY=( $( compgen -d -W '$(find "${path_array[@]}" . \
-mindepth 1 -maxdepth 1 -not -type d -executable \
@@ -32,7 +32,7 @@ _gdb()
awk '{if ($1 ~ /^'"$prev"'/) print $2}' )" -- "$cur" ) )
fi
} &&
-complete -F _gdb $default gdb
+complete -F _gdb -o default gdb
# Local variables:
# mode: shell-script
diff --git a/contrib/genisoimage b/contrib/genisoimage
index 7f3abfe6..7f379041 100644
--- a/contrib/genisoimage
+++ b/contrib/genisoimage
@@ -6,11 +6,11 @@ _mkisofs()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
- case "$prev" in
- -@(o|abstract|biblio|check-session|copyright|log-file|root-info|prep-boot|*-list))
+ case $prev in
+ -o|-abstract|-biblio|-check-session|-copyright|-log-file| \
+ -root-info|-prep-boot|-*-list)
_filedir
return 0
;;
@@ -30,30 +30,28 @@ _mkisofs()
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-abstract -A -allow-lowercase \
- -allow-multidot -biblio -cache-inodes \
- -no-cache-inodes -b -eltorito-alt-boot -B -G \
- -hard-disk-boot -no-emul-boot -no-boot \
- -boot-load-seg -boot-load-size \
- -boot-info-table -C -c -check-oldname \
- -check-session -copyright -d -D -dir-mode \
- -dvd-video -f -file-mode -gid -gui \
- -graft-points -hide -hide-list -hidden \
- -hidden-list -hide-joliet -hide-joliet-list \
- -hide-joliet-trans-tbl -hide-rr-moved \
- -input-charset -output-charset -iso-level -J \
- -joliet-long -jcharset -l -L -log-file -m \
- -exclude-list -max-iso9660-filenames -M -N \
- -new-dir-mode -nobak -no-bak -force-rr -no-rr \
- -no-split-symlink-components \
- -no-split-symlink-fields -o -pad -no-pad \
- -path-list -P -p -print-size -quiet -R -r \
- -relaxed-filenames -sort -split-output \
- -stream-media-size -stream-file-name -sysid -T\
- -table-name -ucs-level -udf -uid \
- -use-fileversion -U -no-iso-translate -V \
- -volset -volset-size -volset-seqno -v -x -z \
- -hfs -apple -map -magic -hfs-creator \
+ COMPREPLY=( $( compgen -W '-abstract -appid -allow-lowercase \
+ -allow-multidot -biblio -cache-inodes -no-cache-inodes \
+ -eltorito-boot -eltorito-alt-boot -sparc-boot -generic-boot \
+ -hard-disk-boot -no-emul-boot -no-boot -boot-load-seg \
+ -boot-load-size -boot-info-table -cdrecord-params \
+ -eltorito-catalog -check-oldname -check-session -copyright \
+ -omit-period -disable-deep-relocation -dir-mode -dvd-video \
+ -follow-links -file-mode -gid -gui -graft-points -hide -hide-list \
+ -hidden -hidden-list -hide-joliet -hide-joliet-list \
+ -hide-joliet-trans-tbl -hide-rr-moved -input-charset \
+ -output-charset -iso-level -joliet -joliet-long -jcharset \
+ -full-iso9660-filenames -allow-leading-dots -log-file -exclude \
+ -exclude-list -max-iso9660-filenames -prev-session \
+ -omit-version-number -new-dir-mode -nobak -no-bak -force-rr -no-rr \
+ -no-split-symlink-components -no-split-symlink-fields -output -pad \
+ -no-pad -path-list -publisher -preparer -print-size -quiet -rock
+ -rational-rock -relaxed-filenames -sort -split-output \
+ -stream-media-size -stream-file-name -sysid -translation-table \
+ -table-name -ucs-level -udf -uid -use-fileversion \
+ -untranslated-filenames -no-iso-translate -volid -volset \
+ -volset-size -volset-seqno -verbose -old-exclude \
+ -transparent-compression -hfs -apple -map -magic -hfs-creator \
-hfs-type -probe -no-desktop -mac-name \
-boot-hfs-file -part -auto -cluster-size \
-hide-hfs -hide-hfs-list -hfs-volid \
@@ -68,7 +66,7 @@ _mkisofs()
fi
} &&
-complete -F _mkisofs $filenames mkisofs genisoimage
+complete -F _mkisofs -o filenames mkisofs genisoimage
# Local variables:
# mode: shell-script
diff --git a/contrib/getent b/contrib/getent
index ec49e2e7..54e62ab8 100644
--- a/contrib/getent
+++ b/contrib/getent
@@ -6,8 +6,7 @@ _getent()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
case $prev in
passwd)
@@ -27,13 +26,13 @@ _getent()
return 0
;;
protocols|networks|ahosts|ahostsv4|ahostsv6|rpc)
- COMPREPLY=( $( getent "$prev" | \
- sed -ne 's|^\('"$cur"'[^[:space:]]*\).*|\1|p' ) )
+ COMPREPLY=( $( compgen -W "$( getent "$prev" | \
+ awk '{ print $1 }' )" -- "$cur" ) )
return 0
;;
aliases|shadow)
- COMPREPLY=( $( getent "$prev" | \
- sed -ne 's|^\('"$cur"'[^:]*\).*|\1|p' ) )
+ COMPREPLY=( $( compgen -W "$( getent "$prev" | cut -d: -f1 )" \
+ -- "$cur" ) )
return 0
;;
esac
diff --git a/contrib/gkrellm b/contrib/gkrellm
index 64144102..1e3925f1 100644
--- a/contrib/gkrellm
+++ b/contrib/gkrellm
@@ -1,4 +1,4 @@
-# gkrellm(1) completion by Guillaume Rousse <rousse@ccr.jussieu.fr>
+# gkrellm(1) completion
have gkrellm || have gkrellm2 &&
_gkrellm()
@@ -6,32 +6,44 @@ _gkrellm()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
- case "$prev" in
- -@(t|-theme))
+ case $prev in
+ -t|--theme)
_filedir -d
return 0
;;
- -@(p|-plugin))
- _filedir 'so'
+ -p|--plugin)
+ _filedir so
return 0
;;
- -@(s|-server))
+ -s|--server)
_known_hosts_real "$cur"
return 0
;;
+ -l|--logfile)
+ _filedir
+ return 0
+ ;;
+ -g|--geometry|-c|--config|-P|--port|-d|--debug-level)
+ # Argument required but no completions available
+ return 0
+ ;;
+ -h|--help|-v|--version)
+ # All other options are noop with these
+ return 0
+ ;;
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--help -t --theme -s --server \
- -g --geometry -wm -w --withdrawn -c --config -nc \
- -f --force-host-config -demo -p --plugin -P --port' -- "$cur" ) )
+ 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" ) )
fi
} &&
-complete -F _gkrellm gkrellm gkrellm2
+complete -F _gkrellm -o filenames gkrellm gkrellm2
# Local variables:
# mode: shell-script
diff --git a/contrib/gnatmake b/contrib/gnatmake
index 3b66aa31..11b04908 100644
--- a/contrib/gnatmake
+++ b/contrib/gnatmake
@@ -6,7 +6,7 @@ _gnatmake()
local cur
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then
# relevant (and less relevant ;-) )options completion
@@ -26,7 +26,7 @@ _gnatmake()
_filedir '@(adb|ads)'
fi
} &&
-complete -F _gnatmake $filenames gnatmake
+complete -F _gnatmake -o filenames gnatmake
# Local variables:
# mode: shell-script
diff --git a/contrib/gpg b/contrib/gpg
index a0dea7d1..878a800b 100644
--- a/contrib/gpg
+++ b/contrib/gpg
@@ -6,21 +6,21 @@ _gpg()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
- case "$prev" in
- -@(s|-sign|-clearsign|-decrypt-files|-load-extension))
+ case $prev in
+ -s|--sign|--clearsign|--decrypt-files|--load-extension)
_filedir
return 0
;;
- --@(export|@(?(l|nr|nrl)sign|edit)-key))
+ --export|--sign-key|--lsignkey|--nrsignkey|--nrlsignkey|--editkey)
# return list of public keys
COMPREPLY=( $( compgen -W "$( gpg --list-keys 2>/dev/null | \
- sed -ne 's@^pub.*/\([^ ]*\).*$@\1@p;s@^.*\(<\([^>]*\)>\).*$@\2@p')" -- "$cur" ))
+ sed -ne 's@^pub.*/\([^ ]*\).*$@\1@p' \
+ -ne 's@^.*\(<\([^>]*\)>\).*$@\2@p' )" -- "$cur" ) )
return 0
;;
- -@(r|-recipient))
+ -r|--recipient)
COMPREPLY=( $( compgen -W "$( gpg --list-keys 2>/dev/null | \
sed -ne 's@^.*<\([^>]*\)>.*$@\1@p')" -- "$cur" ))
if [ -e ~/.gnupg/gpg.conf ]; then
@@ -33,12 +33,11 @@ _gpg()
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-s -b -e -f -c -d -a -r -u -Z -o -v\
- -q -n -N $(gpg --dump-options)' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$(gpg --dump-options)' -- "$cur" ) )
fi
} &&
-complete -F _gpg $default gpg
+complete -F _gpg -o default gpg
# Local variables:
# mode: shell-script
diff --git a/contrib/gpg2 b/contrib/gpg2
index 56e3c6eb..b99783f9 100644
--- a/contrib/gpg2
+++ b/contrib/gpg2
@@ -6,25 +6,25 @@ _gpg2 ()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
- case "$prev" in
+ case $prev in
--homedir)
_filedir -d
return 0
;;
- -@(s|-sign|-clearsign|-options|-decrypt))
+ -s|--sign|--clearsign|--options|--decrypt)
_filedir
return 0
;;
- --@(export|@(?(l|nr|nrl)sign|edit)-key))
+ --export|--sign-key|--lsign-key|--nrsign-key|--nrlsign-key|--edit-key)
# return list of public keys
COMPREPLY=( $( compgen -W "$( gpg2 --list-keys 2>/dev/null | \
- sed -ne 's@^pub.*/\([^ ]*\).*$@\1@p;s@^.*\(<\([^>]*\)>\).*$@\2@p')" -- "$cur" ))
+ sed -ne 's@^pub.*/\([^ ]*\).*$@\1@p' \
+ -ne 's@^.*\(<\([^>]*\)>\).*$@\2@p' )" -- "$cur" ) )
return 0
;;
- -@(r|-recipient))
+ -r|--recipient)
COMPREPLY=( $( compgen -W "$( gpg2 --list-keys 2>/dev/null | \
sed -ne 's@^.*<\([^>]*\)>.*$@\1@p')" -- "$cur" ))
if [ -e ~/.gnupg/gpg.conf ]; then
@@ -37,11 +37,10 @@ _gpg2 ()
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-s -b -e -c -d -k -K -a -r -u -z -o -v \
- -n -N -i -h -R -t $(gpg2 --dump-options)' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$(gpg2 --dump-options)' -- "$cur" ) )
fi
} &&
-complete -F _gpg2 $default gpg2
+complete -F _gpg2 -o default gpg2
}
# Local variables:
diff --git a/contrib/gzip b/contrib/gzip
index 0bfd748a..0951f72f 100644
--- a/contrib/gzip
+++ b/contrib/gzip
@@ -1,23 +1,29 @@
# bash completion for gzip
-have gzip &&
+have gzip || have pigz &&
_gzip()
{
local cur prev xspec helpopts
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
- helpopts=`_parse_help gzip`
+ _get_comp_words_by_ref cur prev
+ helpopts=`_parse_help ${COMP_WORDS[0]}`
+
+ case $prev in
+ -b|--blocksize|-p|--processes|-S|--suffix|-h|--help|-V|--version)
+ return 0
+ ;;
+ esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W "$helpopts -2 -3 -4 -5 -6 -7 -8" -- "$cur" ) )
+ COMPREPLY=( $( compgen -W "$helpopts -1 -2 -3 -4 -5 -6 -7 -8 -9" \
+ -- "$cur" ) )
return 0
fi
local IFS=$'\t\n'
- xspec="*.?(t)gz"
+ xspec="*.@(gz|t[ag]z)"
if [[ "$prev" == --* ]]; then
[[ "$prev" == --decompress || \
"$prev" == --list || \
@@ -26,7 +32,7 @@ _gzip()
elif [[ "$prev" == -* ]]; then
[[ "$prev" == -*[dlt]* ]] && xspec="!"$xspec
[[ "$prev" == -*f* ]] && xspec=
- elif [ "$prev" = '>' -o "$prev" = '>>' ]; then
+ elif [[ "$prev" == '>' || "$prev" == '>>' ]]; then
xspec=
elif [ "$prev" = '<' ]; then
xspec=
@@ -37,7 +43,7 @@ _gzip()
COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \
$( compgen -d -- "$cur" ) )
} &&
-complete -F _gzip $filenames gzip
+complete -F _gzip -o filenames gzip pigz
# Local variables:
# mode: shell-script
diff --git a/contrib/heimdal b/contrib/heimdal
index 6d79d142..c1efb110 100644
--- a/contrib/heimdal
+++ b/contrib/heimdal
@@ -12,7 +12,7 @@ _heimdal_realms()
{
COMPREPLY=( $( compgen -W "( kadmin -l dump 2>/dev/null | \
- awk '{print $1}' | awk -F @ '{print $2}' )" -- "$cur" ) )
+ awk '{print $1}' | awk -F@ '{print $2}' )" -- "$cur" ) )
}
_heimdal_encodings()
@@ -28,8 +28,7 @@ _ktutil()
local cur prev command options split=false
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
_split_longopt && split=true
@@ -50,7 +49,7 @@ _ktutil()
_heimdal_realms
return 0
;;
- -@(s|k|-@(srv|key)tab))
+ -s|-k|--srvtab|--keytab)
_filedir
return 0
;;
@@ -63,7 +62,7 @@ _ktutil()
for (( i=1; i < COMP_CWORD; i++ )); do
case ${COMP_WORDS[i]} in
- -@(k|-keytab))
+ -k|--keytab)
i=$(($i+1))
;;
-*)
@@ -97,7 +96,7 @@ _ktutil()
purge)
options='--age'
;;
- @(srv2keytab|key2srvtab))
+ srv2keytab|key2srvtab)
options='-s --srvtab'
;;
*)
diff --git a/contrib/hping2 b/contrib/hping2
new file mode 100644
index 00000000..b1607f83
--- /dev/null
+++ b/contrib/hping2
@@ -0,0 +1,55 @@
+# bash completion for hping2
+
+have hping2 &&
+_hping2()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=`_get_pword`
+
+ case $prev in
+ -I|--interface)
+ _available_interfaces
+ return 0
+ ;;
+ -a|--spoof)
+ _known_hosts_real "$cur"
+ return 0
+ ;;
+ -o|--tos)
+ COMPREPLY=( $( compgen -W '02 04 08 10' ) )
+ return 0
+ ;;
+ -E|--file)
+ _filedir
+ return 0
+ ;;
+ 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" ) )
+ else
+ _known_hosts_real "$cur"
+ fi
+} &&
+complete -F _hping2 hping2 hping
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/iconv b/contrib/iconv
index cf497e99..14b618dc 100644
--- a/contrib/iconv
+++ b/contrib/iconv
@@ -3,28 +3,41 @@
have iconv &&
_iconv()
{
- local cur prev
+ local cur prev split=false
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
- case "$prev" in
- -@(f|t|-@(from|to)-code))
- COMPREPLY=( $( compgen -W \
- '$( iconv --list | sed -e "s@//@@;" )' -- "$cur" ) )
+ _split_longopt && split=true
+
+ case $prev in
+ -'?'|--help|--usage|-V|--version|--unicode-subst|--byte-subst|\
+ --widechar-subst)
+ return 0
+ ;;
+ -f|--from-code|-t|--to-code)
+ COMPREPLY=( $( compgen -W '$( iconv -l | \
+ sed -e "s@/*\$@@" -e "s/[,()]//g" )' -- "$cur" ) )
+ return 0
+ ;;
+ -o|--output)
+ _filedir
return 0
;;
esac
+ $split && return 0
if [[ "$cur" = -* ]]; then
- COMPREPLY=( $( compgen -W '--from-code -f --to-code -t --list
- --output -o --verbose' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '--from-code --to-code --list -c
+ --unicode-subst --byte-subst --widechar-subst --output --silent
+ --verbose --help --usage --version' -- "$cur" ) )
return 0
fi
} &&
-complete -F _iconv $default iconv
+complete -F _iconv -o default iconv
+# Intentionally not -o filenames here, -f/-t completions may contain slashes
+# and -o filenames would break them.
# Local variables:
# mode: shell-script
diff --git a/contrib/ifupdown b/contrib/ifupdown
new file mode 100644
index 00000000..f81e08d5
--- /dev/null
+++ b/contrib/ifupdown
@@ -0,0 +1,27 @@
+# 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/contrib/imagemagick b/contrib/imagemagick
index ed2d01e0..5366e619 100644
--- a/contrib/imagemagick
+++ b/contrib/imagemagick
@@ -3,10 +3,10 @@
have convert && {
_ImageMagick()
{
- local prev
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ local cur prev
+ _get_comp_words_by_ref cur prev
- case "$prev" in
+ case $prev in
-channel)
COMPREPLY=( $( compgen -W 'Red Green Blue Opacity \
Matte Cyan Magenta Yellow Black' -- "$cur" ) )
@@ -103,7 +103,7 @@ _ImageMagick()
Wave OilPaint CharcoalDrawing JPEG' -- "$cur" ) )
return 0
;;
- -@(mask|profile|texture|tile|write))
+ -mask|-profile|-texture|-tile|-write)
_filedir
return 0
;;
@@ -135,7 +135,7 @@ _convert()
local cur
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
_ImageMagick
@@ -189,14 +189,14 @@ _convert()
_filedir
fi
}
-complete -F _convert $filenames convert
+complete -F _convert -o filenames convert
_mogrify()
{
local cur
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
_ImageMagick
@@ -245,14 +245,14 @@ _mogrify()
_filedir
fi
}
-complete -F _mogrify $filenames mogrify
+complete -F _mogrify -o filenames mogrify
_display()
{
local cur
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
_ImageMagick
@@ -285,14 +285,14 @@ _display()
_filedir
fi
}
-complete -F _display $filenames display
+complete -F _display -o filenames display
_animate()
{
local cur
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
_ImageMagick
@@ -319,14 +319,14 @@ _animate()
_filedir
fi
}
-complete -F _animate $filenames animate
+complete -F _animate -o filenames animate
_identify()
{
local cur
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
_ImageMagick
@@ -344,14 +344,14 @@ _identify()
_filedir
fi
}
-complete -F _identify $filenames identify
+complete -F _identify -o filenames identify
_montage()
{
local cur
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
_ImageMagick
@@ -382,14 +382,14 @@ _montage()
_filedir
fi
}
-complete -F _montage $filenames montage
+complete -F _montage -o filenames montage
_composite()
{
local cur
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
_ImageMagick
@@ -417,14 +417,14 @@ _composite()
_filedir
fi
}
-complete -F _composite $filenames composite
+complete -F _composite -o filenames composite
_compare()
{
local cur
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
_ImageMagick
@@ -444,14 +444,14 @@ _compare()
_filedir
fi
}
-complete -F _compare $filenames compare
+complete -F _compare -o filenames compare
_conjure()
{
local cur
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
_ImageMagick
@@ -464,14 +464,14 @@ _conjure()
_filedir
fi
}
-complete -F _conjure $filenames conjure
+complete -F _conjure -o filenames conjure
_import()
{
local cur
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
_ImageMagick
@@ -495,14 +495,14 @@ _import()
_filedir
fi
}
-complete -F _import $filenames import
+complete -F _import -o filenames import
_stream()
{
local cur
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
_ImageMagick
@@ -520,7 +520,7 @@ _stream()
_filedir
fi
}
-complete -F _stream $filenames stream
+complete -F _stream -o filenames stream
}
# Local variables:
diff --git a/contrib/info b/contrib/info
index 5d491453..55791d31 100644
--- a/contrib/info
+++ b/contrib/info
@@ -6,7 +6,7 @@ _info()
local cur i infopath
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
_expand || return 0
@@ -47,7 +47,7 @@ _info()
return 0
} &&
-complete -F _info $filenames info
+complete -F _info -o filenames info
# Local variables:
# mode: shell-script
diff --git a/contrib/ipmitool b/contrib/ipmitool
index 3862491c..fc4ec71c 100644
--- a/contrib/ipmitool
+++ b/contrib/ipmitool
@@ -6,10 +6,9 @@ _ipmitool()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
- case "$prev" in
+ case $prev in
-I)
COMPREPLY=( $( compgen -W 'open imb lan lanplus free' -- "$cur" ) )
return 0
diff --git a/contrib/ipsec b/contrib/ipsec
new file mode 100644
index 00000000..acb8c995
--- /dev/null
+++ b/contrib/ipsec
@@ -0,0 +1,51 @@
+# Linux ipsec(8) completion (for FreeS/WAN)
+#
+[ $UNAME = Linux ] && have ipsec &&
+_ipsec()
+{
+ local cur
+
+ COMPREPLY=()
+ _get_comp_words_by_ref cur
+
+
+ if [ $COMP_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
+ auto)
+ COMPREPLY=( $( compgen -W '--asynchronous --up --add --delete \
+ --replace --down --route --unroute \
+ --ready --status --rereadsecrets' \
+ -- "$cur" ) )
+ ;;
+ manual)
+ COMPREPLY=( $( compgen -W '--up --down --route --unroute \
+ --union' -- "$cur" ) )
+ ;;
+ ranbits)
+ COMPREPLY=( $( compgen -W '--quick --continuous --bytes' \
+ -- "$cur" ) )
+ ;;
+ setup)
+ COMPREPLY=( $( compgen -W '--start --stop --restart' -- "$cur" ) )
+ ;;
+ *)
+ ;;
+ esac
+
+ return 0
+} &&
+complete -F _ipsec ipsec
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/iptables b/contrib/iptables
index 849fd543..bd0e4622 100644
--- a/contrib/iptables
+++ b/contrib/iptables
@@ -6,9 +6,8 @@ _iptables()
local cur prev table chain
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
- chain='s/^Chain \([^ ]\+\).*$/\1/p'
+ _get_comp_words_by_ref cur prev
+ chain='s/^Chain \([^ ]\{1,\}\).*$/\1/p'
if [[ $COMP_LINE == *-t\ *filter* ]]; then
table="-t filter"
@@ -20,16 +19,16 @@ _iptables()
_split_longopt
- case "$prev" in
+ case $prev in
-*[AIDRPFXLZ])
COMPREPLY=( $( compgen -W '`iptables $table -nL | \
- sed -ne "s/^Chain \([^ ]\+\).*$/\1/p"`' -- "$cur" ) )
+ sed -ne "s/^Chain \([^ ]\{1,\}\).*$/\1/p"`' -- "$cur" ) )
;;
-*t)
COMPREPLY=( $( compgen -W 'nat filter mangle' -- "$cur" ) )
;;
-j)
- if [ "$table" = "-t filter" -o "$table" = "" ]; then
+ if [[ "$table" == "-t filter" || -z "$table" ]]; then
COMPREPLY=( $( compgen -W 'ACCEPT DROP LOG ULOG REJECT \
`iptables $table -nL | sed -ne "$chain" \
-e "s/INPUT|OUTPUT|FORWARD|PREROUTING|POSTROUTING//"`' -- \
@@ -48,7 +47,8 @@ _iptables()
;;
*)
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-i -o -s -d -p -f -m --append \
+ COMPREPLY=( $( compgen -W '--in-interface --out-interface --source \
+ --destination --protocol --fragment --match --append \
--delete --insert --replace --list --flush --zero --new \
--delete-chain --policy --rename-chain --proto --source \
--destination --in-interface --jump --match --numeric \
diff --git a/contrib/ipv6calc b/contrib/ipv6calc
new file mode 100644
index 00000000..75f55e74
--- /dev/null
+++ b/contrib/ipv6calc
@@ -0,0 +1,57 @@
+have ipv6calc &&
+_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
+
+ case "$prev" in
+ -d|--debug)
+ return 0
+ ;;
+ -I|--in|-O|--out|-A|--action)
+ # With ipv6calc < 0.73.0, -m does nothing here, so use sed instead.
+ COMPREPLY=( $( compgen -W "$( ipv6calc "$prev" -h 2>&1 | \
+ sed -ne 's/^[[:space:]]\{1,\}\([^[:space:]:]\{1,\}\)[[:space:]]*:.*/\1/p' )" \
+ -- "$cur" ) )
+ return 0
+ ;;
+ --db-geoip|--db-ip2location-ipv4|--db-ip2location-ipv6)
+ _filedir
+ return 0
+ ;;
+ --printstart|--printend)
+ return 0
+ ;;
+ esac
+
+ $split && return 0
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--help --debug --quiet --in \
+ --out --action --examples --showinfo --show_types \
+ --machine_readable --db-geoip --db-geoip-default \
+ --db-ip2location-ipv4 --db-ip2location-ipv6 \
+ --lowercase --uppercase --printprefix --printsuffix \
+ --maskprefix --masksuffix --printstart --printend \
+ --printcompressed --printuncompressed \
+ --printfulluncompressed --printmirrored' -- "$cur" ) )
+ return 0
+ fi
+
+ return 0
+} &&
+complete -F _ipv6calc -o filenames 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/contrib/isql b/contrib/isql
index ff4ad888..f0ddbd75 100644
--- a/contrib/isql
+++ b/contrib/isql
@@ -4,10 +4,10 @@ have isql &&
_isql()
{
local cur
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
[ -f "$ODBCINI" ] \
- && COMPREPLY=( $( grep \\["$cur" "$ODBCINI" | tr -d \\[\\] ) )
+ && COMPREPLY=( $( command grep \\["$cur" "$ODBCINI" | tr -d \\[\\] ) )
} &&
complete -F _isql isql
diff --git a/contrib/jar b/contrib/jar
index 6ef632bf..75dcaf3e 100644
--- a/contrib/jar
+++ b/contrib/jar
@@ -6,14 +6,14 @@ _jar()
local cur
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
if [ $COMP_CWORD = 1 ]; then
COMPREPLY=( $( compgen -W 'c t x u' -- "$cur" ) )
return 0
fi
- case "${COMP_WORDS[1]}" in
+ case ${COMP_WORDS[1]} in
*c*f)
_filedir
;;
@@ -25,7 +25,7 @@ _jar()
;;
esac
} &&
-complete -F _jar $filenames jar
+complete -F _jar -o filenames jar
# Local variables:
# mode: shell-script
diff --git a/contrib/java b/contrib/java
index 9b8c95d5..76d2cd4e 100644
--- a/contrib/java
+++ b/contrib/java
@@ -60,23 +60,22 @@ _java_classes()
cur=${cur//.//}
# parse each classpath element for classes
for i in ${classpath//:/ }; do
- if [ -r $i ] && [[ "$i" == *.@(jar|zip) ]]; then
+ if [[ -r $i && "$i" == *.@(jar|zip) ]]; then
if type zipinfo &>/dev/null; then
COMPREPLY=( "${COMPREPLY[@]}" $( zipinfo -1 \
"$i" "$cur*" 2>/dev/null | \
- grep '^[^$]*\.class$' ) )
+ command grep '^[^$]*\.class$' ) )
else
COMPREPLY=( "${COMPREPLY[@]}" $( jar tf "$i" \
- "$cur" | grep '^[^$]*\.class$' ) )
+ "$cur" | command grep '^[^$]*\.class$' ) )
fi
elif [ -d $i ]; then
- i=${i%/}
-
- # See Debian bug #496828
- COMPREPLY=( "${COMPREPLY[@]}" $( find "$i" -type f \
- -maxdepth 1 -path "$i/$cur*.class" 2>/dev/null | \
- grep -v "\\$" | sed -e "s|^$i/||" ) )
+ # 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" ) )
# FIXME: if we have foo.class and foo/, the completion
# returns "foo/"... how to give precedence to files
@@ -108,7 +107,7 @@ _java_packages()
fi
done
# keep only packages
- COMPREPLY=( $( echo "${COMPREPLY[@]}" | tr " " "\n" | grep "/$" ) )
+ COMPREPLY=( $( tr " " "\n" <<<"${COMPREPLY[@]}" | command grep "/$" ) )
# remove packages extension
COMPREPLY=( ${COMPREPLY[@]%/} )
# convert path syntax to package syntax
@@ -122,27 +121,26 @@ _java()
local cur prev i
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
for ((i=1; i < $COMP_CWORD; i++)); do
case ${COMP_WORDS[$i]} in
-cp|-classpath)
- ((i++)) # skip the classpath string.
- ;;
+ ((i++)) # skip the classpath string.
+ ;;
-*)
- # this is an option, not a class/jarfile name.
- ;;
+ # this is an option, not a class/jarfile name.
+ ;;
*)
- # once we've seen a class, just do filename completion
- _filedir
- return 0
- ;;
+ # once we've seen a class, just do filename completion
+ _filedir
+ return 0
+ ;;
esac
done
case $prev in
- -@(cp|classpath))
+ -cp|-classpath)
_java_path
return 0
;;
@@ -151,12 +149,11 @@ _java()
if [[ "$cur" == -* ]]; then
# relevant options completion
COMPREPLY=( $( compgen -W '-client -hotspot -server -classic \
- -cp -classpath -D -verbose -verbose:class \
+ -classpath -D -verbose -verbose:class \
-verbose:gc -version:jni -version \
- -showversion -? -help -X -jar \
- -ea -enableassertions -da -disableassertions \
- -esa -enablesystemassertions \
- -dsa -disablesystemassertions ' -- "$cur" ) )
+ -showversion -help -X -jar \
+ -enableassertions -disableassertions \
+ -enablesystemassertions -disablesystemassertions ' -- "$cur" ) )
else
if [[ "$prev" == -jar ]]; then
# jar file completion
@@ -167,20 +164,19 @@ _java()
fi
fi
}
-complete -F _java $filenames java
+complete -F _java -o filenames java
}
have javadoc &&
_javadoc()
{
COMPREPLY=()
- local cur prev
+ local cur prev classpath
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
case $prev in
- -@(overview|helpfile|stylesheetfile))
+ -overview|-helpfile|-stylesheetfile)
_filedir
return 0
;;
@@ -188,7 +184,7 @@ _javadoc()
_filedir -d
return 0
;;
- -@(classpath|bootclasspath|docletpath|sourcepath|extdirs))
+ -classpath|-bootclasspath|-docletpath|-sourcepath|-extdirs)
_java_path
return 0
;;
@@ -216,7 +212,7 @@ _javadoc()
_java_packages
fi
} &&
-complete -F _javadoc $filenames javadoc
+complete -F _javadoc -o filenames javadoc
have javac &&
_javac()
@@ -224,15 +220,14 @@ _javac()
COMPREPLY=()
local cur prev
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
case $prev in
-d)
_filedir -d
return 0
;;
- -@(classpath|bootclasspath|sourcepath|extdirs))
+ -classpath|-bootclasspath|-sourcepath|-extdirs)
_java_path
return 0
;;
@@ -240,16 +235,185 @@ _javac()
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\
+ 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" ) )
else
# source files completion
_filedir java
fi
} &&
-complete -F _javac $filenames javac
+complete -F _javac -o filenames 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
+ ;;
+ 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' -- "$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
+
+ 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
+} &&
+complete -F _jarsigner -o filenames jarsigner
# Local variables:
# mode: shell-script
diff --git a/contrib/k3b b/contrib/k3b
new file mode 100644
index 00000000..a2b0af6b
--- /dev/null
+++ b/contrib/k3b
@@ -0,0 +1,55 @@
+# bash completion for k3b
+
+have k3b &&
+_k3b()
+{
+ local cur prev
+ _get_comp_words_by_ref cur prev
+ COMPREPLY=()
+
+ case $prev in
+ --help*|--author|-v|--version|--license|--lang)
+ return 0
+ ;;
+ --datacd|--audiocd|--videocd|--mixedcd|--emovixcd|--videodvd)
+ _filedir
+ return 0
+ ;;
+ --copydvd|--formatdvd|--videodvdrip)
+ _dvd_devices
+ return 0
+ ;;
+ --copycd|--erasecd|--cddarip|--videocdrip)
+ _cd_devices
+ _dvd_devices
+ return 0
+ ;;
+ --cdimage|--image)
+ _filedir @(cue|iso|toc)
+ return 0
+ ;;
+ --dvdimage)
+ _filedir iso
+ return 0
+ ;;
+ --ao)
+ COMPREPLY=( $( compgen -W 'alsa arts' -- "$cur" ) )
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]] ; then
+ COMPREPLY=( $( compgen -W "$( _parse_help "$1" )" -- "$cur" ) )
+ else
+ _filedir
+ fi
+} &&
+complete -F _k3b -o filenames 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/contrib/kldload b/contrib/kldload
index 36207afb..a230dbb5 100644
--- a/contrib/kldload
+++ b/contrib/kldload
@@ -9,7 +9,7 @@ _kldload()
moddir=/modules/
[ -d $moddir ] || moddir=/boot/kernel/
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
COMPREPLY=( $( compgen -f "$moddir$cur" ) )
COMPREPLY=( ${COMPREPLY[@]#$moddir} )
@@ -17,15 +17,16 @@ _kldload()
return 0
}
-complete -F _kldload $filenames kldload
+complete -F _kldload -o filenames kldload
_kldunload()
{
local cur
- cur=`_get_cword`
- COMPREPLY=( $(kldstat | sed -ne "s/^.*[ \t]\+\($cur[a-z_]\+\).ko$/\1/p") )
+ _get_comp_words_by_ref cur
+ COMPREPLY=( $( kldstat | \
+ sed -ne "s/^.*[ \t]\{1,\}\($cur[a-z_]\{1,\}\).ko$/\1/p" ) )
}
-complete -F _kldunload $filenames kldunload
+complete -F _kldunload -o filenames kldunload
}
diff --git a/contrib/larch b/contrib/larch
index c3a55199..e58374f7 100644
--- a/contrib/larch
+++ b/contrib/larch
@@ -6,10 +6,9 @@ _larch()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
- if [ $COMP_CWORD -eq 1 ] || [[ "$prev" == -* ]]; then
+ if [[ $COMP_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 \
@@ -38,7 +37,7 @@ _larch()
return 0
} &&
-complete -F _larch $default larch
+complete -F _larch -o default larch
# Local variables:
# mode: shell-script
diff --git a/contrib/ldapvi b/contrib/ldapvi
index e006f56e..31e26d1c 100644
--- a/contrib/ldapvi
+++ b/contrib/ldapvi
@@ -6,15 +6,14 @@ _ldapvi()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
- case "$prev" in
- -@(h|-host))
+ case $prev in
+ -h|--host)
_known_hosts_real "$cur"
return 0
;;
- -@(Y|-sasl-mech))
+ -Y|--sasl-mech)
COMPREPLY=( $( compgen -W 'EXTERNAL GSSAPI DIGEST-MD5 \
CRAM-MD5 PLAIN ANONYMOUS' -- "$cur" ) )
return 0
diff --git a/contrib/lftp b/contrib/lftp
index feb8af62..15d0a977 100644
--- a/contrib/lftp
+++ b/contrib/lftp
@@ -3,19 +3,44 @@
have lftp &&
_lftp()
{
- local cur
+ local cur prev
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur prev
+
+ case $prev in
+ -f)
+ _filedir
+ return 0
+ ;;
+ -c|-h|--help|-v|--version|-e|-u|-p)
+ return 0
+ ;;
+ esac
- if [ $COMP_CWORD -eq 1 ] && [ -f ~/.lftp/bookmarks ]; then
- COMPREPLY=( $( compgen -W '$( sed -ne "s/^\(.*\)'$'\t''.*$/\1/p" \
- ~/.lftp/bookmarks )' -- "$cur" ) )
+ if [[ "$cur" == -* ]] ; then
+ COMPREPLY=( $( compgen -W '-f -c --help --version -e -u -p' \
+ -- "$cur" ) )
+ return 0
fi
- return 0
+ COMPREPLY=( $( compgen -W \
+ '$( cut -f 1 -s ~/.lftp/bookmarks 2>/dev/null )' -- "$cur" ) )
+ _known_hosts_real "$cur"
+} &&
+complete -F _lftp -o filenames 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 _lftp $default lftp
+complete -F _lftpget lftpget
# Local variables:
# mode: shell-script
diff --git a/contrib/lilo b/contrib/lilo
index afff3722..ab0d9dc3 100644
--- a/contrib/lilo
+++ b/contrib/lilo
@@ -12,11 +12,10 @@ _lilo()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
case $prev in
- -@(C|i|m|s|S))
+ -C|-i|-m|-s|-S)
_filedir
return 0
;;
@@ -24,12 +23,12 @@ _lilo()
_filedir -d
return 0
;;
- -@(I|D|R))
+ -I|-D|-R)
# label completion
_lilo_labels
return 0
;;
- -@(A|b|M|u|U))
+ -A|-b|-M|-u|-U)
# device completion
cur=${cur:=/dev/}
_filedir
diff --git a/contrib/links b/contrib/links
index b2b41cff..4b5c683a 100644
--- a/contrib/links
+++ b/contrib/links
@@ -6,9 +6,9 @@ _links()
local cur
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
- case "$cur" in
+ case $cur in
--*)
COMPREPLY=( $( compgen -W '--help' -- "$cur" ) )
;;
@@ -32,7 +32,7 @@ _links()
return 0
} &&
-complete -F _links $filenames links
+complete -F _links -o filenames links
# Local variables:
# mode: shell-script
diff --git a/contrib/lintian b/contrib/lintian
new file mode 100644
index 00000000..a1f51546
--- /dev/null
+++ b/contrib/lintian
@@ -0,0 +1,186 @@
+# -*- 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)
+
+have lintian && {
+_lintian_tags() {
+ local match search tags
+
+ tags=$( grep -e ^Tag /usr/share/lintian/checks/*.desc | cut -d\ -f2 )
+ if [[ "$cur" == *, ]]; then
+ search=${cur//,/ }
+ for item in $search; do
+ match=$(grep -nE "^Tag: $item$" /usr/share/lintian/checks/*.desc \
+ | cut -d: -f1 )
+ tags=$( echo $tags | sed -e "s/\<$item\>//g" )
+ done
+ COMPREPLY=( ${COMPREPLY[@]} $(compgen -W "$tags") )
+ elif [[ "$cur" == *,* ]]; then
+ COMPREPLY=( ${COMPREPLY[@]} $(compgen -P "${cur%,*}," -W "$tags" -- \
+ "${cur##*,}") )
+ else
+ COMPREPLY=( ${COMPREPLY[@]} $(compgen -W "$tags" -- "$cur") )
+ fi
+ return 0
+}
+
+_lintian_checks() {
+ local match search todisable checks
+
+ checks=$(grep -e ^Check-Script -e ^Abbrev \
+ /usr/share/lintian/checks/*.desc | cut -d\ -f2 )
+ if [[ "$cur" == *, ]]; then
+ search=${cur//,/ }
+ for item in $search; do
+ match=$(grep -nE "^(Check-Script|Abbrev): $item$" \
+ /usr/share/lintian/checks/*.desc | cut -d: -f1 )
+ todisable=$(grep -e ^Check-Script -e ^Abbrev $match | \
+ cut -d\ -f2 )
+ for name in $todisable; do
+ checks=$( echo $checks | sed -e "s/\<$name\>//g" )
+ done
+ done
+ COMPREPLY=( ${COMPREPLY[@]} $(compgen -W "$checks") )
+ elif [[ "$cur" == *,* ]]; then
+ COMPREPLY=( ${COMPREPLY[@]} $(compgen -P "${cur%,*}," -W "$checks" \
+ -- "${cur##*,}") )
+ else
+ COMPREPLY=( ${COMPREPLY[@]} $(compgen -W "$checks" -- "$cur") )
+ fi
+ return 0
+}
+
+_lintian_infos() {
+ local match search infos
+
+ infos=$(grep -e ^Collector /usr/share/lintian/collection/*.desc \
+ | cut -d\ -f2 )
+ if [[ "$cur" == *, ]]; then
+ search=${cur//,/ }
+ for item in $search; do
+ match=$( grep -nE "^Collector: $item$" \
+ /usr/share/lintian/collection/*.desc | cut -d: -f1 )
+ infos=$( echo $infos | sed -e "s/\<$item\>//g" )
+ done
+ COMPREPLY=( ${COMPREPLY[@]} $(compgen -W "$infos") )
+ elif [[ "$cur" == *,* ]]; then
+ COMPREPLY=( ${COMPREPLY[@]} $(compgen -P "${cur%,*}," -W "$infos" \
+ -- "${cur##*,}") )
+ else
+ COMPREPLY=( ${COMPREPLY[@]} $(compgen -W "$infos" -- "$cur") )
+ fi
+ return 0
+}
+
+_lintian_arches() {
+ return 0
+}
+
+_lintian() {
+ local cur prev action lint_actions general_opts behaviour_opts \
+ configuration_opts selection_opts
+
+ _get_comp_words_by_ref cur prev
+
+ 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 \
+ --suppress-tags-from-file --no-override --show-overrides \
+ --color --unpack-info --md5sums --checksums --allow-root \
+ --fail-on-warnings --keep-lab"
+ configuration_opts="--cfg --lab --archivedir --dist --area --section \
+ --arch --root"
+ selection_opts="--all --binary --source --udeb --packages-file"
+
+ if [[ "$prev" = -* ]]; then
+ case $prev in
+ -C|--check-part|-X|--dont-check-part)
+ _lintian_checks
+ ;;
+ -T|--tags|--suppress-tags)
+ _lintian_tags
+ ;;
+ --tags-from-file|--suppress-tags-from-file|--cfg|-p|\
+ --packages-file)
+ _filedir
+ ;;
+ --lab|--archivedir|--dist|--root)
+ _filedir -d
+ ;;
+ -l|--unpack-level)
+ COMPREPLY=($(compgen -W "0 none 1 basic 2 contents" -- \
+ "$cur"))
+ ;;
+ --color)
+ COMPREPLY=($(compgen -W "never always auto html" -- "$cur"))
+ ;;
+ -U|--unpack-info)
+ _lintian_infos
+ ;;
+ --area|--section)
+ COMPREPLY=($(compgen -W "main contrib non-free" -- "$cur"))
+ ;;
+ --arch)
+ ;;
+ esac
+ fi
+
+ case "$cur" in
+ --*)
+ COMPREPLY=($(compgen -W "$lint_actions $general_opts \
+ $behaviour_opts $configuration_opts" -- "$cur"))
+ ;;
+ *,)
+ # If we're here, the user is trying to complete on
+ # --action tag,tag,<TAB>
+ # Only few actions permit that, re-complete them now.
+ echo $prev
+ case "$prev" in
+ -C|--check-part|-X|--dont-check-part)
+ _lintian_checks
+ ;;
+ -T|--tags|--suppress-tags)
+ _lintian_tags
+ ;;
+ -U|--unpack-info)
+ _lintian_infos
+ ;;
+ esac
+ ;;
+ *)
+ _filedir '@(?(u)deb|changes|dsc)'
+ ;;
+ esac
+ return 0
+}
+
+_lintian_info() {
+ local cur prev
+
+ _get_comp_words_by_ref cur prev
+
+ case "$prev" in
+ -t|--tags)
+ _lintian_tags
+ return 0
+ ;;
+ esac
+
+ case "$cur" in
+ --*)
+ COMPREPLY=($(compgen -W "--annotate --help --tags" -- "$cur"))
+ ;;
+ *)
+ _filedir
+ ;;
+ esac
+ return 0
+}
+
+complete -F _lintian -o filenames lintian
+complete -F _lintian_info -o filenames lintian-info
+}
diff --git a/contrib/lisp b/contrib/lisp
index cf9e2f8b..ee43a019 100644
--- a/contrib/lisp
+++ b/contrib/lisp
@@ -7,7 +7,7 @@ _lisp()
local cur
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
# completing an option (may or may not be separated by a space)
if [[ "$cur" == -* ]]; then
@@ -20,7 +20,7 @@ _lisp()
return 0
} &&
-complete -F _lisp $default lisp
+complete -F _lisp -o default lisp
# Local variables:
# mode: shell-script
diff --git a/contrib/lvm b/contrib/lvm
index 647564ab..f4d3b77d 100644
--- a/contrib/lvm
+++ b/contrib/lvm
@@ -49,11 +49,11 @@ _lvmdiskscan()
local cur
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-d --debug -h -? --help -l \
- --lvmpartition -v --verbose --version' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '--debug --help \
+ --lvmpartition --verbose --version' -- "$cur" ) )
fi
}
complete -F _lvmdiskscan lvmdiskscan
@@ -63,13 +63,11 @@ _pvscan()
local cur
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-d --debug -e \
- --exported -n --novolumegroup -h -? \
- --help --ignorelockingfailure -P \
- --partial -s --short -u --uuid -v \
+ COMPREPLY=( $( compgen -W '--debug --exported --novolumegroup \
+ --help --ignorelockingfailure --partial --short --uuid \
--verbose --version' -- "$cur" ) )
fi
}
@@ -80,11 +78,10 @@ _pvs()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
- case "$prev" in
- -@(o|O|-options|-sort))
+ case $prev in
+ -o|-O|--options|--sort)
COMPREPLY=( $( compgen -W 'pv_fmt pv_uuid \
pv_size pv_free pv_used pv_name \
pv_attr pv_pe_count \
@@ -98,11 +95,10 @@ _pvs()
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--aligned -a --all -d --debug \
- -h -? --help --ignorelockingfailure --noheadings \
- --nosuffix -o --options -O --sort \
- --separator --unbuffered --units \
- -v --verbose --version' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '--aligned --all --debug \
+ --help --ignorelockingfailure --noheadings \
+ --nosuffix --options --sort --separator --unbuffered --units \
+ --verbose --version' -- "$cur" ) )
else
_physicalvolumes
fi
@@ -114,10 +110,9 @@ _pvdisplay()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
- case "$prev" in
+ case $prev in
--units)
_units
return 0
@@ -125,8 +120,8 @@ _pvdisplay()
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-c --colon -C --columns --units \
- -v --verbose -d --debug -h --help --version' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '--colon --columns --units \
+ --verbose --debug --help --version' -- "$cur" ) )
else
_physicalvolumes
fi
@@ -138,20 +133,19 @@ _pvchange()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
- case "$prev" in
- -@(A|x|-autobackup|--allocatable))
+ case $prev in
+ -A|-x|--autobackup|--allocatable)
COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
return 0
;;
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-a --all -A --autobackup \
- -d --debug -h --help -t --test -u --uuid -x \
- --allocatable -v --verbose --addtag --deltag \
+ COMPREPLY=( $( compgen -W '--all --autobackup \
+ --debug --help --test --uuid \
+ --allocatable --verbose --addtag --deltag \
--version' -- "$cur" ) )
else
_physicalvolumes
@@ -164,15 +158,14 @@ _pvcreate()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
- case "$prev" in
+ case $prev in
--restorefile)
_filedir
return 0
;;
- -@(M|-metadatatype))
+ -M|--metadatatype)
COMPREPLY=( $( compgen -W '1 2' -- "$cur" ) )
return 0
;;
@@ -180,18 +173,18 @@ _pvcreate()
COMPREPLY=( $( compgen -W '0 1 2' -- "$cur" ) )
return 0
;;
- --@(metadatasize|setphysicalvolumesize))
+ --metadatasize|--setphysicalvolumesize)
_sizes
return 0
;;
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--restorefile -d --debug -f \
- --force -h -? --help --labelsector -M --metadatatype \
+ COMPREPLY=( $( compgen -W '--restorefile --debug \
+ --force --help --labelsector --metadatatype \
--metadatacopies --metadatasize \
- --setphysicalvolumesize -t --test -u --uuid uuid -v \
- --verbose -y --yes --version' -- "$cur" ) )
+ --setphysicalvolumesize --test --uuid \
+ --verbose --yes --version' -- "$cur" ) )
else
_physicalvolumes
fi
@@ -203,24 +196,22 @@ _pvmove()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
- case "$prev" in
- -@(A|-autobackup))
+ case $prev in
+ -A|--autobackup)
COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
return 0
;;
- -@(n|-name))
+ -n|--name)
_logicalvolumes
return 0
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--abort -A --autobackup \
- -b --background -d --debug -f --force -h -? \
- --help -i --interval -t --test -v --verbose \
- --version -n --name' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '--abort --autobackup \
+ --background --debug --force --help --interval --test --verbose \
+ --version --name' -- "$cur" ) )
else
_physicalvolumes
fi
@@ -232,12 +223,11 @@ _pvremove()
local cur
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-d --debug -f --force -h -? \
- --help -y --yes -t --test -v --verbose \
- --version' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '--debug --force \
+ --help --yes --test --verbose --version' -- "$cur" ) )
else
_physicalvolumes
fi
@@ -249,12 +239,12 @@ _vgscan()
local cur
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-d --debug -h --help \
- --ignorelockingfailure --mknodes -P \
- --partial -v --verbose --version' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '--debug --help \
+ --ignorelockingfailure --mknodes \
+ --partial --verbose --version' -- "$cur" ) )
fi
}
complete -F _vgscan vgscan
@@ -264,11 +254,10 @@ _vgs()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
- case "$prev" in
- -@(o|O|-options|-sort))
+ case $prev in
+ -o|-O|--options|--sort)
COMPREPLY=( $( compgen -W 'vg_fmt vg_uuid vg_name \
vg_attr vg_size vg_free vg_sysid \
vg_extent_size vg_extent_count vg_free_count \
@@ -283,11 +272,11 @@ _vgs()
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--aligned -d --debug \
- -h --help --ignorelockingfailure --noheadings \
- --nosuffix -o --options -O --sort -P --partial \
+ COMPREPLY=( $( compgen -W '--aligned --debug \
+ --help --ignorelockingfailure --noheadings \
+ --nosuffix --options --sort --partial \
--separator --unbuffered --units \
- -v --verbose --version' -- "$cur" ) )
+ --verbose --version' -- "$cur" ) )
else
_volumegroups
fi
@@ -299,10 +288,9 @@ _vgdisplay()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
- case "$prev" in
+ case $prev in
--units)
_units
return 0
@@ -310,9 +298,9 @@ _vgdisplay()
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-c --colon -C --columns --units \
- -P --partial -A --activevolumegroups -v --verbose \
- -d --debug -h --help --version' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '--colon --columns --units \
+ --partial --activevolumegroups --verbose \
+ --debug --help --version' -- "$cur" ) )
else
_volumegroups
fi
@@ -324,21 +312,20 @@ _vgchange()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
- case "$prev" in
- -@(a|A|x|-available|-autobackup|-resizeable))
+ case $prev in
+ -a|-A|-x|--available|--autobackup|--resizeable)
COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
return 0
;;
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-A --autobackup --alloc -P \
- --partial -d --debug -h --help --ignorelockingfailure \
- -t --test -u --uuid -v --verbose --version -a \
- --available -x --resizeable -l --logicalvolume \
+ COMPREPLY=( $( compgen -W '--autobackup --alloc \
+ --partial --debug --help --ignorelockingfailure \
+ --test --uuid --verbose --version \
+ --available --resizeable --logicalvolume \
--addtag --deltag' -- "$cur" ) )
else
_volumegroups
@@ -351,28 +338,27 @@ _vgcreate()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
- case "$prev" in
- -@(A|-autobackup))
+ case $prev in
+ -A|--autobackup)
COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
return 0
;;
- -@(M|-metadatatype))
+ -M|--metadatatype)
COMPREPLY=( $( compgen -W '1 2' -- "$cur" ) )
return 0
;;
- -@(s|-physicalextentsize))
+ -s|--physicalextentsize)
_sizes
return 0
;;
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-A --autobackup --addtag --alloc -d \
- --debug -h --help -l --maxlogicalvolumes -M --metadatatype -p \
- --maxphysicalvolumes -s --physicalextentsize -t --test -v \
+ COMPREPLY=( $( compgen -W '--autobackup --addtag --alloc \
+ --debug --help --maxlogicalvolumes --metadatatype \
+ --maxphysicalvolumes --physicalextentsize --test \
--verbose --version' -- "$cur" ) )
else
_args
@@ -390,11 +376,11 @@ _vgremove()
local cur
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-d --debug -h --help -t --test \
- -v --verbose --version' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '--debug --help --test \
+ --verbose --version' -- "$cur" ) )
else
_volumegroups
fi
@@ -406,19 +392,18 @@ _vgrename()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
- case "$prev" in
- -@(A|-autobackup))
+ case $prev in
+ -A|--autobackup)
COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
return 0
;;
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-A --autobackup -d --debug -h \
- -? --help -t --test -v --verbose --version' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '--autobackup --debug \
+ --help --test --verbose --version' -- "$cur" ) )
else
_volumegroups
fi
@@ -430,19 +415,18 @@ _vgreduce()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
- case "$prev" in
- -@(A|-autobackup))
+ case $prev in
+ -A|--autobackup)
COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
return 0
;;
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-a --all -A --autobackup -d \
- --debug -h --help --removemissing -t --test -v \
+ COMPREPLY=( $( compgen -W '--all --autobackup \
+ --debug --help --removemissing --test \
--verbose --version' -- "$cur" ) )
else
@@ -461,23 +445,22 @@ _vgextend()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
- case "$prev" in
- -@(A|-autobackup))
+ case $prev in
+ -A|--autobackup)
COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
return 0
;;
- -@(L|-size))
+ -L|--size)
_sizes
return 0
;;
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-A --autobackup -d --debug -h \
- -? --help -t --test -v --verbose --version' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '--autobackup --debug \
+ --help --test --verbose --version' -- "$cur" ) )
else
_args
if [ $args -eq 0 ]; then
@@ -494,11 +477,11 @@ _vgport()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-a --all -d --debug -h \
- -? --help -v --verbose --version' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '--all --debug \
+ --help --verbose --version' -- "$cur" ) )
else
_volumegroups
fi
@@ -507,14 +490,14 @@ complete -F _vgport vgimport vgexport
_vgck()
{
- local cur prev
+ local cur
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-d --debug -h \
- -? --help -v --verbose --version' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '--debug \
+ --help --verbose --version' -- "$cur" ) )
else
_volumegroups
fi
@@ -526,11 +509,10 @@ _vgconvert()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
- case "$prev" in
- -@(M|-metadatatype))
+ case $prev in
+ -M|--metadatatype)
COMPREPLY=( $( compgen -W '1 2' -- "$cur" ) )
return 0
;;
@@ -545,9 +527,9 @@ _vgconvert()
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-d --debug -h --help --labelsector \
- -M --metadatatype --metadatacopies --metadatasize \
- -t --test -v --verbose --version' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '--debug --help --labelsector \
+ --metadatatype --metadatacopies --metadatasize \
+ --test --verbose --version' -- "$cur" ) )
else
_volumegroups
fi
@@ -559,19 +541,18 @@ _vgcfgbackup()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
- case "$prev" in
- -@(f|-file))
+ case $prev in
+ -f|--file)
_filedir
return 0
;;
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-d --debug -f --file -h --help \
- --ignorelockingfailure -P --partial -v --verbose \
+ COMPREPLY=( $( compgen -W '--debug --file --help \
+ --ignorelockingfailure --partial --verbose \
--version' -- "$cur" ) )
else
_volumegroups
@@ -584,28 +565,27 @@ _vgcfgrestore()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
- case "$prev" in
- -@(f|-file))
+ case $prev in
+ -f|--file)
_filedir
return 0
;;
- -@(M|-metadatatype))
+ -M|--metadatatype)
COMPREPLY=( $( compgen -W '1 2' -- "$cur" ) )
return 0
;;
- -@(n|-name))
+ -n|--name)
_volumegroups
return 0
;;
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-d --debug -f --file -l --list \
- -h --help -M --Metadatatype -n --name -t --test \
- -v --verbose --version' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '--debug --file --list \
+ --help --metadatatype --name --test \
+ --verbose --version' -- "$cur" ) )
else
_volumegroups
fi
@@ -617,19 +597,18 @@ _vgmerge()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
- case "$prev" in
- -@(A|-autobackup))
+ case $prev in
+ -A|--autobackup)
COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
return 0
;;
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-A --autobackup -d --debug -h --help -l \
- --list -t --test -v --verbose --version' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '--autobackup --debug --help \
+ --list --test --verbose --version' -- "$cur" ) )
else
_volumegroups
fi
@@ -641,27 +620,26 @@ _vgsplit()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
- case "$prev" in
- -@(A|-autobackup))
+ case $prev in
+ -A|--autobackup)
COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
return 0
;;
- -@(M|-metadatatype))
+ -M|--metadatatype)
COMPREPLY=( $( compgen -W '1 2' -- "$cur" ) )
return 0
;;
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-A --autobackup -d --debug \
- -h --help -l --list -M --metadatatype -t --test \
- -v --verbose --version' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '--autobackup --debug \
+ --help --list --metadatatype --test \
+ --verbose --version' -- "$cur" ) )
else
_args
- if [ $args -eq 0 -o $args -eq 1 ]; then
+ if [[ $args -eq 0 || $args -eq 1 ]]; then
_volumegroups
else
_physicalvolumes
@@ -675,10 +653,10 @@ _vgmknodes()
local cur
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-d --debug -h --help -v --verbose \
+ COMPREPLY=( $( compgen -W '--debug --help --verbose \
--version' -- "$cur" ) )
else
_volumegroups
@@ -691,12 +669,12 @@ _lvscan()
local cur
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-b --blockdevice -d --debug \
- -h -? --help --ignorelockingfailure -P \
- --partial -v --verbose --version' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '--blockdevice --debug \
+ --help --ignorelockingfailure \
+ --partial --verbose --version' -- "$cur" ) )
fi
}
complete -F _lvscan lvscan
@@ -706,11 +684,10 @@ _lvs()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
- case "$prev" in
- -@(o|O|-options|-sort))
+ case $prev in
+ -o|-O|--options|--sort)
COMPREPLY=( $( compgen -W 'lv_uuid lv_name lv_attr lv_minor \
lv_size seg_count origin snap_percent segtype stripes \
stripesize chunksize seg_start seg_size' -- "$cur" ) )
@@ -723,10 +700,10 @@ _lvs()
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--aligned -d --debug -h --help \
- --ignorelockingfailure --noheadings --nosuffix -o --options -O \
- --sort -P --partial --segments --separator --unbuffered --units \
- -v --verbose --version' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '--aligned --debug --help \
+ --ignorelockingfailure --noheadings --nosuffix --options \
+ --sort --partial --segments --separator --unbuffered --units \
+ --verbose --version' -- "$cur" ) )
else
_logicalvolumes
fi
@@ -738,10 +715,9 @@ _lvdisplay()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
- case "$prev" in
+ case $prev in
--units)
_units
return 0
@@ -749,9 +725,8 @@ _lvdisplay()
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-c --colon -C --columns --units \
- -P --partial -m --maps -v --verbose -d --debug -h \
- --help --version' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '--colon --columns --units \
+ --partial --maps --verbose --debug --help --version' -- "$cur" ) )
else
_logicalvolumes
fi
@@ -763,27 +738,26 @@ _lvchange()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
- case "$prev" in
- -@(a|A|C|M|-available|-autobackup|-continguous|-persistent))
+ case $prev in
+ -a|-A|-C|-M|--available|--autobackup|--continguous|--persistent)
COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
return 0
;;
- -@(p|-permission))
+ -p|--permission)
COMPREPLY=( $( compgen -W 'r rw' -- "$cur" ) )
return 0
;;
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-A --autobackup -a --available \
- --addtag --alloc -C --contiguous -d --debug --deltag \
- -f --force -h --help --ignorelockingfailure -M \
- --persistent --major major --minor minor -P --partial \
- -p --permission -r --readahead --refresh -t --test \
- -v --verbose --version' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '--autobackup --available \
+ --addtag --alloc --contiguous --debug --deltag \
+ --force --help --ignorelockingfailure \
+ --persistent --major --minor --partial \
+ --permission --readahead --refresh --test \
+ --verbose --version' -- "$cur" ) )
else
_logicalvolumes
fi
@@ -795,34 +769,33 @@ _lvcreate()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
- case "$prev" in
- -@(A|C|M|Z|-autobackup|-continguous|-persistent|-zero))
+ case $prev in
+ -A|-C|-M|-Z|--autobackup|--continguous|--persistent|--zero)
COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
return 0
;;
- -@(L|-size))
+ -L|--size)
_sizes
return 0
;;
- -@(p|-permission))
+ -p|--permission)
COMPREPLY=( $( compgen -W 'r rw' -- "$cur" ) )
return 0
;;
- -@(n|-name))
+ -n|--name)
_logicalvolumes
return 0
;;
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-A --autobackup --addtag --alloc \
- -C --contiguous -d --debug -h -? --help -i --stripes \
- -I --stripesize -l --extents -L --size -M --persistent \
- --major --minor -n --name -p --permission -r \
- --readahead -t --test --type -v --verbose -Z --zero \
+ COMPREPLY=( $( compgen -W '--autobackup --addtag --alloc \
+ --contiguous --debug --help --stripes \
+ --stripesize --extents --size --persistent \
+ --major --minor --name --permission \
+ --readahead --test --type --verbose --zero \
--version' -- "$cur" ) )
else
_args
@@ -840,20 +813,18 @@ _lvremove()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
- case "$prev" in
- -@(A|-autobackup))
+ case $prev in
+ -A|--autobackup)
COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
return 0
;;
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-A --autobackup -d --debug -f \
- --force -h -? --help -t --test -v --verbose \
- --version' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '--autobackup --debug \
+ --force --help --test --verbose --version' -- "$cur" ) )
else
_logicalvolumes
fi
@@ -865,19 +836,18 @@ _lvrename()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
- case "$prev" in
- -@(A|-autobackup))
+ case $prev in
+ -A|--autobackup)
COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
return 0
;;
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-A --autobackup -d --debug -h \
- -? --help -t --test -v --verbose --version' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '--autobackup --debug \
+ --help --test --verbose --version' -- "$cur" ) )
else
_logicalvolumes
fi
@@ -889,25 +859,23 @@ _lvreduce()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
- case "$prev" in
- -@(A|-autobackup))
+ case $prev in
+ -A|--autobackup)
COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
return 0
;;
- -@(L|-size))
+ -L|--size)
_sizes
return 0
;;
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-A --autobackup -d \
- --debug -f --force -h --help -l --extents \
- -L --size -n --nofsck -r --resizefs -t --test \
- -v --verbose --version' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '--autobackup \
+ --debug --force --help --extents \
+ --size --nofsck --resizefs --test --verbose --version' -- "$cur" ) )
else
_logicalvolumes
fi
@@ -919,25 +887,24 @@ _lvresize()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
- case "$prev" in
- -@(A|-autobackup))
+ case $prev in
+ -A|--autobackup)
COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
return 0
;;
- -@(L|-size))
+ -L|--size)
_sizes
return 0
;;
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-A --autobackup --alloc -d \
- --debug -h --help -i --stripes -I --stripesize \
- -l --extents -L --size -n --nofsck -r --resizefs \
- -t --test --type -v --verbose --version' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '--autobackup --alloc \
+ --debug --help --stripes --stripesize \
+ --extents --size --nofsck --resizefs \
+ --test --type --verbose --version' -- "$cur" ) )
else
_args
if [ $args -eq 0 ]; then
@@ -954,25 +921,24 @@ _lvextend()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
- case "$prev" in
- -@(A|-autobackup))
+ case $prev in
+ -A|--autobackup)
COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
return 0
;;
- -@(L|-size))
+ -L|--size)
_sizes
return 0
;;
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-A --autobackup --alloc -d \
- --debug -h --help -i --stripes -I --stripesize \
- -l --extents -L --size -n --nofsck -r --resizefs \
- -t --test --type -v --verbose --version' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '--autobackup --alloc \
+ --debug --help --stripes --stripesize \
+ --extents --size --nofsck --resizefs \
+ --test --type --verbose --version' -- "$cur" ) )
else
_args
if [ $args -eq 0 ]; then
@@ -986,10 +952,10 @@ complete -F _lvextend lvextend
_lvm()
{
- local prev
+ local cur
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
if [ $COMP_CWORD -eq 1 ]; then
COMPREPLY=( $( compgen -W 'dumpconfig help lvchange \
diff --git a/contrib/lzma b/contrib/lzma
index 42d2bfb1..a176f191 100644
--- a/contrib/lzma
+++ b/contrib/lzma
@@ -6,21 +6,19 @@ _lzma()
local cur prev xspec
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-c -d -f -h -k -L -q -s \
- -v -V -z -1 -2 -3 -4 -5 -6 -7 -8 -9 \
- --help --decompress --compress --keep --force \
- --test --stdout --quiet --verbose --license \
+ COMPREPLY=( $( compgen -W '-1 -2 -3 -4 -5 -6 -7 -8 -9 \
+ --help --decompress --compress --keep --force --suffix \
+ --test --stdout --quiet --verbose --license --list \
--version --small --fast --best --text' -- "$cur" ) )
return 0
fi
local IFS=$'\t\n'
- xspec="*.lzma"
+ xspec="*.@(lzma|tlz)"
if [[ "$prev" == --* ]]; then
[[ "$prev" == --decompress || \
"$prev" == --list || \
@@ -36,7 +34,7 @@ _lzma()
COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \
$( compgen -d -- "$cur" ) )
} &&
-complete -F _lzma $filenames lzma
+complete -F _lzma -o filenames lzma
# Local variables:
# mode: shell-script
diff --git a/contrib/lzop b/contrib/lzop
index 9090bac4..19852b24 100644
--- a/contrib/lzop
+++ b/contrib/lzop
@@ -6,26 +6,20 @@ _lzop()
local cur prev xspec
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- # TODO: -p: takes a dir argument, without a separating space
+ _get_comp_words_by_ref cur prev
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-d -x -l -t -h -I -V -L -1 -2 -3 \
- -4 -5 -6 -7 -8 -9 -q -v -c -f -F -n -N -P -k -U -o \
- -S --fast --best --decompress --uncompress --extract \
- --test --list --ls --info --sysinfo --license --help \
- --version --stdout --to-stdout --output --path \
- --force --no-checksum --no-name --name --no-mode \
- --no-time --suffix --keep --unlink --delete --crc32 \
- --no-warn --ignore-warn --quiet --silent --verbose \
- --no-stdin --filter --checksum --no-color --mono \
+ 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
- case "$prev" in
+ case $prev in
-o|--output)
_filedir
return 0
@@ -40,8 +34,8 @@ _lzop()
esac
xspec="*.?(t)lzo"
- case "$prev" in
- --@(@(de|un)compress|extract|list|ls|info|test))
+ case $prev in
+ --decompress|--uncompress|--extract|--list|--ls|--info|--test)
xspec="!"$xspec
;;
--force)
@@ -63,7 +57,7 @@ _lzop()
COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \
$( compgen -d -- "$cur" ) )
} &&
-complete -F _lzop $filenames lzop
+complete -F _lzop -o filenames lzop
# Local variables:
# mode: shell-script
diff --git a/contrib/mailman b/contrib/mailman
index 8cfec3e8..33227897 100644
--- a/contrib/mailman
+++ b/contrib/mailman
@@ -1,4 +1,4 @@
-# Mailman completion by Guillaume Rousse <rousse@ccr.jussieu.fr>
+# mailman completion
have list_lists && {
_mailman_lists()
@@ -11,11 +11,11 @@ _list_lists()
local cur
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-a --advertised --virtual-host-overview -V \
- -b --bare -h --help' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '--advertised --virtual-host-overview \
+ --bare --help' -- "$cur" ) )
fi
} &&
@@ -28,17 +28,16 @@ _add_members()
local cur prev split=false
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
_split_longopt && split=true
- case "$prev" in
- -@(r|d|-regular-members-file|-digest-members-file))
+ case $prev in
+ -r|-d|--regular-members-file|--digest-members-file)
_filedir
return 0
;;
- -@(w|a|-welcome-msg|-admin-notify))
+ -w|-a|--welcome-msg|--admin-notify)
COMPREPLY=( $( compgen -W 'y n' -- "$cur") )
return 0
;;
@@ -47,9 +46,9 @@ _add_members()
$split && return 0
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--regular-members-file -r \
- --digest-members-file -d --welcome-msg -w \
- --admin-notify -a --help -h' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '--regular-members-file \
+ --digest-members-file --welcome-msg \
+ --admin-notify --help' -- "$cur" ) )
else
_mailman_lists
fi
@@ -63,13 +62,12 @@ _remove_members()
local cur prev split=false
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
_split_longopt && split=true
- case "$prev" in
- -@(f|-file))
+ case $prev in
+ -f|--file)
_filedir
return 0
;;
@@ -78,8 +76,8 @@ _remove_members()
$split && return 0
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--file -f --all -a --fromall --nouserack -n \
- --noadminack -N --help -h' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '--file --all --fromall --nouserack \
+ --noadminack --help' -- "$cur" ) )
else
_mailman_lists
fi
@@ -93,13 +91,12 @@ _find_member()
local cur prev split=false
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
_split_longopt && split=true
- case "$prev" in
- -@(l|x|-listname|-exclude))
+ case $prev in
+ -l|-x|--listname|--exclude)
_mailman_lists
return 0
;;
@@ -108,8 +105,8 @@ _find_member()
$split && return 0
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-l --listname -x --exclude --owners -w \
- --help -h' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '--listname --exclude --owners \
+ --help' -- "$cur" ) )
fi
} &&
@@ -121,13 +118,12 @@ _clone_member()
local cur prev split=false
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
_split_longopt && split=true
- case "$prev" in
- -@(l|-listname))
+ case $prev in
+ -l|--listname)
_mailman_lists
return 0
;;
@@ -136,8 +132,8 @@ _clone_member()
$split && return 0
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-l --listname --remove -r --admin -a \
- --quiet -q --nomodify -n --help -h' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '--listname --remove --admin \
+ --quiet --nomodify --help' -- "$cur" ) )
fi
} &&
@@ -149,17 +145,16 @@ _sync_members()
local cur prev split=false
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
_split_longopt && split=true
- case "$prev" in
- -@(w|g|d|--welcome-msg|-goodbye-msg|-digest))
+ case $prev in
+ -w|-g|-d|--welcome-msg|--goodbye-msg|--digest)
COMPREPLY=( $( compgen -W 'y n' -- "$cur") )
return 0
;;
- -@(d|-file))
+ -d|--file)
_filedir
return 0
;;
@@ -168,9 +163,8 @@ _sync_members()
$split && return 0
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--no-change -n --welcome-msg -w \
- --goodbye-msg -g --digest -d --notifyadmin -a -f --file -h --help' \
- -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '--no-change --welcome-msg \
+ --goodbye-msg --digest --notifyadmin --file --help' -- "$cur" ) )
else
_mailman_lists
fi
@@ -184,10 +178,10 @@ _unshunt()
local cur
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-h --help' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '--help' -- "$cur" ) )
else
_filedir -d
fi
@@ -201,11 +195,10 @@ _list_admins()
local cur
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--all-vhost -v --all -a -h --help' \
- -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '--all-vhost --all --help' -- "$cur" ) )
else
_mailman_lists
fi
@@ -219,10 +212,10 @@ _list_owners()
local cur
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-w --with-listnames -m --moderators -h \
+ COMPREPLY=( $( compgen -W '--with-listnames --moderators \
--help' -- "$cur" ) )
else
_mailman_lists
@@ -237,21 +230,20 @@ _list_members()
local cur prev split=false
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
_split_longopt && split=true
- case "$prev" in
- -@(o|-output))
+ case $prev in
+ -o|--output)
_filedir
return 0
;;
- -@(d|-digest))
+ -d|--digest)
COMPREPLY=( $( compgen -W 'mime plain' -- "$cur") )
return 0
;;
- -@(n|-nomail))
+ -n|--nomail)
COMPREPLY=( $( compgen -W 'byadmin byuser bybounce unknown' \
-- "$cur") )
return 0
@@ -261,8 +253,8 @@ _list_members()
$split && return 0
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--output -o --regular -r --digest -d \
- --nomail -n --fullnames -f --preserve -p -h --help' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '--output --regular --digest \
+ --nomail --fullnames --preserve --help' -- "$cur" ) )
else
_mailman_lists
fi
@@ -276,13 +268,12 @@ _change_pw()
local cur prev split=false
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
_split_longopt && split=true
- case "$prev" in
- -@(l|-listname))
+ case $prev in
+ -l|--listname)
_mailman_lists
return 0
;;
@@ -291,8 +282,8 @@ _change_pw()
$split && return 0
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-a --all --domain -d --listname -l \
- --password -p --quiet -q -h --help' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '--all --domain --listname \
+ --password --quiet --help' -- "$cur" ) )
fi
} &&
@@ -304,11 +295,11 @@ _withlist()
local cur
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-l --lock -i --interactive \
- -r --run -a --all -q --quiet -h --help' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '--lock --interactive \
+ --run --all --quiet --help' -- "$cur" ) )
else
_mailman_lists
fi
@@ -322,11 +313,10 @@ _newlist()
local cur
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-l --language -q --quiet -h --help' \
- -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '--language --quiet --help' -- "$cur" ) )
else
_mailman_lists
fi
@@ -340,10 +330,10 @@ _rmlist()
local cur
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--archives -a -h --help' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '--archives --help' -- "$cur" ) )
else
_mailman_lists
fi
@@ -357,13 +347,12 @@ _config_list()
local cur prev split=false
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
_split_longopt && split=true
- case "$prev" in
- -@(i|o|-inputfile|-outputfile))
+ case $prev in
+ -i|-o|--inputfile|--outputfile)
_filedir
return 0
;;
@@ -372,32 +361,33 @@ _config_list()
$split && return 0
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--inputfile -i --outputfile -o \
- --checkonly -c --verbose -v -h --help' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '--inputfile --outputfile \
+ --checkonly --verbose --help' -- "$cur" ) )
else
_mailman_lists
fi
} &&
-complete -F _config_list $filenames config_list
+complete -F _config_list -o filenames config_list
-have arch &&
+# 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=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
_split_longopt && split=true
- case "$prev" in
- -@(w|g|d|--welcome-msg|-goodbye-msg|-digest))
+ case $prev in
+ -w|-g|-d|--welcome-msg|--goodbye-msg|--digest)
COMPREPLY=( $( compgen -W 'y n' -- "$cur") )
return 0
;;
- -@(d|-file))
+ -d|--file)
_filedir
return 0
;;
@@ -406,7 +396,7 @@ _arch()
$split && return 0
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--wipe -s --start -e --end -q --quiet -h \
+ COMPREPLY=( $( compgen -W '--wipe --start --end --quiet \
--help' -- "$cur" ) )
else
args=$COMP_CWORD
@@ -426,7 +416,7 @@ _arch()
fi
} &&
-complete -F _arch $filenames arch
+complete -F _arch -o filenames arch
have cleanarch &&
_cleanarch()
@@ -434,10 +424,10 @@ _cleanarch()
local cur
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-s --status -n --dry-run -q --quiet -h \
+ COMPREPLY=( $( compgen -W '--status --dry-run --quiet \
--help' -- "$cur" ) )
fi
@@ -450,13 +440,12 @@ _inject()
local cur prev split=false
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
_split_longopt && split=true
- case "$prev" in
- -@(l|-listname))
+ case $prev in
+ -l|--listname)
_mailman_lists
return 0
;;
@@ -465,14 +454,13 @@ _inject()
$split && return 0
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-l --listname -q --queue -h --help' \
- -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '--listname --queue --help' -- "$cur" ) )
else
_filedir
fi
} &&
-complete -F _inject $filenames inject
+complete -F _inject -o filenames inject
have dumpdb &&
_dumpdb()
@@ -480,17 +468,17 @@ _dumpdb()
local cur
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--marshal -m --pickle -p --noprint -n -h \
+ COMPREPLY=( $( compgen -W '--marshal --pickle --noprint \
--help' -- "$cur" ) )
else
_filedir
fi
} &&
-complete -F _dumpdb $filenames dumpdb
+complete -F _dumpdb -o filenames dumpdb
have check_db &&
_check_db()
@@ -498,11 +486,10 @@ _check_db()
local cur
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--all -a --verbose -v -h --help' \
- -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '--all --verbose --help' -- "$cur" ) )
else
_mailman_lists
fi
@@ -516,7 +503,7 @@ _check_perms()
local cur
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-f -v -h' -- "$cur" ) )
@@ -531,10 +518,10 @@ _genaliases()
local cur
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-q --quiet -h --help' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '--quiet --help' -- "$cur" ) )
fi
} &&
@@ -546,10 +533,10 @@ _mmsitepass()
local cur
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-c --listcreator -h --help' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '--listcreator --help' -- "$cur" ) )
fi
} &&
@@ -561,14 +548,13 @@ _qrunner()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
_split_longopt && return 0
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-r --runner --once -o \
- -l --list -v --verbose -s --subproc -h --help' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '--runner --once \
+ --list --verbose --subproc --help' -- "$cur" ) )
fi
} &&
@@ -580,11 +566,11 @@ _mailmanctl()
local cur
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-n --no-restart -u --run-as-user \
- -s --stale-lock-cleanup --quiet -q -h --help' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '--no-restart --run-as-user \
+ --stale-lock-cleanup --quiet --help' -- "$cur" ) )
else
COMPREPLY=( $( compgen -W 'start stop restart reopen' -- "$cur" ) )
fi
diff --git a/contrib/make b/contrib/make
index ecbd56e3..e792b348 100644
--- a/contrib/make
+++ b/contrib/make
@@ -6,13 +6,12 @@ _make()
local file makef makef_dir="." makef_inc cur prev i split=false
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
_split_longopt && split=true
case $prev in
- -@(f|o|W|-@(?(make|old-|new-)file|assume-@(old|new)|what-if)))
+ -f|-o|-W|--file|--makefile|--old-file|--new-file|--assume-old|--assume-new|--what-if)
_filedir
return 0
;;
@@ -39,9 +38,9 @@ _make()
--warn-undefined-variables' -- "$cur" ) )
else
# before we check for makefiles, see if a path was specified
- # with -C
+ # with -C/--directory
for (( i=0; i < ${#COMP_WORDS[@]}; i++ )); do
- if [[ ${COMP_WORDS[i]} == -C ]]; then
+ if [[ ${COMP_WORDS[i]} == -@(C|-directory) ]]; then
# eval for tilde expansion
eval makef_dir=${COMP_WORDS[i+1]}
break
@@ -49,9 +48,9 @@ _make()
done
# before we scan for targets, see if a Makefile name was
- # specified with -f
+ # specified with -f/--file/--makefile
for (( i=0; i < ${#COMP_WORDS[@]}; i++ )); do
- if [[ ${COMP_WORDS[i]} == -f ]]; then
+ if [[ ${COMP_WORDS[i]} == -@(f|-?(make)file) ]]; then
# eval for tilde expansion
eval makef=${COMP_WORDS[i+1]}
break
@@ -68,7 +67,7 @@ _make()
fi
} &&
-complete -F _make $filenames make gmake gnumake pmake
+complete -F _make -o filenames make gmake gnumake pmake
# Local variables:
# mode: shell-script
diff --git a/contrib/man b/contrib/man
index 4804a949..a3360b2e 100644
--- a/contrib/man
+++ b/contrib/man
@@ -7,12 +7,11 @@ _man()
{
local cur i prev sect manpath manext mansect uname
- manext="@([0-9lnp]|[0-9][px]|man|3pm)?(.@(gz|bz2|lzma))"
+ manext="@([0-9lnp]|[0-9][px]|man|3pm)?(.@([gx]z|bz2|lzma|Z))"
mansect="@([0-9lnp]|[0-9][px]|3pm)"
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
if [[ "$prev" == -l ]]; then
_filedir $manext
@@ -54,7 +53,7 @@ _man()
# weed out directory path names and paths to man pages
COMPREPLY=( ${COMPREPLY[@]##*/?(:)} )
# strip suffix from man pages
- COMPREPLY=( ${COMPREPLY[@]%.@(gz|bz2|lzma)} )
+ COMPREPLY=( ${COMPREPLY[@]%.@([gx]z|bz2|lzma|Z)} )
COMPREPLY=( $( compgen -W '${COMPREPLY[@]%.*}' -- "${cur//\\\\/}" ) )
if [[ "$prev" != $mansect ]]; then
@@ -72,7 +71,7 @@ _man()
[ $USERLAND = GNU -o $UNAME = Darwin \
-o $UNAME = FreeBSD -o $UNAME = SunOS -o $UNAME = Cygwin \
-o $UNAME = OpenBSD ] && \
-complete -F _man $filenames man apropos whatis
+complete -F _man -o filenames man apropos whatis
# Local variables:
# mode: shell-script
diff --git a/contrib/mc b/contrib/mc
index c834e05e..910fef13 100644
--- a/contrib/mc
+++ b/contrib/mc
@@ -6,12 +6,11 @@ _mc()
local cur prev split=false
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
_split_longopt && split=true
- case "$prev" in
+ case $prev in
-e|--edit|-v|--view|-l|--ftplog|-P|--printwd)
_filedir
return 0
@@ -29,17 +28,15 @@ _mc()
$split && return 0
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-a --stickchars -b --nocolor -c \
- --color -C --colors -d --nomouse -e --edit -f \
- --datadir -k --resetsoft -l --ftplog -P --printwd \
- -s --slow -t --termcap -u --nosubshell -U --subshell \
- -v --view -V --version -x --xterm -D --debuglevel -h \
- --help' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '--stickchars --nocolor --color --colors \
+ --nomouse --edit --datadir --resetsoft --ftplog --printwd --slow \
+ --termcap --nosubshell --subshell --view --version --xterm \
+ --debuglevel --help' -- "$cur" ) )
else
_filedir -d
fi
} &&
-complete -F _mc $filenames mc
+complete -F _mc -o filenames mc
# Local variables:
# mode: shell-script
diff --git a/contrib/mcrypt b/contrib/mcrypt
index 3ee8c41e..e777150f 100644
--- a/contrib/mcrypt
+++ b/contrib/mcrypt
@@ -6,58 +6,57 @@ _mcrypt()
local cur prev i decrypt
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
- case "$prev" in
- -@(g|-openpgp-z))
+ case $prev in
+ -g|--openpgp-z)
COMPREPLY=( $( compgen -W '0 1 2 3 4 5 6 7 8 9' -- "$cur" ) )
return 0
;;
- -@(o|-keymode))
+ -o|--keymode)
COMPREPLY=( $( compgen -W '$( mcrypt --list-keymodes \
2>/dev/null )' -- "$cur" ) )
return 0
;;
- -@(m|-mode))
+ -m|--mode)
COMPREPLY=( $( compgen -W "$( mcrypt --list \
2>/dev/null | sed -e 's/.*: //' -e 's/ $//' | \
- sort | uniq )" -- "$cur" ) )
+ sort -u )" -- "$cur" ) )
return 0
;;
- -@(a|-algorithm))
+ -a|--algorithm)
COMPREPLY=( $( compgen -W "$( mcrypt --list 2>/dev/null | \
awk '{print $1}' )" -- "$cur" ) )
return 0
;;
- -@(h|-hash))
+ -h|--hash)
COMPREPLY=( $( compgen -W '$( mcrypt --list-hash 2>/dev/null | \
sed -e 1d )' -- "$cur" ) )
return 0
;;
- -@(k|s|-@(key?(size))))
+ -k|-s|--key|--keysize)
return 0
;;
- -@(f|c|-@(keyfile|config)))
+ -f|-c|--keyfile|--config)
_filedir
return 0
;;
- --@(algorithm|mode)s-directory)
+ --algorithms-directory|--modes-directory)
_filedir -d
return 0
;;
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-g --openpgp --openpgp-z -d \
- --decrypt -s --keysize -o --keymode -f --keyfile \
- -c --config -a --algorithm --algorithms-directory \
- -m --mode --modes-directory -h --hash -k --key \
- --noiv -b --bare -z --gzip -p --bzip2 --flush -l \
- --doublecheck -u --unlink --nodelete -t --time -F \
- --force --echo -r --random --list --list-keymodes \
- --list-hash -V --verbose -q --quiet --help -v \
- --version -L --license' -- "$cur" ) )
+ 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
_filedir '@(nc)'
else
@@ -74,7 +73,7 @@ _mcrypt()
fi
fi
} &&
-complete $filenames -F _mcrypt mcrypt mdecrypt
+complete -o filenames -F _mcrypt mcrypt mdecrypt
# Local variables:
# mode: shell-script
diff --git a/contrib/mdadm b/contrib/mdadm
index 0847b61f..9cbaad7b 100644
--- a/contrib/mdadm
+++ b/contrib/mdadm
@@ -1,17 +1,18 @@
# bash completion for mdadm
-have mdadm && {
+have mdadm &&
+{
_mdadm_raid_level()
{
local mode
for (( i=1; i < COMP_CWORD; i++ )); do
case ${COMP_WORDS[i]} in
- -@(C|-create))
+ -C|--create)
mode=create
break
;;
- -@(B|-build))
+ -B|--build)
mode=build
break
;;
@@ -71,102 +72,76 @@ _mdadm_update_flag()
_mdadm()
{
- local cur prev mode options
+ local cur prev mode options split=false
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
+
+ _split_longopt && split=true
- # --name value style option
case $prev in
- -@(c|b))
+ -c|--config|-b|--bitmap|--backup-file)
_filedir
return 0
;;
- -l)
+ -l|--level)
_mdadm_raid_level
return 0
;;
- -p)
+ -p|--layout|--parity)
_mdadm_raid_layout
return 0
;;
- -a)
+ -a|--auto)
_mdadm_auto_flag
return 0
;;
- -U)
+ -U|--update)
_mdadm_update_flag
return 0
;;
esac
- # --name=value style option
- if [[ "$cur" == *=* ]]; then
- prev=${cur/=*/}
- cur=${cur/*=/}
- case "$prev" in
- --@(config|bitmap|backup-file))
- _filedir
- return 0
- ;;
- --level)
- _mdadm_raid_level
- return 0
- ;;
- --@(layout|parity))
- _mdadm_raid_layout
- return 0
- ;;
- --auto)
- _mdadm_auto_flag
- return 0
- ;;
- --update)
- _mdadm_update_flag
- return 0
- ;;
- esac
- fi
+ $split && return 0
- options='-h --help --help-options -V --version -v --verbose -q --quiet -b \
- --brief -f --force -c --config= -s --scan -e --metadata= --homehost='
+ options='--help --help-options --version --verbose --quiet \
+ --brief --force --config --scan --metadata --homehost'
if [[ "$cur" == -* ]]; then
if [[ $COMP_CWORD -eq 1 ]] ; then
- COMPREPLY=( $( compgen -W "$options -A --assemble -B --build -C \
- --create -F --follow --monitor -G --grow" -- "$cur" ) )
+ COMPREPLY=( $( compgen -W "$options --assemble --build \
+ --create --monitor --grow" -- "$cur" ) )
else
case ${COMP_WORDS[COMP_CWORD-1]} in
- -@(A|-assemble))
- COMPREPLY=( $( compgen -W "$options -u --uuid= -m \
- --super-minor= -N --name= -f --force -R --run \
- --no-degraded -a --auto -b --bitmap= --backup-file= \
- -U --update= --auto-update-homehost" -- "$cur" ) )
+ -A|--assemble)
+ 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 -n --raid-devices= -x \
- --spare-devices= -z --size= -c --chunk= --rounding= -l \
- --level= -p --layout= --parity= -b --bitmap= \
- --bitmap-chunk= -W --write-mostly --write-behind= \
- --assume-clean --backup-file= -N --name= -R --run -f \
- --force -a --auto" -- "$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" ) )
;;
- -@(F|-follow|-monitor))
- COMPREPLY=( $( compgen -W "$options -m --mail -p --program \
- --alert -y --syslog -d --delay -f --daemonise -i \
- --pid-file -1 --oneshot -t --test" -- "$cur" ) )
+ -F|--follow|--monitor)
+ COMPREPLY=( $( compgen -W "$options --mail --program \
+ --alert --syslog --delay --daemonise \
+ --pid-file --oneshot --test" -- "$cur" ) )
;;
- @(/dev/*|--add|--fail|--remove))
- COMPREPLY=( $( compgen -W "$options -a --add --re-add -r \
- --remove -f --fail --set-faulty" -- "$cur" ) )
+ /dev/*|--add|--fail|--remove)
+ COMPREPLY=( $( compgen -W "$options --add --re-add \
+ --remove --fail --set-faulty" -- "$cur" ) )
;;
*)
- COMPREPLY=( $( compgen -W "$options -Q --query -D --detail \
- -E --examine --sparc2.2 -X --examine-bitmap -R --run \
- -S --stop -o --readonly -w --readwrite \
- --zero-superblock -t --test" -- "$cur" ) )
+ COMPREPLY=( $( compgen -W "$options --query --detail \
+ --examine --sparc2.2 --examine-bitmap --run \
+ --stop --readonly --readwrite \
+ --zero-superblock --test" -- "$cur" ) )
;;
esac
fi
diff --git a/contrib/medusa b/contrib/medusa
new file mode 100644
index 00000000..d8dcfe41
--- /dev/null
+++ b/contrib/medusa
@@ -0,0 +1,41 @@
+# bash completion for medusa
+
+have medusa &&
+_medusa()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=`_get_pword`
+
+ case $prev in
+ -h)
+ _known_hosts_real "$cur"
+ return 0
+ ;;
+ -H|-U|-P|-C|-O)
+ _filedir
+ return 0
+ ;;
+ -M)
+ COMPREPLY=( $( compgen -W "$(medusa -d | awk '/^ +\+/ {print $2}' \
+ | sed -e 's/\.mod$//')" ) )
+ return 0
+ ;;
+ 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" ) )
+ 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/contrib/minicom b/contrib/minicom
index 4b6a9e71..76553317 100644
--- a/contrib/minicom
+++ b/contrib/minicom
@@ -6,20 +6,19 @@ _minicom()
local cur prev confdir
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
case $prev in
- -@(a|c))
+ -a|-c)
COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) )
return 0
;;
- -@(S|C))
+ -S|-C)
_filedir
return 0
;;
-P)
- COMPREPLY=( $( command ls /dev/tty* ) )
+ COMPREPLY=( $( printf '%s\n' /dev/tty* ) )
COMPREPLY=( $( compgen -W '${COMPREPLY[@]} ${COMPREPLY[@]#/dev/}' \
-- "$cur" ) )
return 0
@@ -37,13 +36,13 @@ _minicom()
[ -n "$( command ls /etc/minicom/minirc.* 2>/dev/null)" ] \
&& confdir=/etc/minicom
if [ -n "$confdir" ]; then
- COMPREPLY=( $( compgen -W '$( command ls $confdir/minirc.* | \
+ COMPREPLY=( $( compgen -W '$( printf "%s\n" $confdir/minirc.* | \
sed -e "s|$confdir/minirc.||")' -- "$cur" ) )
return 0
fi
fi
} &&
-complete -F _minicom $default minicom
+complete -F _minicom -o default minicom
# Local variables:
# mode: shell-script
diff --git a/contrib/mkinitrd b/contrib/mkinitrd
index 040ab2ad..48893471 100644
--- a/contrib/mkinitrd
+++ b/contrib/mkinitrd
@@ -6,17 +6,16 @@ _mkinitrd()
local cur prev args split=false
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
_split_longopt && split=true
- case "$prev" in
- --@(preload|with|builtin))
+ case $prev in
+ --preload|--with|--builtin)
_modules
return 0
;;
- --@(fstab|dsdt))
+ --fstab|--dsdt)
_filedir
return 0
;;
diff --git a/contrib/module-init-tools b/contrib/module-init-tools
new file mode 100644
index 00000000..8c0f13ea
--- /dev/null
+++ b/contrib/module-init-tools
@@ -0,0 +1,61 @@
+# 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 -o filenames 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/contrib/monodevelop b/contrib/monodevelop
index 5ec82021..1aa117b0 100644
--- a/contrib/monodevelop
+++ b/contrib/monodevelop
@@ -4,7 +4,7 @@ have monodevelop &&
_monodevelop()
{
local cur
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-? -help -help2 -ipc-tcp -newwindow -nologo \
@@ -23,8 +23,7 @@ _mdtool()
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _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
@@ -39,7 +38,7 @@ _mdtool()
-S":" -- "$cur" ) )
# TODO: This does not work :(
#if [[ "$prev" == *: ]]; then
- # case "$prev" in
+ # case $prev in
# @(--p:|--project:))
# COMPREPLY=( $( compgen -f -G "*.mdp" -- "$cur" ) )
# ;;
@@ -51,7 +50,7 @@ _mdtool()
return 0
;;
"generate-makefiles")
- COMPREPLY=( $( compgen $filenames -G"*.mds" -- "$cur" ) )
+ COMPREPLY=( $( compgen -o filenames -G"*.mds" -- "$cur" ) )
if [[ "$prev" == *mds ]]; then
COMPREPLY=( $( compgen -W '--simple-makefiles --s --d:' \
-- "$cur" ) )
@@ -75,7 +74,7 @@ _mdtool()
return 0
} &&
-complete -F _mdtool $filenames mdtool
+complete -F _mdtool -o filenames mdtool
# Local variables:
# mode: shell-script
diff --git a/contrib/mount b/contrib/mount
new file mode 100644
index 00000000..b14eef3e
--- /dev/null
+++ b/contrib/mount
@@ -0,0 +1,165 @@
+# mount(8) completion. 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!
+#
+# This will correctly escape special characters in COMPREPLY.
+_reply_compgen_array()
+{
+ # Create the argument for compgen -W by escaping twice.
+ #
+ # One round of escape is because we want to reply with escaped arguments. A
+ # second round is required because compgen -W will helpfully expand it's
+ # argument.
+ local i wlist
+ for i in ${!COMPREPLY[*]}; do
+ local q=$(quote "$(printf %q "${COMPREPLY[$i]}")")
+ wlist+=$q$'\n'
+ done
+
+ # We also have to add another round of escaping to $cur.
+ local ecur="$cur"
+ ecur="${ecur//\\/\\\\}"
+ ecur="${ecur//\'/\'}"
+
+ # Actually generate completions.
+ local oldifs=$IFS
+ IFS=$'\n' eval 'COMPREPLY=(`compgen -W "$wlist" -- "${ecur}"`)'
+ IFS=$oldifs
+}
+
+# Unescape strings in the linux fstab(5) format (with octal escapes).
+__linux_fstab_unescape() {
+ eval $1="'${!1//\'/\047}'"
+ eval $1="'${!1/%\\/\\\\}'"
+ eval "$1=$'${!1}'"
+}
+
+# Complete linux fstab entries.
+#
+# Reads a file from stdin in the linux fstab(5) format; as used by /etc/fstab
+# and /proc/mounts.
+_linux_fstab()
+{
+ COMPREPLY=()
+
+ # Read and unescape values into COMPREPLY
+ local fs_spec fs_file fs_other
+ local oldifs="$IFS"
+ while read -r fs_spec fs_file fs_other; do
+ if [[ $fs_spec = [#]* ]]; then continue; fi
+ if [[ $1 == -L ]]; then
+ local fs_label=${fs_spec/#LABEL=}
+ if [[ $fs_label != "$fs_spec" ]]; then
+ __linux_fstab_unescape fs_label
+ IFS=$'\0'
+ COMPREPLY+=("$fs_label")
+ IFS=$oldifs
+ fi
+ else
+ __linux_fstab_unescape fs_spec
+ __linux_fstab_unescape fs_file
+ IFS=$'\0'
+ [[ $fs_spec = */* ]] && COMPREPLY+=("$fs_spec")
+ [[ $fs_file = */* ]] && COMPREPLY+=("$fs_file")
+ IFS=$oldifs
+ fi
+ done
+
+ _reply_compgen_array
+}
+
+_mount()
+{
+ local cur sm host prev
+
+ COMPREPLY=()
+ _get_comp_words_by_ref -n : cur prev
+
+ case $prev in
+ -t|--types)
+ _fstypes
+ return 0
+ ;;
+ esac
+
+ [[ "$cur" == \\ ]] && cur="/"
+
+ if [[ "$cur" == *:* ]]; then
+ for sm in "$(type -P showmount)" {,/usr}/{,s}bin/showmount; do
+ [ -x "$sm" ] || continue
+ COMPREPLY=( $( compgen -W "$( "$sm" -e ${cur%%:*} | \
+ awk 'NR>1 {print $1}' )" -- "${cur#*:}" ) )
+ return 0
+ done
+ fi
+
+ if [[ "$cur" == //* ]]; then
+ host=${cur#//}
+ host=${host%%/*}
+ if [ -n "$host" ]; then
+ COMPREPLY=( $( compgen -P "//$host" -W \
+ "$( smbclient -d 0 -NL $host 2>/dev/null |
+ sed -ne '/^['"$'\t '"']*Sharename/,/^$/p' |
+ sed -ne '3,$s|^[^A-Za-z]*\([^'"$'\t '"']*\).*$|/\1|p' )" \
+ -- "${cur#//$host}" ) )
+ fi
+ elif [ -r /etc/vfstab ]; then
+ # Solaris
+ COMPREPLY=( $( compgen -W "$( awk '! /^[ \t]*#/ {if ($3 ~ /\//) print $3}' /etc/vfstab )" -- "$cur" ) )
+ elif [ ! -e /etc/fstab ]; then
+ # probably Cygwin
+ COMPREPLY=( $( compgen -W "$( mount | awk '! /^[ \t]*#/ {if ($3 ~ /\//) print $3}' )" -- "$cur" ) )
+ else
+ # probably Linux
+ if [ "$prev" = -L ]; then
+ _linux_fstab -L < /etc/fstab
+ elif [ "$prev" = -U ]; then
+ COMPREPLY=( $( compgen -W '$(sed -ne "s/^[[:space:]]*UUID=\([^[:space:]]*\).*/\1/p" /etc/fstab )' -- "$cur" ) )
+ else
+ _linux_fstab < /etc/fstab
+ fi
+ fi
+
+ return 0
+} &&
+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=()
+
+ if [[ $(uname -s) = 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
+ else
+ local IFS=$'\n'
+ COMPREPLY=( $( compgen -W '$( mount | cut -d" " -f 3 )' -- "$cur" ) )
+ fi
+
+ return 0
+} &&
+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/contrib/mplayer b/contrib/mplayer
index 5c8d8f74..63af3122 100644
--- a/contrib/mplayer
+++ b/contrib/mplayer
@@ -15,11 +15,10 @@ _mplayer()
COMPREPLY=()
cmd=${COMP_WORDS[0]}
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
- case "$prev" in
- -@([av][cfo]|[av]fm|vop|fstype|demuxer|o[av]c|of|profile))
+ case $prev in
+ -[av][cfo]|-[av]fm|-vop|-fstype|-demuxer|-o[av]c|-of|-profile)
_mplayer_options_list $cmd $prev
return 0
;;
@@ -39,10 +38,10 @@ _mplayer()
_filedir '@(idx|IDX|ifo|IFO|sub|SUB)'
IFS=$'\t\n'
COMPREPLY=( $( for i in "${COMPREPLY[@]}"; do
- if [ -f $i -a -r $i ]; then
- echo ${i%.*}
+ if [[ -f $i && -r $i ]]; then
+ printf '%s\n' ${i%.*}
else
- echo $i
+ printf '%s\n' $i
fi
done ) )
IFS=$' \t\n'
@@ -67,7 +66,7 @@ _mplayer()
IFS=$'\t\n'
for i in ~/.mplayer/Skin $skinsdir; do
- if [ -d $i -a -r $i ]; then
+ if [[ -d $i && -r $i ]]; then
for j in $( compgen -d $i/$cur ); do
COMPREPLY[$k]=${j#$i/}
k=$((++k))
@@ -77,30 +76,42 @@ _mplayer()
IFS=$' \t\n'
return 0
;;
- -@(mixer|@(cdrom|dvd)-device|dvdauth|fb|zrdev))
+ -cdrom-device)
+ _cd_devices
+ _dvd_devices
+ return 0
+ ;;
+ -dvd-device)
+ _dvd_devices
+ return 0
+ ;;
+ -mixer|-dvdauth|-fb|-zrdev)
cur=${cur:=/dev/}
_filedir
return 0
;;
- -@(edl?(out)|lircconf|menu-cfg|playlist|csslib|dumpfile)| \
- -@(subfile|vobsub|aofile|fbmodeconfig|include|o|dvdkey)| \
+ -edl|-edlout|-lircconf|-menu-cfg|-playlist|-csslib|-dumpfile| \
+ -subfile|-vobsub|-aofile|-fbmodeconfig|-include|-o|-dvdkey| \
-passlogfile)
_filedir
return 0
;;
- -@(auto@(q|sync)|loop|menu-root|speed|sstep|aid|alang)| \
- -@(?(@(audio|sub)-)demuxer|bandwidth|cache|chapter)| \
- -@(dvd?(angle)|fps|frames|mc|passwd|user|sb|srate|ss|vcd)| \
- -@(vi?(d|vo)|ffactor|sid|slang|spu@(align|aa|gauss))| \
- -@(vobsubid|delay|bpp|brightness|contrast|dfbopts|display)| \
- -@(fbmode|geometry|guiwid|hue|icelayer|screen[wh]|wid)| \
- -@(monitor@(aspect|-@(dotclock|[hv]freq))|panscan|saturation)| \
- -@(xineramascreen|zr@(crop|norm|quality|[xy]doff|[vh]dec))| \
- -@(aspect|pp|x|y|xy|z|stereo|audio-@(density|delay|preload))| \
- -@(endpos|osdlevel|ffourcc|sws|channels|skiplimit|format)| \
- -@(ofps|aa@(driver|@(osd|sub)color)|vobsubout?(i@(ndex|d)))| \
- -sub@(-bg-@(alpha|color)|cp|delay|fps|pos|align|width)| \
- -sub@(font-@(blur|outline|autoscale|encoding|@(osd|text)-scale)))
+ -autoq|-autosync|-loop|-menu-root|-speed|-sstep|-aid|-alang| \
+ -audo-demuxer|-sub-demuxer|-demuxer|-bandwidth|-cache|-chapter| \
+ -dvd|-dvdangle|-fps|-frames|-mc|-passwd|-user|-sb|-srate|-ss|-vcd| \
+ -vi|-vid|-vivo|-ffactor|-sid|-slang|-spualign|-spuaa|-spugauss| \
+ -vobsubid|-delay|-bpp|-brightness|-contrast|-dfbopts|-display| \
+ -fbmode|-geometry|-guiwid|-hue|-icelayer|-screen[wh]|-wid| \
+ -monitoraspect|-monitor-dotclock|-monitor-[hv]freq|-panscan| \
+ -saturation|-xineramascreen|-zrcrop|-zrnorm|-zrquality| \
+ -zr[xy]doff|-zr[vh]dec|-aspect|-pp|-x|-y|-xy|-z|-stereo| \
+ -audio-density|-audio-delay|-audio-preload|-endpos|-osdlevel| \
+ -ffourcc|-sws|-channels|-skiplimit|-format|-ofps|-aadriver| \
+ -aaosdcolor|-aasubcolor|-vobsubout|-vobsuboutid|-vobsuboutindex| \
+ -sub-bg-alpha|-sub-bg-color|-sub-cp|-sub-delay|-sub-fps|-sub-pos| \
+ -sub-align|-sub-width|-subfont-blur|-subfont-outline| \
+ -subfont-autoscale|-subfont-encoding|-subfont-osd-scale| \
+ -subfont-osd-text)
return 0
;;
-lavdopts)
@@ -118,10 +129,11 @@ _mplayer()
scplx_mask= naq ildct format= pred qpel precmp= cmp= subcmp= \
predia= dia= trell last_pred= preme= subq= psnr mpeg_quant aic \
umv' -- "$cur" ) )
- return 0
- ;;
- -ssf)
- COMPREPLY=( $( compgen -W 'lgb= cgb= ls= cs= chs= cvs=' -- "$cur" ) )
+ return 0
+ ;;
+ -ssf)
+ COMPREPLY=( $( compgen -W 'lgb= cgb= ls= cs= chs= cvs=' \
+ -- "$cur" ) )
return 0
;;
-jpeg)
@@ -216,21 +228,21 @@ _mplayer()
;;
esac
- case "$cur" in
+ case $cur in
-*)
COMPREPLY=( $( compgen -W '$( $cmd -list-options 2>/dev/null | \
sed -ne '1,/^[[:space:]]*Name/d' \
-e "s/^[[:space:]]*/-/" -e "s/[[:space:]:].*//" \
- -e "/^-\(Total\|.*\*\)\?$/!p" )' -- "$cur" ) )
+ -e "/^-\(Total\|.*\*\)\{0,1\}$/!p" )' -- "$cur" ) )
;;
*)
- _filedir '@(mp?(e)g|MP?(E)G|wm[av]|WM[AV]|avi|AVI|asf|ASF|vob|VOB|bin|BIN|dat|DAT|vcd|VCD|ps|PS|pes|PES|fl[iv]|FL[IV]|viv|VIV|rm?(j)|RM?(J)|ra?(m)|RA?(M)|yuv|YUV|mov|MOV|qt|QT|mp[234]|MP[234]|m4[av]|M4[AV]|og[gmavx]|OG[GMAVX]|w?(a)v|W?(A)V|dump|DUMP|mk[av]|MK[AV]|m4a|M4A|aac|AAC|m[24]v|M[24]V|dv|DV|rmvb|RMVB|mid|MID|ts|TS|3g[p2]|mpc|MPC|flac|FLAC|vro|VRO|divx|DIVX|aif?(f)|AIF?(F)|m2ts|M2TS|vdr|VDR|xvid|XVID|ape|APE)'
+ _filedir '@(mp?(e)g|MP?(E)G|wm[av]|WM[AV]|avi|AVI|asf|ASF|vob|VOB|bin|BIN|dat|DAT|vcd|VCD|ps|PS|pes|PES|fl[iv]|FL[IV]|fxm|FXM|viv|VIV|rm?(j)|RM?(J)|ra?(m)|RA?(M)|yuv|YUV|mov|MOV|qt|QT|mp[234]|MP[234]|m4[av]|M4[AV]|og[gmavx]|OG[GMAVX]|w?(a)v|W?(A)V|dump|DUMP|mk[av]|MK[AV]|m4a|M4A|aac|AAC|m[24]v|M[24]V|dv|DV|rmvb|RMVB|mid|MID|t[ps]|T[PS]|3g[p2]|mpc|MPC|flac|FLAC|vro|VRO|divx|DIVX|aif?(f)|AIF?(F)|m2ts|M2TS|vdr|VDR|xvid|XVID|ape|APE)'
;;
esac
return 0
}
-complete $filenames -F _mplayer mplayer mencoder gmplayer kplayer
+complete -o filenames -F _mplayer mplayer mencoder gmplayer kplayer
}
# Local variables:
diff --git a/contrib/msynctool b/contrib/msynctool
index 31923050..3f9afb7f 100644
--- a/contrib/msynctool
+++ b/contrib/msynctool
@@ -6,11 +6,7 @@ _msynctool()
local cur prev anteprev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
- if [ $COMP_CWORD -ge 2 ]; then
- anteprev=${COMP_WORDS[COMP_CWORD-2]}
- fi
+ _get_comp_words_by_ref cur prev anteprev
case $anteprev in
--configure)
@@ -27,12 +23,12 @@ _msynctool()
esac
case $prev in
- --@(configure|@(add|del|show)group|sync|addmember))
+ --configure|--addgroup|--delgroup|--showgroup|--sync|--addmember)
COMPREPLY=( $( compgen -W '$(msynctool --listgroups \
| sed -e '1d' )' -- "$cur" ) )
return 0
;;
- --@(showformats|filter-objtype|slow-sync))
+ --showformats|--filter-objtype|--slow-sync)
COMPREPLY=( $( compgen -W '$(msynctool --listobjects \
| sed -e '1d' )' -- "$cur" ) )
return 0
diff --git a/contrib/mtx b/contrib/mtx
index 4b20ba70..0454f032 100644
--- a/contrib/mtx
+++ b/contrib/mtx
@@ -6,8 +6,7 @@ _mtx()
local cur prev options tapes drives
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
options="-f nobarcode invert noattach --version inquiry noattach \
inventory status load unload eepos first last next"
diff --git a/contrib/munin-node b/contrib/munin-node
index 2753fc2a..abf2b0f6 100644
--- a/contrib/munin-node
+++ b/contrib/munin-node
@@ -1,20 +1,19 @@
# bash completion for munin node
have munin-run &&
-_munin-run()
+_munin_run()
{
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
case $prev in
- --@(config|sconffile))
+ --config|--sconffile)
_filedir
return 0
;;
- --@(service|sconf)dir)
+ --servicedir|--sconfdir)
_filedir -d
return 0
;;
@@ -28,16 +27,28 @@ _munin-run()
-- "$cur" ) )
fi
} &&
-complete -F _munin-run munin-run
+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()
+_munin_update()
{
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
case $prev in
--config)
@@ -56,23 +67,22 @@ _munin-update()
--fork --nofork --stdout --nostdout --timeout' -- "$cur" ) )
fi
} &&
-complete -F _munin-update munin-update
+complete -F _munin_update munin-update
have munin-node-configure &&
-_munin-node-configure()
+_munin_node_configure()
{
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
case $prev in
--config)
_filedir
return 0
;;
- --@(service|lib)dir)
+ --servicedir|--libdir)
_filedir -d
return 0
;;
@@ -92,7 +102,7 @@ _munin-node-configure()
--remove-also --snmp --snmpversion --snmpcommunity' -- "$cur" ) )
fi
} &&
-complete -F _munin-node-configure munin-node-configure
+complete -F _munin_node_configure munin-node-configure
# Local variables:
# mode: shell-script
diff --git a/contrib/mutt b/contrib/mutt
index 62540bde..fc12e690 100644
--- a/contrib/mutt
+++ b/contrib/mutt
@@ -4,17 +4,50 @@
# 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
- _muttquery
+ _muttaliases "$1"
+ _muttquery "$1"
- cur=`_get_cword`
- COMPREPLY=( "${COMPREPLY[@]}" $( compgen -u -- "$cur" ) )
+ COMPREPLY=( "${COMPREPLY[@]}" $( compgen -u -- "$1" ) )
return 0
-}
+} # _muttaddr()
+
+
+# Find muttrc to use
+# @output muttrc filename
+_muttrc()
+{
+ # Search COMP_WORDS for '-F muttrc' or '-Fmuttrc' argument
+ set -- "${COMP_WORDS[@]}"
+ while [ $# -gt 0 ]; do
+ if [ "${1:0:2}" = -F ]; then
+ if [ ${#1} -gt 2 ]; then
+ muttrc="$(dequote "${1:2}")"
+ else
+ shift
+ [ "$1" ] && muttrc="$(dequote "$1")"
+ fi
+ break
+ fi
+ shift
+ done
+
+ if [ -z "$muttrc" ]; then
+ [ -f ~/.${muttcmd}/${muttcmd}rc ] && muttrc="~/.${muttcmd}/${muttcmd}rc"
+ [ -f ~/.${muttcmd}rc ] && muttrc="~/.${muttcmd}rc"
+ fi
+ printf "%s" "$muttrc"
+} # _muttrc()
+
+# Recursively build list of sourced config files
+# @param $1 List of config files found so far
+# @param $2 Config file to process
+# @output List of config files
_muttconffiles()
{
local file sofar
@@ -23,47 +56,49 @@ _muttconffiles()
sofar=" $1 "
shift
while [[ "$1" ]]; do
- newconffiles=( $(sed -rn 's|^source[[:space:]]+([^[:space:]]+).*$|\1|p' $(eval echo $1) ) )
+ newconffiles=( $(sed -n 's|^source[[:space:]]\{1,\}\([^[:space:]]\{1,\}\).*$|\1|p' $(eval echo $1) ) )
for file in "${newconffiles[@]}"; do
- [[ ! "$file" ]] || [[ "${sofar/ ${file} / }" != "$sofar" ]] &&
- continue
- sofar="$sofar $file"
- sofar=" $(eval _muttconffiles \"$sofar\" $file) "
+ [[ ! "$file" ]] || [[ "${sofar/ ${file} / }" != "$sofar" ]] &&
+ continue
+ sofar="$sofar $file"
+ sofar=" $(eval _muttconffiles \"$sofar\" $file) "
done
shift
done
- echo $sofar
-}
+ printf '%s\n' $sofar
+} # _muttconffiles()
+
+# @param $1 (cur) Current word to complete
_muttaliases()
{
- local cur muttrc muttcmd=${COMP_WORDS[0]}
+ local cur=$1 muttrc muttcmd=${COMP_WORDS[0]}
local -a conffiles aliases
- cur=`_get_cword =`
- [ -f ~/.${muttcmd}/${muttcmd}rc ] && muttrc="~/.${muttcmd}/${muttcmd}rc"
- [ -f ~/.${muttcmd}rc ] && muttrc="~/.${muttcmd}rc"
+ muttrc=$(_muttrc)
[ -z "$muttrc" ] && return 0
conffiles=( $(eval _muttconffiles $muttrc $muttrc) )
- aliases=( $( sed -rn 's|^alias[[:space:]]+([^[:space:]]+).*$|\1|p' \
+ aliases=( $( sed -n 's|^alias[[:space:]]\{1,\}\([^[:space:]]\{1,\}\).*$|\1|p' \
$(eval echo "${conffiles[@]}") ) )
COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "${aliases[*]}" -- "$cur" ) )
return 0
}
+
+# @param $1 (cur) Current word to complete
_muttquery()
{
- local cur querycmd muttcmd=${COMP_WORDS[0]}
+ local cur=$1 querycmd muttcmd=${COMP_WORDS[0]}
local -a queryresults
- cur=`_get_cword`
- querycmd="$( $muttcmd -Q query_command | sed -r 's|^query_command=\"(.*)\"$|\1|; s|%s|'$cur'|' )"
- if [ -z "$cur" -o -z "$querycmd" ]; then
+ querycmd="$( $muttcmd -Q query_command | sed -e 's|^query_command=\"\(.*\)\"$|\1|' -e 's|%s|'$cur'|' )"
+ if [[ -z "$cur" || -z "$querycmd" ]]; then
queryresults=()
else
- queryresults=( $( $querycmd | sed -nr '2,$s|^([^[:space:]]+).*|\1|p' ) )
+ queryresults=( $( $querycmd | \
+ sed -n '2,$s|^\([^[:space:]]\{1,\}\).*|\1|p' ) )
fi
COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "${queryresults[*]}" \
@@ -72,15 +107,15 @@ _muttquery()
return 0
}
+
+# @param $1 (cur) Current word to complete
_muttfiledir()
{
- local cur folder spoolfile muttcmd=${COMP_WORDS[0]}
- cur=`_get_cword`
+ local cur=$1 folder muttrc spoolfile muttcmd=${COMP_WORDS[0]}
- # This is currently not working so well. Perhaps this function should
- # just call _filedir() for the moment.
+ muttrc=$(_muttrc)
if [[ $cur == [=+]* ]]; then
- folder="$( $muttcmd -Q folder | sed -r 's|^folder=\"(.*)\"$|\1|' )"
+ folder="$( $muttcmd -F "$muttrc" -Q folder | sed -e 's|^folder=\"\(.*\)\"$|\1|' )"
: folder:=~/Mail
# Match any file in $folder beginning with $cur
@@ -89,53 +124,54 @@ _muttfiledir()
COMPREPLY=( ${COMPREPLY[@]#$folder/} )
return 0
elif [ "$cur" == !* ]; then
- spoolfile="$( $muttcmd -Q spoolfile | \
- sed -r 's|^spoolfile=\"(.*)\"$|\1|' )"
+ spoolfile="$( $muttcmd -F "$muttrc" -Q spoolfile | \
+ sed -e 's|^spoolfile=\"\(.*\)\"$|\1|' )"
[ ! -z "$spoolfile" ] && eval cur="${cur/^!/$spoolfile}";
fi
_filedir
return 0
-}
+} # _muttfiledir
+
_mutt()
{
local cur prev
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref -n =+! cur prev
+ #cur=`_get_cword =+!`
+ #prev=`_get_pword =+!`
COMPREPLY=()
- case "$cur" in
+ case $cur in
-*)
COMPREPLY=( $( compgen -W '-A -a -b -c -e -f -F -H -i -m -n \
-p -Q -R -s -v -x -y -z -Z -h' -- "$cur" ) )
return 0
;;
*)
- case "$prev" in
- -@(a|f|F|H|i))
- _muttfiledir
+ case $prev in
+ -a|-f|-F|-H|-i)
+ _muttfiledir "$cur"
return 0
;;
-A)
- _muttaliases
+ _muttaliases "$cur"
return 0
;;
- -@(e|m|Q|s|h|p|R|v|y|z|Z))
+ -e|-m|-Q|-s|-h|-p|-R|-v|-y|-z|-Z)
return 0
;;
*)
- _muttaddr
+ _muttaddr "$cur"
return 0
;;
esac
;;
esac
-
-}
-complete -F _mutt $default $filenames mutt muttng
-}
+} # _mutt()
+complete -F _mutt -o default -o filenames mutt muttng
+} # have mutt
# Local variables:
# mode: shell-script
diff --git a/contrib/mysqladmin b/contrib/mysqladmin
index 0a84de1e..a7e002d3 100644
--- a/contrib/mysqladmin
+++ b/contrib/mysqladmin
@@ -3,31 +3,64 @@
have mysqladmin &&
_mysqladmin()
{
- local cur prev
+ local cur prev split=false
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case "$prev" in
- -u)
- COMPREPLY=( $( compgen -u -- "$cur" ) )
- return 0
- ;;
- *)
- ;;
+ _get_comp_words_by_ref cur prev
+
+ _split_longopt && split=true
+
+ case $prev in
+ -u|--user)
+ COMPREPLY=( $( compgen -u -- "$cur" ) )
+ return 0
+ ;;
+ -h|--host)
+ _known_hosts_real "$cur"
+ return 0
+ ;;
+ --character-sets-dir|--ssl-capath)
+ _filedir -d
+ return 0
+ ;;
+ -S|--socket)
+ _filedir sock
+ return 0
+ ;;
+ --defaults-file|--defaults-extra-file)
+ _filedir
+ return 0
+ ;;
+ -c|--count|--default-character-set|-P|--port|-O|--set-variable|\
+ -i|--sleep|--ssl-ca|--ssl-cert|--ssl-cipher|--ssl-key|-w|--wait|\
+ --connect_timeout|--shutdown_timeout)
+ # Argument required but no completions available
+ return 0
+ ;;
+ '-?'|--help|-V|--version)
+ # All other options are noop with these
+ return 0
+ ;;
esac
- COMPREPLY=( $( compgen -W '-# -f -? -C -h -p -P -i -r -E -s -S -t -u \
- -v -V -w' -- "$cur" ) )
+ $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=( "${COMPREPLY[@]}" \
- $( compgen -W 'create drop extended-status flush-hosts flush-logs \
- flush-status flush-tables flush-threads flush-privileges kill \
- password ping processlist reload refresh shutdown status variables \
- version' -- "$cur" ) )
+ $( 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" ) )
} &&
-complete -F _mysqladmin mysqladmin
+complete -F _mysqladmin -o filenames mysqladmin
# Local variables:
# mode: shell-script
diff --git a/contrib/ncftp b/contrib/ncftp
index 6d5a611a..b831f444 100644
--- a/contrib/ncftp
+++ b/contrib/ncftp
@@ -6,16 +6,16 @@ _ncftp()
local cur
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
- if [ $COMP_CWORD -eq 1 ] && [ -f ~/.ncftp/bookmarks ]; then
+ if [[ $COMP_CWORD -eq 1 && -f ~/.ncftp/bookmarks ]]; then
COMPREPLY=( $( compgen -W '$( sed -ne "s/^\([^,]\{1,\}\),.*$/\1/p" \
~/.ncftp/bookmarks )' -- "$cur" ) )
fi
return 0
} &&
-complete -F _ncftp $default ncftp
+complete -F _ncftp -o default ncftp
# Local variables:
# mode: shell-script
diff --git a/contrib/net-tools b/contrib/net-tools
index b3bf8615..5b86a64a 100644
--- a/contrib/net-tools
+++ b/contrib/net-tools
@@ -6,8 +6,7 @@ _mii_tool()
local cur prev split=false
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
_split_longopt && split=true
@@ -27,14 +26,13 @@ _mii_tool()
$split && return 0
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-v --verbose -V --version -R \
- --reset -r --restart -w --watch -l --log -A \
- --advertise -F --force' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '--verbose --version --reset --restart \
+ --watch --log --advertise --force' -- "$cur" ) )
else
_available_interfaces -a
fi
} &&
-complete -F _mii_tool $default mii-tool
+complete -F _mii_tool -o default mii-tool
have mii-diag &&
_mii_diag()
@@ -42,13 +40,12 @@ _mii_diag()
local cur prev split=false
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
_split_longopt && split=true
case $prev in
- -@(F|A|-advertise|-fixed-speed))
+ -F|-A|--advertise|--fixed-speed)
COMPREPLY=( $( compgen -W '100baseT4 100baseTx \
100baseTx-FD 100baseTx-HD 10baseT 10baseT-FD \
10baseT-HD' -- "$cur" ) )
@@ -59,52 +56,45 @@ _mii_diag()
$split && return 0
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-A --advertise -F --fixed-speed -a \
- --all-interfaces -s --status -D --debug -g \
- --read-parameters -G --set-parameters -M --msg-level \
- -p --phy -r --restart -R --reset -v -V -w --watch \
- -? --help' -- "$cur" ) )
+ 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 $default mii-diag
+complete -F _mii_diag -o default mii-diag
# Linux route(8) completion
#
-[ $UNAME = Linux ] &&
+[ $UNAME = Linux ] && have route &&
_route()
{
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
if [ "$prev" = dev ]; then
- COMPREPLY=( $( ifconfig -a | sed -ne 's|^\('$cur'[^ ]*\).*$|\1|p' ))
+ _available_interfaces
return 0
fi
- COMPREPLY=( $( compgen -W 'add del -host -net netmask metric mss \
- window irtt reject mod dyn reinstate dev \
- default gw' -- "$cur" ) )
-
- COMPREPLY=( $( echo " ${COMP_WORDS[@]}" | \
- (while read -d ' ' i; do
- [ "$i" == "" ] && 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 / } )
+ # 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
- echo "${COMPREPLY[@]}")
- ) )
- return 0
-}
-[ $UNAME = Linux ] && complete -F _route route
+ $found || COMPREPLY[${#COMPREPLY[@]}]="$opt"
+ done
+
+ COMPREPLY=( $( compgen -W '"${COMPREPLY[@]}"' -- "$cur" ) )
+} &&
+complete -F _route route
# Local variables:
# mode: shell-script
diff --git a/contrib/nmap b/contrib/nmap
new file mode 100644
index 00000000..19f0a07e
--- /dev/null
+++ b/contrib/nmap
@@ -0,0 +1,60 @@
+# bash completion for nmap
+
+have nmap &&
+_nmap()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=`_get_pword`
+
+ case $prev in
+ -iL|-oN|-oX|-oS|-oG|---excludefile|--resume|--stylesheet)
+ _filedir
+ return 0
+ ;;
+ -oA|--datadir)
+ _filedir -d
+ return 0
+ ;;
+ -e)
+ _available_interfaces
+ return 0
+ ;;
+ -b|--dns-servers)
+ _known_hosts_real "$cur"
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-iL -iR --exclude --excludefile -sL -sP \
+ -PN -PS -PA -PU -PY -PE -PP -PM -PO -n -R --dns-servers \
+ --system-dns --traceroute -sS -sT -sA -sW -sM -sU -sN -sF -sX \
+ --scanflags -sI -sY -sZ -sO -b -p -F -r --top-ports --port-ratio \
+ -sV --version-intensity --version-light --version-all \
+ --version-trace -sC --script= --script-args= --script-trace \
+ --script-updatedb -O --osscan-limit --osscan-guess -T0 -T1 -T2 -T3 \
+ -T4 -T5 --min-hostgroup --max-hostgroup --min-parallelism \
+ --max-parallelism --min-rtt-timeout --max-rtt-timeout \
+ --initial-rtt-timeout --max-retries --host-timeout --scan-delay \
+ --max-scan-delay --min-rate --max-rate -f --mtu -D -S -e \
+ --source-port --data-length --ip-options --ttl --spoof-mac \
+ --badsum --adler32 -oN -oX -oS -oG -oA -v -d --reason --open \
+ --packet-trace --iflist --log-errors --append-output --resume \
+ --stylesheet --webxml --no-stylesheet -6 -A --datadir --send-eth \
+ --send-ip --privilege--unprivileged -V -h' -- "$cur" ) )
+ else
+ _known_hosts_real "$cur"
+ fi
+} &&
+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/contrib/ntpdate b/contrib/ntpdate
index 233f69f1..bf004b55 100644
--- a/contrib/ntpdate
+++ b/contrib/ntpdate
@@ -6,8 +6,7 @@ _ntpdate()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
case $prev in
-k)
diff --git a/contrib/openldap b/contrib/openldap
index 5869811d..e4bbba1f 100644
--- a/contrib/openldap
+++ b/contrib/openldap
@@ -16,10 +16,9 @@ _ldapsearch()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
- case "$prev" in
+ case $prev in
-h)
_known_hosts_real "$cur"
return 0
@@ -32,7 +31,7 @@ _ldapsearch()
_filedir -d
return 0
;;
- -@(f|y))
+ -f|-y)
_filedir
return 0
;;
@@ -64,10 +63,9 @@ _ldapaddmodify()
local cur prev options
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
- case "$prev" in
+ case $prev in
-h)
_known_hosts_real "$cur"
return 0
@@ -76,7 +74,7 @@ _ldapaddmodify()
_ldap_uris
return 0
;;
- -@(S|f|y))
+ -S|-f|-y)
_filedir
return 0
;;
@@ -102,10 +100,9 @@ _ldapdelete()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
- case "$prev" in
+ case $prev in
-h)
_known_hosts_real "$cur"
return 0
@@ -114,7 +111,7 @@ _ldapdelete()
_ldap_uris
return 0
;;
- -@(f|y))
+ -f|-y)
_filedir
return 0
;;
@@ -136,10 +133,9 @@ _ldapcompare()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
- case "$prev" in
+ case $prev in
-h)
_known_hosts_real "$cur"
return 0
@@ -170,10 +166,9 @@ _ldapmodrdn()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
- case "$prev" in
+ case $prev in
-h)
_known_hosts_real "$cur"
return 0
@@ -182,7 +177,7 @@ _ldapmodrdn()
_ldap_uris
return 0
;;
- -@(f|y))
+ -f|-y)
_filedir
return 0
;;
@@ -204,10 +199,9 @@ _ldapwhoami()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
- case "$prev" in
+ case $prev in
-h)
_known_hosts_real "$cur"
return 0
@@ -216,7 +210,7 @@ _ldapwhoami()
_ldap_uris
return 0
;;
- -@(f|y))
+ -f|-y)
_filedir
return 0
;;
@@ -238,10 +232,9 @@ _ldappasswd()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
- case "$prev" in
+ case $prev in
-h)
_known_hosts_real "$cur"
return 0
@@ -250,7 +243,7 @@ _ldappasswd()
_ldap_uris
return 0
;;
- -@(t|T|y))
+ -t|-T|-y)
_filedir
return 0
;;
diff --git a/contrib/openssl b/contrib/openssl
index 8fdbb87d..568f2dbf 100644
--- a/contrib/openssl
+++ b/contrib/openssl
@@ -32,7 +32,7 @@ _openssl()
local cur prev commands command options formats
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur prev
commands='asn1parse ca ciphers crl crl2pkcs7 dgst dh dhparam dsa \
dsaparam ec ecparam enc engine errstr gendh gendsa genrsa \
@@ -53,21 +53,24 @@ _openssl()
COMPREPLY=( $( compgen -W "$commands" -- "$cur" ) )
else
command=${COMP_WORDS[1]}
- prev=${COMP_WORDS[COMP_CWORD-1]}
case $prev in
- -@(CA|CAfile|CAkey|CAserial|cert|certfile|config|content|dcert|dkey|dhparam|extfile|in|inkey|kfile|key|keyout|out|oid|prvrify|rand|recip|revoke|sess_in|sess_out|spkac|sign|signkey|signer|signature|ss_cert|untrusted|verify))
+ -CA|-CAfile|-CAkey|-CAserial|-cert|-certfile|-config|-content| \
+ -dcert|-dkey|-dhparam|-extfile|-in|-inkey|-kfile|-key|-keyout| \
+ -out|-oid|-prvrify|-rand|-recip|-revoke|-sess_in|-sess_out| \
+ -spkac|-sign|-signkey|-signer|-signature|-ss_cert|-untrusted| \
+ -verify)
_filedir
return 0
;;
- -@(outdir|CApath))
+ -outdir|-CApath)
_filedir -d
return 0
;;
- -@(name|crlexts|extensions))
+ -name|-crlexts|-extensions)
_openssl_sections
return 0
;;
- -@(in|out|key|cert|CA|CAkey|dkey|dcert)form)
+ -inform|-outform|-keyform|-certform|-CAform|-CAkeyform|-dkeyform|-dcertform)
formats='DER PEM'
case $command in
x509)
@@ -222,7 +225,7 @@ _openssl()
-CAcreateserial -CAserial -text -C -md2 -md5 -sha1 \
-mdc2 -clrext -extfile -extensions -engine'
;;
- @(md5|md4|md2|sha1|sha|mdc2|ripemd160))
+ md5|md4|md2|sha1|sha|mdc2|ripemd160)
options='-c -d'
;;
esac
@@ -239,7 +242,7 @@ _openssl()
fi
fi
}
-complete -F _openssl $default openssl
+complete -F _openssl -o default openssl
}
# Local variables:
diff --git a/contrib/p4 b/contrib/p4
index 4e7fc3d3..0795a28e 100644
--- a/contrib/p4
+++ b/contrib/p4
@@ -3,11 +3,10 @@
have p4 &&
_p4()
{
- local cur prev prev2 p4commands p4filetypes
+ local cur prev preprev p4commands p4filetypes
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev preprev
# rename isn't really a command
p4commands="$( p4 help commands | awk 'NF>3 {print $1}' )"
@@ -18,7 +17,7 @@ _p4()
if [ $COMP_CWORD -eq 1 ]; then
COMPREPLY=( $( compgen -W "$p4commands" -- "$cur" ) )
elif [ $COMP_CWORD -eq 2 ]; then
- case "$prev" in
+ case $prev in
help)
COMPREPLY=( $( compgen -W "simple commands \
environment filetypes jobview revisions \
@@ -31,10 +30,9 @@ _p4()
;;
esac
elif [ $COMP_CWORD -gt 2 ]; then
- prev2=${COMP_WORDS[COMP_CWORD-2]}
- case "$prev" in
+ case $prev in
-t)
- case "$prev2" in
+ case $preprev in
add|edit|reopen)
COMPREPLY=( $( compgen -W "$p4filetypes" -- "$cur") )
;;
@@ -49,7 +47,7 @@ _p4()
return 0
} &&
-complete -F _p4 $default p4 g4
+complete -F _p4 -o default p4 g4
# Local variables:
# mode: shell-script
diff --git a/contrib/perl b/contrib/perl
index 77fac477..67996f94 100644
--- a/contrib/perl
+++ b/contrib/perl
@@ -4,7 +4,8 @@ have perl &&
{
_perlmodules()
{
- COMPREPLY=( $( compgen -P "$prefix" -W "$( perl -e 'sub mods { my ($base,$dir)=@_; return if $base !~ /^\Q$ENV{cur}/; chdir($dir) or return; for (glob(q[*.pm])) {s/\.pm$//; print qq[$base$_\n]}; mods(/^(?:[.\d]+|$Config{archname}-$Config{osname}|auto)$/ ? undef : qq[${base}${_}\\\\:\\\\:],qq[$dir/$_]) for grep {-d} glob(q[*]); } mods(undef,$_) for @INC;' )" -- "$cur" ) )
+ COMPREPLY=( $( compgen -P "$prefix" -W "$( perl -e 'sub mods { my ($base,$dir)=@_; return if $base !~ /^\Q$ENV{cur}/; chdir($dir) or return; for (glob(q[*.pm])) {s/\.pm$//; print qq[$base$_\n]}; mods(/^(?:[.\d]+|$Config{archname}-$Config{osname}|auto)$/ ? undef : qq[${base}${_}::],qq[$dir/$_]) for grep {-d} glob(q[*]); } mods(undef,$_) for @INC;' )" -- "$cur" ) )
+ __ltrim_colon_completions "$1"
}
_perl()
@@ -13,8 +14,7 @@ _perl()
local optPrefix optSuffix
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref -n : cur prev
prefix=""
# If option not followed by whitespace, reassign prev and cur
@@ -28,34 +28,33 @@ _perl()
fi
# only handle module completion for now
- case "$prev" in
+ case $prev in
-I|-x)
local IFS=$'\t\n'
COMPREPLY=( $( compgen -d $optPrefix $optSuffix -- "$cur" ) )
return 0
;;
-m|-M)
- _perlmodules
+ _perlmodules "$cur"
return 0
;;
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-C -s -T -u -U -W -X -h -v -V -c -w -d \
- -D -p -n -a -F -l -0 -I -m -M -P -S -x -i -e ' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '-C -s -T -u -U -W -X -h -v -V -c -w -d \
+ -D -p -n -a -F -l -0 -I -m -M -P -S -x -i -e ' -- "$cur" ) )
else
_filedir
fi
}
-complete -F _perl $nospace $filenames perl
+complete -F _perl -o nospace -o filenames perl
_perldoc()
{
local cur prev prefix temp
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref -n : cur prev
prefix=""
# completing an option (may or may not be separated by a space)
@@ -76,14 +75,14 @@ _perldoc()
shift splice unshift grep join map qw reverse sort unpack \
delete each exists keys values binmode close closedir \
dbmclose dbmopen die eof fileno flock format getc print \
- printf read readdir rewinddir seek seekdir select syscall \
+ printf read readdir rewinddir say seek seekdir select syscall \
sysread sysseek syswrite tell telldir truncate warn write \
pack read syscall sysread syswrite unpack vec -X chdir chmod \
chown chroot fcntl glob ioctl link lstat mkdir open opendir \
readlink rename rmdir stat symlink umask unlink utime caller \
continue do dump eval exit goto last next redo return \
- sub wantarray caller import local my our package use defined \
- formline reset scalar undef \
+ sub wantarray break caller import local my our state package \
+ use defined formline reset scalar undef \
alarm exec fork getpgrp getppid getpriority kill pipe qx \
setpgrp setpriority sleep system times wait waitpid \
import no package require use bless dbmclose dbmopen package \
@@ -97,7 +96,7 @@ _perldoc()
getnetbyaddr getnetbyname getnetent getprotobyname \
getprotobynumber getprotoent getservbyname getservbyport \
getservent sethostent setnetent setprotoent setservent \
- gmtime localtime time times' -- "$cur" ) )
+ gmtime localtime time times lock' -- "$cur" ) )
return 0
;;
esac
@@ -107,15 +106,16 @@ _perldoc()
else
# return available modules (unless it is clearly a file)
if [[ "$cur" != */* ]]; then
- _perlmodules
+ _perlmodules "$cur"
COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W \
'$( PAGER=/bin/cat man perl | \
sed -ne "/perl.*Perl overview/,/perlwin32/p" | \
- awk "\$NF=2 { print \$1}" | grep perl )' -- "$cur" ) )
+ awk "\$NF=2 { print \$1}" | command grep perl )' -- "$cur" ) )
fi
+ _filedir '@(pl|PL|pm|PM|pod|POD)'
fi
}
-complete -F _perldoc $default perldoc
+complete -F _perldoc -o bashdefault perldoc
}
# Local variables:
diff --git a/contrib/pine b/contrib/pine
index 0c96bedd..2f069287 100644
--- a/contrib/pine
+++ b/contrib/pine
@@ -1,17 +1,17 @@
# PINE address-book completion
-have pine &&
+have pine || have alpine &&
_pineaddr()
{
local cur
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
COMPREPLY=( $( compgen -W '$( awk "{print \$1}" ~/.addressbook \
2>/dev/null)' -- "$cur" ) )
} &&
-complete -F _pineaddr $default pine
+complete -F _pineaddr -o default pine alpine
# Local variables:
# mode: shell-script
diff --git a/contrib/pkg-config b/contrib/pkg-config
index 1f8cc83f..b999bd81 100644
--- a/contrib/pkg-config
+++ b/contrib/pkg-config
@@ -6,13 +6,13 @@ _pkg_config()
local cur prev split=false
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
_split_longopt && split=true
case $prev in
- --@(?(define-)variable|@(atleast?(-pkgconfig)|exact|max)-version))
+ --variable|--define-variable|--atleast-version|--atleast-pkgconfig-version| \
+ --exact-version|--max-version)
# argument required but no completions available
return 0
;;
@@ -34,8 +34,7 @@ _pkg_config()
--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") )
+ --print-provides --print-requires --help --usage' -- "$cur") )
else
COMPREPLY=( $( compgen -W "$( pkg-config --list-all \
2>/dev/null | awk '{print $1}' )" -- "$cur" ) )
diff --git a/contrib/pkg_install b/contrib/pkg_install
index 3bdf2b77..577d9c94 100644
--- a/contrib/pkg_install
+++ b/contrib/pkg_install
@@ -8,17 +8,16 @@ _pkg_delete()
local cur pkgdir prev
pkgdir=${PKG_DBDIR:-/var/db/pkg}/
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
- [ "$prev" = "-o" -o "$prev" = "-p" -o "$prev" = "-W" ] && return 0
+ [[ "$prev" == -o || "$prev" == -p || "$prev" == -W ]] && return 0
COMPREPLY=( $( compgen -d "$pkgdir$cur" ) )
COMPREPLY=( ${COMPREPLY[@]#$pkgdir} )
return 0
}
-complete -F _pkg_delete $dirnames pkg_delete pkg_info
+complete -F _pkg_delete -o dirnames pkg_delete pkg_info
}
diff --git a/contrib/pkgtools b/contrib/pkgtools
index c8092b7c..3a5df278 100644
--- a/contrib/pkgtools
+++ b/contrib/pkgtools
@@ -6,12 +6,12 @@ _removepkg()
local packages cur
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
COMPREPLY=( $( (cd /var/log/packages; compgen -f -- "$cur") ) )
} &&
-complete -F _removepkg $filenames removepkg &&
- complete $dirnames -f -X '!*.tgz' installpkg upgradepkg explodepkg
+complete -F _removepkg -o filenames removepkg &&
+ complete -o dirnames -f -X '!*.t[bglx]z' installpkg upgradepkg explodepkg
# Local variables:
# mode: shell-script
diff --git a/contrib/pm-utils b/contrib/pm-utils
new file mode 100644
index 00000000..4deb82e7
--- /dev/null
+++ b/contrib/pm-utils
@@ -0,0 +1,37 @@
+# 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/contrib/portupgrade b/contrib/portupgrade
index b9914730..5389a5ca 100644
--- a/contrib/portupgrade
+++ b/contrib/portupgrade
@@ -6,10 +6,9 @@ _portupgrade()
local cur pkgdir prev
pkgdir=${PKG_DBDIR:-/var/db/pkg}/
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
- [ "$prev" = "-l" -o "$prev" = "-L" -o "$prev" = "-o" ] && return 0
+ [[ "$prev" == -l || "$prev" == -L || "$prev" == -o ]] && return 0
COMPREPLY=( $( compgen -d "$pkgdir$cur" ) )
COMPREPLY=( ${COMPREPLY[@]#$pkgdir} )
@@ -17,7 +16,7 @@ _portupgrade()
return 0
} &&
-complete -F _portupgrade $dirnames portupgrade
+complete -F _portupgrade -o dirnames portupgrade
have portinstall &&
_portinstall()
@@ -26,29 +25,28 @@ _portinstall()
local -a COMPREPLY2
portsdir=${PORTSDIR:-/usr/ports}/
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _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" -a -f $indexfile ] ||
- indexfile=$portsdir/INDEX
+ [[ "${OSTYPE%.*}" == freebsd5 && -f $indexfile ]] ||
+ indexfile=$portsdir/INDEX
- [ "$prev" = "-l" -o "$prev" = "-L" -o "$prev" = "-o" ] && return 0
+ [[ "$prev" == -l || "$prev" == -L || "$prev" == -o ]] && return 0
- COMPREPLY=( $( egrep "^$cur" < $indexfile | cut -d'|' -f1 ) )
- COMPREPLY2=( $( egrep "^[^\|]+\|$portsdir$cur" < $indexfile | \
+ 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 $dirnames portinstall
+complete -F _portinstall -o dirnames portinstall
# _pkg_delete is in pkg_install
type _pkg_delete &>/dev/null && have pkg_deinstall && \
-complete -F _pkg_delete $dirnames pkg_deinstall
+complete -F _pkg_delete -o dirnames pkg_deinstall
# Local variables:
# mode: shell-script
diff --git a/contrib/postfix b/contrib/postfix
index dccdc1e5..ec91c1a3 100644
--- a/contrib/postfix
+++ b/contrib/postfix
@@ -8,8 +8,7 @@ _postfix()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
case $prev in
-c)
@@ -30,7 +29,7 @@ _postfix()
COMPREPLY=( $( compgen -W 'check start stop abort flush reload status \
set-permissions upgrade-configuration' -- "$cur" ) )
}
-complete -F _postfix $filenames postfix
+complete -F _postfix -o filenames postfix
# postalias(1) and postmap(1)
#
@@ -39,8 +38,7 @@ _postmap()
local cur prev len idx
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
case $prev in
-c)
@@ -75,7 +73,7 @@ _postmap()
fi
return 0
}
-complete -F _postmap $filenames postmap postalias
+complete -F _postmap -o filenames postmap postalias
# postcat(1)
#
@@ -84,8 +82,7 @@ _postcat()
local cur prev pval len idx qfile
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
case $prev in
-c)
@@ -107,7 +104,7 @@ _postcat()
len=${#cur}
idx=0
for pval in $( mailq 2>/dev/null | \
- sed -e '1d; $d; /^[^0-9A-Z]\|^$/d; s/[* !].*$//' ); do
+ sed -e '1d; $d; /^[^0-9A-Z]/d; /^$/d; s/[* !].*$//' ); do
if [[ "$cur" == "${pval:0:$len}" ]]; then
COMPREPLY[$idx]=$pval
idx=$(($idx+1))
@@ -119,7 +116,7 @@ _postcat()
return 0
fi
}
-complete -F _postcat $filenames postcat
+complete -F _postcat -o filenames postcat
# postconf(1)
#
@@ -128,8 +125,7 @@ _postconf()
local cur prev pval len idx eqext
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
case $prev in
-b|-t)
@@ -162,7 +158,7 @@ _postconf()
done
return 0
}
-complete -F _postconf $filenames postconf
+complete -F _postconf -o filenames postconf
# postsuper(1)
#
@@ -171,8 +167,7 @@ _postsuper()
local cur prev pval len idx
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
case $prev in
-c)
@@ -182,8 +177,8 @@ _postsuper()
-[dr])
len=${#cur}
idx=0
- for pval in $( echo ALL; mailq 2>/dev/null | \
- sed -e '1d; $d; /^[^0-9A-Z]\|^$/d; s/[* !].*$//' ); do
+ 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))
@@ -194,8 +189,8 @@ _postsuper()
-h)
len=${#cur}
idx=0
- for pval in $( echo ALL; mailq 2>/dev/null | \
- sed -e '1d; $d; /^[^0-9A-Z]\|^$/d; s/[* ].*$//; /!$/d' ); do
+ 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))
@@ -206,8 +201,8 @@ _postsuper()
-H)
len=${#cur}
idx=0
- for pval in $( echo ALL; mailq 2>/dev/null | \
- sed -e '1d; $d; /^[^0-9A-Z]\|^$/d; /^[0-9A-Z]*[* ]/d; s/!.*$//' ); do
+ 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))
@@ -224,7 +219,7 @@ _postsuper()
COMPREPLY=( $( compgen -W 'hold incoming active deferred' -- "$cur" ) )
}
-complete -F _postsuper $filenames postsuper
+complete -F _postsuper -o filenames postsuper
}
# Local variables:
diff --git a/contrib/postgresql b/contrib/postgresql
index 125b6f64..392c9aa6 100644
--- a/contrib/postgresql
+++ b/contrib/postgresql
@@ -13,7 +13,7 @@ _pg_users()
{
# See https://launchpad.net/bugs/164772
#COMPREPLY=( $( psql -qtc 'select usename from pg_user' template1 2>/dev/null | \
- # grep "^ $cur" ) )
+ # command grep "^ $cur" ) )
#[ ${#COMPREPLY[@]} -eq 0 ] && COMPREPLY=( $( compgen -u -- $cur ) )
COMPREPLY=( $( compgen -u -- "$cur" ) )
}
@@ -25,12 +25,11 @@ _createdb()
local cur prev split=false
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
_split_longopt && split=true
- case "$prev" in
+ case $prev in
-h|--host)
_known_hosts_real "$cur"
return 0
@@ -52,14 +51,14 @@ _createdb()
$split && return 0
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-D -T -E -h -p -U -W -e -q \
- --tablespace --template --encoding --host --port \
- --username --password --echo --quiet --help --version' -- "$cur" ))
+ COMPREPLY=( $( compgen -W '--tablespace --template --encoding --host \
+ --port --username --password --echo --quiet --help --version' \
+ -- "$cur" ) )
else
_pg_databases
fi
}
-complete -F _createdb $default createdb
+complete -F _createdb -o default createdb
# dropdb(1) completion
#
@@ -68,12 +67,11 @@ _dropdb()
local cur prev split=false
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
_split_longopt && split=true
- case "$prev" in
+ case $prev in
-h|--host)
_known_hosts_real "$cur"
return 0
@@ -91,14 +89,13 @@ _dropdb()
$split && return 0
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-h -p -U -W -i -e -q \
- --host --port --username --password --interactive \
- --echo --quiet --help --version' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '--host --port --username --password \
+ --interactive --echo --quiet --help --version' -- "$cur" ) )
else
_pg_databases
fi
}
-complete -F _dropdb $default dropdb
+complete -F _dropdb -o default dropdb
# psql(1) completion
#
@@ -107,12 +104,11 @@ _psql()
local cur prev split=false
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
_split_longopt && split=true
- case "$prev" in
+ case $prev in
-h|--host)
_known_hosts_real "$cur"
return 0
@@ -144,22 +140,18 @@ _psql()
if [[ "$cur" == -* ]]; then
# return list of available options
- COMPREPLY=( $( compgen -W '-a --echo-all -A --no-align \
- -c --command -d --dbname -e --echo-queries \
- -E --echo-hidden -f --file -F --field-separator \
- -h --host -H --html -l --list -L --log-file -n \
- -o --output -p --port -P --pset -q --quiet \
- -R --record-separator -s --single-step \
- -S --single-line -t --tuples-only -T --table-attr \
- -U --username -v --set --variable -V --version \
- -W --password -x --expanded -X --no-psqlrc \
- -1 --single-transaction -? --help' -- "$cur" ) )
+ 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" ) )
else
# return list of available databases
_pg_databases
fi
}
-complete -F _psql $filenames psql
+complete -F _psql -o filenames psql
}
# Local variables:
diff --git a/contrib/povray b/contrib/povray
index 4a4df011..cd03b940 100644
--- a/contrib/povray
+++ b/contrib/povray
@@ -7,8 +7,7 @@ _povray()
defoext=png # default output extension, if cannot be determined FIXME
COMPREPLY=()
- povcur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref povcur prev
_expand || return 0
@@ -22,14 +21,14 @@ _povray()
;;
[-+]O*)
# guess what output file type user may want
- case $( ( IFS=$'\n'; echo "${COMP_WORDS[*]}" | grep '^[-+]F' ) ) in
+ case $( ( IFS=$'\n'; command grep '^[-+]F' <<<"${COMP_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'; echo "${COMP_WORDS[*]}" | grep '^[-+]I' ) ) )
+ COMPREPLY=( $( ( IFS=$'\n'; command grep '^[-+]I' <<<"${COMP_WORDS[*]}" ) ) )
COMPREPLY=( ${COMPREPLY[@]#[-+]I} )
COMPREPLY=( ${COMPREPLY[@]/%.pov/.$oext} )
cur="${povcur#[-+]O}" # to confuse _filedir
@@ -55,7 +54,7 @@ _povray()
;;
esac
} &&
-complete -F _povray $filenames povray xpovray spovray
+complete -F _povray -o filenames povray xpovray spovray
# Local variables:
# mode: shell-script
diff --git a/contrib/procps b/contrib/procps
new file mode 100644
index 00000000..db8fc3d5
--- /dev/null
+++ b/contrib/procps
@@ -0,0 +1,49 @@
+# 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/contrib/python b/contrib/python
index 6bd4e0ce..9d8fcc9d 100644
--- a/contrib/python
+++ b/contrib/python
@@ -6,10 +6,9 @@ _python()
local prev cur i
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]##*/}
+ _get_comp_words_by_ref cur prev
- case "$prev" in
+ case $prev in
-Q)
COMPREPLY=( $( compgen -W "old new warn warnall" -- "$cur" ) )
return 0
@@ -48,7 +47,7 @@ _python()
return 0
} &&
-complete -F _python $filenames python
+complete -F _python -o filenames python
# Local variables:
# mode: shell-script
diff --git a/contrib/qdbus b/contrib/qdbus
index 1e70c708..879df68d 100644
--- a/contrib/qdbus
+++ b/contrib/qdbus
@@ -1,21 +1,18 @@
-# Qt qdbus completion
+# Qt qdbus, dcop completion
-have qdbus &&
+have qdbus || have dcop &&
_qdbus()
{
- local cur compstr
+ local cur
COMPREPLY=()
- cur=`_get_cword`
- if [ -z "$cur" ]; then
- compstr=${COMP_WORDS[*]}
- else
- compstr=$( command echo ${COMP_WORDS[*]} | sed "s/ ${cur/\//\\/}$//" )
- fi
- COMPREPLY=( $( compgen -W '$( command $compstr | sed s/\(.*\)// )' \
- -- "$cur" ) )
+ _get_comp_words_by_ref cur
+
+ [ -n "$cur" ] && unset COMP_WORDS[${#COMP_WORDS[@]}-1]
+ COMPREPLY=( $( compgen -W '$( command ${COMP_WORDS[@]} 2>/dev/null | \
+ sed s/\(.*\)// )' -- "$cur" ) )
} &&
-complete -F _qdbus qdbus
+complete -F _qdbus qdbus dcop
# Local variables:
# mode: shell-script
diff --git a/contrib/qemu b/contrib/qemu
index c129f0c3..1c7a8da0 100644
--- a/contrib/qemu
+++ b/contrib/qemu
@@ -6,15 +6,15 @@ _qemu()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
case $prev in
- -@(fd[ab]|hd[abcd]|cdrom|option-rom|kernel|initrd|bootp|pidfile|loadvm|mtdblock|sd|pflash|bios))
+ -fd[ab]|-hd[abcd]|-cdrom|-option-rom|-kernel|-initrd|-bootp|-pidfile| \
+ -loadvm|-mtdblock|-sd|-pflash|-bios)
_filedir
return 0
;;
- -@(tftp|smb|L|chroot))
+ -tftp|-smb|-L|-chroot)
_filedir -d
return 0
;;
@@ -53,7 +53,7 @@ _qemu()
-- "$cur" ) )
return 0
;;
- -@(serial|parallel|monitor))
+ -serial|-parallel|-monitor)
COMPREPLY=( $( compgen -W 'vc pty none null /dev/ \
file: stdio pipe: COM udp: tcp: telnet: unix: \
mon: braille' -- "$cur" ) )
@@ -111,7 +111,7 @@ _qemu()
-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 -h -help -version -numa -mtdblock -sd -pflash \
+ -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 \
@@ -121,7 +121,7 @@ _qemu()
_filedir
fi
} &&
-complete -F _qemu $filenames qemu
+complete -F _qemu -o filenames qemu
# Local variables:
# mode: shell-script
diff --git a/contrib/quota-tools b/contrib/quota-tools
index bc5346c3..2b528d92 100644
--- a/contrib/quota-tools
+++ b/contrib/quota-tools
@@ -35,8 +35,7 @@ _quota()
local cur prev split=false
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
_split_longopt && split=true
@@ -58,15 +57,14 @@ _quota()
_user_or_group
fi
}
-complete -F _quota $default quota
+complete -F _quota -o default quota
_setquota()
{
local cur prev split=false
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
_split_longopt && split=true
@@ -98,15 +96,14 @@ _setquota()
fi
}
-complete -F _setquota $default setquota
+complete -F _setquota -o default setquota
_edquota()
{
local cur prev split=false
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
_split_longopt && split=true
@@ -115,7 +112,7 @@ _edquota()
_quota_formats
return 0
;;
- -@(f|-filesystem))
+ -f|--filesystem)
_filesystems
return 0
;;
@@ -131,15 +128,14 @@ _edquota()
_user_or_group
fi
}
-complete -F _edquota $default edquota
+complete -F _edquota -o default edquota
_quotacheck()
{
local cur prev split=false
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
_split_longopt && split=true
@@ -161,15 +157,14 @@ _quotacheck()
_filesystems
fi
}
-complete -F _quotacheck $default quotacheck
+complete -F _quotacheck -o default quotacheck
_repquota()
{
local cur prev split=false
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
_split_longopt && split=true
@@ -191,15 +186,14 @@ _repquota()
_filesystems
fi
}
-complete -F _repquota $default repquota
+complete -F _repquota -o default repquota
_quotaon()
{
local cur prev split=false
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
_split_longopt && split=true
@@ -219,15 +213,14 @@ _quotaon()
_filesystems
fi
}
-complete -F _quotaon $default quotaon
+complete -F _quotaon -o default quotaon
_quotaoff()
{
local cur prev split=false
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
_split_longopt && split=true
@@ -236,7 +229,7 @@ _quotaoff()
_quota_formats
return 0
;;
- -@(x|-xfs-command))
+ -x|--xfs-command)
COMPREPLY=( $( compgen -W 'delete enforce' -- "$cur" ) )
return 0
;;
@@ -252,7 +245,7 @@ _quotaoff()
_filesystems
fi
}
-complete -F _quotaoff $default quotaoff
+complete -F _quotaoff -o default quotaoff
}
# Local variables:
diff --git a/contrib/rcs b/contrib/rcs
index a6505deb..42ac8d5a 100644
--- a/contrib/rcs
+++ b/contrib/rcs
@@ -6,8 +6,7 @@ _rcs()
local cur prev file dir i
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
file=${cur##*/}
dir=${cur%/*}
@@ -31,9 +30,9 @@ _rcs()
# default to files if nothing returned and we're checking in.
# otherwise, default to directories
- [ ${#COMPREPLY[@]} -eq 0 -a $1 = ci ] && _filedir || _filedir -d
+ [[ ${#COMPREPLY[@]} -eq 0 && $1 == ci ]] && _filedir || _filedir -d
} &&
-complete -F _rcs $filenames ci co rlog rcs rcsdiff
+complete -F _rcs -o filenames ci co rlog rcs rcsdiff
# Local variables:
# mode: shell-script
diff --git a/contrib/rdesktop b/contrib/rdesktop
index 79514e7a..7acf47a5 100644
--- a/contrib/rdesktop
+++ b/contrib/rdesktop
@@ -6,14 +6,13 @@ _rdesktop()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
case $prev in
-k)
COMPREPLY=( $( command ls \
/usr/share/rdesktop/keymaps 2>/dev/null | \
- egrep -v '(common|modifiers)' ) )
+ command grep -E -v '(common|modifiers)' ) )
COMPREPLY=( ${COMPREPLY[@]:-} $( command ls \
$HOME/.rdesktop/keymaps 2>/dev/null ) )
COMPREPLY=( ${COMPREPLY[@]:-} $( command ls \
@@ -31,7 +30,7 @@ _rdesktop()
return 0
;;
-r)
- # FIXME: should do $nospace for the colon options
+ # FIXME: should do -o nospace for the colon options
COMPREPLY=( $( compgen -W 'comport: disk: lptport: \
printer: sound: lspci scard' -- "$cur" ) )
return 0
diff --git a/contrib/reportbug b/contrib/reportbug
index b6cb5e26..51e37fb7 100644
--- a/contrib/reportbug
+++ b/contrib/reportbug
@@ -6,10 +6,9 @@ _reportbug()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
- case "$prev" in
+ case $prev in
-f|--filename|-i|--include|--mta|-o|--output)
_filedir
return 0
@@ -42,7 +41,7 @@ _reportbug()
COMPREPLY=( $( compgen -W "gnats debbugs" -- "$cur" ) )
return 0
;;
- -T|--tags)
+ -T|--tag)
COMPREPLY=( $( compgen -W "none \
woody potato sarge sarge-ignore etch etch-ignore \
lenny lenny-ignore sid experimental confirmed \
@@ -51,23 +50,30 @@ _reportbug()
unreproducible upstream wontfix ipv6 lfs" -- "$cur" ))
return 0
;;
+ --from-buildd)
+ COMPREPLY=( $( compgen -S "_" -W '$( apt-cache dumpavail | \
+ command grep "^Source: $cur" | sort -u | cut -f2 -d" " )' ))
+ return 0
+ ;;
*)
;;
esac
- COMPREPLY=($( compgen -W '-h --help -v --version -a --af -b \
- --no-query-bts --query-bts -B --bts -c --configure \
- --no-config-files --check-available -d --debug \
- --no-check-available -e --editor --email -f \
- --filename -g --gnupg -H --header -i --include -j \
- --justification -l --ldap --no-ldap -L --list-cc -m \
- --maintonly --mode --mua --mta --mutt -n --mh --nmh \
- -o --output -p --print -P --pgp --proxy --http_proxy\
- -q --quiet -Q --query-only --realname --report-quiet \
- --reply-to --replyto -s --subject -S --severity \
- --smtphost -t --type -T --tags --template -V -x \
- --no-cc --package-version -z --no-compress \
- --ui --interface -u \
+ COMPREPLY=($( compgen -W '--help --version --attach \
+ --no-query-bts --query-bts --bts --body --body-file --bodyfile \
+ --no-config-files --class --configure --check-available --debug \
+ --no-check-available --debconf --test --draftpath --editor --email \
+ --exit-prompt --filename --from-buildd --gnupg --gpg --path --gnus \
+ --header --include --no-check-installed --check-installed \
+ --justification --kudos --keyid --license --list-cc \
+ --maintonly --mirror --mode --mua --mta --mutt --mh --nmh \
+ --bugnumber --no-bug-script --no-cc-menu --output --offline \
+ --print --paranoid --no-paranoid --pgp --proxy --http_proxy \
+ --pseudo-header --quiet --query-only --query-source --no-query-source \
+ --realname --report-quiet --reply-to --replyto --subject --severity \
+ --smtphost --timeout --tls --smtpuser --smtppasswd --src --source --type \
+ --tag --template --verify --no-verify --no-cc --package-version \
+ --no-compress --ui --interface \
wnpp boot-floppies kernel bugs.debian.org \
cdimage.debian.org general installation-reports \
listarchives lists.debian.org mirrors nm.debian.org \
@@ -78,7 +84,7 @@ _reportbug()
_filedir
return 0
} &&
-complete -F _reportbug $filenames reportbug
+complete -F _reportbug -o filenames reportbug
have querybts &&
_querybts()
@@ -86,12 +92,11 @@ _querybts()
local cur prev split=false
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
_split_longopt && split=true
- case "$prev" in
+ case $prev in
-B|--bts)
COMPREPLY=( $( compgen -W "debian guug kde mandrake help" \
-- "$cur" ))
@@ -116,7 +121,7 @@ _querybts()
www.debian.org' -- "$cur" ) \
$( apt-cache pkgnames -- "$cur" 2> /dev/null) )
} &&
-complete -F _querybts $filenames querybts
+complete -F _querybts -o filenames querybts
# Local variables:
# mode: shell-script
diff --git a/contrib/resolvconf b/contrib/resolvconf
index 70fedb0e..9773696d 100644
--- a/contrib/resolvconf
+++ b/contrib/resolvconf
@@ -6,11 +6,10 @@ _resolvconf()
local cur command
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
case $prev in
- -@(a|d))
+ -a|-d)
_available_interfaces
return 0
;;
diff --git a/contrib/rfkill b/contrib/rfkill
index df3dde69..5c51ff9d 100644
--- a/contrib/rfkill
+++ b/contrib/rfkill
@@ -6,7 +6,7 @@ _rfkill()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur prev
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--version' -- "$cur" ) )
@@ -17,8 +17,7 @@ _rfkill()
-- "$cur" ) )
;;
2)
- prev=${COMP_WORDS[COMP_CWORD-1]}
- if [ $prev == block -o $prev == unblock ]; then
+ if [[ $prev == block || $prev == unblock ]]; then
COMPREPLY=( $( compgen -W "$(rfkill list | awk -F: \
'/^[0-9]/ {print $1}') all wifi bluetooth uwb wimax \
wwan gps" -- "$cur" ) )
diff --git a/contrib/ri b/contrib/ri
index 1d550898..be66d98f 100644
--- a/contrib/ri
+++ b/contrib/ri
@@ -38,7 +38,7 @@ _ri()
local -a classes
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
ri_path=$(type -p ri)
# which version of ri are we using?
@@ -64,33 +64,33 @@ _ri()
# integrated ri from Ruby 1.9
classes=( $( ri -c | ruby -ne 'if /^\s*$/..$stdin.eof then \
if /, [A-Z]+/ then print; end; end' ) )
- elif [ "$ri_version" = "ri 1.8a" ]; then
- classes=( $( ruby -W0 $ri_path | \
+ elif [ "$ri_version" = "ri 1.8a" ]; then
+ classes=( $( ruby -W0 $ri_path | \
ruby -ne 'if /^'"'"'ri'"'"' has/..$stdin.eof then \
if /^ .*[A-Z]/ then print; end; end' ))
- else
- classes=( $( ruby -W0 $ri_path | \
- ruby -ne 'if /^I have/..$stdin.eof then \
+ else
+ classes=( $( ruby -W0 $ri_path | \
+ ruby -ne 'if /^I have/..$stdin.eof then \
if /^ .*[A-Z]/ then print; end; end' ))
- fi
+ fi
- COMPREPLY=( $( compgen -W '${classes[@]}' -- "$cur" ) )
- if [[ "$cur" == [A-Z]* ]]; then
- # we're completing on class or module alone
- return 0
- fi
+ COMPREPLY=( $( compgen -W '${classes[@]}' -- "$cur" ) )
+ if [[ "$cur" == [A-Z]* ]]; then
+ # we're completing on class or module alone
+ return 0
+ fi
- # we're completing on methods
- method=$cur
- ri_get_methods
- }
- complete -F _ri 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
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/rpcdebug b/contrib/rpcdebug
index 196d1872..be2a8709 100644
--- a/contrib/rpcdebug
+++ b/contrib/rpcdebug
@@ -14,7 +14,7 @@ _rpcdebug_flags()
if [ -n "$module" ]; then
COMPREPLY=( $( compgen -W "$(rpcdebug -vh 2>&1 \
- | grep '^'$module' '\
+ | command grep '^'$module' '\
| awk '{$1 = ""; print $0}')" -- "$cur" ) )
fi
}
@@ -24,8 +24,7 @@ _rpcdebug()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
case $prev in
-s)
diff --git a/contrib/rpm b/contrib/rpm
index dbfcc8f9..20f98522 100644
--- a/contrib/rpm
+++ b/contrib/rpm
@@ -7,12 +7,15 @@ _rpm_installed_packages()
{
local nodig="$1" nosig="$2"
- if [ -r /var/log/rpmpkgs -a \
- /var/log/rpmpkgs -nt /var/lib/rpm/Packages ]; then
+ if [[ -r /var/log/rpmpkgs && \
+ /var/log/rpmpkgs -nt /var/lib/rpm/Packages ]]; then
# using RHL 7.2 or later - this is quicker than querying the DB
- COMPREPLY=( $( sed -ne \
- 's|^\('$cur'[^[:space:]]*\)-[^[:space:]-]\+-[^[:space:]-]\+\.rpm$|\1|p' \
- /var/log/rpmpkgs ) )
+ COMPREPLY=( $( compgen -W "$( sed -ne \
+ 's|^\([^[:space:]]\{1,\}\)-[^[:space:]-]\{1,\}-[^[:space:]-]\{1,\}\.rpm$|\1|p' \
+ /var/log/rpmpkgs )" -- "$cur" ) )
+ elif type rpmqpack &>/dev/null ; then
+ # SUSE's rpmqpack is faster than rpm -qa
+ COMPREPLY=( $( compgen -W '$( rpmqpack )' -- "$cur" ) )
else
_rpm_nodigsig
COMPREPLY=( $( rpm -qa $nodig $nosig --qf='%{NAME} ' "$cur*" ) )
@@ -30,7 +33,7 @@ _rpm_groups()
_rpm_nodigsig()
{
- if [ -z "$nodig" -a -z "$nosig" ]; then
+ if [[ -z "$nodig" && -z "$nosig" ]]; then
local rpmver
rpmver=$(rpm --version)
@@ -52,15 +55,14 @@ _rpm()
local cur prev opts nodig nosig
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
nodig=""
nosig=""
_rpm_nodigsig
if [ $COMP_CWORD -eq 1 ]; then
# first parameter on line
- case "$cur" in
+ case $cur in
-b*)
COMPREPLY=( $( compgen -W '-ba -bb -bc -bi -bl -bp -bs' \
-- "$cur" ) )
@@ -86,16 +88,16 @@ _rpm()
return 0
fi
- case "$prev" in
- --@(@(db|exclude)path|prefix|relocate|root))
+ case $prev in
+ --dbpath|--excludepath|--prefix|--relocate|--root)
_filedir -d
return 0
;;
--eval|-E)
# get a list of macros
- COMPREPLY=( $( rpm --showrc | sed -ne \
- 's/^-\?[0-9]\+[:=][[:space:]]\+\('${cur#%}'[^[:space:](]*\).*/\1/p' ) )
- COMPREPLY=( "${COMPREPLY[@]/#/%}" )
+ COMPREPLY=( $( compgen -W "$( rpm --showrc | sed -ne \
+ 's/^-\{0,1\}[0-9]\{1,\}[:=][[:space:]]\{1,\}\([^[:space:](]\{3,\}\).*/%\1/p' )" \
+ -- "$cur" ) )
return 0
;;
--pipe)
@@ -136,7 +138,7 @@ _rpm()
;;
--target)
COMPREPLY=( $( compgen -W "$( command rpm --showrc | sed -ne \
- 's/^\s*compatible\s\+build\s\+archs\s*:\s*\(.*\)/\1/ p' )" \
+ 's/^\s*compatible\s\s*build\s\s*archs\s*:\s*\(.*\)/\1/ p' )" \
-- "$cur" ) )
return 0
;;
@@ -150,8 +152,8 @@ _rpm()
opts="--define --eval --macros --nodigest --nosignature --rcfile \
--quiet --pipe --verbose"
- case "${COMP_WORDS[1]}" in
- -@([iFU]*|-install|-freshen|-upgrade))
+ case ${COMP_WORDS[1]} in
+ -[iFU]*|--install|--freshen|--upgrade)
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W "$opts --percent --force \
--test --replacepkgs --replacefiles --root \
@@ -165,7 +167,7 @@ _rpm()
_filedir 'rpm'
fi
;;
- -@(e|-erase))
+ -e|--erase)
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W "$opts --allmatches \
--noscripts --notriggers --nodeps --test --repackage" \
@@ -174,7 +176,7 @@ _rpm()
_rpm_installed_packages "$nodig" "$nosig"
fi
;;
- -@(q*|-query))
+ -q*|--query)
# options common to all query types
opts="$opts --changelog --configfiles --conflicts --docfiles
--dump --enhances --filesbypkg --filecaps --fileclass
@@ -212,7 +214,7 @@ _rpm()
fi
fi
;;
- -@(K*|-checksig))
+ -K*|--checksig)
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W "$opts --nopgp --nogpg --nomd5" \
-- "$cur" ) )
@@ -220,7 +222,7 @@ _rpm()
_filedir 'rpm'
fi
;;
- -@([Vy]*|-verify))
+ -[Vy]*|--verify)
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W "$opts --root --dbpath --nodeps \
--nogroup --nolinkto --nomode --nomtime --nordev --nouser \
@@ -248,7 +250,7 @@ _rpm()
_filedir '@(t?(ar.)@([gx]z|bz?(2))|tar.@(lzma|Z))'
fi
;;
- --re@(build|compile))
+ --rebuild|--recompile)
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W "$opts --nodeps --rmsource \
--rmspec --sign --nodirtokens --target" -- "$cur" ) )
@@ -259,13 +261,13 @@ _rpm()
--tarbuild)
_filedir '@(t?(ar.)@([gx]z|bz?(2))|tar.@(lzma|Z))'
;;
- --@(re|add)sign)
+ --resign|--addsign)
_filedir 'rpm'
;;
- --set@(perms|gids))
+ --setperms|--setgids)
_rpm_installed_packages "$nodig" "$nosig"
;;
- --@(clean|rms@(ource|pec)))
+ --clean|--rmsource|--rmspec)
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--clean --rmsource --rmspec' \
-- "$cur" ) )
@@ -273,7 +275,7 @@ _rpm()
_filedir 'spec'
fi
;;
- --@(import|dbpath|root))
+ --import|--dbpath|--root)
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--import --dbpath --root' \
-- "$cur" ) )
@@ -285,7 +287,7 @@ _rpm()
return 0
}
-complete -F _rpm $filenames rpm rpmbuild
+complete -F _rpm -o filenames rpm rpmbuild
}
# Local variables:
diff --git a/contrib/rpmcheck b/contrib/rpmcheck
index 49240fd1..5d9aada7 100644
--- a/contrib/rpmcheck
+++ b/contrib/rpmcheck
@@ -6,8 +6,7 @@ _rpmcheck()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
case $prev in
-base)
diff --git a/contrib/rrdtool b/contrib/rrdtool
index 891df683..0b15a23f 100644
--- a/contrib/rrdtool
+++ b/contrib/rrdtool
@@ -3,7 +3,9 @@
have rrdtool &&
_rrdtool ()
{
- cur=`_get_cword`
+ local cur
+ _get_comp_words_by_ref cur
+
COMPREPLY=( $( compgen -W 'create update updatev graph dump restore last \
lastupdate first info fetch tune resize xport' -- "$cur" ) )
} &&
diff --git a/contrib/rsync b/contrib/rsync
index c8dc6cf2..b0f2d106 100644
--- a/contrib/rsync
+++ b/contrib/rsync
@@ -5,92 +5,83 @@ _rsync()
{
# TODO: _split_longopt
- local cur prev shell i userhost path
-
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ local cur prev
+ _get_comp_words_by_ref -n : cur prev
_expand || return 0
- case "$prev" in
- --@(config|password-file|include-from|exclude-from))
- _filedir
- return 0
- ;;
- -@(T|-temp-dir|-compare-dest))
- _filedir -d
- return 0
- ;;
- -@(e|-rsh))
- COMPREPLY=( $( compgen -W 'rsh ssh' -- "$cur" ) )
- return 0
- ;;
+ case $prev in
+ --config|--password-file|--include-from|--exclude-from)
+ _filedir
+ return 0
+ ;;
+ -T|--temp-dir|--compare-dest)
+ _filedir -d
+ return 0
+ ;;
+ -e|--rsh)
+ COMPREPLY=( $( compgen -W 'rsh ssh' -- "$cur" ) )
+ return 0
+ ;;
+ --compress-level)
+ COMPREPLY=( $( compgen -W '1 2 3 4 5 6 7 8 9' -- "$cur" ) )
+ return 0
+ ;;
esac
- case "$cur" in
- -*)
- COMPREPLY=( $( compgen -W '-v -q -c -a -r -R -b -u -l -L -H \
- -p -o -g -D -t -S -n -W -x -B -e -C -I -T -P \
- -z -h -4 -6 --verbose --quiet --checksum \
- --archive --recursive --relative --backup \
- --backup-dir --suffix= --update --links \
- --copy-links --copy-unsafe-links --safe-links \
- --hard-links --perms --owner --group --devices\
- --times --sparse --dry-run --whole-file \
- --no-whole-file --one-file-system \
- --block-size= --rsh= --rsync-path= \
- --cvs-exclude --existing --ignore-existing \
- --delete --delete-excluded --delete-after \
- --ignore-errors --max-delete= --partial \
- --force --numeric-ids --timeout= \
- --ignore-times --size-only --modify-window= \
- --temp-dir= --compare-dest= --compress \
- --exclude= --exclude-from= --include= \
- --include-from= --version --daemon --no-detach\
- --address= --config= --port= --blocking-io \
- --no-blocking-io --stats --progress \
- --log-format= --password-file= --bwlimit= \
- --write-batch= --read-batch= --help' -- "$cur" ))
- ;;
- *:*)
- # find which remote shell is used
- 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
- if [[ "$shell" == ssh ]]; then
- # remove backslash escape from :
- cur=${cur/\\:/:}
- userhost=${cur%%?(\\):*}
- path=${cur#*:}
- # unescape spaces
- path=${path//\\\\\\\\ / }
- if [ -z "$path" ]; then
- # default to home dir of specified
- # user on remote host
- path=$(ssh -o 'Batchmode yes' $userhost pwd 2>/dev/null)
+ case $cur in
+ -*)
+ COMPREPLY=( $( compgen -W '--verbose --quiet --no-motd --checksum \
+ --archive --recursive --relative --no-implied-dirs \
+ --backup --backup-dir --suffix= --update --inplace --append \
+ --append-verify --dirs --old-dirs --links --copy-links \
+ --copy-unsafe-links --safe-links --copy-dirlinks \
+ --keep-dirlinks --hard-links --perms --executability --chmod= \
+ --acls --xattrs --owner --group --devices --copy-devices \
+ --specials --times --omit-dir-times --super --fake-super \
+ --sparse --dry-run --whole-file --no-whole-file \
+ --one-file-system --block-size= --rsh= --rsync-path= \
+ --existing --ignore-existing --remove-source-files --delete \
+ --delete-before --delete-during --delete-delay --delete-after \
+ --delete-excluded --ignore-errors --force --max-delete= \
+ --max-size= --min-size= --partial --partial-dir= \
+ --delay-updates --prune-empty-dirs --numeric-ids --timeout= \
+ --contimeout= --ignore-times --size-only --modify-window= \
+ --temp-dir= --fuzzy --compare-dest= --copy-dest= --link-dest= \
+ --compress --compress-level= --skip-compress= --cvs-exclude \
+ --filter= --exclude= --exclude-from= --include= \
+ --include-from= --files-from= --from0 --protect-args \
+ --address= --port= --sockopts= --blocking-io --no-blocking-io \
+ --stats --8-bit-output --human-readable --progress \
+ --itemize-changes --out-format= --log-file= \
+ --log-file-format= --password-file= --list-only --bwlimit= \
+ --write-batch= --only-write-batch= --read-batch= --protocol= \
+ --iconv= --ipv4 --ipv6 --version --help --daemon --config= \
+ --no-detach' -- "$cur" ) )
+ ;;
+ *:*)
+ if type _scp_remote_files &>/dev/null; then
+ # 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
- # escape spaces; remove executables, aliases, pipes
- # and sockets; add space at end of file names
- COMPREPLY=( $( ssh -o 'Batchmode yes' $userhost \
- command ls -aF1d "$path*" 2>/dev/null | \
- sed -e 's/ /\\\\\\\ /g' -e 's/[*@|=]$//g' \
- -e 's/[^\/]$/& /g' ) )
- fi
- ;;
- *)
- _known_hosts_real -c -a "$cur"
- _filedir
- ;;
+ ;;
+ *)
+ _known_hosts_real -c -a "$cur"
+ type _scp_local_files &>/dev/null && _scp_local_files || _filedir
+ ;;
esac
return 0
} &&
-complete -F _rsync $nospace $filenames rsync
+complete -F _rsync -o nospace rsync
# Local variables:
# mode: shell-script
diff --git a/contrib/rtcwake b/contrib/rtcwake
new file mode 100644
index 00000000..c95c1d76
--- /dev/null
+++ b/contrib/rtcwake
@@ -0,0 +1,40 @@
+# bash completion for rtcwake
+
+have rtcwake &&
+_rtcwake()
+{
+ COMPREPLY=()
+ local cur prev split=false
+ _get_comp_words_by_ref cur prev
+
+ _split_longopt && split=true
+
+ case "$prev" in
+ --help|-h|--version|-V|--seconds|-s|--time|-t)
+ return 0
+ ;;
+ --mode|-m)
+ COMPREPLY=( $( compgen -W 'standby mem disk on no off' -- "$cur" ) )
+ return 0
+ ;;
+ --device|-d)
+ COMPREPLY=( $( command ls -d /dev/rtc?* 2>/dev/null ) )
+ COMPREPLY=( $( compgen -W '${COMPREPLY[@]#/dev/}' -- "$cur" ) )
+ return 0
+ ;;
+ esac
+
+ $split && return 0
+
+ COMPREPLY=( $( compgen -W '--device --local --mode --seconds --time --utc \
+ --verbose --version --help' -- "$cur" ) )
+} &&
+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/contrib/samba b/contrib/samba
index 7256906e..61d78abc 100644
--- a/contrib/samba
+++ b/contrib/samba
@@ -32,8 +32,7 @@ _smbclient()
local cur prev split=false
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
_split_longopt && split=true
@@ -99,13 +98,12 @@ _smbget()
local cur prev split=false
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
_split_longopt && split=true
case $prev in
- -@(o|f|-outputfile|-rcfile))
+ -o|-f|--outputfile|--rcfile)
_filedir
return 0;
;;
@@ -132,8 +130,7 @@ _smbcacls()
local cur prev split=false
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
_split_longopt && split=true
@@ -166,8 +163,7 @@ _smbcquotas()
local cur prev split=false
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
_split_longopt && split=true
@@ -190,8 +186,8 @@ _smbcquotas()
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-u -L -F -S -n -t -v -h --help -V \
- -s -d --debuglevel -l --log-basename -N -k -A \
- --authentication-file -U --user' -- "$cur" ) )
+ -s --debuglevel --log-basename -N -k \
+ --authentication-file --user' -- "$cur" ) )
fi
}
complete -F _smbcquotas smbcquotas
@@ -201,8 +197,7 @@ _smbpasswd()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
case $prev in
-r)
@@ -235,11 +230,10 @@ _smbtar()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
case $prev in
- -@(r|t))
+ -r|-t)
_filedir tar
return 0;
;;
@@ -265,8 +259,7 @@ _smbtree()
local cur prev split=false
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
_split_longopt && split=true
diff --git a/contrib/sbcl b/contrib/sbcl
index 7a12f89d..a43ec1fc 100644
--- a/contrib/sbcl
+++ b/contrib/sbcl
@@ -7,7 +7,7 @@ _sbcl()
local cur
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
# completing an option (may or may not be separated by a space)
if [[ "$cur" == -* ]]; then
@@ -20,7 +20,7 @@ _sbcl()
return 0
} &&
-complete -F _sbcl $filenames sbcl sbcl-mt
+complete -F _sbcl -o filenames sbcl sbcl-mt
# Local variables:
# mode: shell-script
diff --git a/contrib/screen b/contrib/screen
index cd6baea2..cabc4b7a 100644
--- a/contrib/screen
+++ b/contrib/screen
@@ -8,30 +8,29 @@ _screen_sessions()
if [ -n "$1" ]; then
pattern=".*$1.*"
else
- pattern=".*"
+ pattern=".*"
fi
COMPREPLY=( $( command screen -ls | sed -ne \
- 's|^['$'\t'']\+\('"$cur"'[0-9]\+\.[^'$'\t'']\+\)'"$pattern"'$|\1|p' ) )
+ 's|^['$'\t'']\{1,\}\('"$cur"'[0-9]\{1,\}\.[^'$'\t'']\{1,\}\)'"$pattern"'$|\1|p' ) )
} &&
_screen()
{
- local cur prev preprev
+ local cur prev words cword
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev words cword
- [ "$COMP_CWORD" -ge 2 ] && preprev=${COMP_WORDS[COMP_CWORD-2]}
-
- case "$preprev" in
- -[dD])
- _screen_sessions
- return 0
- ;;
- esac
+ if ((cword > 2)); then
+ case ${words[cword-2]} in
+ -[dD])
+ _screen_sessions
+ return 0
+ ;;
+ esac
+ fi
- case "$prev" in
+ case $prev in
-[rR])
# list detached
_screen_sessions 'Detached'
@@ -43,8 +42,8 @@ _screen()
return 0
;;
-s)
- # shells
- COMPREPLY=( $( grep ^${cur:-[^#]} /etc/shells ) )
+ _shells
+ return 0
;;
-c)
_filedir
@@ -53,12 +52,12 @@ _screen()
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-a -A -c -d -D -e -f -fn -fa -h -i \
- -l -ln -ls -list -L -m -O -p -q -r -R -s -S -t -U -v \
- -wipe -x -X' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '-a -A -c -d -D -e -f -fn -fa -h -i -ln \
+ -list -L -m -O -p -q -r -R -s -S -t -U -v -wipe -x -X --help \
+ --version' -- "$cur" ) )
fi
} &&
-complete -F _screen $default screen
+complete -F _screen -o default screen
# Local variables:
# mode: shell-script
diff --git a/contrib/service b/contrib/service
new file mode 100644
index 00000000..9ebd117d
--- /dev/null
+++ b/contrib/service
@@ -0,0 +1,45 @@
+# service(8) and /etc/init.d/* completion
+
+# 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
+
+ # don't complete past 2nd token
+ [ $COMP_CWORD -gt 2 ] && return 0
+
+ [ -d /etc/rc.d/init.d ] && sysvdir=/etc/rc.d/init.d || sysvdir=/etc/init.d
+
+ if [[ $COMP_CWORD -eq 1 ]] && [[ $prev == "service" ]]; then
+ _services
+ else
+ COMPREPLY=( $( compgen -W '`sed -e "y/|/ /" \
+ -ne "s/^.*\(U\|msg_u\)sage.*{\(.*\)}.*$/\2/p" \
+ $sysvdir/${prev##*/} 2>/dev/null`' -- "$cur" ) )
+ fi
+
+ return 0
+} &&
+complete -F _service service
+[ -d /etc/init.d/ ] && complete -F _service -o default \
+ $(for i in /etc/init.d/*; do
+ complete -p ${i##*/} &>/dev/null || printf '%s\n' ${i##*/}; done)
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/shadow b/contrib/shadow
index c72718d0..a3451b7b 100644
--- a/contrib/shadow
+++ b/contrib/shadow
@@ -6,15 +6,14 @@ _useradd()
local cur prev split=false
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _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
+ case $prev in
-c|--comment|-h|--help|-e|--expiredate|-f|--inactive|-k|--key|-p|--password|-u|--uid|-Z|--selinux-user)
return 0
;;
@@ -24,14 +23,12 @@ _useradd()
;;
-g|--gid)
_gids
- [ -n "$bash205" ] && \
- COMPREPLY=( "${COMPREPLY[@]}" $( compgen -g ) )
- COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '${COMPREPLY[@]} $( compgen -g )' \
+ -- "$cur" ) )
return 0
;;
-G|--groups)
- [ -n "$bash205" ] && \
- COMPREPLY=( $( compgen -g -- "$cur" ) )
+ COMPREPLY=( $( compgen -g -- "$cur" ) )
return 0
;;
-s|--shell)
@@ -43,12 +40,11 @@ _useradd()
$split && return 0
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-b --base-dir -c --comment -d --home\
- -D --defaults -e --expiredate -f --inactive -g --gid \
- -G --groups -h --help -k --skel -K --key -l -M \
- -m --create-home -N --no-user-group -o --non-unique \
- -p --password -r --system -s --shell -u --uid \
- -U --user-group -Z --selinux-user' -- "$cur" ) )
+ 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
} &&
@@ -60,28 +56,25 @@ _usermod()
local cur prev split=false
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _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
+ 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
- [ -n "$bash205" ] && \
- COMPREPLY=( "${COMPREPLY[@]}" $( compgen -g ) )
- COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '${COMPREPLY[@]} $( compgen -g )' \
+ -- "$cur" ) )
return 0
;;
-G|--groups)
- [ -n "$bash205" ] && \
- COMPREPLY=( $( compgen -g -- "$cur" ) )
+ COMPREPLY=( $( compgen -g -- "$cur" ) )
return 0
;;
-s|--shell)
@@ -94,11 +87,10 @@ _usermod()
if [[ "$cur" == -* ]]; then
# TODO: -U/--unlock, -p/--password, -L/--lock mutually exclusive
- COMPREPLY=( $( compgen -W '-a --append -c --comment -d --home \
- -e --expiredate -f --inactive -g --gid -G --groups \
- -h --help -l --login -L --lock -o --non-unique \
- -p --password -s --shell -u --uid -U --unlock \
- -Z --selinux-user' -- "$cur" ) )
+ 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
@@ -112,11 +104,10 @@ _userdel()
local cur
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-f --force -h --help -r --remove' \
- -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '--force --help --remove' -- "$cur" ) )
return 0
fi
@@ -130,12 +121,11 @@ _chage()
local cur prev split=false
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
_split_longopt && split=true
- case "$prev" in
+ case $prev in
-d|--lastday|-E|--expiredate|-h|--help|-I|--inactive|-m|--mindays|-M|--maxdays|-W|--warndays)
return 0
;;
@@ -144,9 +134,8 @@ _chage()
$split && return 0
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-d --lastday -E --expiredate \
- -h --help -I --inactive -l --list -m --mindays \
- -M --maxdays -W --warndays' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '--lastday --expiredate --help --inactive \
+ --list --mindays --maxdays --warndays' -- "$cur" ) )
return 0
fi
@@ -160,10 +149,9 @@ _passwd()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
- case "$prev" in
+ case $prev in
-n|-x|-w|-i|-\?|--help|--usage)
return 0
;;
@@ -185,12 +173,11 @@ _chpasswd()
local cur prev split=false
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
_split_longopt && split=true
- case "$prev" in
+ case $prev in
-c|--crypt)
COMPREPLY=( $( compgen -W 'DES MD5 NONE SHA256 SHA512' \
-- "$cur" ) )
@@ -204,8 +191,8 @@ _chpasswd()
$split && return 0
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-c --crypt-method -e --encrypted \
- -h --help -m --md5 -s --sha-rounds' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '--crypt-method --encrypted \
+ --help --md5 --sha-rounds' -- "$cur" ) )
return 0
fi
} &&
@@ -217,12 +204,11 @@ _newusers()
local cur prev split=false
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
_split_longopt && split=true
- case "$prev" in
+ case $prev in
-c|--crypt)
COMPREPLY=( $( compgen -W 'DES MD5 NONE SHA256 SHA512' \
-- "$cur" ) )
@@ -236,14 +222,14 @@ _newusers()
$split && return 0
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-c --crypt-method --r --system \
- -s --sha-rounds' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '--crypt-method --help --system \
+ --sha-rounds' -- "$cur" ) )
return 0
fi
_filedir
} &&
-complete -F _newusers $filenames newusers
+complete -F _newusers -o filenames newusers
have pwck &&
_pwck()
@@ -251,7 +237,7 @@ _pwck()
local cur
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-q -r -s' -- "$cur" ) )
@@ -260,7 +246,7 @@ _pwck()
_filedir
} &&
-complete -F _pwck $filenames pwck
+complete -F _pwck -o filenames pwck
have groupadd &&
_groupadd()
@@ -268,15 +254,14 @@ _groupadd()
local cur prev split=false
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _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
+ case $prev in
-g|--gid|-K|--key|-p|--password)
return 0
;;
@@ -285,9 +270,8 @@ _groupadd()
$split && return 0
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-f --force -g --gid -h --help \
- -K --key -o --non-unique -p --password -r --system' \
- -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '--force --gid --help \
+ --key --non-unique --password --system' -- "$cur" ) )
return 0
fi
} &&
@@ -299,15 +283,14 @@ _groupmod()
local cur prev split=false
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _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
+ case $prev in
-g|--gid|-h|--help|-n|--new-name|-p|--password)
return 0
;;
@@ -316,16 +299,16 @@ _groupmod()
$split && return 0
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-g --gid -h --help -n --new-name \
- -o --non-unique -p --password' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '--gid --help --new-name \
+ --non-unique --password' -- "$cur" ) )
return 0
fi
- [ -n "$bash205" ] && COMPREPLY=( $( compgen -g -- "$cur" ) )
+ COMPREPLY=( $( compgen -g -- "$cur" ) )
} &&
complete -F _groupmod groupmod
-[ -n "$bash205" ] && complete -g groupdel
+complete -g groupdel
have newgrp &&
_newgrp()
@@ -335,7 +318,7 @@ _newgrp()
COMPREPLY=( - )
fi
} &&
-complete ${bash205:+-g} -F _newgrp newgrp
+complete -g -F _newgrp newgrp
have gpasswd &&
_gpasswd()
@@ -343,10 +326,9 @@ _gpasswd()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
- case "$prev" in
+ case $prev in
-a|-d|-A|-M)
COMPREPLY=( $( compgen -u -- "$cur" ) )
return 0
@@ -358,7 +340,7 @@ _gpasswd()
return 0
fi
- [ -n "$bash205" ] && COMPREPLY=( $( compgen -g -- "$cur" ) )
+ COMPREPLY=( $( compgen -g -- "$cur" ) )
} &&
complete -F _gpasswd gpasswd
@@ -368,17 +350,15 @@ _groupmems()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
- case "$prev" in
+ case $prev in
-a|-d)
COMPREPLY=( $( compgen -u -- "$cur" ) )
return 0
;;
-g)
- [ -n "$bash205" ] && \
- COMPREPLY=( $( compgen -g -- "$cur" ) )
+ COMPREPLY=( $( compgen -g -- "$cur" ) )
return 0
;;
esac
@@ -396,7 +376,7 @@ _grpck()
local cur
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-r -s' -- "$cur" ) )
@@ -405,7 +385,7 @@ _grpck()
_filedir
} &&
-complete -F _grpck $filenames grpck
+complete -F _grpck -o filenames grpck
have vipw || have vigr &&
_vipw()
@@ -413,18 +393,17 @@ _vipw()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
- case "$prev" in
+ case $prev in
-h|--help)
return 0
;;
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-g --group -h --help -p --passwd \
- -q --quiet -s --shadow' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '--group --help --passwd \
+ --quiet --shadow' -- "$cur" ) )
return 0
fi
} &&
@@ -436,12 +415,11 @@ _faillog()
local cur prev split=false
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
_split_longopt && split=true
- case "$prev" in
+ case $prev in
-h|--help|-l|--lock-time|-m|--maximum|-t|--time)
return 0
;;
@@ -454,8 +432,8 @@ _faillog()
$split && return 0
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-a --all -h --help -l --lock-time \
- -m --maximum -r --reset -t --time -u --user' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '--all --help --lock-time \
+ --maximum --reset --time --user' -- "$cur" ) )
return 0
fi
} &&
@@ -467,12 +445,11 @@ _lastlog()
local cur prev split=false
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
_split_longopt && split=true
- case "$prev" in
+ case $prev in
-b|--before|-h|--help|-t|--time)
return 0
;;
@@ -485,8 +462,7 @@ _lastlog()
$split && return 0
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-b --before -h --help -t --time \
- -u --user' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '--before --help --time --user' -- "$cur" ) )
return 0
fi
} &&
diff --git a/contrib/sitecopy b/contrib/sitecopy
index abf3d928..616bc5e4 100644
--- a/contrib/sitecopy
+++ b/contrib/sitecopy
@@ -8,20 +8,20 @@ _sitecopy()
local cur
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
- case "$cur" in
+ case $cur in
--*)
- COMPREPLY=( $( compgen -W "$(sitecopy -h | grep -e '--\w' | \
+ COMPREPLY=( $( compgen -W "$(sitecopy -h | command grep -e '--\w' |\
awk '{sub (/=(FILE|PATH)/, "", $2); print $2}')" -- "$cur" ) )
;;
-*)
- COMPREPLY=( $( compgen -W "$(sitecopy -h | grep -e '-\w' | \
+ COMPREPLY=( $( compgen -W "$(sitecopy -h | command grep -e '-\w' | \
awk '{sub (",", "", $1); print $1}')" -- "$cur" ) )
;;
*)
if [ -r ~/.sitecopyrc ]; then
- COMPREPLY=( $( compgen -W "$(grep '^["$'\t '"]*site' \
+ COMPREPLY=( $( compgen -W "$(command grep '^["$'\t '"]*site' \
~/.sitecopyrc | awk '{print $2}')" -- "$cur" ) )
fi
;;
@@ -29,7 +29,7 @@ _sitecopy()
return 0
} &&
-complete -F _sitecopy $default sitecopy
+complete -F _sitecopy -o default sitecopy
# Local variables:
# mode: shell-script
diff --git a/contrib/smartctl b/contrib/smartctl
index 5108269f..74e42816 100644
--- a/contrib/smartctl
+++ b/contrib/smartctl
@@ -1,141 +1,138 @@
# bash completion for smartctl(8)
-have smartctl && {
+have smartctl &&
+{
_smartctl_quietmode()
{
- COMPREPLY=( $( compgen -W 'errorsonly silent noserial' -- "$cur" ) )
+ 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" ) )
+ 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" ) )
}
_smartctl_tolerance()
{
- COMPREPLY=( $( compgen -W 'normal conservative permissive \
- verypermissive' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W 'normal conservative permissive \
+ verypermissive' -- "$cur" ) )
}
_smartctl_badsum()
{
- COMPREPLY=( $( compgen -W 'warn exit ignore' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W 'warn exit ignore' -- "$cur" ) )
}
_smartctl_report()
{
- COMPREPLY=( $( compgen -W 'ioctl ataioctl scsiioctl' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W 'ioctl ataioctl scsiioctl' -- "$cur" ) )
}
_smartctl_powermode()
{
- COMPREPLY=( $( compgen -W 'never sleep standby idle' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W 'never sleep standby idle' -- "$cur" ) )
}
_smartctl_feature()
{
- COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) )
}
_smartctl_log()
{
- COMPREPLY=( $( compgen -W 'error selftest selective directory' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W 'error selftest selective directory' -- "$cur" ) )
}
_smartctl_vendorattribute()
{
- COMPREPLY=( $( compgen -W 'help 9,minutes 9,seconds 9,halfminutes \
- 9,temp 192,emergencyretractcyclect 193,loadunload \
- 194,10xCelsius 194,unknown 198,offlinescanuncsectorct \
- 200,writeerrorcount 201,detectedtacount 220,temp' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W 'help 9,minutes 9,seconds 9,halfminutes \
+ 9,temp 192,emergencyretractcyclect 193,loadunload \
+ 194,10xCelsius 194,unknown 198,offlinescanuncsectorct \
+ 200,writeerrorcount 201,detectedtacount 220,temp' -- "$cur" ) )
}
_smartctl_firmwarebug()
{
- COMPREPLY=( $( compgen -W 'none samsung samsung2 samsung3 swapid' \
+ COMPREPLY=( $( compgen -W 'none samsung samsung2 samsung3 swapid' \
-- "$cur" ) )
}
_smartctl_presets()
{
- COMPREPLY=( $( compgen -W 'use ignore show showall' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W 'use ignore show showall' -- "$cur" ) )
}
_smartctl_test()
{
- COMPREPLY=( $( compgen -W 'offline short long conveyance select \
- afterselect,on afterselect,off pending scttempint' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W 'offline short long conveyance select \
+ afterselect,on afterselect,off pending scttempint' -- "$cur" ) )
}
_smartctl()
{
- local cur prev split=false
+ local cur prev split=false
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ COMPREPLY=()
+ _get_comp_words_by_ref cur prev
- _split_longopt && split=true
+ _split_longopt && split=true
- case "$prev" in
- -q|--quietmode)
- _smartctl_quietmode
- ;;
- -d|--device)
- _smartctl_device
- return 0
- ;;
- -t|--tolerance)
- _smartctl_tolerance
- return 0
- ;;
- -b|--badsum)
- _smartctl_badsum
- return 0
- ;;
- -r|--report)
- _smartctl_report
- return 0
- ;;
- -n|--nocheck)
- _smartctl_powermode
- return 0
- ;;
- -s|--smart|-o|--offlineauto|-S|--saveauto)
- _smartctl_feature
- return 0
- ;;
- -l|--log)
- _smartctl_log
- return 0
- ;;
- -v|--vendorattribute)
- _smartctl_vendorattribute
- return 0
- ;;
- -F|--firmwarebug)
- _smartctl_firmwarebug
- return 0
- ;;
- -P|--presets)
- _smartctl_presets
- return 0
- ;;
- -t|--test)
- _smartctl_test
- return 0
- ;;
- esac
+ case $prev in
+ -q|--quietmode)
+ _smartctl_quietmode
+ ;;
+ -d|--device)
+ _smartctl_device
+ return 0
+ ;;
+ -t|--tolerance)
+ _smartctl_tolerance
+ return 0
+ ;;
+ -b|--badsum)
+ _smartctl_badsum
+ return 0
+ ;;
+ -r|--report)
+ _smartctl_report
+ return 0
+ ;;
+ -n|--nocheck)
+ _smartctl_powermode
+ return 0
+ ;;
+ -s|--smart|-o|--offlineauto|-S|--saveauto)
+ _smartctl_feature
+ return 0
+ ;;
+ -l|--log)
+ _smartctl_log
+ return 0
+ ;;
+ -v|--vendorattribute)
+ _smartctl_vendorattribute
+ return 0
+ ;;
+ -F|--firmwarebug)
+ _smartctl_firmwarebug
+ return 0
+ ;;
+ -P|--presets)
+ _smartctl_presets
+ return 0
+ ;;
+ -t|--test)
+ _smartctl_test
+ return 0
+ ;;
+ esac
- $split && return 0
+ $split && return 0
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-h --help --usage -V --version \
- --copyright --license-i --info -a --all -q \
- --quietmode -d --device -T --tolerance -b --badsum \
- -r --report -n --nocheck -s --smart -o --offlineauto \
- -S --saveauto -H --health -c --capabilities -A \
- --attributes -l --log -v --vendorattribute -F \
- --firmwarebug -P --presets -t --test -C \
- --captive -X --abort' -- "$cur" ) )
- else
- cur=${cur:=/dev/}
- _filedir
- fi
+ 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" ) )
+ else
+ cur=${cur:=/dev/}
+ _filedir
+ fi
}
complete -F _smartctl smartctl
}
diff --git a/contrib/snownews b/contrib/snownews
index 8d89b78c..9c99ed7c 100644
--- a/contrib/snownews
+++ b/contrib/snownews
@@ -1,4 +1,4 @@
-# snownews completion by Guillaume Rousse <rousse@ccr.jussieu.fr>
+# snownews(1) completion
have snownews &&
_snownews()
@@ -6,7 +6,7 @@ _snownews()
local cur
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then
# return list of available options
diff --git a/contrib/ssh b/contrib/ssh
index 0215ffd7..b4bafdee 100644
--- a/contrib/ssh
+++ b/contrib/ssh
@@ -1,108 +1,194 @@
# ssh(1) completion
-have ssh && {
-
-_ssh_options() {
- COMPREPLY=( $( compgen -W 'AddressFamily BatchMode BindAddress \
- ChallengeResponseAuthentication CheckHostIP Cipher Ciphers \
- ClearAllForwardings Compression CompressionLevel \
- ConnectionAttempts ConnectTimeout ControlMaster ControlPath \
- DynamicForward EscapeChar ExitOnForwardFailure ForwardAgent \
- ForwardX11 ForwardX11Trusted GatewayPorts GlobalKnownHostsFile \
- GSSAPIAuthentication GSSAPIDelegateCredentials HashKnownHosts \
- Host HostbasedAuthentication HostKeyAlgorithms HostKeyAlias \
- HostName IdentityFile IdentitiesOnly KbdInteractiveDevices \
- LocalCommand LocalForward LogLevel MACs \
- NoHostAuthenticationForLocalhost NumberOfPasswordPrompts \
- PasswordAuthentication PermitLocalCommand Port \
- PreferredAuthentications Protocol ProxyCommand \
- PubkeyAuthentication RekeyLimit RemoteForward \
- RhostsRSAAuthentication RSAAuthentication SendEnv \
- ServerAliveInterval ServerAliveCountMax SmartcardDevice \
- StrictHostKeyChecking TCPKeepAlive Tunnel TunnelDevice \
- UsePrivilegedPort User UserKnownHostsFile VerifyHostKeyDNS \
- VisualHostKey XAuthLocation' -- "$cur" ) )
+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_ciphers()
+{
+ COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W '3des-cbc aes128-cbc \
+ aes192-cbc aes256-cbc aes128-ctr aes192-ctr aes256-ctr arcfour128 \
+ arcfour256 arcfour blowfish-cbc cast128-cbc' -- "$cur" ) )
+}
+
+_ssh_macs()
+{
+ COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W 'hmac-md5 hmac-sha1 \
+ umac-64@openssh.com hmac-ripemd160 hmac-sha1-96 hmac-md5-96' \
+ -- "$cur" ) )
+}
+
+_ssh_options()
+{
+ type compopt &>/dev/null && compopt -o nospace
+ COMPREPLY=( $( compgen -S = -W 'AddressFamily BatchMode BindAddress \
+ ChallengeResponseAuthentication CheckHostIP Cipher Ciphers \
+ ClearAllForwardings Compression CompressionLevel ConnectionAttempts \
+ ConnectTimeout ControlMaster ControlPath DynamicForward EscapeChar \
+ ExitOnForwardFailure ForwardAgent ForwardX11 ForwardX11Trusted \
+ GatewayPorts GlobalKnownHostsFile GSSAPIAuthentication \
+ GSSAPIDelegateCredentials HashKnownHosts Host HostbasedAuthentication \
+ HostKeyAlgorithms HostKeyAlias HostName IdentityFile IdentitiesOnly \
+ KbdInteractiveDevices LocalCommand LocalForward LogLevel MACs \
+ NoHostAuthenticationForLocalhost NumberOfPasswordPrompts \
+ PasswordAuthentication PermitLocalCommand Port \
+ PreferredAuthentications Protocol ProxyCommand PubkeyAuthentication \
+ RekeyLimit RemoteForward RhostsRSAAuthentication RSAAuthentication \
+ SendEnv ServerAliveInterval ServerAliveCountMax SmartcardDevice \
+ StrictHostKeyChecking TCPKeepAlive Tunnel TunnelDevice \
+ UsePrivilegedPort User UserKnownHostsFile VerifyHostKeyDNS \
+ VisualHostKey XAuthLocation' -- "$cur" ) )
+}
+
+# Complete a ssh suboption (like ForwardAgent=y<tab>)
+# Only one parameter: the string to complete including the equal sign.
+# Not all suboptions are completed.
+# Doesn't handle comma-separated lists.
+_ssh_suboption()
+{
+ # Split into subopt and subval
+ local prev=${1%%=*} cur=${1#*=}
+
+ case $prev in
+ BatchMode|ChallengeResponseAuthentication|CheckHostIP|\
+ ClearAllForwardings|Compression|ExitOnForwardFailure|ForwardAgent|\
+ ForwardX11|ForwardX11Trusted|GatewayPorts|GSSAPIAuthentication|\
+ GSSAPIKeyExchange|GSSAPIDelegateCredentials|GSSAPITrustDns|\
+ HashKnownHosts|HostbasedAuthentication|IdentitiesOnly|\
+ KbdInteractiveAuthentication|KbdInteractiveDevices|\
+ NoHostAuthenticationForLocalhost|PasswordAuthentication|\
+ PubkeyAuthentication|RhostsRSAAuthentication|RSAAuthentication|\
+ StrictHostKeyChecking|TCPKeepAlive|UsePrivilegedPort|\
+ VerifyHostKeyDNS|VisualHostKey)
+ COMPREPLY=( $( compgen -W 'yes no' -- "$cur") )
+ ;;
+ AddressFamily)
+ COMPREPLY=( $( compgen -W 'any inet inet6' -- "$cur" ) )
+ ;;
+ BindAddress)
+ _ssh_bindaddress
+ ;;
+ Cipher)
+ COMPREPLY=( $( compgen -W 'blowfish des 3des' -- "$cur" ) )
+ ;;
+ Protocol)
+ COMPREPLY=( $( compgen -W '1 2 1,2 2,1' -- "$cur" ) )
+ ;;
+ Tunnel)
+ COMPREPLY=( $( compgen -W 'yes no point-to-point ethernet' \
+ -- "$cur" ) )
+ ;;
+ PreferredAuthentications)
+ COMPREPLY=( $( compgen -W 'gssapi-with-mic host-based \
+ publickey keyboard-interactive password' -- "$cur" ) )
+ ;;
+ MACs)
+ _ssh_macs
+ ;;
+ Ciphers)
+ _ssh_ciphers
+ ;;
+ esac
+ return 0
+}
+
+# Try to complete -o SubOptions=
+#
+# Returns 0 if the completion was handled or non-zero otherwise.
+_ssh_suboption_check()
+{
+ # Get prev and cur words without splitting on =
+ local cureq=`_get_cword :=` preveq=`_get_pword :=`
+ if [[ $cureq == *=* && $preveq == -o ]]; then
+ _ssh_suboption $cureq
+ return $?
+ fi
+ return 1
}
_ssh()
{
- local cur prev configfile
- local -a config
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case "$prev" in
- -@(F|i|S))
- _filedir
- return 0
- ;;
- -c)
- 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" ) )
- return 0
- ;;
- -c)
- COMPREPLY=( $( compgen -W 'hmac-md5 hmac-sha1 \
- umac-64@openssh.com hmac-ripemd160 \
- hmac-sha1-96 hmac-md5-96' -- "$cur" ) )
- return 0
- ;;
- -l)
- COMPREPLY=( $( compgen -u -- "$cur" ) )
- return 0
- ;;
- -o)
- _ssh_options
- return 0
- ;;
- -w)
- _available_interfaces
- return 0
- ;;
- -b)
- COMPREPLY=( $( compgen -W "$(/sbin/ifconfig | \
- awk '/adr:/ {print $2}' | \
- awk -F: '{print $2}' )" -- "$cur" ) )
- return 0
- ;;
- esac
-
- if [[ "$cur" == -F* ]]; then
- cur=${cur#-F}
- _filedir
- # Prefix completions with '-F'
- COMPREPLY=( "${COMPREPLY[@]/#/-F}" )
- cur=-F$cur # Restore cur
- elif [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-1 -2 -4 -6 -A -a -C -f -g -K -k -M \
- -N -n -q -s -T -t -V -v -X -v -Y -y -b -b -c -D -e -F \
- -i -L -l -m -O -o -p -R -S -w' -- "$cur" ) )
- else
- # Search COMP_WORDS for '-F configfile' or '-Fconfigfile' argument
- set -- "${COMP_WORDS[@]}"
- while [ $# -gt 0 ]; do
- if [ "${1:0:2}" = -F ]; then
- if [ ${#1} -gt 2 ]; then
- configfile="$(dequote "${1:2}")"
- else
- shift
- [ "$1" ] && configfile="$(dequote "$1")"
- fi
- break
- fi
- shift
- done
- _known_hosts_real -a -F "$configfile" "$cur"
- if [ $COMP_CWORD -ne 1 ]; then
- COMPREPLY=( "${COMPREPLY[@]}" $( compgen -c -- "$cur" ) )
- fi
- fi
-
- return 0
+ local cur prev configfile
+ local -a config
+
+ COMPREPLY=()
+ _get_comp_words_by_ref -n : cur prev
+ #cur=`_get_cword :`
+ #prev=`_get_pword`
+
+ _ssh_suboption_check && return 0
+
+ case $prev in
+ -F|-i|-S)
+ _filedir
+ return 0
+ ;;
+ -c)
+ _ssh_ciphers
+ return 0
+ ;;
+ -m)
+ _ssh_macs
+ return 0
+ ;;
+ -l)
+ COMPREPLY=( $( compgen -u -- "$cur" ) )
+ return 0
+ ;;
+ -o)
+ _ssh_options
+ return 0
+ ;;
+ -w)
+ _available_interfaces
+ return 0
+ ;;
+ -b)
+ _ssh_bindaddress
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -F* ]]; then
+ cur=${cur#-F}
+ _filedir
+ # Prefix completions with '-F'
+ 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" ) )
+ else
+ # Search COMP_WORDS for '-F configfile' or '-Fconfigfile' argument
+ set -- "${COMP_WORDS[@]}"
+ while [ $# -gt 0 ]; do
+ if [ "${1:0:2}" = -F ]; then
+ if [ ${#1} -gt 2 ]; then
+ configfile="$(dequote "${1:2}")"
+ else
+ shift
+ [ "$1" ] && configfile="$(dequote "$1")"
+ fi
+ break
+ fi
+ shift
+ done
+ _known_hosts_real -a -F "$configfile" "$cur"
+ if [ $COMP_CWORD -ne 1 ]; then
+ COMPREPLY=( "${COMPREPLY[@]}" $( compgen -c -- "$cur" ) )
+ fi
+ fi
+
+ return 0
}
shopt -u hostcomplete && complete -F _ssh ssh slogin autossh
@@ -110,144 +196,226 @@ shopt -u hostcomplete && complete -F _ssh ssh slogin autossh
#
_sftp()
{
- local cur prev configfile
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case "$prev" in
- -@(b|F|P))
- _filedir
- return 0
- ;;
- -o)
- _ssh_options
- return 0
- ;;
- esac
-
- if [[ "$cur" == -F* ]]; then
- cur=${cur#-F}
- _filedir
- # Prefix completions with '-F'
- COMPREPLY=( "${COMPREPLY[@]/#/-F}" )
- cur=-F$cur # Restore cur
- elif [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-1 -C -v -B -b -F -o -P -R -S -s' \
- -- "$cur" ) )
- else
- # Search COMP_WORDS for '-F configfile' argument
- set -- "${COMP_WORDS[@]}"
- while [ $# -gt 0 ]; do
- if [ "${1:0:2}" = -F ]; then
- if [ ${#1} -gt 2 ]; then
- configfile="$(dequote "${1:2}")"
- else
- shift
- [ "$1" ] && configfile="$(dequote "$1")"
- fi
- break
- fi
- shift
- done
- _known_hosts_real -a -F "$configfile" "$cur"
- fi
-
- return 0
+ local cur prev configfile
+
+ COMPREPLY=()
+ _get_comp_words_by_ref cur prev
+
+ _ssh_suboption_check && return 0
+
+ case $prev in
+ -b|-F|-P)
+ _filedir
+ return 0
+ ;;
+ -o)
+ _ssh_options
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -F* ]]; then
+ cur=${cur#-F}
+ _filedir
+ # Prefix completions with '-F'
+ 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" ) )
+ else
+ # Search COMP_WORDS for '-F configfile' argument
+ set -- "${COMP_WORDS[@]}"
+ while [ $# -gt 0 ]; do
+ if [ "${1:0:2}" = -F ]; then
+ if [ ${#1} -gt 2 ]; then
+ configfile="$(dequote "${1:2}")"
+ else
+ shift
+ [ "$1" ] && configfile="$(dequote "$1")"
+ fi
+ break
+ fi
+ shift
+ done
+ _known_hosts_real -a -F "$configfile" "$cur"
+ fi
+
+ return 0
}
shopt -u hostcomplete && complete -F _sftp sftp
+# things we want to escape in remote scp paths
+_scp_path_esc="[][(){}<>\",:;^&\!$=?\`|\\ ']"
+
+# Complete remote files with ssh. If the first arg is -d, complete on dirs
+# only. Returns paths escaped with three backslashes.
+_scp_remote_files()
+{
+ local IFS=$'\t\n'
+
+ # remove backslash escape from the first colon
+ cur=${cur/\\:/:}
+
+ local userhost=${cur%%?(\\):*}
+ local path=${cur#*:}
+
+ # unescape (3 backslashes to 1 for chars we escaped)
+ path=$( sed -e 's/\\\\\\\('$_scp_path_esc'\)/\\\1/g' <<<"$path" )
+
+ # default to home dir of specified user on remote host
+ if [ -z "$path" ]; then
+ path=$(ssh -o 'Batchmode yes' $userhost pwd 2>/dev/null)
+ fi
+
+ local files
+ if [ "$1" = -d ] ; then
+ # escape problematic characters; remove non-dirs
+ files=$( ssh -o 'Batchmode yes' $userhost \
+ command ls -aF1d "$path*" 2>/dev/null | \
+ sed -e 's/'$_scp_path_esc'/\\\\\\&/g' -e '/[^\/]$/d' )
+ else
+ # escape problematic characters; remove executables, aliases, pipes
+ # and sockets; add space at end of file names
+ files=$( ssh -o 'Batchmode yes' $userhost \
+ command ls -aF1d "$path*" 2>/dev/null | \
+ sed -e 's/'$_scp_path_esc'/\\\\\\&/g' -e 's/[*@|=]$//g' \
+ -e 's/[^\/]$/& /g' )
+ fi
+ COMPREPLY=( "${COMPREPLY[@]}" $files )
+}
+
+# This approach is used instead of _filedir to get a space appended
+# after local file/dir completions, and -o nospace retained for others.
+# If first arg is -d, complete on directory names only. The next arg is
+# an optional prefix to add to returned completions.
+_scp_local_files()
+{
+ local IFS=$'\t\n'
+
+ local dirsonly=false
+ if [ "$1" = -d ]; then
+ dirsonly=true
+ shift
+ fi
+
+ if $dirsonly ; then
+ COMPREPLY=( "${COMPREPLY[@]}" $( command ls -aF1d $cur* 2>/dev/null | \
+ sed -e "s/$_scp_path_esc/\\\\&/g" -e '/[^\/]$/d' -e "s/^/$1/") )
+ else
+ COMPREPLY=( "${COMPREPLY[@]}" $( command ls -aF1d $cur* 2>/dev/null | \
+ sed -e "s/$_scp_path_esc/\\\\&/g" -e 's/[*@|=]$//g' \
+ -e 's/[^\/]$/& /g' -e "s/^/$1/") )
+ fi
+}
# scp(1) completion
#
_scp()
{
- local configfile cur userhost path prefix
-
- COMPREPLY=()
- cur=`_get_cword ":"`
-
- _expand || return 0
-
- if [[ "$cur" == *:* ]]; then
- local IFS=$'\t\n'
- # remove backslash escape from :
- cur=${cur/\\:/:}
- userhost=${cur%%?(\\):*}
- path=${cur#*:}
- # unescape spaces
- path=${path//\\\\\\\\ / }
- if [ -z "$path" ]; then
- # default to home dir of specified user on remote host
- path=$(ssh -o 'Batchmode yes' $userhost pwd 2>/dev/null)
- fi
- # escape spaces; remove executables, aliases, pipes and sockets;
- # add space at end of file names
- COMPREPLY=( $( ssh -o 'Batchmode yes' $userhost \
- command ls -aF1d "$path*" 2>/dev/null | \
- sed -e "s/[][(){}<>\",:;^&\!$=?\`|\\ ']/\\\\\\\\\\\\&/g" \
- -e 's/[*@|=]$//g' -e 's/[^\/]$/& /g' ) )
- return 0
- fi
-
- if [[ "$cur" = -F* ]]; then
- cur=${cur#-F}
- prefix=-F
- else
- # Search COMP_WORDS for '-F configfile' or '-Fconfigfile' argument
- set -- "${COMP_WORDS[@]}"
- while [ $# -gt 0 ]; do
- if [ "${1:0:2}" = -F ]; then
- if [ ${#1} -gt 2 ]; then
- configfile="$(dequote "${1:2}")"
- else
- shift
- [ "$1" ] && configfile="$(dequote "$1")"
- fi
- break
- fi
- shift
- done
-
- [[ "$cur" == */* ]] || _known_hosts_real -c -a -F "$configfile" "$cur"
- fi
- # This approach is used instead of _filedir to get a space appended
- # after local file/dir completions, and $nospace retained for others.
- local IFS=$'\t\n'
- COMPREPLY=( "${COMPREPLY[@]}" $( command ls -aF1d $cur* 2>/dev/null | sed \
- -e "s/[][(){}<>\",:;^&\!$=?\`|\\ ']/\\\\&/g" \
- -e 's/[*@|=]$//g' -e 's/[^\/]$/& /g' -e "s/^/$prefix/") )
-
- return 0
+ local configfile cur prev prefix
+
+ COMPREPLY=()
+ _get_comp_words_by_ref -n : cur prev
+
+ _ssh_suboption_check && {
+ COMPREPLY=( "${COMPREPLY[@]/%/ }" )
+ return 0
+ }
+
+ case $prev in
+ -l|-P)
+ return 0
+ ;;
+ -F|-i|-S)
+ _filedir
+ type compopt &>/dev/null && compopt +o nospace
+ return 0
+ ;;
+ -c)
+ _ssh_ciphers
+ COMPREPLY=( "${COMPREPLY[@]/%/ }" )
+ return 0
+ ;;
+ -o)
+ _ssh_options
+ return 0
+ ;;
+ esac
+
+ _expand || return 0
+
+ if [[ "$cur" == *:* ]]; then
+ _scp_remote_files
+ return 0
+ fi
+
+ if [[ "$cur" == -F* ]]; then
+ cur=${cur#-F}
+ prefix=-F
+ else
+ # Search COMP_WORDS for '-F configfile' or '-Fconfigfile' argument
+ set -- "${COMP_WORDS[@]}"
+ while [ $# -gt 0 ]; do
+ if [ "${1:0:2}" = -F ]; then
+ if [ ${#1} -gt 2 ]; then
+ configfile="$(dequote "${1:2}")"
+ else
+ shift
+ [ "$1" ] && configfile="$(dequote "$1")"
+ fi
+ break
+ fi
+ shift
+ done
+
+ case $cur in
+ -*)
+ COMPREPLY=( $( compgen -W '-1 -2 -4 -6 -B -C -c -F -i -l -o \
+ -P -p -q -r -S -v' -- "$cur" ) )
+ COMPREPLY=( "${COMPREPLY[@]/%/ }" )
+ return 0
+ ;;
+ */*)
+ # pass through
+ ;;
+ *)
+ _known_hosts_real -c -a -F "$configfile" "$cur"
+ ;;
+ esac
+ fi
+
+ _scp_local_files "$prefix"
+
+ return 0
}
-complete -F _scp $nospace scp sshfs
+complete -F _scp -o nospace scp
# ssh-copy-id(1) completion
#
-_ssh_copy_id() {
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case "$prev" in
- -i)
- _filedir
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-i' -- "$cur" ) )
- else
- _known_hosts_real -a "$cur"
- fi
-
- return 0
+_ssh_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 $filenames ssh-copy-id
+complete -F _ssh_copy_id -o filenames ssh-copy-id
}
# Local variables:
diff --git a/contrib/sshfs b/contrib/sshfs
new file mode 100644
index 00000000..d7945f88
--- /dev/null
+++ b/contrib/sshfs
@@ -0,0 +1,34 @@
+# sshfs(1) completion
+
+have sshfs &&
+_sshfs()
+{
+ local cur userhost path
+
+ COMPREPLY=()
+ _get_comp_words_by_ref -n : cur
+
+ _expand || return 0
+
+ if [[ "$cur" == *:* ]] && type _scp_remote_files &>/dev/null ; then
+ _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"
+
+ type _scp_local_files &>/dev/null && _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/contrib/strace b/contrib/strace
index 7925890a..9b3e2676 100644
--- a/contrib/strace
+++ b/contrib/strace
@@ -9,7 +9,7 @@ _strace()
offset=0
for (( i=1; i <= COMP_CWORD; i++ )); do
case ${COMP_WORDS[$i]} in
- -@(o|e|p))
+ -o|-e|-p)
i=$((i+1))
continue
;;
@@ -27,8 +27,7 @@ _strace()
else
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
case $prev in
-e)
@@ -43,7 +42,7 @@ _strace()
/usr/include/asm/unistd.h | sed -e \
's/__NR_//')
if [ -z "$syscalls" ]; then
- if [[ "$arch" =~ 86$ ]]; then
+ if [[ "$arch" == *86 ]]; then
unistd=/usr/include/asm/unistd_32.h
else
unistd=/usr/include/asm/unistd_64.h
@@ -84,7 +83,7 @@ _strace()
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-c -d -f -ff -F -h --help -i -q \
+ COMPREPLY=( $( compgen -W '-c -d -f -ff -F --help -i -q \
-r -t -tt -ttt -T -v -V -x -xx -a -e -o -O -p \
-s -S -u -E' -- "$cur" ) )
else
@@ -92,7 +91,7 @@ _strace()
fi
fi
} &&
-complete -F _strace $default strace
+complete -F _strace -o default strace
# Local variables:
# mode: shell-script
diff --git a/contrib/svk b/contrib/svk
index 1b6f70fd..c809d2eb 100644
--- a/contrib/svk
+++ b/contrib/svk
@@ -1,4 +1,4 @@
-# svk completion by Guillaume Rousse <guillomovitch@zarb.org>
+# svk(1) completion
have svk &&
_svk()
@@ -6,7 +6,7 @@ _svk()
local cur prev commands options command
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur prev
commands='add admin annotate ann blame praise cat checkout co cleanup \
cmerge cm commit ci copy cp delete del remove rm depotmap \
@@ -23,10 +23,8 @@ _svk()
COMPREPLY=( $( compgen -W "$commands" -- "$cur" ) )
fi
else
-
- prev=${COMP_WORDS[COMP_CWORD-1]}
case $prev in
- -@(F|-file|-targets))
+ -F|--file|--targets)
_filedir
return 0;
;;
@@ -45,44 +43,44 @@ _svk()
add)
options=' --non-recursive -N -q --quiet'
;;
- @(blame|annotate|ann|praise))
+ blame|annotate|ann|praise)
options='-r --revisions -x --cross'
;;
cat)
options='-r --revision'
;;
- @(checkout|co))
+ checkout|co)
options='-r --revision -q --quiet -N --non-recursive -l \
--list -d --detach --export --relocate --purge'
;;
cleanup)
options='-a --all'
;;
- @(cmerge|cm))
+ cmerge|cm)
options='-c --change -l --log -r --revision -a --auto \
--verbatim --no-ticket -m --message -F --file \
--template --encoding -P --patch -S --sign -C \
--check-only --direct'
;;
- @(commit|ci))
+ commit|ci)
options='--import -m --message -F --file --encoding \
--template -P --patch -S --sign -C --check-only -N \
--non-recursive --direct'
;;
- @(copy|cp))
+ copy|cp)
options='-r --revision -p --parent -q --quiet -m --message \
-F --file --template --encoding -P --patch -S --sign \
-C --check-only --direct'
;;
- @(delete|del|remove|rm))
+ delete|del|remove|rm)
options='-k --keep-local -m --message -F --file --encoding \
--template -P --patch -S --sign -C --check-only \
--direct'
;;
- @(depotmap|depot))
+ depotmap|depot)
options='-i --init -l --list -d --detach --relocate'
;;
- @(diff|di))
+ diff|di)
options='-r --revision -s --summarize -b --verbose -N \
--non-recursive'
;;
@@ -91,7 +89,7 @@ _svk()
-F --file --template --encoding -P --patch -S --sign \
-C --check-only -N --non-recursive --direct'
;;
- @(list|ls))
+ list|ls)
options='-r --revision -v --verbose -R --recursive -d \
--depth -f --full-path'
;;
@@ -106,7 +104,7 @@ _svk()
-F --file --template --encoding -P --patch -S --sign \
-C --check-only --direct'
;;
- @(mirror|mi))
+ mirror|mi)
options='-l --list -d --detach --relocate --recover \
--unlock --upgrade'
;;
@@ -115,7 +113,7 @@ _svk()
--encoding -P --patch -S --sign -C --check-only \
--direct'
;;
- @(move|mv|rename|ren))
+ move|mv|rename|ren)
options='-r --revision -p --parent -q --quiet -m \
--message -F --file --encoding --template -P --patch \
-S --sign -C --check-only --direct'
@@ -123,20 +121,20 @@ _svk()
patch)
options='--depot'
;;
- @(propdel|propset|pdel|pset|pd|ps))
+ propdel|propset|pdel|pset|pd|ps)
options='-R --recursive -r --revision --revprop -m \
--message -F --file --template --encoding -P --patch \
-S --sign -C --check-only -q --quiet --direct'
;;
- @(propedit|pedit|pe))
+ propedit|pedit|pe)
options='-R --recursive -r --revision --revprop -m \
--message -F --file --template --encoding -P --patch \
-S --sign -C --check-only --direct'
;;
- @(propget|pget|pg))
+ propget|pget|pg)
options='-R --recursive -r --revision --revprop --strict'
;;
- @(proplist|plist|pl))
+ proplist|plist|pl)
options='-R --recursive -v --verbose \
-r --revision --revprop'
;;
@@ -153,24 +151,24 @@ _svk()
revert)
options='-R --recursive -q --quiet'
;;
- @(smerge|sm))
+ smerge|sm)
options='-I --incremental -l --log -B --baseless -b \
--base -s --sync -t --to -f --from --verbatim \
--no-ticket --track-rename --host --remoterev -m \
--message -F --file --template --encoding -P --patch \
-S --sign -C --check-only --direct'
;;
- @(status|stat|st))
+ status|stat|st)
options='-q --quiet --no-ignore -N --non-recursive -v \
--verbose'
;;
- @(switch|sw))
+ switch|sw)
options='-r --revision -d --detach -q --quiet'
;;
- @(sync|sy))
+ sync|sy)
options='-a --all -s --skipto -t --torev'
;;
- @(update|up))
+ update|up)
options='-r --revision -N --non-recursive -C --check-only \
-s --sync -m --merge -q --quiet'
;;
@@ -180,7 +178,7 @@ _svk()
COMPREPLY=( $( compgen -W "$options" -- "$cur" ) )
else
case $command in
- @(help|h|\?))
+ help|h|\?)
COMPREPLY=( $( compgen -W "$commands \
environment commands intro" -- "$cur" ) )
;;
@@ -198,7 +196,7 @@ _svk()
COMPREPLY=( $( compgen -W "$( svk mirror --list \
2>/dev/null | awk '/^\//{print $1}' )" -- "$cur" ) )
;;
- @(co|checkout|push|pull))
+ co|checkout|push|pull)
if [[ "$cur" == //*/* ]]; then
path=${cur%/*}/
else
@@ -216,7 +214,7 @@ _svk()
return 0
} &&
-complete -F _svk $filenames svk
+complete -F _svk -o filenames svk
# Local variables:
# mode: shell-script
diff --git a/contrib/sysctl b/contrib/sysctl
index cd40c453..41cbd7ee 100644
--- a/contrib/sysctl
+++ b/contrib/sysctl
@@ -6,7 +6,7 @@ _sysctl()
local cur
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
COMPREPLY=( $( compgen -W "$(sysctl -N -a 2>/dev/null)" -- "$cur" ) )
diff --git a/contrib/sysv-rc b/contrib/sysv-rc
index ac2062be..735a4042 100644
--- a/contrib/sysv-rc
+++ b/contrib/sysv-rc
@@ -7,26 +7,24 @@ _update_rc_d()
{
local cur prev sysvdir services options valid_options
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
[ -d /etc/rc.d/init.d ] && sysvdir=/etc/rc.d/init.d \
|| sysvdir=/etc/init.d
- services=( $(echo $sysvdir/!(README*|*.sh|*.dpkg*|*.rpm@(orig|new|save))) )
+ services=( $(printf '%s ' $sysvdir/!(README*|*.sh|*.dpkg*|*.rpm@(orig|new|save))) )
services=( ${services[@]#$sysvdir/} )
options=( -f -n )
if [[ $COMP_CWORD -eq 1 || "$prev" == -* ]]; then
valid_options=( $( \
- echo "${COMP_WORDS[@]} ${options[@]}" \
- | tr " " "\n" \
- | sed -ne "/$( echo "${options[@]}" | sed "s/ /\\|/g" )/p" \
+ tr " " "\n" <<<"${COMP_WORDS[@]} ${options[@]}" \
+ | sed -ne "/$( sed "s/ /\\|/g" <<<"${options[@]}" )/p" \
| sort | uniq -u \
) )
COMPREPLY=( $( compgen -W '${options[@]} ${services[@]}' \
- -X '$( echo ${COMP_WORDS[@]} | tr " " "|" )' -- "$cur" ) )
- elif [[ "$prev" == ?($( echo ${services[@]} | tr " " "|" )) ]]; then
+ -X '$( tr " " "|" <<<${COMP_WORDS[@]} )' -- "$cur" ) )
+ elif [[ "$prev" == ?($( tr " " "|" <<<${services[@]} )) ]]; then
COMPREPLY=( $( compgen -W 'remove defaults start stop' -- "$cur" ) )
elif [[ "$prev" == defaults && "$cur" == [0-9] ]]; then
COMPREPLY=( 0 1 2 3 4 5 6 7 8 9 )
@@ -73,28 +71,27 @@ _invoke_rc_d()
{
local cur prev sysvdir services options valid_options
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
[ -d /etc/rc.d/init.d ] && sysvdir=/etc/rc.d/init.d \
|| sysvdir=/etc/init.d
- services=( $(echo $sysvdir/!(README*|*.sh|*.dpkg*|*.rpm@(orig|new|save))) )
+ 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=( $( \
- echo ${COMP_WORDS[@]} ${options[@]} \
- | tr " " "\n" \
- | sed -ne "/$( echo ${options[@]} | sed "s/ /\\\\|/g" )/p" \
+ 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 -ne "y/|/ /; \
- s/^.*Usage:[ ]*[^ ]*[ ]*{*\([^}\"]*\).*$/\1/p" \
+ COMPREPLY=( $( compgen -W '`sed -e "y/|/ /" \
+ -ne "s/^.*Usage:[ ]*[^ ]*[ ]*{*\([^}\"]*\).*$/\1/p" \
$sysvdir/$prev`' -- "$cur" ) )
else
COMPREPLY=()
diff --git a/contrib/tar b/contrib/tar
index 0802c881..400daa62 100644
--- a/contrib/tar
+++ b/contrib/tar
@@ -6,20 +6,20 @@ _tar()
local cur ext regex tar untar
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
if [ $COMP_CWORD -eq 1 ]; then
COMPREPLY=( $( compgen -W 'c t x u r d A' -- "$cur" ) )
return 0
fi
- case "${COMP_WORDS[1]}" in
+ case ${COMP_WORDS[1]} in
?(-)[cr]*f)
_filedir
return 0
;;
+([^IZzJjy])f)
- ext='t@(ar?(.@(Z|gz|bz?(2)|lz?(ma)))|gz|bz?(2)|lz?(ma))'
+ ext='t@(ar?(.@(Z|gz|bz?(2)|lz?(ma)|xz))|gz|bz?(2)|lz?(ma)|xz)'
regex='t\(ar\(\.\(Z\|gz\|bz2\?\|lzma\|xz\)\)\?\|gz\|bz2\?\|lzma\|xz\)'
;;
*[Zz]*f)
@@ -45,11 +45,11 @@ _tar()
# complete on files in tar file
#
# get name of tar file from command line
- tar=$( echo "$COMP_LINE" | sed -e 's/^.* \([^ ]*'$regex'\) .*$/\1/' )
+ tar=$( sed -e 's/^.* \([^ ]*'$regex'\) .*$/\1/' <<<"$COMP_LINE" )
# devise how to untar and list it
untar=t${COMP_WORDS[1]//[^Izjyf]/}
- COMPREPLY=( $( compgen -W "$( echo $( tar $untar $tar \
+ COMPREPLY=( $( compgen -W "$( printf '%s ' $( tar $untar $tar \
2>/dev/null ) )" -- "$cur" ) )
return 0
fi
@@ -59,8 +59,8 @@ _tar()
return 0
}
-[ -n "${COMP_TAR_INTERNAL_PATHS:-}" ] && complete -F _tar $dirnames tar ||
- complete -F _tar $filenames tar
+[ -n "${COMP_TAR_INTERNAL_PATHS:-}" ] && complete -F _tar -o dirnames tar ||
+ complete -F _tar -o filenames tar
}
# Local variables:
diff --git a/contrib/tcpdump b/contrib/tcpdump
index 958ac8d7..259f13e0 100644
--- a/contrib/tcpdump
+++ b/contrib/tcpdump
@@ -6,11 +6,10 @@ _tcpdump()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
- case "$prev" in
- -@(r|w|F))
+ case $prev in
+ -r|-w|-F)
_filedir
return 0
;;
diff --git a/contrib/unace b/contrib/unace
index d006ffbd..5ceb7646 100644
--- a/contrib/unace
+++ b/contrib/unace
@@ -1,4 +1,4 @@
-# unace(1) completion by Guillaume Rousse <rousse@ccr.jussieu.fr>
+# unace(1) completion
have unace &&
_unace()
@@ -6,26 +6,19 @@ _unace()
local cur
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
- case "$cur" in
- -*)
- COMPREPLY=( $( compgen -W '-c -c- -f -f- -o -o- -p -y -y-' \
- -- "$cur" ) )
- ;;
- *)
+ if [[ "$cur" == -* ]] ; then
+ COMPREPLY=( $( compgen -W '-c -c- -f -f- -o -o- -p -y -y-' -- "$cur" ) )
+ else
if [ $COMP_CWORD -eq 1 ]; then
COMPREPLY=( $( compgen -W 'e l t v x' -- "$cur" ) )
else
_filedir '@(ace|ACE)'
fi
- ;;
- esac
-
- return 0
-
+ fi
} &&
-complete -F _unace $filenames unace
+complete -F _unace -o filenames unace
# Local variables:
# mode: shell-script
diff --git a/contrib/unrar b/contrib/unrar
index a97fb0d1..3fb24dbb 100644
--- a/contrib/unrar
+++ b/contrib/unrar
@@ -1,4 +1,4 @@
-# unrar(1) completion by Guillaume Rousse <rousse@ccr.jussieu.fr>
+# unrar(1) completion
have unrar &&
_unrar()
@@ -6,26 +6,22 @@ _unrar()
local cur
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
- case "$cur" in
- -*)
+ 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
COMPREPLY=( $( compgen -W 'e l lb lt p t v vb vt x' -- "$cur" ) )
else
_filedir '@(rar|RAR)'
fi
- ;;
- esac
+ fi
- return 0
} &&
-complete -F _unrar $filenames unrar
+complete -F _unrar -o filenames unrar
# Local variables:
# mode: shell-script
diff --git a/contrib/update-alternatives b/contrib/update-alternatives
index 7e12b96e..ebed294d 100644
--- a/contrib/update-alternatives
+++ b/contrib/update-alternatives
@@ -22,22 +22,21 @@ _update_alternatives()
local cur prev mode args i
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
- case "$prev" in
- --@(altdir|admindir))
- _filedir -d
- return 0
- ;;
- --@(help|version))
- return 0
- ;;
+ case $prev in
+ --altdir|--admindir)
+ _filedir -d
+ return 0
+ ;;
+ --help|--usage|--version)
+ return 0
+ ;;
esac
# 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) ]]; then
+ if [[ "${COMP_WORDS[i]}" == --@(install|remove|auto|display|config|remove-all|set) ]]; then
mode=${COMP_WORDS[i]}
args=$(($COMP_CWORD - i))
break
@@ -45,46 +44,48 @@ _update_alternatives()
done
case $mode in
- --install)
- case $args in
- 1)
- _filedir
+ --install)
+ case $args in
+ 1|3)
+ _filedir
+ ;;
+ 2)
+ _installed_alternatives
+ ;;
+ 4)
+ # priority - no completions
+ ;;
+ *)
+ case $((args % 4)) in
+ 0|2)
+ _filedir
+ ;;
+ 1)
+ COMPREPLY=( $( compgen -W '--slave' -- "$cur" ) )
+ ;;
+ 3)
+ _installed_alternatives
+ ;;
+ esac
+ esac
;;
- 2)
- _installed_alternatives
+ --remove|--set)
+ case $args in
+ 1)
+ _installed_alternatives
+ ;;
+ 2)
+ _filedir
+ ;;
+ esac
;;
- 3)
- _filedir
- ;;
- esac
- ;;
- --remove)
- case $args in
- 1)
+ --auto|--remove-all|--display|--config)
_installed_alternatives
;;
- 2)
- _filedir
- ;;
- esac
- ;;
- --auto)
- _installed_alternatives
- ;;
- --remove-all)
- _installed_alternatives
- ;;
- --display)
- _installed_alternatives
- ;;
- --config)
- _installed_alternatives
- ;;
- *)
- COMPREPLY=( $( compgen -W '--verbose --quiet --help --version \
- --altdir --admindir' -- "$cur" ) \
- $( compgen -W '--install --remove --auto --display \
- --config' -- "$cur" ) )
+ *)
+ COMPREPLY=( $( compgen -W '--verbose --quiet --help --version \
+ --altdir --admindir --install --remove --auto --display \
+ --config --set' -- "$cur" ) )
esac
}
complete -F _update_alternatives update-alternatives alternatives
diff --git a/contrib/util-linux b/contrib/util-linux
new file mode 100644
index 00000000..8017ebb2
--- /dev/null
+++ b/contrib/util-linux
@@ -0,0 +1,76 @@
+# 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)
+ COMPREPLY=( $( compgen -u -- "$cur" ) )
+ ;;
+ -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/contrib/vncviewer b/contrib/vncviewer
index 7e9c00da..296eb8af 100644
--- a/contrib/vncviewer
+++ b/contrib/vncviewer
@@ -1,20 +1,19 @@
# bash completion for vncviewer
have vncviewer &&
-_vncviewer_bootstrap() {
+_vncviewer_bootstrap()
+{
local fname
- case "$(_realcommand vncviewer)" in
- # If `vncviewer' not installed, default file-dir completion
- '') _filedir `_get_cword` ;;
+ case $(_realcommand vncviewer) in
*xvnc4viewer) fname=_xvnc4viewer ;;
- *tightvncviewer|*) fname=_tightvncviewer ;;
+ *tightvncviewer) fname=_tightvncviewer ;;
+ *) fname=_known_hosts ;;
esac
- if [ $fname ]; then
- # Install real completion for subsequent completions
- complete -F $fname vncviewer
- $fname # Generate completions once for now
- unset -f _vncviewer_bootstrap
- fi
+
+ # Install real completion for subsequent completions
+ complete -F $fname vncviewer
+ $fname # Generate completions once for now
+ unset -f _vncviewer_bootstrap
} &&
complete -F _vncviewer_bootstrap vncviewer
@@ -24,8 +23,7 @@ _tightvncviewer()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
case $prev in
-passwd)
@@ -57,7 +55,8 @@ _tightvncviewer()
complete -F _tightvncviewer tightvncviewer
-# NOTE: - VNC Viewer options are case-insensivite. Preferred case is taken from -help.
+# 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()
@@ -65,8 +64,7 @@ _xvnc4viewer()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
# Convert double dash to single dash
case ${prev/#--/-} in
@@ -101,21 +99,21 @@ _xvnc4viewer()
)
[[ "$cur" == --* ]] && dash=-- || dash=-
# Is a `nocasematch' variable available (bash > v3.1)?
- if shopt nocasematch 2> /dev/null | grep -q ^nocasematch; then
+ 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
- [[ $dash$option == "$cur"* ]] && echo $dash$option
+ [[ $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 "$(
- echo ${options[@]/#/$dash} | tr [:upper:] [:lower:]
- )" -- "$(echo "$cur" | tr [:upper:] [:lower:])" ) )
+ COMPREPLY=( $( compgen -W \
+ "$( tr [:upper:] [:lower:] <<<${options[@]/#/$dash} )" \
+ -- "$( tr [:upper:] [:lower:] <<<"$cur" )" ) )
fi
else
_known_hosts_real "$cur"
diff --git a/contrib/vpnc b/contrib/vpnc
index aaf0300a..722fee3a 100644
--- a/contrib/vpnc
+++ b/contrib/vpnc
@@ -6,8 +6,7 @@ _vpnc()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
case $prev in
--pfs)
@@ -18,7 +17,7 @@ _vpnc()
COMPREPLY=( $( compgen -W 'dh1 dh2 dh5' -- "$cur" ) )
return 0
;;
- --@(pid-file|script))
+ --pid-file|--script)
_filedir
return 0
;;
diff --git a/contrib/wireless-tools b/contrib/wireless-tools
index 22da1b2e..56ba0db8 100644
--- a/contrib/wireless-tools
+++ b/contrib/wireless-tools
@@ -9,8 +9,7 @@ _iwconfig()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
case $prev in
mode)
@@ -23,7 +22,7 @@ _iwconfig()
if [ -n "${COMP_IWLIST_SCAN:-}" ]; then
COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W \
"$( iwlist ${COMP_WORDS[1]} scan | \
- awk -F '\"' '/ESSID/ {print $2}' )" -- "$cur" ) )
+ awk -F'\"' '/ESSID/ {print $2}' )" -- "$cur" ) )
fi
return 0
;;
@@ -33,13 +32,13 @@ _iwconfig()
;;
channel)
COMPREPLY=( $( compgen -W "$( iwlist ${COMP_WORDS[1]} channel | \
- awk '/^[[:space:]]*Channel/ {print $2}' )" -- "$cur" ) )
+ awk '/^[ \t]*Channel/ {print $2}' )" -- "$cur" ) )
return 0
;;
freq)
COMPREPLY=( $( compgen -W "$( iwlist ${COMP_WORDS[1]} channel | \
- awk '/^[[:space:]]*Channel/ {print $4\"G\"}')" -- "$cur" ) )
+ awk '/^[ \t]*Channel/ {print $4"G"}')" -- "$cur" ) )
return 0
;;
ap)
@@ -55,7 +54,7 @@ _iwconfig()
COMPREPLY=( $( compgen -W 'auto fixed' -- "$cur" ) )
COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W \
"$( iwlist ${COMP_WORDS[1]} rate | \
- awk '/^[[:space:]]*[0-9]/ {print $1\"M\"}' )" -- "$cur" ) )
+ awk '/^[ \t]*[0-9]/ {print $1"M"}' )" -- "$cur" ) )
return 0
;;
rts|frag)
@@ -101,8 +100,7 @@ _iwlist()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
if [ $COMP_CWORD -eq 1 ]; then
if [[ "$cur" == -* ]]; then
@@ -125,7 +123,7 @@ _iwspy()
local cur
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
if [ $COMP_CWORD -eq 1 ]; then
if [[ "$cur" == -* ]]; then
@@ -146,10 +144,9 @@ _iwpriv()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
- case "$prev" in
+ case $prev in
roam)
COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) )
return 0
diff --git a/contrib/wodim b/contrib/wodim
index 6359ec59..5fa69a8b 100644
--- a/contrib/wodim
+++ b/contrib/wodim
@@ -6,15 +6,14 @@ _cdrecord()
local cur prev i generic_options track_options track_mode
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
# foo=bar style option
if [[ "$cur" == *=* ]]; then
prev=${cur/=*/}
cur=${cur/*=/}
- case "$prev" in
- @(text|cue)file)
+ case $prev in
+ textfile|cuefile)
_filedir
return 0
;;
@@ -35,7 +34,7 @@ _cdrecord()
esac
fi
- generic_options=(-version -v -V -d -silent -s -force -immed -dummy \
+ generic_options=(-version -v -V -d -silent -force -immed -dummy \
-dao -raw -raw96r -raw96p -raw16 -multi -msinfo -toc \
-atip -fix -nofix -waiti -load -lock -eject -format \
-setdropts -checkdrive -prcap -inq -scanbus -reset \
@@ -74,7 +73,7 @@ _cdrecord()
fi
} &&
-complete -F _cdrecord $filenames cdrecord wodim
+complete -F _cdrecord -o filenames cdrecord wodim
# Local variables:
# mode: shell-script
diff --git a/contrib/wol b/contrib/wol
new file mode 100644
index 00000000..89a1a8ba
--- /dev/null
+++ b/contrib/wol
@@ -0,0 +1,47 @@
+# wol(1) completion
+
+have wol &&
+_wol()
+{
+ local cur prev split=false
+ COMPREPLY=()
+ _get_comp_words_by_ref -n : cur prev
+ _split_longopt && split=true
+
+ case $prev in
+ -V|--version|--help|-p|--port|--passwd|-w|--wait)
+ return 0
+ ;;
+ -h|--host|-i|--ipaddr)
+ # Broadcast addresses
+ COMPREPLY=( $( PATH=$PATH:/sbin ifconfig -a 2>/dev/null | \
+ sed -ne 's/.*[[:space:]]\{1,\}Bcast:\([^[:space:]]*\).*/\1/p' \
+ -e 's/.*[[:space:]]\{1,\}broadcast[[:space:]]\{1,\}\([^[:space:]]*\).*/\1/p' ) )
+ _known_hosts_real "$cur"
+ return 0
+ ;;
+ -f|--file)
+ _filedir
+ return 0
+ ;;
+ esac
+
+ $split && return 0
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--help --version --verbose --wait --host
+ --port --file --passwd' -- "$cur" ) )
+ return 0
+ fi
+
+ _mac_addresses
+} &&
+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/contrib/wtf b/contrib/wtf
new file mode 100644
index 00000000..2b6c4d01
--- /dev/null
+++ b/contrib/wtf
@@ -0,0 +1,36 @@
+# wtf completion
+# Raphael Droz, 25/09/2009
+
+have wtf &&
+_wtf()
+{
+ local cur prev db
+
+ COMPREPLY=()
+ _get_comp_words_by_ref cur prev
+
+ [ "$prev" = -f ] && _filedir && return 0
+ [[ "$cur" == -* ]] && COMPREPLY=( -f ) && return 0
+
+ set -- "${COMP_WORDS[@]}"
+ while [ $# -gt 0 ]; do
+ if [ "$1" = -f ]; then
+ shift ; db=$1 ; break
+ fi
+ shift
+ 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}" ) )
+} &&
+complete -F _wtf -o filenames 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/contrib/wvdial b/contrib/wvdial
index 9081f6f8..101112ca 100644
--- a/contrib/wvdial
+++ b/contrib/wvdial
@@ -6,8 +6,7 @@ _wvdial()
local cur prev config i IFS=$'\t\n'
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
case $prev in
--config)
@@ -35,7 +34,7 @@ _wvdial()
# parse config files for sections and
# remove default section
COMPREPLY=( $( sed -ne "s|^\[Dialer \($cur.*\)\]$|\1|p" $config \
- 2>/dev/null |grep -v '^Defaults$'))
+ 2>/dev/null | command grep -v '^Defaults$'))
# escape spaces
COMPREPLY=${COMPREPLY// /\\ }
;;
diff --git a/contrib/xhost b/contrib/xhost
index 006c961e..cec4adcf 100644
--- a/contrib/xhost
+++ b/contrib/xhost
@@ -3,16 +3,17 @@
have xhost &&
_xhost ()
{
- local cur=`_get_cword`
+ local cur
+ _get_comp_words_by_ref cur
- case "$cur" in
+ case $cur in
+*) _known_hosts_real -p+ "${cur:1}" ;;
-*) _known_hosts_real -p- "${cur:1}" ;;
*) _known_hosts_real "$cur" ;;
esac
return 0
-}
+} &&
complete -F _xhost xhost
# Local variables:
diff --git a/contrib/xm b/contrib/xm
index b8337e5a..4087a710 100644
--- a/contrib/xm
+++ b/contrib/xm
@@ -20,7 +20,7 @@ _xm()
local cur prev command options
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur prev
commands='console create new delete destroy domid domname dump-core \
list mem-max mem-set migrate pause reboot rename restore \
@@ -35,7 +35,6 @@ _xm()
if [[ $COMP_CWORD -eq 1 ]] ; then
COMPREPLY=( $( compgen -W "$commands" -- "$cur" ) )
else
- prev=${COMP_WORDS[COMP_CWORD-1]}
if [[ "$cur" == *=* ]]; then
prev=${cur/=*/}
cur=${cur/*=/}
@@ -63,7 +62,7 @@ _xm()
sched-credit)
options='-d -w -c'
;;
- @(block|network|vtpm|vnet)-list)
+ block-list|network-list|vtpm-list|vnet-list)
options='-l --long'
;;
getpolicy)
@@ -81,7 +80,9 @@ _xm()
COMPREPLY=( $( compgen -W "$options" -- "$cur" ) )
else
case $command in
- @(console|destroy|domname|domid|list|mem-@(set|max)|pause|reboot|rename|shutdown|unpause|vcpu-@(list|pin|set)|block-list|network-list|vtpm-list))
+ console|destroy|domname|domid|list|mem-set|mem-max| \
+ pause|reboot|rename|shutdown|unpause|vcpu-list|vcpu-pin| \
+ vcpu-set|block-list|network-list|vtpm-list)
_count_args
case $args in
2)
@@ -100,7 +101,7 @@ _xm()
;;
esac
;;
- @(restore|dry-run|vnet-create))
+ restore|dry-run|vnet-create)
_filedir
;;
save)
@@ -196,7 +197,7 @@ _xm()
;;
new)
case $prev in
- -@(f|F|-defconfig|-config))
+ -f|-F|--defconfig|--config)
_filedir
return 0
;;
diff --git a/contrib/xmllint b/contrib/xmllint
index ff201ec1..82feb4a3 100644
--- a/contrib/xmllint
+++ b/contrib/xmllint
@@ -6,10 +6,9 @@ _xmllint()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
- case "$prev" in
+ case $prev in
-o|--output)
_filedir
return 0
@@ -45,7 +44,7 @@ _xmllint()
_filedir '@(*ml|htm|svg)'
} &&
-complete -F _xmllint $filenames xmllint
+complete -F _xmllint -o filenames xmllint
# Local variables:
# mode: shell-script
diff --git a/contrib/xmlwf b/contrib/xmlwf
index de8b7250..7109bcd3 100644
--- a/contrib/xmlwf
+++ b/contrib/xmlwf
@@ -6,10 +6,9 @@ _xmlwf()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
- case "$prev" in
+ case $prev in
-d)
_filedir -d
return 0
@@ -29,7 +28,7 @@ _xmlwf()
_filedir '@(*ml|htm|svg)'
} &&
-complete -F _xmlwf $filenames xmlwf
+complete -F _xmlwf -o filenames xmlwf
# Local variables:
# mode: shell-script
diff --git a/contrib/xmms b/contrib/xmms
index ca49545b..42c5402c 100644
--- a/contrib/xmms
+++ b/contrib/xmms
@@ -6,7 +6,7 @@ _xmms()
local cur
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-h --help -r --rew -p --play \
@@ -19,7 +19,7 @@ _xmms()
fi
} &&
-complete -F _xmms $filenames xmms
+complete -F _xmms -o filenames xmms
# Local variables:
# mode: shell-script
diff --git a/contrib/xrandr b/contrib/xrandr
index cd5c05b8..70de80f7 100644
--- a/contrib/xrandr
+++ b/contrib/xrandr
@@ -5,12 +5,11 @@ _xrandr()
{
local cur prev output modes
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
- case "$prev" in
+ case $prev in
--output)
- local outputs=$(xrandr|grep 'connected'|awk '{print $1}')
+ local outputs=$(xrandr|awk '/connected/ {print $1}')
COMPREPLY=( $(compgen -W "$outputs" -- "$cur"))
return 0
;;
@@ -28,17 +27,14 @@ _xrandr()
;;
esac
- case "$cur" in
+ case $cur in
*)
- COMPREPLY=( $(compgen -W '-d -display -help -o \
- --orientation -q --query -s --size\
- -r --rate -v --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"))
+ COMPREPLY=( $(compgen -W '-display -help --orientation --query \
+ --size --rate --version -x -y --screen --verbose --dryrun \
+ --prop --fb --fbmm --dpi --output --auto --mode --preferred \
+ --pos --reflect --rotate --left-of --right-of --above --below \
+ --same-as --set --off --crtc --newmode --rmmode --addmode \
+ --delmode' -- "$cur") )
return 0
;;
esac
diff --git a/contrib/xsltproc b/contrib/xsltproc
new file mode 100644
index 00000000..f71d3f11
--- /dev/null
+++ b/contrib/xsltproc
@@ -0,0 +1,56 @@
+# xsltproc(1) completion
+
+have xsltproc &&
+_xsltproc()
+{
+ local cur prev
+ COMPREPLY=()
+ _get_comp_words_by_ref cur prev
+
+ case $prev in
+ --output|-o)
+ _filedir
+ return 0
+ ;;
+ # TODO : number only
+ --maxdepth)
+ return 0
+ ;;
+ --encoding)
+ # some aliases removed
+ COMPREPLY=( $( compgen -W "$( iconv -l | sed -e '/^UTF[1378]/d' \
+ -e '/^ISO[0-9_]/d' -e '/^8859/d' -e 's/\/.*//')" -- "$cur" ) )
+ return 0
+ ;;
+ --param|--stringparam)
+ return 0
+ ;;
+ # not really like --writesubtree
+ --path)
+ _filedir -d
+ return 0
+ ;;
+ --writesubtree)
+ _filedir -d
+ return 0
+ ;;
+ esac
+
+ [[ $COMP_CWORD -gt 2 && `_get_cword '' 2` == --?(string)param ]] && \
+ return 0
+
+ if [[ "$cur" == -* ]]; then
+ _longopt xsltproc
+ else
+ _filedir '@(xsl|xslt|xml)'
+ fi
+} &&
+complete -F _xsltproc -o filenames 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/contrib/xz b/contrib/xz
index f2719861..46420b01 100644
--- a/contrib/xz
+++ b/contrib/xz
@@ -4,27 +4,26 @@ have xz &&
_xz()
{
COMPREPLY=()
- local cur=`_get_cword`
- local prev=${COMP_WORDS[COMP_CWORD-1]}
+ local cur prev
+ _get_comp_words_by_ref cur prev
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-z --compress -d --decompress \
- -t --test -l --list -k --keep -f --force -c --stdout \
- -S --suffix --files --files0 -F --format -C --check \
- -0 -1 -2 -3 -4 -5 -6 -7 -8 -9 -M --memory --lzma1 \
- --lzma2 --x86 --powerpc --ia64 --arm --armthumb \
- --sparc --delta -q --quiet -v --verbose -h --help \
- -H --long-help -V --version' -- "$cur" ) )
+ 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 xspec="*.@(xz|lzma)"
+ local xspec="*.@(xz|lzma|txz|tlz)"
- case "$prev" in
- -@(!(-*)[dlt]*|-decompress|-list|-test))
+ case $prev in
+ --decompress|--list|--test|-!(-*)[dlt]*)
xspec="!"$xspec
;;
--files|--files0)
@@ -57,7 +56,7 @@ _xz()
COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \
$( compgen -d -- "$cur" ) )
} &&
-complete -F _xz $filenames xz
+complete -F _xz -o filenames xz
# xzdec(1) completion
#
@@ -65,19 +64,18 @@ have xzdec &&
_xzdec()
{
COMPREPLY=()
- local cur=`_get_cword`
- local prev=${COMP_WORDS[COMP_CWORD-1]}
+ local cur prev
+ _get_comp_words_by_ref cur prev
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-M --memory -h --help -V --version' \
- -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '--memory --help --version' -- "$cur" ) )
return 0
fi
local split=false
_split_longopt && split=true
- case "$prev" in
+ case $prev in
-M|--memory)
# argument required but no completions available
return 0
@@ -92,7 +90,7 @@ _xzdec()
_filedir xz # no lzma support here as of xz 4.999.8beta
} &&
-complete -F _xzdec $filenames xzdec
+complete -F _xzdec -o filenames xzdec
# Local variables:
# mode: shell-script
diff --git a/contrib/yp-tools b/contrib/yp-tools
index 60155279..7252a129 100644
--- a/contrib/yp-tools
+++ b/contrib/yp-tools
@@ -1,25 +1,26 @@
# bash completion for yp-tools
-have ypmatch &&
+have ypcat &&
_ypmatch()
{
- local cur map
+ local cur map cmd
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
+ cmd=${1##*/}
- [ $1 = ypcat ] && [ $COMP_CWORD -gt 1 ] && return 0
- [ $1 = ypmatch ] && [ $COMP_CWORD -gt 2 ] && return 0
+ [[ $cmd == ypcat && $COMP_CWORD -gt 1 ]] && return 0
+ [[ $cmd == ypmatch && $COMP_CWORD -gt 2 ]] && return 0
- if [ $1 = ypmatch ] && [ $COMP_CWORD -eq 1 ] && \
- [ ${#COMP_WORDS[@]} -eq 3 ]; then
+ 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
- [ $1 = ypmatch ] && [ $COMP_CWORD -ne 2 ] && return 0
+ [[ $cmd == ypmatch && $COMP_CWORD -ne 2 ]] && return 0
COMPREPLY=( $( compgen -W \
- '$( echo $(ypcat -x | cut -d"\"" -f 2))' -- "$cur"))
+ '$( printf "%s\n" $(ypcat -x | cut -d"\"" -f 2) )' -- "$cur"))
fi
return 0
diff --git a/contrib/yum-arch b/contrib/yum-arch
index 1cc8320c..3728335c 100644
--- a/contrib/yum-arch
+++ b/contrib/yum-arch
@@ -5,21 +5,15 @@ _yum_arch()
{
local cur
COMPREPLY=()
- cur=`_get_cword`
+ _get_comp_words_by_ref cur
- case "$cur" in
- -*)
- COMPREPLY=( $( compgen -W '-d -v -vv -n -c -z -s -l \
- -q' -- "$cur" ) )
- ;;
- *)
- _filedir -d
- ;;
- esac
-
- return 0
+ if [[ "$cur" == -* ]] ; then
+ COMPREPLY=( $( compgen -W '-d -v -vv -n -c -z -s -l -q' -- "$cur" ) )
+ else
+ _filedir -d
+ fi
} &&
-complete -F _yum_arch $filenames yum-arch
+complete -F _yum_arch -o filenames yum-arch
# Local variables:
# mode: shell-script
diff --git a/test/Makefile.am b/test/Makefile.am
new file mode 100644
index 00000000..d955be8a
--- /dev/null
+++ b/test/Makefile.am
@@ -0,0 +1,8 @@
+DEJATOOL = completion install unit
+AM_RUNTESTFLAGS = --outdir log
+
+EXTRA_DIST = completion \
+ config \
+ fixtures \
+ lib \
+ unit
diff --git a/test/Makefile.in b/test/Makefile.in
new file mode 100644
index 00000000..a1376c9f
--- /dev/null
+++ b/test/Makefile.in
@@ -0,0 +1,343 @@
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+subdir = test
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+SOURCES =
+DIST_SOURCES =
+RUNTESTDEFAULTFLAGS = --tool $$tool --srcdir $$srcdir
+EXPECT = expect
+RUNTEST = runtest
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+am__leading_dot = @am__leading_dot@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build_alias = @build_alias@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host_alias = @host_alias@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+DEJATOOL = completion install unit
+AM_RUNTESTFLAGS = --outdir log
+EXTRA_DIST = completion \
+ config \
+ fixtures \
+ lib \
+ unit
+
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign test/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign test/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+check-DEJAGNU: site.exp
+ srcdir=`$(am__cd) $(srcdir) && pwd`; export srcdir; \
+ EXPECT=$(EXPECT); export EXPECT; \
+ runtest=$(RUNTEST); \
+ if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \
+ exit_status=0; l='$(DEJATOOL)'; for tool in $$l; do \
+ if $$runtest $(AM_RUNTESTFLAGS) $(RUNTESTDEFAULTFLAGS) $(RUNTESTFLAGS); \
+ then :; else exit_status=1; fi; \
+ done; \
+ else echo "WARNING: could not find \`runtest'" 1>&2; :;\
+ fi; \
+ exit $$exit_status
+site.exp: Makefile
+ @echo 'Making a new site.exp file...'
+ @echo '## these variables are automatically generated by make ##' >site.tmp
+ @echo '# Do not edit here. If you wish to override these values' >>site.tmp
+ @echo '# edit the last section' >>site.tmp
+ @echo 'set srcdir $(srcdir)' >>site.tmp
+ @echo "set objdir `pwd`" >>site.tmp
+ @echo '## All variables above are generated by configure. Do Not Edit ##' >>site.tmp
+ @test ! -f site.exp || \
+ sed '1,/^## All variables above are.*##/ d' site.exp >> site.tmp
+ @-rm -f site.bak
+ @test ! -f site.exp || mv site.exp site.bak
+ @mv site.tmp site.exp
+
+distclean-DEJAGNU:
+ -rm -f site.exp site.bak
+ -l='$(DEJATOOL)'; for tool in $$l; do \
+ rm -f $$tool.sum $$tool.log; \
+ done
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+ $(MAKE) $(AM_MAKEFLAGS) check-DEJAGNU
+check: check-am
+all-am: Makefile
+installdirs:
+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-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+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-am
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-DEJAGNU distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: check-am install-am install-strip
+
+.PHONY: all all-am check check-DEJAGNU check-am clean clean-generic \
+ distclean distclean-DEJAGNU 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-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
+
+
+# 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/test/completion/a2ps.exp b/test/completion/a2ps.exp
new file mode 100644
index 00000000..06927b56
--- /dev/null
+++ b/test/completion/a2ps.exp
@@ -0,0 +1 @@
+assert_source_completions a2ps
diff --git a/test/completion/abook.exp b/test/completion/abook.exp
new file mode 100644
index 00000000..eaa4b308
--- /dev/null
+++ b/test/completion/abook.exp
@@ -0,0 +1 @@
+assert_source_completions abook
diff --git a/test/completion/acroread.exp b/test/completion/acroread.exp
new file mode 100644
index 00000000..c3635ae8
--- /dev/null
+++ b/test/completion/acroread.exp
@@ -0,0 +1,12 @@
+set test "Completion via _filedir_xspec() should be installed"
+set cmd "complete -p acroread"
+send "$cmd\r"
+
+set expected "^$cmd\r\ncomplete -o filenames -F _filedir_xspec acroread\r\n/@$"
+expect {
+ -re $expected { pass "$test" }
+ -re /@ { fail "$test at prompt" }
+}; # expect
+
+
+source "lib/completions/acroread.exp"
diff --git a/test/completion/add_members.exp b/test/completion/add_members.exp
new file mode 100644
index 00000000..17aacd0a
--- /dev/null
+++ b/test/completion/add_members.exp
@@ -0,0 +1 @@
+assert_source_completions add_members
diff --git a/test/completion/alias.exp b/test/completion/alias.exp
new file mode 100644
index 00000000..ee7cf4bc
--- /dev/null
+++ b/test/completion/alias.exp
@@ -0,0 +1 @@
+assert_source_completions alias
diff --git a/test/completion/animate.exp b/test/completion/animate.exp
new file mode 100644
index 00000000..2f4e749e
--- /dev/null
+++ b/test/completion/animate.exp
@@ -0,0 +1 @@
+assert_source_completions animate
diff --git a/test/completion/ant.exp b/test/completion/ant.exp
new file mode 100644
index 00000000..ad6996bd
--- /dev/null
+++ b/test/completion/ant.exp
@@ -0,0 +1 @@
+assert_source_completions ant
diff --git a/test/completion/apache2ctl.exp b/test/completion/apache2ctl.exp
new file mode 100644
index 00000000..f3d5d771
--- /dev/null
+++ b/test/completion/apache2ctl.exp
@@ -0,0 +1 @@
+assert_source_completions apache2ctl
diff --git a/test/completion/apt-build.exp b/test/completion/apt-build.exp
new file mode 100644
index 00000000..48bbe583
--- /dev/null
+++ b/test/completion/apt-build.exp
@@ -0,0 +1 @@
+assert_source_completions apt-build
diff --git a/test/completion/apt-cache.exp b/test/completion/apt-cache.exp
new file mode 100644
index 00000000..901c5e87
--- /dev/null
+++ b/test/completion/apt-cache.exp
@@ -0,0 +1 @@
+assert_source_completions apt-cache
diff --git a/test/completion/apt-get.exp b/test/completion/apt-get.exp
new file mode 100644
index 00000000..04fbf631
--- /dev/null
+++ b/test/completion/apt-get.exp
@@ -0,0 +1 @@
+assert_source_completions apt-get
diff --git a/test/completion/aptitude.exp b/test/completion/aptitude.exp
new file mode 100644
index 00000000..6afbacc8
--- /dev/null
+++ b/test/completion/aptitude.exp
@@ -0,0 +1 @@
+assert_source_completions aptitude
diff --git a/test/completion/arch.exp b/test/completion/arch.exp
new file mode 100644
index 00000000..254acd53
--- /dev/null
+++ b/test/completion/arch.exp
@@ -0,0 +1 @@
+assert_source_completions arch
diff --git a/test/completion/arpspoof.exp b/test/completion/arpspoof.exp
new file mode 100644
index 00000000..d4f9341e
--- /dev/null
+++ b/test/completion/arpspoof.exp
@@ -0,0 +1 @@
+assert_source_completions arpspoof
diff --git a/test/completion/aspell.exp b/test/completion/aspell.exp
new file mode 100644
index 00000000..5592574f
--- /dev/null
+++ b/test/completion/aspell.exp
@@ -0,0 +1 @@
+assert_source_completions aspell
diff --git a/test/completion/autoconf.exp b/test/completion/autoconf.exp
new file mode 100644
index 00000000..64942435
--- /dev/null
+++ b/test/completion/autoconf.exp
@@ -0,0 +1 @@
+assert_source_completions autoconf
diff --git a/test/completion/automake.exp b/test/completion/automake.exp
new file mode 100644
index 00000000..af412413
--- /dev/null
+++ b/test/completion/automake.exp
@@ -0,0 +1 @@
+assert_source_completions automake
diff --git a/test/completion/autorpm.exp b/test/completion/autorpm.exp
new file mode 100644
index 00000000..5931bdb1
--- /dev/null
+++ b/test/completion/autorpm.exp
@@ -0,0 +1 @@
+assert_source_completions autorpm
diff --git a/test/completion/awk.exp b/test/completion/awk.exp
new file mode 100644
index 00000000..42572591
--- /dev/null
+++ b/test/completion/awk.exp
@@ -0,0 +1 @@
+assert_source_completions awk
diff --git a/test/completion/bash.exp b/test/completion/bash.exp
new file mode 100644
index 00000000..c00fc09b
--- /dev/null
+++ b/test/completion/bash.exp
@@ -0,0 +1 @@
+assert_source_completions bash
diff --git a/test/completion/bc.exp b/test/completion/bc.exp
new file mode 100644
index 00000000..8b7a3d0b
--- /dev/null
+++ b/test/completion/bc.exp
@@ -0,0 +1 @@
+assert_source_completions bc
diff --git a/test/completion/bison.exp b/test/completion/bison.exp
new file mode 100644
index 00000000..ac40cccc
--- /dev/null
+++ b/test/completion/bison.exp
@@ -0,0 +1 @@
+assert_source_completions bison
diff --git a/test/completion/bk.exp b/test/completion/bk.exp
new file mode 100644
index 00000000..10540b7a
--- /dev/null
+++ b/test/completion/bk.exp
@@ -0,0 +1 @@
+assert_source_completions bk
diff --git a/test/completion/brctl.exp b/test/completion/brctl.exp
new file mode 100644
index 00000000..efb5a75a
--- /dev/null
+++ b/test/completion/brctl.exp
@@ -0,0 +1 @@
+assert_source_completions brctl
diff --git a/test/completion/btdownloadcurses.py.exp b/test/completion/btdownloadcurses.py.exp
new file mode 100644
index 00000000..fc9d95f7
--- /dev/null
+++ b/test/completion/btdownloadcurses.py.exp
@@ -0,0 +1 @@
+assert_source_completions btdownloadcurses.py
diff --git a/test/completion/btdownloadgui.py.exp b/test/completion/btdownloadgui.py.exp
new file mode 100644
index 00000000..e617156b
--- /dev/null
+++ b/test/completion/btdownloadgui.py.exp
@@ -0,0 +1 @@
+assert_source_completions btdownloadgui.py
diff --git a/test/completion/btdownloadheadless.py.exp b/test/completion/btdownloadheadless.py.exp
new file mode 100644
index 00000000..fc4f2561
--- /dev/null
+++ b/test/completion/btdownloadheadless.py.exp
@@ -0,0 +1 @@
+assert_source_completions btdownloadheadless.py
diff --git a/test/completion/bzip2.exp b/test/completion/bzip2.exp
new file mode 100644
index 00000000..b3953144
--- /dev/null
+++ b/test/completion/bzip2.exp
@@ -0,0 +1 @@
+assert_source_completions bzip2
diff --git a/test/completion/c++.exp b/test/completion/c++.exp
new file mode 100644
index 00000000..b00bf8c2
--- /dev/null
+++ b/test/completion/c++.exp
@@ -0,0 +1 @@
+assert_source_completions c++
diff --git a/test/completion/cancel.exp b/test/completion/cancel.exp
new file mode 100644
index 00000000..67c47100
--- /dev/null
+++ b/test/completion/cancel.exp
@@ -0,0 +1 @@
+assert_source_completions cancel
diff --git a/test/completion/cardctl.exp b/test/completion/cardctl.exp
new file mode 100644
index 00000000..99d0276b
--- /dev/null
+++ b/test/completion/cardctl.exp
@@ -0,0 +1 @@
+assert_source_completions cardctl
diff --git a/test/completion/cat.exp b/test/completion/cat.exp
new file mode 100644
index 00000000..15588ac7
--- /dev/null
+++ b/test/completion/cat.exp
@@ -0,0 +1 @@
+assert_source_completions cat
diff --git a/test/completion/cc.exp b/test/completion/cc.exp
new file mode 100644
index 00000000..af39132d
--- /dev/null
+++ b/test/completion/cc.exp
@@ -0,0 +1 @@
+assert_source_completions cc
diff --git a/test/completion/cd.exp b/test/completion/cd.exp
new file mode 100644
index 00000000..94c3c598
--- /dev/null
+++ b/test/completion/cd.exp
@@ -0,0 +1 @@
+assert_source_completions cd
diff --git a/test/completion/cdrecord.exp b/test/completion/cdrecord.exp
new file mode 100644
index 00000000..9aaa7573
--- /dev/null
+++ b/test/completion/cdrecord.exp
@@ -0,0 +1 @@
+assert_source_completions cdrecord
diff --git a/test/completion/change_pw.exp b/test/completion/change_pw.exp
new file mode 100644
index 00000000..0b152a1c
--- /dev/null
+++ b/test/completion/change_pw.exp
@@ -0,0 +1 @@
+assert_source_completions change_pw
diff --git a/test/completion/check_db.exp b/test/completion/check_db.exp
new file mode 100644
index 00000000..cf136872
--- /dev/null
+++ b/test/completion/check_db.exp
@@ -0,0 +1 @@
+assert_source_completions check_db
diff --git a/test/completion/check_perms.exp b/test/completion/check_perms.exp
new file mode 100644
index 00000000..860e8d79
--- /dev/null
+++ b/test/completion/check_perms.exp
@@ -0,0 +1 @@
+assert_source_completions check_perms
diff --git a/test/completion/chgrp.exp b/test/completion/chgrp.exp
new file mode 100644
index 00000000..2b1d2251
--- /dev/null
+++ b/test/completion/chgrp.exp
@@ -0,0 +1 @@
+assert_source_completions chgrp
diff --git a/test/completion/chkconfig.exp b/test/completion/chkconfig.exp
new file mode 100644
index 00000000..38b4226d
--- /dev/null
+++ b/test/completion/chkconfig.exp
@@ -0,0 +1 @@
+assert_source_completions chkconfig
diff --git a/test/completion/chown.exp b/test/completion/chown.exp
new file mode 100644
index 00000000..53d497c2
--- /dev/null
+++ b/test/completion/chown.exp
@@ -0,0 +1 @@
+assert_source_completions chown
diff --git a/test/completion/chsh.exp b/test/completion/chsh.exp
new file mode 100644
index 00000000..3caa0c55
--- /dev/null
+++ b/test/completion/chsh.exp
@@ -0,0 +1 @@
+assert_source_completions chsh
diff --git a/test/completion/ci.exp b/test/completion/ci.exp
new file mode 100644
index 00000000..03e417a1
--- /dev/null
+++ b/test/completion/ci.exp
@@ -0,0 +1 @@
+assert_source_completions ci
diff --git a/test/completion/civclient.exp b/test/completion/civclient.exp
new file mode 100644
index 00000000..9ad3a3a6
--- /dev/null
+++ b/test/completion/civclient.exp
@@ -0,0 +1 @@
+assert_source_completions civclient
diff --git a/test/completion/civserver.exp b/test/completion/civserver.exp
new file mode 100644
index 00000000..d590e0c6
--- /dev/null
+++ b/test/completion/civserver.exp
@@ -0,0 +1 @@
+assert_source_completions civserver
diff --git a/test/completion/cksfv.exp b/test/completion/cksfv.exp
new file mode 100644
index 00000000..293096f7
--- /dev/null
+++ b/test/completion/cksfv.exp
@@ -0,0 +1 @@
+assert_source_completions cksfv
diff --git a/test/completion/cleanarch.exp b/test/completion/cleanarch.exp
new file mode 100644
index 00000000..93646e07
--- /dev/null
+++ b/test/completion/cleanarch.exp
@@ -0,0 +1 @@
+assert_source_completions cleanarch
diff --git a/test/completion/clisp.exp b/test/completion/clisp.exp
new file mode 100644
index 00000000..f4203ef4
--- /dev/null
+++ b/test/completion/clisp.exp
@@ -0,0 +1 @@
+assert_source_completions clisp
diff --git a/test/completion/clone_member.exp b/test/completion/clone_member.exp
new file mode 100644
index 00000000..04dcfe9f
--- /dev/null
+++ b/test/completion/clone_member.exp
@@ -0,0 +1 @@
+assert_source_completions clone_member
diff --git a/test/completion/co.exp b/test/completion/co.exp
new file mode 100644
index 00000000..e8babba4
--- /dev/null
+++ b/test/completion/co.exp
@@ -0,0 +1 @@
+assert_source_completions co
diff --git a/test/completion/composite.exp b/test/completion/composite.exp
new file mode 100644
index 00000000..0eaf6150
--- /dev/null
+++ b/test/completion/composite.exp
@@ -0,0 +1 @@
+assert_source_completions composite
diff --git a/test/completion/config_list.exp b/test/completion/config_list.exp
new file mode 100644
index 00000000..40986234
--- /dev/null
+++ b/test/completion/config_list.exp
@@ -0,0 +1 @@
+assert_source_completions config_list
diff --git a/test/completion/configure.exp b/test/completion/configure.exp
new file mode 100644
index 00000000..cf5611ce
--- /dev/null
+++ b/test/completion/configure.exp
@@ -0,0 +1 @@
+assert_source_completions configure
diff --git a/test/completion/convert.exp b/test/completion/convert.exp
new file mode 100644
index 00000000..27fcc6d0
--- /dev/null
+++ b/test/completion/convert.exp
@@ -0,0 +1 @@
+assert_source_completions convert
diff --git a/test/completion/cowsay.exp b/test/completion/cowsay.exp
new file mode 100644
index 00000000..b82d66d3
--- /dev/null
+++ b/test/completion/cowsay.exp
@@ -0,0 +1 @@
+assert_source_completions cowsay
diff --git a/test/completion/cp.exp b/test/completion/cp.exp
new file mode 100644
index 00000000..db7b6991
--- /dev/null
+++ b/test/completion/cp.exp
@@ -0,0 +1 @@
+assert_source_completions cp
diff --git a/test/completion/cpio.exp b/test/completion/cpio.exp
new file mode 100644
index 00000000..c3fae7ad
--- /dev/null
+++ b/test/completion/cpio.exp
@@ -0,0 +1 @@
+assert_source_completions cpio
diff --git a/test/completion/createdb.exp b/test/completion/createdb.exp
new file mode 100644
index 00000000..db76b2cc
--- /dev/null
+++ b/test/completion/createdb.exp
@@ -0,0 +1 @@
+assert_source_completions createdb
diff --git a/test/completion/cryptsetup.exp b/test/completion/cryptsetup.exp
new file mode 100644
index 00000000..c28169af
--- /dev/null
+++ b/test/completion/cryptsetup.exp
@@ -0,0 +1 @@
+assert_source_completions cryptsetup
diff --git a/test/completion/csplit.exp b/test/completion/csplit.exp
new file mode 100644
index 00000000..d1049855
--- /dev/null
+++ b/test/completion/csplit.exp
@@ -0,0 +1 @@
+assert_source_completions csplit
diff --git a/test/completion/cut.exp b/test/completion/cut.exp
new file mode 100644
index 00000000..87858132
--- /dev/null
+++ b/test/completion/cut.exp
@@ -0,0 +1 @@
+assert_source_completions cut
diff --git a/test/completion/cvs.exp b/test/completion/cvs.exp
new file mode 100644
index 00000000..3515047a
--- /dev/null
+++ b/test/completion/cvs.exp
@@ -0,0 +1 @@
+assert_source_completions cvs
diff --git a/test/completion/cvsps.exp b/test/completion/cvsps.exp
new file mode 100644
index 00000000..e6e3173c
--- /dev/null
+++ b/test/completion/cvsps.exp
@@ -0,0 +1 @@
+assert_source_completions cvsps
diff --git a/test/completion/date.exp b/test/completion/date.exp
new file mode 100644
index 00000000..098ca455
--- /dev/null
+++ b/test/completion/date.exp
@@ -0,0 +1 @@
+assert_source_completions date
diff --git a/test/completion/dcop.exp b/test/completion/dcop.exp
new file mode 100644
index 00000000..d0d0fcc0
--- /dev/null
+++ b/test/completion/dcop.exp
@@ -0,0 +1 @@
+assert_source_completions dcop
diff --git a/test/completion/dd.exp b/test/completion/dd.exp
new file mode 100644
index 00000000..e53ab66d
--- /dev/null
+++ b/test/completion/dd.exp
@@ -0,0 +1 @@
+assert_source_completions dd
diff --git a/test/completion/df.exp b/test/completion/df.exp
new file mode 100644
index 00000000..3840252d
--- /dev/null
+++ b/test/completion/df.exp
@@ -0,0 +1 @@
+assert_source_completions df
diff --git a/test/completion/dhclient.exp b/test/completion/dhclient.exp
new file mode 100644
index 00000000..ef8b6a85
--- /dev/null
+++ b/test/completion/dhclient.exp
@@ -0,0 +1 @@
+assert_source_completions dhclient
diff --git a/test/completion/dict.exp b/test/completion/dict.exp
new file mode 100644
index 00000000..0860b228
--- /dev/null
+++ b/test/completion/dict.exp
@@ -0,0 +1 @@
+assert_source_completions dict
diff --git a/test/completion/diff.exp b/test/completion/diff.exp
new file mode 100644
index 00000000..63e11c74
--- /dev/null
+++ b/test/completion/diff.exp
@@ -0,0 +1 @@
+assert_source_completions diff
diff --git a/test/completion/dir.exp b/test/completion/dir.exp
new file mode 100644
index 00000000..fa4c12fd
--- /dev/null
+++ b/test/completion/dir.exp
@@ -0,0 +1 @@
+assert_source_completions dir
diff --git a/test/completion/display.exp b/test/completion/display.exp
new file mode 100644
index 00000000..a37de277
--- /dev/null
+++ b/test/completion/display.exp
@@ -0,0 +1 @@
+assert_source_completions display
diff --git a/test/completion/dnsspoof.exp b/test/completion/dnsspoof.exp
new file mode 100644
index 00000000..c7110c58
--- /dev/null
+++ b/test/completion/dnsspoof.exp
@@ -0,0 +1 @@
+assert_source_completions dnsspoof
diff --git a/test/completion/dpkg-deb.exp b/test/completion/dpkg-deb.exp
new file mode 100644
index 00000000..4f113ec0
--- /dev/null
+++ b/test/completion/dpkg-deb.exp
@@ -0,0 +1 @@
+assert_source_completions dpkg-deb
diff --git a/test/completion/dpkg-reconfigure.exp b/test/completion/dpkg-reconfigure.exp
new file mode 100644
index 00000000..8d22071a
--- /dev/null
+++ b/test/completion/dpkg-reconfigure.exp
@@ -0,0 +1 @@
+assert_source_completions dpkg-reconfigure
diff --git a/test/completion/dpkg-source.exp b/test/completion/dpkg-source.exp
new file mode 100644
index 00000000..4a7badf8
--- /dev/null
+++ b/test/completion/dpkg-source.exp
@@ -0,0 +1 @@
+assert_source_completions dpkg-source
diff --git a/test/completion/dpkg.exp b/test/completion/dpkg.exp
new file mode 100644
index 00000000..934c3474
--- /dev/null
+++ b/test/completion/dpkg.exp
@@ -0,0 +1 @@
+assert_source_completions dpkg
diff --git a/test/completion/dropdb.exp b/test/completion/dropdb.exp
new file mode 100644
index 00000000..ce35fd5c
--- /dev/null
+++ b/test/completion/dropdb.exp
@@ -0,0 +1 @@
+assert_source_completions dropdb
diff --git a/test/completion/dselect.exp b/test/completion/dselect.exp
new file mode 100644
index 00000000..716b6a26
--- /dev/null
+++ b/test/completion/dselect.exp
@@ -0,0 +1 @@
+assert_source_completions dselect
diff --git a/test/completion/dsniff.exp b/test/completion/dsniff.exp
new file mode 100644
index 00000000..452beebb
--- /dev/null
+++ b/test/completion/dsniff.exp
@@ -0,0 +1 @@
+assert_source_completions dsniff
diff --git a/test/completion/du.exp b/test/completion/du.exp
new file mode 100644
index 00000000..ec7a9946
--- /dev/null
+++ b/test/completion/du.exp
@@ -0,0 +1 @@
+assert_source_completions du
diff --git a/test/completion/dumpdb.exp b/test/completion/dumpdb.exp
new file mode 100644
index 00000000..1bfaecc8
--- /dev/null
+++ b/test/completion/dumpdb.exp
@@ -0,0 +1 @@
+assert_source_completions dumpdb
diff --git a/test/completion/enscript.exp b/test/completion/enscript.exp
new file mode 100644
index 00000000..4ea7b029
--- /dev/null
+++ b/test/completion/enscript.exp
@@ -0,0 +1 @@
+assert_source_completions enscript
diff --git a/test/completion/env.exp b/test/completion/env.exp
new file mode 100644
index 00000000..baf3f754
--- /dev/null
+++ b/test/completion/env.exp
@@ -0,0 +1 @@
+assert_source_completions env
diff --git a/test/completion/evince.exp b/test/completion/evince.exp
new file mode 100644
index 00000000..27376e06
--- /dev/null
+++ b/test/completion/evince.exp
@@ -0,0 +1 @@
+assert_source_completions evince
diff --git a/test/completion/expand.exp b/test/completion/expand.exp
new file mode 100644
index 00000000..1bb7dd6b
--- /dev/null
+++ b/test/completion/expand.exp
@@ -0,0 +1 @@
+assert_source_completions expand
diff --git a/test/completion/filesnarf.exp b/test/completion/filesnarf.exp
new file mode 100644
index 00000000..20af6347
--- /dev/null
+++ b/test/completion/filesnarf.exp
@@ -0,0 +1 @@
+assert_source_completions filesnarf
diff --git a/test/completion/find.exp b/test/completion/find.exp
new file mode 100644
index 00000000..dc73012e
--- /dev/null
+++ b/test/completion/find.exp
@@ -0,0 +1 @@
+assert_source_completions find
diff --git a/test/completion/find_member.exp b/test/completion/find_member.exp
new file mode 100644
index 00000000..c8e4548c
--- /dev/null
+++ b/test/completion/find_member.exp
@@ -0,0 +1 @@
+assert_source_completions find_member
diff --git a/test/completion/finger.exp b/test/completion/finger.exp
new file mode 100644
index 00000000..cc77abe5
--- /dev/null
+++ b/test/completion/finger.exp
@@ -0,0 +1,6 @@
+source "lib/completions/finger.exp"
+
+# TODO: Dynamic loading of completions. After the tests have run a first time
+# and real completion is installed, the tests can be run a second time.
+#
+# source "lib/completions/finger.exp"
diff --git a/test/completion/fmt.exp b/test/completion/fmt.exp
new file mode 100644
index 00000000..44ed2147
--- /dev/null
+++ b/test/completion/fmt.exp
@@ -0,0 +1 @@
+assert_source_completions fmt
diff --git a/test/completion/fold.exp b/test/completion/fold.exp
new file mode 100644
index 00000000..eec92d33
--- /dev/null
+++ b/test/completion/fold.exp
@@ -0,0 +1 @@
+assert_source_completions fold
diff --git a/test/completion/g++.exp b/test/completion/g++.exp
new file mode 100644
index 00000000..9635d93e
--- /dev/null
+++ b/test/completion/g++.exp
@@ -0,0 +1 @@
+assert_source_completions g++
diff --git a/test/completion/g4.exp b/test/completion/g4.exp
new file mode 100644
index 00000000..7bf0b164
--- /dev/null
+++ b/test/completion/g4.exp
@@ -0,0 +1 @@
+assert_source_completions g4
diff --git a/test/completion/g77.exp b/test/completion/g77.exp
new file mode 100644
index 00000000..9a78cac8
--- /dev/null
+++ b/test/completion/g77.exp
@@ -0,0 +1 @@
+assert_source_completions g77
diff --git a/test/completion/gcc.exp b/test/completion/gcc.exp
new file mode 100644
index 00000000..749fafeb
--- /dev/null
+++ b/test/completion/gcc.exp
@@ -0,0 +1 @@
+assert_source_completions gcc
diff --git a/test/completion/gcj.exp b/test/completion/gcj.exp
new file mode 100644
index 00000000..88ca9ff3
--- /dev/null
+++ b/test/completion/gcj.exp
@@ -0,0 +1 @@
+assert_source_completions gcj
diff --git a/test/completion/gcl.exp b/test/completion/gcl.exp
new file mode 100644
index 00000000..ba2ff758
--- /dev/null
+++ b/test/completion/gcl.exp
@@ -0,0 +1 @@
+assert_source_completions gcl
diff --git a/test/completion/gdb.exp b/test/completion/gdb.exp
new file mode 100644
index 00000000..2b09307f
--- /dev/null
+++ b/test/completion/gdb.exp
@@ -0,0 +1 @@
+assert_source_completions gdb
diff --git a/test/completion/genaliases.exp b/test/completion/genaliases.exp
new file mode 100644
index 00000000..eeee394f
--- /dev/null
+++ b/test/completion/genaliases.exp
@@ -0,0 +1 @@
+assert_source_completions genaliases
diff --git a/test/completion/getent.exp b/test/completion/getent.exp
new file mode 100644
index 00000000..9abcfbbd
--- /dev/null
+++ b/test/completion/getent.exp
@@ -0,0 +1 @@
+assert_source_completions getent
diff --git a/test/completion/gkrellm.exp b/test/completion/gkrellm.exp
new file mode 100644
index 00000000..55422a0f
--- /dev/null
+++ b/test/completion/gkrellm.exp
@@ -0,0 +1 @@
+assert_source_completions gkrellm
diff --git a/test/completion/gmplayer.exp b/test/completion/gmplayer.exp
new file mode 100644
index 00000000..0cea91c1
--- /dev/null
+++ b/test/completion/gmplayer.exp
@@ -0,0 +1 @@
+assert_source_completions gmplayer
diff --git a/test/completion/gnatmake.exp b/test/completion/gnatmake.exp
new file mode 100644
index 00000000..eebb3c00
--- /dev/null
+++ b/test/completion/gnatmake.exp
@@ -0,0 +1 @@
+assert_source_completions gnatmake
diff --git a/test/completion/gpc.exp b/test/completion/gpc.exp
new file mode 100644
index 00000000..d7fdb9e7
--- /dev/null
+++ b/test/completion/gpc.exp
@@ -0,0 +1 @@
+assert_source_completions gpc
diff --git a/test/completion/gperf.exp b/test/completion/gperf.exp
new file mode 100644
index 00000000..2b87d664
--- /dev/null
+++ b/test/completion/gperf.exp
@@ -0,0 +1 @@
+assert_source_completions gperf
diff --git a/test/completion/gpg.exp b/test/completion/gpg.exp
new file mode 100644
index 00000000..694f5f87
--- /dev/null
+++ b/test/completion/gpg.exp
@@ -0,0 +1 @@
+assert_source_completions gpg
diff --git a/test/completion/gprof.exp b/test/completion/gprof.exp
new file mode 100644
index 00000000..c63cc28b
--- /dev/null
+++ b/test/completion/gprof.exp
@@ -0,0 +1 @@
+assert_source_completions gprof
diff --git a/test/completion/grep.exp b/test/completion/grep.exp
new file mode 100644
index 00000000..945c3459
--- /dev/null
+++ b/test/completion/grep.exp
@@ -0,0 +1 @@
+assert_source_completions grep
diff --git a/test/completion/grub.exp b/test/completion/grub.exp
new file mode 100644
index 00000000..d50bf754
--- /dev/null
+++ b/test/completion/grub.exp
@@ -0,0 +1 @@
+assert_source_completions grub
diff --git a/test/completion/gzip.exp b/test/completion/gzip.exp
new file mode 100644
index 00000000..e2a31c5f
--- /dev/null
+++ b/test/completion/gzip.exp
@@ -0,0 +1 @@
+assert_source_completions gzip
diff --git a/test/completion/hcitool.exp b/test/completion/hcitool.exp
new file mode 100644
index 00000000..d30c564b
--- /dev/null
+++ b/test/completion/hcitool.exp
@@ -0,0 +1 @@
+assert_source_completions hcitool
diff --git a/test/completion/head.exp b/test/completion/head.exp
new file mode 100644
index 00000000..49235c2e
--- /dev/null
+++ b/test/completion/head.exp
@@ -0,0 +1 @@
+assert_source_completions head
diff --git a/test/completion/iconv.exp b/test/completion/iconv.exp
new file mode 100644
index 00000000..c4c5fb6f
--- /dev/null
+++ b/test/completion/iconv.exp
@@ -0,0 +1 @@
+assert_source_completions iconv
diff --git a/test/completion/id.exp b/test/completion/id.exp
new file mode 100644
index 00000000..a4f81c84
--- /dev/null
+++ b/test/completion/id.exp
@@ -0,0 +1 @@
+assert_source_completions id
diff --git a/test/completion/identify.exp b/test/completion/identify.exp
new file mode 100644
index 00000000..59bd9d6a
--- /dev/null
+++ b/test/completion/identify.exp
@@ -0,0 +1 @@
+assert_source_completions identify
diff --git a/test/completion/ifdown.exp b/test/completion/ifdown.exp
new file mode 100644
index 00000000..f3f1a69d
--- /dev/null
+++ b/test/completion/ifdown.exp
@@ -0,0 +1 @@
+assert_source_completions ifdown
diff --git a/test/completion/ifup.exp b/test/completion/ifup.exp
new file mode 100644
index 00000000..780794b2
--- /dev/null
+++ b/test/completion/ifup.exp
@@ -0,0 +1 @@
+assert_source_completions ifup
diff --git a/test/completion/indent.exp b/test/completion/indent.exp
new file mode 100644
index 00000000..91eae727
--- /dev/null
+++ b/test/completion/indent.exp
@@ -0,0 +1 @@
+assert_source_completions indent
diff --git a/test/completion/info.exp b/test/completion/info.exp
new file mode 100644
index 00000000..d16830b7
--- /dev/null
+++ b/test/completion/info.exp
@@ -0,0 +1 @@
+assert_source_completions info
diff --git a/test/completion/inject.exp b/test/completion/inject.exp
new file mode 100644
index 00000000..c2a18a46
--- /dev/null
+++ b/test/completion/inject.exp
@@ -0,0 +1 @@
+assert_source_completions inject
diff --git a/test/completion/insmod.exp b/test/completion/insmod.exp
new file mode 100644
index 00000000..9aab37c8
--- /dev/null
+++ b/test/completion/insmod.exp
@@ -0,0 +1 @@
+assert_source_completions insmod
diff --git a/test/completion/invoke-rc.d.exp b/test/completion/invoke-rc.d.exp
new file mode 100644
index 00000000..0198d100
--- /dev/null
+++ b/test/completion/invoke-rc.d.exp
@@ -0,0 +1 @@
+assert_source_completions invoke-rc.d
diff --git a/test/completion/ipsec.exp b/test/completion/ipsec.exp
new file mode 100644
index 00000000..f904429b
--- /dev/null
+++ b/test/completion/ipsec.exp
@@ -0,0 +1 @@
+assert_source_completions ipsec
diff --git a/test/completion/ipv6calc.exp b/test/completion/ipv6calc.exp
new file mode 100644
index 00000000..b1c3c181
--- /dev/null
+++ b/test/completion/ipv6calc.exp
@@ -0,0 +1 @@
+assert_source_completions ipv6calc
diff --git a/test/completion/irb.exp b/test/completion/irb.exp
new file mode 100644
index 00000000..02f166f8
--- /dev/null
+++ b/test/completion/irb.exp
@@ -0,0 +1 @@
+assert_source_completions irb
diff --git a/test/completion/isql.exp b/test/completion/isql.exp
new file mode 100644
index 00000000..d06295b7
--- /dev/null
+++ b/test/completion/isql.exp
@@ -0,0 +1 @@
+assert_source_completions isql
diff --git a/test/completion/iwconfig.exp b/test/completion/iwconfig.exp
new file mode 100644
index 00000000..d3935e61
--- /dev/null
+++ b/test/completion/iwconfig.exp
@@ -0,0 +1 @@
+assert_source_completions iwconfig
diff --git a/test/completion/iwlist.exp b/test/completion/iwlist.exp
new file mode 100644
index 00000000..5293e3b1
--- /dev/null
+++ b/test/completion/iwlist.exp
@@ -0,0 +1 @@
+assert_source_completions iwlist
diff --git a/test/completion/iwpriv.exp b/test/completion/iwpriv.exp
new file mode 100644
index 00000000..5caa8410
--- /dev/null
+++ b/test/completion/iwpriv.exp
@@ -0,0 +1 @@
+assert_source_completions iwpriv
diff --git a/test/completion/iwspy.exp b/test/completion/iwspy.exp
new file mode 100644
index 00000000..08476d3d
--- /dev/null
+++ b/test/completion/iwspy.exp
@@ -0,0 +1 @@
+assert_source_completions iwspy
diff --git a/test/completion/jar.exp b/test/completion/jar.exp
new file mode 100644
index 00000000..f9dbdc79
--- /dev/null
+++ b/test/completion/jar.exp
@@ -0,0 +1 @@
+assert_source_completions jar
diff --git a/test/completion/jarsigner.exp b/test/completion/jarsigner.exp
new file mode 100644
index 00000000..21b84fea
--- /dev/null
+++ b/test/completion/jarsigner.exp
@@ -0,0 +1 @@
+assert_source_completions jarsigner
diff --git a/test/completion/java.exp b/test/completion/java.exp
new file mode 100644
index 00000000..fbea3c32
--- /dev/null
+++ b/test/completion/java.exp
@@ -0,0 +1 @@
+assert_source_completions java
diff --git a/test/completion/javac.exp b/test/completion/javac.exp
new file mode 100644
index 00000000..1bc9403e
--- /dev/null
+++ b/test/completion/javac.exp
@@ -0,0 +1 @@
+assert_source_completions javac
diff --git a/test/completion/javadoc.exp b/test/completion/javadoc.exp
new file mode 100644
index 00000000..0fcca89c
--- /dev/null
+++ b/test/completion/javadoc.exp
@@ -0,0 +1 @@
+assert_source_completions javadoc
diff --git a/test/completion/k3b.exp b/test/completion/k3b.exp
new file mode 100644
index 00000000..6d71bbef
--- /dev/null
+++ b/test/completion/k3b.exp
@@ -0,0 +1 @@
+assert_source_completions k3b
diff --git a/test/completion/kdvi.exp b/test/completion/kdvi.exp
new file mode 100644
index 00000000..9f6aa664
--- /dev/null
+++ b/test/completion/kdvi.exp
@@ -0,0 +1 @@
+assert_source_completions kdvi
diff --git a/test/completion/kill.exp b/test/completion/kill.exp
new file mode 100644
index 00000000..98efb326
--- /dev/null
+++ b/test/completion/kill.exp
@@ -0,0 +1 @@
+assert_source_completions kill
diff --git a/test/completion/killall.exp b/test/completion/killall.exp
new file mode 100644
index 00000000..8cf4fe58
--- /dev/null
+++ b/test/completion/killall.exp
@@ -0,0 +1 @@
+assert_source_completions killall
diff --git a/test/completion/kldload.exp b/test/completion/kldload.exp
new file mode 100644
index 00000000..23ad008b
--- /dev/null
+++ b/test/completion/kldload.exp
@@ -0,0 +1 @@
+assert_source_completions kldload
diff --git a/test/completion/kldunload.exp b/test/completion/kldunload.exp
new file mode 100644
index 00000000..26219f20
--- /dev/null
+++ b/test/completion/kldunload.exp
@@ -0,0 +1 @@
+assert_source_completions kldunload
diff --git a/test/completion/kpdf.exp b/test/completion/kpdf.exp
new file mode 100644
index 00000000..d0a17749
--- /dev/null
+++ b/test/completion/kpdf.exp
@@ -0,0 +1 @@
+assert_source_completions kpdf
diff --git a/test/completion/kplayer.exp b/test/completion/kplayer.exp
new file mode 100644
index 00000000..0812c045
--- /dev/null
+++ b/test/completion/kplayer.exp
@@ -0,0 +1 @@
+assert_source_completions kplayer
diff --git a/test/completion/larch.exp b/test/completion/larch.exp
new file mode 100644
index 00000000..ccf332ee
--- /dev/null
+++ b/test/completion/larch.exp
@@ -0,0 +1 @@
+assert_source_completions larch
diff --git a/test/completion/ld.exp b/test/completion/ld.exp
new file mode 100644
index 00000000..fcbc43da
--- /dev/null
+++ b/test/completion/ld.exp
@@ -0,0 +1 @@
+assert_source_completions ld
diff --git a/test/completion/ldd.exp b/test/completion/ldd.exp
new file mode 100644
index 00000000..af175bef
--- /dev/null
+++ b/test/completion/ldd.exp
@@ -0,0 +1 @@
+assert_source_completions ldd
diff --git a/test/completion/less.exp b/test/completion/less.exp
new file mode 100644
index 00000000..1a18c817
--- /dev/null
+++ b/test/completion/less.exp
@@ -0,0 +1 @@
+assert_source_completions less
diff --git a/test/completion/lftp.exp b/test/completion/lftp.exp
new file mode 100644
index 00000000..90f307b8
--- /dev/null
+++ b/test/completion/lftp.exp
@@ -0,0 +1 @@
+assert_source_completions lftp
diff --git a/test/completion/lftpget.exp b/test/completion/lftpget.exp
new file mode 100644
index 00000000..26c40cb8
--- /dev/null
+++ b/test/completion/lftpget.exp
@@ -0,0 +1 @@
+assert_source_completions lftpget
diff --git a/test/completion/lilo.exp b/test/completion/lilo.exp
new file mode 100644
index 00000000..94076365
--- /dev/null
+++ b/test/completion/lilo.exp
@@ -0,0 +1 @@
+assert_source_completions lilo
diff --git a/test/completion/links.exp b/test/completion/links.exp
new file mode 100644
index 00000000..36af0ddf
--- /dev/null
+++ b/test/completion/links.exp
@@ -0,0 +1 @@
+assert_source_completions links
diff --git a/test/completion/lisp.exp b/test/completion/lisp.exp
new file mode 100644
index 00000000..f531d8e2
--- /dev/null
+++ b/test/completion/lisp.exp
@@ -0,0 +1 @@
+assert_source_completions lisp
diff --git a/test/completion/list_admins.exp b/test/completion/list_admins.exp
new file mode 100644
index 00000000..17d9f57a
--- /dev/null
+++ b/test/completion/list_admins.exp
@@ -0,0 +1 @@
+assert_source_completions list_admins
diff --git a/test/completion/list_lists.exp b/test/completion/list_lists.exp
new file mode 100644
index 00000000..28a381cd
--- /dev/null
+++ b/test/completion/list_lists.exp
@@ -0,0 +1 @@
+assert_source_completions list_lists
diff --git a/test/completion/list_members.exp b/test/completion/list_members.exp
new file mode 100644
index 00000000..89b6e1ef
--- /dev/null
+++ b/test/completion/list_members.exp
@@ -0,0 +1 @@
+assert_source_completions list_members
diff --git a/test/completion/list_owners.exp b/test/completion/list_owners.exp
new file mode 100644
index 00000000..88262b09
--- /dev/null
+++ b/test/completion/list_owners.exp
@@ -0,0 +1 @@
+assert_source_completions list_owners
diff --git a/test/completion/ln.exp b/test/completion/ln.exp
new file mode 100644
index 00000000..db4fe381
--- /dev/null
+++ b/test/completion/ln.exp
@@ -0,0 +1 @@
+assert_source_completions ln
diff --git a/test/completion/look.exp b/test/completion/look.exp
new file mode 100644
index 00000000..3a781af4
--- /dev/null
+++ b/test/completion/look.exp
@@ -0,0 +1 @@
+assert_source_completions look
diff --git a/test/completion/ls.exp b/test/completion/ls.exp
new file mode 100644
index 00000000..c98d3463
--- /dev/null
+++ b/test/completion/ls.exp
@@ -0,0 +1 @@
+assert_source_completions ls
diff --git a/test/completion/lvchange.exp b/test/completion/lvchange.exp
new file mode 100644
index 00000000..400a6c5f
--- /dev/null
+++ b/test/completion/lvchange.exp
@@ -0,0 +1 @@
+assert_source_completions lvchange
diff --git a/test/completion/lvcreate.exp b/test/completion/lvcreate.exp
new file mode 100644
index 00000000..f211c6d5
--- /dev/null
+++ b/test/completion/lvcreate.exp
@@ -0,0 +1 @@
+assert_source_completions lvcreate
diff --git a/test/completion/lvdisplay.exp b/test/completion/lvdisplay.exp
new file mode 100644
index 00000000..0d4540b3
--- /dev/null
+++ b/test/completion/lvdisplay.exp
@@ -0,0 +1 @@
+assert_source_completions lvdisplay
diff --git a/test/completion/lvextend.exp b/test/completion/lvextend.exp
new file mode 100644
index 00000000..84c1b526
--- /dev/null
+++ b/test/completion/lvextend.exp
@@ -0,0 +1 @@
+assert_source_completions lvextend
diff --git a/test/completion/lvm.exp b/test/completion/lvm.exp
new file mode 100644
index 00000000..ff3e80fd
--- /dev/null
+++ b/test/completion/lvm.exp
@@ -0,0 +1 @@
+assert_source_completions lvm
diff --git a/test/completion/lvmdiskscan.exp b/test/completion/lvmdiskscan.exp
new file mode 100644
index 00000000..c1f4f5f8
--- /dev/null
+++ b/test/completion/lvmdiskscan.exp
@@ -0,0 +1 @@
+assert_source_completions lvmdiskscan
diff --git a/test/completion/lvreduce.exp b/test/completion/lvreduce.exp
new file mode 100644
index 00000000..c9cd8732
--- /dev/null
+++ b/test/completion/lvreduce.exp
@@ -0,0 +1 @@
+assert_source_completions lvreduce
diff --git a/test/completion/lvremove.exp b/test/completion/lvremove.exp
new file mode 100644
index 00000000..475202fb
--- /dev/null
+++ b/test/completion/lvremove.exp
@@ -0,0 +1 @@
+assert_source_completions lvremove
diff --git a/test/completion/lvrename.exp b/test/completion/lvrename.exp
new file mode 100644
index 00000000..32e7f626
--- /dev/null
+++ b/test/completion/lvrename.exp
@@ -0,0 +1 @@
+assert_source_completions lvrename
diff --git a/test/completion/lvresize.exp b/test/completion/lvresize.exp
new file mode 100644
index 00000000..dd05dbdc
--- /dev/null
+++ b/test/completion/lvresize.exp
@@ -0,0 +1 @@
+assert_source_completions lvresize
diff --git a/test/completion/lvs.exp b/test/completion/lvs.exp
new file mode 100644
index 00000000..796c8b2d
--- /dev/null
+++ b/test/completion/lvs.exp
@@ -0,0 +1 @@
+assert_source_completions lvs
diff --git a/test/completion/lvscan.exp b/test/completion/lvscan.exp
new file mode 100644
index 00000000..549c9fdb
--- /dev/null
+++ b/test/completion/lvscan.exp
@@ -0,0 +1 @@
+assert_source_completions lvscan
diff --git a/test/completion/lzma.exp b/test/completion/lzma.exp
new file mode 100644
index 00000000..8d3f637b
--- /dev/null
+++ b/test/completion/lzma.exp
@@ -0,0 +1 @@
+assert_source_completions lzma
diff --git a/test/completion/lzop.exp b/test/completion/lzop.exp
new file mode 100644
index 00000000..99d8e67e
--- /dev/null
+++ b/test/completion/lzop.exp
@@ -0,0 +1 @@
+assert_source_completions lzop
diff --git a/test/completion/m4.exp b/test/completion/m4.exp
new file mode 100644
index 00000000..475fb9a9
--- /dev/null
+++ b/test/completion/m4.exp
@@ -0,0 +1 @@
+assert_source_completions m4
diff --git a/test/completion/macof.exp b/test/completion/macof.exp
new file mode 100644
index 00000000..0942c213
--- /dev/null
+++ b/test/completion/macof.exp
@@ -0,0 +1 @@
+assert_source_completions macof
diff --git a/test/completion/mailmanctl.exp b/test/completion/mailmanctl.exp
new file mode 100644
index 00000000..2784b27c
--- /dev/null
+++ b/test/completion/mailmanctl.exp
@@ -0,0 +1 @@
+assert_source_completions mailmanctl
diff --git a/test/completion/mailsnarf.exp b/test/completion/mailsnarf.exp
new file mode 100644
index 00000000..c3e20e2a
--- /dev/null
+++ b/test/completion/mailsnarf.exp
@@ -0,0 +1 @@
+assert_source_completions mailsnarf
diff --git a/test/completion/make.exp b/test/completion/make.exp
new file mode 100644
index 00000000..483c7fe8
--- /dev/null
+++ b/test/completion/make.exp
@@ -0,0 +1 @@
+assert_source_completions make
diff --git a/test/completion/man.exp b/test/completion/man.exp
new file mode 100644
index 00000000..7bae8c03
--- /dev/null
+++ b/test/completion/man.exp
@@ -0,0 +1 @@
+assert_source_completions man
diff --git a/test/completion/mc.exp b/test/completion/mc.exp
new file mode 100644
index 00000000..37471b40
--- /dev/null
+++ b/test/completion/mc.exp
@@ -0,0 +1 @@
+assert_source_completions mc
diff --git a/test/completion/mcrypt.exp b/test/completion/mcrypt.exp
new file mode 100644
index 00000000..086b0581
--- /dev/null
+++ b/test/completion/mcrypt.exp
@@ -0,0 +1 @@
+assert_source_completions mcrypt
diff --git a/test/completion/md5sum.exp b/test/completion/md5sum.exp
new file mode 100644
index 00000000..3378b370
--- /dev/null
+++ b/test/completion/md5sum.exp
@@ -0,0 +1 @@
+assert_source_completions md5sum
diff --git a/test/completion/mdecrypt.exp b/test/completion/mdecrypt.exp
new file mode 100644
index 00000000..daab2196
--- /dev/null
+++ b/test/completion/mdecrypt.exp
@@ -0,0 +1 @@
+assert_source_completions mdecrypt
diff --git a/test/completion/mencoder.exp b/test/completion/mencoder.exp
new file mode 100644
index 00000000..6c4fa23d
--- /dev/null
+++ b/test/completion/mencoder.exp
@@ -0,0 +1 @@
+assert_source_completions mencoder
diff --git a/test/completion/minicom.exp b/test/completion/minicom.exp
new file mode 100644
index 00000000..cef598e9
--- /dev/null
+++ b/test/completion/minicom.exp
@@ -0,0 +1 @@
+assert_source_completions minicom
diff --git a/test/completion/mkdir.exp b/test/completion/mkdir.exp
new file mode 100644
index 00000000..f4bad3b9
--- /dev/null
+++ b/test/completion/mkdir.exp
@@ -0,0 +1 @@
+assert_source_completions mkdir
diff --git a/test/completion/mkfifo.exp b/test/completion/mkfifo.exp
new file mode 100644
index 00000000..706b36f4
--- /dev/null
+++ b/test/completion/mkfifo.exp
@@ -0,0 +1 @@
+assert_source_completions mkfifo
diff --git a/test/completion/mkinitrd.exp b/test/completion/mkinitrd.exp
new file mode 100644
index 00000000..e8f4e119
--- /dev/null
+++ b/test/completion/mkinitrd.exp
@@ -0,0 +1 @@
+assert_source_completions mkinitrd
diff --git a/test/completion/mkisofs.exp b/test/completion/mkisofs.exp
new file mode 100644
index 00000000..a94d833b
--- /dev/null
+++ b/test/completion/mkisofs.exp
@@ -0,0 +1 @@
+assert_source_completions mkisofs
diff --git a/test/completion/mknod.exp b/test/completion/mknod.exp
new file mode 100644
index 00000000..89f0cefd
--- /dev/null
+++ b/test/completion/mknod.exp
@@ -0,0 +1 @@
+assert_source_completions mknod
diff --git a/test/completion/mmsitepass.exp b/test/completion/mmsitepass.exp
new file mode 100644
index 00000000..c54c53b2
--- /dev/null
+++ b/test/completion/mmsitepass.exp
@@ -0,0 +1 @@
+assert_source_completions mmsitepass
diff --git a/test/completion/module.exp b/test/completion/module.exp
new file mode 100644
index 00000000..3db6d110
--- /dev/null
+++ b/test/completion/module.exp
@@ -0,0 +1 @@
+assert_source_completions module
diff --git a/test/completion/mogrify.exp b/test/completion/mogrify.exp
new file mode 100644
index 00000000..ad3ff02a
--- /dev/null
+++ b/test/completion/mogrify.exp
@@ -0,0 +1 @@
+assert_source_completions mogrify
diff --git a/test/completion/montage.exp b/test/completion/montage.exp
new file mode 100644
index 00000000..afb11ad5
--- /dev/null
+++ b/test/completion/montage.exp
@@ -0,0 +1 @@
+assert_source_completions montage
diff --git a/test/completion/mount.exp b/test/completion/mount.exp
new file mode 100644
index 00000000..2561e20a
--- /dev/null
+++ b/test/completion/mount.exp
@@ -0,0 +1 @@
+assert_source_completions mount
diff --git a/test/completion/mplayer.exp b/test/completion/mplayer.exp
new file mode 100644
index 00000000..5c38af87
--- /dev/null
+++ b/test/completion/mplayer.exp
@@ -0,0 +1 @@
+assert_source_completions mplayer
diff --git a/test/completion/msgsnarf.exp b/test/completion/msgsnarf.exp
new file mode 100644
index 00000000..cdcbf43d
--- /dev/null
+++ b/test/completion/msgsnarf.exp
@@ -0,0 +1 @@
+assert_source_completions msgsnarf
diff --git a/test/completion/mtx.exp b/test/completion/mtx.exp
new file mode 100644
index 00000000..6be7a2ff
--- /dev/null
+++ b/test/completion/mtx.exp
@@ -0,0 +1 @@
+assert_source_completions mtx
diff --git a/test/completion/mutt.exp b/test/completion/mutt.exp
new file mode 100644
index 00000000..5fb8c339
--- /dev/null
+++ b/test/completion/mutt.exp
@@ -0,0 +1 @@
+assert_source_completions mutt
diff --git a/test/completion/muttng.exp b/test/completion/muttng.exp
new file mode 100644
index 00000000..b06b574d
--- /dev/null
+++ b/test/completion/muttng.exp
@@ -0,0 +1 @@
+assert_source_completions muttng
diff --git a/test/completion/mv.exp b/test/completion/mv.exp
new file mode 100644
index 00000000..b7d22766
--- /dev/null
+++ b/test/completion/mv.exp
@@ -0,0 +1 @@
+assert_source_completions mv
diff --git a/test/completion/mysqladmin.exp b/test/completion/mysqladmin.exp
new file mode 100644
index 00000000..61769d26
--- /dev/null
+++ b/test/completion/mysqladmin.exp
@@ -0,0 +1 @@
+assert_source_completions mysqladmin
diff --git a/test/completion/ncftp.exp b/test/completion/ncftp.exp
new file mode 100644
index 00000000..c5db3f96
--- /dev/null
+++ b/test/completion/ncftp.exp
@@ -0,0 +1 @@
+assert_source_completions ncftp
diff --git a/test/completion/netstat.exp b/test/completion/netstat.exp
new file mode 100644
index 00000000..bee92789
--- /dev/null
+++ b/test/completion/netstat.exp
@@ -0,0 +1 @@
+assert_source_completions netstat
diff --git a/test/completion/newlist.exp b/test/completion/newlist.exp
new file mode 100644
index 00000000..ac05a92f
--- /dev/null
+++ b/test/completion/newlist.exp
@@ -0,0 +1 @@
+assert_source_completions newlist
diff --git a/test/completion/nl.exp b/test/completion/nl.exp
new file mode 100644
index 00000000..c788a06b
--- /dev/null
+++ b/test/completion/nl.exp
@@ -0,0 +1 @@
+assert_source_completions nl
diff --git a/test/completion/nm.exp b/test/completion/nm.exp
new file mode 100644
index 00000000..99ccd370
--- /dev/null
+++ b/test/completion/nm.exp
@@ -0,0 +1 @@
+assert_source_completions nm
diff --git a/test/completion/ntpdate.exp b/test/completion/ntpdate.exp
new file mode 100644
index 00000000..d40bbd73
--- /dev/null
+++ b/test/completion/ntpdate.exp
@@ -0,0 +1 @@
+assert_source_completions ntpdate
diff --git a/test/completion/objcopy.exp b/test/completion/objcopy.exp
new file mode 100644
index 00000000..579d9ba9
--- /dev/null
+++ b/test/completion/objcopy.exp
@@ -0,0 +1 @@
+assert_source_completions objcopy
diff --git a/test/completion/objdump.exp b/test/completion/objdump.exp
new file mode 100644
index 00000000..78689842
--- /dev/null
+++ b/test/completion/objdump.exp
@@ -0,0 +1 @@
+assert_source_completions objdump
diff --git a/test/completion/od.exp b/test/completion/od.exp
new file mode 100644
index 00000000..e9ec0f8f
--- /dev/null
+++ b/test/completion/od.exp
@@ -0,0 +1 @@
+assert_source_completions od
diff --git a/test/completion/openssl.exp b/test/completion/openssl.exp
new file mode 100644
index 00000000..281cbf9c
--- /dev/null
+++ b/test/completion/openssl.exp
@@ -0,0 +1 @@
+assert_source_completions openssl
diff --git a/test/completion/p4.exp b/test/completion/p4.exp
new file mode 100644
index 00000000..9301a04b
--- /dev/null
+++ b/test/completion/p4.exp
@@ -0,0 +1 @@
+assert_source_completions p4
diff --git a/test/completion/pack200.exp b/test/completion/pack200.exp
new file mode 100644
index 00000000..b20f8178
--- /dev/null
+++ b/test/completion/pack200.exp
@@ -0,0 +1 @@
+assert_source_completions pack200
diff --git a/test/completion/paste.exp b/test/completion/paste.exp
new file mode 100644
index 00000000..ab2f1249
--- /dev/null
+++ b/test/completion/paste.exp
@@ -0,0 +1 @@
+assert_source_completions paste
diff --git a/test/completion/patch.exp b/test/completion/patch.exp
new file mode 100644
index 00000000..27d69363
--- /dev/null
+++ b/test/completion/patch.exp
@@ -0,0 +1 @@
+assert_source_completions patch
diff --git a/test/completion/perl.exp b/test/completion/perl.exp
new file mode 100644
index 00000000..617a7b18
--- /dev/null
+++ b/test/completion/perl.exp
@@ -0,0 +1 @@
+assert_source_completions perl
diff --git a/test/completion/perldoc.exp b/test/completion/perldoc.exp
new file mode 100644
index 00000000..d0d49b1a
--- /dev/null
+++ b/test/completion/perldoc.exp
@@ -0,0 +1 @@
+assert_source_completions perldoc
diff --git a/test/completion/pgrep.exp b/test/completion/pgrep.exp
new file mode 100644
index 00000000..6deac165
--- /dev/null
+++ b/test/completion/pgrep.exp
@@ -0,0 +1 @@
+assert_source_completions pgrep
diff --git a/test/completion/pine.exp b/test/completion/pine.exp
new file mode 100644
index 00000000..635d79b9
--- /dev/null
+++ b/test/completion/pine.exp
@@ -0,0 +1 @@
+assert_source_completions pine
diff --git a/test/completion/ping.exp b/test/completion/ping.exp
new file mode 100644
index 00000000..f006ea25
--- /dev/null
+++ b/test/completion/ping.exp
@@ -0,0 +1 @@
+assert_source_completions ping
diff --git a/test/completion/pkg-config.exp b/test/completion/pkg-config.exp
new file mode 100644
index 00000000..03d8dc41
--- /dev/null
+++ b/test/completion/pkg-config.exp
@@ -0,0 +1 @@
+assert_source_completions pkg-config
diff --git a/test/completion/pkg_deinstall.exp b/test/completion/pkg_deinstall.exp
new file mode 100644
index 00000000..e7a666cd
--- /dev/null
+++ b/test/completion/pkg_deinstall.exp
@@ -0,0 +1 @@
+assert_source_completions pkg_deinstall
diff --git a/test/completion/pkg_delete.exp b/test/completion/pkg_delete.exp
new file mode 100644
index 00000000..f66049e0
--- /dev/null
+++ b/test/completion/pkg_delete.exp
@@ -0,0 +1 @@
+assert_source_completions pkg_delete
diff --git a/test/completion/pkg_info.exp b/test/completion/pkg_info.exp
new file mode 100644
index 00000000..e5387cdb
--- /dev/null
+++ b/test/completion/pkg_info.exp
@@ -0,0 +1 @@
+assert_source_completions pkg_info
diff --git a/test/completion/pkill.exp b/test/completion/pkill.exp
new file mode 100644
index 00000000..56e30836
--- /dev/null
+++ b/test/completion/pkill.exp
@@ -0,0 +1 @@
+assert_source_completions pkill
diff --git a/test/completion/portinstall.exp b/test/completion/portinstall.exp
new file mode 100644
index 00000000..87fb5968
--- /dev/null
+++ b/test/completion/portinstall.exp
@@ -0,0 +1 @@
+assert_source_completions portinstall
diff --git a/test/completion/portupgrade.exp b/test/completion/portupgrade.exp
new file mode 100644
index 00000000..00e8d4df
--- /dev/null
+++ b/test/completion/portupgrade.exp
@@ -0,0 +1 @@
+assert_source_completions portupgrade
diff --git a/test/completion/povray.exp b/test/completion/povray.exp
new file mode 100644
index 00000000..4d49702f
--- /dev/null
+++ b/test/completion/povray.exp
@@ -0,0 +1 @@
+assert_source_completions povray
diff --git a/test/completion/pr.exp b/test/completion/pr.exp
new file mode 100644
index 00000000..940bfe40
--- /dev/null
+++ b/test/completion/pr.exp
@@ -0,0 +1 @@
+assert_source_completions pr
diff --git a/test/completion/psql.exp b/test/completion/psql.exp
new file mode 100644
index 00000000..619d9e13
--- /dev/null
+++ b/test/completion/psql.exp
@@ -0,0 +1 @@
+assert_source_completions psql
diff --git a/test/completion/ptx.exp b/test/completion/ptx.exp
new file mode 100644
index 00000000..4ab752b5
--- /dev/null
+++ b/test/completion/ptx.exp
@@ -0,0 +1 @@
+assert_source_completions ptx
diff --git a/test/completion/pvchange.exp b/test/completion/pvchange.exp
new file mode 100644
index 00000000..d6f35360
--- /dev/null
+++ b/test/completion/pvchange.exp
@@ -0,0 +1 @@
+assert_source_completions pvchange
diff --git a/test/completion/pvcreate.exp b/test/completion/pvcreate.exp
new file mode 100644
index 00000000..1542baa5
--- /dev/null
+++ b/test/completion/pvcreate.exp
@@ -0,0 +1 @@
+assert_source_completions pvcreate
diff --git a/test/completion/pvdisplay.exp b/test/completion/pvdisplay.exp
new file mode 100644
index 00000000..bcbcb588
--- /dev/null
+++ b/test/completion/pvdisplay.exp
@@ -0,0 +1 @@
+assert_source_completions pvdisplay
diff --git a/test/completion/pvmove.exp b/test/completion/pvmove.exp
new file mode 100644
index 00000000..43151934
--- /dev/null
+++ b/test/completion/pvmove.exp
@@ -0,0 +1 @@
+assert_source_completions pvmove
diff --git a/test/completion/pvremove.exp b/test/completion/pvremove.exp
new file mode 100644
index 00000000..3cc59769
--- /dev/null
+++ b/test/completion/pvremove.exp
@@ -0,0 +1 @@
+assert_source_completions pvremove
diff --git a/test/completion/pvs.exp b/test/completion/pvs.exp
new file mode 100644
index 00000000..22dc03d0
--- /dev/null
+++ b/test/completion/pvs.exp
@@ -0,0 +1 @@
+assert_source_completions pvs
diff --git a/test/completion/pvscan.exp b/test/completion/pvscan.exp
new file mode 100644
index 00000000..22b02c7f
--- /dev/null
+++ b/test/completion/pvscan.exp
@@ -0,0 +1 @@
+assert_source_completions pvscan
diff --git a/test/completion/python.exp b/test/completion/python.exp
new file mode 100644
index 00000000..2cb7390d
--- /dev/null
+++ b/test/completion/python.exp
@@ -0,0 +1 @@
+assert_source_completions python
diff --git a/test/completion/qrunner.exp b/test/completion/qrunner.exp
new file mode 100644
index 00000000..567dcb4d
--- /dev/null
+++ b/test/completion/qrunner.exp
@@ -0,0 +1 @@
+assert_source_completions qrunner
diff --git a/test/completion/querybts.exp b/test/completion/querybts.exp
new file mode 100644
index 00000000..81203b2b
--- /dev/null
+++ b/test/completion/querybts.exp
@@ -0,0 +1 @@
+assert_source_completions querybts
diff --git a/test/completion/rcs.exp b/test/completion/rcs.exp
new file mode 100644
index 00000000..34b21190
--- /dev/null
+++ b/test/completion/rcs.exp
@@ -0,0 +1 @@
+assert_source_completions rcs
diff --git a/test/completion/rcsdiff.exp b/test/completion/rcsdiff.exp
new file mode 100644
index 00000000..9cf52dcc
--- /dev/null
+++ b/test/completion/rcsdiff.exp
@@ -0,0 +1 @@
+assert_source_completions rcsdiff
diff --git a/test/completion/rdict.exp b/test/completion/rdict.exp
new file mode 100644
index 00000000..cea99fbc
--- /dev/null
+++ b/test/completion/rdict.exp
@@ -0,0 +1 @@
+assert_source_completions rdict
diff --git a/test/completion/readelf.exp b/test/completion/readelf.exp
new file mode 100644
index 00000000..d0d9bc48
--- /dev/null
+++ b/test/completion/readelf.exp
@@ -0,0 +1 @@
+assert_source_completions readelf
diff --git a/test/completion/readonly.exp b/test/completion/readonly.exp
new file mode 100644
index 00000000..f35b8e7a
--- /dev/null
+++ b/test/completion/readonly.exp
@@ -0,0 +1 @@
+assert_source_completions readonly
diff --git a/test/completion/remove_members.exp b/test/completion/remove_members.exp
new file mode 100644
index 00000000..0cc71ac1
--- /dev/null
+++ b/test/completion/remove_members.exp
@@ -0,0 +1 @@
+assert_source_completions remove_members
diff --git a/test/completion/removepkg.exp b/test/completion/removepkg.exp
new file mode 100644
index 00000000..e78e01a7
--- /dev/null
+++ b/test/completion/removepkg.exp
@@ -0,0 +1 @@
+assert_source_completions removepkg
diff --git a/test/completion/renice.exp b/test/completion/renice.exp
new file mode 100644
index 00000000..e5d6c8e5
--- /dev/null
+++ b/test/completion/renice.exp
@@ -0,0 +1 @@
+assert_source_completions renice
diff --git a/test/completion/reportbug.exp b/test/completion/reportbug.exp
new file mode 100644
index 00000000..10d6cebb
--- /dev/null
+++ b/test/completion/reportbug.exp
@@ -0,0 +1 @@
+assert_source_completions reportbug
diff --git a/test/completion/ri.exp b/test/completion/ri.exp
new file mode 100644
index 00000000..f93d3409
--- /dev/null
+++ b/test/completion/ri.exp
@@ -0,0 +1 @@
+assert_source_completions ri
diff --git a/test/completion/rlog.exp b/test/completion/rlog.exp
new file mode 100644
index 00000000..9af48c09
--- /dev/null
+++ b/test/completion/rlog.exp
@@ -0,0 +1 @@
+assert_source_completions rlog
diff --git a/test/completion/rm.exp b/test/completion/rm.exp
new file mode 100644
index 00000000..6a99948b
--- /dev/null
+++ b/test/completion/rm.exp
@@ -0,0 +1 @@
+assert_source_completions rm
diff --git a/test/completion/rmdir.exp b/test/completion/rmdir.exp
new file mode 100644
index 00000000..a7435b82
--- /dev/null
+++ b/test/completion/rmdir.exp
@@ -0,0 +1 @@
+assert_source_completions rmdir
diff --git a/test/completion/rmlist.exp b/test/completion/rmlist.exp
new file mode 100644
index 00000000..ac4dd513
--- /dev/null
+++ b/test/completion/rmlist.exp
@@ -0,0 +1 @@
+assert_source_completions rmlist
diff --git a/test/completion/rpcdebug.exp b/test/completion/rpcdebug.exp
new file mode 100644
index 00000000..add86388
--- /dev/null
+++ b/test/completion/rpcdebug.exp
@@ -0,0 +1 @@
+assert_source_completions rpcdebug
diff --git a/test/completion/rpm.exp b/test/completion/rpm.exp
new file mode 100644
index 00000000..c583e56c
--- /dev/null
+++ b/test/completion/rpm.exp
@@ -0,0 +1 @@
+assert_source_completions rpm
diff --git a/test/completion/rsync.exp b/test/completion/rsync.exp
new file mode 100644
index 00000000..d927b509
--- /dev/null
+++ b/test/completion/rsync.exp
@@ -0,0 +1 @@
+assert_source_completions rsync
diff --git a/test/completion/rtcwake.exp b/test/completion/rtcwake.exp
new file mode 100644
index 00000000..abedd8de
--- /dev/null
+++ b/test/completion/rtcwake.exp
@@ -0,0 +1 @@
+assert_source_completions rtcwake
diff --git a/test/completion/sbcl-mt.exp b/test/completion/sbcl-mt.exp
new file mode 100644
index 00000000..a5485f14
--- /dev/null
+++ b/test/completion/sbcl-mt.exp
@@ -0,0 +1 @@
+assert_source_completions sbcl-mt
diff --git a/test/completion/sbcl.exp b/test/completion/sbcl.exp
new file mode 100644
index 00000000..865f9509
--- /dev/null
+++ b/test/completion/sbcl.exp
@@ -0,0 +1 @@
+assert_source_completions sbcl
diff --git a/test/completion/scp.exp b/test/completion/scp.exp
new file mode 100644
index 00000000..e025a9dd
--- /dev/null
+++ b/test/completion/scp.exp
@@ -0,0 +1 @@
+assert_source_completions scp
diff --git a/test/completion/screen.exp b/test/completion/screen.exp
new file mode 100644
index 00000000..8fce61d0
--- /dev/null
+++ b/test/completion/screen.exp
@@ -0,0 +1 @@
+assert_source_completions screen
diff --git a/test/completion/sed.exp b/test/completion/sed.exp
new file mode 100644
index 00000000..e4ce16f8
--- /dev/null
+++ b/test/completion/sed.exp
@@ -0,0 +1 @@
+assert_source_completions sed
diff --git a/test/completion/seq.exp b/test/completion/seq.exp
new file mode 100644
index 00000000..4123ba9d
--- /dev/null
+++ b/test/completion/seq.exp
@@ -0,0 +1 @@
+assert_source_completions seq
diff --git a/test/completion/service.exp b/test/completion/service.exp
new file mode 100644
index 00000000..a1bae6a4
--- /dev/null
+++ b/test/completion/service.exp
@@ -0,0 +1 @@
+assert_source_completions service
diff --git a/test/completion/set.exp b/test/completion/set.exp
new file mode 100644
index 00000000..e30a9c6f
--- /dev/null
+++ b/test/completion/set.exp
@@ -0,0 +1 @@
+assert_source_completions set
diff --git a/test/completion/sftp.exp b/test/completion/sftp.exp
new file mode 100644
index 00000000..448cd218
--- /dev/null
+++ b/test/completion/sftp.exp
@@ -0,0 +1 @@
+assert_source_completions sftp
diff --git a/test/completion/sha1sum.exp b/test/completion/sha1sum.exp
new file mode 100644
index 00000000..b6d09e88
--- /dev/null
+++ b/test/completion/sha1sum.exp
@@ -0,0 +1 @@
+assert_source_completions sha1sum
diff --git a/test/completion/shar.exp b/test/completion/shar.exp
new file mode 100644
index 00000000..ae23e49e
--- /dev/null
+++ b/test/completion/shar.exp
@@ -0,0 +1 @@
+assert_source_completions shar
diff --git a/test/completion/sitecopy.exp b/test/completion/sitecopy.exp
new file mode 100644
index 00000000..ddb57024
--- /dev/null
+++ b/test/completion/sitecopy.exp
@@ -0,0 +1 @@
+assert_source_completions sitecopy
diff --git a/test/completion/smartctl.exp b/test/completion/smartctl.exp
new file mode 100644
index 00000000..1b6f55d6
--- /dev/null
+++ b/test/completion/smartctl.exp
@@ -0,0 +1 @@
+assert_source_completions smartctl
diff --git a/test/completion/snownews.exp b/test/completion/snownews.exp
new file mode 100644
index 00000000..c7a94d2f
--- /dev/null
+++ b/test/completion/snownews.exp
@@ -0,0 +1 @@
+assert_source_completions snownews
diff --git a/test/completion/sort.exp b/test/completion/sort.exp
new file mode 100644
index 00000000..8cc2429e
--- /dev/null
+++ b/test/completion/sort.exp
@@ -0,0 +1 @@
+assert_source_completions sort
diff --git a/test/completion/split.exp b/test/completion/split.exp
new file mode 100644
index 00000000..78614669
--- /dev/null
+++ b/test/completion/split.exp
@@ -0,0 +1 @@
+assert_source_completions split
diff --git a/test/completion/spovray.exp b/test/completion/spovray.exp
new file mode 100644
index 00000000..3c45889b
--- /dev/null
+++ b/test/completion/spovray.exp
@@ -0,0 +1 @@
+assert_source_completions spovray
diff --git a/test/completion/ssh.exp b/test/completion/ssh.exp
new file mode 100644
index 00000000..0477cba5
--- /dev/null
+++ b/test/completion/ssh.exp
@@ -0,0 +1 @@
+assert_source_completions ssh
diff --git a/test/completion/sshmitm.exp b/test/completion/sshmitm.exp
new file mode 100644
index 00000000..f1c10baa
--- /dev/null
+++ b/test/completion/sshmitm.exp
@@ -0,0 +1 @@
+assert_source_completions sshmitm
diff --git a/test/completion/sshow.exp b/test/completion/sshow.exp
new file mode 100644
index 00000000..8899f907
--- /dev/null
+++ b/test/completion/sshow.exp
@@ -0,0 +1 @@
+assert_source_completions sshow
diff --git a/test/completion/strace.exp b/test/completion/strace.exp
new file mode 100644
index 00000000..717db3a3
--- /dev/null
+++ b/test/completion/strace.exp
@@ -0,0 +1 @@
+assert_source_completions strace
diff --git a/test/completion/strip.exp b/test/completion/strip.exp
new file mode 100644
index 00000000..d56fdb21
--- /dev/null
+++ b/test/completion/strip.exp
@@ -0,0 +1 @@
+assert_source_completions strip
diff --git a/test/completion/sudo.exp b/test/completion/sudo.exp
new file mode 100644
index 00000000..2a8015ff
--- /dev/null
+++ b/test/completion/sudo.exp
@@ -0,0 +1 @@
+assert_source_completions sudo
diff --git a/test/completion/svk.exp b/test/completion/svk.exp
new file mode 100644
index 00000000..f3b5c4e6
--- /dev/null
+++ b/test/completion/svk.exp
@@ -0,0 +1 @@
+assert_source_completions svk
diff --git a/test/completion/svn.exp b/test/completion/svn.exp
new file mode 100644
index 00000000..e68594fa
--- /dev/null
+++ b/test/completion/svn.exp
@@ -0,0 +1 @@
+assert_source_completions svn
diff --git a/test/completion/svnadmin.exp b/test/completion/svnadmin.exp
new file mode 100644
index 00000000..cbbc0b71
--- /dev/null
+++ b/test/completion/svnadmin.exp
@@ -0,0 +1 @@
+assert_source_completions svnadmin
diff --git a/test/completion/svnlook.exp b/test/completion/svnlook.exp
new file mode 100644
index 00000000..6f973fc3
--- /dev/null
+++ b/test/completion/svnlook.exp
@@ -0,0 +1 @@
+assert_source_completions svnlook
diff --git a/test/completion/sync_members.exp b/test/completion/sync_members.exp
new file mode 100644
index 00000000..85f2f8c8
--- /dev/null
+++ b/test/completion/sync_members.exp
@@ -0,0 +1 @@
+assert_source_completions sync_members
diff --git a/test/completion/sysctl.exp b/test/completion/sysctl.exp
new file mode 100644
index 00000000..cad11393
--- /dev/null
+++ b/test/completion/sysctl.exp
@@ -0,0 +1 @@
+assert_source_completions sysctl
diff --git a/test/completion/tac.exp b/test/completion/tac.exp
new file mode 100644
index 00000000..98f051ed
--- /dev/null
+++ b/test/completion/tac.exp
@@ -0,0 +1 @@
+assert_source_completions tac
diff --git a/test/completion/tail.exp b/test/completion/tail.exp
new file mode 100644
index 00000000..362876a3
--- /dev/null
+++ b/test/completion/tail.exp
@@ -0,0 +1 @@
+assert_source_completions tail
diff --git a/test/completion/tar.exp b/test/completion/tar.exp
new file mode 100644
index 00000000..4a309863
--- /dev/null
+++ b/test/completion/tar.exp
@@ -0,0 +1 @@
+assert_source_completions tar
diff --git a/test/completion/tcpkill.exp b/test/completion/tcpkill.exp
new file mode 100644
index 00000000..c062cf3b
--- /dev/null
+++ b/test/completion/tcpkill.exp
@@ -0,0 +1 @@
+assert_source_completions tcpkill
diff --git a/test/completion/tcpnice.exp b/test/completion/tcpnice.exp
new file mode 100644
index 00000000..b7f14f5e
--- /dev/null
+++ b/test/completion/tcpnice.exp
@@ -0,0 +1 @@
+assert_source_completions tcpnice
diff --git a/test/completion/tee.exp b/test/completion/tee.exp
new file mode 100644
index 00000000..deb6a0d9
--- /dev/null
+++ b/test/completion/tee.exp
@@ -0,0 +1 @@
+assert_source_completions tee
diff --git a/test/completion/texindex.exp b/test/completion/texindex.exp
new file mode 100644
index 00000000..0363595f
--- /dev/null
+++ b/test/completion/texindex.exp
@@ -0,0 +1 @@
+assert_source_completions texindex
diff --git a/test/completion/tightvncviewer.exp b/test/completion/tightvncviewer.exp
new file mode 100644
index 00000000..e08b7560
--- /dev/null
+++ b/test/completion/tightvncviewer.exp
@@ -0,0 +1 @@
+assert_source_completions tightvncviewer
diff --git a/test/completion/time.exp b/test/completion/time.exp
new file mode 100644
index 00000000..fc90f521
--- /dev/null
+++ b/test/completion/time.exp
@@ -0,0 +1 @@
+assert_source_completions time
diff --git a/test/completion/touch.exp b/test/completion/touch.exp
new file mode 100644
index 00000000..212622c5
--- /dev/null
+++ b/test/completion/touch.exp
@@ -0,0 +1 @@
+assert_source_completions touch
diff --git a/test/completion/tr.exp b/test/completion/tr.exp
new file mode 100644
index 00000000..c5b3f9be
--- /dev/null
+++ b/test/completion/tr.exp
@@ -0,0 +1 @@
+assert_source_completions tr
diff --git a/test/completion/unace.exp b/test/completion/unace.exp
new file mode 100644
index 00000000..0fe2b39f
--- /dev/null
+++ b/test/completion/unace.exp
@@ -0,0 +1 @@
+assert_source_completions unace
diff --git a/test/completion/uname.exp b/test/completion/uname.exp
new file mode 100644
index 00000000..45f26569
--- /dev/null
+++ b/test/completion/uname.exp
@@ -0,0 +1 @@
+assert_source_completions uname
diff --git a/test/completion/unexpand.exp b/test/completion/unexpand.exp
new file mode 100644
index 00000000..ed11ba79
--- /dev/null
+++ b/test/completion/unexpand.exp
@@ -0,0 +1 @@
+assert_source_completions unexpand
diff --git a/test/completion/uniq.exp b/test/completion/uniq.exp
new file mode 100644
index 00000000..a1dfa4a7
--- /dev/null
+++ b/test/completion/uniq.exp
@@ -0,0 +1 @@
+assert_source_completions uniq
diff --git a/test/completion/units.exp b/test/completion/units.exp
new file mode 100644
index 00000000..5c9bfb73
--- /dev/null
+++ b/test/completion/units.exp
@@ -0,0 +1 @@
+assert_source_completions units
diff --git a/test/completion/unpack200.exp b/test/completion/unpack200.exp
new file mode 100644
index 00000000..c90d02ed
--- /dev/null
+++ b/test/completion/unpack200.exp
@@ -0,0 +1 @@
+assert_source_completions unpack200
diff --git a/test/completion/unrar.exp b/test/completion/unrar.exp
new file mode 100644
index 00000000..d9a509ee
--- /dev/null
+++ b/test/completion/unrar.exp
@@ -0,0 +1 @@
+assert_source_completions unrar
diff --git a/test/completion/unset.exp b/test/completion/unset.exp
new file mode 100644
index 00000000..8a00dbf2
--- /dev/null
+++ b/test/completion/unset.exp
@@ -0,0 +1 @@
+assert_source_completions unset
diff --git a/test/completion/unshunt.exp b/test/completion/unshunt.exp
new file mode 100644
index 00000000..fea1a7a3
--- /dev/null
+++ b/test/completion/unshunt.exp
@@ -0,0 +1 @@
+assert_source_completions unshunt
diff --git a/test/completion/update-alternatives.exp b/test/completion/update-alternatives.exp
new file mode 100644
index 00000000..ff4bc114
--- /dev/null
+++ b/test/completion/update-alternatives.exp
@@ -0,0 +1 @@
+assert_source_completions update-alternatives
diff --git a/test/completion/update-rc.d.exp b/test/completion/update-rc.d.exp
new file mode 100644
index 00000000..1becc8cc
--- /dev/null
+++ b/test/completion/update-rc.d.exp
@@ -0,0 +1 @@
+assert_source_completions update-rc.d
diff --git a/test/completion/urlsnarf.exp b/test/completion/urlsnarf.exp
new file mode 100644
index 00000000..c541391b
--- /dev/null
+++ b/test/completion/urlsnarf.exp
@@ -0,0 +1 @@
+assert_source_completions urlsnarf
diff --git a/test/completion/vdir.exp b/test/completion/vdir.exp
new file mode 100644
index 00000000..582f3b09
--- /dev/null
+++ b/test/completion/vdir.exp
@@ -0,0 +1 @@
+assert_source_completions vdir
diff --git a/test/completion/vgcfgbackup.exp b/test/completion/vgcfgbackup.exp
new file mode 100644
index 00000000..d512f0bd
--- /dev/null
+++ b/test/completion/vgcfgbackup.exp
@@ -0,0 +1 @@
+assert_source_completions vgcfgbackup
diff --git a/test/completion/vgcfgrestore.exp b/test/completion/vgcfgrestore.exp
new file mode 100644
index 00000000..75319983
--- /dev/null
+++ b/test/completion/vgcfgrestore.exp
@@ -0,0 +1 @@
+assert_source_completions vgcfgrestore
diff --git a/test/completion/vgchange.exp b/test/completion/vgchange.exp
new file mode 100644
index 00000000..80c35c63
--- /dev/null
+++ b/test/completion/vgchange.exp
@@ -0,0 +1 @@
+assert_source_completions vgchange
diff --git a/test/completion/vgck.exp b/test/completion/vgck.exp
new file mode 100644
index 00000000..06a0829e
--- /dev/null
+++ b/test/completion/vgck.exp
@@ -0,0 +1 @@
+assert_source_completions vgck
diff --git a/test/completion/vgconvert.exp b/test/completion/vgconvert.exp
new file mode 100644
index 00000000..374522e2
--- /dev/null
+++ b/test/completion/vgconvert.exp
@@ -0,0 +1 @@
+assert_source_completions vgconvert
diff --git a/test/completion/vgcreate.exp b/test/completion/vgcreate.exp
new file mode 100644
index 00000000..11c38703
--- /dev/null
+++ b/test/completion/vgcreate.exp
@@ -0,0 +1 @@
+assert_source_completions vgcreate
diff --git a/test/completion/vgdisplay.exp b/test/completion/vgdisplay.exp
new file mode 100644
index 00000000..0f8653cd
--- /dev/null
+++ b/test/completion/vgdisplay.exp
@@ -0,0 +1 @@
+assert_source_completions vgdisplay
diff --git a/test/completion/vgexport.exp b/test/completion/vgexport.exp
new file mode 100644
index 00000000..13f10342
--- /dev/null
+++ b/test/completion/vgexport.exp
@@ -0,0 +1 @@
+assert_source_completions vgexport
diff --git a/test/completion/vgextend.exp b/test/completion/vgextend.exp
new file mode 100644
index 00000000..4b860708
--- /dev/null
+++ b/test/completion/vgextend.exp
@@ -0,0 +1 @@
+assert_source_completions vgextend
diff --git a/test/completion/vgimport.exp b/test/completion/vgimport.exp
new file mode 100644
index 00000000..dd45bfd0
--- /dev/null
+++ b/test/completion/vgimport.exp
@@ -0,0 +1 @@
+assert_source_completions vgimport
diff --git a/test/completion/vgmerge.exp b/test/completion/vgmerge.exp
new file mode 100644
index 00000000..50556060
--- /dev/null
+++ b/test/completion/vgmerge.exp
@@ -0,0 +1 @@
+assert_source_completions vgmerge
diff --git a/test/completion/vgmknodes.exp b/test/completion/vgmknodes.exp
new file mode 100644
index 00000000..74f13cb3
--- /dev/null
+++ b/test/completion/vgmknodes.exp
@@ -0,0 +1 @@
+assert_source_completions vgmknodes
diff --git a/test/completion/vgreduce.exp b/test/completion/vgreduce.exp
new file mode 100644
index 00000000..47338e05
--- /dev/null
+++ b/test/completion/vgreduce.exp
@@ -0,0 +1 @@
+assert_source_completions vgreduce
diff --git a/test/completion/vgremove.exp b/test/completion/vgremove.exp
new file mode 100644
index 00000000..029ba70e
--- /dev/null
+++ b/test/completion/vgremove.exp
@@ -0,0 +1 @@
+assert_source_completions vgremove
diff --git a/test/completion/vgrename.exp b/test/completion/vgrename.exp
new file mode 100644
index 00000000..17460c3c
--- /dev/null
+++ b/test/completion/vgrename.exp
@@ -0,0 +1 @@
+assert_source_completions vgrename
diff --git a/test/completion/vgs.exp b/test/completion/vgs.exp
new file mode 100644
index 00000000..470b8ecd
--- /dev/null
+++ b/test/completion/vgs.exp
@@ -0,0 +1 @@
+assert_source_completions vgs
diff --git a/test/completion/vgscan.exp b/test/completion/vgscan.exp
new file mode 100644
index 00000000..a8f1ce46
--- /dev/null
+++ b/test/completion/vgscan.exp
@@ -0,0 +1 @@
+assert_source_completions vgscan
diff --git a/test/completion/vgsplit.exp b/test/completion/vgsplit.exp
new file mode 100644
index 00000000..d4777569
--- /dev/null
+++ b/test/completion/vgsplit.exp
@@ -0,0 +1 @@
+assert_source_completions vgsplit
diff --git a/test/completion/vncviewer.exp b/test/completion/vncviewer.exp
new file mode 100644
index 00000000..05c663d3
--- /dev/null
+++ b/test/completion/vncviewer.exp
@@ -0,0 +1 @@
+assert_source_completions vncviewer
diff --git a/test/completion/wc.exp b/test/completion/wc.exp
new file mode 100644
index 00000000..fc6a0432
--- /dev/null
+++ b/test/completion/wc.exp
@@ -0,0 +1 @@
+assert_source_completions wc
diff --git a/test/completion/webmitm.exp b/test/completion/webmitm.exp
new file mode 100644
index 00000000..73d8a2a7
--- /dev/null
+++ b/test/completion/webmitm.exp
@@ -0,0 +1 @@
+assert_source_completions webmitm
diff --git a/test/completion/wget.exp b/test/completion/wget.exp
new file mode 100644
index 00000000..0607f2e6
--- /dev/null
+++ b/test/completion/wget.exp
@@ -0,0 +1 @@
+assert_source_completions wget
diff --git a/test/completion/who.exp b/test/completion/who.exp
new file mode 100644
index 00000000..3a312a32
--- /dev/null
+++ b/test/completion/who.exp
@@ -0,0 +1 @@
+assert_source_completions who
diff --git a/test/completion/withlist.exp b/test/completion/withlist.exp
new file mode 100644
index 00000000..cfc5a546
--- /dev/null
+++ b/test/completion/withlist.exp
@@ -0,0 +1 @@
+assert_source_completions withlist
diff --git a/test/completion/wol.exp b/test/completion/wol.exp
new file mode 100644
index 00000000..2e499726
--- /dev/null
+++ b/test/completion/wol.exp
@@ -0,0 +1 @@
+assert_source_completions wol
diff --git a/test/completion/wtf.exp b/test/completion/wtf.exp
new file mode 100644
index 00000000..3e1b364c
--- /dev/null
+++ b/test/completion/wtf.exp
@@ -0,0 +1 @@
+assert_source_completions wtf
diff --git a/test/completion/wvdial.exp b/test/completion/wvdial.exp
new file mode 100644
index 00000000..46b65712
--- /dev/null
+++ b/test/completion/wvdial.exp
@@ -0,0 +1 @@
+assert_source_completions wvdial
diff --git a/test/completion/xhost.exp b/test/completion/xhost.exp
new file mode 100644
index 00000000..159782b2
--- /dev/null
+++ b/test/completion/xhost.exp
@@ -0,0 +1 @@
+assert_source_completions xhost
diff --git a/test/completion/xmllint.exp b/test/completion/xmllint.exp
new file mode 100644
index 00000000..64210c80
--- /dev/null
+++ b/test/completion/xmllint.exp
@@ -0,0 +1 @@
+assert_source_completions xmllint
diff --git a/test/completion/xmlwf.exp b/test/completion/xmlwf.exp
new file mode 100644
index 00000000..afe823b6
--- /dev/null
+++ b/test/completion/xmlwf.exp
@@ -0,0 +1 @@
+assert_source_completions xmlwf
diff --git a/test/completion/xmms.exp b/test/completion/xmms.exp
new file mode 100644
index 00000000..2ebde005
--- /dev/null
+++ b/test/completion/xmms.exp
@@ -0,0 +1 @@
+assert_source_completions xmms
diff --git a/test/completion/xpovray.exp b/test/completion/xpovray.exp
new file mode 100644
index 00000000..1ada5e03
--- /dev/null
+++ b/test/completion/xpovray.exp
@@ -0,0 +1 @@
+assert_source_completions xpovray
diff --git a/test/completion/xrandr.exp b/test/completion/xrandr.exp
new file mode 100644
index 00000000..37dcedcc
--- /dev/null
+++ b/test/completion/xrandr.exp
@@ -0,0 +1 @@
+assert_source_completions xrandr
diff --git a/test/completion/xsltproc.exp b/test/completion/xsltproc.exp
new file mode 100644
index 00000000..8729fbe1
--- /dev/null
+++ b/test/completion/xsltproc.exp
@@ -0,0 +1 @@
+assert_source_completions xsltproc
diff --git a/test/completion/xvnc4viewer.exp b/test/completion/xvnc4viewer.exp
new file mode 100644
index 00000000..0c7210bc
--- /dev/null
+++ b/test/completion/xvnc4viewer.exp
@@ -0,0 +1 @@
+assert_source_completions xvnc4viewer
diff --git a/test/completion/xz.exp b/test/completion/xz.exp
new file mode 100644
index 00000000..92a6a170
--- /dev/null
+++ b/test/completion/xz.exp
@@ -0,0 +1 @@
+assert_source_completions xz
diff --git a/test/completion/ypcat.exp b/test/completion/ypcat.exp
new file mode 100644
index 00000000..9a244c68
--- /dev/null
+++ b/test/completion/ypcat.exp
@@ -0,0 +1 @@
+assert_source_completions ypcat
diff --git a/test/completion/ypmatch.exp b/test/completion/ypmatch.exp
new file mode 100644
index 00000000..5ec094fa
--- /dev/null
+++ b/test/completion/ypmatch.exp
@@ -0,0 +1 @@
+assert_source_completions ypmatch
diff --git a/test/completion/yum-arch.exp b/test/completion/yum-arch.exp
new file mode 100644
index 00000000..95284151
--- /dev/null
+++ b/test/completion/yum-arch.exp
@@ -0,0 +1 @@
+assert_source_completions yum-arch
diff --git a/test/completion/yum.exp b/test/completion/yum.exp
new file mode 100644
index 00000000..d1b7c1f8
--- /dev/null
+++ b/test/completion/yum.exp
@@ -0,0 +1 @@
+assert_source_completions yum
diff --git a/test/config/bashrc b/test/config/bashrc
new file mode 100644
index 00000000..ddf06339
--- /dev/null
+++ b/test/config/bashrc
@@ -0,0 +1,42 @@
+# bashrc file for DejaGnu testsuite
+
+ # Use emacs key bindings
+set -o emacs
+ # Use bash strict mode
+set -o posix
+ # Unset `command_not_found_handle' as defined on Debian/Ubuntu, because this
+ # troubles and slows down testing
+unset -f command_not_found_handle
+ # Set prompt to ignore current root directory; display path starting
+ # from here. E.g. prompt: /fixtures/@
+TESTDIR=$(pwd)
+export PS1='$(wd=$(pwd); echo ${wd#$TESTDIR}/)@'
+export PS2='> '
+ # Configure readline
+export INPUTRC=$TESTDIR/config/inputrc
+ # When not running via cron, avoid escape junk at beginning of line from
+ # readline, see e.g. http://bugs.gentoo.org/246091
+[ "$CRON" ] || export TERM=dummy
+ # Ensure enough columns so expect doesn't have to care about line breaks
+stty columns 150
+ # Also test completions of system administrator commands, which are
+ # installed via the same PATH expansion in `bash_completion.have()'
+export PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin
+
+ # Make sure default settings are in effect
+unset -v \
+ COMP_CONFIGURE_HINTS \
+ COMP_CVS_REMOTE \
+ COMP_KNOWN_HOSTS_WITH_HOSTFILE \
+ COMP_TAR_INTERNAL_PATHS
+
+ # Load bash testsuite helper functions
+. lib/library.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/test/config/default.exp b/test/config/default.exp
new file mode 100644
index 00000000..d1c04e71
--- /dev/null
+++ b/test/config/default.exp
@@ -0,0 +1,23 @@
+ # Set default expect fallback routines
+expect_after {
+ eof {
+ if {[info exists test]} {
+ fail "$test at eof"
+ } else {
+ fail "[info level 1] at eof"
+ }; # if
+ }; # eof
+ timeout {
+ if {[info exists test]} {
+ fail "$test at timeout"
+ } else {
+ fail "[info level 1] at timeout"
+ }; # if
+ }; # timeout
+}; # expect_after()
+
+
+ # Call tool_start(), if available
+if { [info procs "${tool}_start"] != "" } {
+ ${tool}_start
+}; # if
diff --git a/test/config/inputrc b/test/config/inputrc
new file mode 100644
index 00000000..33134da6
--- /dev/null
+++ b/test/config/inputrc
@@ -0,0 +1,21 @@
+# Readline init file for DejaGnu testsuite
+# See: info readline
+
+ # Press TAB once (instead of twice) to auto-complete
+set show-all-if-ambiguous on
+ # No bell. No ^G in output
+set bell-style none
+ # Don't query user about viewing the number of possible completions
+set completion-query-items -1
+ # Display completions sorted horizontally, not vertically
+set print-completions-horizontally on
+ # Don't use pager when showing completions
+set page-completions off
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/test/fixtures/_filedir/a b/i b/test/fixtures/_filedir/a b/i
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/_filedir/a b/i
diff --git a/test/fixtures/_filedir/a"b/d b/test/fixtures/_filedir/a"b/d
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/_filedir/a"b/d
diff --git a/test/fixtures/_filedir/a$b/h b/test/fixtures/_filedir/a$b/h
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/_filedir/a$b/h
diff --git a/test/fixtures/_filedir/a&b/f b/test/fixtures/_filedir/a&b/f
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/_filedir/a&b/f
diff --git a/test/fixtures/_filedir/a'b/c b/test/fixtures/_filedir/a'b/c
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/_filedir/a'b/c
diff --git a/test/fixtures/_filedir/ab/e b/test/fixtures/_filedir/ab/e
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/_filedir/ab/e
diff --git a/test/fixtures/_filedir/aé/g b/test/fixtures/_filedir/aé/g
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/_filedir/aé/g
diff --git a/test/fixtures/_filedir/ext/ee.e1 b/test/fixtures/_filedir/ext/ee.e1
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/_filedir/ext/ee.e1
diff --git a/test/fixtures/_filedir/ext/ff.e2 b/test/fixtures/_filedir/ext/ff.e2
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/_filedir/ext/ff.e2
diff --git a/test/fixtures/_filedir/ext/foo/.gitignore b/test/fixtures/_filedir/ext/foo/.gitignore
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/_filedir/ext/foo/.gitignore
diff --git a/test/fixtures/_filedir/ext/gg.e1 b/test/fixtures/_filedir/ext/gg.e1
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/_filedir/ext/gg.e1
diff --git a/test/fixtures/_filedir/ext/hh.e2 b/test/fixtures/_filedir/ext/hh.e2
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/_filedir/ext/hh.e2
diff --git a/test/fixtures/_known_hosts_real/config b/test/fixtures/_known_hosts_real/config
new file mode 100644
index 00000000..77770ffe
--- /dev/null
+++ b/test/fixtures/_known_hosts_real/config
@@ -0,0 +1,6 @@
+ UserKnownHostsFile fixtures/_known_hosts_real/known_hosts
+
+ # Unindented
+Host gee jar
+ # Indented
+ Host hus # With comment
diff --git a/test/fixtures/_known_hosts_real/config_tilde b/test/fixtures/_known_hosts_real/config_tilde
new file mode 100644
index 00000000..1068e299
--- /dev/null
+++ b/test/fixtures/_known_hosts_real/config_tilde
@@ -0,0 +1,4 @@
+# With quotes and tilde
+UserKnownHostsFile "~/fixtures/_known_hosts_real/known_hosts2"
+# Without quotes, with tilde
+UserKnownHostsFile ~/fixtures/_known_hosts_real/known_hosts3
diff --git a/test/fixtures/_known_hosts_real/known_hosts b/test/fixtures/_known_hosts_real/known_hosts
new file mode 100644
index 00000000..bf39e848
--- /dev/null
+++ b/test/fixtures/_known_hosts_real/known_hosts
@@ -0,0 +1,6 @@
+|1|abc
+|1|def
+doo
+ike ssh-rsa qwerty1234/Qwerty+1234==
+jub,10.0.0.1
+kyl,100.0.0.2
diff --git a/test/fixtures/_known_hosts_real/known_hosts2 b/test/fixtures/_known_hosts_real/known_hosts2
new file mode 100644
index 00000000..f719efd4
--- /dev/null
+++ b/test/fixtures/_known_hosts_real/known_hosts2
@@ -0,0 +1 @@
+two
diff --git a/test/fixtures/_known_hosts_real/known_hosts3 b/test/fixtures/_known_hosts_real/known_hosts3
new file mode 100644
index 00000000..2bdf67ab
--- /dev/null
+++ b/test/fixtures/_known_hosts_real/known_hosts3
@@ -0,0 +1 @@
+three
diff --git a/test/fixtures/_known_hosts_real/spaced conf b/test/fixtures/_known_hosts_real/spaced conf
new file mode 100644
index 00000000..f484f0e3
--- /dev/null
+++ b/test/fixtures/_known_hosts_real/spaced conf
@@ -0,0 +1,9 @@
+
+ # Unindented
+Host gee
+ UserKnownHostsFile "fixtures/_known_hosts_real/spaced known_hosts"
+
+ # Indented
+ Host hus # With comment
+ UserKnownHostsFile "fixtures/_known_hosts_real/known_hosts2"
+
diff --git a/test/fixtures/_known_hosts_real/spaced known_hosts b/test/fixtures/_known_hosts_real/spaced known_hosts
new file mode 100644
index 00000000..d54a04d0
--- /dev/null
+++ b/test/fixtures/_known_hosts_real/spaced known_hosts
@@ -0,0 +1,4 @@
+|1|abc
+|1|def
+doo
+ike ssh-rsa qwerty1234/Qwerty+1234==
diff --git a/test/fixtures/compgen/a'b/c b/test/fixtures/compgen/a'b/c
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/compgen/a'b/c
diff --git a/test/fixtures/compgen/t1.txt b/test/fixtures/compgen/t1.txt
new file mode 100644
index 00000000..322a14d8
--- /dev/null
+++ b/test/fixtures/compgen/t1.txt
@@ -0,0 +1,121 @@
+BASH=/bin/bash
+BASH_ARGC=()
+BASH_ARGV=()
+BASH_LINENO=()
+BASH_SOURCE=()
+BASH_VERSINFO=([0]="3" [1]="2" [2]="39" [3]="1" [4]="release" [5]="i486-pc-linux-gnu")
+BASH_VERSION='3.2.39(1)-release'
+CDPL_DIRS=([0]="/home/freddy/proj")
+CDPM_DIRS=
+CDP_DIRS=([0]="/home/freddy/proj" [1]="")
+COLUMNS=130
+COMP_CACHE=/home/freddy/.bash_completion_lib.d/cache~
+COMP_DIR=/etc/bash_completion_lib
+COMP_PATH=/home/freddy/.bash_completion_lib.d:/etc/bash_completion_lib
+COMP_RESTRICT_BY_EXTENSION=0
+COMP_VERSION=bash_completion_lib-1.3.1
+DIRSTACK=()
+EDITOR=/usr/bin/vim
+EUID=1000
+GPGKEY=10A575C3
+GPG_AGENT_INFO=/tmp/gpg-Pg6JXR/S.gpg-agent:4129:1
+GPG_TTY=/dev/pts/0
+GREP_OPTIONS='--exclude '\''distrib/*'\'' --exclude tags'
+GROUPS=()
+HISTCONTROL=ignoreboth
+HISTFILE=/home/freddy/.bash_history
+HISTFILESIZE=500
+HISTIGNORE=exit
+HISTSIZE=500
+HOME=/home/freddy
+HOSTNAME=blondy
+HOSTTYPE=i486
+IFS=$' \t\n'
+LANG=en_US
+LANGUAGE=en_NL:en_US:en_GB:en
+LINES=49
+LOGNAME=freddy
+MACHTYPE=i486-pc-linux-gnu
+MAIL=/var/mail/freddy
+MAILCHECK=60
+OLDPWD=/home/freddy/.bash_completion_lib.d
+OPTERR=1
+OPTIND=1
+OSTYPE=linux-gnu
+PATH=/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games:/home/freddy/proj/rc/bin
+PIPESTATUS=([0]="0")
+PPID=29352
+PS1=$'\\[\E[0;34m\\]\\!\\[\E[0m\\]\\[\E[1;32m\\]$(stoppedjobs)\\[\E[0m\\]:\\u@\\h:\\w> \\[\E[m\\]'
+PS2='> '
+PS4='+ '
+PWD=/home/freddy/proj/bashCompletion/bash-completion.git/test/fixtures/compgen
+SHELL=/bin/bash
+SHELLOPTS=braceexpand:hashall:histexpand:interactive-comments:monitor:vi
+SHLVL=1
+SSH_AUTH_SOCK=/tmp/ssh-xhQbo29352/agent.29352
+SSH_CLIENT='192.168.123.143 37670 4822'
+SSH_CONNECTION='192.168.123.143 37670 192.168.123.8 4822'
+SSH_TTY=/dev/pts/0
+TERM=xterm
+UID=1000
+USER=freddy
+VIM=/home/freddy/.vim
+VIMRUNTIME=/usr/share/vim/vimcurrent
+_=GPG_AGENT_INFO
+bash205='3.2.39(1)-release'
+bash205b='3.2.39(1)-release'
+bash3='3.2.39(1)-release'
+cdots ()
+{
+ [ -d "$1$2" ] && cd "$1$2" || eval cd "$1$2"
+}
+comp_load ()
+{
+ local cmd=${COMP_WORDS[0]} dir globs OLDIFS=$IFS;
+ IFS=:;
+ local -a aPaths=($COMP_PATH);
+ IFS='
+';
+ globs=($(
+ for dir in "${aPaths[@]}"; do
+ echo \"$dir\"/complete\*/\*.$cmd
+ echo \"$dir\"/complete\*/$cmd\!
+ echo \"$dir\"/complete\*/$cmd
+ done
+ ));
+ IFS=$OLDIFS;
+ if ! declare -F comp_include >&/dev/null; then
+ for dir in "${aPaths[@]}";
+ do
+ [ -r "$dir/include/comp_include" ] && . "$dir/include/comp_include" && break;
+ done;
+ fi;
+ comp_include comp_load_init;
+ comp_load_init;
+ local script="$(eval find "${globs[@]}" 2> /dev/null | head -1)";
+ local link comp=${script##*/};
+ [[ ${comp: -1:1} == ! ]] || {
+ link=${comp#*.};
+ comp=${comp%.$link}
+ };
+ local path=${script%/*};
+ [ "$script" -a -r "$path/$comp" ] && . "$path/$comp" && declare -F _$comp >&/dev/null && {
+ [ ${COMP_INSTALL:-1} -eq 0 ] || _comp_install $comp "$path"
+ } && _$comp $link;
+ comp_load_deinit
+}
+nameTerminal ()
+{
+ [ "${TERM:0:5}" = "xterm" ] && local ansiNrTab=0;
+ [ "$TERM" = "rxvt" ] && local ansiNrTab=61;
+ [ "$TERM" = "konsole" ] && local ansiNrTab=30 ansiNrWindow=0;
+ [ $ansiNrTab ] && echo -n ''"]$ansiNrTab;$1"'';
+ [ $ansiNrWindow -a "$2" ] && echo -n ''"]$ansiNrWindow;$2"''
+}
+stoppedjobs ()
+{
+ if [ "$(jobs -s)" ]; then
+ echo -n "%";
+ jobs -s | wc -l;
+ fi
+}
diff --git a/test/fixtures/compgen/t2.txt b/test/fixtures/compgen/t2.txt
new file mode 100644
index 00000000..371ab2b1
--- /dev/null
+++ b/test/fixtures/compgen/t2.txt
@@ -0,0 +1,121 @@
+BASH=/bin/bash
+BASH_ARGC=()
+BASH_ARGV=()
+BASH_LINENO=()
+BASH_SOURCE=()
+BASH_VERSINFO=([0]="3" [1]="2" [2]="39" [3]="1" [4]="release" [5]="i486-pc-linux-gnu")
+BASH_VERSION='3.2.39(1)-release'
+CDPL_DIRS=([0]="/home/freddy/proj")
+CDPM_DIRS=
+CDP_DIRS=([0]="/home/freddy/proj" [1]="")
+COLUMNS=130
+COMP_CACHE=/home/freddy/.bash_completion_lib.d/cache~
+COMP_DIR=/etc/bash_completion_lib
+COMP_PATH=/home/freddy/.bash_completion_lib.d:/etc/bash_completion_lib
+COMP_RESTRICT_BY_EXTENSION=0
+COMP_VERSION=bash_completion_lib-1.3.1
+DIRSTACK=()
+EDITOR=/usr/bin/vim
+EUID=1000
+GPGKEY=10A575C3
+GPG_AGENT_INFO=/tmp/gpg-Pg6JXR/S.gpg-agent:4129:1
+GPG_TTY=/dev/pts/0
+GREP_OPTIONS='--exclude '\''distrib/*'\'' --exclude tags'
+GROUPS=()
+HISTCONTROL=ignoreboth
+HISTFILE=/home/freddy/.bash_history
+HISTFILESIZE=500
+HISTIGNORE=exit
+HISTSIZE=500
+HOME=/home/freddy
+HOSTNAME=blondy
+HOSTTYPE=i486
+IFS=$' \t\n'
+LANG=en_US
+LANGUAGE=en_NL:en_US:en_GB:en
+LINES=49
+LOGNAME=freddy
+MACHTYPE=i486-pc-linux-gnu
+MAIL=/var/mail/freddy
+MAILCHECK=60
+OLDPWD=/home/freddy/.bash_completion_lib.d
+OPTERR=1
+OPTIND=1
+OSTYPE=linux-gnu
+PATH=/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games:/home/freddy/proj/rc/bin
+PIPESTATUS=([0]="0")
+PPID=29352
+PS1=$'\\[\E[0;34m\\]\\!\\[\E[0m\\]\\[\E[1;32m\\]$(stoppedjobs)\\[\E[0m\\]:\\u@\\h:\\w> \\[\E[m\\]'
+PS2='> '
+PS4='+ '
+PWD=/home/freddy/proj/bashCompletion/bash-completion.git/test/fixtures/compgen
+SHELL=/bin/bash
+SHELLOPTS=braceexpand:hashall:histexpand:interactive-comments:monitor:vi
+SHLVL=1
+SSH_AUTH_SOCK=/tmp/ssh-xhQbo29352/agent.29352
+SSH_CLIENT='192.168.123.143 37670 4822'
+SSH_CONNECTION='192.168.123.143 37670 192.168.123.8 4822'
+SSH_TTY=/dev/pts/0
+TERM=xterm
+UID=1000
+USER=freddy
+VIM=/home/freddy/.vim
+VIMRUNTIME=/usr/share/vim/vimcurrent
+_='a\\\'\''b/'
+bash205='3.2.39(1)-release'
+bash205b='3.2.39(1)-release'
+bash3='3.2.39(1)-release'
+cdots ()
+{
+ [ -d "$1$2" ] && cd "$1$2" || eval cd "$1$2"
+}
+comp_load ()
+{
+ local cmd=${COMP_WORDS[0]} dir globs OLDIFS=$IFS;
+ IFS=:;
+ local -a aPaths=($COMP_PATH);
+ IFS='
+';
+ globs=($(
+ for dir in "${aPaths[@]}"; do
+ echo \"$dir\"/complete\*/\*.$cmd
+ echo \"$dir\"/complete\*/$cmd\!
+ echo \"$dir\"/complete\*/$cmd
+ done
+ ));
+ IFS=$OLDIFS;
+ if ! declare -F comp_include >&/dev/null; then
+ for dir in "${aPaths[@]}";
+ do
+ [ -r "$dir/include/comp_include" ] && . "$dir/include/comp_include" && break;
+ done;
+ fi;
+ comp_include comp_load_init;
+ comp_load_init;
+ local script="$(eval find "${globs[@]}" 2> /dev/null | head -1)";
+ local link comp=${script##*/};
+ [[ ${comp: -1:1} == ! ]] || {
+ link=${comp#*.};
+ comp=${comp%.$link}
+ };
+ local path=${script%/*};
+ [ "$script" -a -r "$path/$comp" ] && . "$path/$comp" && declare -F _$comp >&/dev/null && {
+ [ ${COMP_INSTALL:-1} -eq 0 ] || _comp_install $comp "$path"
+ } && _$comp $link;
+ comp_load_deinit
+}
+nameTerminal ()
+{
+ [ "${TERM:0:5}" = "xterm" ] && local ansiNrTab=0;
+ [ "$TERM" = "rxvt" ] && local ansiNrTab=61;
+ [ "$TERM" = "konsole" ] && local ansiNrTab=30 ansiNrWindow=0;
+ [ $ansiNrTab ] && echo -n ''"]$ansiNrTab;$1"'';
+ [ $ansiNrWindow -a "$2" ] && echo -n ''"]$ansiNrWindow;$2"''
+}
+stoppedjobs ()
+{
+ if [ "$(jobs -s)" ]; then
+ echo -n "%";
+ jobs -s | wc -l;
+ fi
+}
diff --git a/test/fixtures/compgen/t3.txt b/test/fixtures/compgen/t3.txt
new file mode 100644
index 00000000..371ab2b1
--- /dev/null
+++ b/test/fixtures/compgen/t3.txt
@@ -0,0 +1,121 @@
+BASH=/bin/bash
+BASH_ARGC=()
+BASH_ARGV=()
+BASH_LINENO=()
+BASH_SOURCE=()
+BASH_VERSINFO=([0]="3" [1]="2" [2]="39" [3]="1" [4]="release" [5]="i486-pc-linux-gnu")
+BASH_VERSION='3.2.39(1)-release'
+CDPL_DIRS=([0]="/home/freddy/proj")
+CDPM_DIRS=
+CDP_DIRS=([0]="/home/freddy/proj" [1]="")
+COLUMNS=130
+COMP_CACHE=/home/freddy/.bash_completion_lib.d/cache~
+COMP_DIR=/etc/bash_completion_lib
+COMP_PATH=/home/freddy/.bash_completion_lib.d:/etc/bash_completion_lib
+COMP_RESTRICT_BY_EXTENSION=0
+COMP_VERSION=bash_completion_lib-1.3.1
+DIRSTACK=()
+EDITOR=/usr/bin/vim
+EUID=1000
+GPGKEY=10A575C3
+GPG_AGENT_INFO=/tmp/gpg-Pg6JXR/S.gpg-agent:4129:1
+GPG_TTY=/dev/pts/0
+GREP_OPTIONS='--exclude '\''distrib/*'\'' --exclude tags'
+GROUPS=()
+HISTCONTROL=ignoreboth
+HISTFILE=/home/freddy/.bash_history
+HISTFILESIZE=500
+HISTIGNORE=exit
+HISTSIZE=500
+HOME=/home/freddy
+HOSTNAME=blondy
+HOSTTYPE=i486
+IFS=$' \t\n'
+LANG=en_US
+LANGUAGE=en_NL:en_US:en_GB:en
+LINES=49
+LOGNAME=freddy
+MACHTYPE=i486-pc-linux-gnu
+MAIL=/var/mail/freddy
+MAILCHECK=60
+OLDPWD=/home/freddy/.bash_completion_lib.d
+OPTERR=1
+OPTIND=1
+OSTYPE=linux-gnu
+PATH=/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games:/home/freddy/proj/rc/bin
+PIPESTATUS=([0]="0")
+PPID=29352
+PS1=$'\\[\E[0;34m\\]\\!\\[\E[0m\\]\\[\E[1;32m\\]$(stoppedjobs)\\[\E[0m\\]:\\u@\\h:\\w> \\[\E[m\\]'
+PS2='> '
+PS4='+ '
+PWD=/home/freddy/proj/bashCompletion/bash-completion.git/test/fixtures/compgen
+SHELL=/bin/bash
+SHELLOPTS=braceexpand:hashall:histexpand:interactive-comments:monitor:vi
+SHLVL=1
+SSH_AUTH_SOCK=/tmp/ssh-xhQbo29352/agent.29352
+SSH_CLIENT='192.168.123.143 37670 4822'
+SSH_CONNECTION='192.168.123.143 37670 192.168.123.8 4822'
+SSH_TTY=/dev/pts/0
+TERM=xterm
+UID=1000
+USER=freddy
+VIM=/home/freddy/.vim
+VIMRUNTIME=/usr/share/vim/vimcurrent
+_='a\\\'\''b/'
+bash205='3.2.39(1)-release'
+bash205b='3.2.39(1)-release'
+bash3='3.2.39(1)-release'
+cdots ()
+{
+ [ -d "$1$2" ] && cd "$1$2" || eval cd "$1$2"
+}
+comp_load ()
+{
+ local cmd=${COMP_WORDS[0]} dir globs OLDIFS=$IFS;
+ IFS=:;
+ local -a aPaths=($COMP_PATH);
+ IFS='
+';
+ globs=($(
+ for dir in "${aPaths[@]}"; do
+ echo \"$dir\"/complete\*/\*.$cmd
+ echo \"$dir\"/complete\*/$cmd\!
+ echo \"$dir\"/complete\*/$cmd
+ done
+ ));
+ IFS=$OLDIFS;
+ if ! declare -F comp_include >&/dev/null; then
+ for dir in "${aPaths[@]}";
+ do
+ [ -r "$dir/include/comp_include" ] && . "$dir/include/comp_include" && break;
+ done;
+ fi;
+ comp_include comp_load_init;
+ comp_load_init;
+ local script="$(eval find "${globs[@]}" 2> /dev/null | head -1)";
+ local link comp=${script##*/};
+ [[ ${comp: -1:1} == ! ]] || {
+ link=${comp#*.};
+ comp=${comp%.$link}
+ };
+ local path=${script%/*};
+ [ "$script" -a -r "$path/$comp" ] && . "$path/$comp" && declare -F _$comp >&/dev/null && {
+ [ ${COMP_INSTALL:-1} -eq 0 ] || _comp_install $comp "$path"
+ } && _$comp $link;
+ comp_load_deinit
+}
+nameTerminal ()
+{
+ [ "${TERM:0:5}" = "xterm" ] && local ansiNrTab=0;
+ [ "$TERM" = "rxvt" ] && local ansiNrTab=61;
+ [ "$TERM" = "konsole" ] && local ansiNrTab=30 ansiNrWindow=0;
+ [ $ansiNrTab ] && echo -n ''"]$ansiNrTab;$1"'';
+ [ $ansiNrWindow -a "$2" ] && echo -n ''"]$ansiNrWindow;$2"''
+}
+stoppedjobs ()
+{
+ if [ "$(jobs -s)" ]; then
+ echo -n "%";
+ jobs -s | wc -l;
+ fi
+}
diff --git a/test/fixtures/cvs/.cvspass b/test/fixtures/cvs/.cvspass
new file mode 100644
index 00000000..e7e0dce7
--- /dev/null
+++ b/test/fixtures/cvs/.cvspass
@@ -0,0 +1,2 @@
+/1 :pserver:anonymous@cvs.savannah.nongnu.org:2401/sources/cvs A
+/1 :pserver:anonymous@cvs.fedoraproject.org:2401/cvs/pkgs A
diff --git a/test/fixtures/evince/.BMP b/test/fixtures/evince/.BMP
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.BMP
diff --git a/test/fixtures/evince/.CBR b/test/fixtures/evince/.CBR
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.CBR
diff --git a/test/fixtures/evince/.CBZ b/test/fixtures/evince/.CBZ
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.CBZ
diff --git a/test/fixtures/evince/.DJV b/test/fixtures/evince/.DJV
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.DJV
diff --git a/test/fixtures/evince/.DJVU b/test/fixtures/evince/.DJVU
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.DJVU
diff --git a/test/fixtures/evince/.DVI b/test/fixtures/evince/.DVI
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.DVI
diff --git a/test/fixtures/evince/.DVI.BZ2 b/test/fixtures/evince/.DVI.BZ2
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.DVI.BZ2
diff --git a/test/fixtures/evince/.DVI.GZ b/test/fixtures/evince/.DVI.GZ
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.DVI.GZ
diff --git a/test/fixtures/evince/.DVI.bz2 b/test/fixtures/evince/.DVI.bz2
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.DVI.bz2
diff --git a/test/fixtures/evince/.DVI.gz b/test/fixtures/evince/.DVI.gz
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.DVI.gz
diff --git a/test/fixtures/evince/.EPS b/test/fixtures/evince/.EPS
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.EPS
diff --git a/test/fixtures/evince/.EPS.BZ2 b/test/fixtures/evince/.EPS.BZ2
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.EPS.BZ2
diff --git a/test/fixtures/evince/.EPS.GZ b/test/fixtures/evince/.EPS.GZ
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.EPS.GZ
diff --git a/test/fixtures/evince/.EPS.bz2 b/test/fixtures/evince/.EPS.bz2
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.EPS.bz2
diff --git a/test/fixtures/evince/.EPS.gz b/test/fixtures/evince/.EPS.gz
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.EPS.gz
diff --git a/test/fixtures/evince/.GIF b/test/fixtures/evince/.GIF
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.GIF
diff --git a/test/fixtures/evince/.ICO b/test/fixtures/evince/.ICO
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.ICO
diff --git a/test/fixtures/evince/.JPEG b/test/fixtures/evince/.JPEG
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.JPEG
diff --git a/test/fixtures/evince/.JPG b/test/fixtures/evince/.JPG
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.JPG
diff --git a/test/fixtures/evince/.MIFF b/test/fixtures/evince/.MIFF
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.MIFF
diff --git a/test/fixtures/evince/.PBM b/test/fixtures/evince/.PBM
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.PBM
diff --git a/test/fixtures/evince/.PCX b/test/fixtures/evince/.PCX
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.PCX
diff --git a/test/fixtures/evince/.PDF b/test/fixtures/evince/.PDF
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.PDF
diff --git a/test/fixtures/evince/.PDF.BZ2 b/test/fixtures/evince/.PDF.BZ2
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.PDF.BZ2
diff --git a/test/fixtures/evince/.PDF.GZ b/test/fixtures/evince/.PDF.GZ
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.PDF.GZ
diff --git a/test/fixtures/evince/.PDF.bz2 b/test/fixtures/evince/.PDF.bz2
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.PDF.bz2
diff --git a/test/fixtures/evince/.PDF.gz b/test/fixtures/evince/.PDF.gz
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.PDF.gz
diff --git a/test/fixtures/evince/.PGM b/test/fixtures/evince/.PGM
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.PGM
diff --git a/test/fixtures/evince/.PNG b/test/fixtures/evince/.PNG
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.PNG
diff --git a/test/fixtures/evince/.PNM b/test/fixtures/evince/.PNM
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.PNM
diff --git a/test/fixtures/evince/.PPM b/test/fixtures/evince/.PPM
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.PPM
diff --git a/test/fixtures/evince/.PS b/test/fixtures/evince/.PS
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.PS
diff --git a/test/fixtures/evince/.PS.BZ2 b/test/fixtures/evince/.PS.BZ2
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.PS.BZ2
diff --git a/test/fixtures/evince/.PS.GZ b/test/fixtures/evince/.PS.GZ
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.PS.GZ
diff --git a/test/fixtures/evince/.PS.bz2 b/test/fixtures/evince/.PS.bz2
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.PS.bz2
diff --git a/test/fixtures/evince/.PS.gz b/test/fixtures/evince/.PS.gz
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.PS.gz
diff --git a/test/fixtures/evince/.TGA b/test/fixtures/evince/.TGA
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.TGA
diff --git a/test/fixtures/evince/.TIF b/test/fixtures/evince/.TIF
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.TIF
diff --git a/test/fixtures/evince/.TIFF b/test/fixtures/evince/.TIFF
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.TIFF
diff --git a/test/fixtures/evince/.XPM b/test/fixtures/evince/.XPM
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.XPM
diff --git a/test/fixtures/evince/.XWD b/test/fixtures/evince/.XWD
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.XWD
diff --git a/test/fixtures/evince/.bmp b/test/fixtures/evince/.bmp
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.bmp
diff --git a/test/fixtures/evince/.cbr b/test/fixtures/evince/.cbr
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.cbr
diff --git a/test/fixtures/evince/.cbz b/test/fixtures/evince/.cbz
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.cbz
diff --git a/test/fixtures/evince/.djv b/test/fixtures/evince/.djv
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.djv
diff --git a/test/fixtures/evince/.djvu b/test/fixtures/evince/.djvu
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.djvu
diff --git a/test/fixtures/evince/.dvi b/test/fixtures/evince/.dvi
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.dvi
diff --git a/test/fixtures/evince/.dvi.BZ2 b/test/fixtures/evince/.dvi.BZ2
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.dvi.BZ2
diff --git a/test/fixtures/evince/.dvi.GZ b/test/fixtures/evince/.dvi.GZ
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.dvi.GZ
diff --git a/test/fixtures/evince/.dvi.bz2 b/test/fixtures/evince/.dvi.bz2
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.dvi.bz2
diff --git a/test/fixtures/evince/.dvi.gz b/test/fixtures/evince/.dvi.gz
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.dvi.gz
diff --git a/test/fixtures/evince/.eps b/test/fixtures/evince/.eps
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.eps
diff --git a/test/fixtures/evince/.eps.BZ2 b/test/fixtures/evince/.eps.BZ2
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.eps.BZ2
diff --git a/test/fixtures/evince/.eps.GZ b/test/fixtures/evince/.eps.GZ
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.eps.GZ
diff --git a/test/fixtures/evince/.eps.bz2 b/test/fixtures/evince/.eps.bz2
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.eps.bz2
diff --git a/test/fixtures/evince/.eps.gz b/test/fixtures/evince/.eps.gz
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.eps.gz
diff --git a/test/fixtures/evince/.gif b/test/fixtures/evince/.gif
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.gif
diff --git a/test/fixtures/evince/.ico b/test/fixtures/evince/.ico
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.ico
diff --git a/test/fixtures/evince/.jpeg b/test/fixtures/evince/.jpeg
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.jpeg
diff --git a/test/fixtures/evince/.jpg b/test/fixtures/evince/.jpg
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.jpg
diff --git a/test/fixtures/evince/.miff b/test/fixtures/evince/.miff
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.miff
diff --git a/test/fixtures/evince/.pbm b/test/fixtures/evince/.pbm
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.pbm
diff --git a/test/fixtures/evince/.pcx b/test/fixtures/evince/.pcx
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.pcx
diff --git a/test/fixtures/evince/.pdf b/test/fixtures/evince/.pdf
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.pdf
diff --git a/test/fixtures/evince/.pdf.BZ2 b/test/fixtures/evince/.pdf.BZ2
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.pdf.BZ2
diff --git a/test/fixtures/evince/.pdf.GZ b/test/fixtures/evince/.pdf.GZ
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.pdf.GZ
diff --git a/test/fixtures/evince/.pdf.bz2 b/test/fixtures/evince/.pdf.bz2
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.pdf.bz2
diff --git a/test/fixtures/evince/.pdf.gz b/test/fixtures/evince/.pdf.gz
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.pdf.gz
diff --git a/test/fixtures/evince/.pgm b/test/fixtures/evince/.pgm
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.pgm
diff --git a/test/fixtures/evince/.png b/test/fixtures/evince/.png
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.png
diff --git a/test/fixtures/evince/.pnm b/test/fixtures/evince/.pnm
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.pnm
diff --git a/test/fixtures/evince/.ppm b/test/fixtures/evince/.ppm
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.ppm
diff --git a/test/fixtures/evince/.ps b/test/fixtures/evince/.ps
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.ps
diff --git a/test/fixtures/evince/.ps.BZ2 b/test/fixtures/evince/.ps.BZ2
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.ps.BZ2
diff --git a/test/fixtures/evince/.ps.GZ b/test/fixtures/evince/.ps.GZ
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.ps.GZ
diff --git a/test/fixtures/evince/.ps.bz2 b/test/fixtures/evince/.ps.bz2
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.ps.bz2
diff --git a/test/fixtures/evince/.ps.gz b/test/fixtures/evince/.ps.gz
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.ps.gz
diff --git a/test/fixtures/evince/.tga b/test/fixtures/evince/.tga
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.tga
diff --git a/test/fixtures/evince/.tif b/test/fixtures/evince/.tif
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.tif
diff --git a/test/fixtures/evince/.tiff b/test/fixtures/evince/.tiff
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.tiff
diff --git a/test/fixtures/evince/.txt b/test/fixtures/evince/.txt
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.txt
diff --git a/test/fixtures/evince/.xpm b/test/fixtures/evince/.xpm
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.xpm
diff --git a/test/fixtures/evince/.xwd b/test/fixtures/evince/.xwd
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/.xwd
diff --git a/test/fixtures/evince/foo/.gitignore b/test/fixtures/evince/foo/.gitignore
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/evince/foo/.gitignore
diff --git a/test/fixtures/isql/odbc.ini b/test/fixtures/isql/odbc.ini
new file mode 100644
index 00000000..96319f3b
--- /dev/null
+++ b/test/fixtures/isql/odbc.ini
@@ -0,0 +1,3 @@
+[foo]
+
+[bar]
diff --git a/test/fixtures/java/a/b$c.class b/test/fixtures/java/a/b$c.class
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/java/a/b$c.class
diff --git a/test/fixtures/java/a/b.class b/test/fixtures/java/a/b.class
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/java/a/b.class
diff --git a/test/fixtures/java/a/c/README.txt b/test/fixtures/java/a/c/README.txt
new file mode 100644
index 00000000..e5e6d0b3
--- /dev/null
+++ b/test/fixtures/java/a/c/README.txt
@@ -0,0 +1,2 @@
+When CLASSPATH is set to the fixtures/java/a dir, we do *not* expect
+*.class in subdirs to be included in completions, see Debian bug #496828.
diff --git a/test/fixtures/java/a/c/d.class b/test/fixtures/java/a/c/d.class
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/java/a/c/d.class
diff --git a/test/fixtures/java/a/d.txt b/test/fixtures/java/a/d.txt
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/java/a/d.txt
diff --git a/test/fixtures/java/bashcomp.jar b/test/fixtures/java/bashcomp.jar
new file mode 100644
index 00000000..d9c27799
--- /dev/null
+++ b/test/fixtures/java/bashcomp.jar
Binary files differ
diff --git a/test/fixtures/kdvi/.DVI b/test/fixtures/kdvi/.DVI
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/kdvi/.DVI
diff --git a/test/fixtures/kdvi/.DVI.Z b/test/fixtures/kdvi/.DVI.Z
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/kdvi/.DVI.Z
diff --git a/test/fixtures/kdvi/.DVI.bz2 b/test/fixtures/kdvi/.DVI.bz2
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/kdvi/.DVI.bz2
diff --git a/test/fixtures/kdvi/.DVI.gz b/test/fixtures/kdvi/.DVI.gz
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/kdvi/.DVI.gz
diff --git a/test/fixtures/kdvi/.dvi b/test/fixtures/kdvi/.dvi
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/kdvi/.dvi
diff --git a/test/fixtures/kdvi/.dvi.Z b/test/fixtures/kdvi/.dvi.Z
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/kdvi/.dvi.Z
diff --git a/test/fixtures/kdvi/.dvi.bz2 b/test/fixtures/kdvi/.dvi.bz2
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/kdvi/.dvi.bz2
diff --git a/test/fixtures/kdvi/.dvi.gz b/test/fixtures/kdvi/.dvi.gz
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/kdvi/.dvi.gz
diff --git a/test/fixtures/kdvi/.txt b/test/fixtures/kdvi/.txt
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/kdvi/.txt
diff --git a/test/fixtures/kdvi/foo/.gitignore b/test/fixtures/kdvi/foo/.gitignore
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/kdvi/foo/.gitignore
diff --git a/test/fixtures/kpdf/.EPS b/test/fixtures/kpdf/.EPS
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/kpdf/.EPS
diff --git a/test/fixtures/kpdf/.PDF b/test/fixtures/kpdf/.PDF
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/kpdf/.PDF
diff --git a/test/fixtures/kpdf/.PS b/test/fixtures/kpdf/.PS
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/kpdf/.PS
diff --git a/test/fixtures/kpdf/.eps b/test/fixtures/kpdf/.eps
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/kpdf/.eps
diff --git a/test/fixtures/kpdf/.pdf b/test/fixtures/kpdf/.pdf
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/kpdf/.pdf
diff --git a/test/fixtures/kpdf/.ps b/test/fixtures/kpdf/.ps
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/kpdf/.ps
diff --git a/test/fixtures/kpdf/.txt b/test/fixtures/kpdf/.txt
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/kpdf/.txt
diff --git a/test/fixtures/kpdf/foo/.gitignore b/test/fixtures/kpdf/foo/.gitignore
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/kpdf/foo/.gitignore
diff --git a/test/fixtures/lftp/.lftp/bookmarks b/test/fixtures/lftp/.lftp/bookmarks
new file mode 100644
index 00000000..31ec9303
--- /dev/null
+++ b/test/fixtures/lftp/.lftp/bookmarks
@@ -0,0 +1 @@
+lftptest ftp://ftp.funet.fi/
diff --git a/test/fixtures/mount/bin/showmount b/test/fixtures/mount/bin/showmount
new file mode 100755
index 00000000..2751c4ba
--- /dev/null
+++ b/test/fixtures/mount/bin/showmount
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+if [ "$1" = -e ] && [ "$2" = mocksrv ]; then
+ echo "Header line"
+ echo "/test/path"
+ echo "/test/path2"
+ echo "/second/path"
+ exit 0
+fi
+
+echo "Usage: 'showmount -e mocksrv'; nothing else works."
+exit 1
diff --git a/test/fixtures/mount/test-fstab b/test/fixtures/mount/test-fstab
new file mode 100644
index 00000000..b2434173
--- /dev/null
+++ b/test/fixtures/mount/test-fstab
@@ -0,0 +1,24 @@
+proc /proc proc defaults 0 0
+none /debug debugfs defaults,noauto 0 0
+
+# Simple obvious test.
+/mnt/nice-test-path /dev/null auto ro,noauto 0 0
+
+# Test octal escapes
+# Contains ' ' and '-'
+/mnt/nice\040test\055path /dev/null auto ro,noauto 0 0
+# Contains '$' and '-'
+/mnt/nice\044test\055path /dev/null auto ro,noauto 0 0
+# Contains ' ' and '\\'
+/mnt/nice\040test\134path /dev/null auto ro,noauto 0 0
+# Contains '\n' and '\ '
+/mnt/nice\012test\040path /dev/null auto ro,noauto 0 0
+
+# Test apostrophe
+/mnt/nice'test-path /dev/null auto ro,noauto 0 0
+/mnt/other'test\040path /dev/null auto ro,noauto 0 0
+
+# Test some labels
+LABEL=Ubuntu\040Karmic /mnt/ubuntu auto no,noauto 0 0
+LABEL=Fedora /mnt/fedora auto ro,noauto 0 0
+LABEL=Debian-it's\040awesome /mnt/debian auto ro,noauto 0 0
diff --git a/test/fixtures/mutt/bar/.gitignore b/test/fixtures/mutt/bar/.gitignore
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/mutt/bar/.gitignore
diff --git a/test/fixtures/mutt/foo/.gitignore b/test/fixtures/mutt/foo/.gitignore
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/mutt/foo/.gitignore
diff --git a/test/fixtures/mutt/muttrc b/test/fixtures/mutt/muttrc
new file mode 100644
index 00000000..58ad7f55
--- /dev/null
+++ b/test/fixtures/mutt/muttrc
@@ -0,0 +1,3 @@
+set folder=.
+alias a1 a1@example.com
+alias a2 a2@example.com
diff --git a/test/fixtures/pkgtools/db/a-1.0,1/.gitignore b/test/fixtures/pkgtools/db/a-1.0,1/.gitignore
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/pkgtools/db/a-1.0,1/.gitignore
diff --git a/test/fixtures/pkgtools/db/b-c-d-2.0_2/.gitignore b/test/fixtures/pkgtools/db/b-c-d-2.0_2/.gitignore
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/pkgtools/db/b-c-d-2.0_2/.gitignore
diff --git a/test/fixtures/pkgtools/ports/.gitignore b/test/fixtures/pkgtools/ports/.gitignore
new file mode 100644
index 00000000..71d2c0c0
--- /dev/null
+++ b/test/fixtures/pkgtools/ports/.gitignore
@@ -0,0 +1,2 @@
+INDEX
+INDEX-5
diff --git a/test/fixtures/pkgtools/ports/INDEX.dist b/test/fixtures/pkgtools/ports/INDEX.dist
new file mode 100644
index 00000000..76957d4f
--- /dev/null
+++ b/test/fixtures/pkgtools/ports/INDEX.dist
@@ -0,0 +1,3 @@
+bash-3.1.17|PORTSDIR/shells/bash|/usr/local|The GNU Project's Bourne Again SHell|PORTSDIR/shells/bash/pkg-descr|obrien@FreeBSD.org|shells|expat-2.0.0_1 gettext-0.14.5_2 ldconfig_compat-1.0_8 libiconv-1.9.2_2 rc_subr-1.31_1|expat-2.0.0_1 gettext-0.14.5_2 ldconfig_compat-1.0_8 libiconv-1.9.2_2 rc_subr-1.31_1|http://cnswww.cns.cwru.edu/~chet/bash/bashtop.html|||
+bash-completion-20060301_2|PORTSDIR/shells/bash-completion|/usr/local|Programmable completion library for Bash 2.04 and up|PORTSDIR/shells/bash-completion/pkg-descr|kirk@strauser.com|shells||bash-3.1.17 expat-2.0.0_1 gettext-0.14.5_2 ldconfig_compat-1.0_8 libiconv-1.9.2_2 rc_subr-1.31_1|http://www.caliban.org/bash/index.shtml|||
+bash-2.05b.007_6|PORTSDIR/shells/bash2|/usr/local|The GNU Bourne Again Shell|PORTSDIR/shells/bash2/pkg-descr|ports@FreeBSD.org|shells|||http://www.gnu.org/software/bash/|||
diff --git a/test/fixtures/scp/config b/test/fixtures/scp/config
new file mode 100644
index 00000000..fea6620e
--- /dev/null
+++ b/test/fixtures/scp/config
@@ -0,0 +1,6 @@
+UserKnownHostsFile known_hosts
+
+ # Unindented
+Host gee
+ # Indented, multiple hosts
+ HostName hus ike
diff --git a/test/fixtures/scp/known_hosts b/test/fixtures/scp/known_hosts
new file mode 100644
index 00000000..d54a04d0
--- /dev/null
+++ b/test/fixtures/scp/known_hosts
@@ -0,0 +1,4 @@
+|1|abc
+|1|def
+doo
+ike ssh-rsa qwerty1234/Qwerty+1234==
diff --git a/test/fixtures/scp/spaced conf b/test/fixtures/scp/spaced conf
new file mode 100644
index 00000000..7ad64bc8
--- /dev/null
+++ b/test/fixtures/scp/spaced conf
@@ -0,0 +1,6 @@
+ UserKnownHostsFile known_hosts
+
+ # Unindented
+Host gee jar
+ # Indented, multiple hosts
+ HostName hus
diff --git a/test/fixtures/sftp/config b/test/fixtures/sftp/config
new file mode 100644
index 00000000..fea6620e
--- /dev/null
+++ b/test/fixtures/sftp/config
@@ -0,0 +1,6 @@
+UserKnownHostsFile known_hosts
+
+ # Unindented
+Host gee
+ # Indented, multiple hosts
+ HostName hus ike
diff --git a/test/fixtures/sftp/known_hosts b/test/fixtures/sftp/known_hosts
new file mode 100644
index 00000000..d54a04d0
--- /dev/null
+++ b/test/fixtures/sftp/known_hosts
@@ -0,0 +1,4 @@
+|1|abc
+|1|def
+doo
+ike ssh-rsa qwerty1234/Qwerty+1234==
diff --git a/test/fixtures/sftp/spaced conf b/test/fixtures/sftp/spaced conf
new file mode 100644
index 00000000..7ad64bc8
--- /dev/null
+++ b/test/fixtures/sftp/spaced conf
@@ -0,0 +1,6 @@
+ UserKnownHostsFile known_hosts
+
+ # Unindented
+Host gee jar
+ # Indented, multiple hosts
+ HostName hus
diff --git a/test/fixtures/shared/bin/arp b/test/fixtures/shared/bin/arp
new file mode 100755
index 00000000..49f42960
--- /dev/null
+++ b/test/fixtures/shared/bin/arp
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+# Dummy "arp -an" emulator
+
+# Linux
+echo "? (0.0.0.0) at 00:00:00:00:00:00 [ether] on eth0"
+
+# FreeBSD
+echo "? (0.0.0.0) at 11:11:11:11:11:11 on bge0 expires in 5 seconds [ethernet]"
+
+# Solaris
+cat <<EOF
+Device IP Address Mask Flags Phys Addr
+------ -------------------- --------------- -------- ---------------
+ce0 0.0.0.0 255.255.255.255 o 22:22:22:22:22:22
+EOF
diff --git a/test/fixtures/shared/bin/ifconfig b/test/fixtures/shared/bin/ifconfig
new file mode 100755
index 00000000..59c9140b
--- /dev/null
+++ b/test/fixtures/shared/bin/ifconfig
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+# Dummy "ifconfig -a" emulator
+
+cat <<EOF
+eth0 Link encap:Ethernet HWaddr 33:33:33:33:33:33
+ inet addr:192.168.80.11 Bcast:192.168.80.255 Mask:255.255.255.0
+ inet6 addr: fe80::000:0000:0000:0000/64 Scope:Link
+ UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
+ RX packets:855946 errors:42 dropped:0 overruns:0 frame:42
+ TX packets:477196 errors:0 dropped:0 overruns:0 carrier:0
+ collisions:0 txqueuelen:1000
+ RX bytes:1142133425 (1.0 GiB) TX bytes:47621718 (45.4 MiB)
+ Interrupt:23 Base address:0xc000
+
+lo Link encap:Local Loopback
+ inet addr:127.0.0.1 Mask:255.0.0.0
+ inet6 addr: ::1/128 Scope:Host
+ UP LOOPBACK RUNNING MTU:16436 Metric:1
+ RX packets:129059 errors:0 dropped:0 overruns:0 frame:0
+ TX packets:129059 errors:0 dropped:0 overruns:0 carrier:0
+ collisions:0 txqueuelen:0
+ RX bytes:7456154 (7.1 MiB) TX bytes:7456154 (7.1 MiB)
+EOF
diff --git a/test/fixtures/shared/default/bar b/test/fixtures/shared/default/bar
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/shared/default/bar
diff --git a/test/fixtures/shared/default/bar bar.d/foo b/test/fixtures/shared/default/bar bar.d/foo
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/shared/default/bar bar.d/foo
diff --git a/test/fixtures/shared/default/foo b/test/fixtures/shared/default/foo
new file mode 100644
index 00000000..257cc564
--- /dev/null
+++ b/test/fixtures/shared/default/foo
@@ -0,0 +1 @@
+foo
diff --git a/test/fixtures/shared/default/foo.d/foo b/test/fixtures/shared/default/foo.d/foo
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/shared/default/foo.d/foo
diff --git a/test/fixtures/ssh/config b/test/fixtures/ssh/config
new file mode 100644
index 00000000..806f405c
--- /dev/null
+++ b/test/fixtures/ssh/config
@@ -0,0 +1 @@
+UserKnownHostsFile known_hosts
diff --git a/test/fixtures/ssh/known_hosts b/test/fixtures/ssh/known_hosts
new file mode 100644
index 00000000..13b2f0f0
--- /dev/null
+++ b/test/fixtures/ssh/known_hosts
@@ -0,0 +1,5 @@
+|1|abc
+|1|def
+doo
+ike ssh-rsa qwerty1234/Qwerty+1234==
+ls_known_host
diff --git a/test/fixtures/ssh/spaced conf b/test/fixtures/ssh/spaced conf
new file mode 100644
index 00000000..7ad64bc8
--- /dev/null
+++ b/test/fixtures/ssh/spaced conf
@@ -0,0 +1,6 @@
+ UserKnownHostsFile known_hosts
+
+ # Unindented
+Host gee jar
+ # Indented, multiple hosts
+ HostName hus
diff --git a/test/fixtures/xz/a/b b/test/fixtures/xz/a/b
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/xz/a/b
diff --git a/test/fixtures/xz/bashcomp.lzma b/test/fixtures/xz/bashcomp.lzma
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/xz/bashcomp.lzma
diff --git a/test/fixtures/xz/bashcomp.tar b/test/fixtures/xz/bashcomp.tar
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/xz/bashcomp.tar
diff --git a/test/fixtures/xz/bashcomp.tar.xz b/test/fixtures/xz/bashcomp.tar.xz
new file mode 100644
index 00000000..b2274e64
--- /dev/null
+++ b/test/fixtures/xz/bashcomp.tar.xz
Binary files differ
diff --git a/test/fixtures/xz/bashcomp.tlz b/test/fixtures/xz/bashcomp.tlz
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/xz/bashcomp.tlz
diff --git a/test/fixtures/xz/bashcomp.xz b/test/fixtures/xz/bashcomp.xz
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/xz/bashcomp.xz
diff --git a/test/lib/completion.exp b/test/lib/completion.exp
new file mode 100644
index 00000000..ea2a3d8d
--- /dev/null
+++ b/test/lib/completion.exp
@@ -0,0 +1,16 @@
+source ${srcdir}/lib/library.exp
+
+
+proc completion_exit {} {
+ send "\rexit\r"
+}
+
+
+proc completion_start {} {
+ start_interactive_test
+}
+
+
+proc completion_version {} {
+ puts "$::TESTDIR, bash-$::BASH_VERSION"
+}
diff --git a/test/lib/completions/a2ps.exp b/test/lib/completions/a2ps.exp
new file mode 100644
index 00000000..796e14cc
--- /dev/null
+++ b/test/lib/completions/a2ps.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "a2ps "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/abook.exp b/test/lib/completions/abook.exp
new file mode 100644
index 00000000..3f4e301f
--- /dev/null
+++ b/test/lib/completions/abook.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "abook "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/acroread.exp b/test/lib/completions/acroread.exp
new file mode 100644
index 00000000..4f11f905
--- /dev/null
+++ b/test/lib/completions/acroread.exp
@@ -0,0 +1,22 @@
+proc setup {} {
+ save_env
+ assert_bash_exec "touch fixtures/shared/default/t.pdf"; # Create temporary files
+}; # setup()
+
+
+proc teardown {} {
+ assert_bash_exec "rm fixtures/shared/default/t.pdf"; # Remove temporary files
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete {"bar bar.d/" foo.d/ t.pdf} "acroread fixtures/shared/default/"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/add_members.exp b/test/lib/completions/add_members.exp
new file mode 100644
index 00000000..02cd762d
--- /dev/null
+++ b/test/lib/completions/add_members.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "add_members -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/alias.exp b/test/lib/completions/alias.exp
new file mode 100644
index 00000000..e6b88d00
--- /dev/null
+++ b/test/lib/completions/alias.exp
@@ -0,0 +1,43 @@
+proc setup {} {
+ assert_bash_exec "unalias -a"; # Remove all aliases
+ assert_bash_exec "alias foo=bar"
+ assert_bash_exec "alias bar='foo foo'"
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_bash_exec "unalias -a"; # Remove all aliases
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+set test "Tab should complete alias"
+ # Try completion
+set cmd "alias "
+assert_complete {bar foo} $cmd $test
+
+
+sync_after_int
+
+
+set test "Tab should complete alias at cursor position"
+ # Try completion
+set cmd "alias foo"
+append cmd \002\002\002; # \002 = ^B = Move cursor left in bash emacs mode
+send "$cmd\t"
+expect {
+ -re "^alias foo\b\b\b\r\nbar +foo *\r\n/@alias foo\b\b\b$" { pass "$test" }
+ -re "^alias foo\b\b\bfoo=foo\b\b\b$" { fail "$test: Wrong cursor position" }
+ -re /@ { unresolved "$test" }
+ default { unresolved "$test" }
+}; # expect
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/animate.exp b/test/lib/completions/animate.exp
new file mode 100644
index 00000000..26065d25
--- /dev/null
+++ b/test/lib/completions/animate.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "animate "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/ant.exp b/test/lib/completions/ant.exp
new file mode 100644
index 00000000..81294439
--- /dev/null
+++ b/test/lib/completions/ant.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "ant -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/apache2ctl.exp b/test/lib/completions/apache2ctl.exp
new file mode 100644
index 00000000..e63abb16
--- /dev/null
+++ b/test/lib/completions/apache2ctl.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "apache2ctl "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/apt-build.exp b/test/lib/completions/apt-build.exp
new file mode 100644
index 00000000..fd09d0eb
--- /dev/null
+++ b/test/lib/completions/apt-build.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "apt-build "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/apt-cache.exp b/test/lib/completions/apt-cache.exp
new file mode 100644
index 00000000..5336beab
--- /dev/null
+++ b/test/lib/completions/apt-cache.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "apt-cache "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/apt-get.exp b/test/lib/completions/apt-get.exp
new file mode 100644
index 00000000..6bd0f3a2
--- /dev/null
+++ b/test/lib/completions/apt-get.exp
@@ -0,0 +1,22 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+set commands {autoclean autoremove build-dep check clean dist-upgrade
+ dselect-upgrade install purge remove source update upgrade}
+assert_complete $commands "apt-get "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/aptitude.exp b/test/lib/completions/aptitude.exp
new file mode 100644
index 00000000..dde6d26e
--- /dev/null
+++ b/test/lib/completions/aptitude.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "aptitude "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/arch.exp b/test/lib/completions/arch.exp
new file mode 100644
index 00000000..9f7114c4
--- /dev/null
+++ b/test/lib/completions/arch.exp
@@ -0,0 +1,21 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+set options {--wipe -s --start= -e --end= -q --quiet -h --help}
+assert_complete $options "arch -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/arpspoof.exp b/test/lib/completions/arpspoof.exp
new file mode 100644
index 00000000..7db79f50
--- /dev/null
+++ b/test/lib/completions/arpspoof.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "arpspoof -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/aspell.exp b/test/lib/completions/aspell.exp
new file mode 100644
index 00000000..4edeb03b
--- /dev/null
+++ b/test/lib/completions/aspell.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "aspell "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/autoconf.exp b/test/lib/completions/autoconf.exp
new file mode 100644
index 00000000..4a44b651
--- /dev/null
+++ b/test/lib/completions/autoconf.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "autoconf "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/automake.exp b/test/lib/completions/automake.exp
new file mode 100644
index 00000000..cf27364a
--- /dev/null
+++ b/test/lib/completions/automake.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "automake "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/autorpm.exp b/test/lib/completions/autorpm.exp
new file mode 100644
index 00000000..99b743ca
--- /dev/null
+++ b/test/lib/completions/autorpm.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "autorpm "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/awk.exp b/test/lib/completions/awk.exp
new file mode 100644
index 00000000..4288adbf
--- /dev/null
+++ b/test/lib/completions/awk.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "awk "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/bash.exp b/test/lib/completions/bash.exp
new file mode 100644
index 00000000..4caf58fc
--- /dev/null
+++ b/test/lib/completions/bash.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "bash --"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/bc.exp b/test/lib/completions/bc.exp
new file mode 100644
index 00000000..c437d037
--- /dev/null
+++ b/test/lib/completions/bc.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "bc --"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/bison.exp b/test/lib/completions/bison.exp
new file mode 100644
index 00000000..a3dea1e0
--- /dev/null
+++ b/test/lib/completions/bison.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "bison --"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/bk.exp b/test/lib/completions/bk.exp
new file mode 100644
index 00000000..4915136e
--- /dev/null
+++ b/test/lib/completions/bk.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "bk "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/brctl.exp b/test/lib/completions/brctl.exp
new file mode 100644
index 00000000..d87002a2
--- /dev/null
+++ b/test/lib/completions/brctl.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "brctl "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/btdownloadcurses.py.exp b/test/lib/completions/btdownloadcurses.py.exp
new file mode 100644
index 00000000..9dc0ba5a
--- /dev/null
+++ b/test/lib/completions/btdownloadcurses.py.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "btdownloadcurses.py "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/btdownloadgui.py.exp b/test/lib/completions/btdownloadgui.py.exp
new file mode 100644
index 00000000..03897a53
--- /dev/null
+++ b/test/lib/completions/btdownloadgui.py.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "btdownloadgui.py "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/btdownloadheadless.py.exp b/test/lib/completions/btdownloadheadless.py.exp
new file mode 100644
index 00000000..69c62950
--- /dev/null
+++ b/test/lib/completions/btdownloadheadless.py.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "btdownloadheadless.py "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/bzip2.exp b/test/lib/completions/bzip2.exp
new file mode 100644
index 00000000..e5389a2a
--- /dev/null
+++ b/test/lib/completions/bzip2.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "bzip2 "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/c++.exp b/test/lib/completions/c++.exp
new file mode 100644
index 00000000..1fe4bb13
--- /dev/null
+++ b/test/lib/completions/c++.exp
@@ -0,0 +1,21 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+set test "Tab should complete"
+assert_complete_any "c++ "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/cancel.exp b/test/lib/completions/cancel.exp
new file mode 100644
index 00000000..24ca47c4
--- /dev/null
+++ b/test/lib/completions/cancel.exp
@@ -0,0 +1,31 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+ # Adding a print job is successful?
+if {[assert_exec {lp -H hold fixtures/shared/default/foo} job "" "untested"]} {
+ # Yes, adding a print-job is successful;
+ # Retrieve job-id, so we can cancel the job after the test
+ set job_id [lindex [split $job] 3]
+ # Retrieve list of all current print jobs
+ assert_exec {lpstat | cut -d\040 -f1} jobs
+ # Completion should show all print jobs
+ assert_complete $jobs "cancel "
+ # Remove/cancel the test print job
+ assert_exec "cancel $job_id"
+}; # if
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/cardctl.exp b/test/lib/completions/cardctl.exp
new file mode 100644
index 00000000..b5d7e88d
--- /dev/null
+++ b/test/lib/completions/cardctl.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "cardctl "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/cat.exp b/test/lib/completions/cat.exp
new file mode 100644
index 00000000..46e8775f
--- /dev/null
+++ b/test/lib/completions/cat.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "cat "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/cc.exp b/test/lib/completions/cc.exp
new file mode 100644
index 00000000..1d63d006
--- /dev/null
+++ b/test/lib/completions/cc.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "cc "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/cd.exp b/test/lib/completions/cd.exp
new file mode 100644
index 00000000..58233575
--- /dev/null
+++ b/test/lib/completions/cd.exp
@@ -0,0 +1,47 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+set test "Tab should complete"
+assert_complete {"bar bar.d/" foo.d/} "cd fixtures/shared/default/" $test
+
+
+sync_after_int
+
+
+set test "Tab should complete cd at cursor position"
+ # Try completion
+set cmd "cd fixtures/shared/default/foo"
+append cmd \002\002\002; # \002 = ^B = Move cursor left in bash emacs mode
+#append cmd \033\0133D; # Escape-[-D = Cursor left
+send "$cmd\t"
+expect {
+ -re "cd fixtures/shared/default/foo\b\b\b\r\n(\.svn/ +|)bar bar.d/ +foo.d/ *(\.svn/ *|)\r\n/@cd fixtures/shared/default/foo\b\b\b$" { pass "$test" }
+ -re "^cd fixtures/shared/default/foo\b\b\bfoo.d/foo\b\b\b$" { fail "$test: Wrong cursor position" }
+ -re /@ { unresolved "$test at prompt" }
+ default { unresolved "$test" }
+}; # expect
+
+
+sync_after_int
+
+
+set test "Tab should complete CDPATH"
+ # Set CDPATH
+assert_bash_exec "CDPATH=\$PWD";
+assert_complete "fixtures/shared/default/foo.d/" "cd fixtures/shared/default/fo" $test
+sync_after_int
+ # Reset CDPATH
+assert_bash_exec "unset CDPATH"
+
+
+teardown
diff --git a/test/lib/completions/cdrecord.exp b/test/lib/completions/cdrecord.exp
new file mode 100644
index 00000000..d369f79d
--- /dev/null
+++ b/test/lib/completions/cdrecord.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "cdrecord -d"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/change_pw.exp b/test/lib/completions/change_pw.exp
new file mode 100644
index 00000000..ca9bcdbd
--- /dev/null
+++ b/test/lib/completions/change_pw.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "change_pw -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/check_db.exp b/test/lib/completions/check_db.exp
new file mode 100644
index 00000000..ca59a715
--- /dev/null
+++ b/test/lib/completions/check_db.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "check_db -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/check_perms.exp b/test/lib/completions/check_perms.exp
new file mode 100644
index 00000000..a58995b0
--- /dev/null
+++ b/test/lib/completions/check_perms.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "check_perms -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/chgrp.exp b/test/lib/completions/chgrp.exp
new file mode 100644
index 00000000..8dfeea79
--- /dev/null
+++ b/test/lib/completions/chgrp.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "chgrp "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/chkconfig.exp b/test/lib/completions/chkconfig.exp
new file mode 100644
index 00000000..e7469b34
--- /dev/null
+++ b/test/lib/completions/chkconfig.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "chkconfig "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/chown.exp b/test/lib/completions/chown.exp
new file mode 100644
index 00000000..953b2b02
--- /dev/null
+++ b/test/lib/completions/chown.exp
@@ -0,0 +1,72 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+set users [exec bash -c "compgen -A user"]
+assert_complete $users "chown "
+
+
+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 "chown $partuser"
+ sync_after_int
+
+ assert_complete $fulluser:$fullgroup "chown $fulluser:$partgroup"
+ sync_after_int
+
+ # One slash should work correctly (doubled here for tcl).
+ assert_complete $fulluser\\:$fullgroup "chown $fulluser\\:$partgroup"
+ sync_after_int
+
+ foreach prefix {
+ "funky\\ user:" "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 "chown $prefix$partgroup" $test
+ sync_after_int
+ }
+
+ # Check that we give up in degenerate cases instead of spewing various junk.
+
+ assert_no_complete "chown $fulluser\\\\:$partgroup"
+ sync_after_int
+
+ assert_no_complete "chown $fulluser\\\\\\:$partgroup"
+ sync_after_int
+
+ assert_no_complete "chown $fulluser\\\\\\\\:$partgroup"
+ sync_after_int
+
+ # Colons in user/groupnames are not usually allowed.
+ assert_no_complete "chown foo:bar:$partgroup"
+ sync_after_int
+}
+
+
+teardown
diff --git a/test/lib/completions/chsh.exp b/test/lib/completions/chsh.exp
new file mode 100644
index 00000000..99262a2c
--- /dev/null
+++ b/test/lib/completions/chsh.exp
@@ -0,0 +1,26 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "chsh -s "
+
+
+sync_after_int
+
+
+assert_complete [exec bash -c "compgen -A user"] "chsh "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/ci.exp b/test/lib/completions/ci.exp
new file mode 100644
index 00000000..09105eec
--- /dev/null
+++ b/test/lib/completions/ci.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "ci "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/civclient.exp b/test/lib/completions/civclient.exp
new file mode 100644
index 00000000..8159c2bc
--- /dev/null
+++ b/test/lib/completions/civclient.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "civclient -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/civserver.exp b/test/lib/completions/civserver.exp
new file mode 100644
index 00000000..df459688
--- /dev/null
+++ b/test/lib/completions/civserver.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "civserver -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/cksfv.exp b/test/lib/completions/cksfv.exp
new file mode 100644
index 00000000..a40a5023
--- /dev/null
+++ b/test/lib/completions/cksfv.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "cksfv -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/cleanarch.exp b/test/lib/completions/cleanarch.exp
new file mode 100644
index 00000000..e3145e81
--- /dev/null
+++ b/test/lib/completions/cleanarch.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "cleanarch -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/clisp.exp b/test/lib/completions/clisp.exp
new file mode 100644
index 00000000..2bc599ac
--- /dev/null
+++ b/test/lib/completions/clisp.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "clisp "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/clone_member.exp b/test/lib/completions/clone_member.exp
new file mode 100644
index 00000000..34b4db57
--- /dev/null
+++ b/test/lib/completions/clone_member.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "clone_member -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/co.exp b/test/lib/completions/co.exp
new file mode 100644
index 00000000..49fe3a64
--- /dev/null
+++ b/test/lib/completions/co.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "co "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/composite.exp b/test/lib/completions/composite.exp
new file mode 100644
index 00000000..e39ce72f
--- /dev/null
+++ b/test/lib/completions/composite.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "composite "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/config_list.exp b/test/lib/completions/config_list.exp
new file mode 100644
index 00000000..5246c860
--- /dev/null
+++ b/test/lib/completions/config_list.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "config_list -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/configure.exp b/test/lib/completions/configure.exp
new file mode 100644
index 00000000..74afba1b
--- /dev/null
+++ b/test/lib/completions/configure.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "configure --prefix "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/convert.exp b/test/lib/completions/convert.exp
new file mode 100644
index 00000000..d8a77e35
--- /dev/null
+++ b/test/lib/completions/convert.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "convert "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/cowsay.exp b/test/lib/completions/cowsay.exp
new file mode 100644
index 00000000..dfbefe1a
--- /dev/null
+++ b/test/lib/completions/cowsay.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "cowsay "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/cp.exp b/test/lib/completions/cp.exp
new file mode 100644
index 00000000..9fe46537
--- /dev/null
+++ b/test/lib/completions/cp.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "cp "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/cpio.exp b/test/lib/completions/cpio.exp
new file mode 100644
index 00000000..b02f2719
--- /dev/null
+++ b/test/lib/completions/cpio.exp
@@ -0,0 +1,26 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "cpio --"
+
+
+sync_after_int
+
+
+assert_complete [exec bash -c "compgen -A user"] "cpio -R "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/createdb.exp b/test/lib/completions/createdb.exp
new file mode 100644
index 00000000..1e5cdbe7
--- /dev/null
+++ b/test/lib/completions/createdb.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "createdb "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/cryptsetup.exp b/test/lib/completions/cryptsetup.exp
new file mode 100644
index 00000000..e94c3ac1
--- /dev/null
+++ b/test/lib/completions/cryptsetup.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "cryptsetup "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/csplit.exp b/test/lib/completions/csplit.exp
new file mode 100644
index 00000000..3a66a627
--- /dev/null
+++ b/test/lib/completions/csplit.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "csplit "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/cut.exp b/test/lib/completions/cut.exp
new file mode 100644
index 00000000..b9bcf6c5
--- /dev/null
+++ b/test/lib/completions/cut.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "cut "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/cvs.exp b/test/lib/completions/cvs.exp
new file mode 100644
index 00000000..2a26da8e
--- /dev/null
+++ b/test/lib/completions/cvs.exp
@@ -0,0 +1,36 @@
+proc setup {} {
+ save_env
+ assert_bash_exec {OLDHOME=$HOME ; HOME=$TESTDIR/fixtures/cvs}
+}; # setup()
+
+
+proc teardown {} {
+ assert_bash_exec {HOME=$OLDHOME}
+ assert_env_unmodified {
+ /OLDHOME=/d
+ }
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "cvs "
+
+
+sync_after_int
+
+
+set test "-d should complete CVS roots"
+set cmd "cvs -d "
+send "$cmd\t"
+expect {
+ -re "^$cmd\r\n.*:pserver:.*\r\n/@$cmd:pserver:.*$" { pass "$test" }
+ default { fail "$test" }
+}; # expect
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/cvsps.exp b/test/lib/completions/cvsps.exp
new file mode 100644
index 00000000..1fd4a0a9
--- /dev/null
+++ b/test/lib/completions/cvsps.exp
@@ -0,0 +1,36 @@
+proc setup {} {
+ save_env
+ assert_bash_exec {OLDHOME=$HOME ; HOME=$TESTDIR/fixtures/cvs}
+}; # setup()
+
+
+proc teardown {} {
+ assert_bash_exec {HOME=$OLDHOME}
+ assert_env_unmodified {
+ /OLDHOME=/d
+ }
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "cvsps -"
+
+
+sync_after_int
+
+
+set test "No arguments should complete CVS roots"
+set cmd "cvsps "
+send "$cmd\t"
+expect {
+ -re "^$cmd\r\n.*:pserver:.*\r\n/@$cmd:pserver:.*$" { pass "$test" }
+ default { fail "$test" }
+}; # expect
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/date.exp b/test/lib/completions/date.exp
new file mode 100644
index 00000000..9d75f5f3
--- /dev/null
+++ b/test/lib/completions/date.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "date "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/dcop.exp b/test/lib/completions/dcop.exp
new file mode 100644
index 00000000..6ed800c5
--- /dev/null
+++ b/test/lib/completions/dcop.exp
@@ -0,0 +1,22 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+if {[assert_exec {dcop} words]} {
+ assert_complete $words "dcop "
+}; # if
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/dd.exp b/test/lib/completions/dd.exp
new file mode 100644
index 00000000..400dd143
--- /dev/null
+++ b/test/lib/completions/dd.exp
@@ -0,0 +1,33 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "dd --"
+
+
+sync_after_int
+
+
+set test "option should be suffixed with ="
+set cmd "dd if"
+send "$cmd\t"
+expect -ex "$cmd"
+expect {
+ -re "^=$" { pass $test }
+ -re {^\\=$} { xfail $test }
+}; # expect
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/df.exp b/test/lib/completions/df.exp
new file mode 100644
index 00000000..487d70a9
--- /dev/null
+++ b/test/lib/completions/df.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "df "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/dhclient.exp b/test/lib/completions/dhclient.exp
new file mode 100644
index 00000000..42c14c82
--- /dev/null
+++ b/test/lib/completions/dhclient.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "dhclient -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/dict.exp b/test/lib/completions/dict.exp
new file mode 100644
index 00000000..32fb4988
--- /dev/null
+++ b/test/lib/completions/dict.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "dict -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/diff.exp b/test/lib/completions/diff.exp
new file mode 100644
index 00000000..c009f640
--- /dev/null
+++ b/test/lib/completions/diff.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "diff --"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/dir.exp b/test/lib/completions/dir.exp
new file mode 100644
index 00000000..6e20d37d
--- /dev/null
+++ b/test/lib/completions/dir.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "dir "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/display.exp b/test/lib/completions/display.exp
new file mode 100644
index 00000000..9a9d6901
--- /dev/null
+++ b/test/lib/completions/display.exp
@@ -0,0 +1,41 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+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
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/dnsspoof.exp b/test/lib/completions/dnsspoof.exp
new file mode 100644
index 00000000..3223a349
--- /dev/null
+++ b/test/lib/completions/dnsspoof.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "dnsspoof -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/dpkg-deb.exp b/test/lib/completions/dpkg-deb.exp
new file mode 100644
index 00000000..c8656610
--- /dev/null
+++ b/test/lib/completions/dpkg-deb.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "dpkg-deb --c"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/dpkg-reconfigure.exp b/test/lib/completions/dpkg-reconfigure.exp
new file mode 100644
index 00000000..267594be
--- /dev/null
+++ b/test/lib/completions/dpkg-reconfigure.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "dpkg-reconfigure --"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/dpkg-source.exp b/test/lib/completions/dpkg-source.exp
new file mode 100644
index 00000000..a21eff45
--- /dev/null
+++ b/test/lib/completions/dpkg-source.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "dpkg-source -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/dpkg.exp b/test/lib/completions/dpkg.exp
new file mode 100644
index 00000000..2bd1fb6e
--- /dev/null
+++ b/test/lib/completions/dpkg.exp
@@ -0,0 +1,29 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "dpkg --c"
+
+
+sync_after_int
+
+
+ # Build list of installed packages
+if {[assert_exec {dpkg --get-selections | command grep \[\[:space:\]\]install$ | cut -f1} packages]} {
+ assert_complete $packages "dpkg -L "
+}; # if
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/dropdb.exp b/test/lib/completions/dropdb.exp
new file mode 100644
index 00000000..e78a2ba7
--- /dev/null
+++ b/test/lib/completions/dropdb.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "dropdb "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/dselect.exp b/test/lib/completions/dselect.exp
new file mode 100644
index 00000000..f6257294
--- /dev/null
+++ b/test/lib/completions/dselect.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "dselect "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/dsniff.exp b/test/lib/completions/dsniff.exp
new file mode 100644
index 00000000..a0cc43ac
--- /dev/null
+++ b/test/lib/completions/dsniff.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "dsniff -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/du.exp b/test/lib/completions/du.exp
new file mode 100644
index 00000000..d1ffa8ca
--- /dev/null
+++ b/test/lib/completions/du.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "du "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/dumpdb.exp b/test/lib/completions/dumpdb.exp
new file mode 100644
index 00000000..240214b3
--- /dev/null
+++ b/test/lib/completions/dumpdb.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "dumpdb "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/enscript.exp b/test/lib/completions/enscript.exp
new file mode 100644
index 00000000..7fefabdd
--- /dev/null
+++ b/test/lib/completions/enscript.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "enscript --"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/env.exp b/test/lib/completions/env.exp
new file mode 100644
index 00000000..f03f5395
--- /dev/null
+++ b/test/lib/completions/env.exp
@@ -0,0 +1,22 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+if {[assert_exec {env --help} "" "" "unsupported"]} {
+ assert_complete_any "env --"
+}; # if
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/evince.exp b/test/lib/completions/evince.exp
new file mode 100644
index 00000000..22279a26
--- /dev/null
+++ b/test/lib/completions/evince.exp
@@ -0,0 +1,35 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified {/OLDPWD=/d}
+}; # teardown()
+
+
+setup
+
+
+# NOTE: The directory `fixtures/evince' contains an additional subdir `foo'
+# (should be visible as completion) and an additional file `.txt'
+# (shouldn't be visible as completion)
+set files {
+ foo/
+ .bmp .BMP .cbr .CBR .cbz .CBZ .djv .DJV .djvu .DJVU
+ .dvi .DVI .dvi.bz2 .dvi.BZ2 .DVI.bz2 .DVI.BZ2 .dvi.gz .dvi.GZ .DVI.gz .DVI.GZ
+ .eps .EPS .eps.bz2 .eps.BZ2 .EPS.bz2 .EPS.BZ2 .eps.gz .eps.GZ .EPS.gz .EPS.GZ
+ .gif .GIF .ico .ICO .jpeg .JPEG .jpg .JPG .miff .MIFF .pbm .PBM .pcx .PCX
+ .pdf .PDF .pdf.bz2 .pdf.BZ2 .PDF.bz2 .PDF.BZ2 .pdf.gz .pdf.GZ .PDF.gz .PDF.GZ
+ .pgm .PGM .png .PNG .pnm .PNM .ppm .PPM
+ .ps .PS .ps.bz2 .ps.BZ2 .PS.bz2 .PS.BZ2 .ps.gz .ps.GZ .PS.gz .PS.GZ
+ .tga .TGA .tif .TIF .tiff .TIFF
+ .xpm .XPM .xwd .XWD
+}
+assert_complete_dir $files "evince " "fixtures/evince"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/expand.exp b/test/lib/completions/expand.exp
new file mode 100644
index 00000000..d5cd6b17
--- /dev/null
+++ b/test/lib/completions/expand.exp
@@ -0,0 +1,22 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+if {[assert_exec {expand --help} "" "" "unsupported"]} {
+ assert_complete_any "expand --"
+}; # if
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/filesnarf.exp b/test/lib/completions/filesnarf.exp
new file mode 100644
index 00000000..53cf01e4
--- /dev/null
+++ b/test/lib/completions/filesnarf.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "filesnarf -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/find.exp b/test/lib/completions/find.exp
new file mode 100644
index 00000000..4b1728dc
--- /dev/null
+++ b/test/lib/completions/find.exp
@@ -0,0 +1,80 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified {/OLDPWD=/d}
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "find "
+
+
+sync_after_int
+
+
+assert_complete_any "find -fstype "
+
+
+sync_after_int
+
+
+set options [list -daystart -depth -follow -help \
+ -ignore_readdir_race -maxdepth -mindepth -mindepth -mount \
+ -noignore_readdir_race -noleaf -regextype -version -warn -nowarn \
+ -xdev \
+ -amin -anewer -atime -cmin -cnewer -ctime -empty -executable -false \
+ -fstype -gid -group -ilname -iname -inum -ipath -iregex -iwholename \
+ -links -lname -mmin -mtime -name -newer -nogroup -nouser -path -perm \
+ -readable -regex -samefile -size -true -type -uid -used -user \
+ -wholename -writable -xtype -context \
+ -delete -exec -execdir -fls -fprint -fprint0 -fprintf -ls -ok -okdir \
+ -print -print0 -printf -prune -quit]
+assert_complete $options {find -}
+
+
+sync_after_int
+
+
+set test "-wholename should complete files/dirs"
+set dir fixtures/shared/default
+set files [split [exec bash -c "cd $dir && ls -p"] "\n"]
+assert_complete_dir $files "find -wholename " $dir
+
+
+sync_after_int
+
+
+set test "-uid should complete uids"
+ # Complete
+set cmd "find -uid "
+send "$cmd\t"
+expect {
+ -re "$cmd\r\n\\d+.*/@$cmd$" { pass "$test" }
+ -re /@ { unresolved "$test at prompt" }
+ -re eof { unresolved "eof" }
+}; # expect
+
+
+sync_after_int
+
+
+set test "-gid should complete gids"
+ # Complete
+set cmd "find -gid "
+send "$cmd\t"
+expect {
+ -re "$cmd\r\n\\d+.*/@$cmd$" { pass "$test" }
+ -re /@ { unresolved "$test at prompt" }
+ -re eof { unresolved "eof" }
+}; # expect
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/find_member.exp b/test/lib/completions/find_member.exp
new file mode 100644
index 00000000..58fac7d2
--- /dev/null
+++ b/test/lib/completions/find_member.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "find_member -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/finger.exp b/test/lib/completions/finger.exp
new file mode 100644
index 00000000..30f2b080
--- /dev/null
+++ b/test/lib/completions/finger.exp
@@ -0,0 +1,57 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+set test "Tab should complete usernames"
+# Build string list of usernames
+set users {}
+foreach u [exec bash -c "compgen -A user"] {
+ lappend users $u
+}; # foreach
+assert_complete $users "finger " $test
+
+
+sync_after_int
+
+
+set test "Tab should complete partial username"
+assert_complete_partial [exec bash -c "compgen -A user"] "finger"
+
+
+sync_after_int
+
+
+set test "Tab should complete partial hostname"
+# Build string list of hostnames, starting with the character of the first
+# host, unless host starts with a COMP_WORDBREAKS character, e.g. a colon (:).
+# Hosts starting with a COMP_WORDBREAKS character are left out because these
+# are exceptional cases, requiring specific tests.
+set hosts {}
+set char ""
+foreach h [get_known_hosts] {
+ set first [string range $h 0 0]
+ if {$char == "" && [string first $first $COMP_WORDBREAKS] == -1} {set char $first}
+ if {$char != ""} {
+ # Only append unique hostnames starting with $char
+ if {$first == $char && [lsearch -exact $hosts "test@$h"] == -1} {
+ # Prefix hosts with username 'test@'
+ lappend hosts "test@$h"
+ }; # if
+ }; # if
+}; # foreach
+assert_complete $hosts "finger test@$char" $test
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/fmt.exp b/test/lib/completions/fmt.exp
new file mode 100644
index 00000000..28570682
--- /dev/null
+++ b/test/lib/completions/fmt.exp
@@ -0,0 +1,22 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+if {[assert_exec {fmt --help} "" "" "unsupported"]} {
+ assert_complete_any "fmt -"
+}; # if
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/fold.exp b/test/lib/completions/fold.exp
new file mode 100644
index 00000000..a5230b03
--- /dev/null
+++ b/test/lib/completions/fold.exp
@@ -0,0 +1,22 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+if {[assert_exec {fold --help} "" "" "unsupported"]} {
+ assert_complete_any "fold --"
+}; # if
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/g++.exp b/test/lib/completions/g++.exp
new file mode 100644
index 00000000..4dc2591a
--- /dev/null
+++ b/test/lib/completions/g++.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "g++ "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/g4.exp b/test/lib/completions/g4.exp
new file mode 100644
index 00000000..203de061
--- /dev/null
+++ b/test/lib/completions/g4.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "g4 "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/g77.exp b/test/lib/completions/g77.exp
new file mode 100644
index 00000000..8802aca9
--- /dev/null
+++ b/test/lib/completions/g77.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "g77 "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/gcc.exp b/test/lib/completions/gcc.exp
new file mode 100644
index 00000000..8e52a120
--- /dev/null
+++ b/test/lib/completions/gcc.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "gcc "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/gcj.exp b/test/lib/completions/gcj.exp
new file mode 100644
index 00000000..db52d59a
--- /dev/null
+++ b/test/lib/completions/gcj.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "gcj "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/gcl.exp b/test/lib/completions/gcl.exp
new file mode 100644
index 00000000..7cead846
--- /dev/null
+++ b/test/lib/completions/gcl.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "gcl "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/gdb.exp b/test/lib/completions/gdb.exp
new file mode 100644
index 00000000..982f0878
--- /dev/null
+++ b/test/lib/completions/gdb.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "gdb - "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/genaliases.exp b/test/lib/completions/genaliases.exp
new file mode 100644
index 00000000..064eb386
--- /dev/null
+++ b/test/lib/completions/genaliases.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "genaliases -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/getent.exp b/test/lib/completions/getent.exp
new file mode 100644
index 00000000..121f3b38
--- /dev/null
+++ b/test/lib/completions/getent.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "getent "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/gkrellm.exp b/test/lib/completions/gkrellm.exp
new file mode 100644
index 00000000..f8b0dd4d
--- /dev/null
+++ b/test/lib/completions/gkrellm.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "gkrellm -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/gmplayer.exp b/test/lib/completions/gmplayer.exp
new file mode 100644
index 00000000..d9032698
--- /dev/null
+++ b/test/lib/completions/gmplayer.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "gmplayer "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/gnatmake.exp b/test/lib/completions/gnatmake.exp
new file mode 100644
index 00000000..902aa062
--- /dev/null
+++ b/test/lib/completions/gnatmake.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "gnatmake "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/gpc.exp b/test/lib/completions/gpc.exp
new file mode 100644
index 00000000..6c4d0383
--- /dev/null
+++ b/test/lib/completions/gpc.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "gpc "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/gperf.exp b/test/lib/completions/gperf.exp
new file mode 100644
index 00000000..aa24333e
--- /dev/null
+++ b/test/lib/completions/gperf.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "gperf --"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/gpg.exp b/test/lib/completions/gpg.exp
new file mode 100644
index 00000000..29fd2244
--- /dev/null
+++ b/test/lib/completions/gpg.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "gpg "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/gprof.exp b/test/lib/completions/gprof.exp
new file mode 100644
index 00000000..592786af
--- /dev/null
+++ b/test/lib/completions/gprof.exp
@@ -0,0 +1,22 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+if {[assert_exec {gprof --help} "" "" "unsupported"]} {
+ assert_complete_any "gprof --"
+}; # if
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/grep.exp b/test/lib/completions/grep.exp
new file mode 100644
index 00000000..3814df71
--- /dev/null
+++ b/test/lib/completions/grep.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "grep --"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/grub.exp b/test/lib/completions/grub.exp
new file mode 100644
index 00000000..9578e789
--- /dev/null
+++ b/test/lib/completions/grub.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "grub --"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/gzip.exp b/test/lib/completions/gzip.exp
new file mode 100644
index 00000000..f212c61a
--- /dev/null
+++ b/test/lib/completions/gzip.exp
@@ -0,0 +1,28 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+set test "Tab should complete"
+ # Try completion
+set cmd "gzip "
+send "$cmd\t"
+expect {
+ -re "^$cmd\r\n.*$cmd$" { pass "$test" }
+ -re /@ { unresolved "$test at prompt" }
+ -re eof { unresolved "eof" }
+}; # expect
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/hcitool.exp b/test/lib/completions/hcitool.exp
new file mode 100644
index 00000000..9283adff
--- /dev/null
+++ b/test/lib/completions/hcitool.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "hcitool "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/head.exp b/test/lib/completions/head.exp
new file mode 100644
index 00000000..0d4f6a20
--- /dev/null
+++ b/test/lib/completions/head.exp
@@ -0,0 +1,22 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+if {[assert_exec {head --help} "" "" "unsupported"]} {
+ assert_complete_any "head --"
+}; # if
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/iconv.exp b/test/lib/completions/iconv.exp
new file mode 100644
index 00000000..420e923c
--- /dev/null
+++ b/test/lib/completions/iconv.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "iconv -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/id.exp b/test/lib/completions/id.exp
new file mode 100644
index 00000000..155af52c
--- /dev/null
+++ b/test/lib/completions/id.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "id -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/identify.exp b/test/lib/completions/identify.exp
new file mode 100644
index 00000000..8f38ae47
--- /dev/null
+++ b/test/lib/completions/identify.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "identify -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/ifdown.exp b/test/lib/completions/ifdown.exp
new file mode 100644
index 00000000..68225bb9
--- /dev/null
+++ b/test/lib/completions/ifdown.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "ifdown "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/ifup.exp b/test/lib/completions/ifup.exp
new file mode 100644
index 00000000..9d717178
--- /dev/null
+++ b/test/lib/completions/ifup.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "ifup "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/indent.exp b/test/lib/completions/indent.exp
new file mode 100644
index 00000000..e8fc32b1
--- /dev/null
+++ b/test/lib/completions/indent.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "indent --"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/info.exp b/test/lib/completions/info.exp
new file mode 100644
index 00000000..ed769f1a
--- /dev/null
+++ b/test/lib/completions/info.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "info "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/inject.exp b/test/lib/completions/inject.exp
new file mode 100644
index 00000000..7c093146
--- /dev/null
+++ b/test/lib/completions/inject.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "inject "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/insmod.exp b/test/lib/completions/insmod.exp
new file mode 100644
index 00000000..8e83f0b4
--- /dev/null
+++ b/test/lib/completions/insmod.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "insmod in"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/invoke-rc.d.exp b/test/lib/completions/invoke-rc.d.exp
new file mode 100644
index 00000000..4dc9f1d8
--- /dev/null
+++ b/test/lib/completions/invoke-rc.d.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "invoke-rc.d "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/ipsec.exp b/test/lib/completions/ipsec.exp
new file mode 100644
index 00000000..15617a16
--- /dev/null
+++ b/test/lib/completions/ipsec.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "ipsec "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/ipv6calc.exp b/test/lib/completions/ipv6calc.exp
new file mode 100644
index 00000000..74ce95f7
--- /dev/null
+++ b/test/lib/completions/ipv6calc.exp
@@ -0,0 +1,26 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "ipv6calc -"
+
+
+sync_after_int
+
+
+assert_complete_any "ipv6calc --in "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/irb.exp b/test/lib/completions/irb.exp
new file mode 100644
index 00000000..81bea6d2
--- /dev/null
+++ b/test/lib/completions/irb.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "irb "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/isql.exp b/test/lib/completions/isql.exp
new file mode 100644
index 00000000..87e16bca
--- /dev/null
+++ b/test/lib/completions/isql.exp
@@ -0,0 +1,23 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified {/ODBCINI=/d}
+}; # teardown()
+
+
+setup
+
+
+assert_bash_exec {OLDODBCINI=$ODBCINI; ODBCINI=$TESTDIR/fixtures/isql/odbc.ini}
+assert_complete_any "isql "
+sync_after_int
+assert_bash_exec {ODBCINI=$OLDODBCINI; unset -v OLDODBCINI}
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/iwconfig.exp b/test/lib/completions/iwconfig.exp
new file mode 100644
index 00000000..f09719d7
--- /dev/null
+++ b/test/lib/completions/iwconfig.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "iwconfig --"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/iwlist.exp b/test/lib/completions/iwlist.exp
new file mode 100644
index 00000000..80a2c367
--- /dev/null
+++ b/test/lib/completions/iwlist.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "iwlist --"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/iwpriv.exp b/test/lib/completions/iwpriv.exp
new file mode 100644
index 00000000..f3102cc5
--- /dev/null
+++ b/test/lib/completions/iwpriv.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "iwpriv --"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/iwspy.exp b/test/lib/completions/iwspy.exp
new file mode 100644
index 00000000..5fa0bee5
--- /dev/null
+++ b/test/lib/completions/iwspy.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_env_unmodified "iwspy --"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/jar.exp b/test/lib/completions/jar.exp
new file mode 100644
index 00000000..0e11f684
--- /dev/null
+++ b/test/lib/completions/jar.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "jar "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/jarsigner.exp b/test/lib/completions/jarsigner.exp
new file mode 100644
index 00000000..075e0263
--- /dev/null
+++ b/test/lib/completions/jarsigner.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "jarsigner "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/java.exp b/test/lib/completions/java.exp
new file mode 100644
index 00000000..14610b2f
--- /dev/null
+++ b/test/lib/completions/java.exp
@@ -0,0 +1,46 @@
+proc setup {} {
+ assert_bash_exec {CLASSPATH=$TESTDIR/fixtures/java/a:$TESTDIR/fixtures/java/bashcomp.jar}
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "java -"
+
+
+sync_after_int
+
+
+assert_complete "b bashcomp.jarred toplevel" "java "
+
+
+sync_after_int
+
+
+assert_complete "bashcomp.jarred toplevel" \
+ "java -cp fixtures/java/bashcomp.jar "
+
+
+sync_after_int
+
+
+assert_no_complete "java -cp \"\" "
+
+
+sync_after_int
+
+
+assert_complete "a/ bashcomp.jar" "java -jar fixtures/java/"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/javac.exp b/test/lib/completions/javac.exp
new file mode 100644
index 00000000..6013de11
--- /dev/null
+++ b/test/lib/completions/javac.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "javac "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/javadoc.exp b/test/lib/completions/javadoc.exp
new file mode 100644
index 00000000..40c922ca
--- /dev/null
+++ b/test/lib/completions/javadoc.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "javadoc "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/k3b.exp b/test/lib/completions/k3b.exp
new file mode 100644
index 00000000..86942d67
--- /dev/null
+++ b/test/lib/completions/k3b.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "k3b "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/kdvi.exp b/test/lib/completions/kdvi.exp
new file mode 100644
index 00000000..0196049a
--- /dev/null
+++ b/test/lib/completions/kdvi.exp
@@ -0,0 +1,27 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified {/OLDPWD=/d}
+}; # teardown()
+
+
+setup
+
+
+# NOTE: The directory `fixtures/kdvi' contains an additional subdir `foo'
+# (should be visible as completion) and an additional file `.txt'
+# (shouldn't be visible as completion)
+set files {
+ foo/
+ .dvi .DVI .dvi.bz2 .DVI.bz2 .dvi.gz .DVI.gz .dvi.Z .DVI.Z
+}
+assert_complete_dir $files "kdvi " "fixtures/kdvi"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/kill.exp b/test/lib/completions/kill.exp
new file mode 100644
index 00000000..ca02650c
--- /dev/null
+++ b/test/lib/completions/kill.exp
@@ -0,0 +1,26 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "kill 1"
+
+
+sync_after_int
+
+
+assert_complete [get_signals] "kill -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/killall.exp b/test/lib/completions/killall.exp
new file mode 100644
index 00000000..763c8e7d
--- /dev/null
+++ b/test/lib/completions/killall.exp
@@ -0,0 +1,26 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "killall "
+
+
+sync_after_int
+
+
+assert_complete [get_signals] "killall -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/kldload.exp b/test/lib/completions/kldload.exp
new file mode 100644
index 00000000..0493a10a
--- /dev/null
+++ b/test/lib/completions/kldload.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "kldload "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/kldunload.exp b/test/lib/completions/kldunload.exp
new file mode 100644
index 00000000..192159a5
--- /dev/null
+++ b/test/lib/completions/kldunload.exp
@@ -0,0 +1,24 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+if {[catch {eval exec {kldstat | grep "\.ko$"}}] == 0} {
+ assert_complete_any "kldunload "
+} else {
+ assert_no_complete "kldunload "
+}
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/kpdf.exp b/test/lib/completions/kpdf.exp
new file mode 100644
index 00000000..010abcfb
--- /dev/null
+++ b/test/lib/completions/kpdf.exp
@@ -0,0 +1,26 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified {/OLDPWD=/d}
+}; # teardown()
+
+
+setup
+
+
+# NOTE: The directory `fixtures/kpdf' contains an additional subdir `foo'
+# (should be visible as completion) and an additional file `.txt'
+# (shouldn't be visible as completion)
+set files {
+ foo/ .eps .ps .EPS .PS .pdf .PDF
+}
+assert_complete_dir $files "kpdf " "fixtures/kpdf"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/kplayer.exp b/test/lib/completions/kplayer.exp
new file mode 100644
index 00000000..34c9b3bf
--- /dev/null
+++ b/test/lib/completions/kplayer.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "kplayer "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/larch.exp b/test/lib/completions/larch.exp
new file mode 100644
index 00000000..076016f2
--- /dev/null
+++ b/test/lib/completions/larch.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "larch library-"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/ld.exp b/test/lib/completions/ld.exp
new file mode 100644
index 00000000..60377991
--- /dev/null
+++ b/test/lib/completions/ld.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "ld "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/ldd.exp b/test/lib/completions/ldd.exp
new file mode 100644
index 00000000..e45d1df7
--- /dev/null
+++ b/test/lib/completions/ldd.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "ldd "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/less.exp b/test/lib/completions/less.exp
new file mode 100644
index 00000000..269c9b5c
--- /dev/null
+++ b/test/lib/completions/less.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "less --"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/lftp.exp b/test/lib/completions/lftp.exp
new file mode 100644
index 00000000..a49a1935
--- /dev/null
+++ b/test/lib/completions/lftp.exp
@@ -0,0 +1,24 @@
+proc setup {} {
+ assert_bash_exec {HOME=$TESTDIR/fixtures/lftp}
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+set expected [get_hosts]
+# `lftptest' is defined in ./fixtures/lftp/.lftp/bookmarks
+lappend expected lftptest
+assert_complete $expected "lftp "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/lftpget.exp b/test/lib/completions/lftpget.exp
new file mode 100644
index 00000000..7d80216e
--- /dev/null
+++ b/test/lib/completions/lftpget.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "lftpget -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/lilo.exp b/test/lib/completions/lilo.exp
new file mode 100644
index 00000000..505a1470
--- /dev/null
+++ b/test/lib/completions/lilo.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "lilo -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/links.exp b/test/lib/completions/links.exp
new file mode 100644
index 00000000..9f4896aa
--- /dev/null
+++ b/test/lib/completions/links.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "links "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/lisp.exp b/test/lib/completions/lisp.exp
new file mode 100644
index 00000000..21663628
--- /dev/null
+++ b/test/lib/completions/lisp.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "lisp "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/list_admins.exp b/test/lib/completions/list_admins.exp
new file mode 100644
index 00000000..e1c9c4dd
--- /dev/null
+++ b/test/lib/completions/list_admins.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "list_admins -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/list_lists.exp b/test/lib/completions/list_lists.exp
new file mode 100644
index 00000000..789ab1a8
--- /dev/null
+++ b/test/lib/completions/list_lists.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "list_lists -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/list_members.exp b/test/lib/completions/list_members.exp
new file mode 100644
index 00000000..c93b53d7
--- /dev/null
+++ b/test/lib/completions/list_members.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "list_members -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/list_owners.exp b/test/lib/completions/list_owners.exp
new file mode 100644
index 00000000..c96e0229
--- /dev/null
+++ b/test/lib/completions/list_owners.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "list_owners -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/ln.exp b/test/lib/completions/ln.exp
new file mode 100644
index 00000000..34786071
--- /dev/null
+++ b/test/lib/completions/ln.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "ln "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/look.exp b/test/lib/completions/look.exp
new file mode 100644
index 00000000..53a3c464
--- /dev/null
+++ b/test/lib/completions/look.exp
@@ -0,0 +1,22 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+if {[assert_exec {look foo | grep ^foo} words]} {
+ assert_complete $words "look foo"
+}; # if
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/ls.exp b/test/lib/completions/ls.exp
new file mode 100644
index 00000000..db2d41d3
--- /dev/null
+++ b/test/lib/completions/ls.exp
@@ -0,0 +1,22 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+if {[assert_exec {ls --help} "" "" "unsupported"]} {
+ assert_complete_any "ls --"
+}; # if
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/lvchange.exp b/test/lib/completions/lvchange.exp
new file mode 100644
index 00000000..ec3886b8
--- /dev/null
+++ b/test/lib/completions/lvchange.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "lvchange --"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/lvcreate.exp b/test/lib/completions/lvcreate.exp
new file mode 100644
index 00000000..46dceb79
--- /dev/null
+++ b/test/lib/completions/lvcreate.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "lvcreate --"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/lvdisplay.exp b/test/lib/completions/lvdisplay.exp
new file mode 100644
index 00000000..5a01a0e5
--- /dev/null
+++ b/test/lib/completions/lvdisplay.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "lvdisplay --"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/lvextend.exp b/test/lib/completions/lvextend.exp
new file mode 100644
index 00000000..24a63853
--- /dev/null
+++ b/test/lib/completions/lvextend.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "lvextend --"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/lvm.exp b/test/lib/completions/lvm.exp
new file mode 100644
index 00000000..1c67825e
--- /dev/null
+++ b/test/lib/completions/lvm.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "lvm pv"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/lvmdiskscan.exp b/test/lib/completions/lvmdiskscan.exp
new file mode 100644
index 00000000..27e566d4
--- /dev/null
+++ b/test/lib/completions/lvmdiskscan.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "lvmdiskscan --"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/lvreduce.exp b/test/lib/completions/lvreduce.exp
new file mode 100644
index 00000000..edd5150d
--- /dev/null
+++ b/test/lib/completions/lvreduce.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "lvreduce --"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/lvremove.exp b/test/lib/completions/lvremove.exp
new file mode 100644
index 00000000..1cd63150
--- /dev/null
+++ b/test/lib/completions/lvremove.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "lvremove --"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/lvrename.exp b/test/lib/completions/lvrename.exp
new file mode 100644
index 00000000..51624222
--- /dev/null
+++ b/test/lib/completions/lvrename.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "lvrename --"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/lvresize.exp b/test/lib/completions/lvresize.exp
new file mode 100644
index 00000000..830b9ab1
--- /dev/null
+++ b/test/lib/completions/lvresize.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "lvresize --"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/lvs.exp b/test/lib/completions/lvs.exp
new file mode 100644
index 00000000..8b239f5d
--- /dev/null
+++ b/test/lib/completions/lvs.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "lvs --"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/lvscan.exp b/test/lib/completions/lvscan.exp
new file mode 100644
index 00000000..841fd0ed
--- /dev/null
+++ b/test/lib/completions/lvscan.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "lvscan --"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/lzma.exp b/test/lib/completions/lzma.exp
new file mode 100644
index 00000000..79d78854
--- /dev/null
+++ b/test/lib/completions/lzma.exp
@@ -0,0 +1,26 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "lzma "
+
+
+sync_after_int
+
+
+assert_complete "a/ bashcomp.lzma bashcomp.tlz" "lzma -d fixtures/xz/"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/lzop.exp b/test/lib/completions/lzop.exp
new file mode 100644
index 00000000..c33e814e
--- /dev/null
+++ b/test/lib/completions/lzop.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "lzop "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/m4.exp b/test/lib/completions/m4.exp
new file mode 100644
index 00000000..2cc884b3
--- /dev/null
+++ b/test/lib/completions/m4.exp
@@ -0,0 +1,22 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+if {[assert_exec {m4 --help} "" "" "unsupported"]} {
+ assert_complete_any "m4 --"
+}; # if
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/macof.exp b/test/lib/completions/macof.exp
new file mode 100644
index 00000000..e21b1e77
--- /dev/null
+++ b/test/lib/completions/macof.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "macof -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/mailmanctl.exp b/test/lib/completions/mailmanctl.exp
new file mode 100644
index 00000000..a69b7650
--- /dev/null
+++ b/test/lib/completions/mailmanctl.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "mailmanctl "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/mailsnarf.exp b/test/lib/completions/mailsnarf.exp
new file mode 100644
index 00000000..df9981b7
--- /dev/null
+++ b/test/lib/completions/mailsnarf.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "mailsnarf -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/make.exp b/test/lib/completions/make.exp
new file mode 100644
index 00000000..90b9e68b
--- /dev/null
+++ b/test/lib/completions/make.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "make "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/man.exp b/test/lib/completions/man.exp
new file mode 100644
index 00000000..62c14c86
--- /dev/null
+++ b/test/lib/completions/man.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "man man"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/mc.exp b/test/lib/completions/mc.exp
new file mode 100644
index 00000000..866161ba
--- /dev/null
+++ b/test/lib/completions/mc.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "mc -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/mcrypt.exp b/test/lib/completions/mcrypt.exp
new file mode 100644
index 00000000..bfc5d2d2
--- /dev/null
+++ b/test/lib/completions/mcrypt.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "mcrypt "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/md5sum.exp b/test/lib/completions/md5sum.exp
new file mode 100644
index 00000000..25290b56
--- /dev/null
+++ b/test/lib/completions/md5sum.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "md5sum "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/mdecrypt.exp b/test/lib/completions/mdecrypt.exp
new file mode 100644
index 00000000..4e49ae12
--- /dev/null
+++ b/test/lib/completions/mdecrypt.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "mdecrypt "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/mencoder.exp b/test/lib/completions/mencoder.exp
new file mode 100644
index 00000000..169dcb71
--- /dev/null
+++ b/test/lib/completions/mencoder.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "mencoder "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/minicom.exp b/test/lib/completions/minicom.exp
new file mode 100644
index 00000000..935502f1
--- /dev/null
+++ b/test/lib/completions/minicom.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "minicom -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/mkdir.exp b/test/lib/completions/mkdir.exp
new file mode 100644
index 00000000..43dfec7e
--- /dev/null
+++ b/test/lib/completions/mkdir.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "mkdir "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/mkfifo.exp b/test/lib/completions/mkfifo.exp
new file mode 100644
index 00000000..c6343f8d
--- /dev/null
+++ b/test/lib/completions/mkfifo.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "mkfifo "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/mkinitrd.exp b/test/lib/completions/mkinitrd.exp
new file mode 100644
index 00000000..cfb316e5
--- /dev/null
+++ b/test/lib/completions/mkinitrd.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "mkinitrd "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/mkisofs.exp b/test/lib/completions/mkisofs.exp
new file mode 100644
index 00000000..ad24ea06
--- /dev/null
+++ b/test/lib/completions/mkisofs.exp
@@ -0,0 +1,48 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "mkisofs "
+
+
+sync_after_int
+
+
+set test "-uid should complete uids"
+ # Try completion
+set cmd "mkisofs -uid "
+send "$cmd\t"
+expect {
+ -re "^$cmd\r\n\\d+.*$cmd$" { pass "$test" }
+ -re /@ { unresolved "$test at prompt" }
+ -re eof { unresolved "eof" }
+}; # expect
+
+
+sync_after_int
+
+
+set test "-gid should complete gids"
+ # Try completion
+set cmd "mkisofs -gid "
+send "$cmd\t"
+expect {
+ -re "^$cmd\r\n\\d+.*$cmd$" { pass "$test" }
+ -re /@ { unresolved "$test at prompt" }
+ -re eof { unresolved "eof" }
+}; # expect
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/mknod.exp b/test/lib/completions/mknod.exp
new file mode 100644
index 00000000..2c58cade
--- /dev/null
+++ b/test/lib/completions/mknod.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "mknod "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/mmsitepass.exp b/test/lib/completions/mmsitepass.exp
new file mode 100644
index 00000000..d69fa202
--- /dev/null
+++ b/test/lib/completions/mmsitepass.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "mmsitepass "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/module.exp b/test/lib/completions/module.exp
new file mode 100644
index 00000000..a34667d4
--- /dev/null
+++ b/test/lib/completions/module.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "module "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/mogrify.exp b/test/lib/completions/mogrify.exp
new file mode 100644
index 00000000..ef7e18ee
--- /dev/null
+++ b/test/lib/completions/mogrify.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "mogrify "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/montage.exp b/test/lib/completions/montage.exp
new file mode 100644
index 00000000..736609a5
--- /dev/null
+++ b/test/lib/completions/montage.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "montage "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/mount.exp b/test/lib/completions/mount.exp
new file mode 100644
index 00000000..38d93e3b
--- /dev/null
+++ b/test/lib/completions/mount.exp
@@ -0,0 +1,121 @@
+# mount completion from fstab can't be tested directly because it
+# (correctly) uses absolute paths. So we create a custom completion which
+# reads from a file in our text fixture instead.
+proc setup_dummy_mnt {} {
+ assert_bash_exec {unset COMPREPLY cur}
+ assert_bash_exec {unset -f _mnt}
+
+ global TESTDIR
+ assert_bash_exec { \
+ _mnt() { \
+ local cur=$(_get_cword); \
+ _linux_fstab $(_get_pword) < "$TESTDIR/fixtures/mount/test-fstab"; \
+ }; \
+ complete -F _mnt mnt \
+ }
+}
+
+
+proc teardown_dummy_mnt {} {
+ assert_bash_exec {unset COMPREPLY cur}
+ assert_bash_exec {unset -f _mnt}
+ assert_bash_exec {complete -r mnt}
+}
+
+
+proc setup {} {
+ save_env
+ setup_dummy_mnt
+}
+
+
+proc teardown {} {
+ teardown_dummy_mnt
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "mount "
+
+
+sync_after_int
+
+
+assert_complete_any "mount -t "
+
+
+sync_after_int
+
+
+set test "Check completing nfs mounts"
+set expected [list /test/path /test/path2 /second/path]
+set cmd "mount mocksrv:/"
+assert_bash_exec {OLDPATH="$PATH"; PATH="$TESTDIR/fixtures/mount/bin:$PATH";}
+# This needs an explicit cword param or will output "unresolved".
+assert_complete $expected $cmd $test "/@" 20 "/"
+sync_after_int
+assert_bash_exec {PATH="$OLDPATH"; unset -v OLDPATH}
+
+
+sync_after_int
+
+
+set test "Testing internal __linux_fstab_unescape function for mount"
+# One round of slashes is for bash.
+assert_bash_exec {var=one\'two\\040three\\}
+assert_bash_exec {__linux_fstab_unescape var}
+set cmd {echo $var}
+send "$cmd\r"
+expect {
+ -ex "$cmd\r\none'two three\\" { pass $test }
+# default { fail $test }
+}
+sync_after_int
+assert_bash_exec {unset var}
+
+
+sync_after_int
+
+
+# Begin testing through mnt (see setup_dummy_mnt).
+assert_complete {/mnt/nice-test-path} {mnt /mnt/nice-test-p}
+sync_after_int
+
+assert_complete {/mnt/nice\ test-path} {mnt /mnt/nice\ test-p}
+sync_after_int
+
+assert_complete {/mnt/nice\$test-path} {mnt /mnt/nice\$test-p}
+sync_after_int
+
+assert_complete {/mnt/nice\ test\\path} {mnt /mnt/nice\ test\\p}
+sync_after_int
+
+assert_complete {{/mnt/nice\ test\\path} {/mnt/nice\ test-path}} \
+ {mnt /mnt/nice\ } "" /@ 20 {/mnt/nice\ }
+sync_after_int
+
+assert_complete {/mnt/nice\$test-path} {mnt /mnt/nice\$}
+sync_after_int
+
+assert_complete {/mnt/nice\'test-path} {mnt /mnt/nice\'}
+sync_after_int
+
+assert_complete {/mnt/other\'test\ path} {mnt /mnt/other}
+sync_after_int
+
+assert_complete {Ubuntu\ Karmic} {mnt -L Ubu}
+sync_after_int
+
+assert_complete {Debian-it\'s\ awesome} {mnt -L Deb}
+sync_after_int
+
+# This does not work. Proper support for this requires smarter parsing of
+# $COMP_LINE and it's not worth doing just for mount.
+#assert_complete {$'/mnt/nice\ntest-path'} {mnt $'/mnt/nice\n}
+#sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/mplayer.exp b/test/lib/completions/mplayer.exp
new file mode 100644
index 00000000..69e5d971
--- /dev/null
+++ b/test/lib/completions/mplayer.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "mplayer "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/msgsnarf.exp b/test/lib/completions/msgsnarf.exp
new file mode 100644
index 00000000..74f458ff
--- /dev/null
+++ b/test/lib/completions/msgsnarf.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "msgsnarf -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/mtx.exp b/test/lib/completions/mtx.exp
new file mode 100644
index 00000000..a518d79f
--- /dev/null
+++ b/test/lib/completions/mtx.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "mtx "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/mutt.exp b/test/lib/completions/mutt.exp
new file mode 100644
index 00000000..6c727daf
--- /dev/null
+++ b/test/lib/completions/mutt.exp
@@ -0,0 +1,33 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified {/OLDPWD=/d}
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "mutt -"
+
+
+sync_after_int
+
+
+set test "mutt should complete mailboxes"
+set expected {foo/ bar/ muttrc}
+assert_complete_dir $expected "mutt -F muttrc -f =" fixtures/mutt
+
+
+set test "mutt should complete aliases"
+set expected {a1 a2}
+assert_complete_dir $expected "mutt -F muttrc -A " fixtures/mutt
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/muttng.exp b/test/lib/completions/muttng.exp
new file mode 100644
index 00000000..25a474ad
--- /dev/null
+++ b/test/lib/completions/muttng.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "muttng -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/mv.exp b/test/lib/completions/mv.exp
new file mode 100644
index 00000000..f2576df7
--- /dev/null
+++ b/test/lib/completions/mv.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "mv "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/mysqladmin.exp b/test/lib/completions/mysqladmin.exp
new file mode 100644
index 00000000..76381587
--- /dev/null
+++ b/test/lib/completions/mysqladmin.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "mysqladmin -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/ncftp.exp b/test/lib/completions/ncftp.exp
new file mode 100644
index 00000000..ad71f226
--- /dev/null
+++ b/test/lib/completions/ncftp.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "ncftp "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/netstat.exp b/test/lib/completions/netstat.exp
new file mode 100644
index 00000000..0e6414d6
--- /dev/null
+++ b/test/lib/completions/netstat.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "netstat "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/newlist.exp b/test/lib/completions/newlist.exp
new file mode 100644
index 00000000..bebf600d
--- /dev/null
+++ b/test/lib/completions/newlist.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "newlist "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/nl.exp b/test/lib/completions/nl.exp
new file mode 100644
index 00000000..02076dff
--- /dev/null
+++ b/test/lib/completions/nl.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "nl "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/nm.exp b/test/lib/completions/nm.exp
new file mode 100644
index 00000000..551f49e9
--- /dev/null
+++ b/test/lib/completions/nm.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "nm "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/ntpdate.exp b/test/lib/completions/ntpdate.exp
new file mode 100644
index 00000000..6a6456f4
--- /dev/null
+++ b/test/lib/completions/ntpdate.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "ntpdate -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/objcopy.exp b/test/lib/completions/objcopy.exp
new file mode 100644
index 00000000..acb6539a
--- /dev/null
+++ b/test/lib/completions/objcopy.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "objcopy "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/objdump.exp b/test/lib/completions/objdump.exp
new file mode 100644
index 00000000..5eec35d6
--- /dev/null
+++ b/test/lib/completions/objdump.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "objdump "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/od.exp b/test/lib/completions/od.exp
new file mode 100644
index 00000000..5838218c
--- /dev/null
+++ b/test/lib/completions/od.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "od "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/openssl.exp b/test/lib/completions/openssl.exp
new file mode 100644
index 00000000..651e5e6d
--- /dev/null
+++ b/test/lib/completions/openssl.exp
@@ -0,0 +1,28 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+set test "Tab should complete"
+ # Try completion
+set cmd "openssl "
+send "$cmd\t"
+expect {
+ -re "^$cmd\r\n.*$cmd$" { pass "$test" }
+ -re /@ { unresolved "$test at prompt" }
+ -re eof { unresolved "eof" }
+}; # expect
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/p4.exp b/test/lib/completions/p4.exp
new file mode 100644
index 00000000..369d2c6b
--- /dev/null
+++ b/test/lib/completions/p4.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "p4 "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/pack200.exp b/test/lib/completions/pack200.exp
new file mode 100644
index 00000000..f96eff13
--- /dev/null
+++ b/test/lib/completions/pack200.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "pack200 "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/paste.exp b/test/lib/completions/paste.exp
new file mode 100644
index 00000000..3a4e93be
--- /dev/null
+++ b/test/lib/completions/paste.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "paste "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/patch.exp b/test/lib/completions/patch.exp
new file mode 100644
index 00000000..a44fa130
--- /dev/null
+++ b/test/lib/completions/patch.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "patch "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/perl.exp b/test/lib/completions/perl.exp
new file mode 100644
index 00000000..2199c994
--- /dev/null
+++ b/test/lib/completions/perl.exp
@@ -0,0 +1,95 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "perl "
+
+
+sync_after_int
+
+
+set test "Second argument should file complete"
+set cmd "perl foo fixtures/shared/default/f"
+send "$cmd\t"
+expect {
+ -re "^$cmd\r\nfoo +foo.d/ *\r\n/@${cmd}oo$" { pass "$test" }
+ -re /@ { unresolved "$test at prompt" }
+ -re eof { unresolved "eof" }
+}
+
+
+sync_after_int
+
+
+set test "-I without space should complete directories"
+set cmd "perl -Ifixtures/shared/default/"
+send "$cmd\t"
+expect {
+ -re "^$cmd\r\nbar bar.d/ +foo.d/ *\r\n/@$cmd$" { pass "$test" }
+ -re /@ { unresolved "$test at prompt" }
+ -re eof { unresolved "eof" }
+}
+
+
+sync_after_int
+
+
+set test "-I with space should complete directories"
+set cmd "perl -I fixtures/shared/default/"
+send "$cmd\t"
+expect {
+ -re "^$cmd\r\nbar bar.d/ +foo.d/ *\r\n/@$cmd$" { pass "$test" }
+ -re /@ { unresolved "$test at prompt" }
+ -re eof { unresolved "eof" }
+}
+
+
+sync_after_int
+
+
+set test "-x without space should complete directories"
+set cmd "perl -xfixtures/shared/default/b"
+send "$cmd\t"
+expect {
+ -re "^${cmd}ar\\\\ bar.d/ *$" { pass "$test" }
+ -re /@ { unresolved "$test at prompt" }
+ -re eof { unresolved "eof" }
+}
+
+
+sync_after_int
+
+
+set test "-x with space should complete directories"
+set cmd "perl -x fixtures/shared/default/b"
+send "$cmd\t"
+expect {
+ -re "^${cmd}ar\\\\ bar.d/ *$" { pass "$test" }
+ -re /@ { unresolved "$test at prompt" }
+ -re eof { unresolved "eof" }
+}
+
+
+sync_after_int
+
+
+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 -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/perldoc.exp b/test/lib/completions/perldoc.exp
new file mode 100644
index 00000000..b3ff83b3
--- /dev/null
+++ b/test/lib/completions/perldoc.exp
@@ -0,0 +1,38 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "perldoc -"
+
+
+sync_after_int
+
+
+set test "perldoc should complete word containing colons"
+set cmd "perldoc File::"
+send "$cmd\t"
+expect {
+ # Assuming the module `File::Path' is always installed
+ -re "\\sPath\\s" { pass "$test" }
+ # Assuming there's no perl module named `fixtures', but only our directory
+ # `test/fixtures' which is presented falsely.
+ -re "\\sfixtures/\\s" { fail "$test" }
+ -re "perldoc File::File::" { fail "$test" }
+ -re /@ { unresolved "$test" }
+ default { unresolved "$test" }
+}; # expect
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/pgrep.exp b/test/lib/completions/pgrep.exp
new file mode 100644
index 00000000..63143acc
--- /dev/null
+++ b/test/lib/completions/pgrep.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "pgrep "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/pine.exp b/test/lib/completions/pine.exp
new file mode 100644
index 00000000..0a0c3f40
--- /dev/null
+++ b/test/lib/completions/pine.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "pine "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/ping.exp b/test/lib/completions/ping.exp
new file mode 100644
index 00000000..b600849b
--- /dev/null
+++ b/test/lib/completions/ping.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "ping "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/pkg-config.exp b/test/lib/completions/pkg-config.exp
new file mode 100644
index 00000000..477dba08
--- /dev/null
+++ b/test/lib/completions/pkg-config.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "pkg-config -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/pkg_deinstall.exp b/test/lib/completions/pkg_deinstall.exp
new file mode 100644
index 00000000..8f3d8c3d
--- /dev/null
+++ b/test/lib/completions/pkg_deinstall.exp
@@ -0,0 +1,22 @@
+proc setup {} {
+ assert_bash_exec {PKG_DBDIR=fixtures/pkgtools/db}
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+set pkgs [exec bash -c "cd fixtures/pkgtools/db ; compgen -d"]
+assert_complete $pkgs "pkg_deinstall "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/pkg_delete.exp b/test/lib/completions/pkg_delete.exp
new file mode 100644
index 00000000..b0c1a2a5
--- /dev/null
+++ b/test/lib/completions/pkg_delete.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "pkg_delete "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/pkg_info.exp b/test/lib/completions/pkg_info.exp
new file mode 100644
index 00000000..3f253ccf
--- /dev/null
+++ b/test/lib/completions/pkg_info.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "pkg_info "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/pkill.exp b/test/lib/completions/pkill.exp
new file mode 100644
index 00000000..0333fc94
--- /dev/null
+++ b/test/lib/completions/pkill.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "pkill "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/portinstall.exp b/test/lib/completions/portinstall.exp
new file mode 100644
index 00000000..d70f5db6
--- /dev/null
+++ b/test/lib/completions/portinstall.exp
@@ -0,0 +1,22 @@
+proc setup {} {
+ assert_bash_exec {PORTSDIR=fixtures/pkgtools/ports ; sed -e s,PORTSDIR,$PORTSDIR,g $PORTSDIR/INDEX.dist > $PORTSDIR/INDEX ; cp $PORTSDIR/INDEX $PORTSDIR/INDEX-5}
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_bash_exec {rm fixtures/pkgtools/ports/INDEX fixtures/pkgtools/ports/INDEX-5}
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete "bash-2.05b.007_6 bash-3.1.17 bash-completion-20060301_2 shells/bash shells/bash-completion shells/bash2" "portinstall "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/portupgrade.exp b/test/lib/completions/portupgrade.exp
new file mode 100644
index 00000000..cb583923
--- /dev/null
+++ b/test/lib/completions/portupgrade.exp
@@ -0,0 +1,21 @@
+proc setup {} {
+ assert_bash_exec {PKG_DBDIR=fixtures/pkgtools/db}
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete "a b-c-d" "portupgrade "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/povray.exp b/test/lib/completions/povray.exp
new file mode 100644
index 00000000..1efeeddb
--- /dev/null
+++ b/test/lib/completions/povray.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "povray "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/pr.exp b/test/lib/completions/pr.exp
new file mode 100644
index 00000000..5d7a96c3
--- /dev/null
+++ b/test/lib/completions/pr.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "pr "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/psql.exp b/test/lib/completions/psql.exp
new file mode 100644
index 00000000..56d56666
--- /dev/null
+++ b/test/lib/completions/psql.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "psql -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/ptx.exp b/test/lib/completions/ptx.exp
new file mode 100644
index 00000000..2defe049
--- /dev/null
+++ b/test/lib/completions/ptx.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "ptx "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/pvchange.exp b/test/lib/completions/pvchange.exp
new file mode 100644
index 00000000..fd4b73d0
--- /dev/null
+++ b/test/lib/completions/pvchange.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "pvchange --"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/pvcreate.exp b/test/lib/completions/pvcreate.exp
new file mode 100644
index 00000000..47cebf7a
--- /dev/null
+++ b/test/lib/completions/pvcreate.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "pvcreate --"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/pvdisplay.exp b/test/lib/completions/pvdisplay.exp
new file mode 100644
index 00000000..151064cd
--- /dev/null
+++ b/test/lib/completions/pvdisplay.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "pvdisplay --"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/pvmove.exp b/test/lib/completions/pvmove.exp
new file mode 100644
index 00000000..81c05e98
--- /dev/null
+++ b/test/lib/completions/pvmove.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "pvmove --"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/pvremove.exp b/test/lib/completions/pvremove.exp
new file mode 100644
index 00000000..dd145bf6
--- /dev/null
+++ b/test/lib/completions/pvremove.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "pvremove --"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/pvs.exp b/test/lib/completions/pvs.exp
new file mode 100644
index 00000000..6e5527e1
--- /dev/null
+++ b/test/lib/completions/pvs.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "pvs --"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/pvscan.exp b/test/lib/completions/pvscan.exp
new file mode 100644
index 00000000..e92cdbe0
--- /dev/null
+++ b/test/lib/completions/pvscan.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "pvscan --"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/python.exp b/test/lib/completions/python.exp
new file mode 100644
index 00000000..c9d70b43
--- /dev/null
+++ b/test/lib/completions/python.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "python "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/qrunner.exp b/test/lib/completions/qrunner.exp
new file mode 100644
index 00000000..b8fcf191
--- /dev/null
+++ b/test/lib/completions/qrunner.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "qrunner -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/querybts.exp b/test/lib/completions/querybts.exp
new file mode 100644
index 00000000..dc75cd62
--- /dev/null
+++ b/test/lib/completions/querybts.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "querybts --"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/rcs.exp b/test/lib/completions/rcs.exp
new file mode 100644
index 00000000..19ae4d50
--- /dev/null
+++ b/test/lib/completions/rcs.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "rcs "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/rcsdiff.exp b/test/lib/completions/rcsdiff.exp
new file mode 100644
index 00000000..8383cdb9
--- /dev/null
+++ b/test/lib/completions/rcsdiff.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "rcsdiff "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/rdict.exp b/test/lib/completions/rdict.exp
new file mode 100644
index 00000000..aa132617
--- /dev/null
+++ b/test/lib/completions/rdict.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "rdict --"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/readelf.exp b/test/lib/completions/readelf.exp
new file mode 100644
index 00000000..a084a41e
--- /dev/null
+++ b/test/lib/completions/readelf.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "readelf --"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/readonly.exp b/test/lib/completions/readonly.exp
new file mode 100644
index 00000000..84be3c96
--- /dev/null
+++ b/test/lib/completions/readonly.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "readonly BASH_ARG"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/remove_members.exp b/test/lib/completions/remove_members.exp
new file mode 100644
index 00000000..63d6a70e
--- /dev/null
+++ b/test/lib/completions/remove_members.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "remove_members --"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/removepkg.exp b/test/lib/completions/removepkg.exp
new file mode 100644
index 00000000..7cf98805
--- /dev/null
+++ b/test/lib/completions/removepkg.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "removepkg "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/renice.exp b/test/lib/completions/renice.exp
new file mode 100644
index 00000000..c91e0212
--- /dev/null
+++ b/test/lib/completions/renice.exp
@@ -0,0 +1,42 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+set test "Tab should show complete process ids"
+ # Try completion
+set cmd "renice 1"
+send "$cmd\t"
+expect {
+ -re "$cmd\r\n\\d+.*/@$cmd$" { pass "$test" }
+ -re /@ { unresolved "$test at prompt" }
+ -re eof { unresolved "eof" }
+}; # expect
+
+
+sync_after_int
+
+
+set test "Tab should show complete process group ids"
+ # Try completion
+set cmd "renice -g "
+send "$cmd\t"
+expect {
+ -re "$cmd\r\n\\d+.*/@$cmd$" { pass "$test" }
+ -re /@ { unresolved "$test at prompt" }
+ -re eof { unresolved "eof" }
+}; # expect
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/reportbug.exp b/test/lib/completions/reportbug.exp
new file mode 100644
index 00000000..1f66df2c
--- /dev/null
+++ b/test/lib/completions/reportbug.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "reportbug --m"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/ri.exp b/test/lib/completions/ri.exp
new file mode 100644
index 00000000..160dc9a7
--- /dev/null
+++ b/test/lib/completions/ri.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "ri "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/rlog.exp b/test/lib/completions/rlog.exp
new file mode 100644
index 00000000..cbc06857
--- /dev/null
+++ b/test/lib/completions/rlog.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "rlog "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/rm.exp b/test/lib/completions/rm.exp
new file mode 100644
index 00000000..ae670e83
--- /dev/null
+++ b/test/lib/completions/rm.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "rm "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/rmdir.exp b/test/lib/completions/rmdir.exp
new file mode 100644
index 00000000..2b23a9c5
--- /dev/null
+++ b/test/lib/completions/rmdir.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "rmdir "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/rmlist.exp b/test/lib/completions/rmlist.exp
new file mode 100644
index 00000000..91519ee8
--- /dev/null
+++ b/test/lib/completions/rmlist.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "rmlist -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/rpcdebug.exp b/test/lib/completions/rpcdebug.exp
new file mode 100644
index 00000000..8629c947
--- /dev/null
+++ b/test/lib/completions/rpcdebug.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "rpcdebug -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/rpm.exp b/test/lib/completions/rpm.exp
new file mode 100644
index 00000000..3ed154a9
--- /dev/null
+++ b/test/lib/completions/rpm.exp
@@ -0,0 +1,29 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "rpm "
+
+
+sync_after_int
+
+
+ # Build list of installed packages
+if {[assert_exec {rpm -qa --qf=%\{NAME\}\n | sort -u} packages]} {
+ assert_complete $packages "rpm -q "
+}; # if
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/rsync.exp b/test/lib/completions/rsync.exp
new file mode 100644
index 00000000..fb301a35
--- /dev/null
+++ b/test/lib/completions/rsync.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "rsync "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/rtcwake.exp b/test/lib/completions/rtcwake.exp
new file mode 100644
index 00000000..0b9a974b
--- /dev/null
+++ b/test/lib/completions/rtcwake.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "rtcwake "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/sbcl-mt.exp b/test/lib/completions/sbcl-mt.exp
new file mode 100644
index 00000000..45e81f79
--- /dev/null
+++ b/test/lib/completions/sbcl-mt.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete {bar "bar bar.d/" foo foo.d/} "sbcl-mt fixtures/shared/default/"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/sbcl.exp b/test/lib/completions/sbcl.exp
new file mode 100644
index 00000000..b68b2dce
--- /dev/null
+++ b/test/lib/completions/sbcl.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete {bar "bar bar.d/" foo foo.d/} "sbcl fixtures/shared/default/"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/scp.exp b/test/lib/completions/scp.exp
new file mode 100644
index 00000000..efe2b686
--- /dev/null
+++ b/test/lib/completions/scp.exp
@@ -0,0 +1,121 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified {
+ /BASH_LINENO=/d
+ /BASH_SOURCE=/d
+ /OLDPWD=/d
+ }
+}; # teardown()
+
+
+setup
+
+
+set test "Tab should complete remote pwd"
+set host bash_completion
+
+ # Retrieving home directory (host_pwd) from ssh-host `bash_completion'
+ # yields error?
+if {
+ [catch {
+ exec -- ssh -o "Batchmode yes" -o "ConnectTimeout 1" $host pwd 2>> /dev/null
+ } host_pwd]
+} {
+ # Yes, retrieving pwd from ssh yields error; reset `host_pwd'
+ # Indicate host pwd is unknown and test is unsupported
+ # NOTE: To support this test, set the hostname "bash_completion"
+ # in `$HOME/.ssh/config' or `/etc/ssh_config'
+ set host_pwd ""
+ unsupported $test
+}; # if
+
+
+ # Try completion
+set cmd "scp $host:"
+send "$cmd\t"
+sync_after_tab
+expect {
+ -re "^$cmd$host_pwd.*$" { pass "$test" }
+ -re /@ { unresolved "$test at prompt" }
+}; # expect
+
+
+sync_after_int
+
+
+set test "Tab should complete known-hosts"
+
+ # Build string list of expected completions
+ # Get hostnames and give them a colon (:) suffix
+ # Hosts `gee' and `hus' are defined in ./fixtures/scp/config
+ # Hosts `doo' and `ike' are defined in ./fixtures/scp/known_hosts
+set expected {}
+foreach host [get_hosts] {
+ lappend expected "$host:"
+}; # foreach
+lappend expected doo: gee: hus: ike:
+ # Append local filenames
+lappend expected config known_hosts "spaced\\ \\ conf"
+set dir fixtures/scp
+assert_complete_dir $expected "scp -F config " $dir
+
+
+sync_after_int
+
+
+set test "-F without space shouldn't error"
+ # Try completion
+set cmd "scp -F"
+send "$cmd\t "
+expect {
+ -re "^${cmd}bash: option requires an argument -- F" { fail "$test" }
+ -re "^$cmd\r\n.*\r\n/@" { pass "$test" }
+ -re /@ { unresolved "$test at prompt" }
+ default { unresolved "$test" }
+}; # expect
+
+
+sync_after_int
+
+
+set test "Config file containing space should work"
+ # Build string list of expected completions
+ # Get hostnames and give them a colon (:) suffix
+set expected {}
+foreach host [get_hosts] {
+ lappend expected "$host:"
+}; # foreach
+ # Hosts `gee', `hus' and `jar' are defined in "./fixtures/scp/spaced conf"
+ # Hosts `doo' and `ike' are defined in ./fixtures/scp/known_hosts
+lappend expected doo: gee: hus: ike: jar:
+ # Append local filenames
+lappend expected config known_hosts "spaced\\ \\ conf"
+set dir fixtures/scp
+#assert_complete_dir $expected "scp -F 'spaced conf' " $dir
+set prompt "/$dir/@"
+assert_bash_exec "cd $dir" "" $prompt
+set cmd "scp -F 'spaced conf' "
+send "$cmd\t"
+expect -ex "$cmd\r\n"
+if {[match_items [lsort -unique $expected] $test]} {
+ expect {
+ -re $prompt { pass "$test" }
+ -re eof { unresolved "eof" }
+ }; # expect
+} 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"}
+}; # if
+sync_after_int $prompt
+assert_bash_exec {cd "$TESTDIR"}
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/screen.exp b/test/lib/completions/screen.exp
new file mode 100644
index 00000000..985862c1
--- /dev/null
+++ b/test/lib/completions/screen.exp
@@ -0,0 +1,52 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified {/OLDPWD=/d}
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "screen -"
+
+
+sync_after_int
+
+
+set test "-c should complete files/dirs"
+set dir fixtures/shared/default
+set prompt "/$dir/@"
+assert_bash_exec "cd $dir" "" $prompt
+set cmd "screen -c "
+set expected {bar {bar bar.d} foo {foo.d}}
+send "$cmd\t"
+expect -ex "$cmd"
+expect {
+ -re "\r\nbar\\s+bar bar.d/\\s+foo\\s+foo.d/" { pass "$test" }
+ # Directories might not be suffixed with a slash (/). This is because
+ # _filedir only works if `-o filenames' is in effect, which isn't the
+ # case for `screen' on bash-3, so an expected failure (xfail)
+ -re "\r\nbar\\s+bar bar.d\\s+foo\\s+foo.d" {
+ if {[lindex $::BASH_VERSINFO 0] < 4} {xfail "$test"} {fail "$test"}
+ }
+ -re "\r\nbar\\s+bar\\\\ bar.d/\\s+foo\\s+foo.d/" {
+ # On bash-3, the space in `bar bar.d' is escaped with a backslash
+ # as a side-effect of emulating `-o filenames'.
+ if {[lindex $::BASH_VERSINFO 0] <= 3} {pass "$test"} {fail "$test"}
+ }
+ -re $prompt { unresolved "$test at prompt" }
+ default { unresolved "$test" }
+}; # expect
+sync_after_int $prompt
+assert_bash_exec {cd "$TESTDIR"}
+
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/sed.exp b/test/lib/completions/sed.exp
new file mode 100644
index 00000000..8764cfb8
--- /dev/null
+++ b/test/lib/completions/sed.exp
@@ -0,0 +1,22 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+if {[assert_exec {sed --help} "" "" "unsupported"]} {
+ assert_complete_any "sed --"
+}; # if
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/seq.exp b/test/lib/completions/seq.exp
new file mode 100644
index 00000000..b5333ef9
--- /dev/null
+++ b/test/lib/completions/seq.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "seq --"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/service.exp b/test/lib/completions/service.exp
new file mode 100644
index 00000000..917c5dcb
--- /dev/null
+++ b/test/lib/completions/service.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "service "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/set.exp b/test/lib/completions/set.exp
new file mode 100644
index 00000000..2b2d40e9
--- /dev/null
+++ b/test/lib/completions/set.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "set no"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/sftp.exp b/test/lib/completions/sftp.exp
new file mode 100644
index 00000000..24c37cb5
--- /dev/null
+++ b/test/lib/completions/sftp.exp
@@ -0,0 +1,77 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified {
+ /BASH_LINENO=/d
+ /BASH_SOURCE=/d
+ /OLDPWD=/d
+ }
+}; # teardown()
+
+
+setup
+
+
+ # Build string list of expected completions
+set expected [get_hosts]
+ # Hosts `gee' and `hus' are defined in ./fixtures/sftp/config
+ # Hosts `doo' and `ike' are defined in ./fixtures/sftp/known_hosts
+lappend expected doo gee hus ike
+set dir fixtures/scp
+assert_complete_dir $expected "sftp -F config " $dir
+
+
+sync_after_int
+
+
+set test "-F without space shouldn't error"
+ # Try completion
+set cmd "sftp -F"
+send "$cmd\t "
+expect {
+ -re "^${cmd}bash: option requires an argument -- F" { fail "$test" }
+ -re "^$cmd\r\n.*\r\n/@" { pass "$test" }
+ -re /@ { unresolved "$test at prompt" }
+ default { unresolved "$test" }
+}; # expect
+
+
+sync_after_int
+
+
+ # Build string list of expected completions
+ # Get hostnames and give them a colon (:) suffix
+set expected [get_hosts]
+ # Hosts `gee', `hus' and `jar' are defined in "./fixtures/scp/spaced conf"
+ # Hosts `doo' and `ike' are defined in ./fixtures/scp/known_hosts
+lappend expected doo gee hus ike jar
+set dir fixtures/sftp
+assert_complete_dir $expected "sftp -F spaced\\ \\ conf " $dir
+
+
+sync_after_int
+
+
+set test "-F should complete filename"
+set dir fixtures/sftp
+set prompt "/$dir/@"
+assert_bash_exec "cd $dir" "" $prompt
+set cmd "ssh -Fsp"
+send "$cmd\t"
+expect -ex "$cmd"
+expect {
+ -ex "aced\\ \\ conf" { pass "$test" }
+ # _filedir works only if `-o filenames' is in effect, which isn't the
+ # case for `sftp'
+ -re "aced conf" { xfail "$test" }
+ -re $prompt { unresolved "$test at prompt" }
+ default { unresolved "$test" }
+}; # expect
+sync_after_int $prompt
+assert_bash_exec {cd "$TESTDIR"}
+
+
+teardown
diff --git a/test/lib/completions/sha1sum.exp b/test/lib/completions/sha1sum.exp
new file mode 100644
index 00000000..17519087
--- /dev/null
+++ b/test/lib/completions/sha1sum.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "sha1sum --"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/shar.exp b/test/lib/completions/shar.exp
new file mode 100644
index 00000000..7ace9d6e
--- /dev/null
+++ b/test/lib/completions/shar.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "shar --"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/sitecopy.exp b/test/lib/completions/sitecopy.exp
new file mode 100644
index 00000000..49b78918
--- /dev/null
+++ b/test/lib/completions/sitecopy.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "sitecopy --"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/smartctl.exp b/test/lib/completions/smartctl.exp
new file mode 100644
index 00000000..a9eeb956
--- /dev/null
+++ b/test/lib/completions/smartctl.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "smartctl --"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/snownews.exp b/test/lib/completions/snownews.exp
new file mode 100644
index 00000000..7502e587
--- /dev/null
+++ b/test/lib/completions/snownews.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "snownews --"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/sort.exp b/test/lib/completions/sort.exp
new file mode 100644
index 00000000..20516cc8
--- /dev/null
+++ b/test/lib/completions/sort.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "sort --"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/split.exp b/test/lib/completions/split.exp
new file mode 100644
index 00000000..b74da369
--- /dev/null
+++ b/test/lib/completions/split.exp
@@ -0,0 +1,22 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+if {[assert_exec {split --help} "" "" "unsupported"]} {
+ assert_complete_any "split --"
+}; # if
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/spovray.exp b/test/lib/completions/spovray.exp
new file mode 100644
index 00000000..30d81853
--- /dev/null
+++ b/test/lib/completions/spovray.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "spovray "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/ssh.exp b/test/lib/completions/ssh.exp
new file mode 100644
index 00000000..91955c1d
--- /dev/null
+++ b/test/lib/completions/ssh.exp
@@ -0,0 +1,93 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified {
+ /BASH_LINENO=/d
+ /BASH_SOURCE=/d
+ /OLDPWD=/d
+ }
+}; # teardown()
+
+
+setup
+
+
+set test "Tab should complete both commands and hostname"
+ # Try completion
+set dir fixtures/ssh
+set prompt "/$dir/@"
+assert_bash_exec "cd $dir" "" $prompt
+set cmd "ssh -F config ls"
+send "$cmd\t"
+set expected "^$cmd\r\n.*ls.*ls_known_host.*\r\n$prompt$cmd$"
+expect {
+ -re $expected { pass "$test" }
+ -re $prompt { unresolved "$test at prompt" }
+ default { unresolved "$test" }
+}; # expect
+sync_after_int $prompt
+assert_bash_exec {cd "$TESTDIR"}
+
+
+sync_after_int
+
+
+set test "-F without space shouldn't error"
+ # Try completion
+set cmd "ssh -F"
+send "$cmd\t "
+set expected "^$cmd $"
+expect {
+ -re "^${cmd}bash: option requires an argument -- F" { fail "$test" }
+ -re "^$cmd\r\n.*\r\n/@" { pass "$test" }
+ -re /@ { unresolved "$test at prompt" }
+ default { unresolved "$test" }
+}; # expect
+
+
+sync_after_int
+
+
+set test "First argument shouldn't complete with commands"
+# NOTE: This test assumes there's a command "bash" and no host named "bash"
+set cmd "ssh bas"
+assert_complete [get_known_hosts "bas"] $cmd $test
+
+
+sync_after_int
+
+
+set test "First argument should complete partial hostname"
+assert_complete_partial [get_hosts] ssh "" $test /@ 20 \
+ [list "ltrim_colon_completions"]
+
+
+sync_after_int
+
+
+set test "-F should complete filename"
+set dir fixtures/ssh
+set prompt "/$dir/@"
+assert_bash_exec "cd $dir" "" $prompt
+set cmd "ssh -Fsp"
+send "$cmd\t"
+expect -ex "$cmd"
+expect {
+ -ex "aced\\ \\ conf" { pass "$test" }
+ # _filedir works only if `-o filenames' is in effect, which isn't the
+ # case for `ssh'
+ -re "aced conf" { xfail "$test" }
+ -re $prompt { unresolved "$test at prompt" }
+ default { unresolved "$test" }
+}; # expect
+sync_after_int $prompt
+assert_bash_exec {cd "$TESTDIR"}
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/sshmitm.exp b/test/lib/completions/sshmitm.exp
new file mode 100644
index 00000000..b8f8a2c9
--- /dev/null
+++ b/test/lib/completions/sshmitm.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "sshmitm -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/sshow.exp b/test/lib/completions/sshow.exp
new file mode 100644
index 00000000..36a6cc2c
--- /dev/null
+++ b/test/lib/completions/sshow.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "sshow -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/strace.exp b/test/lib/completions/strace.exp
new file mode 100644
index 00000000..55004d20
--- /dev/null
+++ b/test/lib/completions/strace.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "strace -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/strip.exp b/test/lib/completions/strip.exp
new file mode 100644
index 00000000..46d9f362
--- /dev/null
+++ b/test/lib/completions/strip.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "strip --"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/sudo.exp b/test/lib/completions/sudo.exp
new file mode 100644
index 00000000..1299a6da
--- /dev/null
+++ b/test/lib/completions/sudo.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete "fixtures/shared/default/foo.d/" "sudo cd fixtures/shared/default/fo"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/svk.exp b/test/lib/completions/svk.exp
new file mode 100644
index 00000000..a08674dc
--- /dev/null
+++ b/test/lib/completions/svk.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "svk "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/svn.exp b/test/lib/completions/svn.exp
new file mode 100644
index 00000000..fe40d6f7
--- /dev/null
+++ b/test/lib/completions/svn.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "svn "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/svnadmin.exp b/test/lib/completions/svnadmin.exp
new file mode 100644
index 00000000..35e07021
--- /dev/null
+++ b/test/lib/completions/svnadmin.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "svnadmin "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/svnlook.exp b/test/lib/completions/svnlook.exp
new file mode 100644
index 00000000..33b67052
--- /dev/null
+++ b/test/lib/completions/svnlook.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "svnlook "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/sync_members.exp b/test/lib/completions/sync_members.exp
new file mode 100644
index 00000000..4cb84ad8
--- /dev/null
+++ b/test/lib/completions/sync_members.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "sync_members --"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/sysctl.exp b/test/lib/completions/sysctl.exp
new file mode 100644
index 00000000..e1866f55
--- /dev/null
+++ b/test/lib/completions/sysctl.exp
@@ -0,0 +1,22 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+if {[assert_exec {sysctl -N -a 2>/dev/null | grep ^kern | sort -u} values]} {
+ assert_complete $values "sysctl kern"
+}; # if
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/tac.exp b/test/lib/completions/tac.exp
new file mode 100644
index 00000000..21230052
--- /dev/null
+++ b/test/lib/completions/tac.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "tac --"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/tail.exp b/test/lib/completions/tail.exp
new file mode 100644
index 00000000..c8a82d97
--- /dev/null
+++ b/test/lib/completions/tail.exp
@@ -0,0 +1,22 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+if {[assert_exec {tail --help} "" "" "unsupported"]} {
+ assert_complete_any "tail --"
+}; # if
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/tar.exp b/test/lib/completions/tar.exp
new file mode 100644
index 00000000..43c60ff9
--- /dev/null
+++ b/test/lib/completions/tar.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "tar "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/tcpkill.exp b/test/lib/completions/tcpkill.exp
new file mode 100644
index 00000000..e8cc9c10
--- /dev/null
+++ b/test/lib/completions/tcpkill.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "tcpkill -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/tcpnice.exp b/test/lib/completions/tcpnice.exp
new file mode 100644
index 00000000..44bb59c6
--- /dev/null
+++ b/test/lib/completions/tcpnice.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "tcpnice -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/tee.exp b/test/lib/completions/tee.exp
new file mode 100644
index 00000000..c25057ba
--- /dev/null
+++ b/test/lib/completions/tee.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "tee "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/texindex.exp b/test/lib/completions/texindex.exp
new file mode 100644
index 00000000..d5b8cd77
--- /dev/null
+++ b/test/lib/completions/texindex.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "texindex --"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/tightvncviewer.exp b/test/lib/completions/tightvncviewer.exp
new file mode 100644
index 00000000..6eba24c2
--- /dev/null
+++ b/test/lib/completions/tightvncviewer.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "tightvncviewer "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/time.exp b/test/lib/completions/time.exp
new file mode 100644
index 00000000..b114318b
--- /dev/null
+++ b/test/lib/completions/time.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "time set"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/touch.exp b/test/lib/completions/touch.exp
new file mode 100644
index 00000000..f0960ef7
--- /dev/null
+++ b/test/lib/completions/touch.exp
@@ -0,0 +1,22 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+if {[assert_exec {touch --help} "" "" "unsupported"]} {
+ assert_complete_any "touch --"
+}; # if
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/tr.exp b/test/lib/completions/tr.exp
new file mode 100644
index 00000000..68b11a36
--- /dev/null
+++ b/test/lib/completions/tr.exp
@@ -0,0 +1,22 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+if {[assert_exec {tr --help} "" "" "unsupported"]} {
+ assert_complete_any "tr --"
+}; # if
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/unace.exp b/test/lib/completions/unace.exp
new file mode 100644
index 00000000..0afbaafb
--- /dev/null
+++ b/test/lib/completions/unace.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "unace -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/uname.exp b/test/lib/completions/uname.exp
new file mode 100644
index 00000000..2179dafd
--- /dev/null
+++ b/test/lib/completions/uname.exp
@@ -0,0 +1,22 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+if {[assert_exec {uname --help} "" "" "unsupported"]} {
+ assert_complete_any "uname --"
+}; # if
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/unexpand.exp b/test/lib/completions/unexpand.exp
new file mode 100644
index 00000000..31822561
--- /dev/null
+++ b/test/lib/completions/unexpand.exp
@@ -0,0 +1,22 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+if {[assert_exec {unexpand --help} "" "" "unsupported"]} {
+ assert_complete_any "unexpand --"
+}; # if
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/uniq.exp b/test/lib/completions/uniq.exp
new file mode 100644
index 00000000..20dbcfac
--- /dev/null
+++ b/test/lib/completions/uniq.exp
@@ -0,0 +1,22 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+if {[assert_exec {uniq --help} "" "" "unsupported"]} {
+ assert_complete_any "uniq --"
+}; # if
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/units.exp b/test/lib/completions/units.exp
new file mode 100644
index 00000000..a40b5f3f
--- /dev/null
+++ b/test/lib/completions/units.exp
@@ -0,0 +1,22 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+if {[assert_exec {units --help} "" "" "unsupported"]} {
+ assert_complete_any "units --"
+}; # if
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/unpack200.exp b/test/lib/completions/unpack200.exp
new file mode 100644
index 00000000..845701dd
--- /dev/null
+++ b/test/lib/completions/unpack200.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "unpack200 "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/unrar.exp b/test/lib/completions/unrar.exp
new file mode 100644
index 00000000..e66e3c8b
--- /dev/null
+++ b/test/lib/completions/unrar.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "unrar -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/unset.exp b/test/lib/completions/unset.exp
new file mode 100644
index 00000000..a5e7fc9b
--- /dev/null
+++ b/test/lib/completions/unset.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "unset BASH_ARG"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/unshunt.exp b/test/lib/completions/unshunt.exp
new file mode 100644
index 00000000..964cac68
--- /dev/null
+++ b/test/lib/completions/unshunt.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "unshunt -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/update-alternatives.exp b/test/lib/completions/update-alternatives.exp
new file mode 100644
index 00000000..10ff4e6d
--- /dev/null
+++ b/test/lib/completions/update-alternatives.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "update-alternatives --"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/update-rc.d.exp b/test/lib/completions/update-rc.d.exp
new file mode 100644
index 00000000..9c2c2464
--- /dev/null
+++ b/test/lib/completions/update-rc.d.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "update-rc.d -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/urlsnarf.exp b/test/lib/completions/urlsnarf.exp
new file mode 100644
index 00000000..c5b26922
--- /dev/null
+++ b/test/lib/completions/urlsnarf.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "urlsnarf -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/vdir.exp b/test/lib/completions/vdir.exp
new file mode 100644
index 00000000..b525c382
--- /dev/null
+++ b/test/lib/completions/vdir.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "vdir "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/vgcfgbackup.exp b/test/lib/completions/vgcfgbackup.exp
new file mode 100644
index 00000000..19ceeeca
--- /dev/null
+++ b/test/lib/completions/vgcfgbackup.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "vgcfgbackup -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/vgcfgrestore.exp b/test/lib/completions/vgcfgrestore.exp
new file mode 100644
index 00000000..e1c3c3b9
--- /dev/null
+++ b/test/lib/completions/vgcfgrestore.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "vgcfgrestore -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/vgchange.exp b/test/lib/completions/vgchange.exp
new file mode 100644
index 00000000..645eedb4
--- /dev/null
+++ b/test/lib/completions/vgchange.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "vgchange -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/vgck.exp b/test/lib/completions/vgck.exp
new file mode 100644
index 00000000..67209b15
--- /dev/null
+++ b/test/lib/completions/vgck.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "vgck -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/vgconvert.exp b/test/lib/completions/vgconvert.exp
new file mode 100644
index 00000000..065c4828
--- /dev/null
+++ b/test/lib/completions/vgconvert.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "vgconvert -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/vgcreate.exp b/test/lib/completions/vgcreate.exp
new file mode 100644
index 00000000..7c324e62
--- /dev/null
+++ b/test/lib/completions/vgcreate.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "vgcreate -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/vgdisplay.exp b/test/lib/completions/vgdisplay.exp
new file mode 100644
index 00000000..b6bc9125
--- /dev/null
+++ b/test/lib/completions/vgdisplay.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "vgdisplay -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/vgexport.exp b/test/lib/completions/vgexport.exp
new file mode 100644
index 00000000..2ad4230e
--- /dev/null
+++ b/test/lib/completions/vgexport.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "vgexport -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/vgextend.exp b/test/lib/completions/vgextend.exp
new file mode 100644
index 00000000..18a491d2
--- /dev/null
+++ b/test/lib/completions/vgextend.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "vgextend -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/vgimport.exp b/test/lib/completions/vgimport.exp
new file mode 100644
index 00000000..e4568f3b
--- /dev/null
+++ b/test/lib/completions/vgimport.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "vgimport -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/vgmerge.exp b/test/lib/completions/vgmerge.exp
new file mode 100644
index 00000000..8ba5e893
--- /dev/null
+++ b/test/lib/completions/vgmerge.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "vgmerge -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/vgmknodes.exp b/test/lib/completions/vgmknodes.exp
new file mode 100644
index 00000000..d24552f0
--- /dev/null
+++ b/test/lib/completions/vgmknodes.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "vgmknodes -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/vgreduce.exp b/test/lib/completions/vgreduce.exp
new file mode 100644
index 00000000..887ba8de
--- /dev/null
+++ b/test/lib/completions/vgreduce.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "vgreduce -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/vgremove.exp b/test/lib/completions/vgremove.exp
new file mode 100644
index 00000000..26dadf95
--- /dev/null
+++ b/test/lib/completions/vgremove.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "vgremove -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/vgrename.exp b/test/lib/completions/vgrename.exp
new file mode 100644
index 00000000..8ddaa758
--- /dev/null
+++ b/test/lib/completions/vgrename.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "vgrename -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/vgs.exp b/test/lib/completions/vgs.exp
new file mode 100644
index 00000000..a27e3650
--- /dev/null
+++ b/test/lib/completions/vgs.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "vgs -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/vgscan.exp b/test/lib/completions/vgscan.exp
new file mode 100644
index 00000000..4bb8c35e
--- /dev/null
+++ b/test/lib/completions/vgscan.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "vgscan -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/vgsplit.exp b/test/lib/completions/vgsplit.exp
new file mode 100644
index 00000000..54e7034f
--- /dev/null
+++ b/test/lib/completions/vgsplit.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "vgsplit -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/vncviewer.exp b/test/lib/completions/vncviewer.exp
new file mode 100644
index 00000000..3d47f49f
--- /dev/null
+++ b/test/lib/completions/vncviewer.exp
@@ -0,0 +1,22 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified {
+ /declare -f _vncviewer_bootstrap/d
+ }
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "vncviewer "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/wc.exp b/test/lib/completions/wc.exp
new file mode 100644
index 00000000..8ad2bf8d
--- /dev/null
+++ b/test/lib/completions/wc.exp
@@ -0,0 +1,22 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+if {[assert_exec {wc --help} "" "" "unsupported"]} {
+ assert_complete_any "wc --"
+}; # if
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/webmitm.exp b/test/lib/completions/webmitm.exp
new file mode 100644
index 00000000..1d48a3a6
--- /dev/null
+++ b/test/lib/completions/webmitm.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "webmitm -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/wget.exp b/test/lib/completions/wget.exp
new file mode 100644
index 00000000..245b27be
--- /dev/null
+++ b/test/lib/completions/wget.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "wget --"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/who.exp b/test/lib/completions/who.exp
new file mode 100644
index 00000000..73928ef7
--- /dev/null
+++ b/test/lib/completions/who.exp
@@ -0,0 +1,22 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+if {[assert_exec {who --help} "" "" "unsupported"]} {
+ assert_complete_any "who --"
+}; # if
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/withlist.exp b/test/lib/completions/withlist.exp
new file mode 100644
index 00000000..6310466d
--- /dev/null
+++ b/test/lib/completions/withlist.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "withlist --"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/wol.exp b/test/lib/completions/wol.exp
new file mode 100644
index 00000000..84a2d88d
--- /dev/null
+++ b/test/lib/completions/wol.exp
@@ -0,0 +1,29 @@
+proc setup {} {
+ # See fixtures/shared/bin/{arp,ifconfig}
+ assert_bash_exec {OLDPATH="$PATH"; PATH="$TESTDIR/fixtures/shared/bin:$PATH";}
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+ assert_bash_exec {PATH="$OLDPATH"; unset -v OLDPATH}
+}; # teardown()
+
+
+setup
+
+
+assert_complete "00:00:00:00:00:00 11:11:11:11:11:11 22:22:22:22:22:22 33:33:33:33:33:33" "wol "
+
+
+sync_after_int
+
+
+assert_complete "00:00:00:00:00:00" "wol 00:"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/wtf.exp b/test/lib/completions/wtf.exp
new file mode 100644
index 00000000..8250becc
--- /dev/null
+++ b/test/lib/completions/wtf.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "wtf "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/wvdial.exp b/test/lib/completions/wvdial.exp
new file mode 100644
index 00000000..8d4669de
--- /dev/null
+++ b/test/lib/completions/wvdial.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "wvdial -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/xhost.exp b/test/lib/completions/xhost.exp
new file mode 100644
index 00000000..aeceadb6
--- /dev/null
+++ b/test/lib/completions/xhost.exp
@@ -0,0 +1,100 @@
+proc setup {} {
+ assert_bash_exec {HOME=$TESTDIR}
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+set test "Tab should complete hostnames"
+ # Build string list of hostnames
+set hosts {}
+foreach h [exec bash -c "compgen -A hostname"] {
+ lappend hosts $h
+}; # foreach
+assert_complete $hosts "xhost " $test
+
+
+sync_after_int
+
+
+set test "Tab should complete partial hostname"
+# Build string list of hostnames, starting with the character of the first hostname
+set hosts {}
+set char ""
+foreach h [exec bash -c "compgen -A hostname"] {
+ if {$char == ""} {set char [string range $h 0 0]}
+ # Only append hostname if starting with $char
+ if {[string range $h 0 0] == "$char"} {
+ lappend hosts $h
+ }; # if
+}; # foreach
+assert_complete $hosts "xhost $char" $test
+
+
+sync_after_int
+
+
+set test "Tab should complete hostnames prefixed with +"
+# Build string list of hostnames, prefixed with plus (+)
+set hosts {}
+foreach h [exec bash -c "compgen -A hostname"] {
+ lappend hosts "+$h"
+}; # foreach
+assert_complete $hosts "xhost \+" $test
+
+
+sync_after_int
+
+
+set test "Tab should complete partial hostname prefixed with +"
+ # Build string list of hostnames, starting with character of first host.
+set hosts {}
+foreach h [exec bash -c "compgen -A hostname"] {
+ if {$char == ""} {set char [string range $h 0 0]}
+ # Only append hostname if starting with $char
+ if {[string range $h 0 0] == "$char"} {
+ lappend hosts "+$h"
+ }; # if
+}; # foreach
+assert_complete $hosts "xhost +$char"
+
+
+sync_after_int
+
+
+set test "Tab should complete hostnames prefixed with -"
+ # Build string list of hostnames, prefix with minus (-)
+set hosts {}
+foreach h [exec bash -c "compgen -A hostname"] {
+ lappend hosts "-$h"
+}; # foreach
+assert_complete $hosts "xhost -" $test
+
+
+sync_after_int
+
+
+set test "Tab should complete partial hostname prefixed with -"
+ # Build list of hostnames, starting with character of first host
+set hosts {}
+foreach h [exec bash -c "compgen -A hostname"] {
+ if {$char == ""} {set char [string range $h 0 0]}
+ # Only append hostname if starting with $char
+ if {[string range $h 0 0] == "$char"} {
+ lappend hosts "-$h"
+ }; # if
+}; # foreach
+assert_complete $hosts "xhost -$char" $test
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/xmllint.exp b/test/lib/completions/xmllint.exp
new file mode 100644
index 00000000..15451471
--- /dev/null
+++ b/test/lib/completions/xmllint.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "xmllint "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/xmlwf.exp b/test/lib/completions/xmlwf.exp
new file mode 100644
index 00000000..a996d458
--- /dev/null
+++ b/test/lib/completions/xmlwf.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "xmlwf "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/xmms.exp b/test/lib/completions/xmms.exp
new file mode 100644
index 00000000..c4ad64e8
--- /dev/null
+++ b/test/lib/completions/xmms.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "xmms --"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/xpovray.exp b/test/lib/completions/xpovray.exp
new file mode 100644
index 00000000..92cc903d
--- /dev/null
+++ b/test/lib/completions/xpovray.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "xpovray "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/xrandr.exp b/test/lib/completions/xrandr.exp
new file mode 100644
index 00000000..649ed43b
--- /dev/null
+++ b/test/lib/completions/xrandr.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "xrandr "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/xsltproc.exp b/test/lib/completions/xsltproc.exp
new file mode 100644
index 00000000..2470c22e
--- /dev/null
+++ b/test/lib/completions/xsltproc.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "xsltproc "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/xvnc4viewer.exp b/test/lib/completions/xvnc4viewer.exp
new file mode 100644
index 00000000..3456c3e7
--- /dev/null
+++ b/test/lib/completions/xvnc4viewer.exp
@@ -0,0 +1,45 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+set test "Tab should complete options"
+set options {
+ -AcceptClipboard -AutoSelect -DebugDelay -display
+ -DotWhenNoCursor -FullColor -FullColour -FullScreen
+ -geometry -help -listen -Log
+ -LowColourLevel -MenuKey -name -Parent
+ -passwd -PasswordFile -PointerEventInterval -PreferredEncoding
+ -SendClipboard -SendPrimary -Shared -UseLocalCursor
+ -via -ViewOnly -WMDecorationHeight -WMDecorationWidth
+ -ZlibLevel
+}
+assert_complete $options {vncviewer -}
+
+
+sync_after_int
+
+
+set expected {hextile raw zrle}
+assert_complete $expected "xvnc4viewer -PreferredEncoding "
+
+
+sync_after_int
+
+
+set expected {hextile raw zrle}
+assert_complete $expected "xvnc4viewer --preferredencoding "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/xz.exp b/test/lib/completions/xz.exp
new file mode 100644
index 00000000..820b0689
--- /dev/null
+++ b/test/lib/completions/xz.exp
@@ -0,0 +1,33 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "xz "
+
+
+sync_after_int
+
+
+assert_complete "a/ bashcomp.lzma bashcomp.tar.xz bashcomp.tlz bashcomp.xz" \
+ "xz -d fixtures/xz/"
+
+
+sync_after_int
+
+
+assert_complete "a/ bashcomp.tar" "xz fixtures/xz/"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/ypcat.exp b/test/lib/completions/ypcat.exp
new file mode 100644
index 00000000..f1bd0c0e
--- /dev/null
+++ b/test/lib/completions/ypcat.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "ypcat "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/ypmatch.exp b/test/lib/completions/ypmatch.exp
new file mode 100644
index 00000000..f1695f67
--- /dev/null
+++ b/test/lib/completions/ypmatch.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "ypmatch foo "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/yum-arch.exp b/test/lib/completions/yum-arch.exp
new file mode 100644
index 00000000..defb7bf4
--- /dev/null
+++ b/test/lib/completions/yum-arch.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "yum-arch -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/yum.exp b/test/lib/completions/yum.exp
new file mode 100644
index 00000000..09d7282c
--- /dev/null
+++ b/test/lib/completions/yum.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "yum -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/library.exp b/test/lib/library.exp
new file mode 100644
index 00000000..c76d9854
--- /dev/null
+++ b/test/lib/library.exp
@@ -0,0 +1,908 @@
+ # Source `init.tcl' again to restore the `unknown' procedure
+ # NOTE: DejaGnu has an old `unknown' procedure which unfortunately disables
+ # tcl auto-loading.
+source [file join [info library] init.tcl]
+package require textutil::string
+
+
+
+# Execute a bash command and make sure the exit status is successful.
+# If not, output the error message.
+# @param string $cmd Bash command line to execute. If empty string (""), the
+# exit status of the previously executed bash command will be
+# checked; specify `title' to adorn the error message.
+# @param string $title (optional) Command title. If empty, `cmd' is used.
+# @param string $prompt (optional) Bash prompt. Default is "/@"
+# @param mixed $out (optional) Reference to (tcl) variable to hold output.
+# If variable equals -1 (default) the bash command is expected
+# to return no output. If variable equals 0, any output
+# from the bash command is disregarded.
+proc assert_bash_exec {{aCmd ""} {title ""} {prompt /@} {out -1}} {
+ if {$out != 0 && $out != -1} {upvar $out results}
+ if {[string length $aCmd] != 0} {
+ send "$aCmd\r"
+ expect -ex "$aCmd\r\n"
+ }; # if
+ if {[string length $title] == 0} {set title $aCmd}
+ expect -ex $prompt
+ set results $expect_out(buffer); # Catch output
+ # Remove $prompt suffix from output
+ set results [
+ string range $results 0 [
+ expr [string length $results] - [string length $prompt] - 1
+ ]
+ ]
+ if {$out == -1 && [string length $results] > 0} {
+ if {[info exists multipass_name]} {
+ fail "ERROR Unexpected output from bash command \"$title\""
+ }; # if
+ send_user "ERROR Unexpected output from bash command \"$title\":\n$results"
+ }; # if
+
+ set cmd "echo $?"
+ send "$cmd\r"
+ expect {
+ -ex "$cmd\r\n0\r\n$prompt" {}
+ $prompt {
+ if {[info exists multipass_name]} {
+ fail "ERROR executing bash command \"$title\""
+ }; # if
+ send_user "ERROR executing bash command \"$title\""
+ }
+ }; # expect
+}; # assert_bash_exec()
+
+
+# Test `type ...' in bash
+# Indicate "unsupported" if `type' exits with error status.
+# @param string $command Command to locate
+proc assert_bash_type {command} {
+ set test "$command should be available in bash"
+ set cmd "type $command &> /dev/null && echo -n 0 || echo -n 1"
+ send "$cmd\r"
+ expect "$cmd\r\n"
+ expect {
+ -ex 0 { set result true }
+ -ex 1 { set result false; unsupported "$test" }
+ }; # expect
+ expect "/@"
+ return $result
+}; # assert_bash_type()
+
+
+# Make sure the expected list is returned by executing the specified command.
+# @param list $expected
+# @param string $cmd Command given to generate items
+# @param string $test (optional) Test title. Default is "$cmd<TAB> should show completions"
+# @param string $prompt (optional) Bash prompt. Default is "/@"
+# @param integer $size (optional) Chunk size. Default is 20.
+# @result boolean True if successful, False if not
+proc assert_bash_list {expected cmd {test ""} {prompt /@} {size 20}} {
+ if {$test == ""} {set test "$cmd should show expected output"}
+ if {[llength $expected] == 0} {
+ assert_no_output $cmd $test $prompt
+ } else {
+ send "$cmd\r"
+ expect -ex "$cmd\r\n"
+
+ if {[match_items $expected $test $prompt $size]} {
+ expect {
+ -re $prompt { pass "$test" }
+ -re eof { unresolved "eof" }
+ }
+ } else {
+ fail "$test"
+ }
+ }
+}
+
+
+proc assert_bash_list_dir {expected cmd dir {test ""} {prompt /@} {size 20}} {
+ set prompt "/$dir/@"
+ assert_bash_exec "cd $dir" "" $prompt
+ assert_bash_list $expected $cmd $test $prompt $size
+ sync_after_int $prompt
+ assert_bash_exec {cd "$TESTDIR"}
+}; # assert_bash_list_dir()
+
+
+# Make sure the expected items are returned by TAB-completing the specified
+# command.
+# @param list $expected Expected completions.
+# @param string $cmd Command given to generate items
+# @param string $test (optional) Test title. Default is "$cmd<TAB> should show completions"
+# @param string $prompt (optional) Bash prompt. Default is "/@"
+# @param integer $size (optional) Chunk size. Default is 20.
+# @param string $cword (optional) Last argument of $cmd which is an
+# argument-to-complete and to be replaced with the longest common prefix
+# of $expected. If empty string (default), `assert_complete' autodetects
+# if the last argument is an argument-to-complete by checking if $cmd
+# doesn't end with whitespace. Specifying `cword' should only be necessary
+# if this autodetection fails, e.g. when the last whitespace is escaped or
+# quoted, e.g. "finger foo\ " or "finger 'foo "
+# @param list $filters (optional) List of filters to apply to this function to tweak
+# the expected completions and argument-to-complete. Possible values:
+# - "ltrim_colon_completions"
+# @result boolean True if successful, False if not
+proc assert_complete {expected cmd {test ""} {prompt /@} {size 20} {cword ""} {filters ""}} {
+ if {[llength $expected] == 0} {
+ assert_no_complete $cmd $test
+ } else {
+ if {$test == ""} {set test "$cmd should show completions"}
+ send "$cmd\t"
+ if {[llength $expected] == 1} {
+ expect -ex "$cmd"
+
+ if {[lsearch -exact $filters "ltrim_colon_completions"] == -1} {
+ set cur ""; # Default to empty word to complete on
+ set words [split_words_bash $cmd]
+ if {[llength $words] > 1} {
+ # Assume last word of `$cmd' is word to complete on.
+ set index [expr [llength $words] - 1]
+ set cur [lindex $words $index]
+ }; # if
+ # Remove second word from beginning of single item $expected
+ if {[string first $cur $expected] == 0} {
+ set expected [list [string range $expected [string length $cur] end]]
+ }; # if
+ }; # if
+ } else {
+ expect -ex "$cmd\r\n"
+ # Make sure expected items are unique
+ set expected [lsort -unique $expected]
+ }; # if
+
+ if {[lsearch -exact $filters "ltrim_colon_completions"] != -1} {
+ # If partial contains colon (:), remove partial from begin of items
+ # See also: bash_completion.__ltrim_colon_completions()
+ _ltrim_colon_completions cword expected
+ }; # if
+
+ if {[match_items $expected $test $prompt $size]} {
+ if {[llength $expected] == 1} {
+ pass "$test"
+ } else {
+ # Remove optional (partial) last argument-to-complete from `cmd',
+ # E.g. "finger test@" becomes "finger"
+
+ if {[lsearch -exact $filters "ltrim_colon_completions"] != -1} {
+ set cmd2 $cmd
+ } else {
+ set cmd2 [_remove_cword_from_cmd $cmd $cword]
+ }; # if
+
+ # Determine common prefix of completions
+ set common [::textutil::string::longestCommonPrefixList $expected]
+ #if {[string length $common] > 0} {set common " $common"}
+ expect {
+ -ex "$prompt$cmd2$common" { pass "$test" }
+ -re $prompt { unresolved "$test at prompt" }
+ -re eof { unresolved "eof" }
+ }; # expect
+ }; # if
+ } else {
+ fail "$test"
+ }; # if
+ }; # if
+}; # assert_complete()
+
+
+# @param string $cmd Command to remove cword from
+# @param string $cword (optional) Last argument of $cmd which is an
+# argument-to-complete and to be deleted. If empty string (default),
+# `_remove_cword_from_cmd' autodetects if the last argument is an
+# argument-to-complete by checking if $cmd doesn't end with whitespace.
+# Specifying `cword' is only necessary if this autodetection fails, e.g.
+# when the last whitespace is escaped or quoted, e.g. "finger foo\ " or
+# "finger 'foo "
+# @return string Command with cword removed
+proc _remove_cword_from_cmd {cmd {cword ""}} {
+ set cmd2 $cmd
+ # Is $cword specified?
+ if {[string length $cword] > 0} {
+ # Remove $cword from end of $cmd
+ if {[string last $cword $cmd] == [string length $cmd] - [string length $cword]} {
+ set cmd2 [string range $cmd 0 [expr [string last $cword $cmd] - 1]]
+ }; # if
+ } else {
+ # No, $cword not specified;
+ # Check if last argument is really an-argument-to-complete, i.e.
+ # doesn't end with whitespace.
+ # NOTE: This check fails if trailing whitespace is escaped or quoted,
+ # e.g. "finger foo\ " or "finger 'foo ". Specify parameter
+ # $cword in those cases.
+ # Is last char whitespace?
+ if {! [string is space [string range $cmd end end]]} {
+ # No, last char isn't whitespace;
+ # Remove argument-to-complete from end of $cmd
+ set cmd2 [lrange [split $cmd] 0 end-1]
+ append cmd2 " "
+ }; # if
+ }; # if
+ return $cmd2
+}; # _remove_cword_from_cmd()
+
+
+# Escape regexp special characters
+proc _escape_regexp_chars {var} {
+ upvar $var str
+ regsub -all {([\^$+*?.|(){}[\]\\])} $str {\\\1} str
+}
+
+# Make sure any completions are returned
+proc assert_complete_any {cmd {test ""} {prompt /@}} {
+ if {$test == ""} {set test "$cmd should show completions"}
+ send "$cmd\t"
+ expect -ex "$cmd"
+ _escape_regexp_chars cmd
+ expect {
+ -timeout 1
+ # Match completions, multiple words
+ # NOTE: The `\S*' (zero or more non-whitespace characters) matches a
+ # longest common prefix of the completions shown.
+ # E.g. `fmt -' becomes `fmt --' (two dashes) when completing
+ -re "^\r\n.*$prompt$cmd\\S*$" { pass "$test" }
+ timeout {
+ expect {
+ # Match completion, single word. This word is shown on the
+ # same line as the command.
+ -re "^\\w+ $" { pass "$test" }
+ # Try matching multiple words again, with new timeout
+ -re "^\r\n.*$prompt$cmd\\S*$" { pass "$test" }
+ }
+ }
+ -re $prompt { unresolved "$test at prompt" }
+ eof { unresolved "eof" }
+ }; # expect
+}; # assert_complete_any()
+
+
+# Make sure the expected files are returned by TAB-completing the
+# specified command in the specified subdirectory.
+# @param list $expected
+# @param string $cmd Command given to generate items
+# @param string $dir Subdirectory to attempt completion in. The directory must be relative from the $TESTDIR and without a trailing slash. E.g. `fixtures/evince'
+# @param string $test (optional) Test title. Default is "$cmd<TAB> should show completions"
+# @param string $prompt (optional) Bash prompt. Default is "/@"
+# @param integer $size (optional) Chunk size. Default is 20.
+# @param string $cword (optional) Last word of $cmd to complete. See: assert_complete()
+# @result boolean True if successful, False if not
+proc assert_complete_dir {expected cmd dir {test ""} {size 20} {cword ""}} {
+ set prompt "/$dir/@"
+ assert_bash_exec "cd $dir" "" $prompt
+ assert_complete $expected $cmd $test $prompt $size $cword
+ sync_after_int $prompt
+ assert_bash_exec {cd "$TESTDIR"}
+}; # assert_complete_dir
+
+
+
+# Make sure a partial argument is completed.
+# A completion is tried with `$partial', or if this is empty, the first
+# character of the first item of `$expected'. Only the items from $expected,
+# starting with this character are then expected as completions.
+# @param list $expected List of all completions.
+# @param string $cmd Command given to generate items
+# @param string $partial Word to complete
+# @param string $test (optional) Test title. Default is "$cmd<TAB> should show completions"
+# @param string $prompt (optional) Bash prompt. Default is "/@"
+# @param integer $size (optional) Chunk size. Default is 20.
+# @param list $filters (optional) List of filters to apply to this function to tweak
+# the expected completions and argument-to-complete.
+# @see assert_complete()
+# @result boolean True if successful, False if not
+proc assert_complete_partial {expected cmd {partial ""} {test ""} {prompt /@} {size 20} {filters ""}} {
+ if {$test == ""} {set test "$cmd should complete partial argument"}
+ if {[llength $expected] == 0} {
+ unresolved "$test"
+ } else {
+ set pick {}
+ # Make sure expected items are unique
+ set expected [lsort -unique $expected]
+ foreach item $expected {
+ if {$partial == ""} {set partial [string range $item 0 0]}
+ # Only append item if starting with $partial
+ if {[string range $item 0 [expr [string length $partial] - 1]] == "$partial"} {
+ lappend pick $item
+ }; # if
+ }; # foreach
+ assert_complete $pick "$cmd $partial" $test $prompt $size $partial $filters
+ }; # if
+}; # assert_complete_partial()
+
+
+# See also: bash_completion._ltrim_colon_completions
+proc _ltrim_colon_completions {cword items} {
+ upvar 1 $cword cword_out
+ upvar 1 $items items_out
+ # If word-to-complete contains a colon,
+ # and bash-version < 4,
+ # or bash-version >= 4 and COMP_WORDBREAKS contains a colon
+ if {
+ [string first : $cword_out] > -1 && (
+ [lindex $::BASH_VERSINFO 0] < 4 ||
+ ([lindex $::BASH_VERSINFO 0] >= 4 && [string first ":" $::COMP_WORDBREAKS] > -1)
+ )
+ } {
+ for {set i 0} {$i < [llength $items_out]} {incr i} {
+ set item [lindex $items_out $i]
+ if {[string first $cword_out $item] == 0} {
+ # Strip colon-prefix
+ lset items_out $i [string range $item [string length $cword_out] end]
+ }; # if
+ }; # for
+ #set cword_out ""
+ }; # if
+}; # _ltrim_colon_completions()
+
+
+# Make sure the bash environment hasn't changed between now and the last call
+# to `save_env()'.
+# @param string $sed Sed commands to preprocess diff output.
+# Example calls:
+#
+# # Replace `COMP_PATH=.*' with `COMP_PATH=PATH'
+# assert_env_unmodified {s/COMP_PATH=.*/COMP_PATH=PATH/}
+#
+# # Remove lines containing `OLDPWD='
+# assert_env_unmodified {/OLDPWD=/d}
+#
+# @param string $file Filename to generate environment save file from. See
+# `gen_env_filename()'.
+# @param string $diff Expected diff output (after being processed by $sed)
+# @see save_env()
+proc assert_env_unmodified {{sed ""} {file ""} {diff ""}} {
+ set test "Environment should not be modified"
+ _save_env [gen_env_filename $file 2]
+
+ # Prepare sed script
+
+ # Escape special bash characters ("\)
+ regsub -all {([\"\\])} $sed {\\\1} sed; #"# (fix Vim syntax highlighting)
+ # Escape newlines
+ regsub -all {\n} [string trim $sed] "\r\n" sed
+
+ # Prepare diff script
+
+ # If diff is filled, escape newlines and make sure it ends with a newline
+ if {[string length [string trim $diff]]} {
+ regsub -all {\n} [string trim $diff] "\r\n" diff
+ append diff "\r\n"
+ } else {
+ set diff ""
+ }; # if
+
+ # Execute diff
+
+ # NOTE: The dummy argument 'LAST-ARG' sets bash variable $_ (last argument) to
+ # 'LAST-ARG' so that $_ doesn't mess up the diff (as it would if $_
+ # was the (possibly multi-lined) sed script).
+ set cmd "diff_env \"[gen_env_filename $file 1]\" \"[gen_env_filename $file 2]\" \"$sed\" LAST-ARG"
+ send "$cmd\r"
+ expect "LAST-ARG\r\n"
+
+ expect {
+ -re "^$diff[wd]@$" { pass "$test" }
+ -re [wd]@ {
+ fail "$test"
+
+ # Show diff to user
+
+ set diff $expect_out(buffer)
+ # Remove possible `\r\n[wd]@' from end of diff
+ if {[string last "\r\n[wd]@" $diff] == [string length $diff] - [string length "\r\n[wd]@"]} {
+ set diff [string range $diff 0 [expr [string last "\r\n[wd]@" $diff] - 1]]
+ }; # if
+ send_user $diff;
+ }
+ }; # expect
+}; # assert_env_unmodified()
+
+
+# Make sure the specified command executed from within Tcl/Expect.
+# Fail the test with status UNSUPPORTED if Tcl fails with error "POSIX/ENOENT
+# (No such file or directory)", or with the given Tcl failure status command
+# (default "unresolved") if other error occurs.
+# NOTE: Further tests are assumed if executing the command is successful. The
+# test isn't immediately declared to have PASSED if the command is
+# executed successful.
+# @param string $command
+# @param string $stdout (optional) Reference to variable to hold stdout.
+# @param string $test (optional) Test title
+# @param string $failcmd (optional, default "unresolved") Failure command
+# @see assert_bash_exec()
+proc assert_exec {cmd {stdout ''} {test ''} {failcmd "unresolved"}} {
+ if {$test == ""} {set test "$cmd should execute successfully"}
+ upvar $stdout results
+ set status [catch {eval exec $cmd} results]
+ if {$status == 0} {
+ set result true
+ } else {
+ set result false
+ # Command not found (POSIX/ENOENT = no such file or directory)?
+ if {[lindex $::errorCode 0] == "POSIX" && [lindex $::errorCode 1] == "ENOENT"} {
+ # Yes, command not found;
+ # Indicate test is unsupported
+ unsupported "$test"
+ } else {
+ $failcmd "$test"
+ }; # if
+ }; # if
+ return $result
+}; # assert_exec()
+
+
+# Check that no completion is attempted on a certain command.
+# Params:
+# @cmd The command to attempt to complete.
+# @test Optional parameter with test name.
+proc assert_no_complete {{cmd} {test ""}} {
+ if {[string length $test] == 0} {
+ set test "$cmd shouldn't complete"
+ }; # if
+
+ send "$cmd\t"
+ expect -ex "$cmd"
+
+ # We can't anchor on $, simulate typing a magical string instead.
+ set endguard "Magic End Guard"
+ send "$endguard"
+ expect {
+ -re "^$endguard$" { pass "$test" }
+ default { fail "$test" }
+ timeout { fail "$test" }
+ }; # expect
+}; # assert_no_complete()
+
+
+# Check that no output is generated on a certain command.
+# @param string $cmd The command to attempt to complete.
+# @param string $test Optional parameter with test name.
+# @param string $prompt (optional) Bash prompt. Default is "/@"
+proc assert_no_output {{cmd} {test ""} {prompt /@}} {
+ if {[string length $test] == 0} {
+ set test "$cmd shouldn't generate output"
+ }
+
+ send "$cmd\r"
+ expect -ex "$cmd"
+
+ expect {
+ -re "^\r\n$prompt$" { pass "$test" }
+ default { fail "$test" }
+ timeout { fail "$test" }
+ }
+}
+
+
+# Source/run file with additional tests if completion for the specified command
+# is installed in bash.
+# @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 {[string length $file] == 0} {
+ set file "lib/completions/$command.exp"
+ }
+ source $file
+ } else {
+ untested $command
+ }
+}
+
+
+# Sort list.
+# `exec sort' is used instead of `lsort' to achieve exactly the
+# same sort order as in bash.
+# @param list $items
+# @return list Sort list
+proc bash_sort {items} {
+ return [split [exec sort << [join $items "\n"]] "\n"]
+}
+
+
+# Get 'known' hostnames. Looks also in ssh's 'known_hosts' files.
+# @param string cword (optional) Word, hosts should start with.
+# @return list Hostnames
+# @see get_hosts()
+proc get_known_hosts {{cword ''}} {
+ assert_bash_exec "_known_hosts_real '$cword'; echo_array COMPREPLY" \
+ {} /@ result
+ return $result
+}; # get_known_hosts()
+
+
+# Get hostnames
+# @return list Hostnames
+# @see get_known_hosts()
+proc get_hosts {} {
+ set hosts [exec bash -c "compgen -A hostname"]
+ # 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
+ set avahi_hosts [get_hosts_avahi]
+ if {[llength $avahi_hosts] > 0} {
+ lappend hosts $avahi_hosts
+ }; # if
+ return $hosts
+}; # get_hosts()
+
+
+# Get hostnames according to avahi
+# @return list Hostnames
+proc get_hosts_avahi {} {
+ # Retrieving hosts is successful?
+ if { [catch {exec bash -c {
+ type avahi-browse >&/dev/null \
+ && avahi-browse -cpr _workstation._tcp 2>/dev/null | command grep ^= | cut -d\; -f7 | sort -u
+ }} hosts] } {
+ # No, retrieving hosts yields error;
+ # Reset hosts
+ set hosts {}
+ }; # if
+ return $hosts
+}; # get_hosts_avahi()
+
+
+# Get signals
+# This function is written in analogy to the bash function `_signals()' in
+# `bash_completion'.
+# @return list Signals starting with `SIG', but with the `SIG' prefix removed.
+proc get_signals {} {
+ set signals {}
+ foreach signal [exec bash -c {compgen -A signal}] {
+ # Does signal start with `SIG'?
+ if {[string range $signal 0 [expr [string length "SIG"] - 1]] == "SIG"} {
+ # Remove `SIG' prefix
+ set signal [string range $signal 3 end]
+ # Add signal (with dash (-) prefix) to list
+ lappend signals -$signal
+ }; # if
+ }; # foreach
+ return $signals
+}; # get_signals()
+
+
+# Initialize tcl globals with bash variables
+proc init_tcl_bash_globals {} {
+ global BASH_VERSINFO BASH_VERSION COMP_WORDBREAKS
+ assert_bash_exec {printf "%s" "$COMP_WORDBREAKS"} {} /@ COMP_WORDBREAKS
+ assert_bash_exec {printf "%s " "${BASH_VERSINFO[@]}"} "" /@ BASH_VERSINFO
+ set BASH_VERSINFO [eval list $BASH_VERSINFO]
+ assert_bash_exec {printf "%s" "$BASH_VERSION"} "" /@ BASH_VERSION
+ assert_bash_exec {printf "%s" "$TESTDIR"} "" /@ TESTDIR
+}; # init_tcl_bash_globals()
+
+
+# Check whether completion is installed for the specified command by executing
+# `complete -p ...' in bash.
+# @param string $command Command to check completion availability for.
+# @return boolean True (1) if completion is installed, False (0) if not.
+proc is_bash_completion_installed_for {command} {
+ set test "$command should have completion installed in bash"
+ set cmd "complete -p $command &> /dev/null && echo -n 0 || echo -n 1"
+ send "$cmd\r"
+ expect "$cmd\r\n"
+ expect {
+ -ex 0 { set result true }
+ -ex 1 { set result false }
+ }
+ expect "/@"
+ return $result
+}; # is_bash_completion_installed_for()
+
+
+# Detect if test suite is running under Cygwin/Windows
+proc is_cygwin {} {
+ expr {[string first [string tolower [exec uname -s]] cygwin] >= 0}
+}; # is_cygwin()
+
+
+# Expect items.
+# Break items into chunks because `expect' seems to have a limited buffer size
+# @param list $items
+# @param integer $size Chunk size
+# @result boolean True if successful, False if not
+proc match_items {items test {prompt /@} {size 20}} {
+ set items [bash_sort $items]
+ set result false
+ for {set i 0} {$i < [llength $items]} {set i [expr {$i + $size}]} {
+ # For chunks > 1, allow leading whitespace
+ if {$i > $size} { set expected "\\s*" } else { set expected "" }
+ for {set j 0} {$j < $size && $i + $j < [llength $items]} {incr j} {
+ set item "[lindex $items [expr {$i + $j}]]"
+ _escape_regexp_chars item
+ append expected $item
+ if {[llength $items] > 1} {append expected {\s+}};
+ }; # for
+ if {[llength $items] == 1} {
+ expect {
+ -re "^$expected\r\n$" { set result true }
+ # NOTE: The optional space ( ?) depends on whether -o nospace is active
+ -re "^$expected ?$" { set result true }
+ -re "^$prompt$" {set result false; break }
+ "\r\n" { set result false; break }
+ default { set result false; break }
+ timeout { set result false; break }
+ }; # expect
+ } else {
+ expect {
+ -re "^$expected" { set result true }
+ default { set result false; break }
+ timeout { set result false; break }
+ }; # expect
+ }; # if
+ }; # for
+ return $result
+}; # match_items()
+
+
+
+# Get real command.
+# - arg: $1 Command
+# - return: Command found, empty string if not found
+proc realcommand {cmd} {
+ set result ""
+ if [string length [set path [auto_execok $cmd]]] {
+ if {[string length [auto_execok realpath]]} {
+ set result [exec realpath $path]
+ } elseif {[string length [auto_execok readlink]]} {
+ set result [exec readlink -f $path]
+ } else {
+ set result $path
+ }; # if
+ }; # if
+ return $result
+}; # realcommand()
+
+
+# Generate filename to save environment to.
+# @param string $file File-basename to save environment to. If the file has a
+# `.exp' suffix, it is removed. E.g.:
+# - "file.exp" becomes "file.env1~"
+# - "" becomes "env.env1~"
+# - "filename" becomes "filename.env1~"
+# The file will be stored in the $TESTDIR/tmp directory.
+# @param integer $seq Sequence number. Must be either 1 or 2.
+proc gen_env_filename {{file ""} {seq 1}} {
+ if {[string length $file] == 0} {
+ set file "env"
+ } else {
+ # Remove possible directories
+ set file [file tail $file]
+ # Remove possible '.exp' suffix from filename
+ if {[string last ".exp" $file] == [string length $file] - [string length ".exp"]} {
+ set file [string range $file 0 [expr [string last ".exp" $file] - 1]]
+ }; # if
+ }; # if
+ return "\$TESTDIR/tmp/$file.env$seq~"
+}; # gen_env_filename()
+
+
+# Save the environment for later comparison
+# @param string $file Filename to generate environment save file from. See
+# `gen_env_filename()'.
+proc save_env {{file ""}} {
+ _save_env [gen_env_filename $file 1]
+}; # save_env()
+
+
+# Save the environment for later comparison
+# @param string File to save the environment to. Default is "$TESTDIR/tmp/env1~".
+# @see assert_env_unmodified()
+proc _save_env {{file ""}} {
+ assert_bash_exec "{ set; declare -F; shopt -p; } > \"$file\""
+}; # _save_env()
+
+
+# Source bash_completion package
+proc source_bash_completion {} {
+ assert_bash_exec {BASH_COMPLETION_DIR=$(cd "$TESTDIR/.."; pwd)/contrib}
+ assert_bash_exec {BASH_COMPLETION_COMPAT_DIR=$BASH_COMPLETION_DIR}
+ assert_bash_exec {BASH_COMPLETION=$(cd "$TESTDIR/.."; pwd)/bash_completion}
+ assert_bash_exec {source "$BASH_COMPLETION"}
+}; # source_bash_completion()
+
+
+# Split line into words, disregarding backslash escapes (e.g. \b (backspace),
+# \g (bell)), but taking backslashed spaces into account.
+# Aimed for simulating bash word splitting.
+# Example usage:
+#
+# % set a {f cd\ \be}
+# % split_words $a
+# f {cd\ \be}
+#
+# @param string Line to split
+# @return list Words
+proc split_words_bash {line} {
+ set words {}
+ set glue false
+ foreach part [split $line] {
+ set glue_next false
+ # Does `part' end with a backslash (\)?
+ if {[string last "\\" $part] == [string length $part] - [string length "\\"]} {
+ # Remove end backslash
+ set part [string range $part 0 [expr [string length $part] - [string length "\\"] - 1]]
+ # Indicate glue on next run
+ set glue_next true
+ }; # if
+ # Must `part' be appended to latest word (= glue)?
+ if {[llength $words] > 0 && [string is true $glue]} {
+ # Yes, join `part' to latest word;
+ set zz [lindex $words [expr [llength $words] - 1]]
+ # Separate glue with backslash-space (\ );
+ lset words [expr [llength $words] - 1] "$zz\\ $part"
+ } else {
+ # No, don't append word to latest word;
+ # Append `part' as separate word
+ lappend words $part
+ }; # if
+ set glue $glue_next
+ }; # foreach
+ return $words
+}; # split_words_bash()
+
+
+# Given a list of items this proc finds a (part, full) pair so that when
+# completing from $part $full will be the only option.
+#
+# Arguments:
+# list The list of full completions.
+# partName Output parameter for the partial string.
+# fullName Output parameter for the full string, member of item.
+#
+# Results:
+# 1, or 0 if no suitable result was found.
+proc find_unique_completion_pair {{list} {partName} {fullName}} {
+ upvar $partName part
+ upvar $fullName full
+ set bestscore 0
+ set list [lsort $list]
+ set n [llength $list]
+ for {set i 0} {$i < $n} {incr i} {
+ set cur [lindex $list $i]
+ set curlen [string length $cur]
+
+ set prev [lindex $list [expr {$i - 1}]]
+ set next [lindex $list [expr {$i + 1}]]
+ set diffprev [expr {$prev == ""}]
+ set diffnext [expr {$next == ""}]
+
+ # Analyse each item of the list and look for the minimum length of the
+ # partial prefix which is distinct from both $next and $prev. The list
+ # is sorted so the prefix will be unique in the entire list.
+ #
+ # In the worst case we analyse every character in the list 3 times.
+ # That's actually very fast, sorting could take more.
+ for {set j 0} {$j < $curlen} {incr j} {
+ set curchar [string index $cur $j]
+ if {!$diffprev && [string index $prev $j] != $curchar} {
+ set diffprev 1
+ }
+ if {!$diffnext && [string index $next $j] != $curchar} {
+ set diffnext 1
+ }
+ if {$diffnext && $diffprev} {
+ break
+ }
+ }
+
+ # At the end of the loop $j is the index of last character of
+ # the unique partial prefix. The length is one plus that.
+ set parlen [expr {$j + 1}]
+ if {$parlen >= $curlen} {
+ continue
+ }
+
+ # Try to find the most "readable pair"; look for a long pair where
+ # $part is about half of $full.
+ if {$parlen < $curlen / 2} {
+ set parlen [expr {$curlen / 2}]
+ }
+ set score [expr {$curlen - $parlen}]
+ if {$score > $bestscore} {
+ set bestscore $score
+ set part [string range $cur 0 [expr {$parlen - 1}]]
+ set full $cur
+ }
+ }
+ return [expr {$bestscore != 0}]
+}
+
+
+# Start bash running as test environment.
+proc start_bash {} {
+ global TESTDIR TOOL_EXECUTABLE spawn_id
+ set TESTDIR [pwd]
+ # If `--tool_exec' option not specified, use "bash"
+ if {! [info exists TOOL_EXECUTABLE]} {set TOOL_EXECUTABLE bash}
+ exp_spawn $TOOL_EXECUTABLE --rcfile config/bashrc
+ assert_bash_exec {} "$TOOL_EXECUTABLE --rcfile 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}
+}; # start_bash()
+
+
+# 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.
+#
+# 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"
+ assert_bash_exec "set -o xtrace"
+}
+
+
+# Setup test environment
+#
+# Common initialization for unit and completion tests.
+proc start_interactive_test {} {
+ start_bash
+ source_bash_completion
+ init_tcl_bash_globals
+
+ global OPT_BASH_XTRACE
+ if {[info exists OPT_BASH_XTRACE]} {
+ init_bash_xtrace
+ }
+ global OPT_TIMEOUT
+ if {[info exists OPT_TIMEOUT]} {
+ global timeout
+ verbose "Changing default expect timeout from $timeout to $OPT_TIMEOUT"
+ set timeout $OPT_TIMEOUT
+ }
+}
+
+
+# Interrupt completion and sync with prompt.
+# Send signals QUIT & INT.
+# @param string $prompt (optional) Bash prompt. Default is "/@"
+proc sync_after_int {{prompt /@}} {
+ set test "Sync after INT"
+ sleep .1
+ send \031\003; # QUIT/INT
+ # Wait to allow bash to become ready
+ # See also: http://lists.alioth.debian.org/pipermail/bash-completion-devel/
+ # 2010-February/002566.html
+ sleep .1
+ # NOTE: Regexp `.*' causes `expect' to discard previous unknown output.
+ # This is necessary if a completion doesn't match expectations.
+ # For instance with `filetype_xspec' completion (e.g. `kdvi') if
+ # one expects `.txt' as a completion (wrong, because it isn't
+ # there), the unmatched completions need to be cleaned up.
+ expect -re ".*$prompt$"
+}
+
+
+proc sync_after_tab {} {
+ # NOTE: Wait in case completion returns nothing - because `units' isn't
+ # installed, so that "^$cdm.*$" doesn't match too early - before
+ # comp_install has finished
+ sleep .4
+}; # sync_after_tab()
+
+
+# Return current working directory with `TESTDIR' stripped
+# @return string Working directory. E.g. /, or /fixtures/
+proc wd {} {
+ global TESTDIR
+ # Remove `$TESTDIR' prefix from current working directory
+ set wd [string replace [pwd] 0 [expr [string length $TESTDIR] - 1]]/
+}; # wd()
diff --git a/test/lib/library.sh b/test/lib/library.sh
new file mode 100644
index 00000000..98107dcb
--- /dev/null
+++ b/test/lib/library.sh
@@ -0,0 +1,75 @@
+# Bash library for bash-completion DejaGnu testsuite
+
+
+# @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
+} # add_comp_wordbreak_char()
+
+
+# Diff environment files to detect if environment is unmodified
+# @param $1 File 1
+# @param $2 File 2
+# @param $3 Additional sed script
+diff_env() {
+ diff "$1" "$2" | sed -e "
+# Remove diff line indicators
+ /^[0-9,]\{1,\}[acd]/d
+# Remove diff block separators
+ /---/d
+# Remove underscore variable
+ /[<>] _=/d
+# Remove PPID bash variable
+ /[<>] PPID=/d
+ $3"
+} # diff_env()
+
+
+# Output array elements, sorted and separated by newline
+# Unset variable after outputting.
+# @param $1 Name of array variable to process
+echo_array() {
+ local name=$1[@]
+ printf "%s\n" "${!name}" | sort
+} # echo_array()
+
+
+# Check if current bash version meets specified minimum
+# @param $1 (integer) Major version number
+# @param $2 (integer) Minor version number
+# @param $3 (integer) Patch level
+# @return 0 if success, > 0 if not
+is_bash_version_minimal() {
+ [[ (
+ ${BASH_VERSINFO[0]} -gt $1
+ ) || (
+ ${BASH_VERSINFO[0]} -eq $1 &&
+ ${BASH_VERSINFO[1]} -gt $2
+ ) || (
+ ${BASH_VERSINFO[0]} -eq $1 &&
+ ${BASH_VERSINFO[1]} -eq $2 &&
+ ${BASH_VERSINFO[2]} -ge $3
+ )
+ ]]
+} # 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
+} # remove_comp_wordbreak_char()
+
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/test/lib/unit.exp b/test/lib/unit.exp
new file mode 100644
index 00000000..de870332
--- /dev/null
+++ b/test/lib/unit.exp
@@ -0,0 +1,17 @@
+source lib/library.exp
+
+
+proc unit_exit {} {
+ # Exit bash
+ send "\rexit\r"
+}
+
+
+proc unit_start {} {
+ start_interactive_test
+}
+
+
+proc unit_version {} {
+ puts "$::TESTDIR, bash-$::BASH_VERSION"
+}
diff --git a/test/unit/__expand_tilde_by_ref.exp b/test/unit/__expand_tilde_by_ref.exp
new file mode 100644
index 00000000..d4a75d11
--- /dev/null
+++ b/test/unit/__expand_tilde_by_ref.exp
@@ -0,0 +1,87 @@
+# @param string $out Reference to variable to hold value of bash environment
+# variable $HOME.
+proc setup {home user} {
+ upvar $home _home
+ upvar $user _user
+ save_env
+ assert_bash_exec {echo "$HOME"} {} /@ _home
+ set _home [string trim $_home]
+ assert_bash_exec {echo "$USER"} {} /@ _user
+ set _user [string trim $_user]
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified {
+ /var=/d
+ }
+}; # teardown()
+
+
+setup home user
+
+
+set test "function should run without errors"
+assert_bash_exec {__expand_tilde_by_ref > /dev/null} $test
+
+
+sync_after_int
+
+
+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 aa="~"; __expand_tilde_by_ref aa; }; foo; unset foo} $test
+
+
+sync_after_int
+
+
+set test "~user should return /home/user"
+set cmd [format {var="~%s"; __expand_tilde_by_ref var; printf "%%s" "$var"} $user]
+assert_bash_list "$home" $cmd $test
+
+
+sync_after_int
+
+
+set test "~/foo should return /home/user/foo"
+set cmd {var='~/foo'; __expand_tilde_by_ref var; printf "%s" "$var"}
+assert_bash_list "$home/foo" $cmd $test
+
+
+sync_after_int
+
+
+set test "~user/bar should return /home/user/bar"
+set cmd [format {var="~%s/bar"; __expand_tilde_by_ref var; printf "%%s" "$var"} $user]
+assert_bash_list "$home/bar" $cmd $test
+
+
+sync_after_int
+
+
+set test "~user/\$HOME should return /home/user/\$HOME"
+set cmd [format {var="~%s/\$HOME"; __expand_tilde_by_ref var; printf "%%s" "$var"} $user]
+assert_bash_list "$home/\$HOME" $cmd $test
+
+
+sync_after_int
+
+
+set test "'~user/a b' should return '/home/user/a b'"
+set cmd [format {var="~%s/a b"; __expand_tilde_by_ref var; printf "%%s" "$var"} $user]
+assert_bash_list [list [format {%s/a b} $home]] $cmd $test
+
+
+sync_after_int
+
+
+set test "~user/* should return /home/user/*"
+set cmd [format {var="~%s/*"; __expand_tilde_by_ref var; printf "%%s" "$var"} $user]
+assert_bash_list "$home/\*" $cmd $test
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/unit/_count_args.exp b/test/unit/_count_args.exp
new file mode 100644
index 00000000..da61bdb6
--- /dev/null
+++ b/test/unit/_count_args.exp
@@ -0,0 +1,68 @@
+proc setup {} {
+ assert_bash_exec {unset COMP_CWORD COMP_LINE COMP_POINT COMP_WORDS}
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_bash_exec {unset args COMP_CWORD COMP_LINE COMP_POINT COMP_WORDS}
+ # Delete 'COMP_WORDBREAKS' occupying two lines
+ assert_env_unmodified {
+ /COMP_WORDBREAKS=/{N
+ d
+ }
+ }
+}; # teardown()
+
+
+setup
+
+
+set test "_count_args should run without errors"
+assert_bash_exec {_count_args > /dev/null} $test
+
+
+sync_after_int
+
+
+set test "a b| should set args to 1"; # | = cursor position
+set cmd {COMP_WORDS=(a b); COMP_CWORD=1; COMP_LINE='a b'; COMP_POINT=3; _count_args; echo -n $args}
+assert_bash_list 1 $cmd $test
+
+
+sync_after_int
+
+
+set test "a b|c should set args to 1"; # | = cursor position
+set cmd {COMP_WORDS=(a bc); COMP_CWORD=1; COMP_LINE='a bc'; COMP_POINT=3; _count_args; echo -n $args}
+assert_bash_list 1 $cmd $test
+
+
+sync_after_int
+
+
+set test "a b c| should set args to 2"; # | = cursor position
+set cmd {COMP_WORDS=(a b c); COMP_CWORD=2; COMP_LINE='a b c'; COMP_POINT=4; _count_args; echo -n $args}
+assert_bash_list 2 $cmd $test
+
+
+sync_after_int
+
+
+set test "a b| c should set args to 1"; # | = cursor position
+set cmd {COMP_WORDS=(a b c); COMP_CWORD=1; COMP_LINE='a b c'; COMP_POINT=3; _count_args; echo -n $args}
+assert_bash_list 1 $cmd $test
+
+
+sync_after_int
+
+
+set test "a b -c| d should set args to 2"; # | = cursor position
+set cmd {COMP_WORDS=(a b -c d); COMP_CWORD=2; COMP_LINE='a b -c d'; COMP_POINT=6; _count_args; echo -n $args}
+assert_bash_list 2 $cmd $test
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/unit/_filedir.exp b/test/unit/_filedir.exp
new file mode 100644
index 00000000..204d31cf
--- /dev/null
+++ b/test/unit/_filedir.exp
@@ -0,0 +1,267 @@
+proc setup {} {
+ assert_bash_exec {unset COMPREPLY cur}
+ assert_bash_exec {unset -f _f}
+ save_env
+ # Declare bash completion function `_f'
+ assert_bash_exec { \
+ _f() { local cur=$(_get_cword); unset COMPREPLY; _filedir; }; \
+ complete -F _f f \
+ }
+ # Declare bash completion function `_f2' with `-o filenames' active.
+ assert_bash_exec { \
+ complete -F _f -o filenames f2 \
+ }
+ # Declare bash completion function `_g' to complete on `.e1' files
+ assert_bash_exec { \
+ _g() { local cur=$(_get_cword); unset COMPREPLY; _filedir e1; }; \
+ complete -F _g g \
+ }
+ # Create directories `a*b' and `a\b' only when not running on Cygwin/Windows;
+ # directories containing `*' or `\' aren't allowed on Cygwin/Windows
+ if {! [is_cygwin]} {
+ # Create directory `a*b'
+ assert_bash_exec {(cd fixtures/_filedir && [ ! -d a\*b ] && mkdir a\*b && touch a\*b/j || true)}
+ # Create directory `a\b'
+ assert_bash_exec {(cd fixtures/_filedir && [ ! -d a\\b ] && mkdir a\\b && touch a\\b/g || true)}
+ }
+}
+
+
+proc teardown {} {
+ if {! [is_cygwin]} {
+ assert_bash_exec {(cd fixtures/_filedir && rm -- a\\b/g && rmdir a\\b/ || true)}
+ assert_bash_exec {(cd fixtures/_filedir && rm -- a\*b/j && rmdir a\*b/ || true)}
+ }
+ assert_bash_exec {unset COMPREPLY cur}
+ assert_bash_exec {unset -f _f _g}
+ assert_bash_exec {complete -r f g}
+ assert_env_unmodified {
+ /OLDPWD/d
+ /OLD_CTYPE/d
+ }
+}
+
+
+setup
+
+
+set test "_filedir should run without errors"
+assert_bash_exec {_filedir > /dev/null} $test
+
+
+sync_after_int
+
+
+foreach name {f f2} {
+
+ set test "completing $name ab/ should return e"
+ set cmd "$name ab/"
+ assert_complete_dir e $cmd "fixtures/_filedir" $test
+
+
+ sync_after_int
+
+
+ set test "completing $name a\\ b/ should return i"
+ set cmd "$name a\\ b/"
+ assert_complete_dir i $cmd "fixtures/_filedir" $test
+
+
+ sync_after_int
+
+
+ set test "completing $name a\\\'b/ should return c"
+ set cmd "$name a\\\'b/"
+ assert_complete_dir c $cmd "fixtures/_filedir" $test
+
+
+ sync_after_int
+
+
+ set test "completing $name a\\\"b/ should return d"; #"
+ set cmd "$name a\\\"b/"; #"
+ assert_complete_dir d $cmd "fixtures/_filedir" $test
+
+
+ sync_after_int
+
+
+ set test "completing $name a\\\$b/ should return h"
+ set cmd "$name a\\\$b/"
+ assert_complete_dir "\b\b\b\b\b$::TESTDIR/fixtures/_filedir/a\\\\\$b/h" \
+ $cmd "fixtures/_filedir" $test
+
+
+ sync_after_int
+
+
+ # Execute these tests only when not running on Cygwin/Windows, because
+ # directories containing asterisk (*) or backslash (\) aren't allowed on
+ # Cygwin/Windows
+ if {! [is_cygwin]} {
+ set test "completing $name a\\\\b/ should return g"
+ set cmd "$name a\\\\b/"
+ assert_complete_dir g $cmd "fixtures/_filedir" $test
+
+
+ sync_after_int
+ }
+
+
+ set test "completing $name a\\&b/ should return f"
+ set cmd "$name a\\&b/"
+ assert_complete_dir f $cmd "fixtures/_filedir" $test
+
+
+ sync_after_int
+
+
+ set test "completing $name a\$ should return a\\\$b/"
+ set cmd "$name a\$"
+ assert_complete_dir "\b\\\\\$b/" $cmd "fixtures/_filedir" $test
+
+
+ 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 "fixtures/_filedir"
+
+
+ sync_after_int
+
+
+ set cmd "$name 'a b/"
+ assert_complete_dir {i'} $cmd "fixtures/_filedir"
+
+
+ sync_after_int
+
+
+ set cmd "$name 'a\"b/"; #"
+ assert_complete_dir {d'} $cmd "fixtures/_filedir"
+
+
+ sync_after_int
+
+
+ set cmd "$name 'a\$b/"
+ if {[lindex $::BASH_VERSINFO 0] == 4} {
+ assert_complete_dir {h'} $cmd "fixtures/_filedir"
+ } else {
+ assert_complete_dir "\b\b\b\b$::TESTDIR/fixtures/_filedir/a\$b/h'" $cmd "fixtures/_filedir"
+ }
+
+
+ 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 'a\\b/"
+ assert_complete_dir {g'} $cmd "fixtures/_filedir"
+
+
+ sync_after_int
+ }
+
+
+ set cmd "$name 'a&b/"
+ assert_complete_dir {f'} $cmd "fixtures/_filedir"
+
+
+ sync_after_int
+
+
+ set cmd "$name \"ab/"; #"
+ assert_complete_dir {e"} $cmd "fixtures/_filedir"; #"
+
+
+ sync_after_int
+
+
+ set cmd "$name \"a b/"; #"
+ assert_complete_dir {i"} $cmd "fixtures/_filedir"; #"
+
+
+ sync_after_int
+
+
+ set cmd "$name \"a'b/"; #"
+ assert_complete_dir {c"} $cmd "fixtures/_filedir"; #"
+
+
+ sync_after_int
+
+
+ set cmd "$name \"a\\\"b/"; #"
+ assert_complete_dir {d"} $cmd "fixtures/_filedir"; #"
+
+
+ sync_after_int
+
+
+ set cmd "$name \"a\\\$b/"; #"
+ assert_complete_dir "\b\b\b\b\b$::TESTDIR/fixtures/_filedir/a\\\\\$b/h\\\"" $cmd "fixtures/_filedir"
+
+
+ sync_after_int
+
+
+ set cmd "$name \"a\\b/"; #"
+ assert_complete_dir "\b\b\bb/e\\\"" $cmd "fixtures/_filedir"
+
+
+ sync_after_int
+
+
+ set cmd "$name \"a\\\\b/"; #"
+ assert_complete_dir {g"} $cmd "fixtures/_filedir"; #"
+
+
+ sync_after_int
+
+
+ set cmd "$name \"a&b/"; #"
+ assert_complete_dir {f"} $cmd "fixtures/_filedir"; #"
+
+
+ sync_after_int
+
+
+ }; # if 4.0.0 < bash-version > 4.0.34
+}; # foreach
+
+
+set test "completing with filter '.e1' should show completions"
+assert_complete_dir {ee.e1 foo/ gg.e1} "g " "fixtures/_filedir/ext" $test
+
+
+sync_after_int
+
+
+set test "completing f aé should return g when LC_CTYPE=C"
+# Backup/set LC_CTYPE
+assert_bash_exec {OLD_CTYPE=$LC_CTYPE; LC_CTYPE=C}
+if {[lindex $::BASH_VERSINFO 0] > 3} {
+ assert_complete_dir g "f aé/" "fixtures/_filedir"
+} else {
+ assert_complete_dir "\b\b\b\b$'a\\\\303\\\\251/g'" "f aé/" \
+ "fixtures/_filedir"
+}
+# Restore LC_CTYPE
+assert_bash_exec {[[ $OLD_CTYPE ]] && LC_CTYPE=$OLD_CTYPE || unset LC_CTYPE}
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/unit/_get_comp_words_by_ref.exp b/test/unit/_get_comp_words_by_ref.exp
new file mode 100644
index 00000000..22561e7f
--- /dev/null
+++ b/test/unit/_get_comp_words_by_ref.exp
@@ -0,0 +1,386 @@
+proc setup {} {
+ assert_bash_exec {unset COMP_CWORD COMP_LINE COMP_POINT COMP_WORDS}
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_bash_exec { \
+ unset COMP_CWORD COMP_LINE COMP_POINT COMP_WORDS cur prev words cword \
+ cur2 prev2 words2 cword2 \
+ }
+ # Delete 'COMP_WORDBREAKS' occupying two lines
+ assert_env_unmodified {
+ /COMP_WORDBREAKS=/{N
+ d
+ }
+ }
+}; # teardown()
+
+
+setup
+
+
+set test "_get_comp_words_by_ref should run without errors"
+assert_bash_exec {_get_comp_words_by_ref cur > /dev/null} $test
+
+
+sync_after_int
+
+
+# See also ./lib/completions/alias.exp. Here `_get_cword' is actually tested
+# by moving the cursor left into the current word.
+
+
+set test "a b|"; # | = cursor position
+set cmd {COMP_WORDS=(a b); COMP_CWORD=1; COMP_LINE='a b'; COMP_POINT=3; _get_comp_words_by_ref cur prev; echo "$cur $prev"}
+assert_bash_list {"b a"} $cmd $test
+
+
+sync_after_int
+
+
+set test "a |"; # | = cursor position
+set cmd {COMP_WORDS=(a); COMP_CWORD=1; COMP_LINE='a '; 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 |"; # | = 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
+
+
+sync_after_int
+
+
+set test "a b | with WORDBREAKS -= :"; # | = cursor position
+set cmd {COMP_WORDS=(a b ''); COMP_CWORD=2; COMP_LINE='a b '; COMP_POINT=4; _get_comp_words_by_ref -n : cur; printf %s "$cur"}
+assert_bash_list {} $cmd $test
+
+
+sync_after_int
+
+
+set test "a b|c"; # | = cursor position
+set cmd {COMP_WORDS=(a bc); COMP_CWORD=1; COMP_LINE='a bc'; COMP_POINT=3; _get_comp_words_by_ref cur prev; echo "$cur $prev"}
+assert_bash_list {"b 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
+
+
+sync_after_int
+
+
+set test {a b\| c should return b\ }; # | = cursor position
+set cmd {COMP_WORDS=(a 'b\ c'); COMP_CWORD=1; COMP_LINE='a b\ c'; COMP_POINT=4; _get_comp_words_by_ref cur prev; echo "$cur $prev"}
+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=5; _get_comp_words_by_ref cur prev; echo "$cur $prev"}
+assert_bash_list {"\"b\\ a"} $cmd $test
+
+
+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}
+}; # if
+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"}
+ }
+}; # expect
+
+
+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}
+}; # if
+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"};
+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"}
+ }
+}; # expect
+
+
+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 :"}
+}; # if
+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
+set cmd {_get_comp_words_by_ref cur prev; echo "$cur $prev"}
+assert_bash_list $expected $cmd $test
+
+
+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}
+}; # if
+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"}
+assert_bash_list {"b:c a"} $cmd $test
+
+
+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}
+}; # if
+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"}
+assert_bash_list {"c: b"} $cmd $test
+
+
+sync_after_int
+
+
+set test {a :| with WORDBREAKS -= : should return :}; # | = cursor position
+set cmd {COMP_WORDS=(a :); COMP_CWORD=1; COMP_LINE='a :'; COMP_POINT=3}
+assert_bash_exec $cmd
+set cmd {_get_comp_words_by_ref -n : cur prev; echo "$cur $prev"}
+assert_bash_list {": a"} $cmd $test
+
+
+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}
+}; # if
+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"}
+assert_bash_list {"b:: a"} $cmd $test
+
+
+sync_after_int
+
+
+# This test makes sure `_get_cword' doesn't use `echo' to return it's value,
+# because -n might be interpreted by `echo' and thus will not be returned.
+set test "a -n| should return -n"; # | = cursor position
+set cmd {COMP_WORDS=(a -n); COMP_CWORD=1; COMP_LINE='a -n'; COMP_POINT=4}
+assert_bash_exec $cmd
+set cmd {_get_comp_words_by_ref cur; printf %s $cur}
+assert_bash_list -n $cmd $test
+
+
+sync_after_int
+
+
+set test {a b>c| should return c}; # | = cursor position
+set cmd {COMP_WORDS=(a b \> c); COMP_CWORD=3; COMP_LINE='a b>c'; COMP_POINT=5}
+assert_bash_exec $cmd
+set cmd {_get_comp_words_by_ref cur prev; echo "$cur"}
+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
+}; # if
+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"}
+assert_bash_list $expected $cmd $test
+
+
+sync_after_int
+
+
+set test {a *| should return *}; # | = cursor position
+set cmd {COMP_WORDS=(a \*); COMP_CWORD=1; COMP_LINE='a *'; COMP_POINT=4}
+assert_bash_exec $cmd
+set cmd {_get_comp_words_by_ref cur; echo "$cur"}
+assert_bash_list * $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=7}
+assert_bash_exec $cmd
+set cmd {_get_comp_words_by_ref cur; printf %s "$cur"}
+send "$cmd\r"
+expect -ex "$cmd\r\n"
+expect {
+ -ex "\$(b c/@" { pass "$test" }
+ # Expected failure on bash-4
+ -ex "c/@" { xfail "$test" }
+}; # expect
+
+
+sync_after_int
+
+
+set test {a $(b c\ d| should return $(b c\ d}; # | = cursor position
+set cmd {COMP_WORDS=(a '$(b c\ d'); COMP_CWORD=1; COMP_LINE='a $(b c\ d'; COMP_POINT=10}
+assert_bash_exec $cmd
+set cmd {_get_comp_words_by_ref cur; printf %s "$cur"}
+#assert_bash_list {{$(b\ c\\\ d}} $cmd $test
+send "$cmd\r"
+expect -ex "$cmd\r\n"
+expect {
+ -ex "\$(b c\\ d/@" { pass "$test" }
+ # Expected failure on bash-4
+ -ex "c\\ d/@" { xfail "$test" }
+}; # expect
+
+
+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}
+}; # if
+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"}
+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"}
+ }
+}; # expect
+
+
+sync_after_int
+
+
+set test {unknown argument should raise error}
+set cmd {_get_comp_words_by_ref dummy}
+assert_bash_list {"bash: _get_comp_words_by_ref(): `dummy': unknown argument"} $cmd $test
+
+
+sync_after_int
+
+
+set test "a b| to all vars"; # | = cursor position
+set cmd {COMP_WORDS=(a b); COMP_CWORD=1; COMP_LINE='a b'; COMP_POINT=3}
+assert_bash_exec $cmd
+set cmd { \
+ _get_comp_words_by_ref words cword prev cur; echo "${words[@]} $cword $cur $prev" \
+}
+assert_bash_list {"a b 1 b a"} $cmd $test
+
+
+sync_after_int
+
+
+set test "a b| to alternate vars"; # | = cursor position
+set cmd {COMP_WORDS=(a b); COMP_CWORD=1; COMP_LINE='a b'; COMP_POINT=3;}
+assert_bash_exec $cmd
+set cmd {_get_comp_words_by_ref -c cur2 -p prev2 -w words2 -i cword2}
+assert_bash_exec $cmd
+set cmd {echo "$cur2 $prev2 ${words2[@]} $cword2"}
+assert_bash_list {"b a a b 1"} $cmd $test
+
+
+sync_after_int
+
+
+set test "a b| to alternate vars"; # | = cursor position
+set cmd {COMP_WORDS=(a b); COMP_CWORD=1; COMP_LINE='a b'; COMP_POINT=3;}
+assert_bash_exec $cmd
+set cmd {_get_comp_words_by_ref -c cur2 -p prev2 -w words2 -i cword2}
+assert_bash_exec $cmd
+set cmd {echo "$cur2 $prev2 ${words2[@]} $cword2"}
+assert_bash_list {"b a a b 1"} $cmd $test
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/unit/_get_cword.exp b/test/unit/_get_cword.exp
new file mode 100644
index 00000000..1e6e9bfb
--- /dev/null
+++ b/test/unit/_get_cword.exp
@@ -0,0 +1,316 @@
+proc setup {} {
+ assert_bash_exec {unset COMP_CWORD COMP_LINE COMP_POINT COMP_WORDS}
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_bash_exec {unset COMP_CWORD COMP_LINE COMP_POINT COMP_WORDS}
+ # Delete 'COMP_WORDBREAKS' occupying two lines
+ assert_env_unmodified {
+ /COMP_WORDBREAKS=/{N
+ d
+ }
+ }
+}; # teardown()
+
+
+setup
+
+
+set test "_get_cword should run without errors"
+assert_bash_exec {_get_cword > /dev/null} $test
+
+
+sync_after_int
+
+
+# See also ./lib/completions/alias.exp. Here `_get_cword' is actually tested
+# by moving the cursor left into the current word.
+
+
+set test "a b| should return b"; # | = cursor position
+set cmd {COMP_WORDS=(a b); COMP_CWORD=1; COMP_LINE='a b'; COMP_POINT=3; _get_cword}
+assert_bash_list b $cmd $test
+
+
+sync_after_int
+
+
+set test "a | should return nothing"; # | = cursor position
+set cmd {COMP_WORDS=(a); COMP_CWORD=1; COMP_LINE='a '; COMP_POINT=2; _get_cword}
+send "$cmd\r"
+expect -ex "$cmd\r\n/@" {pass "$test"}
+
+
+sync_after_int
+
+
+set test "a b | should return nothing"; # | = cursor position
+set cmd {COMP_WORDS=(a b ''); COMP_CWORD=2; COMP_LINE='a b '; COMP_POINT=4; _get_cword}
+send "$cmd\r"
+expect -ex "$cmd\r\n/@" {pass "$test"}
+
+
+sync_after_int
+
+
+set test "a b | with WORDBREAKS -= : should return nothing"; # | = cursor position
+set cmd {COMP_WORDS=(a b ''); COMP_CWORD=2; COMP_LINE='a b '; COMP_POINT=4; _get_cword :}
+send "$cmd\r"
+expect -ex "$cmd\r\n/@" {pass "$test"}
+
+
+sync_after_int
+
+
+set test "a b|c should return b"; # | = cursor position
+set cmd {COMP_WORDS=(a bc); COMP_CWORD=1; COMP_LINE='a bc'; COMP_POINT=3; _get_cword}
+assert_bash_list b $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_cword}
+assert_bash_list {"b\\ c"} $cmd $test
+
+
+sync_after_int
+
+
+set test {a b\| c should return b\ }; # | = cursor position
+set cmd {COMP_WORDS=(a 'b\ c'); COMP_CWORD=1; COMP_LINE='a b\ c'; COMP_POINT=4; _get_cword}
+assert_bash_list {"b\\"} $cmd $test
+
+
+sync_after_int
+
+
+set test {a "b\| should return "b\ }; # | = cursor position
+set cmd {COMP_WORDS=(a '"b\'); COMP_CWORD=1; COMP_LINE='a "b\'; COMP_POINT=5; _get_cword}
+assert_bash_list {"\"b\\"} $cmd $test
+
+
+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}
+}; # if
+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"}
+ }
+}; # expect
+
+
+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}
+}; # if
+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"}
+ }
+}; # expect
+
+
+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
+}; # if
+append cmd {; COMP_LINE='a b:c'; COMP_POINT=5; _get_cword}
+assert_bash_list $expected $cmd $test
+
+
+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}
+}; # if
+append cmd {; COMP_LINE='a b:c'; COMP_POINT=5; _get_cword :}
+assert_bash_list b:c $cmd $test
+
+
+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}
+}; # if
+append cmd {; COMP_LINE='a b c:'; COMP_POINT=6; _get_cword :}
+assert_bash_list c: $cmd $test
+
+
+sync_after_int
+
+
+set test {a :| with WORDBREAKS -= : should return :}; # | = cursor position
+set cmd {COMP_WORDS=(a :); COMP_CWORD=1; COMP_LINE='a :'; COMP_POINT=3; _get_cword :}
+assert_bash_list : $cmd $test
+
+
+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}
+}; # if
+append cmd {; COMP_LINE='a b::'; COMP_POINT=5; _get_cword :}
+assert_bash_list b:: $cmd $test
+
+
+sync_after_int
+
+
+# This test makes sure `_get_cword' doesn't use `echo' to return it's value,
+# because -n might be interpreted by `echo' and thus will not be returned.
+set test "a -n| should return -n"; # | = cursor position
+set cmd {COMP_WORDS=(a -n); COMP_CWORD=1; COMP_LINE='a -n'; COMP_POINT=4; _get_cword}
+assert_bash_list -n $cmd $test
+
+
+sync_after_int
+
+
+set test {a b>c| should return c}; # | = cursor position
+set cmd {COMP_WORDS=(a b \> c); COMP_CWORD=3; COMP_LINE='a b>c'; COMP_POINT=5; _get_cword}
+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
+}; # if
+append cmd {; COMP_LINE='a b=c'; COMP_POINT=5; _get_cword}
+assert_bash_list $expected $cmd $test
+
+
+sync_after_int
+
+
+set test {a *| should return *}; # | = cursor position
+set cmd {COMP_WORDS=(a \*); COMP_CWORD=1; COMP_LINE='a *'; COMP_POINT=4; _get_cword}
+assert_bash_list * $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=7; _get_cword}
+#assert_bash_list {{$(b\ c}} $cmd $test
+send "$cmd\r"
+expect -ex "$cmd\r\n"
+expect {
+ -ex "\$(b c/@" { pass "$test" }
+ # Expected failure on bash-4
+ -ex "c/@" { xfail "$test" }
+}; # expect
+
+
+sync_after_int
+
+
+set test {a $(b c\ d| should return $(b c\ d}; # | = cursor position
+set cmd {COMP_WORDS=(a '$(b c\ d'); COMP_CWORD=1; COMP_LINE='a $(b c\ d'; COMP_POINT=10; _get_cword}
+#assert_bash_list {{$(b\ c\\\ d}} $cmd $test
+send "$cmd\r"
+expect -ex "$cmd\r\n"
+expect {
+ -ex "\$(b c\\ d/@" { pass "$test" }
+ # Expected failure on bash-4
+ -ex "c\\ d/@" { xfail "$test" }
+}; # expect
+
+
+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}
+}; # if
+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"}
+ }
+}; # expect
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/unit/_known_hosts_real.exp b/test/unit/_known_hosts_real.exp
new file mode 100644
index 00000000..152cf885
--- /dev/null
+++ b/test/unit/_known_hosts_real.exp
@@ -0,0 +1,118 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified {
+ /COMPREPLY=/d
+ /OLDHOME=/d
+ }
+}; # teardown()
+
+
+setup
+
+
+set test "Hosts should be put in COMPREPLY"
+set hosts [get_hosts]
+ # Hosts `gee', `hus' and `jar' are defined in ./fixtures/_known_hosts_real/config
+ # doo, ike, jub, 10.0.0.1, kyl and 100.0.0.2 in ./fixtures/_known_hosts_real/known_hosts
+lappend hosts doo gee hus ike jar jub kyl 10.0.0.1 100.0.0.2
+set cmd {unset COMPREPLY; _known_hosts_real -aF fixtures/_known_hosts_real/config ''; echo_array COMPREPLY}
+assert_bash_list $hosts $cmd $test
+
+
+sync_after_int
+
+
+set test "Hosts should have username prefix and colon suffix"
+set hosts [get_hosts]
+ # Hosts `gee', `hus' and `jar' are defined in ./fixtures/_known_hosts_real/config
+ # doo, ike jub, 10.0.0.1, kyl and 100.0.0.2 in ./fixtures/_known_hosts_real/known_hosts
+lappend hosts doo gee hus ike jar jub kyl 10.0.0.1 100.0.0.2
+set hosts [lsort -ascii $hosts]
+set expected {}
+foreach host $hosts {
+ lappend expected "user@$host:"
+}; # foreach
+ # Call _known_hosts
+set cmd {unset COMPREPLY; _known_hosts_real -acF fixtures/_known_hosts_real/config 'user@'; echo_array COMPREPLY}
+assert_bash_list $expected $cmd $test
+
+
+sync_after_int
+
+
+set test "Files containing consecutive spaces should work"
+set hosts [get_hosts]
+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
+lappend hosts gee hus two
+set hosts_config $hosts
+ # Hosts `doo' and `ike' are defined in `./fixtures/_known_hosts_/spaced known_hosts'
+lappend hosts doo ike
+set hosts [join [bash_sort $hosts ] "\\s+"]
+set hosts_orig [join [bash_sort $hosts_orig ] "\\s+"]
+set hosts_config [join [bash_sort $hosts_config] "\\s+"]
+ # Call _known_hosts
+set cmd {unset COMPREPLY; _known_hosts_real -aF 'fixtures/_known_hosts_real/spaced conf' ''; echo_array COMPREPLY}
+send "$cmd\r"
+expect -ex "$cmd\r\n"
+expect {
+ -re "^$hosts\r\n/@$" { pass "$test" }
+ -re "^$hosts_orig\r\n/@$" { fail "$test (config file)" }
+ -re "^$hosts_config\r\n/@$" { fail "$test (known hosts file)" }
+ -re /@ { unresolved "$test at prompt" }
+ default { unresolved "$test" }
+}; # expect
+
+
+sync_after_int
+
+
+set test "Files starting with tilde (~) should work"
+set hosts [get_hosts]
+ # 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
+set hosts [join [bash_sort $hosts] "\\s+"]
+ # Setup environment
+set cmd {OLDHOME=$HOME; HOME=$TESTDIR}
+send "$cmd\r"
+expect -ex "$cmd\r\n/@"
+ # Call _known_hosts
+set cmd {unset COMPREPLY; _known_hosts_real -aF fixtures/_known_hosts_real/config_tilde ''; echo_array COMPREPLY}
+send "$cmd\r"
+expect -ex "$cmd\r\n"
+expect {
+ -re "^$hosts\r\n/@$" { pass "$test" }
+ default { unresolved "$test" }
+}; # expect
+ # Teardown environment
+set cmd {HOME=$OLDHOME}
+send "$cmd\r"
+expect -ex "$cmd\r\n/@"
+
+
+sync_after_int
+
+
+set test "Empty COMP_KNOWN_HOSTS_WITH_HOSTFILE should omit HOSTFILE"
+assert_bash_exec "COMP_KNOWN_HOSTS_WITH_HOSTFILE="
+set hosts [get_hosts_avahi]
+ # Hosts `gee', `hus' and `jar' are defined in ./fixtures/_known_hosts_real/config
+ # doo, ike, jub, 10.0.0.1, kyl and 100.0.0.2 in ./fixtures/_known_hosts_real/known_hosts
+lappend hosts doo gee hus ike jar jub kyl 10.0.0.1 100.0.0.2
+ # Call _known_hosts
+set cmd {unset COMPREPLY; _known_hosts_real -aF fixtures/_known_hosts_real/config ''; echo_array COMPREPLY}
+assert_bash_list $hosts $cmd $test
+sync_after_int
+assert_bash_exec "unset -v COMP_KNOWN_HOSTS_WITH_HOSTFILE"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/unit/compgen.exp b/test/unit/compgen.exp
new file mode 100644
index 00000000..6673bf0e
--- /dev/null
+++ b/test/unit/compgen.exp
@@ -0,0 +1,52 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified {/OLDPWD/d}
+}; # 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/}
+}; # if
+set dir fixtures/compgen
+set prompt "/$dir/@"
+assert_bash_exec "cd $dir" "" $prompt
+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 $prompt { pass "$test" }
+ -re eof { unresolved "eof" }
+}; # expect
+sync_after_int $prompt
+assert_bash_exec {cd "$TESTDIR"}
+
+#assert_bash_list_dir {a\\\'b/c} $cmd fixtures/compgen
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/unit/find_unique_completion_pair.exp b/test/unit/find_unique_completion_pair.exp
new file mode 100644
index 00000000..ec7f040d
--- /dev/null
+++ b/test/unit/find_unique_completion_pair.exp
@@ -0,0 +1,37 @@
+# Note: This test actually tests a function in the test library. It doesn't
+# need bash running; but it doesn't hurt either.
+
+# Run one test. Look below for usage.
+proc test_find_ucp {{list} {epart} {econt} {eret 1}} {
+ set efull "$epart$econt"
+ set rret [find_unique_completion_pair $list rpart rfull]
+ if {$eret != $rret} {
+ if {$eret} {
+ fail "find_unique_completion_pair: Nothing found for {$list}"
+ } else {
+ fail "find_unique_completion_pair: Expected failure for {$list}"
+ }
+ } elseif {!$eret} {
+ pass "find_unique_completion_pair: No results for list {$list}"
+ } elseif {$rpart != $epart || $rfull != $efull} {
+ fail "find_unique_completion_pair: Got \"$rpart\", \"$rfull\" \
+ instead of \"$epart\", \"$efull\" for list {$list}"
+ } else {
+ pass "find_unique_completion_pair: Got \"$epart\", \"$efull\" \
+ for list {$list}"
+ }
+}
+
+test_find_ucp {a} 0 0 0
+test_find_ucp {ab} a b
+test_find_ucp {a ab abcd abc} 0 0 0
+test_find_ucp {a ab abcde abc} abcd e
+test_find_ucp {user1 user2} 0 0 0
+test_find_ucp {root username2 username1} ro ot
+test_find_ucp {root username21 username2} ro ot
+test_find_ucp {long_user_name lang_user_name long_usor_name} lang_us er_name
+test_find_ucp {lang_user_name1 long_user_name lang_user_name long_usor_name} \
+ long_use r_name
+test_find_ucp {root username} user name
+test_find_ucp {a aladin} ala din
+test_find_ucp {ala aladin} alad in