summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Paleino <dapal@debian.org>2011-01-09 18:19:18 +0100
committerDavid Paleino <dapal@debian.org>2011-01-09 18:19:18 +0100
commita5e203cfe5bc335667900a3026a13e613152b50c (patch)
treecbc49be2e8062a929ddb2cfc56e15adfdcab2c49
parentbccf24e53240356343eb48c00cd256fb7ad2a39a (diff)
parentfe2d7645df9f619a33feb8c8d7c89b1ea5fcad6b (diff)
downloadbash-completion-a5e203cfe5bc335667900a3026a13e613152b50c.tar.gz
Merge branch 'master' into 1.x
Conflicts: CHANGES configure.ac
-rw-r--r--CHANGES74
-rw-r--r--Makefile.am171
-rw-r--r--README25
-rwxr-xr-xautogen.sh4
-rw-r--r--bash_completion401
-rw-r--r--bash_completion.sh.in2
-rw-r--r--completions/Makefile.am182
-rw-r--r--completions/_mock (renamed from contrib/_mock)23
-rw-r--r--completions/_modules (renamed from contrib/_modules)0
-rw-r--r--completions/_subversion360
-rw-r--r--completions/_yum (renamed from contrib/_yum)2
-rw-r--r--completions/_yum-utils (renamed from contrib/_yum-utils)2
-rw-r--r--completions/abook (renamed from contrib/abook)4
-rw-r--r--completions/ant (renamed from contrib/ant)3
-rw-r--r--completions/apache2ctl (renamed from contrib/apache2ctl)0
-rw-r--r--completions/apt (renamed from contrib/apt)4
-rw-r--r--completions/apt-build (renamed from contrib/apt-build)2
-rw-r--r--completions/aptitude (renamed from contrib/aptitude)0
-rw-r--r--completions/aspell (renamed from contrib/aspell)2
-rw-r--r--completions/autoconf124
-rw-r--r--completions/automake80
-rw-r--r--completions/autorpm (renamed from contrib/autorpm)0
-rw-r--r--completions/bash-builtins (renamed from contrib/bash-builtins)14
-rw-r--r--completions/bind-utils (renamed from contrib/bind-utils)0
-rw-r--r--completions/bitkeeper (renamed from contrib/bitkeeper)0
-rw-r--r--completions/bittorrent (renamed from contrib/bittorrent)0
-rw-r--r--completions/bluez (renamed from contrib/bluez)0
-rw-r--r--completions/brctl (renamed from contrib/brctl)0
-rw-r--r--completions/bzip2 (renamed from contrib/bzip2)5
-rw-r--r--completions/cardctl (renamed from contrib/cardctl)0
-rw-r--r--completions/cfengine (renamed from contrib/cfengine)0
-rw-r--r--completions/chkconfig (renamed from contrib/chkconfig)0
-rw-r--r--completions/chsh (renamed from contrib/chsh)0
-rw-r--r--completions/cksfv (renamed from contrib/cksfv)0
-rw-r--r--completions/clisp (renamed from contrib/clisp)0
-rw-r--r--completions/configure (renamed from contrib/configure)4
-rw-r--r--completions/coreutils (renamed from contrib/coreutils)9
-rw-r--r--completions/cowsay (renamed from contrib/cowsay)0
-rw-r--r--completions/cpan2dist (renamed from contrib/cpan2dist)0
-rw-r--r--completions/cpio (renamed from contrib/cpio)3
-rw-r--r--completions/crontab60
-rw-r--r--completions/cryptsetup (renamed from contrib/cryptsetup)0
-rw-r--r--completions/cups (renamed from contrib/cups)2
-rw-r--r--completions/cvs (renamed from contrib/cvs)2
-rw-r--r--completions/cvsps (renamed from contrib/cvsps)0
-rw-r--r--completions/dd (renamed from contrib/dd)28
-rw-r--r--completions/dhclient (renamed from contrib/dhclient)0
-rw-r--r--completions/dict (renamed from contrib/dict)0
-rw-r--r--completions/dpkg (renamed from contrib/dpkg)2
-rw-r--r--completions/dselect (renamed from contrib/dselect)3
-rw-r--r--completions/dsniff (renamed from contrib/dsniff)0
-rw-r--r--completions/dvd+rw-tools47
-rw-r--r--completions/e2fsprogs180
-rw-r--r--completions/findutils (renamed from contrib/findutils)2
-rw-r--r--completions/freeciv (renamed from contrib/freeciv)0
-rw-r--r--completions/freerdp47
-rw-r--r--completions/fuse (renamed from contrib/fuse)2
-rw-r--r--completions/gcc (renamed from contrib/gcc)4
-rw-r--r--completions/gcl (renamed from contrib/gcl)0
-rw-r--r--completions/gdb (renamed from contrib/gdb)1
-rw-r--r--completions/genisoimage (renamed from contrib/genisoimage)2
-rw-r--r--completions/getent (renamed from contrib/getent)0
-rw-r--r--completions/gkrellm (renamed from contrib/gkrellm)2
-rw-r--r--completions/gnatmake (renamed from contrib/gnatmake)2
-rw-r--r--completions/gpg (renamed from contrib/gpg)0
-rw-r--r--completions/gpg2 (renamed from contrib/gpg2)0
-rw-r--r--completions/gzip (renamed from contrib/gzip)5
-rw-r--r--completions/heimdal (renamed from contrib/heimdal)0
-rw-r--r--completions/helpers/Makefile.am3
-rwxr-xr-xcompletions/helpers/perl88
-rw-r--r--completions/hping2 (renamed from contrib/hping2)4
-rw-r--r--completions/iconv (renamed from contrib/iconv)2
-rw-r--r--completions/iftop35
-rw-r--r--completions/ifupdown (renamed from contrib/ifupdown)0
-rw-r--r--completions/imagemagick (renamed from contrib/imagemagick)22
-rw-r--r--completions/info (renamed from contrib/info)2
-rw-r--r--completions/ipmitool214
-rw-r--r--completions/iproute2285
-rw-r--r--completions/ipsec (renamed from contrib/ipsec)0
-rw-r--r--completions/iptables (renamed from contrib/iptables)0
-rw-r--r--completions/ipv6calc (renamed from contrib/ipv6calc)2
-rw-r--r--completions/isql (renamed from contrib/isql)0
-rw-r--r--completions/jar (renamed from contrib/jar)4
-rw-r--r--completions/java (renamed from contrib/java)108
-rw-r--r--completions/k3b (renamed from contrib/k3b)2
-rw-r--r--completions/kldload (renamed from contrib/kldload)5
-rw-r--r--completions/larch (renamed from contrib/larch)0
-rw-r--r--completions/ldapvi (renamed from contrib/ldapvi)0
-rw-r--r--completions/lftp (renamed from contrib/lftp)3
-rw-r--r--completions/lilo (renamed from contrib/lilo)0
-rw-r--r--completions/links (renamed from contrib/links)2
-rw-r--r--completions/lintian (renamed from contrib/lintian)4
-rw-r--r--completions/lisp (renamed from contrib/lisp)0
-rw-r--r--completions/lrzip64
-rw-r--r--completions/lsof64
-rw-r--r--completions/lvm (renamed from contrib/lvm)0
-rw-r--r--completions/lzma (renamed from contrib/lzma)5
-rw-r--r--completions/lzop (renamed from contrib/lzop)5
-rw-r--r--completions/mailman (renamed from contrib/mailman)8
-rw-r--r--completions/make (renamed from contrib/make)2
-rw-r--r--completions/man (renamed from contrib/man)10
-rw-r--r--completions/mc (renamed from contrib/mc)2
-rw-r--r--completions/mcrypt (renamed from contrib/mcrypt)6
-rw-r--r--completions/mdadm (renamed from contrib/mdadm)0
-rw-r--r--completions/medusa (renamed from contrib/medusa)0
-rw-r--r--completions/minicom (renamed from contrib/minicom)0
-rw-r--r--completions/mkinitrd (renamed from contrib/mkinitrd)0
-rw-r--r--completions/module-init-tools (renamed from contrib/module-init-tools)2
-rw-r--r--completions/monodevelop (renamed from contrib/monodevelop)3
-rw-r--r--completions/mount (renamed from contrib/mount)0
-rw-r--r--completions/mplayer (renamed from contrib/mplayer)59
-rw-r--r--completions/msynctool (renamed from contrib/msynctool)0
-rw-r--r--completions/mtx (renamed from contrib/mtx)0
-rw-r--r--completions/munin-node (renamed from contrib/munin-node)0
-rw-r--r--completions/mutt (renamed from contrib/mutt)5
-rw-r--r--completions/mysqladmin (renamed from contrib/mysqladmin)2
-rw-r--r--completions/ncftp (renamed from contrib/ncftp)0
-rw-r--r--completions/net-tools (renamed from contrib/net-tools)26
-rw-r--r--completions/nmap (renamed from contrib/nmap)0
-rw-r--r--completions/ntpdate (renamed from contrib/ntpdate)0
-rw-r--r--completions/openldap (renamed from contrib/openldap)0
-rw-r--r--completions/openssl (renamed from contrib/openssl)0
-rw-r--r--completions/p4 (renamed from contrib/p4)12
-rw-r--r--completions/perl131
-rw-r--r--completions/pine (renamed from contrib/pine)0
-rw-r--r--completions/pkg-config (renamed from contrib/pkg-config)0
-rw-r--r--completions/pkg_install (renamed from contrib/pkg_install)0
-rw-r--r--completions/pkgtools (renamed from contrib/pkgtools)0
-rw-r--r--completions/pm-utils (renamed from contrib/pm-utils)0
-rw-r--r--completions/portupgrade (renamed from contrib/portupgrade)0
-rw-r--r--completions/postfix (renamed from contrib/postfix)18
-rw-r--r--completions/postgresql (renamed from contrib/postgresql)19
-rw-r--r--completions/povray (renamed from contrib/povray)6
-rw-r--r--completions/procps (renamed from contrib/procps)0
-rw-r--r--completions/python54
-rw-r--r--completions/qdbus (renamed from contrib/qdbus)0
-rw-r--r--completions/qemu (renamed from contrib/qemu)4
-rw-r--r--completions/quota-tools (renamed from contrib/quota-tools)0
-rw-r--r--completions/rcs (renamed from contrib/rcs)2
-rw-r--r--completions/rdesktop (renamed from contrib/rdesktop)0
-rw-r--r--completions/reportbug (renamed from contrib/reportbug)4
-rw-r--r--completions/resolvconf (renamed from contrib/resolvconf)0
-rw-r--r--completions/rfkill (renamed from contrib/rfkill)0
-rw-r--r--completions/ri (renamed from contrib/ri)0
-rw-r--r--completions/rpcdebug (renamed from contrib/rpcdebug)0
-rw-r--r--completions/rpm (renamed from contrib/rpm)68
-rw-r--r--completions/rpmcheck (renamed from contrib/rpmcheck)0
-rw-r--r--completions/rrdtool (renamed from contrib/rrdtool)0
-rw-r--r--completions/rsync (renamed from contrib/rsync)0
-rw-r--r--completions/rtcwake (renamed from contrib/rtcwake)0
-rw-r--r--completions/samba (renamed from contrib/samba)0
-rw-r--r--completions/sbcl (renamed from contrib/sbcl)10
-rw-r--r--completions/screen (renamed from contrib/screen)20
-rw-r--r--completions/service (renamed from contrib/service)10
-rw-r--r--completions/sh41
-rw-r--r--completions/shadow (renamed from contrib/shadow)21
-rw-r--r--completions/sitecopy (renamed from contrib/sitecopy)0
-rw-r--r--completions/smartctl (renamed from contrib/smartctl)0
-rw-r--r--completions/snownews (renamed from contrib/snownews)0
-rw-r--r--completions/sqlite339
-rw-r--r--completions/ssh (renamed from contrib/ssh)11
-rw-r--r--completions/sshfs (renamed from contrib/sshfs)0
-rw-r--r--completions/strace103
-rw-r--r--completions/svk (renamed from contrib/svk)2
-rw-r--r--completions/sysbench175
-rw-r--r--completions/sysctl (renamed from contrib/sysctl)3
-rw-r--r--completions/sysv-rc (renamed from contrib/sysv-rc)0
-rw-r--r--completions/tar (renamed from contrib/tar)54
-rw-r--r--completions/tcpdump (renamed from contrib/tcpdump)0
-rw-r--r--completions/unace (renamed from contrib/unace)4
-rw-r--r--completions/unrar (renamed from contrib/unrar)4
-rw-r--r--completions/update-alternatives (renamed from contrib/update-alternatives)0
-rw-r--r--completions/util-linux (renamed from contrib/util-linux)2
-rw-r--r--completions/vncviewer (renamed from contrib/vncviewer)0
-rw-r--r--completions/vpnc (renamed from contrib/vpnc)0
-rw-r--r--completions/wireless-tools (renamed from contrib/wireless-tools)0
-rw-r--r--completions/wodim118
-rw-r--r--completions/wol (renamed from contrib/wol)0
-rw-r--r--completions/wtf (renamed from contrib/wtf)2
-rw-r--r--completions/wvdial (renamed from contrib/wvdial)4
-rw-r--r--completions/xhost (renamed from contrib/xhost)0
-rw-r--r--completions/xm (renamed from contrib/xm)0
-rw-r--r--completions/xmllint (renamed from contrib/xmllint)12
-rw-r--r--completions/xmlwf (renamed from contrib/xmlwf)2
-rw-r--r--completions/xmms (renamed from contrib/xmms)4
-rw-r--r--completions/xmodmap32
-rw-r--r--completions/xrandr (renamed from contrib/xrandr)0
-rw-r--r--completions/xrdb37
-rw-r--r--completions/xsltproc (renamed from contrib/xsltproc)2
-rw-r--r--completions/xz (renamed from contrib/xz)9
-rw-r--r--completions/yp-tools (renamed from contrib/yp-tools)0
-rw-r--r--completions/yum-arch (renamed from contrib/yum-arch)2
-rw-r--r--configure.ac8
-rw-r--r--contrib/_subversion429
-rw-r--r--contrib/ipmitool38
-rw-r--r--contrib/perl127
-rw-r--r--contrib/python58
-rw-r--r--contrib/strace102
-rw-r--r--contrib/wodim84
-rw-r--r--doc/bash_completion.txt11
-rw-r--r--doc/styleguide.txt12
-rw-r--r--test/Makefile.am10
-rw-r--r--test/completion/aclocal.exp1
-rw-r--r--test/completion/acroread.exp4
-rw-r--r--test/completion/autoheader.exp1
-rw-r--r--test/completion/autoreconf.exp1
-rw-r--r--test/completion/autoscan.exp1
-rw-r--r--test/completion/autoupdate.exp1
-rw-r--r--test/completion/badblocks.exp1
-rw-r--r--test/completion/crontab.exp1
-rw-r--r--test/completion/dumpe2fs.exp1
-rw-r--r--test/completion/e2freefrag.exp1
-rw-r--r--test/completion/e2label.exp1
-rw-r--r--test/completion/ether-wake.exp1
-rw-r--r--test/completion/filefrag.exp1
-rw-r--r--test/completion/finger.exp7
-rw-r--r--test/completion/freerdp.exp1
-rw-r--r--test/completion/growisofs.exp1
-rw-r--r--test/completion/hping2.exp1
-rw-r--r--test/completion/iftop.exp1
-rw-r--r--test/completion/ip.exp1
-rw-r--r--test/completion/ipmitool.exp1
-rw-r--r--test/completion/lrzip.exp1
-rw-r--r--test/completion/lsof.exp1
-rw-r--r--test/completion/sh.exp1
-rw-r--r--test/completion/sqlite3.exp1
-rw-r--r--test/completion/sysbench.exp1
-rw-r--r--test/completion/tune2fs.exp1
-rw-r--r--test/completion/xmodmap.exp1
-rw-r--r--test/completion/xrdb.exp1
-rw-r--r--test/config/bashrc9
-rw-r--r--test/config/default.exp26
-rw-r--r--test/fixtures/_filedir/ext/ii.E10
-rw-r--r--test/fixtures/_known_hosts_real/known_hosts7
-rw-r--r--test/fixtures/acroread/bar0
-rw-r--r--test/fixtures/acroread/foo.d/.gitignore0
-rw-r--r--test/fixtures/acroread/t.pdf0
-rw-r--r--test/fixtures/man/man1/bar.1.bz20
-rw-r--r--test/fixtures/man/man1/foo.10
-rw-r--r--test/fixtures/man/man3/Bash::Completion.3pm.gz0
-rw-r--r--test/fixtures/scp/known_hosts1
-rw-r--r--test/fixtures/sftp/known_hosts1
-rwxr-xr-xtest/generate4
-rw-r--r--test/lib/completion.exp10
-rw-r--r--test/lib/completions/a2ps.exp4
-rw-r--r--test/lib/completions/abook.exp4
-rw-r--r--test/lib/completions/aclocal.exp20
-rw-r--r--test/lib/completions/acroread.exp10
-rw-r--r--test/lib/completions/add_members.exp4
-rw-r--r--test/lib/completions/alias.exp6
-rw-r--r--test/lib/completions/animate.exp4
-rw-r--r--test/lib/completions/ant.exp4
-rw-r--r--test/lib/completions/apache2ctl.exp4
-rw-r--r--test/lib/completions/apt-build.exp4
-rw-r--r--test/lib/completions/apt-cache.exp4
-rw-r--r--test/lib/completions/apt-get.exp4
-rw-r--r--test/lib/completions/aptitude.exp4
-rw-r--r--test/lib/completions/arch.exp4
-rw-r--r--test/lib/completions/arpspoof.exp4
-rw-r--r--test/lib/completions/aspell.exp4
-rw-r--r--test/lib/completions/autoconf.exp4
-rw-r--r--test/lib/completions/autoheader.exp20
-rw-r--r--test/lib/completions/automake.exp4
-rw-r--r--test/lib/completions/autoreconf.exp20
-rw-r--r--test/lib/completions/autorpm.exp4
-rw-r--r--test/lib/completions/autoscan.exp20
-rw-r--r--test/lib/completions/autoupdate.exp20
-rw-r--r--test/lib/completions/awk.exp4
-rw-r--r--test/lib/completions/badblocks.exp20
-rw-r--r--test/lib/completions/bash.exp4
-rw-r--r--test/lib/completions/bc.exp4
-rw-r--r--test/lib/completions/bison.exp4
-rw-r--r--test/lib/completions/bk.exp4
-rw-r--r--test/lib/completions/brctl.exp4
-rw-r--r--test/lib/completions/btdownloadcurses.py.exp4
-rw-r--r--test/lib/completions/btdownloadgui.py.exp4
-rw-r--r--test/lib/completions/btdownloadheadless.py.exp4
-rw-r--r--test/lib/completions/bzip2.exp4
-rw-r--r--test/lib/completions/c++.exp4
-rw-r--r--test/lib/completions/cancel.exp8
-rw-r--r--test/lib/completions/cardctl.exp4
-rw-r--r--test/lib/completions/cat.exp4
-rw-r--r--test/lib/completions/cc.exp4
-rw-r--r--test/lib/completions/cd.exp20
-rw-r--r--test/lib/completions/cdrecord.exp4
-rw-r--r--test/lib/completions/change_pw.exp4
-rw-r--r--test/lib/completions/check_db.exp4
-rw-r--r--test/lib/completions/check_perms.exp4
-rw-r--r--test/lib/completions/chgrp.exp4
-rw-r--r--test/lib/completions/chkconfig.exp4
-rw-r--r--test/lib/completions/chown.exp11
-rw-r--r--test/lib/completions/chsh.exp4
-rw-r--r--test/lib/completions/ci.exp4
-rw-r--r--test/lib/completions/civclient.exp4
-rw-r--r--test/lib/completions/civserver.exp4
-rw-r--r--test/lib/completions/cksfv.exp4
-rw-r--r--test/lib/completions/cleanarch.exp4
-rw-r--r--test/lib/completions/clisp.exp4
-rw-r--r--test/lib/completions/clone_member.exp4
-rw-r--r--test/lib/completions/co.exp4
-rw-r--r--test/lib/completions/composite.exp4
-rw-r--r--test/lib/completions/config_list.exp4
-rw-r--r--test/lib/completions/configure.exp4
-rw-r--r--test/lib/completions/convert.exp4
-rw-r--r--test/lib/completions/cowsay.exp4
-rw-r--r--test/lib/completions/cp.exp4
-rw-r--r--test/lib/completions/cpio.exp4
-rw-r--r--test/lib/completions/createdb.exp4
-rw-r--r--test/lib/completions/crontab.exp20
-rw-r--r--test/lib/completions/cryptsetup.exp4
-rw-r--r--test/lib/completions/csplit.exp4
-rw-r--r--test/lib/completions/cut.exp4
-rw-r--r--test/lib/completions/cvs.exp8
-rw-r--r--test/lib/completions/cvsps.exp8
-rw-r--r--test/lib/completions/date.exp4
-rw-r--r--test/lib/completions/dcop.exp6
-rw-r--r--test/lib/completions/dd.exp6
-rw-r--r--test/lib/completions/df.exp4
-rw-r--r--test/lib/completions/dhclient.exp4
-rw-r--r--test/lib/completions/dict.exp4
-rw-r--r--test/lib/completions/diff.exp4
-rw-r--r--test/lib/completions/dir.exp4
-rw-r--r--test/lib/completions/display.exp4
-rw-r--r--test/lib/completions/dnsspoof.exp4
-rw-r--r--test/lib/completions/dpkg-deb.exp4
-rw-r--r--test/lib/completions/dpkg-reconfigure.exp4
-rw-r--r--test/lib/completions/dpkg-source.exp4
-rw-r--r--test/lib/completions/dpkg.exp6
-rw-r--r--test/lib/completions/dropdb.exp4
-rw-r--r--test/lib/completions/dselect.exp4
-rw-r--r--test/lib/completions/dsniff.exp4
-rw-r--r--test/lib/completions/du.exp4
-rw-r--r--test/lib/completions/dumpdb.exp4
-rw-r--r--test/lib/completions/dumpe2fs.exp20
-rw-r--r--test/lib/completions/e2freefrag.exp20
-rw-r--r--test/lib/completions/e2label.exp20
-rw-r--r--test/lib/completions/enscript.exp4
-rw-r--r--test/lib/completions/env.exp6
-rw-r--r--test/lib/completions/ether-wake.exp20
-rw-r--r--test/lib/completions/evince.exp6
-rw-r--r--test/lib/completions/expand.exp6
-rw-r--r--test/lib/completions/filefrag.exp20
-rw-r--r--test/lib/completions/filesnarf.exp4
-rw-r--r--test/lib/completions/find.exp12
-rw-r--r--test/lib/completions/find_member.exp4
-rw-r--r--test/lib/completions/finger.exp16
-rw-r--r--test/lib/completions/fmt.exp6
-rw-r--r--test/lib/completions/fold.exp6
-rw-r--r--test/lib/completions/freerdp.exp20
-rw-r--r--test/lib/completions/g++.exp4
-rw-r--r--test/lib/completions/g4.exp4
-rw-r--r--test/lib/completions/g77.exp4
-rw-r--r--test/lib/completions/gcc.exp4
-rw-r--r--test/lib/completions/gcj.exp4
-rw-r--r--test/lib/completions/gcl.exp4
-rw-r--r--test/lib/completions/gdb.exp4
-rw-r--r--test/lib/completions/genaliases.exp4
-rw-r--r--test/lib/completions/getent.exp4
-rw-r--r--test/lib/completions/gkrellm.exp4
-rw-r--r--test/lib/completions/gmplayer.exp4
-rw-r--r--test/lib/completions/gnatmake.exp4
-rw-r--r--test/lib/completions/gpc.exp4
-rw-r--r--test/lib/completions/gperf.exp4
-rw-r--r--test/lib/completions/gpg.exp4
-rw-r--r--test/lib/completions/gprof.exp6
-rw-r--r--test/lib/completions/grep.exp4
-rw-r--r--test/lib/completions/growisofs.exp20
-rw-r--r--test/lib/completions/grub.exp4
-rw-r--r--test/lib/completions/gzip.exp6
-rw-r--r--test/lib/completions/hcitool.exp4
-rw-r--r--test/lib/completions/head.exp6
-rw-r--r--test/lib/completions/hping2.exp20
-rw-r--r--test/lib/completions/iconv.exp4
-rw-r--r--test/lib/completions/id.exp4
-rw-r--r--test/lib/completions/identify.exp4
-rw-r--r--test/lib/completions/ifdown.exp4
-rw-r--r--test/lib/completions/iftop.exp20
-rw-r--r--test/lib/completions/ifup.exp4
-rw-r--r--test/lib/completions/indent.exp4
-rw-r--r--test/lib/completions/info.exp4
-rw-r--r--test/lib/completions/inject.exp4
-rw-r--r--test/lib/completions/insmod.exp4
-rw-r--r--test/lib/completions/invoke-rc.d.exp4
-rw-r--r--test/lib/completions/ip.exp20
-rw-r--r--test/lib/completions/ipmitool.exp20
-rw-r--r--test/lib/completions/ipsec.exp4
-rw-r--r--test/lib/completions/ipv6calc.exp4
-rw-r--r--test/lib/completions/irb.exp4
-rw-r--r--test/lib/completions/isql.exp4
-rw-r--r--test/lib/completions/iwconfig.exp4
-rw-r--r--test/lib/completions/iwlist.exp4
-rw-r--r--test/lib/completions/iwpriv.exp4
-rw-r--r--test/lib/completions/iwspy.exp4
-rw-r--r--test/lib/completions/jar.exp4
-rw-r--r--test/lib/completions/jarsigner.exp4
-rw-r--r--test/lib/completions/java.exp10
-rw-r--r--test/lib/completions/javac.exp4
-rw-r--r--test/lib/completions/javadoc.exp4
-rw-r--r--test/lib/completions/k3b.exp4
-rw-r--r--test/lib/completions/kdvi.exp6
-rw-r--r--test/lib/completions/kill.exp4
-rw-r--r--test/lib/completions/killall.exp4
-rw-r--r--test/lib/completions/kldload.exp4
-rw-r--r--test/lib/completions/kldunload.exp4
-rw-r--r--test/lib/completions/kpdf.exp6
-rw-r--r--test/lib/completions/kplayer.exp4
-rw-r--r--test/lib/completions/larch.exp4
-rw-r--r--test/lib/completions/ld.exp4
-rw-r--r--test/lib/completions/ldd.exp4
-rw-r--r--test/lib/completions/less.exp4
-rw-r--r--test/lib/completions/lftp.exp6
-rw-r--r--test/lib/completions/lftpget.exp4
-rw-r--r--test/lib/completions/lilo.exp4
-rw-r--r--test/lib/completions/links.exp4
-rw-r--r--test/lib/completions/lisp.exp4
-rw-r--r--test/lib/completions/list_admins.exp4
-rw-r--r--test/lib/completions/list_lists.exp4
-rw-r--r--test/lib/completions/list_members.exp4
-rw-r--r--test/lib/completions/list_owners.exp4
-rw-r--r--test/lib/completions/ln.exp4
-rw-r--r--test/lib/completions/look.exp6
-rw-r--r--test/lib/completions/lrzip.exp20
-rw-r--r--test/lib/completions/ls.exp28
-rw-r--r--test/lib/completions/lsof.exp21
-rw-r--r--test/lib/completions/lvchange.exp4
-rw-r--r--test/lib/completions/lvcreate.exp4
-rw-r--r--test/lib/completions/lvdisplay.exp4
-rw-r--r--test/lib/completions/lvextend.exp4
-rw-r--r--test/lib/completions/lvm.exp4
-rw-r--r--test/lib/completions/lvmdiskscan.exp4
-rw-r--r--test/lib/completions/lvreduce.exp4
-rw-r--r--test/lib/completions/lvremove.exp4
-rw-r--r--test/lib/completions/lvrename.exp4
-rw-r--r--test/lib/completions/lvresize.exp4
-rw-r--r--test/lib/completions/lvs.exp4
-rw-r--r--test/lib/completions/lvscan.exp4
-rw-r--r--test/lib/completions/lzma.exp6
-rw-r--r--test/lib/completions/lzop.exp4
-rw-r--r--test/lib/completions/m4.exp6
-rw-r--r--test/lib/completions/macof.exp4
-rw-r--r--test/lib/completions/mailmanctl.exp4
-rw-r--r--test/lib/completions/mailsnarf.exp4
-rw-r--r--test/lib/completions/make.exp4
-rw-r--r--test/lib/completions/man.exp21
-rw-r--r--test/lib/completions/mc.exp4
-rw-r--r--test/lib/completions/mcrypt.exp4
-rw-r--r--test/lib/completions/md5sum.exp4
-rw-r--r--test/lib/completions/mdecrypt.exp4
-rw-r--r--test/lib/completions/mencoder.exp4
-rw-r--r--test/lib/completions/minicom.exp4
-rw-r--r--test/lib/completions/mkdir.exp10
-rw-r--r--test/lib/completions/mkfifo.exp4
-rw-r--r--test/lib/completions/mkinitrd.exp4
-rw-r--r--test/lib/completions/mkisofs.exp8
-rw-r--r--test/lib/completions/mknod.exp4
-rw-r--r--test/lib/completions/mmsitepass.exp4
-rw-r--r--test/lib/completions/module.exp4
-rw-r--r--test/lib/completions/mogrify.exp4
-rw-r--r--test/lib/completions/montage.exp4
-rw-r--r--test/lib/completions/mount.exp9
-rw-r--r--test/lib/completions/mplayer.exp4
-rw-r--r--test/lib/completions/msgsnarf.exp4
-rw-r--r--test/lib/completions/mtx.exp4
-rw-r--r--test/lib/completions/mutt.exp8
-rw-r--r--test/lib/completions/muttng.exp4
-rw-r--r--test/lib/completions/mv.exp4
-rw-r--r--test/lib/completions/mysqladmin.exp4
-rw-r--r--test/lib/completions/ncftp.exp4
-rw-r--r--test/lib/completions/netstat.exp4
-rw-r--r--test/lib/completions/newlist.exp4
-rw-r--r--test/lib/completions/nl.exp4
-rw-r--r--test/lib/completions/nm.exp4
-rw-r--r--test/lib/completions/ntpdate.exp4
-rw-r--r--test/lib/completions/objcopy.exp4
-rw-r--r--test/lib/completions/objdump.exp4
-rw-r--r--test/lib/completions/od.exp4
-rw-r--r--test/lib/completions/openssl.exp6
-rw-r--r--test/lib/completions/p4.exp4
-rw-r--r--test/lib/completions/pack200.exp4
-rw-r--r--test/lib/completions/paste.exp4
-rw-r--r--test/lib/completions/patch.exp4
-rw-r--r--test/lib/completions/perl.exp39
-rw-r--r--test/lib/completions/perldoc.exp21
-rw-r--r--test/lib/completions/pgrep.exp4
-rw-r--r--test/lib/completions/pine.exp4
-rw-r--r--test/lib/completions/ping.exp4
-rw-r--r--test/lib/completions/pkg-config.exp4
-rw-r--r--test/lib/completions/pkg_deinstall.exp8
-rw-r--r--test/lib/completions/pkg_delete.exp4
-rw-r--r--test/lib/completions/pkg_info.exp4
-rw-r--r--test/lib/completions/pkill.exp4
-rw-r--r--test/lib/completions/portinstall.exp8
-rw-r--r--test/lib/completions/portupgrade.exp4
-rw-r--r--test/lib/completions/povray.exp4
-rw-r--r--test/lib/completions/pr.exp4
-rw-r--r--test/lib/completions/psql.exp4
-rw-r--r--test/lib/completions/ptx.exp4
-rw-r--r--test/lib/completions/pvchange.exp4
-rw-r--r--test/lib/completions/pvcreate.exp4
-rw-r--r--test/lib/completions/pvdisplay.exp4
-rw-r--r--test/lib/completions/pvmove.exp4
-rw-r--r--test/lib/completions/pvremove.exp4
-rw-r--r--test/lib/completions/pvs.exp4
-rw-r--r--test/lib/completions/pvscan.exp4
-rw-r--r--test/lib/completions/python.exp7
-rw-r--r--test/lib/completions/qrunner.exp4
-rw-r--r--test/lib/completions/querybts.exp4
-rw-r--r--test/lib/completions/rcs.exp4
-rw-r--r--test/lib/completions/rcsdiff.exp4
-rw-r--r--test/lib/completions/rdict.exp4
-rw-r--r--test/lib/completions/readelf.exp4
-rw-r--r--test/lib/completions/readonly.exp4
-rw-r--r--test/lib/completions/remove_members.exp4
-rw-r--r--test/lib/completions/removepkg.exp4
-rw-r--r--test/lib/completions/renice.exp8
-rw-r--r--test/lib/completions/reportbug.exp4
-rw-r--r--test/lib/completions/ri.exp4
-rw-r--r--test/lib/completions/rlog.exp4
-rw-r--r--test/lib/completions/rm.exp4
-rw-r--r--test/lib/completions/rmdir.exp10
-rw-r--r--test/lib/completions/rmlist.exp4
-rw-r--r--test/lib/completions/rpcdebug.exp4
-rw-r--r--test/lib/completions/rpm.exp6
-rw-r--r--test/lib/completions/rsync.exp4
-rw-r--r--test/lib/completions/rtcwake.exp4
-rw-r--r--test/lib/completions/sbcl-mt.exp6
-rw-r--r--test/lib/completions/sbcl.exp6
-rw-r--r--test/lib/completions/scp.exp43
-rw-r--r--test/lib/completions/screen.exp33
-rw-r--r--test/lib/completions/sed.exp6
-rw-r--r--test/lib/completions/seq.exp4
-rw-r--r--test/lib/completions/service.exp4
-rw-r--r--test/lib/completions/set.exp4
-rw-r--r--test/lib/completions/sftp.exp45
-rw-r--r--test/lib/completions/sh.exp38
-rw-r--r--test/lib/completions/sha1sum.exp4
-rw-r--r--test/lib/completions/shar.exp4
-rw-r--r--test/lib/completions/sitecopy.exp4
-rw-r--r--test/lib/completions/smartctl.exp4
-rw-r--r--test/lib/completions/snownews.exp4
-rw-r--r--test/lib/completions/sort.exp4
-rw-r--r--test/lib/completions/split.exp6
-rw-r--r--test/lib/completions/spovray.exp4
-rw-r--r--test/lib/completions/sqlite3.exp20
-rw-r--r--test/lib/completions/ssh.exp41
-rw-r--r--test/lib/completions/sshmitm.exp4
-rw-r--r--test/lib/completions/sshow.exp4
-rw-r--r--test/lib/completions/strace.exp4
-rw-r--r--test/lib/completions/strip.exp4
-rw-r--r--test/lib/completions/sudo.exp15
-rw-r--r--test/lib/completions/svk.exp4
-rw-r--r--test/lib/completions/svn.exp4
-rw-r--r--test/lib/completions/svnadmin.exp4
-rw-r--r--test/lib/completions/svnlook.exp4
-rw-r--r--test/lib/completions/sync_members.exp4
-rw-r--r--test/lib/completions/sysbench.exp20
-rw-r--r--test/lib/completions/sysctl.exp9
-rw-r--r--test/lib/completions/tac.exp4
-rw-r--r--test/lib/completions/tail.exp6
-rw-r--r--test/lib/completions/tar.exp4
-rw-r--r--test/lib/completions/tcpkill.exp4
-rw-r--r--test/lib/completions/tcpnice.exp4
-rw-r--r--test/lib/completions/tee.exp4
-rw-r--r--test/lib/completions/texindex.exp4
-rw-r--r--test/lib/completions/tightvncviewer.exp4
-rw-r--r--test/lib/completions/time.exp4
-rw-r--r--test/lib/completions/touch.exp6
-rw-r--r--test/lib/completions/tr.exp6
-rw-r--r--test/lib/completions/tune2fs.exp20
-rw-r--r--test/lib/completions/unace.exp4
-rw-r--r--test/lib/completions/uname.exp6
-rw-r--r--test/lib/completions/unexpand.exp6
-rw-r--r--test/lib/completions/uniq.exp6
-rw-r--r--test/lib/completions/units.exp6
-rw-r--r--test/lib/completions/unpack200.exp4
-rw-r--r--test/lib/completions/unrar.exp4
-rw-r--r--test/lib/completions/unset.exp4
-rw-r--r--test/lib/completions/unshunt.exp4
-rw-r--r--test/lib/completions/update-alternatives.exp4
-rw-r--r--test/lib/completions/update-rc.d.exp4
-rw-r--r--test/lib/completions/urlsnarf.exp4
-rw-r--r--test/lib/completions/vdir.exp4
-rw-r--r--test/lib/completions/vgcfgbackup.exp4
-rw-r--r--test/lib/completions/vgcfgrestore.exp4
-rw-r--r--test/lib/completions/vgchange.exp4
-rw-r--r--test/lib/completions/vgck.exp4
-rw-r--r--test/lib/completions/vgconvert.exp4
-rw-r--r--test/lib/completions/vgcreate.exp4
-rw-r--r--test/lib/completions/vgdisplay.exp4
-rw-r--r--test/lib/completions/vgexport.exp4
-rw-r--r--test/lib/completions/vgextend.exp4
-rw-r--r--test/lib/completions/vgimport.exp4
-rw-r--r--test/lib/completions/vgmerge.exp4
-rw-r--r--test/lib/completions/vgmknodes.exp4
-rw-r--r--test/lib/completions/vgreduce.exp4
-rw-r--r--test/lib/completions/vgremove.exp4
-rw-r--r--test/lib/completions/vgrename.exp4
-rw-r--r--test/lib/completions/vgs.exp4
-rw-r--r--test/lib/completions/vgscan.exp4
-rw-r--r--test/lib/completions/vgsplit.exp4
-rw-r--r--test/lib/completions/vncviewer.exp4
-rw-r--r--test/lib/completions/wc.exp6
-rw-r--r--test/lib/completions/webmitm.exp4
-rw-r--r--test/lib/completions/wget.exp4
-rw-r--r--test/lib/completions/who.exp6
-rw-r--r--test/lib/completions/withlist.exp4
-rw-r--r--test/lib/completions/wol.exp6
-rw-r--r--test/lib/completions/wtf.exp4
-rw-r--r--test/lib/completions/wvdial.exp4
-rw-r--r--test/lib/completions/xhost.exp22
-rw-r--r--test/lib/completions/xmllint.exp4
-rw-r--r--test/lib/completions/xmlwf.exp4
-rw-r--r--test/lib/completions/xmms.exp4
-rw-r--r--test/lib/completions/xmodmap.exp20
-rw-r--r--test/lib/completions/xpovray.exp4
-rw-r--r--test/lib/completions/xrandr.exp4
-rw-r--r--test/lib/completions/xrdb.exp20
-rw-r--r--test/lib/completions/xsltproc.exp4
-rw-r--r--test/lib/completions/xvnc4viewer.exp4
-rw-r--r--test/lib/completions/xz.exp12
-rw-r--r--test/lib/completions/ypcat.exp4
-rw-r--r--test/lib/completions/ypmatch.exp4
-rw-r--r--test/lib/completions/yum-arch.exp4
-rw-r--r--test/lib/completions/yum.exp4
-rw-r--r--test/lib/library.exp616
-rw-r--r--test/lib/unit.exp10
-rwxr-xr-xtest/run2
-rwxr-xr-xtest/runLint2
-rw-r--r--test/unit/__expand_tilde_by_ref.exp16
-rw-r--r--test/unit/_count_args.exp14
-rw-r--r--test/unit/_filedir.exp82
-rw-r--r--test/unit/_get_comp_words_by_ref.exp47
-rw-r--r--test/unit/_get_cword.exp58
-rw-r--r--test/unit/_known_hosts_real.exp34
-rw-r--r--test/unit/_parse_help.exp73
-rw-r--r--test/unit/_tilde.exp51
-rw-r--r--test/unit/compgen.exp19
637 files changed, 5572 insertions, 2817 deletions
diff --git a/CHANGES b/CHANGES
index e13527c0..3213a12b 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,77 @@
+bash-completion (1.3)
+ [ Guillaume Rousse ]
+ * added pure-perl perldoc completion helper, using work from Aristotle
+ Pagaltzis (pagaltzis@gmx.de)
+
+ [ David Paleino ]
+ * Fixed "service" completion, thanks to John Hedges (Debian: #586210)
+ * Complete on all files for mplayer's -dvd-device
+
+ [ Ville Skyttä ]
+ * Activate hping2 completion also for hping and hping3.
+ * Add badblocks, compgen, crontab, dumpe2fs, e2freefrag, e2label, ether-wake,
+ filefrag, growisofs, iftop, ip (Debian: #600617), lrzip, lsof, POSIX sh,
+ sha{,224,256,384,512}sum, sysbench, tune2fs, xmodmap, and xrdb completions.
+ * Add *.gif (Alioth: #312512), *.m2t (Alioth: #312770), *.3gpp, *.3gpp2,
+ *.awb, and *.iso (Alioth: #311420) to mplayer filename completions.
+ * Add "short" tarball extensions to unxz, unlzma etc completions.
+ * Improve /etc/init.d/*, ipmitool, jar, java, javadoc, man, mencoder, mkdir,
+ mplayer, povray, python, rpmbuild, sqlite3, tar, wodim, and general help
+ parsing completions.
+ * Fix p4 and povray completions (Alioth: #312625).
+ * Add *.xsd, *.xsl, *.rng, and *.wsdl to xmllint filename completions,
+ and *.gz versions of all of the supported ones.
+ * Recognize rpm query mode based on the --file, --group, --package, and
+ --all long options (RedHat: #630328).
+ * Improve rpm query option completions.
+ * Drop bad kompare filename completion (Alioth: #312708).
+ * Make _filedir and _filedir_xspec complete uppercase versions of their
+ filename extension arguments in addition to exact case matches.
+ * IPv6 known hosts completion fixes (Alioth: #312695, RedHat: #630658).
+ * Fixes to completions for filenames containing tabs (RedHat: #629518).
+ * Add *.iso (Alioth: #311420), *.m2t and *.m2ts (Alioth: #312770) to
+ xine-based player filename completions.
+ * Add /etc/ethers to MAC address completion sources.
+ * Add *.gem and *.spkg to tar filename completions.
+ * Complete known hosts from avahi-browse only if $COMP_KNOWN_HOSTS_WITH_AVAHI
+ is non-empty (Alioth: #312691, RedHat: #630326).
+ * Improve relevance of many user/group completions, depending on context.
+ * Remove most "-o filenames" options to "complete", turn "-o filenames" on
+ dynamically when needed instead.
+ * Add/improve various autotools completions.
+ * Add *.apk to unzip and jar filename completions.
+ * Do not load bash_completion in profile.d script if progcomp is not enabled.
+ * Ignore muttrc source entries that are not files (Alioth: #312881).
+ * Re-enable postgresql database and user completion (Alioth: #312914,
+ Ubuntu: #164772).
+
+ [ Freddy Vulto ]
+ * Added _tilde(), fix ~username completion (Alioth: #312613, Debian: #587095)
+ * Speed up `compopt' availability detection
+ * Fix _filedir `-o filenames' detection on bash-3 (Alioth: #312646)
+ * Fix __reassemble_comp_words_by_ref (Alioth #312740)
+
+ [ Anton Khirnov ]
+ * Improve mplayer and mencoder completions.
+
+ [ Paul Walmsley ]
+ * Add *.webm to mplayer file completions (Debian: #588079).
+
+ [ Miklos Vajna ]
+ * Add *.amr to mplayer file completions (Alioth: #312634).
+
+ [ Andrej Gelenberg ]
+ * Add *.part (partially downloaded) to mplayer and xine-based player
+ completions (Alioth: #312657).
+
+ [ Stephen Gildea ]
+ * Fix false posives for non-option words in _parse_help (Alioth: #312750).
+
+ [ Andrey G. Grozin ]
+ * Add *.fb2 to okular filename completions.
+
+ -- David Paleino <d.paleino@gmail.com> Wed, 16 Jun 2010 17:53:22 +0200
+
bash-completion (1.2)
[ David Paleino ]
diff --git a/Makefile.am b/Makefile.am
index 93574a71..dcecc32c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,172 +1,7 @@
-SUBDIRS = test
+SUBDIRS = completions test
sysconf_DATA = bash_completion
-bashcompdir = $(sysconfdir)/bash_completion.d
-bashcomp_DATA = contrib/abook \
- contrib/ant \
- contrib/apache2ctl \
- contrib/apt \
- contrib/apt-build \
- contrib/aptitude \
- contrib/aspell \
- contrib/autorpm \
- contrib/bash-builtins \
- contrib/bind-utils \
- contrib/bitkeeper \
- contrib/bittorrent \
- contrib/bluez \
- contrib/brctl \
- contrib/bzip2 \
- contrib/cardctl \
- contrib/cfengine \
- contrib/chkconfig \
- contrib/chsh \
- contrib/cksfv \
- contrib/clisp \
- contrib/configure \
- contrib/coreutils \
- contrib/cowsay \
- contrib/cpan2dist \
- contrib/cpio \
- contrib/cups \
- contrib/cryptsetup \
- contrib/cvs \
- contrib/cvsps \
- contrib/dd \
- contrib/dhclient \
- contrib/dict \
- contrib/dpkg \
- contrib/dselect \
- contrib/dsniff \
- contrib/findutils \
- contrib/freeciv \
- contrib/fuse \
- contrib/gcc \
- contrib/gcl \
- contrib/gdb \
- contrib/genisoimage \
- contrib/getent \
- contrib/gkrellm \
- contrib/gnatmake \
- contrib/gpg \
- 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 \
- contrib/lzop \
- contrib/mailman \
- contrib/make \
- contrib/man \
- contrib/mc \
- contrib/mcrypt \
- contrib/mdadm \
- contrib/medusa \
- contrib/minicom \
- contrib/mkinitrd \
- contrib/module-init-tools \
- contrib/monodevelop \
- contrib/mount \
- contrib/mplayer \
- contrib/msynctool \
- contrib/mtx \
- contrib/munin-node \
- contrib/mutt \
- contrib/mysqladmin \
- contrib/ncftp \
- contrib/net-tools \
- contrib/nmap \
- contrib/ntpdate \
- contrib/openldap \
- contrib/openssl \
- contrib/p4 \
- contrib/perl \
- contrib/pine \
- 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/reportbug \
- contrib/resolvconf \
- contrib/rfkill \
- contrib/ri \
- contrib/rpcdebug \
- contrib/rpm \
- 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 \
- contrib/sysv-rc \
- contrib/tar \
- contrib/tcpdump \
- 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 \
- contrib/xmllint \
- contrib/xmlwf \
- contrib/xmms \
- contrib/xrandr \
- contrib/xsltproc \
- contrib/xz \
- contrib/yp-tools \
- contrib/yum-arch
-
profiledir = $(sysconfdir)/profile.d
profile_DATA = bash_completion.sh
@@ -175,6 +10,4 @@ bash_completion.sh: bash_completion.sh.in Makefile
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
+EXTRA_DIST = CHANGES $(sysconf_DATA) bash_completion.sh.in
diff --git a/README b/README
index 725678ac..71758cd0 100644
--- a/README
+++ b/README
@@ -15,17 +15,20 @@ fi
(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.
-
-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.
+you simply don't want to use one, you can install bash completion using the
+standard commands for GNU autotools packages:
+
+./configure
+make
+make check # optional, requires dejagnu and tcllib
+make install # as root
+
+These commands installs the completions and helpers, as well as a
+profile.d script that loads bash_completion where appropriate. If
+your system does not use the profile.d directory (usually below /etc)
+mechanism, i.e. does not automatically source shell scripts in it, you
+can source the $sysconfdir/profile.d/bash_completion.sh script in
+/etc/bashrc or ~/.bashrc.
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
diff --git a/autogen.sh b/autogen.sh
deleted file mode 100755
index 6868f2de..00000000
--- a/autogen.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/sh
-
-autoreconf -i
-rm -rf autom4te.cache/
diff --git a/bash_completion b/bash_completion
index e7a4b6ec..9b63059a 100644
--- a/bash_completion
+++ b/bash_completion
@@ -70,41 +70,42 @@ 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 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 '!*.@(zip|[ejw]ar|exe|pk3|wsz|zargo|xpi|sxw|o[tx]t|od[fgpst]|epub|apk)' unzip zipinfo
complete -f -X '*.Z' compress znew
# zcmp, zdiff, z*grep, zless, zmore intentionally not here, see Debian: #455510
complete -f -X '!*.@(Z|[gGd]z|t[ag]z)' gunzip zcat unpigz
complete -f -X '!*.Z' uncompress
# lzcmp, lzdiff intentionally not here, see Debian: #455510
-complete -f -X '!*.lzma' lzcat lzegrep lzfgrep lzgrep lzless lzmore unlzma
-complete -f -X '!*.@(xz|lzma)' unxz xzcat
-complete -f -X '!*.@(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)' ee
-complete -f -X '!*.@(gif|jp?(e)g|tif?(f)|png|p[bgp]m|bmp|x[bp]m|rle|rgb|pcx|fits|pm|GIF|JPG|JP?(E)G|TIF?(F)|PNG|P[BGP]M|BMP|X[BP]M|RLE|RGB|PCX|FITS|PM)' xv qiv
+complete -f -X '!*.@(tlz|lzma)' lzcat lzegrep lzfgrep lzgrep lzless lzmore unlzma
+complete -f -X '!*.@(?(t)xz|tlz|lzma)' unxz xzcat
+complete -f -X '!*.lrz' lrunzip
+complete -f -X '!*.@(gif|jp?(e)g|miff|tif?(f)|pn[gm]|p[bgp]m|bmp|xpm|ico|xwd|tga|pcx)' ee
+complete -f -X '!*.@(gif|jp?(e)g|tif?(f)|png|p[bgp]m|bmp|x[bp]m|rle|rgb|pcx|fits|pm)' xv qiv
complete -f -X '!*.@(@(?(e)ps|?(E)PS|pdf|PDF)?(.gz|.GZ|.bz2|.BZ2|.Z))' gv ggv kghostview
-complete -f -X '!*.@(dvi|DVI)?(.@(gz|Z|bz2))' xdvi
-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|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 '!*.@(dvi|DVI)?(.@(gz|Z|bz2))' xdvi kdvi
+complete -f -X '!*.dvi' dvips dviselect dvitype dvipdf advi dvipdfm dvipdfmx
+complete -f -X '!*.pdf' acroread gpdf xpdf
+complete -f -X '!*.@(?(e)ps|pdf)' kpdf
+complete -f -X '!*.@(@(?(e)ps|?(E)PS|pdf|PDF|dvi|DVI)?(.gz|.GZ|.bz2|.BZ2)|cb[rz]|djv?(u)|gif|jp?(e)g|miff|tif?(f)|pn[gm]|p[bgp]m|bmp|xpm|ico|xwd|tga|pcx|fdf)' evince
+complete -f -X '!*.@(okular|@(?(e|x)ps|?(E|X)PS|pdf|PDF|dvi|DVI|cb[rz]|CB[RZ]|djv?(u)|DJV?(U)|dvi|DVI|gif|jp?(e)g|miff|tif?(f)|pn[gm]|p[bgp]m|bmp|xpm|ico|xwd|tga|pcx|GIF|JP?(E)G|MIFF|TIF?(F)|PN[GM]|P[BGP]M|BMP|XPM|ICO|XWD|TGA|PCX|epub|EPUB|odt|ODT|fb?(2)|FB?(2)|mobi|MOBI|g3|G3|chm|CHM|fdf|FDF)?(.?(gz|GZ|bz2|BZ2)))' okular
+complete -f -X '!*.@(?(e)ps|pdf)' ps2pdf ps2pdf12 ps2pdf13 ps2pdf14 ps2pdfwr
complete -f -X '!*.texi*' makeinfo texi2html
-complete -f -X '!*.@(?(la)tex|?(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|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 '!*.@(?(la)tex|texi|dtx|ins|ltx)' tex latex slitex jadetex pdfjadetex pdftex pdflatex texi2dvi
+complete -f -X '!*.mp3' mpg123 mpg321 madplay
+complete -f -X '!*@(.@(mp?(e)g|MP?(E)G|wma|avi|AVI|asf|vob|VOB|bin|dat|divx|DIVX|vcd|ps|pes|fli|flv|FLV|fxm|FXM|viv|rm|ram|yuv|mov|MOV|qt|QT|wmv|mp[234]|MP[234]|m4[pv]|M4[PV]|mkv|MKV|og[gmv]|OG[GMV]|t[ps]|T[PS]|m2t?(s)|M2T?(S)|wav|WAV|flac|FLAC|asx|ASX|mng|MNG|srt|m[eo]d|M[EO]D|s[3t]m|S[3T]M|it|IT|xm|XM)|+([0-9]).@(vdr|VDR))?(.part)' xine aaxine fbxine
+complete -f -X '!*@(.@(mp?(e)g|MP?(E)G|wma|avi|AVI|asf|vob|VOB|bin|dat|divx|DIVX|vcd|ps|pes|fli|flv|FLV|fxm|FXM|viv|rm|ram|yuv|mov|MOV|qt|QT|wmv|mp[234]|MP[234]|m4[pv]|M4[PV]|mkv|MKV|og[gmv]|OG[GMV]|t[ps]|T[PS]|m2t?(s)|M2T?(S)|wav|WAV|flac|FLAC|asx|ASX|mng|MNG|srt|m[eo]d|M[EO]D|s[3t]m|S[3T]M|it|IT|xm|XM|iso|ISO)|+([0-9]).@(vdr|VDR))?(.part)' kaffeine dragon
complete -f -X '!*.@(avi|asf|wmv)' aviplay
complete -f -X '!*.@(rm?(j)|ra?(m)|smi?(l))' realplay
complete -f -X '!*.@(mpg|mpeg|avi|mov|qt)' xanim
-complete -f -X '!*.@(ogg|OGG|m3u|flac|spx)' ogg123
-complete -f -X '!*.@(mp3|MP3|ogg|OGG|pls|m3u)' gqmpeg freeamp
+complete -f -X '!*.@(ogg|m3u|flac|spx)' ogg123
+complete -f -X '!*.@(mp3|ogg|pls|m3u)' gqmpeg freeamp
complete -f -X '!*.fig' xfig
-complete -f -X '!*.@(mid?(i)|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 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 '!*.@(mid?(i)|cmf)' playmidi
+complete -f -X '!*.@(mid?(i)|rmi|rcp|[gr]36|g18|mod|xm|it|x3m|s[3t]m|kar)' timidity
+complete -f -X '!*.@(m[eo]d|s[3t]m|xm|it)' modplugplay modplug123
+complete -f -X '*.@(o|so|so.!(conf)|a|[rs]pm|gif|jp?(e)g|mp3|mp?(e)g|avi|asf|ogg|class)' vi vim gvim rvim view rview rgvim rgview gview emacs xemacs sxemacs kate kwrite
complete -f -X '!*.@([eE][xX][eE]?(.[sS][oO])|[cC][oO][mM]|[sS][cC][rR])' wine
-complete -f -X '!*.@(zip|ZIP|z|Z|gz|GZ|tgz|TGZ)' bzme
+complete -f -X '!*.@(zip|z|gz|tgz)' bzme
# konqueror not here on purpose, it's more than a web/html browser
complete -f -X '!*.@(?([xX]|[sS])[hH][tT][mM]?([lL]))' netscape mozilla lynx opera galeon dillo elinks amaya firefox mozilla-firefox iceweasel google-chrome chromium-browser epiphany
complete -f -X '!*.@(sxw|stw|sxg|sgl|doc?([mx])|dot?([mx])|rtf|txt|htm|html|odt|ott|odm)' oowriter
@@ -113,22 +114,20 @@ complete -f -X '!*.@(sxc|stc|xls?([bmx])|xlw|xlt?([mx])|[ct]sv|ods|ots)' oocalc
complete -f -X '!*.@(sxd|std|sda|sdd|odg|otg)' oodraw
complete -f -X '!*.@(sxm|smf|mml|odf)' oomath
complete -f -X '!*.odb' oobase
-complete -f -X '!*.rpm' rpm2cpio
-complete -f -X '!*.s@(qlite?(3)|?(3)db)' sqlite3
+complete -f -X '!*.[rs]pm' rpm2cpio
complete -f -X '!*.aux' bibtex
complete -f -X '!*.po' poedit gtranslator kbabel lokalize
complete -f -X '!*.@([Pp][Rr][Gg]|[Cc][Ll][Pp])' harbour gharbour hbpp
complete -f -X '!*.[Hh][Rr][Bb]' hbrun
complete -f -X '!*.ly' lilypond ly2dvi
complete -f -X '!*.@(dif?(f)|?(d)patch)?(.@([gx]z|bz2|lzma))' cdiff
-complete -f -X '!*.@(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
# user commands see only users
-complete -u su passwd write chfn groups slay w sux
+complete -u su write chfn groups slay w sux
# bg completes with stopped jobs
complete -A stopped -P '"%' -S '"' bg
@@ -310,7 +309,7 @@ __reassemble_comp_words_by_ref() {
ref="$2[$j]"
eval $2[$j]=\${!ref}\${COMP_WORDS[i]}
# Indicate new cword
- [ $i = $COMP_CWORD ] && [[ ${COMP_WORDS[i]} ]] && eval $3=$j
+ [[ $i == $COMP_CWORD ]] && eval $3=$j
done
else
# No, list of word completions separators hasn't changed;
@@ -464,7 +463,7 @@ _get_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
+ elif [[ "${#words[cword]}" -eq 0 || "$COMP_POINT" == "${#COMP_LINE}" ]]; then
printf "%s" "${words[cword]}"
else
local i
@@ -568,16 +567,32 @@ __ltrim_colon_completions() {
# $ compgen -f "a\\\\\'b/" # Good (bash-3)
# a\'b/c
#
-# See also: http://lists.gnu.org/archive/html/bug-bash/2009-03/msg00155.html
+# On bash-3, special characters need to be escaped extra. This is
+# unless the first character is a single quote ('). If the single
+# quote appears further down the string, bash default completion also
+# fails, e.g.:
+#
+# $ ls 'a&b/'
+# f
+# $ foo 'a&b/<TAB> # Becomes: foo 'a&b/f'
+# $ foo a'&b/<TAB> # Nothing happens
+#
+# See also:
+# - http://lists.gnu.org/archive/html/bug-bash/2009-03/msg00155.html
+# - http://www.mail-archive.com/bash-completion-devel@lists.alioth.\
+# debian.org/msg01944.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
+ if [[ ${BASH_VERSINFO[0]} -ge 4 ]]; then
+ # Leave out first character
+ printf -v $2 %s "${1:1}"
+ else
+ # Quote word, leaving out first character
+ printf -v $2 %q "${1:1}"
+ # Double-quote word (bash-3)
printf -v $2 %q ${!2}
fi
elif [[ ${BASH_VERSINFO[0]} -le 3 && ${1:0:1} == '"' ]]; then
@@ -593,16 +608,30 @@ _quote_readline_by_ref()
} # _quote_readline_by_ref()
+# This function turns on "-o filenames" behavior dynamically. It is present
+# for bash < 4 reasons. See http://bugs.debian.org/272660#64 for info about
+# the bash < 4 compgen hack.
+_compopt_o_filenames()
+{
+ # We test for compopt availability first because directly invoking it on
+ # bash < 4 at this point may cause terminal echo to be turned off for some
+ # reason, see https://bugzilla.redhat.com/653669 for more info.
+ type compopt &>/dev/null && compopt -o filenames 2>/dev/null || \
+ compgen -f /non-existing-dir/ >/dev/null
+}
+
+
# This function performs file and directory completion. It's better than
# simply using 'compgen -f', because it honours spaces in filenames.
# @param $1 If `-d', complete only on directories. Otherwise filter/pick only
-# completions with `.$1' as file extension.
+# completions with `.$1' and the uppercase version of it as file
+# extension.
#
_filedir()
{
- local i IFS=$'\t\n' xspec
+ local i IFS=$'\n' xspec
- __expand_tilde_by_ref cur
+ _tilde "$cur" || return 0
local -a toks
local quoted tmp
@@ -621,68 +650,14 @@ _filedir()
}
))
- # 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
+ # Munge xspec to contain uppercase version too
+ [[ ${BASH_VERSINFO[0]} -ge 4 ]] && \
+ xspec=${1:+"!*.@($1|${1^^})"} || \
+ xspec=${1:+"!*.@($1|$(printf %s $1 | tr '[:lower:]' '[:upper:]'))"}
+ toks=( ${toks[@]-} $( compgen -f -X "$xspec" -- $quoted) )
fi
+ [ ${#toks[@]} -ne 0 ] && _compopt_o_filenames
COMPREPLY=( "${COMPREPLY[@]}" "${toks[@]}" )
} # _filedir()
@@ -705,13 +680,13 @@ _split_longopt()
return 1
}
-# This function tries to parse the output of $command --help
+# This function tries to parse the help output of the given command.
+# @param $1 command
+# @param $2 command options (default: --help)
#
_parse_help() {
- local cmd
- cmd=$1
- $cmd --help 2>&1 | command grep -- "^[[:space:]]*-" | tr "," " " | \
- awk '{print $1; if ($2 ~ /-.*/) { print $2 } }' | sed -e "s:=.*::g"
+ $1 ${2:---help} 2>&1 | sed -e '/^[[:space:]]*-/!d' -e 's|[,/]| |g' | \
+ awk '{ print $1; if ($2 ~ /^-/) { print $2 } }' | sed -e 's|=.*||'
}
# This function completes on signal names
@@ -746,6 +721,10 @@ _mac_addresses()
"s/.*[[:space:]]\($re\)[[:space:]].*/\1/p" -ne \
"s/.*[[:space:]]\($re\)[[:space:]]*$/\1/p" ) )
+ # /etc/ethers
+ COMPREPLY=( "${COMPREPLY[@]}" $( sed -ne \
+ "s/^[[:space:]]*\($re\)[[:space:]].*/\1/p" /etc/ethers 2>/dev/null ) )
+
COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) )
__ltrim_colon_completions "$cur"
}
@@ -805,7 +784,27 @@ _available_interfaces()
}
+# Perform tilde (~) completion
+# @return True (0) if completion needs further processing,
+# False (> 0) if tilde is followed by a valid username, completions
+# are put in COMPREPLY and no further processing is necessary.
+_tilde() {
+ local result=0
+ # Does $1 start with tilde (~) and doesn't contain slash (/)?
+ if [[ ${1:0:1} == "~" && $1 == ${1//\/} ]]; then
+ _compopt_o_filenames
+ # Try generate username completions
+ COMPREPLY=( $( compgen -P '~' -u "${1#\~}" ) )
+ result=${#COMPREPLY[@]}
+ fi
+ return $result
+}
+
+
# Expand variable starting with tilde (~)
+# We want to expand ~foo/... to /home/foo/... to avoid problems when
+# word-to-complete starting with a tilde is fed to commands and ending up
+# quoted instead of expanded.
# 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.
@@ -834,7 +833,7 @@ __expand_tilde_by_ref() {
# becomes "~a". Double quotes allow eval.
# 2: Remove * before the first slash (/), i.e. "~a/b"
# becomes "b". Single quotes prevent eval.
- # +-----1----+ +---2----+
+ # +-----1----+ +---2----+
eval $1="${!1/%\/*}"/'${!1#*/}'
else
# No, $1 doesn't contain slash
@@ -982,10 +981,10 @@ _installed_modules()
# 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.
+# @param $1 If -u, only return users/groups the user has access to in
+# context of current completion.
_usergroup()
{
- local IFS=$'\n'
if [[ $cur = *\\\\* || $cur = *:*:* ]]; then
# Give up early on if something seems horribly wrong.
return
@@ -996,19 +995,61 @@ _usergroup()
local prefix
prefix=${cur%%*([^:])}
prefix=${prefix//\\}
- COMPREPLY=( $( compgen -P "$prefix" -g -- "${cur#*[:]}" ) )
+ local mycur="${cur#*[:]}"
+ if [[ $1 == -u ]]; then
+ _allowed_groups "$mycur"
+ else
+ local IFS=$'\n'
+ COMPREPLY=( $( compgen -g -- "$mycur" ) )
+ fi
+ COMPREPLY=( $( compgen -P "$prefix" -W "${COMPREPLY[@]}" ) )
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#*:}" ) )
+ local mycur="${cur#*:}"
+ if [[ $1 == -u ]]; then
+ _allowed_groups "$mycur"
+ else
+ local IFS=$'\n'
+ COMPREPLY=( $( compgen -g -- "$mycur" ) )
+ fi
else
# 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" ) )
+ if [[ $1 == -u ]]; then
+ _allowed_users "$cur"
+ else
+ local IFS=$'\n'
+ COMPREPLY=( $( compgen -u -- "$cur" ) )
+ fi
+ fi
+}
+
+_allowed_users()
+{
+ if _complete_as_root; then
+ local IFS=$'\n'
+ COMPREPLY=( $( compgen -u -- "${1:-$cur}" ) )
+ else
+ local IFS=$'\n '
+ COMPREPLY=( $( compgen -W \
+ "$( id -un 2>/dev/null || whoami 2>/dev/null )" -- "${1:-$cur}" ) )
+ fi
+}
+
+_allowed_groups()
+{
+ if _complete_as_root; then
+ local IFS=$'\n'
+ COMPREPLY=( $( compgen -g -- "$1" ) )
+ else
+ local IFS=$'\n '
+ COMPREPLY=( $( compgen -W \
+ "$( id -Gn 2>/dev/null || groups 2>/dev/null )" -- "$1" ) )
fi
}
@@ -1164,7 +1205,8 @@ _known_hosts()
# Helper function for completing _known_hosts.
# 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
+# files, as well as hostnames reported by avahi-browse if
+# COMP_KNOWN_HOSTS_WITH_AVAHI is set to a non-empty value. 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
@@ -1259,16 +1301,16 @@ _known_hosts_real()
awkcur=${awkcur//\./\\\.}
curd=$awkcur
- if [[ "$awkcur" == [0-9]*.* ]]; then
- # Digits followed by a dot - just search for that
- awkcur="^$awkcur.*"
+ if [[ "$awkcur" == [0-9]*[.:]* ]]; then
+ # Digits followed by a dot or a colon - just search for that
+ awkcur="^$awkcur[.:]*"
elif [[ "$awkcur" == [0-9]* ]]; then
- # Digits followed by no dot - search for digits followed
- # by a dot
- awkcur="^$awkcur.*\."
+ # Digits followed by no dot or colon - search for digits followed
+ # by a dot or a colon
+ awkcur="^$awkcur.*[.:]"
elif [ -z "$awkcur" ]; then
- # A blank - search for a dot or an alpha character
- awkcur="[a-z.]"
+ # A blank - search for a dot, a colon, or an alpha character
+ awkcur="[a-z.:]"
else
awkcur="^$awkcur"
fi
@@ -1277,9 +1319,8 @@ _known_hosts_real()
# FS needs to look for a comma separated list
COMPREPLY=( "${COMPREPLY[@]}" $( awk 'BEGIN {FS=","}
/^\s*[^|\#]/ {for (i=1; i<=2; ++i) { \
- gsub(" .*$", "", $i); \
- gsub("[\\[\\]]", "", $i); \
- gsub(":[0-9]+$", "", $i); \
+ sub(" .*$", "", $i); \
+ sub("^\\[", "", $i); sub("\\](:[0-9]+)?$", "", $i); \
if ($i ~ /'"$awkcur"'/) {print $i} \
}}' "${kh[@]}" 2>/dev/null ) )
fi
@@ -1310,12 +1351,14 @@ _known_hosts_real()
-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
+ # Add hosts reported by avahi-browse, if desired and it's available.
+ if [[ ${COMP_KNOWN_HOSTS_WITH_AVAHI:-} ]] && \
+ type avahi-browse &>/dev/null; then
+ # 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 wasn't available (even if mentioned in the manpage) some
+ # time ago, so...
COMPREPLY=( "${COMPREPLY[@]}" $( \
compgen -P "$prefix$user" -S "$suffix" -W \
"$( avahi-browse -cpr _workstation._tcp 2>/dev/null | \
@@ -1342,7 +1385,7 @@ complete -F _known_hosts traceroute traceroute6 tracepath tracepath6 ping \
#
_cd()
{
- local cur IFS=$'\t\n' i j k
+ local cur IFS=$'\n' i j k
_get_comp_words_by_ref cur
# try to allow variable completion
@@ -1351,8 +1394,7 @@ _cd()
return 0
fi
- # Enable -o filenames option, see Debian bug #272660
- compgen -f /non-existing-dir/ >/dev/null
+ _compopt_o_filenames
# Use standard dir completion if no CDPATH or parameter starts with /,
# ./ or ../
@@ -1365,7 +1407,7 @@ _cd()
local -r mark_symdirs=$(_rl_enabled mark-symlinked-directories && echo y)
# we have a CDPATH, so loop on its contents
- for i in ${CDPATH//:/$'\t'}; do
+ for i in ${CDPATH//:/$'\n'}; do
# create an array of matched subdirs
k="${#COMPREPLY[@]}"
for j in $( compgen -d $i/$cur ); do
@@ -1449,11 +1491,12 @@ _command_offset()
_get_comp_words_by_ref cur
if [[ $COMP_CWORD -eq 0 ]]; then
+ _compopt_o_filenames
COMPREPLY=( $( compgen -c -- "$cur" ) )
else
cmd=${COMP_WORDS[0]}
- if complete -p $cmd &>/dev/null; then
- cspec=$( complete -p $cmd )
+ if complete -p ${cmd##*/} &>/dev/null; then
+ cspec=$( complete -p ${cmd##*/} )
if [ "${cspec#* -F }" != "$cspec" ]; then
# complete -F <function>
@@ -1475,68 +1518,74 @@ _command_offset()
cspec=${cspec%% *}
if [[ "$cspec" != @(dir|file)names ]]; then
COMPREPLY=("${COMPREPLY[@]//\\\\:/:}")
+ else
+ _compopt_o_filenames
fi
fi
elif [ -n "$cspec" ]; then
cspec=${cspec#complete};
- cspec=${cspec%%$cmd};
+ cspec=${cspec%%${cmd##*/}};
COMPREPLY=( $( eval compgen "$cspec" -- "$cur" ) );
fi
+ elif [ ${#COMPREPLY[@]} -eq 0 ]; then
+ _filedir
fi
fi
-
- [ ${#COMPREPLY[@]} -eq 0 ] && _filedir
}
-complete -F _command -o filenames nohup exec nice eval time ltrace then \
- else do vsound command xargs tsocks aoss padsp
+complete -F _command aoss command do else eval exec ltrace nice nohup padsp \
+ then time tsocks vsound xargs
_root_command()
{
local PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin
+ local root_command=$1
_command $1 $2 $3
}
-complete -F _root_command -o filenames sudo fakeroot really gksudo gksu kdesudo
+complete -F _root_command fakeroot gksu gksudo kdesudo really sudo
+
+# Return true if the completion should be treated as running as root
+_complete_as_root()
+{
+ [[ $EUID -eq 0 || ${root_command:-} ]]
+}
_longopt()
{
- local cur prev
+ local cur prev split=false
+ _get_comp_words_by_ref -n = cur prev
- _get_comp_words_by_ref cur prev
+ _split_longopt && split=true
- if _split_longopt; then
- case "$prev" in
- *[Dd][Ii][Rr]*)
- _filedir -d
- ;;
- *[Ff][Ii][Ll][Ee]*)
- _filedir
- ;;
- esac
- return 0
- fi
+ case "$prev" in
+ --*[Dd][Ii][Rr]*)
+ _filedir -d
+ return 0
+ ;;
+ --*[Ff][Ii][Ll][Ee]*|--*[Pp][Aa][Tt][Hh]*)
+ _filedir
+ return 0
+ ;;
+ esac
+
+ $split && return 0
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W "$( $1 --help 2>&1 | \
sed -ne 's/.*\(--[-A-Za-z0-9]\{1,\}\).*/\1/p' | sort -u )" \
-- "$cur" ) )
- elif [[ "$1" == rmdir ]]; then
+ elif [[ "$1" == @(mk|rm)dir ]]; then
_filedir -d
else
_filedir
fi
}
# makeinfo and texi2dvi are defined elsewhere.
-for i in a2ps autoconf automake bc gprof ld nm objcopy objdump readelf strip \
- 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 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; do
+for i in a2ps awk bash bc bison cat colordiff cp csplit \
+ curl cut date df diff dir du enscript env expand fmt fold gperf gprof \
+ grep grub head indent irb ld ldd less ln ls m4 md5sum mkdir mkfifo mknod \
+ mv netstat nl nm objcopy objdump od paste patch pr ptx readelf rm rmdir \
+ sed seq sha{,1,224,256,384,512}sum shar sort split strip tac tail tee \
+ texindex touch tr uname unexpand uniq units vdir wc wget who; do
have $i && complete -F _longopt -o default $i
done
unset i
@@ -1545,7 +1594,7 @@ _filedir_xspec()
{
local IFS cur xspec
- IFS=$'\t\n'
+ IFS=$'\n'
COMPREPLY=()
_get_comp_words_by_ref cur
@@ -1570,14 +1619,26 @@ _filedir_xspec()
}
))
+ # Munge xspec to contain uppercase version too
+ eval xspec="${xspec}"
+ local matchop=!
+ if [[ $xspec == !* ]]; then
+ xspec=${xspec#!}
+ matchop=@
+ fi
+ [[ ${BASH_VERSINFO[0]} -ge 4 ]] && \
+ xspec="$matchop($xspec|${xspec^^})" || \
+ xspec="$matchop($xspec|$(printf %s $xspec | tr '[:lower:]' '[:upper:]'))"
+
toks=( ${toks[@]-} $(
- eval compgen -f -X "$xspec" -- "\$(quote_readline "\$cur")" | {
+ eval compgen -f -X "!$xspec" -- "\$(quote_readline "\$cur")" | {
while read -r tmp; do
[ -n $tmp ] && printf '%s\n' $tmp
done
}
))
+ [ ${#toks[@]} -ne 0 ] && _compopt_o_filenames
COMPREPLY=( "${toks[@]}" )
}
list=( $( sed -ne '/^# START exclude/,/^# FINISH exclude/p' "$BASH_COMPLETION" | \
@@ -1599,7 +1660,7 @@ list=( $( sed -ne '/^# START exclude/,/^# FINISH exclude/p' "$BASH_COMPLETION" |
if [ ${#list[@]} -gt 0 ]; then
eval complete -r ${list[@]}
# install new compspecs
- eval complete -F _filedir_xspec -o filenames "${list[@]}"
+ eval complete -F _filedir_xspec "${list[@]}"
fi
unset list
@@ -1608,8 +1669,8 @@ 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"
+ [[ ${i##*/} != @(*~|*.bak|*.swp|\#*\#|*.dpkg*|*.rpm@(orig|new|save)|Makefile*) \
+ && -f $i && -r $i ]] && . "$i"
done
fi
if [[ $BASH_COMPLETION_DIR != $BASH_COMPLETION_COMPAT_DIR && \
@@ -1617,8 +1678,8 @@ if [[ $BASH_COMPLETION_DIR != $BASH_COMPLETION_COMPAT_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"
+ [[ ${i##*/} != @(*~|*.bak|*.swp|\#*\#|*.dpkg*|*.rpm@(orig|new|save)|Makefile*) \
+ && -f $i && -r $i ]] && . "$i"
done
fi
unset i
diff --git a/bash_completion.sh.in b/bash_completion.sh.in
index bdddeee0..f6a983fb 100644
--- a/bash_completion.sh.in
+++ b/bash_completion.sh.in
@@ -4,7 +4,7 @@
# 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
+ if shopt -q progcomp && [ -r @sysconfdir@/bash_completion ]; then
# Source completion code.
. @sysconfdir@/bash_completion
fi
diff --git a/completions/Makefile.am b/completions/Makefile.am
new file mode 100644
index 00000000..fb423253
--- /dev/null
+++ b/completions/Makefile.am
@@ -0,0 +1,182 @@
+SUBDIRS = helpers
+bashcomp_DATA = abook \
+ ant \
+ apache2ctl \
+ apt \
+ apt-build \
+ aptitude \
+ aspell \
+ autoconf \
+ automake \
+ autorpm \
+ bash-builtins \
+ bind-utils \
+ bitkeeper \
+ bittorrent \
+ bluez \
+ brctl \
+ bzip2 \
+ cardctl \
+ cfengine \
+ chkconfig \
+ chsh \
+ cksfv \
+ clisp \
+ configure \
+ coreutils \
+ cowsay \
+ cpan2dist \
+ cpio \
+ crontab \
+ cups \
+ cryptsetup \
+ cvs \
+ cvsps \
+ dd \
+ dhclient \
+ dict \
+ dpkg \
+ dselect \
+ dsniff \
+ dvd+rw-tools \
+ e2fsprogs \
+ findutils \
+ freeciv \
+ freerdp \
+ fuse \
+ gcc \
+ gcl \
+ gdb \
+ genisoimage \
+ getent \
+ gkrellm \
+ gnatmake \
+ gpg \
+ gpg2 \
+ gzip \
+ heimdal \
+ hping2 \
+ iconv \
+ iftop \
+ ifupdown \
+ imagemagick \
+ info \
+ iptables \
+ ipmitool \
+ iproute2 \
+ ipsec \
+ ipv6calc \
+ isql \
+ jar \
+ java \
+ k3b \
+ kldload \
+ larch \
+ ldapvi \
+ lftp \
+ lilo \
+ links \
+ lintian \
+ lisp \
+ lrzip \
+ lsof \
+ lvm \
+ lzma \
+ lzop \
+ mailman \
+ make \
+ man \
+ mc \
+ mcrypt \
+ mdadm \
+ medusa \
+ minicom \
+ mkinitrd \
+ module-init-tools \
+ monodevelop \
+ mount \
+ mplayer \
+ msynctool \
+ mtx \
+ munin-node \
+ mutt \
+ mysqladmin \
+ ncftp \
+ net-tools \
+ nmap \
+ ntpdate \
+ openldap \
+ openssl \
+ p4 \
+ perl \
+ pine \
+ pkg-config \
+ pkg_install \
+ pkgtools \
+ pm-utils \
+ portupgrade \
+ postfix \
+ postgresql \
+ povray \
+ procps \
+ python \
+ qdbus \
+ qemu \
+ quota-tools \
+ rcs \
+ rdesktop \
+ reportbug \
+ resolvconf \
+ rfkill \
+ ri \
+ rpcdebug \
+ rpm \
+ rpmcheck \
+ rrdtool \
+ rsync \
+ rtcwake \
+ samba \
+ sbcl \
+ screen \
+ service \
+ sh \
+ shadow \
+ sitecopy \
+ smartctl \
+ snownews \
+ sqlite3 \
+ ssh \
+ sshfs \
+ strace \
+ svk \
+ sysbench \
+ sysctl \
+ sysv-rc \
+ tar \
+ tcpdump \
+ unace \
+ unrar \
+ update-alternatives \
+ util-linux \
+ vncviewer \
+ vpnc \
+ wireless-tools \
+ wodim \
+ wol \
+ wtf \
+ wvdial \
+ xhost \
+ xm \
+ xmllint \
+ xmlwf \
+ xmms \
+ xmodmap \
+ xrandr \
+ xrdb \
+ xsltproc \
+ xz \
+ yp-tools \
+ yum-arch
+
+EXTRA_DIST = $(bashcomp_DATA) \
+ _mock _modules _subversion _yum _yum-utils
diff --git a/contrib/_mock b/completions/_mock
index f16f116d..fa312711 100644
--- a/contrib/_mock
+++ b/completions/_mock
@@ -27,7 +27,8 @@ _mock()
_split_longopt && split=true
case $prev in
- -h|--help|--copyin|--copyout|--arch|-D|--define|--with|--without|--uniqueext|--rpmbuild_timeout|--sources|--cwd)
+ -h|--help|--copyin|--copyout|--arch|-D|--define|--with|--without|\
+ --uniqueext|--rpmbuild_timeout|--sources|--cwd)
return 0
;;
-r|--root)
@@ -62,20 +63,18 @@ _mock()
$split && return 0
if [[ "$cur" == -* ]] ; then
- COMPREPLY=( $( compgen -W '--version --help --rebuild \
- --buildsrpm --shell --chroot --clean --init \
- --installdeps --install --update --orphanskill \
- --copyin --copyout --root --offline --no-clean \
- --cleanup-after --no-cleanup-after --arch --target \
- --define --with --without --resultdir --uniqueext \
- --configdir --rpmbuild_timeout --unpriv --cwd --spec \
- --sources --verbose --quiet --trace --enable-plugin \
- --disable-plugin --print-root-path' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '--version --help --rebuild --buildsrpm
+ --shell --chroot --clean --init --installdeps --install --update
+ --orphanskill --copyin --copyout --root --offline --no-clean
+ --cleanup-after --no-cleanup-after --arch --target --define --with
+ --without --resultdir --uniqueext --configdir --rpmbuild_timeout
+ --unpriv --cwd --spec --sources --verbose --quiet --trace
+ --enable-plugin --disable-plugin --print-root-path' -- "$cur" ) )
else
- _filedir '?(no)src.rpm'
+ _filedir '@(?(no)src.r|s)pm'
fi
} &&
-complete -F _mock -o filenames mock
+complete -F _mock mock
# Local variables:
# mode: shell-script
diff --git a/contrib/_modules b/completions/_modules
index f1ad88d8..f1ad88d8 100644
--- a/contrib/_modules
+++ b/completions/_modules
diff --git a/completions/_subversion b/completions/_subversion
new file mode 100644
index 00000000..91523d89
--- /dev/null
+++ b/completions/_subversion
@@ -0,0 +1,360 @@
+# Use of this file is deprecated. Upstream completion is available in
+# subversion >= 0.12.0, use that instead.
+
+# svn completion
+
+have svn &&
+{
+_svn()
+{
+ local cur prev commands options command
+
+ COMPREPLY=()
+ _get_comp_words_by_ref cur prev
+
+ 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
+
+ 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]}
+
+ 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
+
+ return 0
+}
+complete -F _svn svn
+
+_svnadmin()
+{
+ local cur prev commands options mode
+
+ 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'
+
+ 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]}
+
+ 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
+
+ return 0
+}
+complete -F _svnadmin -o default svnadmin
+
+_svnlook()
+{
+ local cur prev commands options mode
+
+ 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'
+
+ 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'
+ ;;
+ 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
+
+ return 0
+}
+complete -F _svnlook -o default svnlook
+}
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/_yum b/completions/_yum
index 19b79cee..9d3cbb68 100644
--- a/contrib/_yum
+++ b/completions/_yum
@@ -146,7 +146,7 @@ _yum()
fi
}
} &&
-complete -F _yum -o filenames yum
+complete -F _yum yum
# Local variables:
# mode: shell-script
diff --git a/contrib/_yum-utils b/completions/_yum-utils
index 49a57f76..b7f6d264 100644
--- a/contrib/_yum-utils
+++ b/completions/_yum-utils
@@ -20,7 +20,7 @@ _repomanage()
_filedir -d
fi
} &&
-complete -F _repomanage -o filenames repomanage
+complete -F _repomanage repomanage
# Local variables:
# mode: shell-script
diff --git a/contrib/abook b/completions/abook
index 2a3bc4f6..f09c8b50 100644
--- a/contrib/abook
+++ b/completions/abook
@@ -26,13 +26,11 @@ _abook()
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
@@ -53,7 +51,7 @@ _abook()
;;
esac
} &&
-complete -F _abook -o filenames abook
+complete -F _abook abook
# Local variables:
# mode: shell-script
diff --git a/contrib/ant b/completions/ant
index e0d835d6..132c4390 100644
--- a/contrib/ant
+++ b/completions/ant
@@ -58,8 +58,7 @@ _ant()
fi
}
have complete-ant-cmd.pl && \
- complete -C complete-ant-cmd.pl -F _ant -o filenames ant || \
- complete -F _ant -o filenames ant
+ complete -C complete-ant-cmd.pl -F _ant ant || complete -F _ant ant
}
# Local variables:
diff --git a/contrib/apache2ctl b/completions/apache2ctl
index 287443a2..287443a2 100644
--- a/contrib/apache2ctl
+++ b/completions/apache2ctl
diff --git a/contrib/apt b/completions/apt
index 4010a0d5..84811ae8 100644
--- a/contrib/apt
+++ b/completions/apt
@@ -71,7 +71,7 @@ _apt_get()
return 0
} &&
-complete -F _apt_get -o filenames apt-get
+complete -F _apt_get apt-get
# Debian apt-cache(8) completion.
#
@@ -146,7 +146,7 @@ _apt_cache()
return 0
} &&
-complete -F _apt_cache -o filenames apt-cache
+complete -F _apt_cache apt-cache
# Local variables:
# mode: shell-script
diff --git a/contrib/apt-build b/completions/apt-build
index 9597ae8d..d875a986 100644
--- a/contrib/apt-build
+++ b/completions/apt-build
@@ -55,7 +55,7 @@ _apt_build()
return 0
} &&
-complete -F _apt_build -o filenames apt-build
+complete -F _apt_build apt-build
# Local variables:
# mode: shell-script
diff --git a/contrib/aptitude b/completions/aptitude
index c00ad40e..c00ad40e 100644
--- a/contrib/aptitude
+++ b/completions/aptitude
diff --git a/contrib/aspell b/completions/aspell
index e063f497..5254eee7 100644
--- a/contrib/aspell
+++ b/completions/aspell
@@ -84,7 +84,7 @@ _aspell()
fi
}
-complete -F _aspell -o filenames aspell
+complete -F _aspell aspell
}
# Local variables:
diff --git a/completions/autoconf b/completions/autoconf
new file mode 100644
index 00000000..c8f1b195
--- /dev/null
+++ b/completions/autoconf
@@ -0,0 +1,124 @@
+# Completions for autoconf tools
+
+have autoconf &&
+_autoconf()
+{
+ COMPREPLY=()
+ local cur prev split=false
+ _get_comp_words_by_ref cur prev
+
+ _split_longopt && split=true
+
+ case "$prev" in
+ --help|-h|--version|-V|--trace|-t)
+ return 0
+ ;;
+ --output|-o)
+ _filedir
+ return 0
+ ;;
+ --warnings|-W)
+ local cats=( cross obsolete syntax )
+ COMPREPLY=( $( compgen -W \
+ '${cats[@]} ${cats[@]/#/no-} all none error' -- "$cur" ) )
+ return 0
+ ;;
+ --prepend-include|-B|--include|-I)
+ _filedir -d
+ return 0
+ ;;
+ esac
+
+ $split && return 0
+
+ if [[ "$cur" == -* ]]; then
+ _longopt $1
+ return
+ fi
+
+ _filedir '@(ac|in)'
+} &&
+complete -F _autoconf autoconf
+
+have autoreconf || have autoheader &&
+_autoreconf()
+{
+ COMPREPLY=()
+ local cur prev split=false
+ _get_comp_words_by_ref cur prev
+
+ _split_longopt && split=true
+
+ case "$prev" in
+ --help|-h|--version|-V)
+ return 0
+ ;;
+ --warnings|-W)
+ local cats=( cross gnu obsolete override portability syntax \
+ unsupported )
+ COMPREPLY=( $( compgen -W \
+ '${cats[@]} ${cats[@]/#/no-} all none error' -- "$cur" ) )
+ return 0
+ ;;
+ --prepend-include|-B|--include|-I)
+ _filedir -d
+ return 0
+ ;;
+ esac
+
+ $split && return 0
+
+ if [[ "$cur" == -* ]]; then
+ _longopt $1
+ return 0
+ fi
+
+ if [[ $1 == autoheader ]] ; then
+ _filedir '@(ac|in)'
+ else
+ _filedir -d
+ fi
+} &&
+complete -F _autoreconf autoreconf autoheader
+
+have autoscan || have autoupdate &&
+_autoscan()
+{
+ COMPREPLY=()
+ local cur prev split=false
+ _get_comp_words_by_ref cur prev
+
+ _split_longopt && split=true
+
+ case "$prev" in
+ --help|-h|--version|-V)
+ return 0
+ ;;
+ --prepend-include|-B|--include|-I)
+ _filedir -d
+ return 0
+ ;;
+ esac
+
+ $split && return 0
+
+ if [[ "$cur" == -* ]]; then
+ _longopt $1
+ return 0
+ fi
+
+ if [[ $1 == autoupdate ]] ; then
+ _filedir '@(ac|in)'
+ else
+ _filedir -d
+ fi
+} &&
+complete -F _autoscan autoscan autoupdate
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/automake b/completions/automake
new file mode 100644
index 00000000..7ed87453
--- /dev/null
+++ b/completions/automake
@@ -0,0 +1,80 @@
+# Completions for automake tools
+
+have automake &&
+_automake()
+{
+ COMPREPLY=()
+ local cur prev split=false
+ _get_comp_words_by_ref cur prev
+
+ _split_longopt && split=true
+
+ case "$prev" in
+ --help|--version)
+ return 0
+ ;;
+ --warnings|-W)
+ local cats=( gnu obsolete override portability syntax unsupported )
+ COMPREPLY=( $( compgen -W \
+ '${cats[@]} ${cats[@]/#/no-} all none error' -- "$cur" ) )
+ return 0
+ ;;
+ --libdir)
+ _filedir -d
+ return 0
+ ;;
+ esac
+
+ $split && return 0
+
+ if [[ "$cur" == -* ]]; then
+ _longopt $1
+ return
+ fi
+
+ _filedir
+} &&
+complete -F _automake automake automake-1.11
+
+have aclocal &&
+_aclocal()
+{
+ COMPREPLY=()
+ local cur prev split=false
+ _get_comp_words_by_ref cur prev
+
+ _split_longopt && split=true
+
+ case "$prev" in
+ --help|--print-ac-dir|--version)
+ return 0
+ ;;
+ --acdir|-I)
+ _filedir -d
+ return 0
+ ;;
+ --output)
+ _filedir
+ return 0
+ ;;
+ --warnings|-W)
+ local cats=( syntax unsupported )
+ COMPREPLY=( $( compgen -W \
+ '${cats[@]} ${cats[@]/#/no-} all none error' -- "$cur" ) )
+ return 0
+ ;;
+ esac
+
+ $split && return 0
+
+ _longopt $1
+} &&
+complete -F _aclocal aclocal aclocal-1.11
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/autorpm b/completions/autorpm
index 6a5f7620..6a5f7620 100644
--- a/contrib/autorpm
+++ b/completions/autorpm
diff --git a/contrib/bash-builtins b/completions/bash-builtins
index aac75ae0..3eba8a11 100644
--- a/contrib/bash-builtins
+++ b/completions/bash-builtins
@@ -85,10 +85,9 @@ _complete()
;;
-A)
- COMPREPLY=( $( compgen -W 'alias arrayvar binding \
- builtin command directory disabled enabled \
- export file function group helptopic hostname \
- job keyword running service setopt shopt \
+ COMPREPLY=( $( compgen -W 'alias arrayvar binding builtin command \
+ directory disabled enabled export file function group \
+ helptopic hostname job keyword running service setopt shopt \
signal stopped user variable' -- "$cur" ) )
return 0
;;
@@ -111,13 +110,14 @@ _complete()
if [[ "$cur" == -* ]]; then
# relevant options completion
- 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" ) )
+ local opts="-a -b -c -d -e -f -g -j -k -o -s -u -v -A -G -W -P -S -X"
+ [[ $1 != compgen ]] && opts="$opts -F -C"
+ COMPREPLY=( $( compgen -W "$opts" -- "$cur" ) )
else
COMPREPLY=( $( compgen -A command -- "$cur" ) )
fi
}
-complete -F _complete complete
+complete -F _complete compgen complete
# Local variables:
# mode: shell-script
diff --git a/contrib/bind-utils b/completions/bind-utils
index 040d1975..040d1975 100644
--- a/contrib/bind-utils
+++ b/completions/bind-utils
diff --git a/contrib/bitkeeper b/completions/bitkeeper
index 4c312a14..4c312a14 100644
--- a/contrib/bitkeeper
+++ b/completions/bitkeeper
diff --git a/contrib/bittorrent b/completions/bittorrent
index 761d0836..761d0836 100644
--- a/contrib/bittorrent
+++ b/completions/bittorrent
diff --git a/contrib/bluez b/completions/bluez
index 7a2b1e57..7a2b1e57 100644
--- a/contrib/bluez
+++ b/completions/bluez
diff --git a/contrib/brctl b/completions/brctl
index 1be86af1..1be86af1 100644
--- a/contrib/brctl
+++ b/completions/brctl
diff --git a/contrib/bzip2 b/completions/bzip2
index f4902e29..7e2f9fd0 100644
--- a/contrib/bzip2
+++ b/completions/bzip2
@@ -21,7 +21,7 @@ _bzip2()
return 0
fi
- local IFS=$'\t\n'
+ local IFS=$'\n'
xspec="*.bz2"
if [[ "$prev" == --* ]]; then
@@ -36,10 +36,11 @@ _bzip2()
_expand || return 0
+ _compopt_o_filenames
COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \
$( compgen -d -- "$cur" ) )
} &&
-complete -F _bzip2 -o filenames bzip2 pbzip2
+complete -F _bzip2 bzip2 pbzip2
# Local variables:
# mode: shell-script
diff --git a/contrib/cardctl b/completions/cardctl
index 1af7491b..1af7491b 100644
--- a/contrib/cardctl
+++ b/completions/cardctl
diff --git a/contrib/cfengine b/completions/cfengine
index 50a13840..50a13840 100644
--- a/contrib/cfengine
+++ b/completions/cfengine
diff --git a/contrib/chkconfig b/completions/chkconfig
index 2d02e56e..2d02e56e 100644
--- a/contrib/chkconfig
+++ b/completions/chkconfig
diff --git a/contrib/chsh b/completions/chsh
index 1af3630f..1af3630f 100644
--- a/contrib/chsh
+++ b/completions/chsh
diff --git a/contrib/cksfv b/completions/cksfv
index 1f83824b..1f83824b 100644
--- a/contrib/cksfv
+++ b/completions/cksfv
diff --git a/contrib/clisp b/completions/clisp
index 074f692c..074f692c 100644
--- a/contrib/clisp
+++ b/completions/clisp
diff --git a/contrib/configure b/completions/configure
index d69f85b1..1b207692 100644
--- a/contrib/configure
+++ b/completions/configure
@@ -10,7 +10,7 @@ _configure()
_split_longopt && split=true
case $prev in
- --prefix|--exec-prefix|--*dir)
+ --*prefix|--*dir)
_filedir -d
;;
esac
@@ -33,7 +33,7 @@ _configure()
-- "$cur" ) )
fi
}
-complete -F _configure -o filenames configure
+complete -F _configure configure
# Local variables:
# mode: shell-script
diff --git a/contrib/coreutils b/completions/coreutils
index 65809fbb..299aabe0 100644
--- a/contrib/coreutils
+++ b/completions/coreutils
@@ -41,13 +41,13 @@ _chown()
_count_args :
if [[ $args == 1 ]]; then
- _usergroup
+ _usergroup -u
else
_filedir
fi
fi
} &&
-complete -F _chown -o filenames chown
+complete -F _chown chown
# chgrp(1) completion
@@ -84,15 +84,14 @@ _chgrp()
# 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 ) )
+ _allowed_groups
else
_filedir || return 0
fi
return 0
} &&
-complete -F _chgrp -o filenames chgrp
+complete -F _chgrp chgrp
# id(1) completion
#
diff --git a/contrib/cowsay b/completions/cowsay
index c6d797aa..c6d797aa 100644
--- a/contrib/cowsay
+++ b/completions/cowsay
diff --git a/contrib/cpan2dist b/completions/cpan2dist
index 13f568af..13f568af 100644
--- a/contrib/cpan2dist
+++ b/completions/cpan2dist
diff --git a/contrib/cpio b/completions/cpio
index e77b4153..5ead0184 100644
--- a/contrib/cpio
+++ b/completions/cpio
@@ -30,6 +30,7 @@ _cpio()
return 0
;;
--rsh-command)
+ _compopt_o_filenames
COMPREPLY=( $( compgen -c -- "$cur" ) )
return 0
;;
@@ -90,7 +91,7 @@ _cpio()
esac
fi
}
-complete -F _cpio -o filenames cpio
+complete -F _cpio cpio
}
# Local variables:
diff --git a/completions/crontab b/completions/crontab
new file mode 100644
index 00000000..d2ee23a0
--- /dev/null
+++ b/completions/crontab
@@ -0,0 +1,60 @@
+# crontab(1) completion
+
+have crontab &&
+_crontab()
+{
+ local cur prev
+ COMPREPLY=()
+ _get_comp_words_by_ref cur prev
+
+ case $prev in
+ -u)
+ _allowed_users
+ return 0
+ ;;
+ esac
+
+ local i opts=" -u -l -r -e" # leading space at start is significant...
+ [ "$(uname -s)" = Linux ] && opts="$opts -i"
+ [ -e /etc/selinux ] && opts="$opts -s"
+ for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
+ case "${COMP_WORDS[i]}" in
+ -l)
+ opts=${opts// -l -r -e/}
+ opts=${opts// -i/}
+ opts=${opts// -s/}
+ ;;
+ -e)
+ opts=${opts// -l -r -e/}
+ opts=${opts// -i/}
+ ;;
+ -r)
+ opts=${opts// -l -r -e/}
+ ;;
+ -u)
+ opts=${opts// -u/}
+ opts=${opts// -i/}
+ ;;
+ -i|-s)
+ opts=${opts// ${COMP_WORDS[i]}/}
+ ;;
+ esac
+ done
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '$opts' -- "$cur" ) )
+ return 0
+ fi
+
+ # do filenames only if we did not have -l, -r, or -e
+ [[ "${COMP_LINE}" == *\ -@(l|r|e)* ]] || _filedir
+} &&
+complete -F _crontab crontab
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/cryptsetup b/completions/cryptsetup
index 5e88de34..5e88de34 100644
--- a/contrib/cryptsetup
+++ b/completions/cryptsetup
diff --git a/contrib/cups b/completions/cups
index 80c9af54..2848c953 100644
--- a/contrib/cups
+++ b/completions/cups
@@ -10,7 +10,7 @@ _cancel()
COMPREPLY=( $( compgen -W "$( lpstat | cut -d' ' -f1 )" -- "$cur" ) )
} &&
-complete -F _cancel -o filenames cancel
+complete -F _cancel cancel
# Local variables:
# mode: shell-script
diff --git a/contrib/cvs b/completions/cvs
index 04837cd1..be3b1be7 100644
--- a/contrib/cvs
+++ b/completions/cvs
@@ -238,7 +238,7 @@ _cvs()
set_prefix
- if [[ "$cur" != -* ]] && [ -r ${prefix:-}CVS/Entries ]; then
+ if [[ "$cur" != -* && -r ${prefix:-}CVS/Entries ]]; then
# if $COMP_CVS_REMOTE is not null, 'cvs commit' will
# complete on remotely checked-out files (requires
# passwordless access to the remote repository
diff --git a/contrib/cvsps b/completions/cvsps
index 257437bc..257437bc 100644
--- a/contrib/cvsps
+++ b/completions/cvsps
diff --git a/contrib/dd b/completions/dd
index e236f85a..7b9b3ac7 100644
--- a/contrib/dd
+++ b/completions/dd
@@ -9,26 +9,26 @@ _dd()
_get_comp_words_by_ref -n = cur
case $cur in
- if=*|of=*)
- cur=${cur#*=}
- _filedir
- return 0
- ;;
- conv=*)
- cur=${cur#*=}
- COMPREPLY=( $( compgen -W 'ascii ebcdic ibm block unblock \
- lcase notrunc ucase swab noerror sync' -- "$cur" ) )
- return 0
- ;;
+ if=*|of=*)
+ cur=${cur#*=}
+ _filedir
+ return 0
+ ;;
+ conv=*)
+ cur=${cur#*=}
+ COMPREPLY=( $( compgen -W 'ascii ebcdic ibm block unblock lcase
+ notrunc ucase swab noerror sync' -- "$cur" ) )
+ return 0
+ ;;
esac
_expand || return 0
COMPREPLY=( $( compgen -W '--help --version' -- "$cur" ) \
- $( compgen -W 'bs cbs conv count ibs if obs of seek skip'\
- -S '=' -- "$cur" ) )
+ $( compgen -W 'bs cbs conv count ibs if obs of seek skip' \
+ -S '=' -- "$cur" ) )
} &&
-complete -F _dd -o nospace -o filenames dd
+complete -F _dd -o nospace dd
# Local variables:
# mode: shell-script
diff --git a/contrib/dhclient b/completions/dhclient
index 3d7e1e1a..3d7e1e1a 100644
--- a/contrib/dhclient
+++ b/completions/dhclient
diff --git a/contrib/dict b/completions/dict
index 4cfdf98f..4cfdf98f 100644
--- a/contrib/dict
+++ b/completions/dict
diff --git a/contrib/dpkg b/completions/dpkg
index a70ccef8..0556f3d1 100644
--- a/contrib/dpkg
+++ b/completions/dpkg
@@ -92,7 +92,7 @@ _dpkg()
}
-complete -F _dpkg -o filenames dpkg dpkg-deb
+complete -F _dpkg dpkg dpkg-deb
}
# Debian GNU dpkg-reconfigure(8) completion
diff --git a/contrib/dselect b/completions/dselect
index 8bea891a..3042a8d0 100644
--- a/contrib/dselect
+++ b/completions/dselect
@@ -27,10 +27,9 @@ _dselect()
remove quit' -- "$cur" ) )
fi
-
return 0
} &&
-complete -F _dselect -o filenames dselect
+complete -F _dselect dselect
# Local variables:
# mode: shell-script
diff --git a/contrib/dsniff b/completions/dsniff
index 1d3b303b..1d3b303b 100644
--- a/contrib/dsniff
+++ b/completions/dsniff
diff --git a/completions/dvd+rw-tools b/completions/dvd+rw-tools
new file mode 100644
index 00000000..f37781ee
--- /dev/null
+++ b/completions/dvd+rw-tools
@@ -0,0 +1,47 @@
+# dvd+rw-tools completions
+
+have growisofs &&
+_growisofs()
+{
+ COMPREPLY=()
+ local cur prev
+ _get_comp_words_by_ref cur prev
+
+ case $prev in
+ -version|-speed)
+ return 0
+ ;;
+ -Z|-M)
+ compopt -o nospace &>/dev/null
+ _dvd_devices
+ return 0
+ ;;
+ /?(r)dev/*)
+ if [[ $cur == =* ]] ; then
+ # e.g. /dev/dvd=foo.iso, /dev/dvdrw=/dev/zero
+ cur="${cur#=}"
+ _filedir
+ return 0
+ fi
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ # TODO: mkisofs options
+ COMPREPLY=( $( compgen -W '-dvd-compat -overburn -speed= -Z -M' \
+ -- "$cur" ) )
+ [[ ${COMPREPLY[@]} == *= ]] && compopt -o nospace &>/dev/null
+ return 0
+ fi
+
+ _filedir
+} &&
+complete -F _growisofs growisofs
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/e2fsprogs b/completions/e2fsprogs
new file mode 100644
index 00000000..50ce7885
--- /dev/null
+++ b/completions/e2fsprogs
@@ -0,0 +1,180 @@
+# bash completion for e2fsprogs
+
+have badblocks &&
+_badblocks()
+{
+ COMPREPLY=()
+ local cur prev
+ _get_comp_words_by_ref cur prev
+
+ case $prev in
+ -b|-c|-e|-d|-p|-t)
+ return 0
+ ;;
+ -i|-o)
+ _filedir
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ # -w (dangerous) and -X (internal use) not here on purpose
+ COMPREPLY=( $( compgen -W '-b -c -e -d -f -i -n -o -p -s -t -v' \
+ -- "$cur" ) )
+ return 0
+ fi
+
+ cur=${cur:=/dev/}
+ _filedir
+} &&
+complete -F _badblocks badblocks
+
+
+have dumpe2fs &&
+_dumpe2fs()
+{
+ COMPREPLY=()
+ local cur prev
+ _get_comp_words_by_ref cur prev
+
+ case $prev in
+ -o|-V)
+ return 0
+ ;;
+ -i)
+ _filedir
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-b -o -f -h -i -x -V' -- "$cur" ) )
+ return 0
+ fi
+
+ cur=${cur:=/dev/}
+ _filedir
+} &&
+complete -F _dumpe2fs dumpe2fs
+
+
+have e2freefrag &&
+_e2freefrag()
+{
+ COMPREPLY=()
+ local cur prev
+ _get_comp_words_by_ref cur prev
+
+ case $prev in
+ -c|-h)
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-c -h' -- "$cur" ) )
+ return 0
+ fi
+
+ cur=${cur:=/dev/}
+ _filedir
+} &&
+complete -F _e2freefrag e2freefrag
+
+
+have e2label &&
+_e2label()
+{
+ COMPREPLY=()
+ local cur cword
+ _get_comp_words_by_ref cur cword
+
+ if [ $cword -eq 1 ]; then
+ cur=${cur:=/dev/}
+ _filedir
+ fi
+} &&
+complete -F _e2label e2label
+
+
+have filefrag &&
+_filefrag()
+{
+ COMPREPLY=()
+ local cur
+ _get_comp_words_by_ref cur
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-B -b -s -v -x' -- "$cur" ) )
+ return 0
+ fi
+
+ _filedir
+} &&
+complete -F _filefrag filefrag
+
+
+have tune2fs &&
+_tune2fs()
+{
+ COMPREPLY=()
+ local cur prev
+ _get_comp_words_by_ref cur prev
+
+ case $prev in
+ -c|-C|-E|-i|-J|-L|-m|-r|-T)
+ return 0
+ ;;
+ -e)
+ COMPREPLY=( $( compgen -W 'continue remount-ro panic' -- "$cur" ) )
+ return 0
+ ;;
+ -g)
+ _gids
+ COMPREPLY=( $( compgen -g -W '${COMPREPLY[@]}' -- "$cur" ) )
+ return 0
+ ;;
+ -M)
+ _filedir -d
+ ;;
+ -o)
+ local -a opts=(^debug ^bsdgroups ^user_xattr ^acl ^uid16
+ ^journal_data ^journal_data_ordered ^journal_data_writeback)
+ COMPREPLY=( $( compgen -W '${opts[@]} ${opts[@]#^}' -- "$cur" ) )
+ return 0
+ ;;
+ -O)
+ local -a opts=(^dir_index ^dir_nlink ^extent ^extra_isize ^filetype
+ ^flex_bg ^has_journal ^huge_file ^large_file ^resize_inode
+ ^sparse_super ^uninit_bg)
+ COMPREPLY=( $( compgen -W '${opts[@]} ${opts[@]#^}' -- "$cur" ) )
+ return 0
+ ;;
+ -u)
+ _uids
+ COMPREPLY=( $( compgen -u -W '${COMPREPLY[@]}' -- "$cur" ) )
+ return 0
+ ;;
+ -U)
+ COMPREPLY=( $( compgen -W 'clear random time' -- "$cur" ) )
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-c -C -e -E -f -g -i -j -J -l -L -m -M -o
+ -O -r -T -u -U' -- "$cur" ) )
+ fi
+
+ cur=${cur:=/dev/}
+ _filedir
+} &&
+complete -F _tune2fs tune2fs
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/findutils b/completions/findutils
index 6af5d50b..b8aaa57a 100644
--- a/contrib/findutils
+++ b/completions/findutils
@@ -117,7 +117,7 @@ _find()
return 0
} &&
-complete -F _find -o filenames find
+complete -F _find find
# Local variables:
# mode: shell-script
diff --git a/contrib/freeciv b/completions/freeciv
index 602ad76a..602ad76a 100644
--- a/contrib/freeciv
+++ b/completions/freeciv
diff --git a/completions/freerdp b/completions/freerdp
new file mode 100644
index 00000000..82a46462
--- /dev/null
+++ b/completions/freerdp
@@ -0,0 +1,47 @@
+# bash completion for xfreerdp
+
+have xfreerdp &&
+_xfreerdp()
+{
+ local cur prev
+
+ COMPREPLY=()
+ _get_comp_words_by_ref cur prev
+
+ case $prev in
+ -k)
+ COMPREPLY=( $( compgen -W "$(xfreerdp --kbd-list | \
+ awk '/^0x/ {print $1}')" -- "$cur" ) )
+ return 0
+ ;;
+ -a)
+ COMPREPLY=( $( compgen -W '8 15 16 24 32' -- "$cur" ) )
+ return 0
+ ;;
+ -x)
+ COMPREPLY=( $( compgen -W 'b broadband m modem l lan' -- $cur ) )
+ return 0
+ ;;
+ --plugin)
+ COMPREPLY=( $( compgen -W 'cliprdr rdpsnd rdpdr' -- "$cur" ) )
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-u -d -s -c -p -n -t -g -a -z -f -x -O -o \
+ -k --kbd-list -h --plugin --data' -- "$cur" ) )
+ else
+ _known_hosts_real "$cur"
+ fi
+
+} &&
+complete -F _xfreerdp xfreerdp
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/fuse b/completions/fuse
index b4d80a28..58d0c516 100644
--- a/contrib/fuse
+++ b/completions/fuse
@@ -25,7 +25,7 @@ _fusermount()
_filedir -d
fi
} &&
-complete -F _fusermount -o filenames fusermount
+complete -F _fusermount fusermount
# Local variables:
# mode: shell-script
diff --git a/contrib/gcc b/completions/gcc
index 3f5a5619..d78e3e24 100644
--- a/contrib/gcc
+++ b/completions/gcc
@@ -46,9 +46,9 @@ _gcc()
_filedir
fi
} &&
-complete -o filenames -F _gcc gcc g++ c++ g77 gcj gpc
+complete -F _gcc gcc g++ c++ g77 gcj gpc
[ $USERLAND = GNU -o $UNAME = Cygwin ] && \
-[ -n "${have:-}" ] && complete -o filenames -F _gcc cc
+[ -n "${have:-}" ] && complete -F _gcc cc
# Local variables:
# mode: shell-script
diff --git a/contrib/gcl b/completions/gcl
index e0931536..e0931536 100644
--- a/contrib/gcl
+++ b/completions/gcl
diff --git a/contrib/gdb b/completions/gdb
index dc769613..f0bc42d3 100644
--- a/contrib/gdb
+++ b/completions/gdb
@@ -10,6 +10,7 @@ _gdb()
if [ $COMP_CWORD -eq 1 ]; then
local IFS
+ _compopt_o_filenames
if [[ "$cur" == */* ]]; then
# compgen -c works as expected if $cur contains any slashes.
IFS=$'\n'
diff --git a/contrib/genisoimage b/completions/genisoimage
index 7f379041..61b18114 100644
--- a/contrib/genisoimage
+++ b/completions/genisoimage
@@ -66,7 +66,7 @@ _mkisofs()
fi
} &&
-complete -F _mkisofs -o filenames mkisofs genisoimage
+complete -F _mkisofs mkisofs genisoimage
# Local variables:
# mode: shell-script
diff --git a/contrib/getent b/completions/getent
index 54e62ab8..54e62ab8 100644
--- a/contrib/getent
+++ b/completions/getent
diff --git a/contrib/gkrellm b/completions/gkrellm
index 1e3925f1..13e25ada 100644
--- a/contrib/gkrellm
+++ b/completions/gkrellm
@@ -43,7 +43,7 @@ _gkrellm()
fi
} &&
-complete -F _gkrellm -o filenames gkrellm gkrellm2
+complete -F _gkrellm gkrellm gkrellm2
# Local variables:
# mode: shell-script
diff --git a/contrib/gnatmake b/completions/gnatmake
index 11b04908..cdd193c1 100644
--- a/contrib/gnatmake
+++ b/completions/gnatmake
@@ -26,7 +26,7 @@ _gnatmake()
_filedir '@(adb|ads)'
fi
} &&
-complete -F _gnatmake -o filenames gnatmake
+complete -F _gnatmake gnatmake
# Local variables:
# mode: shell-script
diff --git a/contrib/gpg b/completions/gpg
index 878a800b..878a800b 100644
--- a/contrib/gpg
+++ b/completions/gpg
diff --git a/contrib/gpg2 b/completions/gpg2
index b99783f9..b99783f9 100644
--- a/contrib/gpg2
+++ b/completions/gpg2
diff --git a/contrib/gzip b/completions/gzip
index 0951f72f..f7aec17e 100644
--- a/contrib/gzip
+++ b/completions/gzip
@@ -21,7 +21,7 @@ _gzip()
return 0
fi
- local IFS=$'\t\n'
+ local IFS=$'\n'
xspec="*.@(gz|t[ag]z)"
if [[ "$prev" == --* ]]; then
@@ -40,10 +40,11 @@ _gzip()
_expand || return 0
+ _compopt_o_filenames
COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \
$( compgen -d -- "$cur" ) )
} &&
-complete -F _gzip -o filenames gzip pigz
+complete -F _gzip gzip pigz
# Local variables:
# mode: shell-script
diff --git a/contrib/heimdal b/completions/heimdal
index c1efb110..c1efb110 100644
--- a/contrib/heimdal
+++ b/completions/heimdal
diff --git a/completions/helpers/Makefile.am b/completions/helpers/Makefile.am
new file mode 100644
index 00000000..98fccefe
--- /dev/null
+++ b/completions/helpers/Makefile.am
@@ -0,0 +1,3 @@
+helpers_SCRIPTS = perl
+
+EXTRA_DIST = $(helpers_SCRIPTS)
diff --git a/completions/helpers/perl b/completions/helpers/perl
new file mode 100755
index 00000000..b3522ac0
--- /dev/null
+++ b/completions/helpers/perl
@@ -0,0 +1,88 @@
+#!/usr/bin/env perl
+use strict;
+use Config;
+use File::Spec::Functions;
+
+my %seen;
+
+sub print_modules_real {
+ my ($base, $dir, $word) = @_;
+
+ # return immediatly if potential completion doesn't match current word
+ # a double comparaison is used to avoid dealing with string lengths
+ # (the shorter being the pattern to be used as the regexp)
+ # word 'Fi', base 'File' -> match 'File' against 'Fi'
+ # word 'File::Sp', base 'File' -> match 'File::Sp' againt 'File'
+ return if
+ $base &&
+ $word &&
+ $base !~ /^\Q$word/ &&
+ $word !~ /^\Q$base/;
+
+ chdir($dir) or return;
+
+ # print each file
+ foreach my $file (glob('*.pm')) {
+ $file =~ s/\.pm$//;
+ my $module = $base . $file;
+ next if $module !~ /^\Q$word/;
+ next if $seen{$module}++;
+ print $module . "\n";
+ }
+
+ # recurse in each subdirectory
+ foreach my $directory (grep { -d } glob('*')) {
+ my $subdir = $dir . '/' . $directory;
+ if ($directory =~ /^(?:[.\d]+|$Config{archname}|auto)$/) {
+ # exclude subdirectory name from base
+ print_modules_real(undef, $subdir, $word);
+ } else {
+ # add subdirectory name to base
+ print_modules_real($base . $directory . '::', $subdir, $word);
+ }
+ }
+}
+
+sub print_modules {
+ my ($word) = @_;
+
+ foreach my $directory (@INC) {
+ print_modules_real(undef, $directory, $word);
+ }
+}
+
+sub print_functions {
+ my ($word) = @_;
+
+ my $perlfunc;
+ for ( @INC, undef ) {
+ return if not defined;
+ $perlfunc = catfile $_, qw( pod perlfunc.pod );
+ last if -r $perlfunc;
+ }
+
+ open my $fh, '<', $perlfunc or return;
+
+ my $nest_level = -1;
+ while ( <$fh> ) {
+ next if 1 .. /^=head2 Alphabetical Listing of Perl Functions$/;
+ ++$nest_level if /^=over/;
+ --$nest_level if /^=back/;
+ next if $nest_level;
+ next unless /^=item (-?\w+)/;
+ my $function = $1;
+ next if $function !~ /^\Q$word/;
+ next if $seen{$function}++;
+ print $function . "\n";
+ }
+
+}
+
+my $type = shift;
+my $word = shift;
+
+if ($type eq 'functions') {
+ print_functions($word);
+} elsif ($type eq 'modules') {
+ print_modules($word);
+}
diff --git a/contrib/hping2 b/completions/hping2
index b1607f83..e2e6bf1a 100644
--- a/contrib/hping2
+++ b/completions/hping2
@@ -1,6 +1,6 @@
# bash completion for hping2
-have hping2 &&
+have hping || have hping2 || have hping3 &&
_hping2()
{
local cur prev
@@ -44,7 +44,7 @@ _hping2()
_known_hosts_real "$cur"
fi
} &&
-complete -F _hping2 hping2 hping
+complete -F _hping2 hping hping2 hping3
# Local variables:
# mode: shell-script
diff --git a/contrib/iconv b/completions/iconv
index 14b618dc..9e332004 100644
--- a/contrib/iconv
+++ b/completions/iconv
@@ -36,8 +36,6 @@ _iconv()
fi
} &&
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/completions/iftop b/completions/iftop
new file mode 100644
index 00000000..9ec2a0d0
--- /dev/null
+++ b/completions/iftop
@@ -0,0 +1,35 @@
+# iftop(8) completion
+
+have iftop &&
+_iftop()
+{
+ COMPREPLY=()
+ local cur prev
+ _get_comp_words_by_ref cur prev
+
+ case $prev in
+ -h|-f|-F|-m)
+ return 0
+ ;;
+ -i)
+ _available_interfaces -a
+ return 0
+ ;;
+ -c)
+ _filedir
+ return 0
+ ;;
+ esac
+
+ COMPREPLY=( $( compgen -W '-h -n -N -p -P -b -B -i -f -F -c -m' \
+ -- "$cur" ) )
+} &&
+complete -F _iftop iftop
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/ifupdown b/completions/ifupdown
index f81e08d5..f81e08d5 100644
--- a/contrib/ifupdown
+++ b/completions/ifupdown
diff --git a/contrib/imagemagick b/completions/imagemagick
index 5366e619..c7ba74c8 100644
--- a/contrib/imagemagick
+++ b/completions/imagemagick
@@ -189,7 +189,7 @@ _convert()
_filedir
fi
}
-complete -F _convert -o filenames convert
+complete -F _convert convert
_mogrify()
{
@@ -245,7 +245,7 @@ _mogrify()
_filedir
fi
}
-complete -F _mogrify -o filenames mogrify
+complete -F _mogrify mogrify
_display()
{
@@ -285,7 +285,7 @@ _display()
_filedir
fi
}
-complete -F _display -o filenames display
+complete -F _display display
_animate()
{
@@ -319,7 +319,7 @@ _animate()
_filedir
fi
}
-complete -F _animate -o filenames animate
+complete -F _animate animate
_identify()
{
@@ -344,7 +344,7 @@ _identify()
_filedir
fi
}
-complete -F _identify -o filenames identify
+complete -F _identify identify
_montage()
{
@@ -382,7 +382,7 @@ _montage()
_filedir
fi
}
-complete -F _montage -o filenames montage
+complete -F _montage montage
_composite()
{
@@ -417,7 +417,7 @@ _composite()
_filedir
fi
}
-complete -F _composite -o filenames composite
+complete -F _composite composite
_compare()
{
@@ -444,7 +444,7 @@ _compare()
_filedir
fi
}
-complete -F _compare -o filenames compare
+complete -F _compare compare
_conjure()
{
@@ -464,7 +464,7 @@ _conjure()
_filedir
fi
}
-complete -F _conjure -o filenames conjure
+complete -F _conjure conjure
_import()
{
@@ -495,7 +495,7 @@ _import()
_filedir
fi
}
-complete -F _import -o filenames import
+complete -F _import import
_stream()
{
@@ -520,7 +520,7 @@ _stream()
_filedir
fi
}
-complete -F _stream -o filenames stream
+complete -F _stream stream
}
# Local variables:
diff --git a/contrib/info b/completions/info
index 55791d31..367cadef 100644
--- a/contrib/info
+++ b/completions/info
@@ -47,7 +47,7 @@ _info()
return 0
} &&
-complete -F _info -o filenames info
+complete -F _info info
# Local variables:
# mode: shell-script
diff --git a/completions/ipmitool b/completions/ipmitool
new file mode 100644
index 00000000..3a90eeb4
--- /dev/null
+++ b/completions/ipmitool
@@ -0,0 +1,214 @@
+# bash completion for ipmitool
+
+have ipmitool && {
+
+_ipmitool_singleline_help()
+{
+ COMPREPLY=( $( compgen -W "$( $1 $2 2>&1 | \
+ sed -ne 's/[,\r]//g' -e 's/^.*[Cc]ommands://p' )" -- "$cur" ) )
+}
+
+_ipmitool()
+{
+ local cur prev
+
+ COMPREPLY=()
+ _get_comp_words_by_ref cur prev
+
+ case $prev in
+ -h|-V|-p|-U|-e|-k|-y|-P|-m|-b|-t|-B|-T|-l)
+ return 0
+ ;;
+ -d)
+ COMPREPLY=( $( compgen -W "$( \
+ command ls -d /dev/ipmi* /dev/ipmi/* /dev/ipmidev/* \
+ 2>/dev/null | sed -ne 's/^[^0-9]*\([0-9]\{1,\}\)/\1/p' )" \
+ -- "$cur" ) )
+ return 0
+ ;;
+ -I)
+ COMPREPLY=( $( compgen -W "$( $1 -h 2>&1 | \
+ sed -e '/^Interfaces:/,/^[[:space:]]*$/!d' \
+ -ne 's/^[[:space:]]\{1,\}\([^[:space:]]\{1,\}\).*/\1/p' )" \
+ -- "$cur" ) )
+ return 0
+ ;;
+ -H)
+ _known_hosts_real "$cur"
+ return 0
+ ;;
+ -f|-S|-O)
+ _filedir
+ return 0
+ ;;
+ -C)
+ COMPREPLY=( $( compgen -W '0 1 2 3 4 5 6 7 8 9 10 11 12 13 14' \
+ -- "$cur" ) )
+ return 0
+ ;;
+ -L)
+ COMPREPLY=( $( compgen -W 'CALLBACK USER OPERATOR ADMINISTRATOR' \
+ -- "$cur" ) )
+ return 0
+ ;;
+ -A)
+ COMPREPLY=( $( compgen -W 'NONE PASSWORD MD2 MD5 OEM' -- "$cur" ) )
+ return 0
+ ;;
+ -o)
+ COMPREPLY=( $( compgen -W "$( $1 -o list 2>&1 | \
+ awk '/^[ \t]+/ { print $1 }' ) list" -- "$cur" ) )
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-h -V -v -c -d -I -H -p -U -f -S -a \
+ -e -C -k -y -L -A -P -E -K -m -b -t -B -T -l -o -O' -- "$cur" ) )
+ return 0
+ fi
+
+ # Find out command and subcommand
+
+ local cmds=( raw i2c spd lan chassis power event mc sdr sensor fru gendev
+ sel pef sol tsol isol user channel session sunoem kontronoem picmg fwum
+ firewall shell exec set hpm ekanalyzer)
+ local i c cmd subcmd
+ for (( i=1; i < ${#COMP_WORDS[@]}-1; i++ )); do
+ [[ -n $cmd ]] && subcmd=${COMP_WORDS[i]} && break
+ for c in ${cmds[@]}; do
+ [ ${COMP_WORDS[i]} = $c ] && cmd=$c && break
+ done
+ done
+
+ if [ -z "$cmd" ]; then
+ COMPREPLY=( $( compgen -W '${cmds[@]}' -- "$cur" ) )
+ return 0
+ fi
+
+ # Command/subcommand completions
+
+ case $cmd in
+
+ shell)
+ ;;
+
+ exec)
+ _filedir
+ ;;
+
+ chassis|power|kontronoem|fwum)
+ _ipmitool_singleline_help $1 $cmd
+ ;;
+
+ lan)
+ case $subcmd in
+ print|set)
+ ;;
+ alert)
+ [ "$prev" = alert ] && \
+ COMPREPLY=( $( compgen -W 'print set' -- "$cur" ) )
+ ;;
+ stats)
+ [ "$prev" = stats ] && \
+ COMPREPLY=( $( compgen -W 'print set' -- "$cur" ) )
+ ;;
+ *)
+ COMPREPLY=( $( compgen -W 'print set alert stats' \
+ -- "$cur" ) )
+ ;;
+ esac
+ ;;
+
+ sdr)
+ case $subcmd in
+ get|info|type|list|entity)
+ ;;
+ elist)
+ COMPREPLY=( $( compgen -W 'all full compact event mclog fru
+ generic' -- "$cur" ) )
+ ;;
+ dump)
+ _filedir
+ ;;
+ fill)
+ case $prev in
+ fill)
+ COMPREPLY=( $( compgen -W 'sensors file' \
+ -- "$cur" ) )
+ ;;
+ file)
+ _filedir
+ ;;
+ esac
+ ;;
+ *)
+ COMPREPLY=( $( compgen -W 'get info type list elist entity
+ dump fill' -- "$cur" ) )
+ ;;
+ esac
+ ;;
+
+ sensor)
+ case $subcmd in
+ list|get|thresh)
+ ;;
+ *)
+ COMPREPLY=( $( compgen -W 'list get thresh' -- "$cur" ) )
+ ;;
+ esac
+ ;;
+
+ sel)
+ case $subcmd in
+ info|clear|list|elist|delete)
+ ;;
+ add|save|writeraw|readraw)
+ _filedir
+ ;;
+ time)
+ [ "$prev" = time ] && \
+ COMPREPLY=( $( compgen -W 'get set' -- "$cur" ) )
+ ;;
+ *)
+ COMPREPLY=( $( compgen -W 'info clear list elist delete add
+ get save writeraw readraw time' -- "$cur" ) )
+ ;;
+ esac
+ ;;
+
+ user)
+ case $subcmd in
+ summary|list|disable|enable|priv|test)
+ ;;
+ set)
+ [ "$prev" = set ] && \
+ COMPREPLY=( $( compgen -W 'name password' -- "$cur" ) )
+ ;;
+ *)
+ COMPREPLY=( $( compgen -W 'summary list set disable enable
+ priv test' -- "$cur" ) )
+ ;;
+ esac
+ ;;
+
+ set)
+ [ "$prev" = set ] && \
+ COMPREPLY=( $( compgen -W 'hostname username password privlvl
+ authtype localaddr targetaddr port csv verbose' \
+ -- "$cur" ) )
+ ;;
+
+ esac
+}
+
+} &&
+complete -F _ipmitool ipmitool
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/iproute2 b/completions/iproute2
new file mode 100644
index 00000000..f5d7bbd9
--- /dev/null
+++ b/completions/iproute2
@@ -0,0 +1,285 @@
+# iproute2 tools completion
+
+have ip &&
+_ip()
+{
+ COMPREPLY=()
+ local cur prev words cword
+ _get_comp_words_by_ref cur prev words cword
+
+ case $prev in
+ -V|-Version|-rc|-rcvbuf)
+ return 0
+ ;;
+ -f|-family)
+ COMPREPLY=( $( compgen -W 'inet inet6 ipx dnet link' -- "$cur" ) )
+ return 0
+ ;;
+ -b|-batch)
+ _filedir
+ return 0
+ ;;
+ -force)
+ COMPREPLY=( $( compgen -W '-batch' -- "$cur" ) )
+ return 0
+ ;;
+ esac
+
+ local subcword cmd subcmd
+ for (( subcword=1; subcword < ${#words[@]}-1; subcword++ )); do
+ [[ ${words[subcword]} == -b?(atch) ]] && return 0
+ [[ -n $cmd ]] && subcmd=${words[subcword]} && break
+ [[ ${words[subcword]} != -* && \
+ ${words[subcword-1]} != -@(f?(amily)|rc?(vbuf)) ]] && \
+ cmd=${words[subcword]}
+ done
+
+ if [[ -z $cmd ]]; then
+ case $cur in
+ -*)
+ local c="-Version -statistics -details -resolve -family
+ -oneline -timestamp -batch -rcvbuf"
+ [[ $cword -eq 1 ]] && c="$c -force"
+ COMPREPLY=( $( compgen -W "$c" -- "$cur" ) )
+ return 0
+ ;;
+ *)
+ COMPREPLY=( $( compgen -W "help $( ip help 2>&1 | \
+ sed -e '/OBJECT := /,/}/!d' \
+ -e 's/.*{//' -e 's/}.*//' -e 's/|//g' )" -- "$cur" ) )
+ return 0
+ ;;
+ esac
+ fi
+
+ [[ $subcmd == help ]] && return 0
+
+ case $cmd in
+ link)
+ case $subcmd in
+ add)
+ # TODO
+ ;;
+ delete)
+ case $(($cword-$subcword)) in
+ 1)
+ _available_interfaces
+ ;;
+ 2)
+ COMPREPLY=( $( compgen -W 'type' -- "$cur" ) )
+ ;;
+ 3)
+ [[ $prev == type ]] && \
+ COMPREPLY=( $( compgen -W 'vlan veth vcan dummy
+ ifb macvlan can' -- "$cur" ) )
+ ;;
+ esac
+ ;;
+ set)
+ if [[ $cword-$subcword -eq 1 ]]; then
+ _available_interfaces
+ else
+ case $prev in
+ arp|dynamic|multicast|allmulticast|promisc|\
+ trailers)
+ COMPREPLY=( $( compgen -W 'on off' \
+ -- "$cur" ) )
+ ;;
+ txqueuelen|name|address|broadcast|mtu|netns|alias)
+ ;;
+ *)
+ local c="arp dynamic multicast allmulticast
+ promisc trailers txqueuelen name address
+ broadcast mtu netns alias"
+ [[ $prev != @(up|down) ]] && c="$c up down"
+ COMPREPLY=( $( compgen -W "$c" -- "$cur" ) )
+ ;;
+ esac
+ fi
+ ;;
+ show)
+ [[ $cword -eq $subcword+1 ]] && _available_interfaces
+ ;;
+ *)
+ [[ $cword -eq $subcword ]] && \
+ COMPREPLY=( $( compgen -W 'help add delete set show' \
+ -- "$cur" ) )
+ ;;
+ esac
+ ;;
+
+ addr)
+ case $subcmd in
+ add|change|replace)
+ # TODO
+ ;;
+ del)
+ # TODO
+ ;;
+ show|flush)
+ # TODO
+ ;;
+ *)
+ [[ $cword -eq $subcword ]] && \
+ COMPREPLY=( $( compgen -W 'help add change replace del
+ show flush' -- "$cur" ) )
+ ;;
+ esac
+ ;;
+
+ addrlabel)
+ case $subcmd in
+ list|add|del|flush)
+ # TODO
+ ;;
+ *)
+ [[ $cword -eq $subcword ]] && \
+ COMPREPLY=( $( compgen -W 'help list add del flush' \
+ -- "$cur" ) )
+ ;;
+ esac
+ ;;
+
+ route)
+ case $subcmd in
+ list|flush)
+ # TODO
+ ;;
+ get)
+ # TODO
+ ;;
+ add|del|change|append|replace|monitor)
+ # TODO
+ ;;
+ *)
+ [[ $cword -eq $subcword ]] && \
+ COMPREPLY=( $( compgen -W 'help list flush get add del
+ change append replace monitor' -- "$cur" ) )
+ ;;
+ esac
+ ;;
+
+ rule)
+ case $subcmd in
+ list|add|del|flush)
+ # TODO
+ ;;
+ *)
+ [[ $cword -eq $subcword ]] && \
+ COMPREPLY=( $( compgen -W 'help list add del flush' \
+ -- "$cur" ) )
+ ;;
+ esac
+ ;;
+
+ neigh)
+ case $subcmd in
+ add|del|change|replace)
+ # TODO
+ ;;
+ show|flush)
+ # TODO
+ ;;
+ *)
+ [[ $cword -eq $subcword ]] && \
+ COMPREPLY=( $( compgen -W 'help add del change replace
+ show flush' -- "$cur" ) )
+ ;;
+ esac
+ ;;
+
+ ntable)
+ case $subcmd in
+ change)
+ # TODO
+ ;;
+ show)
+ # TODO
+ ;;
+ *)
+ [[ $cword -eq $subcword ]] && \
+ COMPREPLY=( $( compgen -W 'help change show' \
+ -- "$cur" ) )
+ ;;
+ esac
+ ;;
+
+ tunnel)
+ case $subcmd in
+ add|change|del|show|prl|6rd)
+ # TODO
+ ;;
+ *)
+ [[ $cword -eq $subcword ]] && \
+ COMPREPLY=( $( compgen -W 'help add change del show prl
+ 6rd' -- "$cur" ) )
+ ;;
+ esac
+ ;;
+
+ maddr)
+ case $subcmd in
+ add|del)
+ # TODO
+ ;;
+ show)
+ if [[ $cword -eq $subcword+1 || $prev == dev ]]; then
+ _available_interfaces
+ [[ $prev != dev ]] && \
+ COMPREPLY=( $( compgen -W '${COMPREPLY[@]} dev' \
+ -- "$cur" ) )
+ fi
+ ;;
+ *)
+ [[ $cword -eq $subcword ]] && \
+ COMPREPLY=( $( compgen -W 'help add del show' \
+ -- "$cur" ) )
+ ;;
+ esac
+ ;;
+
+ mroute)
+ case $subcmd in
+ show)
+ # TODO
+ ;;
+ *)
+ [[ $cword -eq $subcword ]] && \
+ COMPREPLY=( $( compgen -W 'help show' -- "$cur" ) )
+ ;;
+ esac
+ ;;
+
+ monitor)
+ case $subcmd in
+ all) ;;
+ *)
+ [[ $cword -eq $subcword ]] && \
+ COMPREPLY=( $( compgen -W 'help all' -- "$cur" ) )
+ ;;
+ esac
+ ;;
+
+ xfrm)
+ case $subcmd in
+ state|policy|monitor)
+ # TODO
+ ;;
+ *)
+ [[ $cword -eq $subcword ]] && \
+ COMPREPLY=( $( compgen -W 'state policy monitor' \
+ -- "$cur" ) )
+ ;;
+ esac
+ ;;
+ esac
+} &&
+complete -F _ip ip
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/ipsec b/completions/ipsec
index acb8c995..acb8c995 100644
--- a/contrib/ipsec
+++ b/completions/ipsec
diff --git a/contrib/iptables b/completions/iptables
index bd0e4622..bd0e4622 100644
--- a/contrib/iptables
+++ b/completions/iptables
diff --git a/contrib/ipv6calc b/completions/ipv6calc
index 75f55e74..20e810df 100644
--- a/contrib/ipv6calc
+++ b/completions/ipv6calc
@@ -46,7 +46,7 @@ _ipv6calc()
return 0
} &&
-complete -F _ipv6calc -o filenames ipv6calc
+complete -F _ipv6calc ipv6calc
# Local variables:
# mode: shell-script
diff --git a/contrib/isql b/completions/isql
index f0ddbd75..f0ddbd75 100644
--- a/contrib/isql
+++ b/completions/isql
diff --git a/contrib/jar b/completions/jar
index 75dcaf3e..d703019d 100644
--- a/contrib/jar
+++ b/completions/jar
@@ -18,14 +18,14 @@ _jar()
_filedir
;;
*f)
- _filedir '?([ejw]ar|zip|[EJW]AR|ZIP)'
+ _filedir '@([ejw]ar|zip|apk)'
;;
*)
_filedir
;;
esac
} &&
-complete -F _jar -o filenames jar
+complete -F _jar jar
# Local variables:
# mode: shell-script
diff --git a/contrib/java b/completions/java
index 76d2cd4e..8365a314 100644
--- a/contrib/java
+++ b/completions/java
@@ -118,13 +118,13 @@ _java_packages()
#
_java()
{
- local cur prev i
+ local cur prev words cword i
COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ _get_comp_words_by_ref -n : cur prev words cword
- for ((i=1; i < $COMP_CWORD; i++)); do
- case ${COMP_WORDS[$i]} in
+ for ((i=1; i < $cword; i++)); do
+ case ${words[$i]} in
-cp|-classpath)
((i++)) # skip the classpath string.
;;
@@ -139,6 +139,70 @@ _java()
esac
done
+ case $cur in
+ # standard option completions
+ -verbose:*)
+ COMPREPLY=( $( compgen -W 'class gc jni' -- "${cur#*:}" ) )
+ return 0
+ ;;
+ -javaagent:*)
+ cur=${cur#*:}
+ _filedir '@(jar|zip)'
+ return 0
+ ;;
+ -agentpath:*)
+ cur=${cur#*:}
+ _filedir so
+ return 0
+ ;;
+ # various non-standard option completions
+ -splash:*)
+ cur=${cur#*:}
+ _filedir '@(gif|jp?(e)g|png)'
+ return 0
+ ;;
+ -Xbootclasspath*:*)
+ _java_path
+ return 0
+ ;;
+ -Xcheck:*)
+ COMPREPLY=( $( compgen -W 'jni' -- "${cur#*:}" ) )
+ return 0
+ ;;
+ -Xgc:*)
+ COMPREPLY=( $( compgen -W 'singlecon gencon singlepar genpar' \
+ -- "${cur#*:}" ) )
+ return 0
+ ;;
+ -Xgcprio:*)
+ COMPREPLY=( $( compgen -W 'throughput pausetime deterministic' \
+ -- "${cur#*:}" ) )
+ return 0
+ ;;
+ -Xloggc:*|-Xverboselog:*)
+ cur=${cur#*:}
+ _filedir
+ return 0
+ ;;
+ -Xshare:*)
+ COMPREPLY=( $( compgen -W 'auto off on' -- "${cur#*:}" ) )
+ return 0
+ ;;
+ -Xverbose:*)
+ COMPREPLY=( $( compgen -W 'memory load jni cpuinfo codegen opt
+ gcpause gcreport' -- "${cur#*:}" ) )
+ return 0
+ ;;
+ -Xverify:*)
+ COMPREPLY=( $( compgen -W 'all none remote' -- "${cur#*:}" ) )
+ return 0
+ ;;
+ # the rest that we have no completions for
+ -D*|-*:*)
+ return 0
+ ;;
+ esac
+
case $prev in
-cp|-classpath)
_java_path
@@ -147,13 +211,11 @@ _java()
esac
if [[ "$cur" == -* ]]; then
- # relevant options completion
- COMPREPLY=( $( compgen -W '-client -hotspot -server -classic \
- -classpath -D -verbose -verbose:class \
- -verbose:gc -version:jni -version \
- -showversion -help -X -jar \
- -enableassertions -disableassertions \
- -enablesystemassertions -disablesystemassertions ' -- "$cur" ) )
+ # standard options
+ COMPREPLY=( $( compgen -W '-client -server -agentlib: -agentpath:
+ -classpath -D -d32 -d64 -enableassertions -disableassertions
+ -enablesystemassertions -disablesystemassertions -jar -javaagent:
+ -verbose -verbose -version -showversion -help -X' -- "$cur" ) )
else
if [[ "$prev" == -jar ]]; then
# jar file completion
@@ -163,8 +225,13 @@ _java()
_java_classes
fi
fi
+
+ [[ ${#COMPREPLY[@]} -eq 1 && ${COMPREPLY[0]} == -*[:=] ]] && \
+ type compopt &>/dev/null && compopt -o nospace
+
+ __ltrim_colon_completions "$cur"
}
-complete -F _java -o filenames java
+complete -F _java java
}
have javadoc &&
@@ -176,11 +243,16 @@ _javadoc()
_get_comp_words_by_ref cur prev
case $prev in
- -overview|-helpfile|-stylesheetfile)
- _filedir
+ -overview|-helpfile)
+ _filedir '?(x)htm?(l)'
return 0
;;
- -d)
+ -stylesheetfile)
+ _filedir css
+ return 0
+ ;;
+ -d|-link|-linkoffline)
+ # TODO: -linkoffline takes two arguments
_filedir -d
return 0
;;
@@ -212,7 +284,7 @@ _javadoc()
_java_packages
fi
} &&
-complete -F _javadoc -o filenames javadoc
+complete -F _javadoc javadoc
have javac &&
_javac()
@@ -244,7 +316,7 @@ _javac()
_filedir java
fi
} &&
-complete -F _javac -o filenames javac
+complete -F _javac javac
have pack200 &&
_pack200()
@@ -413,7 +485,7 @@ _jarsigner()
_filedir jar
fi
} &&
-complete -F _jarsigner -o filenames jarsigner
+complete -F _jarsigner jarsigner
# Local variables:
# mode: shell-script
diff --git a/contrib/k3b b/completions/k3b
index a2b0af6b..1965717b 100644
--- a/contrib/k3b
+++ b/completions/k3b
@@ -44,7 +44,7 @@ _k3b()
_filedir
fi
} &&
-complete -F _k3b -o filenames k3b
+complete -F _k3b k3b
# Local variables:
# mode: shell-script
diff --git a/contrib/kldload b/completions/kldload
index a230dbb5..e5bce0a3 100644
--- a/contrib/kldload
+++ b/completions/kldload
@@ -11,13 +11,14 @@ _kldload()
[ -d $moddir ] || moddir=/boot/kernel/
_get_comp_words_by_ref cur
+ _compopt_o_filenames
COMPREPLY=( $( compgen -f "$moddir$cur" ) )
COMPREPLY=( ${COMPREPLY[@]#$moddir} )
COMPREPLY=( ${COMPREPLY[@]%.ko} )
return 0
}
-complete -F _kldload -o filenames kldload
+complete -F _kldload kldload
_kldunload()
{
@@ -26,7 +27,7 @@ _kldunload()
COMPREPLY=( $( kldstat | \
sed -ne "s/^.*[ \t]\{1,\}\($cur[a-z_]\{1,\}\).ko$/\1/p" ) )
}
-complete -F _kldunload -o filenames kldunload
+complete -F _kldunload kldunload
}
diff --git a/contrib/larch b/completions/larch
index e58374f7..e58374f7 100644
--- a/contrib/larch
+++ b/completions/larch
diff --git a/contrib/ldapvi b/completions/ldapvi
index 31e26d1c..31e26d1c 100644
--- a/contrib/ldapvi
+++ b/completions/ldapvi
diff --git a/contrib/lftp b/completions/lftp
index 15d0a977..1de87aec 100644
--- a/contrib/lftp
+++ b/completions/lftp
@@ -28,7 +28,8 @@ _lftp()
'$( cut -f 1 -s ~/.lftp/bookmarks 2>/dev/null )' -- "$cur" ) )
_known_hosts_real "$cur"
} &&
-complete -F _lftp -o filenames lftp
+complete -F _lftp lftp
+
have lftpget &&
_lftpget()
{
diff --git a/contrib/lilo b/completions/lilo
index ab0d9dc3..ab0d9dc3 100644
--- a/contrib/lilo
+++ b/completions/lilo
diff --git a/contrib/links b/completions/links
index 4b5c683a..9b7b50f0 100644
--- a/contrib/links
+++ b/completions/links
@@ -32,7 +32,7 @@ _links()
return 0
} &&
-complete -F _links -o filenames links
+complete -F _links links
# Local variables:
# mode: shell-script
diff --git a/contrib/lintian b/completions/lintian
index a1f51546..e2237893 100644
--- a/contrib/lintian
+++ b/completions/lintian
@@ -181,6 +181,6 @@ _lintian_info() {
return 0
}
-complete -F _lintian -o filenames lintian
-complete -F _lintian_info -o filenames lintian-info
+complete -F _lintian lintian
+complete -F _lintian_info lintian-info
}
diff --git a/contrib/lisp b/completions/lisp
index ee43a019..ee43a019 100644
--- a/contrib/lisp
+++ b/completions/lisp
diff --git a/completions/lrzip b/completions/lrzip
new file mode 100644
index 00000000..5cde88a8
--- /dev/null
+++ b/completions/lrzip
@@ -0,0 +1,64 @@
+# lrzip(1) completion
+
+have lrzip &&
+_lrzip()
+{
+ COMPREPLY=()
+ local cur prev
+ _get_comp_words_by_ref cur prev
+
+ if [[ "$cur" == -* && $prev != -N ]]; then
+ COMPREPLY=( $( compgen -W '-w -d -o -O -S -f -D -q -L -n -l -b -g -M \
+ -T -N -v -vv -V -h' -- "$cur" ) )
+ return 0
+ fi
+
+ local xspec="*.lrz"
+
+ case $prev in
+ -w|-S|-V|-h)
+ return 0
+ ;;
+ -d)
+ xspec="!"$xspec
+ ;;
+ -o)
+ _filedir
+ return 0
+ ;;
+ -O)
+ _filedir -d
+ return 0
+ ;;
+ -L)
+ COMPREPLY=( $( compgen -W '1 2 3 4 5 6 7 8 9' -- "$cur" ) )
+ return 0
+ ;;
+ -T)
+ COMPREPLY=( $( compgen -W '1 2 3 4 5 6 7 8 9 10' -- "$cur" ) )
+ return 0
+ ;;
+ -N)
+ COMPREPLY=( $( compgen -W '-20 -19 -18 -17 -16 -15 -14 -13 -12 \
+ -11 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 8 9 10 11 \
+ 12 13 14 15 16 17 18 19' -- "$cur" ) )
+ return 0
+ ;;
+ esac
+
+ _expand || return 0
+
+ local IFS=$'\n'
+ _compopt_o_filenames
+ COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \
+ $( compgen -d -- "$cur" ) )
+} &&
+complete -F _lrzip lrzip
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/lsof b/completions/lsof
new file mode 100644
index 00000000..ac010dad
--- /dev/null
+++ b/completions/lsof
@@ -0,0 +1,64 @@
+# lsof(8) completion
+
+have lsof &&
+_lsof()
+{
+ COMPREPLY=()
+ local cur prev
+ _get_comp_words_by_ref cur prev
+
+ case $prev in
+ -'?'|-h|+c|-c|-d|-F|-i|+r|-r|-s|-S|-T)
+ return 0
+ ;;
+ -A|-k|-m|+m|-o)
+ _filedir
+ return 0
+ ;;
+ +d|+D)
+ _filedir -d
+ return 0
+ ;;
+ -D)
+ COMPREPLY=( $( compgen -W '? b i r u' -- "$cur" ) )
+ return 0
+ ;;
+ -f)
+ COMPREPLY=( $( compgen -W 'c f g G n' -- "$cur" ) )
+ return 0
+ ;;
+ -g)
+ # TODO: handle ^foo exclusions, comma separated lists
+ _pgids
+ return 0
+ ;;
+ -p)
+ # TODO: handle ^foo exclusions, comma separated lists
+ _pids
+ return 0
+ ;;
+ -u)
+ # TODO: handle ^foo exclusions, comma separated lists
+ COMPREPLY=( $( compgen -u -- "$cur" ) )
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == [-+]* ]]; then
+ COMPREPLY=( $( compgen -W '-h -a -A -b -c +c -C +d -d +D -D +f -f -F -g
+ -i -k -l +L -L +m -m +M -M -n -N -o -O -p -P +r -r -R -s -S -T -t
+ -u -U -v -V +w -w -x -X -z -Z' -- "$cur" ) )
+ return 0
+ fi
+
+ _filedir
+} &&
+complete -F _lsof lsof
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/lvm b/completions/lvm
index f4d3b77d..f4d3b77d 100644
--- a/contrib/lvm
+++ b/completions/lvm
diff --git a/contrib/lzma b/completions/lzma
index a176f191..295ef37b 100644
--- a/contrib/lzma
+++ b/completions/lzma
@@ -16,7 +16,7 @@ _lzma()
return 0
fi
- local IFS=$'\t\n'
+ local IFS=$'\n'
xspec="*.@(lzma|tlz)"
if [[ "$prev" == --* ]]; then
@@ -31,10 +31,11 @@ _lzma()
_expand || return 0
+ _compopt_o_filenames
COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \
$( compgen -d -- "$cur" ) )
} &&
-complete -F _lzma -o filenames lzma
+complete -F _lzma lzma
# Local variables:
# mode: shell-script
diff --git a/contrib/lzop b/completions/lzop
index 19852b24..6d384128 100644
--- a/contrib/lzop
+++ b/completions/lzop
@@ -53,11 +53,12 @@ _lzop()
_expand || return 0
- local IFS=$'\t\n'
+ local IFS=$'\n'
+ _compopt_o_filenames
COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \
$( compgen -d -- "$cur" ) )
} &&
-complete -F _lzop -o filenames lzop
+complete -F _lzop lzop
# Local variables:
# mode: shell-script
diff --git a/contrib/mailman b/completions/mailman
index 33227897..b239cbbf 100644
--- a/contrib/mailman
+++ b/completions/mailman
@@ -368,7 +368,7 @@ _config_list()
fi
} &&
-complete -F _config_list -o filenames config_list
+complete -F _config_list config_list
# Try to detect whether this is the mailman "arch" to avoid installing
# it for the coreutils/util-linux-ng one.
@@ -416,7 +416,7 @@ _arch()
fi
} &&
-complete -F _arch -o filenames arch
+complete -F _arch arch
have cleanarch &&
_cleanarch()
@@ -460,7 +460,7 @@ _inject()
fi
} &&
-complete -F _inject -o filenames inject
+complete -F _inject inject
have dumpdb &&
_dumpdb()
@@ -478,7 +478,7 @@ _dumpdb()
fi
} &&
-complete -F _dumpdb -o filenames dumpdb
+complete -F _dumpdb dumpdb
have check_db &&
_check_db()
diff --git a/contrib/make b/completions/make
index e792b348..76e95284 100644
--- a/contrib/make
+++ b/completions/make
@@ -67,7 +67,7 @@ _make()
fi
} &&
-complete -F _make -o filenames make gmake gnumake pmake
+complete -F _make make gmake gnumake pmake
# Local variables:
# mode: shell-script
diff --git a/contrib/man b/completions/man
index a3360b2e..9e5cd3a8 100644
--- a/contrib/man
+++ b/completions/man
@@ -11,7 +11,7 @@ _man()
mansect="@([0-9lnp]|[0-9][px]|3pm)"
COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ _get_comp_words_by_ref -n : cur prev
if [[ "$prev" == -l ]]; then
_filedir $manext
@@ -66,12 +66,10 @@ _man()
done
fi
+ __ltrim_colon_completions "$cur"
return 0
-}
-[ $USERLAND = GNU -o $UNAME = Darwin \
- -o $UNAME = FreeBSD -o $UNAME = SunOS -o $UNAME = Cygwin \
- -o $UNAME = OpenBSD ] && \
-complete -F _man -o filenames man apropos whatis
+} &&
+complete -F _man man apropos whatis
# Local variables:
# mode: shell-script
diff --git a/contrib/mc b/completions/mc
index 910fef13..09e9eabe 100644
--- a/contrib/mc
+++ b/completions/mc
@@ -36,7 +36,7 @@ _mc()
_filedir -d
fi
} &&
-complete -F _mc -o filenames mc
+complete -F _mc mc
# Local variables:
# mode: shell-script
diff --git a/contrib/mcrypt b/completions/mcrypt
index e777150f..32c4f89f 100644
--- a/contrib/mcrypt
+++ b/completions/mcrypt
@@ -58,12 +58,12 @@ _mcrypt()
--list-hash --verbose --quiet --help \
--version --license' -- "$cur" ) )
elif [[ ${COMP_WORDS[0]} == mdecrypt ]]; then
- _filedir '@(nc)'
+ _filedir nc
else
decrypt=0
for (( i=1; i < ${#COMP_WORDS[@]}-1; i++ )); do
if [[ ${COMP_WORDS[i]} == -@(d|-decrypt) ]]; then
- _filedir '@(nc)'
+ _filedir nc
decrypt=1
break
fi
@@ -73,7 +73,7 @@ _mcrypt()
fi
fi
} &&
-complete -o filenames -F _mcrypt mcrypt mdecrypt
+complete -F _mcrypt mcrypt mdecrypt
# Local variables:
# mode: shell-script
diff --git a/contrib/mdadm b/completions/mdadm
index 9cbaad7b..9cbaad7b 100644
--- a/contrib/mdadm
+++ b/completions/mdadm
diff --git a/contrib/medusa b/completions/medusa
index d8dcfe41..d8dcfe41 100644
--- a/contrib/medusa
+++ b/completions/medusa
diff --git a/contrib/minicom b/completions/minicom
index 76553317..76553317 100644
--- a/contrib/minicom
+++ b/completions/minicom
diff --git a/contrib/mkinitrd b/completions/mkinitrd
index 48893471..48893471 100644
--- a/contrib/mkinitrd
+++ b/completions/mkinitrd
diff --git a/contrib/module-init-tools b/completions/module-init-tools
index 8c0f13ea..bf2d24d1 100644
--- a/contrib/module-init-tools
+++ b/completions/module-init-tools
@@ -50,7 +50,7 @@ _insmod()
return 0
} &&
-complete -F _insmod -o filenames insmod modprobe modinfo
+complete -F _insmod insmod modprobe modinfo
# Local variables:
# mode: shell-script
diff --git a/contrib/monodevelop b/completions/monodevelop
index 1aa117b0..69b23445 100644
--- a/contrib/monodevelop
+++ b/completions/monodevelop
@@ -50,6 +50,7 @@ _mdtool()
return 0
;;
"generate-makefiles")
+ _compopt_o_filenames
COMPREPLY=( $( compgen -o filenames -G"*.mds" -- "$cur" ) )
if [[ "$prev" == *mds ]]; then
COMPREPLY=( $( compgen -W '--simple-makefiles --s --d:' \
@@ -74,7 +75,7 @@ _mdtool()
return 0
} &&
-complete -F _mdtool -o filenames mdtool
+complete -F _mdtool mdtool
# Local variables:
# mode: shell-script
diff --git a/contrib/mount b/completions/mount
index b14eef3e..b14eef3e 100644
--- a/contrib/mount
+++ b/completions/mount
diff --git a/contrib/mplayer b/completions/mplayer
index 63af3122..de1aea51 100644
--- a/contrib/mplayer
+++ b/completions/mplayer
@@ -4,39 +4,51 @@ have mplayer && {
_mplayer_options_list()
{
cur=${cur%\\}
- COMPREPLY=( $( compgen -W "$( $1 $2 help 2>/dev/null | \
- sed -e '1,/^Available/d' | awk '{print $1}' | \
+ COMPREPLY=( $( compgen -W "$( $1 -nomsgcolor -nomsgmodule $2 help 2>/dev/null | \
+ sed -e '/^Available/,/^$/!d' -e '/^Available/d' | awk '{print $1}' | \
sed -e 's/:$//' -e 's/^'${2#-}'$//' -e 's/<.*//' )" -- "$cur" ) )
}
_mplayer()
{
- local cmd cur prev skinsdir IFS=$' \t\n' i j k=0
+ local cmd cur prev i j k=0
COMPREPLY=()
cmd=${COMP_WORDS[0]}
_get_comp_words_by_ref cur prev
case $prev in
- -[av][cfo]|-[av]fm|-vop|-fstype|-demuxer|-o[av]c|-of|-profile)
+ -[av][cfo]|-[av]fm|-vop|-fstype|-demuxer|-o[av]c|-of|-profile| \
+ -audio-demuxer|-sub-demuxer)
_mplayer_options_list $cmd $prev
return 0
;;
+ -show-profile)
+ _mplayer_options_list $cmd -profile
+ return 0
+ ;;
-audiofile)
- _filedir '@(mp3|MP3|mpg|MPG|ogg|OGG|w?(a)v|W?(A)V|mid|MID|flac|FLAC|mka|MKA|ape|APE)'
+ _filedir '@(mp3|mpg|ogg|w?(a)v|mid|flac|mka|ape)'
return 0
;;
- -font)
- _filedir '@(desc|ttf)'
+ -font|-subfont)
+ if [ "$prev" = -font ]; then
+ _filedir '@(desc|ttf)'
+ else
+ _filedir ttf
+ fi
+ local IFS=$'\n'
+ COMPREPLY=( "${COMPREPLY[@]}"
+ $( compgen -W '$( fc-list 2>/dev/null )' -- "$cur" ) )
return 0
;;
-sub)
- _filedir '@(srt|SRT|sub|SUB|txt|TXT|utf|UTF|rar|RAR|mpsub|smi|js|ssa|SSA|ass|ASS)'
+ _filedir '@(srt|sub|txt|utf|rar|mpsub|smi|js|ssa|ass)'
return 0
;;
-vobsub)
- _filedir '@(idx|IDX|ifo|IFO|sub|SUB)'
- IFS=$'\t\n'
+ _filedir '@(idx|ifo|sub)'
+ local IFS=$'\n'
COMPREPLY=( $( for i in "${COMPREPLY[@]}"; do
if [[ -f $i && -r $i ]]; then
printf '%s\n' ${i%.*}
@@ -44,28 +56,28 @@ _mplayer()
printf '%s\n' $i
fi
done ) )
- IFS=$' \t\n'
return 0
;;
-ifo)
- _filedir '@(ifo|IFO)'
+ _filedir ifo
return 0
;;
-cuefile)
- _filedir '@(bin|BIN|cue|CUE)'
+ _filedir '@(bin|cue)'
return 0
;;
-skin)
# if you don't have installed mplayer in /usr you
# may want to set the MPLAYER_SKINS_DIR global variable
+ local -a dirs
if [ -n "$MPLAYER_SKINS_DIR" ]; then
- skinsdir=$MPLAYER_SKINS_DIR
+ dirs=($MPLAYER_SKINS_DIR)
else
- skinsdir=/usr/share/mplayer/Skin
+ dirs=(/usr/share/mplayer/skins /usr/local/share/mplayer/skins)
fi
- IFS=$'\t\n'
- for i in ~/.mplayer/Skin $skinsdir; do
+ local IFS=$'\n'
+ for i in ~/.mplayer/skins ${dirs[@]}; do
if [[ -d $i && -r $i ]]; then
for j in $( compgen -d $i/$cur ); do
COMPREPLY[$k]=${j#$i/}
@@ -73,7 +85,6 @@ _mplayer()
done
fi
done
- IFS=$' \t\n'
return 0
;;
-cdrom-device)
@@ -82,7 +93,7 @@ _mplayer()
return 0
;;
-dvd-device)
- _dvd_devices
+ _filedir
return 0
;;
-mixer|-dvdauth|-fb|-zrdev)
@@ -97,7 +108,7 @@ _mplayer()
return 0
;;
-autoq|-autosync|-loop|-menu-root|-speed|-sstep|-aid|-alang| \
- -audo-demuxer|-sub-demuxer|-demuxer|-bandwidth|-cache|-chapter| \
+ -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| \
@@ -115,7 +126,7 @@ _mplayer()
return 0
;;
-lavdopts)
- COMPREPLY=( $( compgen -W 'ec er= bug= idct= gray' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W 'bitexact bug= debug= ec= er= fast gray idct= lowres= sb= st= skiploopfilter= skipidct= skipframe= threads= vismv= vstats' -- "$cur" ) )
return 0
;;
-lavcopts)
@@ -230,19 +241,19 @@ _mplayer()
case $cur in
-*)
- COMPREPLY=( $( compgen -W '$( $cmd -list-options 2>/dev/null | \
+ COMPREPLY=( $( compgen -W '$( $cmd -nomsgcolor -nomsgmodule -list-options 2>/dev/null | \
sed -ne '1,/^[[:space:]]*Name/d' \
-e "s/^[[:space:]]*/-/" -e "s/[[:space:]:].*//" \
-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]|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)'
+ _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]|3gpp?(2)|mpc|MPC|flac|FLAC|vro|VRO|divx|DIVX|aif?(f)|AIF?(F)|m2t?(s)|M2T?(S)|vdr|VDR|xvid|XVID|ape|APE|gif|GIF|nut|NUT|bik|BIK|webm|WEBM|amr|AMR|awb|AWB|iso|ISO)?(.part)'
;;
esac
return 0
}
-complete -o filenames -F _mplayer mplayer mencoder gmplayer kplayer
+complete -F _mplayer mplayer mencoder gmplayer kplayer
}
# Local variables:
diff --git a/contrib/msynctool b/completions/msynctool
index 3f9afb7f..3f9afb7f 100644
--- a/contrib/msynctool
+++ b/completions/msynctool
diff --git a/contrib/mtx b/completions/mtx
index 0454f032..0454f032 100644
--- a/contrib/mtx
+++ b/completions/mtx
diff --git a/contrib/munin-node b/completions/munin-node
index abf2b0f6..abf2b0f6 100644
--- a/contrib/munin-node
+++ b/completions/munin-node
diff --git a/contrib/mutt b/completions/mutt
index fc12e690..a753a652 100644
--- a/contrib/mutt
+++ b/completions/mutt
@@ -58,7 +58,7 @@ _muttconffiles()
while [[ "$1" ]]; do
newconffiles=( $(sed -n 's|^source[[:space:]]\{1,\}\([^[:space:]]\{1,\}\).*$|\1|p' $(eval echo $1) ) )
for file in "${newconffiles[@]}"; do
- [[ ! "$file" ]] || [[ "${sofar/ ${file} / }" != "$sofar" ]] &&
+ [[ ! -f "$file" || "${sofar/ ${file} / }" != "$sofar" ]] &&
continue
sofar="$sofar $file"
sofar=" $(eval _muttconffiles \"$sofar\" $file) "
@@ -120,6 +120,7 @@ _muttfiledir()
# Match any file in $folder beginning with $cur
# (minus the leading '=' sign).
+ _compopt_o_filenames
COMPREPLY=( $( compgen -f -- "$folder/${cur:1}" ) )
COMPREPLY=( ${COMPREPLY[@]#$folder/} )
return 0
@@ -170,7 +171,7 @@ _mutt()
;;
esac
} # _mutt()
-complete -F _mutt -o default -o filenames mutt muttng
+complete -F _mutt -o default mutt muttng
} # have mutt
# Local variables:
diff --git a/contrib/mysqladmin b/completions/mysqladmin
index a7e002d3..c9415696 100644
--- a/contrib/mysqladmin
+++ b/completions/mysqladmin
@@ -60,7 +60,7 @@ _mysqladmin()
kill password old-password ping processlist reload refresh shutdown \
status start-slave stop-slave variables version' -- "$cur" ) )
} &&
-complete -F _mysqladmin -o filenames mysqladmin
+complete -F _mysqladmin mysqladmin
# Local variables:
# mode: shell-script
diff --git a/contrib/ncftp b/completions/ncftp
index b831f444..b831f444 100644
--- a/contrib/ncftp
+++ b/completions/ncftp
diff --git a/contrib/net-tools b/completions/net-tools
index 5b86a64a..e7de2b04 100644
--- a/contrib/net-tools
+++ b/completions/net-tools
@@ -96,6 +96,32 @@ _route()
} &&
complete -F _route route
+have ether-wake &&
+_ether_wake()
+{
+ COMPREPLY=()
+ local cur prev
+ _get_comp_words_by_ref -n : cur prev
+
+ case $prev in
+ -i)
+ _available_interfaces
+ return 0
+ ;;
+ -p)
+ return 0
+ ;;
+ esac
+
+ if [[ $cur == -* ]]; then
+ COMPREPLY=( $( compgen -W '-b -D -i -p -V' -- "$cur" ) )
+ return 0
+ fi
+
+ _mac_addresses
+} &&
+complete -F _ether_wake ether-wake
+
# Local variables:
# mode: shell-script
# sh-basic-offset: 4
diff --git a/contrib/nmap b/completions/nmap
index 19f0a07e..19f0a07e 100644
--- a/contrib/nmap
+++ b/completions/nmap
diff --git a/contrib/ntpdate b/completions/ntpdate
index bf004b55..bf004b55 100644
--- a/contrib/ntpdate
+++ b/completions/ntpdate
diff --git a/contrib/openldap b/completions/openldap
index e4bbba1f..e4bbba1f 100644
--- a/contrib/openldap
+++ b/completions/openldap
diff --git a/contrib/openssl b/completions/openssl
index 568f2dbf..568f2dbf 100644
--- a/contrib/openssl
+++ b/completions/openssl
diff --git a/contrib/p4 b/completions/p4
index 0795a28e..59b02c1d 100644
--- a/contrib/p4
+++ b/completions/p4
@@ -3,10 +3,10 @@
have p4 &&
_p4()
{
- local cur prev preprev p4commands p4filetypes
+ local cur prev words cword p4commands p4filetypes
COMPREPLY=()
- _get_comp_words_by_ref cur prev preprev
+ _get_comp_words_by_ref cur prev words cword
# rename isn't really a command
p4commands="$( p4 help commands | awk 'NF>3 {print $1}' )"
@@ -14,9 +14,9 @@ _p4()
uresource uxbinary xbinary xltext xtempobj xtext \
text binary resource"
- if [ $COMP_CWORD -eq 1 ]; then
+ if [ $cword -eq 1 ]; then
COMPREPLY=( $( compgen -W "$p4commands" -- "$cur" ) )
- elif [ $COMP_CWORD -eq 2 ]; then
+ elif [ $cword -eq 2 ]; then
case $prev in
help)
COMPREPLY=( $( compgen -W "simple commands \
@@ -29,10 +29,10 @@ _p4()
*)
;;
esac
- elif [ $COMP_CWORD -gt 2 ]; then
+ elif [ $cword -gt 2 ]; then
case $prev in
-t)
- case $preprev in
+ case ${words[$cword-2]} in
add|edit|reopen)
COMPREPLY=( $( compgen -W "$p4filetypes" -- "$cur") )
;;
diff --git a/completions/perl b/completions/perl
new file mode 100644
index 00000000..843e249b
--- /dev/null
+++ b/completions/perl
@@ -0,0 +1,131 @@
+# bash completion for perl
+
+have perl &&
+{
+_perlmodules()
+{
+ COMPREPLY=( $( compgen -P "$prefix" -W "$( $1 ${BASH_SOURCE[0]%/*}/helpers/perl modules $cur )" -- "$cur" ) )
+ __ltrim_colon_completions "$prefix$cur"
+}
+
+_perlfunctions()
+{
+ COMPREPLY=( $( compgen -P "$prefix" -W "$( ${BASH_SOURCE[0]%/*}/helpers/perl functions $cur )" -- "$cur" ) )
+}
+
+_perl()
+{
+ local cur prev prefix temp
+ local optPrefix optSuffix
+
+ COMPREPLY=()
+ _get_comp_words_by_ref -n : cur prev
+ prefix=""
+
+ # If option not followed by whitespace, reassign prev and cur
+ if [[ "$cur" == -?* ]]; then
+ temp=$cur
+ prev=${temp:0:2}
+ cur=${temp:2}
+ optPrefix=-P$prev
+ optSuffix=-S/
+ prefix=$prev
+ fi
+
+ case $prev in
+ -D|-e|-E|-i|-F|-l)
+ return 0
+ ;;
+ -I|-x)
+ local IFS=$'\n'
+ _compopt_o_filenames
+ COMPREPLY=( $( compgen -d $optPrefix $optSuffix -- "$cur" ) )
+ return 0
+ ;;
+ -m|-M)
+ temp="${cur#-}"
+ prefix="$prefix${cur%$temp}"
+ cur="$temp"
+ _perlmodules $1
+ return 0
+ ;;
+ -V)
+ if [[ $cur == :* ]]; then
+ temp="${cur##+(:)}"
+ prefix="$prefix${cur%$temp}"
+ local IFS=$'\n'
+ COMPREPLY=( $( compgen -P "$prefix" -W \
+ '$( $1 -MConfig -e "print join \"\\n\",
+ keys %Config::Config" 2>/dev/null )' -- "$temp" ) )
+ __ltrim_colon_completions "$prefix$temp"
+ fi
+ return 0
+ ;;
+ -d|-dt)
+ if [[ $cur == :* ]]; then
+ temp="${cur#:}"
+ prefix="$prefix${cur%$temp}"
+ cur="Devel::$temp"
+ _perlmodules $1
+ fi
+ 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" ) )
+ else
+ _filedir
+ fi
+}
+complete -F _perl perl
+
+_perldoc()
+{
+ local cur prev prefix temp
+
+ COMPREPLY=()
+ _get_comp_words_by_ref -n : cur prev
+ prefix=""
+
+ # completing an option (may or may not be separated by a space)
+ if [[ "$cur" == -?* ]]; then
+ temp=$cur
+ prev=${temp:0:2}
+ cur=${temp:2}
+ prefix=$prev
+ fi
+
+ # complete builtin perl functions
+ case $prev in
+ -f)
+ _perlfunctions "$cur"
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-h -v -t -u -m -l -F -X -f -q' -- "$cur" ))
+ else
+ # return available modules (unless it is clearly a file)
+ if [[ "$cur" != */* ]]; then
+ _perlmodules
+ COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W \
+ '$( PAGER=/bin/cat man perl | \
+ sed -ne "/perl.*Perl overview/,/perlwin32/p" | \
+ awk "\$NF=2 { print \$1}" | command grep perl )' -- "$cur" ) )
+ fi
+ _filedir 'p@(l|m|od)'
+ fi
+}
+complete -F _perldoc -o bashdefault perldoc
+}
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/pine b/completions/pine
index 2f069287..2f069287 100644
--- a/contrib/pine
+++ b/completions/pine
diff --git a/contrib/pkg-config b/completions/pkg-config
index b999bd81..b999bd81 100644
--- a/contrib/pkg-config
+++ b/completions/pkg-config
diff --git a/contrib/pkg_install b/completions/pkg_install
index 577d9c94..577d9c94 100644
--- a/contrib/pkg_install
+++ b/completions/pkg_install
diff --git a/contrib/pkgtools b/completions/pkgtools
index 3a5df278..3a5df278 100644
--- a/contrib/pkgtools
+++ b/completions/pkgtools
diff --git a/contrib/pm-utils b/completions/pm-utils
index 4deb82e7..4deb82e7 100644
--- a/contrib/pm-utils
+++ b/completions/pm-utils
diff --git a/contrib/portupgrade b/completions/portupgrade
index 5389a5ca..5389a5ca 100644
--- a/contrib/portupgrade
+++ b/completions/portupgrade
diff --git a/contrib/postfix b/completions/postfix
index ec91c1a3..1311c987 100644
--- a/contrib/postfix
+++ b/completions/postfix
@@ -29,7 +29,7 @@ _postfix()
COMPREPLY=( $( compgen -W 'check start stop abort flush reload status \
set-permissions upgrade-configuration' -- "$cur" ) )
}
-complete -F _postfix -o filenames postfix
+complete -F _postfix postfix
# postalias(1) and postmap(1)
#
@@ -51,13 +51,14 @@ _postmap()
esac
if [[ $cur == -* ]]; then
- COMPREPLY=( $( compgen -W '-N -f -i -n -o -p -r -v -w -c -d -q'\
+ COMPREPLY=( $( compgen -W '-N -f -i -n -o -p -r -v -w -c -d -q' \
-- "$cur" ) )
return 0
fi
if [[ "$cur" == *:* ]]; then
- COMPREPLY=( $( compgen -f -- "${cur#*:}" ) )
+ _compopt_o_filenames
+ COMPREPLY=( $( compgen -f -- "${cur#*:}" ) )
else
len=${#cur}
idx=0
@@ -68,12 +69,13 @@ _postmap()
fi
done
if [[ $idx -eq 0 ]]; then
+ _compopt_o_filenames
COMPREPLY=( $( compgen -f -- "$cur" ) )
fi
fi
return 0
}
-complete -F _postmap -o filenames postmap postalias
+complete -F _postmap postmap postalias
# postcat(1)
#
@@ -116,7 +118,7 @@ _postcat()
return 0
fi
}
-complete -F _postcat -o filenames postcat
+complete -F _postcat postcat
# postconf(1)
#
@@ -143,7 +145,7 @@ _postconf()
esac
if [[ $cur == -* ]]; then
- COMPREPLY=( $( compgen -W '-A -a -b -c -d -e -h -m -l -n -t -v'\
+ COMPREPLY=( $( compgen -W '-A -a -b -c -d -e -h -m -l -n -t -v' \
-- "$cur" ) )
return 0
fi
@@ -158,7 +160,7 @@ _postconf()
done
return 0
}
-complete -F _postconf -o filenames postconf
+complete -F _postconf postconf
# postsuper(1)
#
@@ -219,7 +221,7 @@ _postsuper()
COMPREPLY=( $( compgen -W 'hold incoming active deferred' -- "$cur" ) )
}
-complete -F _postsuper -o filenames postsuper
+complete -F _postsuper postsuper
}
# Local variables:
diff --git a/contrib/postgresql b/completions/postgresql
index 392c9aa6..f874b67b 100644
--- a/contrib/postgresql
+++ b/completions/postgresql
@@ -3,19 +3,18 @@
have psql && {
_pg_databases()
{
- return # See https://launchpad.net/bugs/164772
- COMPREPLY=( $( compgen -W "$( psql -l 2>/dev/null | \
- sed -e '1,/^-/d' -e '/^(/,$d' | \
- awk '{print $1}' )" -- "$cur" ) )
+ # -w was introduced in 8.4, https://launchpad.net/bugs/164772
+ # "Access privileges" in output may contain linefeeds, hence the NF > 1
+ COMPREPLY=( $( compgen -W "$( psql -AtqwlF $'\t' 2>/dev/null | \
+ awk 'NF > 1 { print $1 }' )" -- "$cur" ) )
}
_pg_users()
{
- # See https://launchpad.net/bugs/164772
- #COMPREPLY=( $( psql -qtc 'select usename from pg_user' template1 2>/dev/null | \
- # command grep "^ $cur" ) )
- #[ ${#COMPREPLY[@]} -eq 0 ] && COMPREPLY=( $( compgen -u -- $cur ) )
- COMPREPLY=( $( compgen -u -- "$cur" ) )
+ # -w was introduced in 8.4, https://launchpad.net/bugs/164772
+ COMPREPLY=( $( compgen -W "$( psql -Atqwc 'select usename from pg_user' \
+ template1 2>/dev/null )" -- "$cur" ) )
+ [ ${#COMPREPLY[@]} -eq 0 ] && COMPREPLY=( $( compgen -u -- "$cur" ) )
}
# createdb(1) completion
@@ -151,7 +150,7 @@ _psql()
_pg_databases
fi
}
-complete -F _psql -o filenames psql
+complete -F _psql psql
}
# Local variables:
diff --git a/contrib/povray b/completions/povray
index cd03b940..a843a5cb 100644
--- a/contrib/povray
+++ b/completions/povray
@@ -7,7 +7,7 @@ _povray()
defoext=png # default output extension, if cannot be determined FIXME
COMPREPLY=()
- _get_comp_words_by_ref povcur prev
+ _get_comp_words_by_ref -c povcur prev
_expand || return 0
@@ -49,12 +49,12 @@ _povray()
;;
*)
cur="$povcur"
- _filedir '?(ini|pov)'
+ _filedir '@(ini|pov)'
return 0
;;
esac
} &&
-complete -F _povray -o filenames povray xpovray spovray
+complete -F _povray povray xpovray spovray
# Local variables:
# mode: shell-script
diff --git a/contrib/procps b/completions/procps
index db8fc3d5..db8fc3d5 100644
--- a/contrib/procps
+++ b/completions/procps
diff --git a/completions/python b/completions/python
new file mode 100644
index 00000000..d6274298
--- /dev/null
+++ b/completions/python
@@ -0,0 +1,54 @@
+# bash completion for python
+
+have python &&
+_python()
+{
+ local prev cur i
+
+ COMPREPLY=()
+ _get_comp_words_by_ref cur prev
+
+ case $prev in
+ -'?'|-h|--help|-V|--version|-c|-m)
+ return 0
+ ;;
+ -Q)
+ COMPREPLY=( $( compgen -W "old new warn warnall" -- "$cur" ) )
+ return 0
+ ;;
+ -W)
+ COMPREPLY=( $( compgen -W "ignore default all module once error" \
+ -- "$cur" ) )
+ return 0
+ ;;
+ !(python?([23])|-?))
+ [[ ${COMP_WORDS[COMP_CWORD-2]} != -@(Q|W) ]] && _filedir
+ ;;
+ esac
+
+
+ # if '-c' is already given, complete all kind of files.
+ for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
+ if [[ ${COMP_WORDS[i]} == -c ]]; then
+ _filedir
+ fi
+ done
+
+
+ if [[ "$cur" != -* ]]; then
+ _filedir 'py?([co])'
+ else
+ COMPREPLY=( $( compgen -W "$( _parse_help $1 -h )" -- "$cur" ) )
+ fi
+
+ return 0
+} &&
+complete -F _python python python2 python3
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/qdbus b/completions/qdbus
index 879df68d..879df68d 100644
--- a/contrib/qdbus
+++ b/completions/qdbus
diff --git a/contrib/qemu b/completions/qemu
index 1c7a8da0..03fa5632 100644
--- a/contrib/qemu
+++ b/completions/qemu
@@ -96,7 +96,7 @@ _qemu()
return 0
;;
-runas)
- COMPREPLY=( $( compgen -u -- "$cur" ) )
+ _allowed_users
return 0
;;
esac
@@ -121,7 +121,7 @@ _qemu()
_filedir
fi
} &&
-complete -F _qemu -o filenames qemu
+complete -F _qemu qemu
# Local variables:
# mode: shell-script
diff --git a/contrib/quota-tools b/completions/quota-tools
index 2b528d92..2b528d92 100644
--- a/contrib/quota-tools
+++ b/completions/quota-tools
diff --git a/contrib/rcs b/completions/rcs
index 42ac8d5a..d859b8a9 100644
--- a/contrib/rcs
+++ b/completions/rcs
@@ -32,7 +32,7 @@ _rcs()
# otherwise, default to directories
[[ ${#COMPREPLY[@]} -eq 0 && $1 == ci ]] && _filedir || _filedir -d
} &&
-complete -F _rcs -o filenames ci co rlog rcs rcsdiff
+complete -F _rcs ci co rlog rcs rcsdiff
# Local variables:
# mode: shell-script
diff --git a/contrib/rdesktop b/completions/rdesktop
index 7acf47a5..7acf47a5 100644
--- a/contrib/rdesktop
+++ b/completions/rdesktop
diff --git a/contrib/reportbug b/completions/reportbug
index 51e37fb7..0c44bd68 100644
--- a/contrib/reportbug
+++ b/completions/reportbug
@@ -84,7 +84,7 @@ _reportbug()
_filedir
return 0
} &&
-complete -F _reportbug -o filenames reportbug
+complete -F _reportbug reportbug
have querybts &&
_querybts()
@@ -121,7 +121,7 @@ _querybts()
www.debian.org' -- "$cur" ) \
$( apt-cache pkgnames -- "$cur" 2> /dev/null) )
} &&
-complete -F _querybts -o filenames querybts
+complete -F _querybts querybts
# Local variables:
# mode: shell-script
diff --git a/contrib/resolvconf b/completions/resolvconf
index 9773696d..9773696d 100644
--- a/contrib/resolvconf
+++ b/completions/resolvconf
diff --git a/contrib/rfkill b/completions/rfkill
index 5c51ff9d..5c51ff9d 100644
--- a/contrib/rfkill
+++ b/completions/rfkill
diff --git a/contrib/ri b/completions/ri
index be66d98f..be66d98f 100644
--- a/contrib/ri
+++ b/completions/ri
diff --git a/contrib/rpcdebug b/completions/rpcdebug
index be2a8709..be2a8709 100644
--- a/contrib/rpcdebug
+++ b/completions/rpcdebug
diff --git a/contrib/rpm b/completions/rpm
index 20f98522..f07ba7de 100644
--- a/contrib/rpm
+++ b/completions/rpm
@@ -24,8 +24,6 @@ _rpm_installed_packages()
_rpm_groups()
{
- # TODO: shown completions are wrong but real ones work nevertheless
- # http://lists.alioth.debian.org/pipermail/bash-completion-devel/2009-May/001486.html
local IFS=$'\n'
COMPREPLY=( $( compgen -W "$( rpm -qa $nodig $nosig --queryformat \
'%{group}\n' )" -- "$cur" ) )
@@ -101,6 +99,7 @@ _rpm()
return 0
;;
--pipe)
+ _compopt_o_filenames
COMPREPLY=( $( compgen -c -- "$cur" ) )
return 0
;;
@@ -118,9 +117,9 @@ _rpm()
_filedir
else
# complete on capabilities
- local IFS=$'\n'
- COMPREPLY=( $( compgen -W "$( rpm -qa $nodig $nosig \
- --queryformat='%{providename}\n' )" -- "$cur" ) )
+ local IFS=$'\n'
+ COMPREPLY=( $( compgen -W "$( rpm -qa $nodig $nosig \
+ --queryformat='%{providename}\n' )" -- "$cur" ) )
fi
return 0
;;
@@ -131,8 +130,7 @@ _rpm()
# complete on capabilities
local IFS=$'\n'
COMPREPLY=( $( compgen -W "$( rpm -qa $nodig $nosig \
- --queryformat='%{requirename}\n' )" \
- -- "$cur" ) )
+ --queryformat='%{requirename}\n' )" -- "$cur" ) )
fi
return 0
;;
@@ -142,7 +140,7 @@ _rpm()
-- "$cur" ) )
return 0
;;
- --define|-D)
+ --define|-D|--fileid|--hdrid|--pkgid)
# argument required but no completions available
return 0
;;
@@ -164,7 +162,7 @@ _rpm()
--excludepath --ignoresize --oldpackage \
--queryformat --repackage --nosuggests" -- "$cur" ) )
else
- _filedir 'rpm'
+ _filedir '[rs]pm'
fi
;;
-e|--erase)
@@ -180,12 +178,11 @@ _rpm()
# options common to all query types
opts="$opts --changelog --configfiles --conflicts --docfiles
--dump --enhances --filesbypkg --filecaps --fileclass
- --filecolor --fileprovide --filerequire --filesbypkg
- --info --list --obsoletes --pipe --provides
- --queryformat --rcfile --requires --scripts --suggests
- --triggeredby --triggers --whatprovides --whatrequires --xml"
+ --filecolor --fileprovide --filerequire --filesbypkg --info
+ --list --obsoletes --pipe --provides --queryformat --rcfile
+ --requires --scripts --suggests --triggers --xml"
- if [ "${COMP_LINE#* -*([^ -])f}" != "$COMP_LINE" ]; then
+ if [[ $COMP_LINE == *\ -@(*([^ -])f|-file )* ]]; then
# -qf completion
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W "$opts --dbpath --fscontext \
@@ -193,23 +190,26 @@ _rpm()
else
_filedir
fi
- elif [ "${COMP_LINE#* -*([^ -])g}" != "$COMP_LINE" ]; then
+ elif [[ $COMP_LINE == *\ -@(*([^ -])g|-group )* ]]; then
# -qg completion
_rpm_groups
- elif [ "${COMP_LINE#* -*([^ -])p}" != "$COMP_LINE" ]; then
+ elif [[ $COMP_LINE == *\ -@(*([^ -])p|-package )* ]]; then
# -qp; uninstalled package completion
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W "$opts --ftpport --ftpproxy \
- --httpport --httpproxy" -- "$cur" ) )
+ --httpport --httpproxy --nomanifest" -- "$cur" ) )
else
- _filedir 'rpm'
+ _filedir '[rs]pm'
fi
else
# -q; installed package completion
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W "$opts --dbpath --fscontext \
- --last --root --state" -- "$cur" ) )
- elif [ "${COMP_LINE#* -*([^ -])a}" == "$COMP_LINE" ]; then
+ COMPREPLY=( $( compgen -W "$opts --all --file --fileid
+ --dbpath --fscontext --ftswalk --group --hdrid --last
+ --package --pkgid --root --specfile --state
+ --triggeredby --whatprovides --whatrequires" \
+ -- "$cur" ) )
+ elif [[ $COMP_LINE != *\ -@(*([^ -])a|-all )* ]]; then
_rpm_installed_packages "$nodig" "$nosig"
fi
fi
@@ -219,7 +219,7 @@ _rpm()
COMPREPLY=( $( compgen -W "$opts --nopgp --nogpg --nomd5" \
-- "$cur" ) )
else
- _filedir 'rpm'
+ _filedir '[rs]pm'
fi
;;
-[Vy]*|--verify)
@@ -229,12 +229,12 @@ _rpm()
--nofiles --noscripts --nomd5 --querytags --specfile \
--whatrequires --whatprovides" -- "$cur" ) )
# check whether we're doing file completion
- elif [ "${COMP_LINE#* -*([^ -])f}" != "$COMP_LINE" ]; then
+ elif [[ $COMP_LINE == *\ -@(*([^ -])f|-file )* ]]; then
_filedir
- elif [ "${COMP_LINE#* -*([^ -])g}" != "$COMP_LINE" ]; then
+ elif [[ $COMP_LINE == *\ -@(*([^ -])g|-group )* ]]; then
_rpm_groups
- elif [ "${COMP_LINE#* -*([^ -])p}" != "$COMP_LINE" ]; then
- _filedir 'rpm'
+ elif [[ $COMP_LINE == *\ -@(*([^ -])p|-package )* ]]; then
+ _filedir '[rs]pm'
else
_rpm_installed_packages "$nodig" "$nosig"
fi
@@ -245,9 +245,9 @@ _rpm()
--clean --rmsource --rmspec --test --sign --buildroot \
--target --nobuild --nodeps --nodirtokens" -- "$cur" ) )
elif [[ ${COMP_WORDS[1]} == -b* ]]; then
- _filedir 'spec'
+ _filedir spec
else
- _filedir '@(t?(ar.)@([gx]z|bz?(2))|tar.@(lzma|Z))'
+ _filedir '@(t?(ar.)@([gx]z|bz?(2))|tar?(.@(lzma|Z)))'
fi
;;
--rebuild|--recompile)
@@ -255,14 +255,14 @@ _rpm()
COMPREPLY=( $( compgen -W "$opts --nodeps --rmsource \
--rmspec --sign --nodirtokens --target" -- "$cur" ) )
else
- _filedir '?(no)src.rpm'
+ _filedir '@(?(no)src.r|s)pm'
fi
;;
--tarbuild)
- _filedir '@(t?(ar.)@([gx]z|bz?(2))|tar.@(lzma|Z))'
+ _filedir '@(t?(ar.)@([gx]z|bz?(2))|tar?(.@(lzma|Z)))'
;;
--resign|--addsign)
- _filedir 'rpm'
+ _filedir '[rs]pm'
;;
--setperms|--setgids)
_rpm_installed_packages "$nodig" "$nosig"
@@ -272,12 +272,12 @@ _rpm()
COMPREPLY=( $( compgen -W '--clean --rmsource --rmspec' \
-- "$cur" ) )
else
- _filedir 'spec'
+ _filedir spec
fi
;;
--import|--dbpath|--root)
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--import --dbpath --root' \
+ COMPREPLY=( $( compgen -W '--import --dbpath --root' \
-- "$cur" ) )
else
_filedir
@@ -287,7 +287,7 @@ _rpm()
return 0
}
-complete -F _rpm -o filenames rpm rpmbuild
+complete -F _rpm rpm rpmbuild
}
# Local variables:
diff --git a/contrib/rpmcheck b/completions/rpmcheck
index 5d9aada7..5d9aada7 100644
--- a/contrib/rpmcheck
+++ b/completions/rpmcheck
diff --git a/contrib/rrdtool b/completions/rrdtool
index 0b15a23f..0b15a23f 100644
--- a/contrib/rrdtool
+++ b/completions/rrdtool
diff --git a/contrib/rsync b/completions/rsync
index b0f2d106..b0f2d106 100644
--- a/contrib/rsync
+++ b/completions/rsync
diff --git a/contrib/rtcwake b/completions/rtcwake
index c95c1d76..c95c1d76 100644
--- a/contrib/rtcwake
+++ b/completions/rtcwake
diff --git a/contrib/samba b/completions/samba
index 61d78abc..61d78abc 100644
--- a/contrib/samba
+++ b/completions/samba
diff --git a/contrib/sbcl b/completions/sbcl
index a43ec1fc..33671a6e 100644
--- a/contrib/sbcl
+++ b/completions/sbcl
@@ -11,16 +11,16 @@ _sbcl()
# completing an option (may or may not be separated by a space)
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--core --noinform --help --version \
- --sysinit --userinit --eval --noprint --disable-debugger \
- --end-runtime-options --end-toplevel-options ' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '--core --noinform --help --version
+ --sysinit --userinit --eval --noprint --disable-debugger
+ --end-runtime-options --end-toplevel-options ' -- "$cur" ) )
else
- _filedir
+ _filedir
fi
return 0
} &&
-complete -F _sbcl -o filenames sbcl sbcl-mt
+complete -F _sbcl sbcl sbcl-mt
# Local variables:
# mode: shell-script
diff --git a/contrib/screen b/completions/screen
index cabc4b7a..952d9766 100644
--- a/contrib/screen
+++ b/completions/screen
@@ -3,16 +3,9 @@
have screen &&
_screen_sessions()
{
- local pattern
-
- if [ -n "$1" ]; then
- pattern=".*$1.*"
- else
- pattern=".*"
- fi
-
- COMPREPLY=( $( command screen -ls | sed -ne \
- 's|^['$'\t'']\{1,\}\('"$cur"'[0-9]\{1,\}\.[^'$'\t'']\{1,\}\)'"$pattern"'$|\1|p' ) )
+ COMPREPLY=( $( compgen -W "$( command screen -ls | sed -ne \
+ 's|^\t\{1,\}\([0-9]\{1,\}\.[^\t]\{1,\}\).*'"$1"'.*$|\1|p' )" \
+ -- "$cur" ) )
} &&
_screen()
{
@@ -36,11 +29,16 @@ _screen()
_screen_sessions 'Detached'
return 0
;;
- -[dDx])
+ -[dD])
# list attached
_screen_sessions 'Attached'
return 0
;;
+ -x)
+ # list both
+ _screen_sessions
+ return 0
+ ;;
-s)
_shells
return 0
diff --git a/contrib/service b/completions/service
index 9ebd117d..ffd24366 100644
--- a/contrib/service
+++ b/completions/service
@@ -21,7 +21,7 @@ _service()
[ -d /etc/rc.d/init.d ] && sysvdir=/etc/rc.d/init.d || sysvdir=/etc/init.d
- if [[ $COMP_CWORD -eq 1 ]] && [[ $prev == "service" ]]; then
+ if [[ $COMP_CWORD -eq 1 && $prev == "service" ]]; then
_services
else
COMPREPLY=( $( compgen -W '`sed -e "y/|/ /" \
@@ -32,9 +32,11 @@ _service()
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)
+for svc in /etc/init.d/*; do
+ [ ! -x "$svc" ] || complete -p "${svc##*/}" &>/dev/null || \
+ complete -F _service -o default "${svc##*/}"
+done
+unset svc
# Local variables:
# mode: shell-script
diff --git a/completions/sh b/completions/sh
new file mode 100644
index 00000000..9c7ca020
--- /dev/null
+++ b/completions/sh
@@ -0,0 +1,41 @@
+# POSIX sh(1) completion
+
+have sh &&
+_sh()
+{
+ COMPREPLY=()
+ local cur prev
+ _get_comp_words_by_ref cur prev
+
+ case $prev in
+ -c)
+ return 0
+ ;;
+ -o|+o)
+ COMPREPLY=( $( compgen -W 'allexport errexit ignoreeof monitor
+ noclobber noglob noexec nolog notify nounset verbose vi
+ xtrace' -- "$cur" ) )
+ return 0
+ ;;
+ esac
+
+ local opts="-a -b -C -e -f -h -i -m -n -o -u -v -x"
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W "$opts -c -s" -- "$cur" ) )
+ return 0
+ elif [[ "$cur" == +* ]]; then
+ COMPREPLY=( $( compgen -W "${opts//-/+}" -- "$cur" ) )
+ return 0
+ fi
+
+ _filedir sh
+} &&
+complete -F _sh sh
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/shadow b/completions/shadow
index a3451b7b..6aea045b 100644
--- a/contrib/shadow
+++ b/completions/shadow
@@ -14,7 +14,8 @@ _useradd()
# with -u/--uid
case $prev in
- -c|--comment|-h|--help|-e|--expiredate|-f|--inactive|-k|--key|-p|--password|-u|--uid|-Z|--selinux-user)
+ -c|--comment|-h|--help|-e|--expiredate|-f|--inactive|-k|--key|\
+ -p|--password|-u|--uid|-Z|--selinux-user)
return 0
;;
-b|--base-dir|-d|--home|-k|--skel)
@@ -64,7 +65,8 @@ _usermod()
# with -u/--uid
case $prev in
- -c|--comment|-d|--home|-e|--expiredate|-f|--inactive|-h|--help|-l|--login|-p|--password|-u|--uid|-Z|--selinux-user)
+ -c|--comment|-d|--home|-e|--expiredate|-f|--inactive|-h|--help|\
+ -l|--login|-p|--password|-u|--uid|-Z|--selinux-user)
return 0
;;
-g|--gid)
@@ -126,7 +128,8 @@ _chage()
_split_longopt && split=true
case $prev in
- -d|--lastday|-E|--expiredate|-h|--help|-I|--inactive|-m|--mindays|-M|--maxdays|-W|--warndays)
+ -d|--lastday|-E|--expiredate|-h|--help|-I|--inactive|-m|--mindays|\
+ -M|--maxdays|-W|--warndays)
return 0
;;
esac
@@ -163,7 +166,7 @@ _passwd()
return 0
fi
- COMPREPLY=( $( compgen -u -- "$cur" ) )
+ _allowed_users
} &&
complete -F _passwd passwd
@@ -229,7 +232,7 @@ _newusers()
_filedir
} &&
-complete -F _newusers -o filenames newusers
+complete -F _newusers newusers
have pwck &&
_pwck()
@@ -246,7 +249,7 @@ _pwck()
_filedir
} &&
-complete -F _pwck -o filenames pwck
+complete -F _pwck pwck
have groupadd &&
_groupadd()
@@ -316,9 +319,11 @@ _newgrp()
COMPREPLY=()
if [[ "`_get_cword`" == "-" ]]; then
COMPREPLY=( - )
+ else
+ _allowed_groups
fi
} &&
-complete -g -F _newgrp newgrp
+complete -F _newgrp newgrp
have gpasswd &&
_gpasswd()
@@ -385,7 +390,7 @@ _grpck()
_filedir
} &&
-complete -F _grpck -o filenames grpck
+complete -F _grpck grpck
have vipw || have vigr &&
_vipw()
diff --git a/contrib/sitecopy b/completions/sitecopy
index 616bc5e4..616bc5e4 100644
--- a/contrib/sitecopy
+++ b/completions/sitecopy
diff --git a/contrib/smartctl b/completions/smartctl
index 74e42816..74e42816 100644
--- a/contrib/smartctl
+++ b/completions/smartctl
diff --git a/contrib/snownews b/completions/snownews
index 9c99ed7c..9c99ed7c 100644
--- a/contrib/snownews
+++ b/completions/snownews
diff --git a/completions/sqlite3 b/completions/sqlite3
new file mode 100644
index 00000000..b37c55f7
--- /dev/null
+++ b/completions/sqlite3
@@ -0,0 +1,39 @@
+# sqlite3(1) completion
+
+have sqlite3 &&
+_sqlite3()
+{
+ COMPREPLY=()
+ local cur prev
+ _get_comp_words_by_ref cur prev
+
+ local dbexts='@(sqlite?(3)|?(s?(3))db)'
+
+ case $prev in
+ -help|-version|-separator|-nullvalue|*.$dbexts)
+ return 0
+ ;;
+ -init)
+ _filedir
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-help -init -echo -header -noheader -bail
+ -interactive -batch -column -csv -html -line -list -separator
+ -nullvalue -version' -- "$cur" ) )
+ return 0
+ fi
+
+ _filedir $dbexts
+} &&
+complete -F _sqlite3 sqlite3
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/ssh b/completions/ssh
index b4bafdee..cf966ae5 100644
--- a/contrib/ssh
+++ b/completions/ssh
@@ -184,6 +184,7 @@ _ssh()
done
_known_hosts_real -a -F "$configfile" "$cur"
if [ $COMP_CWORD -ne 1 ]; then
+ _compopt_o_filenames
COMPREPLY=( "${COMPREPLY[@]}" $( compgen -c -- "$cur" ) )
fi
fi
@@ -245,14 +246,14 @@ _sftp()
}
shopt -u hostcomplete && complete -F _sftp sftp
-# things we want to escape in remote scp paths
-_scp_path_esc="[][(){}<>\",:;^&\!$=?\`|\\ ']"
+# things we want to backslash escape in scp paths
+_scp_path_esc='[][(){}<>",:;^&!$=?`|\\'"'"'[:space:]]'
# Complete remote files with ssh. If the first arg is -d, complete on dirs
# only. Returns paths escaped with three backslashes.
_scp_remote_files()
{
- local IFS=$'\t\n'
+ local IFS=$'\n'
# remove backslash escape from the first colon
cur=${cur/\\:/:}
@@ -291,7 +292,7 @@ _scp_remote_files()
# an optional prefix to add to returned completions.
_scp_local_files()
{
- local IFS=$'\t\n'
+ local IFS=$'\n'
local dirsonly=false
if [ "$1" = -d ]; then
@@ -415,7 +416,7 @@ _ssh_copy_id()
return 0
}
-complete -F _ssh_copy_id -o filenames ssh-copy-id
+complete -F _ssh_copy_id ssh-copy-id
}
# Local variables:
diff --git a/contrib/sshfs b/completions/sshfs
index d7945f88..d7945f88 100644
--- a/contrib/sshfs
+++ b/completions/sshfs
diff --git a/completions/strace b/completions/strace
new file mode 100644
index 00000000..0ee27377
--- /dev/null
+++ b/completions/strace
@@ -0,0 +1,103 @@
+# bash completion for strace
+
+have strace &&
+_strace()
+{
+ local cur prev offset i syscalls arch unistd
+
+ # check if we're still completing strace
+ offset=0
+ for (( i=1; i <= COMP_CWORD; i++ )); do
+ case ${COMP_WORDS[$i]} in
+ -o|-e|-p)
+ i=$((i+1))
+ continue
+ ;;
+ -*)
+ continue
+ ;;
+ esac
+ offset=$i
+ break
+ done
+
+ if [ $offset -gt 0 ]; then
+ # FAIL: _command_offset is not defined anywhere. Guillame?
+ _command_offset $offset
+ else
+
+ COMPREPLY=()
+ _get_comp_words_by_ref cur prev
+
+ case $prev in
+ -e)
+ if [[ "$cur" == *=* ]]; then
+ prev=${cur/=*/}
+ cur=${cur/*=/}
+
+ # Import arch-specific syscalls -- not foolproof IMHO
+ #+ --David Paleino
+ arch=$(command uname -m)
+ syscalls=$(awk '/^#define __NR/ {print $2}' \
+ /usr/include/asm/unistd.h | sed -e \
+ 's/__NR_//')
+ if [ -z "$syscalls" ]; then
+ if [[ "$arch" == *86 ]]; then
+ unistd=/usr/include/asm/unistd_32.h
+ else
+ unistd=/usr/include/asm/unistd_64.h
+ fi
+ syscalls=$(awk '/^#define __NR/ {print $2}' \
+ $unistd | sed -e 's/__NR_//')
+ fi
+
+ case $prev in
+ trace)
+ COMPREPLY=( $( compgen -W "$syscalls file process
+ network signal ipc desc all none" -- "$cur") )
+ return 0
+ ;;
+ esac
+ else
+ COMPREPLY=( $( compgen -S"=" -W 'trace abbrev verbose raw
+ signal read write' -- "$cur" ) )
+ fi
+ return 0
+ ;;
+ -o)
+ _filedir
+ return 0
+ ;;
+ -p)
+ _pids
+ return 0
+ ;;
+ -S)
+ COMPREPLY=( $( compgen -W 'time calls name nothing' \
+ -- "$cur" ) )
+ return 0
+ ;;
+ -u)
+ _allowed_users
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ 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
+ COMPREPLY=( $( compgen -c -- "$cur" ) )
+ fi
+ fi
+} &&
+complete -F _strace -o default strace
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/svk b/completions/svk
index c809d2eb..bda5997a 100644
--- a/contrib/svk
+++ b/completions/svk
@@ -214,7 +214,7 @@ _svk()
return 0
} &&
-complete -F _svk -o filenames svk
+complete -F _svk svk
# Local variables:
# mode: shell-script
diff --git a/completions/sysbench b/completions/sysbench
new file mode 100644
index 00000000..3b309a9a
--- /dev/null
+++ b/completions/sysbench
@@ -0,0 +1,175 @@
+# bash completion for sysbench
+
+# We set -o nospace and turn it off in quite a few places for bash < 4
+# reasons; assuming bash >= 4 we could instead not turn it on
+# initially but only in the few cases where it's actually needed.
+
+have sysbench &&
+_sysbench()
+{
+ COMPREPLY=()
+ local cur prev words split=false
+ _get_comp_words_by_ref -n = cur prev words
+
+ # long options need the "=" (whitespace split doesn't work), but we split
+ # internally to make processing easier
+ _split_longopt && split=true
+
+ case $prev in
+ --num-threads|--max-requests|--max-time|--thread-stack-size| \
+ --help|--version|help|version)
+ return 0
+ ;;
+ --init-rng|--debug|--validate)
+ compopt +o nospace &>/dev/null
+ COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) )
+ return 0
+ ;;
+ --test)
+ compopt +o nospace &>/dev/null
+ COMPREPLY=( $( compgen -W 'fileio cpu memory threads mutex oltp' \
+ -- "$cur" ) )
+ return 0
+ ;;
+ --cpu-max-prime)
+ return 0
+ ;;
+ --file-test-mode)
+ compopt +o nospace &>/dev/null
+ COMPREPLY=( $( compgen -W 'seqwr seqrewr seqrd rndrd rndwr rndrw' \
+ -- "$cur" ) )
+ return 0
+ ;;
+ --file-io-mode)
+ compopt +o nospace &>/dev/null
+ COMPREPLY=( $( compgen -W 'sync async fastmmap slowmmap' \
+ -- "$cur" ) )
+ return 0
+ ;;
+ --file-extra-flags)
+ compopt +o nospace &>/dev/null
+ COMPREPLY=( $( compgen -W 'sync dsync direct' -- "$cur" ) )
+ return 0
+ ;;
+ --file-fsync-all|--file-fsync-end)
+ compopt +o nospace &>/dev/null
+ COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) )
+ return 0
+ ;;
+ --file-fsync-mode)
+ compopt +o nospace &>/dev/null
+ COMPREPLY=( $( compgen -W 'fsync fdatasync' -- "$cur" ) )
+ return 0
+ ;;
+ --memory-scope)
+ compopt +o nospace &>/dev/null
+ COMPREPLY=( $( compgen -W 'global local' -- "$cur" ) )
+ return 0
+ ;;
+ --memory-hugetlb)
+ compopt +o nospace &>/dev/null
+ COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) )
+ return 0
+ ;;
+ --memory-oper)
+ compopt +o nospace &>/dev/null
+ COMPREPLY=( $( compgen -W 'read write none' -- "$cur" ) )
+ return 0
+ ;;
+ --memory-access-mode)
+ compopt +o nospace &>/dev/null
+ COMPREPLY=( $( compgen -W 'seq rnd' -- "$cur" ) )
+ return 0
+ ;;
+ --oltp-test-mode)
+ compopt +o nospace &>/dev/null
+ COMPREPLY=( $( compgen -W 'simple complex nontrx sp' -- "$cur" ) )
+ return 0
+ ;;
+ --oltp-read-only|--oltp-skip-trx|--oltp-quto-inc|--mysql-ssl)
+ compopt +o nospace &>/dev/null
+ COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) )
+ return 0
+ ;;
+ --oltp-nontrx-mode)
+ compopt +o nospace &>/dev/null
+ COMPREPLY=( $( compgen -W 'select update_key update_nokey insert
+ delete' -- "$cur" ) )
+ return 0
+ ;;
+ --oltp-dist-type)
+ compopt +o nospace &>/dev/null
+ COMPREPLY=( $( compgen -W 'uniform gaussian special' -- "$cur" ) )
+ return 0
+ ;;
+ --db-driver)
+ compopt +o nospace &>/dev/null
+ COMPREPLY=( $( compgen -W "$( $1 --test=oltp help 2>/dev/null |
+ sed -e '/^.*database drivers:/,/^$/!d' \
+ -ne 's/^ *\([^ ]*\) .*/\1/p' )" -- "$cur" ) )
+ return 0
+ ;;
+ --db-ps-mode)
+ compopt +o nospace &>/dev/null
+ COMPREPLY=( $( compgen -W 'auto disable' -- "$cur" ) )
+ return 0
+ ;;
+ --mysql-socket)
+ compopt +o nospace &>/dev/null
+ _filedir sock
+ return 0
+ ;;
+ --mysql-table-engine)
+ compopt +o nospace &>/dev/null
+ COMPREPLY=( $( compgen -W 'myisam innodb bdb heap ndbcluster
+ federated' -- "$cur" ) )
+ return 0
+ ;;
+ --mysql-engine-trx)
+ compopt +o nospace &>/dev/null
+ COMPREPLY=( $( compgen -W 'yes no auto' -- "$cur" ) )
+ return 0
+ ;;
+ --*)
+ $split && return 0
+ ;;
+ esac
+
+ # find out which test we're running
+ local i test
+ for (( i=1 ; $i < ${#words[@]}-1 ; i++ )); do
+ if [[ ${words[i]} == --test* ]]; then
+ test=${words[i]#*=}
+ break
+ fi
+ done
+
+ local opts="--num-threads= --max-requests= --max-time= --thread-stack-size=
+ --init-rng= --debug= --validate= --help --version"
+
+ if [[ $test ]]; then
+ local help=( $( _parse_help $1 "--test=$test help" ) )
+ opts="$opts ${help[@]/%/=} prepare run cleanup help version"
+ else
+ opts="$opts --test="
+ fi
+
+ if [[ "$cur" == -* || ! $test ]]; then
+ COMPREPLY=( $( compgen -W "$opts" -- "$cur" ) )
+ [[ ${#COMPREPLY[@]} == 1 && ${COMPREPLY[0]} != *= ]] && \
+ compopt +o nospace &>/dev/null
+ else
+ compopt +o nospace &>/dev/null
+ COMPREPLY=( $( compgen -W "prepare run cleanup help version" \
+ -- "$cur" ) )
+ fi
+} &&
+complete -F _sysbench -o nospace sysbench
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/sysctl b/completions/sysctl
index 41cbd7ee..ac25f4ef 100644
--- a/contrib/sysctl
+++ b/completions/sysctl
@@ -8,7 +8,8 @@ _sysctl()
COMPREPLY=()
_get_comp_words_by_ref cur
- COMPREPLY=( $( compgen -W "$(sysctl -N -a 2>/dev/null)" -- "$cur" ) )
+ COMPREPLY=( $( compgen -W \
+ "$( PATH="$PATH:/sbin" sysctl -N -a 2>/dev/null )" -- "$cur" ) )
return 0
} &&
diff --git a/contrib/sysv-rc b/completions/sysv-rc
index 735a4042..735a4042 100644
--- a/contrib/sysv-rc
+++ b/completions/sysv-rc
diff --git a/contrib/tar b/completions/tar
index 400daa62..a5c02490 100644
--- a/contrib/tar
+++ b/completions/tar
@@ -14,31 +14,30 @@ _tar()
fi
case ${COMP_WORDS[1]} in
- ?(-)[cr]*f)
- _filedir
- return 0
- ;;
- +([^IZzJjy])f)
- 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)
- ext='t?(ar.)@(gz|Z)'
- regex='t\(ar\.\)\?\(gz\|Z\)'
- ;;
- *[Ijy]*f)
- ext='t?(ar.)bz?(2)'
- regex='t\(ar\.\)\?bz2\?'
- ;;
- *[J]*f)
- ext='t?(ar.)@(lz?(ma)|xz)'
- regex='t\(ar\.\)\?\(lzma\|xz\)\?'
- ;;
- *)
- _filedir
- return 0
- ;;
-
+ ?(-)[cr]*f)
+ _filedir
+ return 0
+ ;;
+ +([^IZzJjy])f)
+ ext='@(@(tar|gem|spkg)?(.@(Z|[gx]z|bz?(2)|lzma))|t@([glx]z|bz?(2)))'
+ regex='\(\(tar\|gem\|spkg\)\(\.\(Z\|[gx]z\|bz?(2)\|lzma\)\)\?\|t\([glx]z\|bz2\?\)\)'
+ ;;
+ *[Zz]*f)
+ ext='@(t?(ar.)|gem.|spkg.)@(gz|Z)'
+ regex='\(t\(ar\.\)\?\|gem\.\|spkg\.\)\(gz\|Z\)'
+ ;;
+ *[Ijy]*f)
+ ext='@(@(t?(ar.)|gem.)bz?(2)|spkg)'
+ regex='\(\(t\(ar\.\)\?\|gem\.\)bz2\?\|spkg\)'
+ ;;
+ *[J]*f)
+ ext='@(t?(ar.)|gem.|spkg.)@(lz?(ma)|xz)'
+ regex='\(t\(ar\.\)\?\|gem\.\|spkg\.\)\(lzma\|xz\)\?'
+ ;;
+ *)
+ _filedir
+ return 0
+ ;;
esac
if [[ "$COMP_LINE" == *$ext' ' ]]; then
@@ -49,7 +48,8 @@ _tar()
# devise how to untar and list it
untar=t${COMP_WORDS[1]//[^Izjyf]/}
- COMPREPLY=( $( compgen -W "$( printf '%s ' $( tar $untar $tar \
+ local IFS=$'\n'
+ COMPREPLY=( $( compgen -W "$( printf '%s\n' $( tar $untar $tar \
2>/dev/null ) )" -- "$cur" ) )
return 0
fi
@@ -60,7 +60,7 @@ _tar()
return 0
}
[ -n "${COMP_TAR_INTERNAL_PATHS:-}" ] && complete -F _tar -o dirnames tar ||
- complete -F _tar -o filenames tar
+ complete -F _tar tar
}
# Local variables:
diff --git a/contrib/tcpdump b/completions/tcpdump
index 259f13e0..259f13e0 100644
--- a/contrib/tcpdump
+++ b/completions/tcpdump
diff --git a/contrib/unace b/completions/unace
index 5ceb7646..9d27ef50 100644
--- a/contrib/unace
+++ b/completions/unace
@@ -14,11 +14,11 @@ _unace()
if [ $COMP_CWORD -eq 1 ]; then
COMPREPLY=( $( compgen -W 'e l t v x' -- "$cur" ) )
else
- _filedir '@(ace|ACE)'
+ _filedir ace
fi
fi
} &&
-complete -F _unace -o filenames unace
+complete -F _unace unace
# Local variables:
# mode: shell-script
diff --git a/contrib/unrar b/completions/unrar
index 3fb24dbb..0a4fe27a 100644
--- a/contrib/unrar
+++ b/completions/unrar
@@ -16,12 +16,12 @@ _unrar()
if [ $COMP_CWORD -eq 1 ]; then
COMPREPLY=( $( compgen -W 'e l lb lt p t v vb vt x' -- "$cur" ) )
else
- _filedir '@(rar|RAR)'
+ _filedir rar
fi
fi
} &&
-complete -F _unrar -o filenames unrar
+complete -F _unrar unrar
# Local variables:
# mode: shell-script
diff --git a/contrib/update-alternatives b/completions/update-alternatives
index ebed294d..ebed294d 100644
--- a/contrib/update-alternatives
+++ b/completions/update-alternatives
diff --git a/contrib/util-linux b/completions/util-linux
index 8017ebb2..f45ffd56 100644
--- a/contrib/util-linux
+++ b/completions/util-linux
@@ -17,7 +17,7 @@ _renice()
curopt=${COMP_WORDS[COMP_CWORD-$i]}
case "$curopt" in
-u)
- COMPREPLY=( $( compgen -u -- "$cur" ) )
+ _allowed_users
;;
-g)
_pgids
diff --git a/contrib/vncviewer b/completions/vncviewer
index 296eb8af..296eb8af 100644
--- a/contrib/vncviewer
+++ b/completions/vncviewer
diff --git a/contrib/vpnc b/completions/vpnc
index 722fee3a..722fee3a 100644
--- a/contrib/vpnc
+++ b/completions/vpnc
diff --git a/contrib/wireless-tools b/completions/wireless-tools
index 56ba0db8..56ba0db8 100644
--- a/contrib/wireless-tools
+++ b/completions/wireless-tools
diff --git a/completions/wodim b/completions/wodim
new file mode 100644
index 00000000..abc0ff25
--- /dev/null
+++ b/completions/wodim
@@ -0,0 +1,118 @@
+# bash completion for cdrecord/wodim
+
+# We set -o nospace and turn it off in several places for bash < 4
+# reasons; assuming bash >= 4 we could instead not turn it on
+# initially but only in the few cases where it's actually needed.
+
+have cdrecord || have wodim &&
+_cdrecord()
+{
+ local cur prev i generic_options track_options track_mode
+
+ COMPREPLY=()
+ _get_comp_words_by_ref -n = cur prev
+
+ # foo=bar style option
+ if [[ "$cur" == *=* ]]; then
+ prev=${cur%%=*}
+ cur=${cur#*=}
+ case $prev in
+ textfile|cuefile|msifile)
+ compopt +o nospace &>/dev/null
+ _filedir
+ ;;
+ blank)
+ compopt +o nospace &>/dev/null
+ COMPREPLY=( $( compgen -W 'help all fast track unreserve trtail
+ unclose session' -- "$cur" ) )
+ ;;
+ driveropts)
+ if [[ $cur == *=* ]]; then
+ prev=${cur%%=*}
+ cur=${cur#*=}
+ case $prev in
+ varirec)
+ compopt +o nospace &>/dev/null
+ COMPREPLY=( $( compgen -W "-2 -1 0 1 2" \
+ -- "$cur" ) )
+ ;;
+ gigarec)
+ compopt +o nospace &>/dev/null
+ COMPREPLY=( $( compgen -W "0.6 0.7 0.8 1.0 1.2 1.3
+ 1.4" -- "$cur" ) )
+ ;;
+ tattoofile)
+ compopt +o nospace &>/dev/null
+ _filedir
+ ;;
+ esac
+ else
+ COMPREPLY=( $( compgen -W 'burnfree noburnfree varirec=
+ gigarec= audiomaster forcespeed noforcespeed speedread
+ nospeedread singlesession nosinglesession hidecdr
+ nohidecdr tattooinfo tattoofile=' -- "$cur" ) )
+ [[ ${#COMPREPLY[@]} == 1 && ${COMPREPLY[0]} != *= ]] && \
+ compopt +o nospace &>/dev/null
+ fi
+ ;;
+ driver)
+ compopt +o nospace &>/dev/null
+ COMPREPLY=( $( compgen -W "$( $1 driver=help 2>&1 | \
+ awk 'NR > 1 { print $1 }' ) help" -- "$cur" ) )
+ ;;
+ minbuf)
+ compopt +o nospace &>/dev/null
+ COMPREPLY=( $( compgen -W "$( seq 25 95 2>/dev/null )" \
+ -- "$cur" ) )
+ ;;
+ esac
+ return 0
+ fi
+
+ generic_options=( -version -v -V -d -silent -force -immed -dummy -clone \
+ -dao -sao -tao -raw -raw96r -raw96p -raw16 -multi -msinfo -toc -atip \
+ -fix -nofix -waiti -load -lock -eject -format -setdropts -checkdrive \
+ -prcap -inq -scanbus --devices -reset -abort -overburn -ignsize \
+ -useinfo -packet -noclose -text debug= kdebug= minbuf= msifile= \
+ speed= blank= fs= ts= dev= gracetime= timeout= driver= driveropts= \
+ defpregap= pktsize= mcn= textfile= cuefile= )
+ track_options=( -audio -swab -data -mode2 -xa -xa1 -xa2 -xamix -cdi \
+ -isosize -pad -nopad -shorttrack -noshorttrack -preemp -nopreemp \
+ -copy -nocopy -scms isrc= index= padsize= pregap= tsize= )
+ # look if previous was either a file or a track option
+ track_mode=0
+ if [ $COMP_CWORD -gt 1 ]; then
+ if [ -f "$prev" ]; then
+ track_mode=1
+ else
+ for (( i=0; i < ${#track_options[@]}; i++ )); do
+ if [[ "${track_options[i]}" == "$prev" ]]; then
+ track_mode=1
+ break
+ fi
+ done
+ fi
+ fi
+
+ # files are always eligible completion
+ _filedir
+ # track options are always available
+ COMPREPLY=( "${COMPREPLY[@]}" \
+ $( compgen -W '${track_options[@]}' -- "$cur" ) )
+ # general options are no more available after file or track option
+ if [ $track_mode -eq 0 ]; then
+ COMPREPLY=( "${COMPREPLY[@]}" \
+ $( compgen -W '${generic_options[@]}' -- "$cur" ) )
+ fi
+ [[ ${#COMPREPLY[@]} == 1 && ${COMPREPLY[0]} != *= ]] && \
+ compopt +o nospace &>/dev/null
+} &&
+complete -F _cdrecord -o nospace cdrecord wodim
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/wol b/completions/wol
index 89a1a8ba..89a1a8ba 100644
--- a/contrib/wol
+++ b/completions/wol
diff --git a/contrib/wtf b/completions/wtf
index 2b6c4d01..a611978d 100644
--- a/contrib/wtf
+++ b/completions/wtf
@@ -25,7 +25,7 @@ _wtf()
COMPREPLY=( $( compgen -W "$( cut -f 1 -s $db ) -f" -- "${cur}" ) )
} &&
-complete -F _wtf -o filenames wtf
+complete -F _wtf wtf
# Local variables:
# mode: shell-script
diff --git a/contrib/wvdial b/completions/wvdial
index 101112ca..3b135f0a 100644
--- a/contrib/wvdial
+++ b/completions/wvdial
@@ -3,7 +3,7 @@
have wvdial &&
_wvdial()
{
- local cur prev config i IFS=$'\t\n'
+ local cur prev config i IFS=$'\n'
COMPREPLY=()
_get_comp_words_by_ref cur prev
@@ -23,7 +23,7 @@ _wvdial()
;;
*)
# start with global and personal config files
- config="/etc/wvdial.conf"$'\t'"$HOME/.wvdialrc"
+ config="/etc/wvdial.conf"$'\n'"$HOME/.wvdialrc"
# replace with command line config file if present
for (( i=1; i < COMP_CWORD; i++ )); do
if [[ "${COMP_WORDS[i]}" == "--config" ]]; then
diff --git a/contrib/xhost b/completions/xhost
index cec4adcf..cec4adcf 100644
--- a/contrib/xhost
+++ b/completions/xhost
diff --git a/contrib/xm b/completions/xm
index 4087a710..4087a710 100644
--- a/contrib/xm
+++ b/completions/xm
diff --git a/contrib/xmllint b/completions/xmllint
index 82feb4a3..bed3b42d 100644
--- a/contrib/xmllint
+++ b/completions/xmllint
@@ -18,19 +18,19 @@ _xmllint()
return 0
;;
--dtdvalid)
- _filedir dtd
+ _filedir 'dtd?(.gz)'
return 0
;;
--relaxng)
- _filedir rng
+ _filedir 'rng?(.gz)'
return 0
;;
--schema)
- _filedir xsd
+ _filedir 'xsd?(.gz)'
return 0
;;
--schematron)
- _filedir sch
+ _filedir 'sch?(.gz)'
return 0
;;
esac
@@ -42,9 +42,9 @@ _xmllint()
return 0
fi
- _filedir '@(*ml|htm|svg)'
+ _filedir '@(*ml|htm|svg|xs[dl]|rng|wsdl)?(.gz)'
} &&
-complete -F _xmllint -o filenames xmllint
+complete -F _xmllint xmllint
# Local variables:
# mode: shell-script
diff --git a/contrib/xmlwf b/completions/xmlwf
index 7109bcd3..74cf0812 100644
--- a/contrib/xmlwf
+++ b/completions/xmlwf
@@ -28,7 +28,7 @@ _xmlwf()
_filedir '@(*ml|htm|svg)'
} &&
-complete -F _xmlwf -o filenames xmlwf
+complete -F _xmlwf xmlwf
# Local variables:
# mode: shell-script
diff --git a/contrib/xmms b/completions/xmms
index 42c5402c..662e2faa 100644
--- a/contrib/xmms
+++ b/completions/xmms
@@ -14,12 +14,12 @@ _xmms()
--enqueue -m --show-main-window -i --sm-client-id \
-v --version' -- "$cur" ) )
else
- _filedir '@(mp[23]|MP[23]|ogg|OGG|wav|WAV|pls|m3u|xm|mod|s[3t]m|it|mtm|ult|flac)'
+ _filedir '@(mp[23]|ogg|wav|pls|m3u|xm|mod|s[3t]m|it|mtm|ult|flac)'
fi
} &&
-complete -F _xmms -o filenames xmms
+complete -F _xmms xmms
# Local variables:
# mode: shell-script
diff --git a/completions/xmodmap b/completions/xmodmap
new file mode 100644
index 00000000..cde9e7e1
--- /dev/null
+++ b/completions/xmodmap
@@ -0,0 +1,32 @@
+# xmodmap(1) completion
+
+have xmodmap &&
+_xmodmap()
+{
+ COMPREPLY=()
+ local cur prev
+ _get_comp_words_by_ref cur prev
+
+ case $prev in
+ -display|-e)
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-display -help -grammar -verbose -quiet -n
+ -e -pm -pk -pke -pp' -- "$cur" ) )
+ return 0
+ fi
+
+ _filedir
+} &&
+complete -F _xmodmap xmodmap
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/xrandr b/completions/xrandr
index 70de80f7..70de80f7 100644
--- a/contrib/xrandr
+++ b/completions/xrandr
diff --git a/completions/xrdb b/completions/xrdb
new file mode 100644
index 00000000..7307f013
--- /dev/null
+++ b/completions/xrdb
@@ -0,0 +1,37 @@
+# xrdb(1) completion
+
+have xrdb &&
+_xrdb()
+{
+ COMPREPLY=()
+ local cur prev
+ _get_comp_words_by_ref cur prev
+
+ case $prev in
+ -backup|-display|-help)
+ return 0
+ ;;
+ -cpp|-edit)
+ _filedir
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-help -display -all -global -screen -screens
+ -n -quiet -cpp -nocpp -symbols -query -load -override -merge
+ -remove -retain -edit -backup' -- "$cur" ) )
+ return 0
+ fi
+
+ _filedir
+} &&
+complete -F _xrdb xrdb
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/xsltproc b/completions/xsltproc
index f71d3f11..2782f805 100644
--- a/contrib/xsltproc
+++ b/completions/xsltproc
@@ -45,7 +45,7 @@ _xsltproc()
_filedir '@(xsl|xslt|xml)'
fi
} &&
-complete -F _xsltproc -o filenames xsltproc
+complete -F _xsltproc xsltproc
# Local variables:
# mode: shell-script
diff --git a/contrib/xz b/completions/xz
index 46420b01..89a8ac98 100644
--- a/contrib/xz
+++ b/completions/xz
@@ -52,11 +52,12 @@ _xz()
_expand || return 0
- local IFS=$'\t\n'
+ local IFS=$'\n'
+ _compopt_o_filenames
COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \
$( compgen -d -- "$cur" ) )
} &&
-complete -F _xz -o filenames xz
+complete -F _xz xz
# xzdec(1) completion
#
@@ -88,9 +89,9 @@ _xzdec()
$split && return 0
- _filedir xz # no lzma support here as of xz 4.999.8beta
+ _filedir xz # no lzma support here as of xz 4.999.9beta
} &&
-complete -F _xzdec -o filenames xzdec
+complete -F _xzdec xzdec
# Local variables:
# mode: shell-script
diff --git a/contrib/yp-tools b/completions/yp-tools
index 7252a129..7252a129 100644
--- a/contrib/yp-tools
+++ b/completions/yp-tools
diff --git a/contrib/yum-arch b/completions/yum-arch
index 3728335c..bb864af4 100644
--- a/contrib/yum-arch
+++ b/completions/yum-arch
@@ -13,7 +13,7 @@ _yum_arch()
_filedir -d
fi
} &&
-complete -F _yum_arch -o filenames yum-arch
+complete -F _yum_arch yum-arch
# Local variables:
# mode: shell-script
diff --git a/configure.ac b/configure.ac
index b6abcac5..0732138f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,7 @@
AC_PREREQ([2.59])
-AC_INIT([bash-completion], [1.2])
-AM_INIT_AUTOMAKE([foreign dejagnu dist-bzip2 -Wall -Werror])
-AC_CONFIG_FILES([Makefile test/Makefile])
+AC_INIT([bash-completion], [1.3])
+AM_INIT_AUTOMAKE([foreign dist-bzip2 no-dist-gzip -Wall -Werror])
+AC_SUBST(bashcompdir, $sysconfdir/bash_completion.d)
+AC_SUBST(helpersdir, $sysconfdir/bash_completion.d/helpers)
+AC_CONFIG_FILES([Makefile completions/Makefile completions/helpers/Makefile test/Makefile])
AC_OUTPUT
diff --git a/contrib/_subversion b/contrib/_subversion
deleted file mode 100644
index 06adf830..00000000
--- a/contrib/_subversion
+++ /dev/null
@@ -1,429 +0,0 @@
-# Use of this file is deprecated. Upstream completion is available in
-# subversion >= 0.12.0, use that instead.
-
-# svn completion
-
-have svn &&
-{
-_svn()
-{
- local cur prev commands options command
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- 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
-
- 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]}
-
- 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
-
- return 0
-}
-complete -F _svn -o filenames svn
-
-_svnadmin()
-{
- local cur prev commands options mode
-
- 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'
-
- 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]}
-
- 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
-
- return 0
-}
-complete -F _svnadmin -o default svnadmin
-
-_svnlook()
-{
- local cur prev commands options mode
-
- 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'
-
- 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'
- ;;
- 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
-
- return 0
-}
-complete -F _svnlook -o default svnlook
-}
-
-# Local variables:
-# mode: shell-script
-# sh-basic-offset: 4
-# sh-indent-comment: t
-# indent-tabs-mode: nil
-# End:
-# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/ipmitool b/contrib/ipmitool
deleted file mode 100644
index fc4ec71c..00000000
--- a/contrib/ipmitool
+++ /dev/null
@@ -1,38 +0,0 @@
-# bash completion for ipmitool
-
-have ipmitool &&
-_ipmitool()
-{
- local cur prev
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- case $prev in
- -I)
- COMPREPLY=( $( compgen -W 'open imb lan lanplus free' -- "$cur" ) )
- return 0
- ;;
- esac
-
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-h -V -v -c -d -I -H -p -U -f -S -a \
- -e -C -k -y -K -A -P -E -K -m -b -r -B -T -l -o -O' -- "$cur" ) )
- else
- COMPREPLY=( $( compgen -W 'raw i2c spd lan chassis power event \
- mc sdr sensor fru gendev sel pef sol tsol isol user \
- channel session sunoem kontronoem picmg fwum firewall \
- exec set hpm ekanalyzer' -- "$cur" ) )
- fi
-
-} &&
-complete -F _ipmitool ipmitool
-
-# Local variables:
-# mode: shell-script
-# sh-basic-offset: 4
-# sh-indent-comment: t
-# indent-tabs-mode: nil
-# End:
-# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/perl b/contrib/perl
deleted file mode 100644
index 67996f94..00000000
--- a/contrib/perl
+++ /dev/null
@@ -1,127 +0,0 @@
-# bash completion for perl
-
-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" ) )
- __ltrim_colon_completions "$1"
-}
-
-_perl()
-{
- local cur prev prefix temp
- local optPrefix optSuffix
-
- COMPREPLY=()
- _get_comp_words_by_ref -n : cur prev
- prefix=""
-
- # If option not followed by whitespace, reassign prev and cur
- if [[ "$cur" == -?* ]]; then
- temp=$cur
- prev=${temp:0:2}
- cur=${temp:2}
- optPrefix=-P$prev
- optSuffix=-S/
- prefix=$prev
- fi
-
- # only handle module completion for now
- case $prev in
- -I|-x)
- local IFS=$'\t\n'
- COMPREPLY=( $( compgen -d $optPrefix $optSuffix -- "$cur" ) )
- return 0
- ;;
- -m|-M)
- _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" ) )
- else
- _filedir
- fi
-}
-complete -F _perl -o nospace -o filenames perl
-
-_perldoc()
-{
- local cur prev prefix temp
-
- COMPREPLY=()
- _get_comp_words_by_ref -n : cur prev
- prefix=""
-
- # completing an option (may or may not be separated by a space)
- if [[ "$cur" == -?* ]]; then
- temp=$cur
- prev=${temp:0:2}
- cur=${temp:2}
- prefix=$prev
- fi
-
- # complete builtin perl functions
- case $prev in
- -f)
- COMPREPLY=( $( compgen -W 'chomp chop chr crypt hex index lc \
- lcfirst length oct ord pack q qq reverse rindex sprintf \
- substr tr uc ucfirst y m pos quotemeta s split study qr abs \
- atan2 cos exp hex int log oct rand sin sqrt srand pop push \
- 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 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 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 \
- ref tie tied untie use accept bind connect getpeername \
- getsockname getsockopt listen recv send setsockopt shutdown \
- socket socketpair msgctl msgget msgrcv msgsnd semctl semget \
- semop shmctl shmget shmread shmwrite endgrent endhostent \
- endnetent endpwent getgrent getgrgid getgrnam getlogin \
- getpwent getpwnam getpwuid setgrent setpwent endprotoent \
- endservent gethostbyaddr gethostbyname gethostent \
- getnetbyaddr getnetbyname getnetent getprotobyname \
- getprotobynumber getprotoent getservbyname getservbyport \
- getservent sethostent setnetent setprotoent setservent \
- gmtime localtime time times lock' -- "$cur" ) )
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-h -v -t -u -m -l -F -X -f -q' -- "$cur" ))
- else
- # return available modules (unless it is clearly a file)
- if [[ "$cur" != */* ]]; then
- _perlmodules "$cur"
- COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W \
- '$( PAGER=/bin/cat man perl | \
- sed -ne "/perl.*Perl overview/,/perlwin32/p" | \
- awk "\$NF=2 { print \$1}" | command grep perl )' -- "$cur" ) )
- fi
- _filedir '@(pl|PL|pm|PM|pod|POD)'
- fi
-}
-complete -F _perldoc -o bashdefault perldoc
-}
-
-# Local variables:
-# mode: shell-script
-# sh-basic-offset: 4
-# sh-indent-comment: t
-# indent-tabs-mode: nil
-# End:
-# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/python b/contrib/python
deleted file mode 100644
index 9d8fcc9d..00000000
--- a/contrib/python
+++ /dev/null
@@ -1,58 +0,0 @@
-# bash completion for python
-
-have python &&
-_python()
-{
- local prev cur i
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- case $prev in
- -Q)
- COMPREPLY=( $( compgen -W "old new warn warnall" -- "$cur" ) )
- return 0
- ;;
- -W)
- COMPREPLY=( $( compgen -W "ignore default all module once error" \
- -- "$cur" ) )
- return 0
- ;;
- -c)
- _filedir '@(py|pyc|pyo)'
- return 0
- ;;
- !(python|-?))
- [[ ${COMP_WORDS[COMP_CWORD-2]} != -@(Q|W) ]] && _filedir
- ;;
- esac
-
-
- # if '-c' is already given, complete all kind of files.
- for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
- if [[ ${COMP_WORDS[i]} == -c ]]; then
- _filedir
- fi
- done
-
-
- if [[ "$cur" != -* ]]; then
- _filedir '@(py|pyc|pyo)'
- else
- COMPREPLY=( $( compgen -W "- -d -E -h -i -O -Q -S -t -u \
- -U -v -V -W -x -c" -- "$cur" ) )
- fi
-
-
-
- return 0
-} &&
-complete -F _python -o filenames python
-
-# Local variables:
-# mode: shell-script
-# 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
deleted file mode 100644
index 9b3e2676..00000000
--- a/contrib/strace
+++ /dev/null
@@ -1,102 +0,0 @@
-# bash completion for strace
-
-have strace &&
-_strace()
-{
- local cur prev offset i syscalls arch unistd
-
- # check if we're still completing strace
- offset=0
- for (( i=1; i <= COMP_CWORD; i++ )); do
- case ${COMP_WORDS[$i]} in
- -o|-e|-p)
- i=$((i+1))
- continue
- ;;
- -*)
- continue
- ;;
- esac
- offset=$i
- break
- done
-
- if [ $offset -gt 0 ]; then
- # FAIL: _command_offset is not defined anywhere. Guillame?
- _command_offset $offset
- else
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- case $prev in
- -e)
- if [[ "$cur" == *=* ]]; then
- prev=${cur/=*/}
- cur=${cur/*=/}
-
- # Import arch-specific syscalls -- not foolproof IMHO
- #+ --David Paleino
- arch=$(command uname -m)
- syscalls=$(awk '/^#define __NR/ {print $2}' \
- /usr/include/asm/unistd.h | sed -e \
- 's/__NR_//')
- if [ -z "$syscalls" ]; then
- if [[ "$arch" == *86 ]]; then
- unistd=/usr/include/asm/unistd_32.h
- else
- unistd=/usr/include/asm/unistd_64.h
- fi
- syscalls=$(awk '/^#define __NR/ {print $2}' \
- $unistd | sed -e 's/__NR_//')
- fi
-
- case $prev in
- trace)
- COMPREPLY=( $( compgen -W "$syscalls file process \
- network signal ipc desc all none" -- "$cur") )
- return 0
- ;;
- esac
- else
- COMPREPLY=( $( compgen -S"=" -W 'trace abbrev \
- verbose raw signal read write' -- "$cur" ) )
- fi
- return 0
- ;;
- -o)
- _filedir
- return 0
- ;;
- -p)
- _pids
- return 0
- ;;
- -S)
- COMPREPLY=( $( compgen -W 'time calls name nothing' -- "$cur" ) )
- return 0
- ;;
- -u)
- COMPREPLY=( $( compgen -u -- "$cur" ) )
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- 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
- COMPREPLY=( $( compgen -c -- "$cur" ) )
- fi
- fi
-} &&
-complete -F _strace -o default strace
-
-# Local variables:
-# mode: shell-script
-# sh-basic-offset: 4
-# sh-indent-comment: t
-# indent-tabs-mode: nil
-# End:
-# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/wodim b/contrib/wodim
deleted file mode 100644
index 5fa69a8b..00000000
--- a/contrib/wodim
+++ /dev/null
@@ -1,84 +0,0 @@
-# bash completion for cdrecord/wodim
-
-have cdrecord || have wodim &&
-_cdrecord()
-{
- local cur prev i generic_options track_options track_mode
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- # foo=bar style option
- if [[ "$cur" == *=* ]]; then
- prev=${cur/=*/}
- cur=${cur/*=/}
- case $prev in
- textfile|cuefile)
- _filedir
- return 0
- ;;
- blank)
- COMPREPLY=( $( compgen -W 'help all fast \
- track unreserve trtail unclose session' \
- -- "$cur" ) )
- return 0
- ;;
- driveropts)
- COMPREPLY=( $( compgen -W 'burnfree noburnfree\
- varirec= audiomaster forcespeed noforcespeed\
- speedread nospeedread singlesession \
- nosinglesession hidecdr nohidecdr tattooinfo\
- tattoofile=' -- "$cur" ) )
- return 0
- ;;
- esac
- fi
-
- 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 \
- -abort -overburn -ignsize -useinfo -packet -noclose \
- -text debug= kdebug= kd= minbuf= speed= blank= fs= \
- dev= gracetime= timeout= driver= driveropts= \
- defpregap= pktsize= mcn= textfile= cuefile=)
- track_options=(-audio -swab -data -mode2 -xa -xa1 -xa2 -xamix -cdi \
- -isosize -pad padsize= -nopad -shorttrack -noshorttrack\
- pregap= -preemp -nopreemp -copy -nocopy -scms tcsize= \
- isrc= index=)
- # look if previous was either a file or a track option
- track_mode=0
- if [ $COMP_CWORD -gt 1 ]; then
- if [ -f "$prev" ]; then
- track_mode=1
- else
- for (( i=0; i < ${#track_options[@]}; i++ )); do
- if [[ "${track_options[i]}" == "$prev" ]]; then
- track_mode=1
- break
- fi
- done
- fi
- fi
-
- # files are always eligible completion
- _filedir
- # track options are always available
- COMPREPLY=( "${COMPREPLY[@]}" \
- $( compgen -W '${track_options[@]}' -- "$cur" ) )
- # general options are no more available after file or track option
- if [ $track_mode -eq 0 ]; then
- COMPREPLY=( "${COMPREPLY[@]}" \
- $( compgen -W '${generic_options[@]}' -- "$cur" ) )
- fi
-
-} &&
-complete -F _cdrecord -o filenames cdrecord wodim
-
-# Local variables:
-# mode: shell-script
-# sh-basic-offset: 4
-# sh-indent-comment: t
-# indent-tabs-mode: nil
-# End:
-# ex: ts=4 sw=4 et filetype=sh
diff --git a/doc/bash_completion.txt b/doc/bash_completion.txt
index c7e7a2b9..8cd3de24 100644
--- a/doc/bash_completion.txt
+++ b/doc/bash_completion.txt
@@ -17,9 +17,12 @@ Environment variables
remotely checked-out files. This requires passwordless access to the
remote repository. Default is unset.
+*COMP_IWLIST_SCAN*::
+ If set and not null, `iwconfig` completion will try to complete on
+ available wireless networks identifiers. Default is unset.
*COMP_KNOWN_HOSTS_WITH_HOSTFILE*::
- If set and not null (default), known_hosts completion will complement
+ If set and not null (default), known hosts completion will complement
hostnames from ssh's known_hosts_files with hostnames taken from the file
specified by the HOSTFILE shell variable (compgen -A hostname). If null,
known_hosts completion will omit hostnames from HOSTFILE. Omitting
@@ -27,6 +30,12 @@ Environment variables
local web development or ad-blocking.
+*COMP_KNOWN_HOSTS_WITH_AVAHI*::
+ If set and not null, known hosts completion will try to use `avahi-browse`
+ for additional completions. This may be a slow operation in some setups.
+ Default is unset.
+
+
*COMP_TAR_INTERNAL_PATHS*::
If set and not null *before* sourcing bash_completion, `tar` completion
will do correct path completion for tar file contents. If unset or null,
diff --git a/doc/styleguide.txt b/doc/styleguide.txt
index 4dbd5732..24f28636 100644
--- a/doc/styleguide.txt
+++ b/doc/styleguide.txt
@@ -54,6 +54,18 @@ is preferable because anyone, with any keyboard layout, is able to
type it. Backticks aren't always available, without doing strange
key combinations.
+-o filenames
+------------
+
+As a rule of thumb, do not use "complete -o filenames". Doing it makes
+it take effect for all completions from the affected function, which
+may break things if some completions from the function must not be
+escaped as filenames. Instead, use the _compopt_o_filenames function
+to turn on "-o filenames" behavior dynamically when returning
+completions that need that kind of processing (e.g. file and command
+names). The _filedir and _filedir_xspec helpers do this automatically
+whenever they return some completions.
+
/////////////////////////////////////////
case/esac vs if
---------------
diff --git a/test/Makefile.am b/test/Makefile.am
index d955be8a..82f6df90 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -1,8 +1,16 @@
DEJATOOL = completion install unit
-AM_RUNTESTFLAGS = --outdir log
+AM_RUNTESTFLAGS = --outdir log --ignore $(PACKAGE).log
EXTRA_DIST = completion \
config \
fixtures \
lib \
unit
+
+all:
+ $(mkdir_p) log tmp
+
+distclean-local:
+ rm -rf log tmp
+
+AUTOMAKE_OPTIONS = dejagnu
diff --git a/test/completion/aclocal.exp b/test/completion/aclocal.exp
new file mode 100644
index 00000000..477921a9
--- /dev/null
+++ b/test/completion/aclocal.exp
@@ -0,0 +1 @@
+assert_source_completions aclocal
diff --git a/test/completion/acroread.exp b/test/completion/acroread.exp
index c3635ae8..6ee03d6e 100644
--- a/test/completion/acroread.exp
+++ b/test/completion/acroread.exp
@@ -2,11 +2,11 @@ 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/@$"
+set expected "^$cmd\r\ncomplete -F _filedir_xspec acroread\r\n/@$"
expect {
-re $expected { pass "$test" }
-re /@ { fail "$test at prompt" }
}; # expect
-source "lib/completions/acroread.exp"
+source "$::srcdir/lib/completions/acroread.exp"
diff --git a/test/completion/autoheader.exp b/test/completion/autoheader.exp
new file mode 100644
index 00000000..b797371a
--- /dev/null
+++ b/test/completion/autoheader.exp
@@ -0,0 +1 @@
+assert_source_completions autoheader
diff --git a/test/completion/autoreconf.exp b/test/completion/autoreconf.exp
new file mode 100644
index 00000000..337d11f7
--- /dev/null
+++ b/test/completion/autoreconf.exp
@@ -0,0 +1 @@
+assert_source_completions autoreconf
diff --git a/test/completion/autoscan.exp b/test/completion/autoscan.exp
new file mode 100644
index 00000000..9fc76858
--- /dev/null
+++ b/test/completion/autoscan.exp
@@ -0,0 +1 @@
+assert_source_completions autoscan
diff --git a/test/completion/autoupdate.exp b/test/completion/autoupdate.exp
new file mode 100644
index 00000000..f56f4c6d
--- /dev/null
+++ b/test/completion/autoupdate.exp
@@ -0,0 +1 @@
+assert_source_completions autoupdate
diff --git a/test/completion/badblocks.exp b/test/completion/badblocks.exp
new file mode 100644
index 00000000..74bfcd5d
--- /dev/null
+++ b/test/completion/badblocks.exp
@@ -0,0 +1 @@
+assert_source_completions badblocks
diff --git a/test/completion/crontab.exp b/test/completion/crontab.exp
new file mode 100644
index 00000000..2a649491
--- /dev/null
+++ b/test/completion/crontab.exp
@@ -0,0 +1 @@
+assert_source_completions crontab
diff --git a/test/completion/dumpe2fs.exp b/test/completion/dumpe2fs.exp
new file mode 100644
index 00000000..22d1523c
--- /dev/null
+++ b/test/completion/dumpe2fs.exp
@@ -0,0 +1 @@
+assert_source_completions dumpe2fs
diff --git a/test/completion/e2freefrag.exp b/test/completion/e2freefrag.exp
new file mode 100644
index 00000000..713ee236
--- /dev/null
+++ b/test/completion/e2freefrag.exp
@@ -0,0 +1 @@
+assert_source_completions e2freefrag
diff --git a/test/completion/e2label.exp b/test/completion/e2label.exp
new file mode 100644
index 00000000..2383c98e
--- /dev/null
+++ b/test/completion/e2label.exp
@@ -0,0 +1 @@
+assert_source_completions e2label
diff --git a/test/completion/ether-wake.exp b/test/completion/ether-wake.exp
new file mode 100644
index 00000000..602ba271
--- /dev/null
+++ b/test/completion/ether-wake.exp
@@ -0,0 +1 @@
+assert_source_completions ether-wake
diff --git a/test/completion/filefrag.exp b/test/completion/filefrag.exp
new file mode 100644
index 00000000..eeb5f8ce
--- /dev/null
+++ b/test/completion/filefrag.exp
@@ -0,0 +1 @@
+assert_source_completions filefrag
diff --git a/test/completion/finger.exp b/test/completion/finger.exp
index cc77abe5..7c7b8a26 100644
--- a/test/completion/finger.exp
+++ b/test/completion/finger.exp
@@ -1,6 +1 @@
-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"
+assert_source_completions finger
diff --git a/test/completion/freerdp.exp b/test/completion/freerdp.exp
new file mode 100644
index 00000000..5ca649a2
--- /dev/null
+++ b/test/completion/freerdp.exp
@@ -0,0 +1 @@
+assert_source_completions xfreerdp
diff --git a/test/completion/growisofs.exp b/test/completion/growisofs.exp
new file mode 100644
index 00000000..57cb991b
--- /dev/null
+++ b/test/completion/growisofs.exp
@@ -0,0 +1 @@
+assert_source_completions growisofs
diff --git a/test/completion/hping2.exp b/test/completion/hping2.exp
new file mode 100644
index 00000000..e9df7c2b
--- /dev/null
+++ b/test/completion/hping2.exp
@@ -0,0 +1 @@
+assert_source_completions hping2
diff --git a/test/completion/iftop.exp b/test/completion/iftop.exp
new file mode 100644
index 00000000..5ec1cb57
--- /dev/null
+++ b/test/completion/iftop.exp
@@ -0,0 +1 @@
+assert_source_completions iftop
diff --git a/test/completion/ip.exp b/test/completion/ip.exp
new file mode 100644
index 00000000..e80841e8
--- /dev/null
+++ b/test/completion/ip.exp
@@ -0,0 +1 @@
+assert_source_completions ip
diff --git a/test/completion/ipmitool.exp b/test/completion/ipmitool.exp
new file mode 100644
index 00000000..a5c72a78
--- /dev/null
+++ b/test/completion/ipmitool.exp
@@ -0,0 +1 @@
+assert_source_completions ipmitool
diff --git a/test/completion/lrzip.exp b/test/completion/lrzip.exp
new file mode 100644
index 00000000..60616f00
--- /dev/null
+++ b/test/completion/lrzip.exp
@@ -0,0 +1 @@
+assert_source_completions lrzip
diff --git a/test/completion/lsof.exp b/test/completion/lsof.exp
new file mode 100644
index 00000000..98baab04
--- /dev/null
+++ b/test/completion/lsof.exp
@@ -0,0 +1 @@
+assert_source_completions lsof
diff --git a/test/completion/sh.exp b/test/completion/sh.exp
new file mode 100644
index 00000000..599f3b29
--- /dev/null
+++ b/test/completion/sh.exp
@@ -0,0 +1 @@
+assert_source_completions sh
diff --git a/test/completion/sqlite3.exp b/test/completion/sqlite3.exp
new file mode 100644
index 00000000..88195e0d
--- /dev/null
+++ b/test/completion/sqlite3.exp
@@ -0,0 +1 @@
+assert_source_completions sqlite3
diff --git a/test/completion/sysbench.exp b/test/completion/sysbench.exp
new file mode 100644
index 00000000..68da0a7a
--- /dev/null
+++ b/test/completion/sysbench.exp
@@ -0,0 +1 @@
+assert_source_completions sysbench
diff --git a/test/completion/tune2fs.exp b/test/completion/tune2fs.exp
new file mode 100644
index 00000000..db034967
--- /dev/null
+++ b/test/completion/tune2fs.exp
@@ -0,0 +1 @@
+assert_source_completions tune2fs
diff --git a/test/completion/xmodmap.exp b/test/completion/xmodmap.exp
new file mode 100644
index 00000000..a80bb027
--- /dev/null
+++ b/test/completion/xmodmap.exp
@@ -0,0 +1 @@
+assert_source_completions xmodmap
diff --git a/test/completion/xrdb.exp b/test/completion/xrdb.exp
new file mode 100644
index 00000000..522ac311
--- /dev/null
+++ b/test/completion/xrdb.exp
@@ -0,0 +1 @@
+assert_source_completions xrdb
diff --git a/test/config/bashrc b/test/config/bashrc
index ddf06339..fd72b816 100644
--- a/test/config/bashrc
+++ b/test/config/bashrc
@@ -7,13 +7,12 @@ 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/@
+ # Set fixed prompt `/@'
TESTDIR=$(pwd)
-export PS1='$(wd=$(pwd); echo ${wd#$TESTDIR}/)@'
+export PS1='/@'
export PS2='> '
# Configure readline
-export INPUTRC=$TESTDIR/config/inputrc
+export INPUTRC=$SRCDIR/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
@@ -31,7 +30,7 @@ unset -v \
COMP_TAR_INTERNAL_PATHS
# Load bash testsuite helper functions
-. lib/library.sh
+. $SRCDIR/lib/library.sh
# Local variables:
# mode: shell-script
diff --git a/test/config/default.exp b/test/config/default.exp
index d1c04e71..1eb47a2c 100644
--- a/test/config/default.exp
+++ b/test/config/default.exp
@@ -1,23 +1,21 @@
- # Set default expect fallback routines
+# Set default expect fallback routines
expect_after {
eof {
if {[info exists test]} {
fail "$test at eof"
- } else {
+ } elseif {[info level] > 0} {
fail "[info level 1] at eof"
- }; # if
- }; # eof
+ } else {
+ fail "eof"
+ }
+ }
timeout {
if {[info exists test]} {
fail "$test at timeout"
- } else {
+ } elseif {[info level] > 0} {
fail "[info level 1] at timeout"
- }; # if
- }; # timeout
-}; # expect_after()
-
-
- # Call tool_start(), if available
-if { [info procs "${tool}_start"] != "" } {
- ${tool}_start
-}; # if
+ } else {
+ fail "timeout"
+ }
+ }
+}
diff --git a/test/fixtures/_filedir/ext/ii.E1 b/test/fixtures/_filedir/ext/ii.E1
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/_filedir/ext/ii.E1
diff --git a/test/fixtures/_known_hosts_real/known_hosts b/test/fixtures/_known_hosts_real/known_hosts
index bf39e848..f655eaa3 100644
--- a/test/fixtures/_known_hosts_real/known_hosts
+++ b/test/fixtures/_known_hosts_real/known_hosts
@@ -4,3 +4,10 @@ doo
ike ssh-rsa qwerty1234/Qwerty+1234==
jub,10.0.0.1
kyl,100.0.0.2
+[10.10.0.3]:10022
+[blah]:1234
+fd00:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:5555
+fe80::123:0xff:dead:beef%eth0
+1111:2222:3333:4444:5555:6666:xxxx:abab
+11xx:2222:3333:4444:5555:6666:xxxx:abab
+::42
diff --git a/test/fixtures/acroread/bar b/test/fixtures/acroread/bar
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/acroread/bar
diff --git a/test/fixtures/acroread/foo.d/.gitignore b/test/fixtures/acroread/foo.d/.gitignore
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/acroread/foo.d/.gitignore
diff --git a/test/fixtures/acroread/t.pdf b/test/fixtures/acroread/t.pdf
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/acroread/t.pdf
diff --git a/test/fixtures/man/man1/bar.1.bz2 b/test/fixtures/man/man1/bar.1.bz2
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/man/man1/bar.1.bz2
diff --git a/test/fixtures/man/man1/foo.1 b/test/fixtures/man/man1/foo.1
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/man/man1/foo.1
diff --git a/test/fixtures/man/man3/Bash::Completion.3pm.gz b/test/fixtures/man/man3/Bash::Completion.3pm.gz
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/man/man3/Bash::Completion.3pm.gz
diff --git a/test/fixtures/scp/known_hosts b/test/fixtures/scp/known_hosts
index d54a04d0..2dfa4b6f 100644
--- a/test/fixtures/scp/known_hosts
+++ b/test/fixtures/scp/known_hosts
@@ -2,3 +2,4 @@
|1|def
doo
ike ssh-rsa qwerty1234/Qwerty+1234==
+[blah]:1234
diff --git a/test/fixtures/sftp/known_hosts b/test/fixtures/sftp/known_hosts
index d54a04d0..6538eb4b 100644
--- a/test/fixtures/sftp/known_hosts
+++ b/test/fixtures/sftp/known_hosts
@@ -2,3 +2,4 @@
|1|def
doo
ike ssh-rsa qwerty1234/Qwerty+1234==
+[10.10.10.10]:2222
diff --git a/test/generate b/test/generate
index aa282a2c..dc400cb6 100755
--- a/test/generate
+++ b/test/generate
@@ -32,12 +32,12 @@ generate_test_lib_completions() {
cat <<EXPECT > "$path"
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completion.exp b/test/lib/completion.exp
index ea2a3d8d..88e92d50 100644
--- a/test/lib/completion.exp
+++ b/test/lib/completion.exp
@@ -1,4 +1,4 @@
-source ${srcdir}/lib/library.exp
+source $::srcdir/lib/library.exp
proc completion_exit {} {
@@ -6,6 +6,14 @@ proc completion_exit {} {
}
+proc completion_init {test_file_name} {
+ # Call completion_start() only once
+ if {! [info exists ::BASH_VERSINFO]} {
+ completion_start
+ }
+}
+
+
proc completion_start {} {
start_interactive_test
}
diff --git a/test/lib/completions/a2ps.exp b/test/lib/completions/a2ps.exp
index 796e14cc..77cd07f5 100644
--- a/test/lib/completions/a2ps.exp
+++ b/test/lib/completions/a2ps.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/abook.exp b/test/lib/completions/abook.exp
index 3f4e301f..43f62729 100644
--- a/test/lib/completions/abook.exp
+++ b/test/lib/completions/abook.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/aclocal.exp b/test/lib/completions/aclocal.exp
new file mode 100644
index 00000000..da133aa8
--- /dev/null
+++ b/test/lib/completions/aclocal.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "aclocal "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/acroread.exp b/test/lib/completions/acroread.exp
index 4f11f905..f627d34e 100644
--- a/test/lib/completions/acroread.exp
+++ b/test/lib/completions/acroread.exp
@@ -1,19 +1,17 @@
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()
+ assert_env_unmodified {/OLDPWD/d}
+}
setup
-assert_complete {"bar bar.d/" foo.d/ t.pdf} "acroread fixtures/shared/default/"
+assert_complete_dir {foo.d/ t.pdf} "acroread " $::srcdir/fixtures/acroread
sync_after_int
diff --git a/test/lib/completions/add_members.exp b/test/lib/completions/add_members.exp
index 02cd762d..46c7a688 100644
--- a/test/lib/completions/add_members.exp
+++ b/test/lib/completions/add_members.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/alias.exp b/test/lib/completions/alias.exp
index e6b88d00..9dba4e62 100644
--- a/test/lib/completions/alias.exp
+++ b/test/lib/completions/alias.exp
@@ -3,13 +3,13 @@ proc setup {} {
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
@@ -34,7 +34,7 @@ expect {
-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
diff --git a/test/lib/completions/animate.exp b/test/lib/completions/animate.exp
index 26065d25..12314d79 100644
--- a/test/lib/completions/animate.exp
+++ b/test/lib/completions/animate.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/ant.exp b/test/lib/completions/ant.exp
index 81294439..de57f24a 100644
--- a/test/lib/completions/ant.exp
+++ b/test/lib/completions/ant.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/apache2ctl.exp b/test/lib/completions/apache2ctl.exp
index e63abb16..88e53fc2 100644
--- a/test/lib/completions/apache2ctl.exp
+++ b/test/lib/completions/apache2ctl.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/apt-build.exp b/test/lib/completions/apt-build.exp
index fd09d0eb..01ff04b4 100644
--- a/test/lib/completions/apt-build.exp
+++ b/test/lib/completions/apt-build.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/apt-cache.exp b/test/lib/completions/apt-cache.exp
index 5336beab..63be48a8 100644
--- a/test/lib/completions/apt-cache.exp
+++ b/test/lib/completions/apt-cache.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/apt-get.exp b/test/lib/completions/apt-get.exp
index 6bd0f3a2..66887bd0 100644
--- a/test/lib/completions/apt-get.exp
+++ b/test/lib/completions/apt-get.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/aptitude.exp b/test/lib/completions/aptitude.exp
index dde6d26e..e6e82abb 100644
--- a/test/lib/completions/aptitude.exp
+++ b/test/lib/completions/aptitude.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/arch.exp b/test/lib/completions/arch.exp
index 9f7114c4..0550c76b 100644
--- a/test/lib/completions/arch.exp
+++ b/test/lib/completions/arch.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/arpspoof.exp b/test/lib/completions/arpspoof.exp
index 7db79f50..91ef5182 100644
--- a/test/lib/completions/arpspoof.exp
+++ b/test/lib/completions/arpspoof.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/aspell.exp b/test/lib/completions/aspell.exp
index 4edeb03b..9dd5f61a 100644
--- a/test/lib/completions/aspell.exp
+++ b/test/lib/completions/aspell.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/autoconf.exp b/test/lib/completions/autoconf.exp
index 4a44b651..53b096db 100644
--- a/test/lib/completions/autoconf.exp
+++ b/test/lib/completions/autoconf.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/autoheader.exp b/test/lib/completions/autoheader.exp
new file mode 100644
index 00000000..d85d4606
--- /dev/null
+++ b/test/lib/completions/autoheader.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "autoheader "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/automake.exp b/test/lib/completions/automake.exp
index cf27364a..f875da56 100644
--- a/test/lib/completions/automake.exp
+++ b/test/lib/completions/automake.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/autoreconf.exp b/test/lib/completions/autoreconf.exp
new file mode 100644
index 00000000..98808fb2
--- /dev/null
+++ b/test/lib/completions/autoreconf.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "autoreconf "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/autorpm.exp b/test/lib/completions/autorpm.exp
index 99b743ca..2ae4ff80 100644
--- a/test/lib/completions/autorpm.exp
+++ b/test/lib/completions/autorpm.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/autoscan.exp b/test/lib/completions/autoscan.exp
new file mode 100644
index 00000000..f75da812
--- /dev/null
+++ b/test/lib/completions/autoscan.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "autoscan "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/autoupdate.exp b/test/lib/completions/autoupdate.exp
new file mode 100644
index 00000000..c83912dd
--- /dev/null
+++ b/test/lib/completions/autoupdate.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "autoupdate "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/awk.exp b/test/lib/completions/awk.exp
index 4288adbf..260dabcc 100644
--- a/test/lib/completions/awk.exp
+++ b/test/lib/completions/awk.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/badblocks.exp b/test/lib/completions/badblocks.exp
new file mode 100644
index 00000000..d453b5bd
--- /dev/null
+++ b/test/lib/completions/badblocks.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "badblocks "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/bash.exp b/test/lib/completions/bash.exp
index 4caf58fc..bf01e76d 100644
--- a/test/lib/completions/bash.exp
+++ b/test/lib/completions/bash.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/bc.exp b/test/lib/completions/bc.exp
index c437d037..23c22b62 100644
--- a/test/lib/completions/bc.exp
+++ b/test/lib/completions/bc.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/bison.exp b/test/lib/completions/bison.exp
index a3dea1e0..4bbb59fa 100644
--- a/test/lib/completions/bison.exp
+++ b/test/lib/completions/bison.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/bk.exp b/test/lib/completions/bk.exp
index 4915136e..b652e6b0 100644
--- a/test/lib/completions/bk.exp
+++ b/test/lib/completions/bk.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/brctl.exp b/test/lib/completions/brctl.exp
index d87002a2..57c9edff 100644
--- a/test/lib/completions/brctl.exp
+++ b/test/lib/completions/brctl.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/btdownloadcurses.py.exp b/test/lib/completions/btdownloadcurses.py.exp
index 9dc0ba5a..71a00de7 100644
--- a/test/lib/completions/btdownloadcurses.py.exp
+++ b/test/lib/completions/btdownloadcurses.py.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/btdownloadgui.py.exp b/test/lib/completions/btdownloadgui.py.exp
index 03897a53..65f56776 100644
--- a/test/lib/completions/btdownloadgui.py.exp
+++ b/test/lib/completions/btdownloadgui.py.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/btdownloadheadless.py.exp b/test/lib/completions/btdownloadheadless.py.exp
index 69c62950..3c833bb8 100644
--- a/test/lib/completions/btdownloadheadless.py.exp
+++ b/test/lib/completions/btdownloadheadless.py.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/bzip2.exp b/test/lib/completions/bzip2.exp
index e5389a2a..2813dd0e 100644
--- a/test/lib/completions/bzip2.exp
+++ b/test/lib/completions/bzip2.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/c++.exp b/test/lib/completions/c++.exp
index 1fe4bb13..4dffb042 100644
--- a/test/lib/completions/c++.exp
+++ b/test/lib/completions/c++.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/cancel.exp b/test/lib/completions/cancel.exp
index 24ca47c4..f4a03473 100644
--- a/test/lib/completions/cancel.exp
+++ b/test/lib/completions/cancel.exp
@@ -1,18 +1,18 @@
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"]} {
+if {[assert_exec {lp -H hold $::srcdir/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]
@@ -22,7 +22,7 @@ if {[assert_exec {lp -H hold fixtures/shared/default/foo} job "" "untested"]} {
assert_complete $jobs "cancel "
# Remove/cancel the test print job
assert_exec "cancel $job_id"
-}; # if
+}
sync_after_int
diff --git a/test/lib/completions/cardctl.exp b/test/lib/completions/cardctl.exp
index b5d7e88d..9df90f48 100644
--- a/test/lib/completions/cardctl.exp
+++ b/test/lib/completions/cardctl.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/cat.exp b/test/lib/completions/cat.exp
index 46e8775f..01b3659e 100644
--- a/test/lib/completions/cat.exp
+++ b/test/lib/completions/cat.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/cc.exp b/test/lib/completions/cc.exp
index 1d63d006..eb722dea 100644
--- a/test/lib/completions/cc.exp
+++ b/test/lib/completions/cc.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/cd.exp b/test/lib/completions/cd.exp
index 58233575..55bae158 100644
--- a/test/lib/completions/cd.exp
+++ b/test/lib/completions/cd.exp
@@ -1,18 +1,18 @@
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
+assert_complete {"bar bar.d/" foo.d/} "cd $::srcdir/fixtures/shared/default/" $test
sync_after_int
@@ -20,16 +20,16 @@ sync_after_int
set test "Tab should complete cd at cursor position"
# Try completion
-set cmd "cd fixtures/shared/default/foo"
+set cmd "cd $::srcdir/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 "cd $::srcdir/fixtures/shared/default/foo\b\b\b\r\n(\.svn/ +|)bar bar.d/ +foo.d/ *(\.svn/ *|)\r\n/@cd $::srcdir/fixtures/shared/default/foo\b\b\b$" { pass "$test" }
+ -re "^cd $::srcdir/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
@@ -37,11 +37,13 @@ sync_after_int
set test "Tab should complete CDPATH"
# Set CDPATH
+assert_bash_exec "declare -p CDPATH &>/dev/null && OLDCDPATH=\$CDPATH || :"
assert_bash_exec "CDPATH=\$PWD";
-assert_complete "fixtures/shared/default/foo.d/" "cd fixtures/shared/default/fo" $test
+assert_complete "$::srcdir/fixtures/shared/default/foo.d/" \
+ "cd $::srcdir/fixtures/shared/default/fo" $test -nospace -expect-cmd-minus fo
sync_after_int
# Reset CDPATH
-assert_bash_exec "unset CDPATH"
+assert_bash_exec "declare -p OLDCDPATH &>/dev/null && CDPATH=\$OLDCDPATH || unset CDPATH && unset OLDCDPATH"
teardown
diff --git a/test/lib/completions/cdrecord.exp b/test/lib/completions/cdrecord.exp
index d369f79d..192d2ded 100644
--- a/test/lib/completions/cdrecord.exp
+++ b/test/lib/completions/cdrecord.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/change_pw.exp b/test/lib/completions/change_pw.exp
index ca9bcdbd..28301941 100644
--- a/test/lib/completions/change_pw.exp
+++ b/test/lib/completions/change_pw.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/check_db.exp b/test/lib/completions/check_db.exp
index ca59a715..fe34ead2 100644
--- a/test/lib/completions/check_db.exp
+++ b/test/lib/completions/check_db.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/check_perms.exp b/test/lib/completions/check_perms.exp
index a58995b0..b40b78fc 100644
--- a/test/lib/completions/check_perms.exp
+++ b/test/lib/completions/check_perms.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/chgrp.exp b/test/lib/completions/chgrp.exp
index 8dfeea79..e9238bde 100644
--- a/test/lib/completions/chgrp.exp
+++ b/test/lib/completions/chgrp.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/chkconfig.exp b/test/lib/completions/chkconfig.exp
index e7469b34..dae3b3bd 100644
--- a/test/lib/completions/chkconfig.exp
+++ b/test/lib/completions/chkconfig.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/chown.exp b/test/lib/completions/chown.exp
index 953b2b02..bc1a8c7f 100644
--- a/test/lib/completions/chown.exp
+++ b/test/lib/completions/chown.exp
@@ -1,10 +1,12 @@
proc setup {} {
+ # fake root command to get all users/groups completed at least for now
+ assert_bash_exec {root_command=sudo}
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
@@ -38,12 +40,11 @@ if {!$failed_find_unique_completion} {
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"
+ assert_complete "dot.user:$fullgroup" "chown dot.user:$partgroup"
sync_after_int
foreach prefix {
- "funky\\ user:" "funky\\ user\\:" "funky.user:" "funky\\.user:" "fu\\ nky.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>"
diff --git a/test/lib/completions/chsh.exp b/test/lib/completions/chsh.exp
index 99262a2c..a26ac93f 100644
--- a/test/lib/completions/chsh.exp
+++ b/test/lib/completions/chsh.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/ci.exp b/test/lib/completions/ci.exp
index 09105eec..15ef2ecc 100644
--- a/test/lib/completions/ci.exp
+++ b/test/lib/completions/ci.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/civclient.exp b/test/lib/completions/civclient.exp
index 8159c2bc..c0047468 100644
--- a/test/lib/completions/civclient.exp
+++ b/test/lib/completions/civclient.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/civserver.exp b/test/lib/completions/civserver.exp
index df459688..3739f50e 100644
--- a/test/lib/completions/civserver.exp
+++ b/test/lib/completions/civserver.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/cksfv.exp b/test/lib/completions/cksfv.exp
index a40a5023..2b9be04c 100644
--- a/test/lib/completions/cksfv.exp
+++ b/test/lib/completions/cksfv.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/cleanarch.exp b/test/lib/completions/cleanarch.exp
index e3145e81..a5f3bfe6 100644
--- a/test/lib/completions/cleanarch.exp
+++ b/test/lib/completions/cleanarch.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/clisp.exp b/test/lib/completions/clisp.exp
index 2bc599ac..dfbad4f3 100644
--- a/test/lib/completions/clisp.exp
+++ b/test/lib/completions/clisp.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/clone_member.exp b/test/lib/completions/clone_member.exp
index 34b4db57..d83d73bc 100644
--- a/test/lib/completions/clone_member.exp
+++ b/test/lib/completions/clone_member.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/co.exp b/test/lib/completions/co.exp
index 49fe3a64..215268b6 100644
--- a/test/lib/completions/co.exp
+++ b/test/lib/completions/co.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/composite.exp b/test/lib/completions/composite.exp
index e39ce72f..aba9af3b 100644
--- a/test/lib/completions/composite.exp
+++ b/test/lib/completions/composite.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/config_list.exp b/test/lib/completions/config_list.exp
index 5246c860..27699239 100644
--- a/test/lib/completions/config_list.exp
+++ b/test/lib/completions/config_list.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/configure.exp b/test/lib/completions/configure.exp
index 74afba1b..b4399cb1 100644
--- a/test/lib/completions/configure.exp
+++ b/test/lib/completions/configure.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/convert.exp b/test/lib/completions/convert.exp
index d8a77e35..07032040 100644
--- a/test/lib/completions/convert.exp
+++ b/test/lib/completions/convert.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/cowsay.exp b/test/lib/completions/cowsay.exp
index dfbefe1a..382f400f 100644
--- a/test/lib/completions/cowsay.exp
+++ b/test/lib/completions/cowsay.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/cp.exp b/test/lib/completions/cp.exp
index 9fe46537..703bf263 100644
--- a/test/lib/completions/cp.exp
+++ b/test/lib/completions/cp.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/cpio.exp b/test/lib/completions/cpio.exp
index b02f2719..93f6f3c1 100644
--- a/test/lib/completions/cpio.exp
+++ b/test/lib/completions/cpio.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/createdb.exp b/test/lib/completions/createdb.exp
index 1e5cdbe7..aafff1b6 100644
--- a/test/lib/completions/createdb.exp
+++ b/test/lib/completions/createdb.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/crontab.exp b/test/lib/completions/crontab.exp
new file mode 100644
index 00000000..18e2269f
--- /dev/null
+++ b/test/lib/completions/crontab.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "crontab "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/cryptsetup.exp b/test/lib/completions/cryptsetup.exp
index e94c3ac1..4c20bc5d 100644
--- a/test/lib/completions/cryptsetup.exp
+++ b/test/lib/completions/cryptsetup.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/csplit.exp b/test/lib/completions/csplit.exp
index 3a66a627..87b89dea 100644
--- a/test/lib/completions/csplit.exp
+++ b/test/lib/completions/csplit.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/cut.exp b/test/lib/completions/cut.exp
index b9bcf6c5..edb558ea 100644
--- a/test/lib/completions/cut.exp
+++ b/test/lib/completions/cut.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/cvs.exp b/test/lib/completions/cvs.exp
index 2a26da8e..3b2643d3 100644
--- a/test/lib/completions/cvs.exp
+++ b/test/lib/completions/cvs.exp
@@ -1,7 +1,7 @@
proc setup {} {
save_env
- assert_bash_exec {OLDHOME=$HOME ; HOME=$TESTDIR/fixtures/cvs}
-}; # setup()
+ assert_bash_exec {OLDHOME=$HOME ; HOME=$SRCDIR/fixtures/cvs}
+}
proc teardown {} {
@@ -9,7 +9,7 @@ proc teardown {} {
assert_env_unmodified {
/OLDHOME=/d
}
-}; # teardown()
+}
setup
@@ -27,7 +27,7 @@ send "$cmd\t"
expect {
-re "^$cmd\r\n.*:pserver:.*\r\n/@$cmd:pserver:.*$" { pass "$test" }
default { fail "$test" }
-}; # expect
+}
sync_after_int
diff --git a/test/lib/completions/cvsps.exp b/test/lib/completions/cvsps.exp
index 1fd4a0a9..6cf95ac1 100644
--- a/test/lib/completions/cvsps.exp
+++ b/test/lib/completions/cvsps.exp
@@ -1,7 +1,7 @@
proc setup {} {
save_env
- assert_bash_exec {OLDHOME=$HOME ; HOME=$TESTDIR/fixtures/cvs}
-}; # setup()
+ assert_bash_exec {OLDHOME=$HOME ; HOME=$SRCDIR/fixtures/cvs}
+}
proc teardown {} {
@@ -9,7 +9,7 @@ proc teardown {} {
assert_env_unmodified {
/OLDHOME=/d
}
-}; # teardown()
+}
setup
@@ -27,7 +27,7 @@ send "$cmd\t"
expect {
-re "^$cmd\r\n.*:pserver:.*\r\n/@$cmd:pserver:.*$" { pass "$test" }
default { fail "$test" }
-}; # expect
+}
sync_after_int
diff --git a/test/lib/completions/date.exp b/test/lib/completions/date.exp
index 9d75f5f3..ee970cf7 100644
--- a/test/lib/completions/date.exp
+++ b/test/lib/completions/date.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/dcop.exp b/test/lib/completions/dcop.exp
index 6ed800c5..1e27346b 100644
--- a/test/lib/completions/dcop.exp
+++ b/test/lib/completions/dcop.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
@@ -13,7 +13,7 @@ setup
if {[assert_exec {dcop} words]} {
assert_complete $words "dcop "
-}; # if
+}
sync_after_int
diff --git a/test/lib/completions/dd.exp b/test/lib/completions/dd.exp
index 400dd143..e02e037c 100644
--- a/test/lib/completions/dd.exp
+++ b/test/lib/completions/dd.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
@@ -24,7 +24,7 @@ expect -ex "$cmd"
expect {
-re "^=$" { pass $test }
-re {^\\=$} { xfail $test }
-}; # expect
+}
sync_after_int
diff --git a/test/lib/completions/df.exp b/test/lib/completions/df.exp
index 487d70a9..acf212a9 100644
--- a/test/lib/completions/df.exp
+++ b/test/lib/completions/df.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/dhclient.exp b/test/lib/completions/dhclient.exp
index 42c14c82..6caff5fc 100644
--- a/test/lib/completions/dhclient.exp
+++ b/test/lib/completions/dhclient.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/dict.exp b/test/lib/completions/dict.exp
index 32fb4988..402e0c5c 100644
--- a/test/lib/completions/dict.exp
+++ b/test/lib/completions/dict.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/diff.exp b/test/lib/completions/diff.exp
index c009f640..918bf7fd 100644
--- a/test/lib/completions/diff.exp
+++ b/test/lib/completions/diff.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/dir.exp b/test/lib/completions/dir.exp
index 6e20d37d..c9f61cd5 100644
--- a/test/lib/completions/dir.exp
+++ b/test/lib/completions/dir.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/display.exp b/test/lib/completions/display.exp
index 9a9d6901..e9fe766a 100644
--- a/test/lib/completions/display.exp
+++ b/test/lib/completions/display.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/dnsspoof.exp b/test/lib/completions/dnsspoof.exp
index 3223a349..4aefb956 100644
--- a/test/lib/completions/dnsspoof.exp
+++ b/test/lib/completions/dnsspoof.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/dpkg-deb.exp b/test/lib/completions/dpkg-deb.exp
index c8656610..37ece08d 100644
--- a/test/lib/completions/dpkg-deb.exp
+++ b/test/lib/completions/dpkg-deb.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/dpkg-reconfigure.exp b/test/lib/completions/dpkg-reconfigure.exp
index 267594be..0212666b 100644
--- a/test/lib/completions/dpkg-reconfigure.exp
+++ b/test/lib/completions/dpkg-reconfigure.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/dpkg-source.exp b/test/lib/completions/dpkg-source.exp
index a21eff45..a42759b9 100644
--- a/test/lib/completions/dpkg-source.exp
+++ b/test/lib/completions/dpkg-source.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/dpkg.exp b/test/lib/completions/dpkg.exp
index 2bd1fb6e..f358e172 100644
--- a/test/lib/completions/dpkg.exp
+++ b/test/lib/completions/dpkg.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
@@ -20,7 +20,7 @@ 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
diff --git a/test/lib/completions/dropdb.exp b/test/lib/completions/dropdb.exp
index e78a2ba7..8f2d5bfb 100644
--- a/test/lib/completions/dropdb.exp
+++ b/test/lib/completions/dropdb.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/dselect.exp b/test/lib/completions/dselect.exp
index f6257294..634db05e 100644
--- a/test/lib/completions/dselect.exp
+++ b/test/lib/completions/dselect.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/dsniff.exp b/test/lib/completions/dsniff.exp
index a0cc43ac..cb8912b6 100644
--- a/test/lib/completions/dsniff.exp
+++ b/test/lib/completions/dsniff.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/du.exp b/test/lib/completions/du.exp
index d1ffa8ca..6ddeb9b2 100644
--- a/test/lib/completions/du.exp
+++ b/test/lib/completions/du.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/dumpdb.exp b/test/lib/completions/dumpdb.exp
index 240214b3..5b617b11 100644
--- a/test/lib/completions/dumpdb.exp
+++ b/test/lib/completions/dumpdb.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/dumpe2fs.exp b/test/lib/completions/dumpe2fs.exp
new file mode 100644
index 00000000..e935c504
--- /dev/null
+++ b/test/lib/completions/dumpe2fs.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "dumpe2fs "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/e2freefrag.exp b/test/lib/completions/e2freefrag.exp
new file mode 100644
index 00000000..1530c9c9
--- /dev/null
+++ b/test/lib/completions/e2freefrag.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "e2freefrag "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/e2label.exp b/test/lib/completions/e2label.exp
new file mode 100644
index 00000000..8ae7f443
--- /dev/null
+++ b/test/lib/completions/e2label.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "e2label "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/enscript.exp b/test/lib/completions/enscript.exp
index 7fefabdd..c859b50f 100644
--- a/test/lib/completions/enscript.exp
+++ b/test/lib/completions/enscript.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/env.exp b/test/lib/completions/env.exp
index f03f5395..4f213748 100644
--- a/test/lib/completions/env.exp
+++ b/test/lib/completions/env.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
@@ -13,7 +13,7 @@ setup
if {[assert_exec {env --help} "" "" "unsupported"]} {
assert_complete_any "env --"
-}; # if
+}
sync_after_int
diff --git a/test/lib/completions/ether-wake.exp b/test/lib/completions/ether-wake.exp
new file mode 100644
index 00000000..fe1aa174
--- /dev/null
+++ b/test/lib/completions/ether-wake.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "ether-wake "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/evince.exp b/test/lib/completions/evince.exp
index 22279a26..204467a1 100644
--- a/test/lib/completions/evince.exp
+++ b/test/lib/completions/evince.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified {/OLDPWD=/d}
-}; # teardown()
+}
setup
@@ -26,7 +26,7 @@ set files {
.tga .TGA .tif .TIF .tiff .TIFF
.xpm .XPM .xwd .XWD
}
-assert_complete_dir $files "evince " "fixtures/evince"
+assert_complete_dir $files "evince " "$::srcdir/fixtures/evince"
sync_after_int
diff --git a/test/lib/completions/expand.exp b/test/lib/completions/expand.exp
index d5cd6b17..76b6eafa 100644
--- a/test/lib/completions/expand.exp
+++ b/test/lib/completions/expand.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
@@ -13,7 +13,7 @@ setup
if {[assert_exec {expand --help} "" "" "unsupported"]} {
assert_complete_any "expand --"
-}; # if
+}
sync_after_int
diff --git a/test/lib/completions/filefrag.exp b/test/lib/completions/filefrag.exp
new file mode 100644
index 00000000..fa80cd05
--- /dev/null
+++ b/test/lib/completions/filefrag.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "filefrag "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/filesnarf.exp b/test/lib/completions/filesnarf.exp
index 53cf01e4..03755056 100644
--- a/test/lib/completions/filesnarf.exp
+++ b/test/lib/completions/filesnarf.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/find.exp b/test/lib/completions/find.exp
index 4b1728dc..9acda648 100644
--- a/test/lib/completions/find.exp
+++ b/test/lib/completions/find.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified {/OLDPWD=/d}
-}; # teardown()
+}
setup
@@ -41,7 +41,7 @@ sync_after_int
set test "-wholename should complete files/dirs"
-set dir fixtures/shared/default
+set dir $::srcdir/fixtures/shared/default
set files [split [exec bash -c "cd $dir && ls -p"] "\n"]
assert_complete_dir $files "find -wholename " $dir
@@ -50,28 +50,26 @@ 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
diff --git a/test/lib/completions/find_member.exp b/test/lib/completions/find_member.exp
index 58fac7d2..55672091 100644
--- a/test/lib/completions/find_member.exp
+++ b/test/lib/completions/find_member.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/finger.exp b/test/lib/completions/finger.exp
index 30f2b080..70e3ed2c 100644
--- a/test/lib/completions/finger.exp
+++ b/test/lib/completions/finger.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
@@ -16,7 +16,7 @@ set test "Tab should complete usernames"
set users {}
foreach u [exec bash -c "compgen -A user"] {
lappend users $u
-}; # foreach
+}
assert_complete $users "finger " $test
@@ -24,7 +24,7 @@ sync_after_int
set test "Tab should complete partial username"
-assert_complete_partial [exec bash -c "compgen -A user"] "finger"
+assert_complete_partial [exec bash -c "compgen -A user"] "finger" -nospace
sync_after_int
@@ -39,15 +39,15 @@ 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 == "" && [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
diff --git a/test/lib/completions/fmt.exp b/test/lib/completions/fmt.exp
index 28570682..7d3cc17f 100644
--- a/test/lib/completions/fmt.exp
+++ b/test/lib/completions/fmt.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
@@ -13,7 +13,7 @@ setup
if {[assert_exec {fmt --help} "" "" "unsupported"]} {
assert_complete_any "fmt -"
-}; # if
+}
sync_after_int
diff --git a/test/lib/completions/fold.exp b/test/lib/completions/fold.exp
index a5230b03..f447f08b 100644
--- a/test/lib/completions/fold.exp
+++ b/test/lib/completions/fold.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
@@ -13,7 +13,7 @@ setup
if {[assert_exec {fold --help} "" "" "unsupported"]} {
assert_complete_any "fold --"
-}; # if
+}
sync_after_int
diff --git a/test/lib/completions/freerdp.exp b/test/lib/completions/freerdp.exp
new file mode 100644
index 00000000..be61d459
--- /dev/null
+++ b/test/lib/completions/freerdp.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "xfreerdp"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/g++.exp b/test/lib/completions/g++.exp
index 4dc2591a..4dbe73f4 100644
--- a/test/lib/completions/g++.exp
+++ b/test/lib/completions/g++.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/g4.exp b/test/lib/completions/g4.exp
index 203de061..7d575f10 100644
--- a/test/lib/completions/g4.exp
+++ b/test/lib/completions/g4.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/g77.exp b/test/lib/completions/g77.exp
index 8802aca9..e23745b7 100644
--- a/test/lib/completions/g77.exp
+++ b/test/lib/completions/g77.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/gcc.exp b/test/lib/completions/gcc.exp
index 8e52a120..00097cc2 100644
--- a/test/lib/completions/gcc.exp
+++ b/test/lib/completions/gcc.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/gcj.exp b/test/lib/completions/gcj.exp
index db52d59a..cde07700 100644
--- a/test/lib/completions/gcj.exp
+++ b/test/lib/completions/gcj.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/gcl.exp b/test/lib/completions/gcl.exp
index 7cead846..1846d0d1 100644
--- a/test/lib/completions/gcl.exp
+++ b/test/lib/completions/gcl.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/gdb.exp b/test/lib/completions/gdb.exp
index 982f0878..2e389edb 100644
--- a/test/lib/completions/gdb.exp
+++ b/test/lib/completions/gdb.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/genaliases.exp b/test/lib/completions/genaliases.exp
index 064eb386..bb4d5e0e 100644
--- a/test/lib/completions/genaliases.exp
+++ b/test/lib/completions/genaliases.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/getent.exp b/test/lib/completions/getent.exp
index 121f3b38..6500b22d 100644
--- a/test/lib/completions/getent.exp
+++ b/test/lib/completions/getent.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/gkrellm.exp b/test/lib/completions/gkrellm.exp
index f8b0dd4d..009770fc 100644
--- a/test/lib/completions/gkrellm.exp
+++ b/test/lib/completions/gkrellm.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/gmplayer.exp b/test/lib/completions/gmplayer.exp
index d9032698..a110cb2f 100644
--- a/test/lib/completions/gmplayer.exp
+++ b/test/lib/completions/gmplayer.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/gnatmake.exp b/test/lib/completions/gnatmake.exp
index 902aa062..bad4da33 100644
--- a/test/lib/completions/gnatmake.exp
+++ b/test/lib/completions/gnatmake.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/gpc.exp b/test/lib/completions/gpc.exp
index 6c4d0383..71eddacc 100644
--- a/test/lib/completions/gpc.exp
+++ b/test/lib/completions/gpc.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/gperf.exp b/test/lib/completions/gperf.exp
index aa24333e..1cf77678 100644
--- a/test/lib/completions/gperf.exp
+++ b/test/lib/completions/gperf.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/gpg.exp b/test/lib/completions/gpg.exp
index 29fd2244..ea6805fa 100644
--- a/test/lib/completions/gpg.exp
+++ b/test/lib/completions/gpg.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/gprof.exp b/test/lib/completions/gprof.exp
index 592786af..996a1efd 100644
--- a/test/lib/completions/gprof.exp
+++ b/test/lib/completions/gprof.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
@@ -13,7 +13,7 @@ setup
if {[assert_exec {gprof --help} "" "" "unsupported"]} {
assert_complete_any "gprof --"
-}; # if
+}
sync_after_int
diff --git a/test/lib/completions/grep.exp b/test/lib/completions/grep.exp
index 3814df71..c94ae727 100644
--- a/test/lib/completions/grep.exp
+++ b/test/lib/completions/grep.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/growisofs.exp b/test/lib/completions/growisofs.exp
new file mode 100644
index 00000000..0f2a0ec7
--- /dev/null
+++ b/test/lib/completions/growisofs.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "growisofs "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/grub.exp b/test/lib/completions/grub.exp
index 9578e789..b88d1f26 100644
--- a/test/lib/completions/grub.exp
+++ b/test/lib/completions/grub.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/gzip.exp b/test/lib/completions/gzip.exp
index f212c61a..32acf428 100644
--- a/test/lib/completions/gzip.exp
+++ b/test/lib/completions/gzip.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
@@ -19,7 +19,7 @@ expect {
-re "^$cmd\r\n.*$cmd$" { pass "$test" }
-re /@ { unresolved "$test at prompt" }
-re eof { unresolved "eof" }
-}; # expect
+}
sync_after_int
diff --git a/test/lib/completions/hcitool.exp b/test/lib/completions/hcitool.exp
index 9283adff..e6ae0032 100644
--- a/test/lib/completions/hcitool.exp
+++ b/test/lib/completions/hcitool.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/head.exp b/test/lib/completions/head.exp
index 0d4f6a20..7edb8a1b 100644
--- a/test/lib/completions/head.exp
+++ b/test/lib/completions/head.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
@@ -13,7 +13,7 @@ setup
if {[assert_exec {head --help} "" "" "unsupported"]} {
assert_complete_any "head --"
-}; # if
+}
sync_after_int
diff --git a/test/lib/completions/hping2.exp b/test/lib/completions/hping2.exp
new file mode 100644
index 00000000..8919626d
--- /dev/null
+++ b/test/lib/completions/hping2.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "hping2 "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/iconv.exp b/test/lib/completions/iconv.exp
index 420e923c..dcce330f 100644
--- a/test/lib/completions/iconv.exp
+++ b/test/lib/completions/iconv.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/id.exp b/test/lib/completions/id.exp
index 155af52c..b03ee721 100644
--- a/test/lib/completions/id.exp
+++ b/test/lib/completions/id.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/identify.exp b/test/lib/completions/identify.exp
index 8f38ae47..3347c5cd 100644
--- a/test/lib/completions/identify.exp
+++ b/test/lib/completions/identify.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/ifdown.exp b/test/lib/completions/ifdown.exp
index 68225bb9..7849f3f7 100644
--- a/test/lib/completions/ifdown.exp
+++ b/test/lib/completions/ifdown.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/iftop.exp b/test/lib/completions/iftop.exp
new file mode 100644
index 00000000..12941610
--- /dev/null
+++ b/test/lib/completions/iftop.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "iftop "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/ifup.exp b/test/lib/completions/ifup.exp
index 9d717178..2c1c010e 100644
--- a/test/lib/completions/ifup.exp
+++ b/test/lib/completions/ifup.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/indent.exp b/test/lib/completions/indent.exp
index e8fc32b1..5c5bb1c7 100644
--- a/test/lib/completions/indent.exp
+++ b/test/lib/completions/indent.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/info.exp b/test/lib/completions/info.exp
index ed769f1a..e7c79e6e 100644
--- a/test/lib/completions/info.exp
+++ b/test/lib/completions/info.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/inject.exp b/test/lib/completions/inject.exp
index 7c093146..4f95be23 100644
--- a/test/lib/completions/inject.exp
+++ b/test/lib/completions/inject.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/insmod.exp b/test/lib/completions/insmod.exp
index 8e83f0b4..a312c894 100644
--- a/test/lib/completions/insmod.exp
+++ b/test/lib/completions/insmod.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/invoke-rc.d.exp b/test/lib/completions/invoke-rc.d.exp
index 4dc9f1d8..d217d17e 100644
--- a/test/lib/completions/invoke-rc.d.exp
+++ b/test/lib/completions/invoke-rc.d.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/ip.exp b/test/lib/completions/ip.exp
new file mode 100644
index 00000000..8f45f6a3
--- /dev/null
+++ b/test/lib/completions/ip.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "ip "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/ipmitool.exp b/test/lib/completions/ipmitool.exp
new file mode 100644
index 00000000..aa18e3ff
--- /dev/null
+++ b/test/lib/completions/ipmitool.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "ipmitool "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/ipsec.exp b/test/lib/completions/ipsec.exp
index 15617a16..74ef638c 100644
--- a/test/lib/completions/ipsec.exp
+++ b/test/lib/completions/ipsec.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/ipv6calc.exp b/test/lib/completions/ipv6calc.exp
index 74ce95f7..42201f0c 100644
--- a/test/lib/completions/ipv6calc.exp
+++ b/test/lib/completions/ipv6calc.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/irb.exp b/test/lib/completions/irb.exp
index 81bea6d2..720edfdf 100644
--- a/test/lib/completions/irb.exp
+++ b/test/lib/completions/irb.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/isql.exp b/test/lib/completions/isql.exp
index 87e16bca..ca40faca 100644
--- a/test/lib/completions/isql.exp
+++ b/test/lib/completions/isql.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified {/ODBCINI=/d}
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/iwconfig.exp b/test/lib/completions/iwconfig.exp
index f09719d7..82ae11f3 100644
--- a/test/lib/completions/iwconfig.exp
+++ b/test/lib/completions/iwconfig.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/iwlist.exp b/test/lib/completions/iwlist.exp
index 80a2c367..43c919ef 100644
--- a/test/lib/completions/iwlist.exp
+++ b/test/lib/completions/iwlist.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/iwpriv.exp b/test/lib/completions/iwpriv.exp
index f3102cc5..86b1ee95 100644
--- a/test/lib/completions/iwpriv.exp
+++ b/test/lib/completions/iwpriv.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/iwspy.exp b/test/lib/completions/iwspy.exp
index 5fa0bee5..2894ca4e 100644
--- a/test/lib/completions/iwspy.exp
+++ b/test/lib/completions/iwspy.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/jar.exp b/test/lib/completions/jar.exp
index 0e11f684..d2cb476b 100644
--- a/test/lib/completions/jar.exp
+++ b/test/lib/completions/jar.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/jarsigner.exp b/test/lib/completions/jarsigner.exp
index 075e0263..7ea7cb2e 100644
--- a/test/lib/completions/jarsigner.exp
+++ b/test/lib/completions/jarsigner.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/java.exp b/test/lib/completions/java.exp
index 14610b2f..842501d2 100644
--- a/test/lib/completions/java.exp
+++ b/test/lib/completions/java.exp
@@ -1,12 +1,12 @@
proc setup {} {
- assert_bash_exec {CLASSPATH=$TESTDIR/fixtures/java/a:$TESTDIR/fixtures/java/bashcomp.jar}
+ assert_bash_exec {CLASSPATH=$SRCDIR/fixtures/java/a:$SRCDIR/fixtures/java/bashcomp.jar}
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
@@ -25,7 +25,7 @@ sync_after_int
assert_complete "bashcomp.jarred toplevel" \
- "java -cp fixtures/java/bashcomp.jar "
+ "java -cp $::srcdir/fixtures/java/bashcomp.jar "
sync_after_int
@@ -37,7 +37,7 @@ assert_no_complete "java -cp \"\" "
sync_after_int
-assert_complete "a/ bashcomp.jar" "java -jar fixtures/java/"
+assert_complete "a/ bashcomp.jar" "java -jar $::srcdir/fixtures/java/"
sync_after_int
diff --git a/test/lib/completions/javac.exp b/test/lib/completions/javac.exp
index 6013de11..948fe8c8 100644
--- a/test/lib/completions/javac.exp
+++ b/test/lib/completions/javac.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/javadoc.exp b/test/lib/completions/javadoc.exp
index 40c922ca..0af8a3da 100644
--- a/test/lib/completions/javadoc.exp
+++ b/test/lib/completions/javadoc.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/k3b.exp b/test/lib/completions/k3b.exp
index 86942d67..cde14b86 100644
--- a/test/lib/completions/k3b.exp
+++ b/test/lib/completions/k3b.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/kdvi.exp b/test/lib/completions/kdvi.exp
index 0196049a..fa993f5e 100644
--- a/test/lib/completions/kdvi.exp
+++ b/test/lib/completions/kdvi.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified {/OLDPWD=/d}
-}; # teardown()
+}
setup
@@ -18,7 +18,7 @@ set files {
foo/
.dvi .DVI .dvi.bz2 .DVI.bz2 .dvi.gz .DVI.gz .dvi.Z .DVI.Z
}
-assert_complete_dir $files "kdvi " "fixtures/kdvi"
+assert_complete_dir $files "kdvi " "$::srcdir/fixtures/kdvi"
sync_after_int
diff --git a/test/lib/completions/kill.exp b/test/lib/completions/kill.exp
index ca02650c..1e80fe69 100644
--- a/test/lib/completions/kill.exp
+++ b/test/lib/completions/kill.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/killall.exp b/test/lib/completions/killall.exp
index 763c8e7d..ae8b3d60 100644
--- a/test/lib/completions/killall.exp
+++ b/test/lib/completions/killall.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/kldload.exp b/test/lib/completions/kldload.exp
index 0493a10a..a1d87c97 100644
--- a/test/lib/completions/kldload.exp
+++ b/test/lib/completions/kldload.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/kldunload.exp b/test/lib/completions/kldunload.exp
index 192159a5..476c5104 100644
--- a/test/lib/completions/kldunload.exp
+++ b/test/lib/completions/kldunload.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/kpdf.exp b/test/lib/completions/kpdf.exp
index 010abcfb..6f0feb68 100644
--- a/test/lib/completions/kpdf.exp
+++ b/test/lib/completions/kpdf.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified {/OLDPWD=/d}
-}; # teardown()
+}
setup
@@ -17,7 +17,7 @@ setup
set files {
foo/ .eps .ps .EPS .PS .pdf .PDF
}
-assert_complete_dir $files "kpdf " "fixtures/kpdf"
+assert_complete_dir $files "kpdf " "$::srcdir/fixtures/kpdf"
sync_after_int
diff --git a/test/lib/completions/kplayer.exp b/test/lib/completions/kplayer.exp
index 34c9b3bf..4fdfa672 100644
--- a/test/lib/completions/kplayer.exp
+++ b/test/lib/completions/kplayer.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/larch.exp b/test/lib/completions/larch.exp
index 076016f2..cefcbe02 100644
--- a/test/lib/completions/larch.exp
+++ b/test/lib/completions/larch.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/ld.exp b/test/lib/completions/ld.exp
index 60377991..ee660fcb 100644
--- a/test/lib/completions/ld.exp
+++ b/test/lib/completions/ld.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/ldd.exp b/test/lib/completions/ldd.exp
index e45d1df7..1c3239c7 100644
--- a/test/lib/completions/ldd.exp
+++ b/test/lib/completions/ldd.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/less.exp b/test/lib/completions/less.exp
index 269c9b5c..78d6ef14 100644
--- a/test/lib/completions/less.exp
+++ b/test/lib/completions/less.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/lftp.exp b/test/lib/completions/lftp.exp
index a49a1935..bb219650 100644
--- a/test/lib/completions/lftp.exp
+++ b/test/lib/completions/lftp.exp
@@ -1,12 +1,12 @@
proc setup {} {
- assert_bash_exec {HOME=$TESTDIR/fixtures/lftp}
+ assert_bash_exec {HOME=$SRCDIR/fixtures/lftp}
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/lftpget.exp b/test/lib/completions/lftpget.exp
index 7d80216e..0eadb6e9 100644
--- a/test/lib/completions/lftpget.exp
+++ b/test/lib/completions/lftpget.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/lilo.exp b/test/lib/completions/lilo.exp
index 505a1470..36ea2c66 100644
--- a/test/lib/completions/lilo.exp
+++ b/test/lib/completions/lilo.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/links.exp b/test/lib/completions/links.exp
index 9f4896aa..4124e2f4 100644
--- a/test/lib/completions/links.exp
+++ b/test/lib/completions/links.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/lisp.exp b/test/lib/completions/lisp.exp
index 21663628..5131b45d 100644
--- a/test/lib/completions/lisp.exp
+++ b/test/lib/completions/lisp.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/list_admins.exp b/test/lib/completions/list_admins.exp
index e1c9c4dd..3b412136 100644
--- a/test/lib/completions/list_admins.exp
+++ b/test/lib/completions/list_admins.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/list_lists.exp b/test/lib/completions/list_lists.exp
index 789ab1a8..a62dca25 100644
--- a/test/lib/completions/list_lists.exp
+++ b/test/lib/completions/list_lists.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/list_members.exp b/test/lib/completions/list_members.exp
index c93b53d7..8c74cdfb 100644
--- a/test/lib/completions/list_members.exp
+++ b/test/lib/completions/list_members.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/list_owners.exp b/test/lib/completions/list_owners.exp
index c96e0229..65e3ba8e 100644
--- a/test/lib/completions/list_owners.exp
+++ b/test/lib/completions/list_owners.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/ln.exp b/test/lib/completions/ln.exp
index 34786071..61405020 100644
--- a/test/lib/completions/ln.exp
+++ b/test/lib/completions/ln.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/look.exp b/test/lib/completions/look.exp
index 53a3c464..8f93db24 100644
--- a/test/lib/completions/look.exp
+++ b/test/lib/completions/look.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
@@ -13,7 +13,7 @@ setup
if {[assert_exec {look foo | grep ^foo} words]} {
assert_complete $words "look foo"
-}; # if
+}
sync_after_int
diff --git a/test/lib/completions/lrzip.exp b/test/lib/completions/lrzip.exp
new file mode 100644
index 00000000..97bc1235
--- /dev/null
+++ b/test/lib/completions/lrzip.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "lrzip "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/ls.exp b/test/lib/completions/ls.exp
index db2d41d3..0d16ec03 100644
--- a/test/lib/completions/ls.exp
+++ b/test/lib/completions/ls.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
@@ -13,7 +13,29 @@ setup
if {[assert_exec {ls --help} "" "" "unsupported"]} {
assert_complete_any "ls --"
-}; # if
+}
+
+
+sync_after_int
+
+
+set test "~part should complete to ~full/ if existing dir"
+# Create list of users, having existing home dir
+assert_bash_exec {for u in $(compgen -u); do \
+ eval test -d ~$u && echo $u; unset u; done} {} /@ users
+find_unique_completion_pair $users part full
+assert_complete "~$full/" "ls ~$part" $test -nospace
+
+
+sync_after_int
+
+
+set test "~part should complete to ~full<space> if non-existing dir"
+# Create list of users, having non-existing home dir
+assert_bash_exec {for u in $(compgen -u); do \
+ eval test -d ~$u || echo $u; unset u; done} {} /@ users
+find_unique_completion_pair $users part full
+assert_complete "~$full " "ls ~$part" $test -nospace
sync_after_int
diff --git a/test/lib/completions/lsof.exp b/test/lib/completions/lsof.exp
new file mode 100644
index 00000000..551bde2a
--- /dev/null
+++ b/test/lib/completions/lsof.exp
@@ -0,0 +1,21 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "lsof "
+sync_after_int
+
+assert_complete_any "lsof -"
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/lvchange.exp b/test/lib/completions/lvchange.exp
index ec3886b8..6587a260 100644
--- a/test/lib/completions/lvchange.exp
+++ b/test/lib/completions/lvchange.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/lvcreate.exp b/test/lib/completions/lvcreate.exp
index 46dceb79..91cb0d81 100644
--- a/test/lib/completions/lvcreate.exp
+++ b/test/lib/completions/lvcreate.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/lvdisplay.exp b/test/lib/completions/lvdisplay.exp
index 5a01a0e5..6fa9c294 100644
--- a/test/lib/completions/lvdisplay.exp
+++ b/test/lib/completions/lvdisplay.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/lvextend.exp b/test/lib/completions/lvextend.exp
index 24a63853..ded34695 100644
--- a/test/lib/completions/lvextend.exp
+++ b/test/lib/completions/lvextend.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/lvm.exp b/test/lib/completions/lvm.exp
index 1c67825e..91fe0dcd 100644
--- a/test/lib/completions/lvm.exp
+++ b/test/lib/completions/lvm.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/lvmdiskscan.exp b/test/lib/completions/lvmdiskscan.exp
index 27e566d4..6553865f 100644
--- a/test/lib/completions/lvmdiskscan.exp
+++ b/test/lib/completions/lvmdiskscan.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/lvreduce.exp b/test/lib/completions/lvreduce.exp
index edd5150d..e2708f89 100644
--- a/test/lib/completions/lvreduce.exp
+++ b/test/lib/completions/lvreduce.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/lvremove.exp b/test/lib/completions/lvremove.exp
index 1cd63150..8ca1517b 100644
--- a/test/lib/completions/lvremove.exp
+++ b/test/lib/completions/lvremove.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/lvrename.exp b/test/lib/completions/lvrename.exp
index 51624222..17179ce9 100644
--- a/test/lib/completions/lvrename.exp
+++ b/test/lib/completions/lvrename.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/lvresize.exp b/test/lib/completions/lvresize.exp
index 830b9ab1..2b3e1044 100644
--- a/test/lib/completions/lvresize.exp
+++ b/test/lib/completions/lvresize.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/lvs.exp b/test/lib/completions/lvs.exp
index 8b239f5d..e531f7e9 100644
--- a/test/lib/completions/lvs.exp
+++ b/test/lib/completions/lvs.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/lvscan.exp b/test/lib/completions/lvscan.exp
index 841fd0ed..7b09e5e1 100644
--- a/test/lib/completions/lvscan.exp
+++ b/test/lib/completions/lvscan.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/lzma.exp b/test/lib/completions/lzma.exp
index 79d78854..ba57d10b 100644
--- a/test/lib/completions/lzma.exp
+++ b/test/lib/completions/lzma.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
@@ -17,7 +17,7 @@ assert_complete_any "lzma "
sync_after_int
-assert_complete "a/ bashcomp.lzma bashcomp.tlz" "lzma -d fixtures/xz/"
+assert_complete "a/ bashcomp.lzma bashcomp.tlz" "lzma -d $::srcdir/fixtures/xz/"
sync_after_int
diff --git a/test/lib/completions/lzop.exp b/test/lib/completions/lzop.exp
index c33e814e..a7d3da25 100644
--- a/test/lib/completions/lzop.exp
+++ b/test/lib/completions/lzop.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/m4.exp b/test/lib/completions/m4.exp
index 2cc884b3..334132db 100644
--- a/test/lib/completions/m4.exp
+++ b/test/lib/completions/m4.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
@@ -13,7 +13,7 @@ setup
if {[assert_exec {m4 --help} "" "" "unsupported"]} {
assert_complete_any "m4 --"
-}; # if
+}
sync_after_int
diff --git a/test/lib/completions/macof.exp b/test/lib/completions/macof.exp
index e21b1e77..873ae1da 100644
--- a/test/lib/completions/macof.exp
+++ b/test/lib/completions/macof.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/mailmanctl.exp b/test/lib/completions/mailmanctl.exp
index a69b7650..2924806a 100644
--- a/test/lib/completions/mailmanctl.exp
+++ b/test/lib/completions/mailmanctl.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/mailsnarf.exp b/test/lib/completions/mailsnarf.exp
index df9981b7..9fb937f3 100644
--- a/test/lib/completions/mailsnarf.exp
+++ b/test/lib/completions/mailsnarf.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/make.exp b/test/lib/completions/make.exp
index 90b9e68b..64a393da 100644
--- a/test/lib/completions/make.exp
+++ b/test/lib/completions/make.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/man.exp b/test/lib/completions/man.exp
index 62c14c86..c7358c62 100644
--- a/test/lib/completions/man.exp
+++ b/test/lib/completions/man.exp
@@ -1,17 +1,30 @@
proc setup {} {
+ assert_bash_exec "export MANPATH=$::srcdirabs/fixtures/man"
save_env
-}; # setup()
+}
proc teardown {} {
- assert_env_unmodified
-}; # teardown()
+ assert_env_unmodified {/OLDPWD/d}
+}
setup
-assert_complete_any "man man"
+assert_complete "bar" "man b"
+
+
+sync_after_int
+
+
+assert_complete_dir oo.1 "man man1/f" $::srcdir/fixtures/man
+
+
+sync_after_int
+
+
+assert_complete "Bash::Completion" "man Bash::C"
sync_after_int
diff --git a/test/lib/completions/mc.exp b/test/lib/completions/mc.exp
index 866161ba..eb97246d 100644
--- a/test/lib/completions/mc.exp
+++ b/test/lib/completions/mc.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/mcrypt.exp b/test/lib/completions/mcrypt.exp
index bfc5d2d2..525ccbc3 100644
--- a/test/lib/completions/mcrypt.exp
+++ b/test/lib/completions/mcrypt.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/md5sum.exp b/test/lib/completions/md5sum.exp
index 25290b56..54ed6416 100644
--- a/test/lib/completions/md5sum.exp
+++ b/test/lib/completions/md5sum.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/mdecrypt.exp b/test/lib/completions/mdecrypt.exp
index 4e49ae12..8d9d9f59 100644
--- a/test/lib/completions/mdecrypt.exp
+++ b/test/lib/completions/mdecrypt.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/mencoder.exp b/test/lib/completions/mencoder.exp
index 169dcb71..db29f66a 100644
--- a/test/lib/completions/mencoder.exp
+++ b/test/lib/completions/mencoder.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/minicom.exp b/test/lib/completions/minicom.exp
index 935502f1..dfc96c01 100644
--- a/test/lib/completions/minicom.exp
+++ b/test/lib/completions/minicom.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/mkdir.exp b/test/lib/completions/mkdir.exp
index 43dfec7e..8d8c881d 100644
--- a/test/lib/completions/mkdir.exp
+++ b/test/lib/completions/mkdir.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
@@ -17,4 +17,10 @@ assert_complete_any "mkdir "
sync_after_int
+assert_complete {"bar bar.d/" foo.d/} "mkdir $::srcdir/fixtures/shared/default/"
+
+
+sync_after_int
+
+
teardown
diff --git a/test/lib/completions/mkfifo.exp b/test/lib/completions/mkfifo.exp
index c6343f8d..59412a2e 100644
--- a/test/lib/completions/mkfifo.exp
+++ b/test/lib/completions/mkfifo.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/mkinitrd.exp b/test/lib/completions/mkinitrd.exp
index cfb316e5..007f278d 100644
--- a/test/lib/completions/mkinitrd.exp
+++ b/test/lib/completions/mkinitrd.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/mkisofs.exp b/test/lib/completions/mkisofs.exp
index ad24ea06..98780b1e 100644
--- a/test/lib/completions/mkisofs.exp
+++ b/test/lib/completions/mkisofs.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
@@ -25,7 +25,7 @@ expect {
-re "^$cmd\r\n\\d+.*$cmd$" { pass "$test" }
-re /@ { unresolved "$test at prompt" }
-re eof { unresolved "eof" }
-}; # expect
+}
sync_after_int
@@ -39,7 +39,7 @@ expect {
-re "^$cmd\r\n\\d+.*$cmd$" { pass "$test" }
-re /@ { unresolved "$test at prompt" }
-re eof { unresolved "eof" }
-}; # expect
+}
sync_after_int
diff --git a/test/lib/completions/mknod.exp b/test/lib/completions/mknod.exp
index 2c58cade..145f4531 100644
--- a/test/lib/completions/mknod.exp
+++ b/test/lib/completions/mknod.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/mmsitepass.exp b/test/lib/completions/mmsitepass.exp
index d69fa202..4dde214f 100644
--- a/test/lib/completions/mmsitepass.exp
+++ b/test/lib/completions/mmsitepass.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/module.exp b/test/lib/completions/module.exp
index a34667d4..5e36a6da 100644
--- a/test/lib/completions/module.exp
+++ b/test/lib/completions/module.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/mogrify.exp b/test/lib/completions/mogrify.exp
index ef7e18ee..84ceeff5 100644
--- a/test/lib/completions/mogrify.exp
+++ b/test/lib/completions/mogrify.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/montage.exp b/test/lib/completions/montage.exp
index 736609a5..4d85e1a4 100644
--- a/test/lib/completions/montage.exp
+++ b/test/lib/completions/montage.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/mount.exp b/test/lib/completions/mount.exp
index 38d93e3b..c99d6058 100644
--- a/test/lib/completions/mount.exp
+++ b/test/lib/completions/mount.exp
@@ -5,11 +5,10 @@ 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"; \
+ _linux_fstab $(_get_pword) < "$SRCDIRABS/fixtures/mount/test-fstab"; \
}; \
complete -F _mnt mnt \
}
@@ -53,9 +52,9 @@ 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";}
+assert_bash_exec {OLDPATH="$PATH"; PATH="$SRCDIRABS/fixtures/mount/bin:$PATH";}
# This needs an explicit cword param or will output "unresolved".
-assert_complete $expected $cmd $test "/@" 20 "/"
+assert_complete $expected $cmd $test -expect-cmd-minus /
sync_after_int
assert_bash_exec {PATH="$OLDPATH"; unset -v OLDPATH}
@@ -94,7 +93,7 @@ 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\ }
+ {mnt /mnt/nice\ } "" -expect-cmd-minus {/mnt/nice\ }
sync_after_int
assert_complete {/mnt/nice\$test-path} {mnt /mnt/nice\$}
diff --git a/test/lib/completions/mplayer.exp b/test/lib/completions/mplayer.exp
index 69e5d971..9230a86d 100644
--- a/test/lib/completions/mplayer.exp
+++ b/test/lib/completions/mplayer.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/msgsnarf.exp b/test/lib/completions/msgsnarf.exp
index 74f458ff..c542e33e 100644
--- a/test/lib/completions/msgsnarf.exp
+++ b/test/lib/completions/msgsnarf.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/mtx.exp b/test/lib/completions/mtx.exp
index a518d79f..1de15269 100644
--- a/test/lib/completions/mtx.exp
+++ b/test/lib/completions/mtx.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/mutt.exp b/test/lib/completions/mutt.exp
index 6c727daf..8cb8b0c6 100644
--- a/test/lib/completions/mutt.exp
+++ b/test/lib/completions/mutt.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified {/OLDPWD=/d}
-}; # teardown()
+}
setup
@@ -19,12 +19,12 @@ sync_after_int
set test "mutt should complete mailboxes"
set expected {foo/ bar/ muttrc}
-assert_complete_dir $expected "mutt -F muttrc -f =" fixtures/mutt
+assert_complete_dir $expected "mutt -F muttrc -f =" $::srcdir/fixtures/mutt
set test "mutt should complete aliases"
set expected {a1 a2}
-assert_complete_dir $expected "mutt -F muttrc -A " fixtures/mutt
+assert_complete_dir $expected "mutt -F muttrc -A " $::srcdir/fixtures/mutt
sync_after_int
diff --git a/test/lib/completions/muttng.exp b/test/lib/completions/muttng.exp
index 25a474ad..32239128 100644
--- a/test/lib/completions/muttng.exp
+++ b/test/lib/completions/muttng.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/mv.exp b/test/lib/completions/mv.exp
index f2576df7..d65c4868 100644
--- a/test/lib/completions/mv.exp
+++ b/test/lib/completions/mv.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/mysqladmin.exp b/test/lib/completions/mysqladmin.exp
index 76381587..ae9b8ce8 100644
--- a/test/lib/completions/mysqladmin.exp
+++ b/test/lib/completions/mysqladmin.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/ncftp.exp b/test/lib/completions/ncftp.exp
index ad71f226..52d70756 100644
--- a/test/lib/completions/ncftp.exp
+++ b/test/lib/completions/ncftp.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/netstat.exp b/test/lib/completions/netstat.exp
index 0e6414d6..e4ef676c 100644
--- a/test/lib/completions/netstat.exp
+++ b/test/lib/completions/netstat.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/newlist.exp b/test/lib/completions/newlist.exp
index bebf600d..0696ec5e 100644
--- a/test/lib/completions/newlist.exp
+++ b/test/lib/completions/newlist.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/nl.exp b/test/lib/completions/nl.exp
index 02076dff..b7255ac2 100644
--- a/test/lib/completions/nl.exp
+++ b/test/lib/completions/nl.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/nm.exp b/test/lib/completions/nm.exp
index 551f49e9..9ce73d45 100644
--- a/test/lib/completions/nm.exp
+++ b/test/lib/completions/nm.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/ntpdate.exp b/test/lib/completions/ntpdate.exp
index 6a6456f4..7a7dd716 100644
--- a/test/lib/completions/ntpdate.exp
+++ b/test/lib/completions/ntpdate.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/objcopy.exp b/test/lib/completions/objcopy.exp
index acb6539a..29be7e62 100644
--- a/test/lib/completions/objcopy.exp
+++ b/test/lib/completions/objcopy.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/objdump.exp b/test/lib/completions/objdump.exp
index 5eec35d6..c1f62e35 100644
--- a/test/lib/completions/objdump.exp
+++ b/test/lib/completions/objdump.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/od.exp b/test/lib/completions/od.exp
index 5838218c..e2712d12 100644
--- a/test/lib/completions/od.exp
+++ b/test/lib/completions/od.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/openssl.exp b/test/lib/completions/openssl.exp
index 651e5e6d..25fc1367 100644
--- a/test/lib/completions/openssl.exp
+++ b/test/lib/completions/openssl.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
@@ -19,7 +19,7 @@ expect {
-re "^$cmd\r\n.*$cmd$" { pass "$test" }
-re /@ { unresolved "$test at prompt" }
-re eof { unresolved "eof" }
-}; # expect
+}
sync_after_int
diff --git a/test/lib/completions/p4.exp b/test/lib/completions/p4.exp
index 369d2c6b..20d8fb6e 100644
--- a/test/lib/completions/p4.exp
+++ b/test/lib/completions/p4.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/pack200.exp b/test/lib/completions/pack200.exp
index f96eff13..537bf327 100644
--- a/test/lib/completions/pack200.exp
+++ b/test/lib/completions/pack200.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/paste.exp b/test/lib/completions/paste.exp
index 3a4e93be..224d9dd9 100644
--- a/test/lib/completions/paste.exp
+++ b/test/lib/completions/paste.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/patch.exp b/test/lib/completions/patch.exp
index a44fa130..07e88f15 100644
--- a/test/lib/completions/patch.exp
+++ b/test/lib/completions/patch.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/perl.exp b/test/lib/completions/perl.exp
index 2199c994..8cd6f957 100644
--- a/test/lib/completions/perl.exp
+++ b/test/lib/completions/perl.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
@@ -18,7 +18,7 @@ sync_after_int
set test "Second argument should file complete"
-set cmd "perl foo fixtures/shared/default/f"
+set cmd "perl foo $::srcdir/fixtures/shared/default/f"
send "$cmd\t"
expect {
-re "^$cmd\r\nfoo +foo.d/ *\r\n/@${cmd}oo$" { pass "$test" }
@@ -31,7 +31,7 @@ sync_after_int
set test "-I without space should complete directories"
-set cmd "perl -Ifixtures/shared/default/"
+set cmd "perl -I$::srcdir/fixtures/shared/default/"
send "$cmd\t"
expect {
-re "^$cmd\r\nbar bar.d/ +foo.d/ *\r\n/@$cmd$" { pass "$test" }
@@ -44,7 +44,7 @@ sync_after_int
set test "-I with space should complete directories"
-set cmd "perl -I fixtures/shared/default/"
+set cmd "perl -I $::srcdir/fixtures/shared/default/"
send "$cmd\t"
expect {
-re "^$cmd\r\nbar bar.d/ +foo.d/ *\r\n/@$cmd$" { pass "$test" }
@@ -57,7 +57,7 @@ sync_after_int
set test "-x without space should complete directories"
-set cmd "perl -xfixtures/shared/default/b"
+set cmd "perl -x$::srcdir/fixtures/shared/default/b"
send "$cmd\t"
expect {
-re "^${cmd}ar\\\\ bar.d/ *$" { pass "$test" }
@@ -70,7 +70,7 @@ sync_after_int
set test "-x with space should complete directories"
-set cmd "perl -x fixtures/shared/default/b"
+set cmd "perl -x $::srcdir/fixtures/shared/default/b"
send "$cmd\t"
expect {
-re "^${cmd}ar\\\\ bar.d/ *$" { pass "$test" }
@@ -91,5 +91,30 @@ assert_complete $options "perl -"
sync_after_int
+assert_no_complete "perl -e "
+sync_after_int
+
+assert_complete_any "perl -V:install"
+sync_after_int
+
+assert_complete_any "perl -V::install"
+sync_after_int
+
+# Assuming that File::Spec and friends are always installed...
+
+assert_complete_any "perl -MFile"
+sync_after_int
+
+assert_complete_any "perl -MFile::Sp"
+sync_after_int
+
+assert_complete_any "perl -MFile::Spec::Func"
+sync_after_int
+
+assert_complete_any "perl -M-File"
+sync_after_int
+
+assert_complete_any "perl -m-File::"
+sync_after_int
teardown
diff --git a/test/lib/completions/perldoc.exp b/test/lib/completions/perldoc.exp
index b3ff83b3..dc1c79c8 100644
--- a/test/lib/completions/perldoc.exp
+++ b/test/lib/completions/perldoc.exp
@@ -1,22 +1,16 @@
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"
@@ -29,7 +23,16 @@ expect {
-re "perldoc File::File::" { fail "$test" }
-re /@ { unresolved "$test" }
default { unresolved "$test" }
-}; # expect
+}
+
+
+sync_after_int
+
+set test "- should complete options"
+set options {
+ -h -v -t -u -m -l -F -X -f -q
+}
+assert_complete $options "perldoc -"
sync_after_int
diff --git a/test/lib/completions/pgrep.exp b/test/lib/completions/pgrep.exp
index 63143acc..c27c4f21 100644
--- a/test/lib/completions/pgrep.exp
+++ b/test/lib/completions/pgrep.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/pine.exp b/test/lib/completions/pine.exp
index 0a0c3f40..622bf064 100644
--- a/test/lib/completions/pine.exp
+++ b/test/lib/completions/pine.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/ping.exp b/test/lib/completions/ping.exp
index b600849b..3e419966 100644
--- a/test/lib/completions/ping.exp
+++ b/test/lib/completions/ping.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/pkg-config.exp b/test/lib/completions/pkg-config.exp
index 477dba08..adf9a301 100644
--- a/test/lib/completions/pkg-config.exp
+++ b/test/lib/completions/pkg-config.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/pkg_deinstall.exp b/test/lib/completions/pkg_deinstall.exp
index 8f3d8c3d..c2b3ae0b 100644
--- a/test/lib/completions/pkg_deinstall.exp
+++ b/test/lib/completions/pkg_deinstall.exp
@@ -1,18 +1,18 @@
proc setup {} {
- assert_bash_exec {PKG_DBDIR=fixtures/pkgtools/db}
+ assert_bash_exec {PKG_DBDIR=$::srcdir/fixtures/pkgtools/db}
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
-set pkgs [exec bash -c "cd fixtures/pkgtools/db ; compgen -d"]
+set pkgs [exec bash -c "cd $::srcdir/fixtures/pkgtools/db ; compgen -d"]
assert_complete $pkgs "pkg_deinstall "
diff --git a/test/lib/completions/pkg_delete.exp b/test/lib/completions/pkg_delete.exp
index b0c1a2a5..37ce4035 100644
--- a/test/lib/completions/pkg_delete.exp
+++ b/test/lib/completions/pkg_delete.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/pkg_info.exp b/test/lib/completions/pkg_info.exp
index 3f253ccf..ad8ed84e 100644
--- a/test/lib/completions/pkg_info.exp
+++ b/test/lib/completions/pkg_info.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/pkill.exp b/test/lib/completions/pkill.exp
index 0333fc94..6faddfc3 100644
--- a/test/lib/completions/pkill.exp
+++ b/test/lib/completions/pkill.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/portinstall.exp b/test/lib/completions/portinstall.exp
index d70f5db6..ab14afa8 100644
--- a/test/lib/completions/portinstall.exp
+++ b/test/lib/completions/portinstall.exp
@@ -1,13 +1,13 @@
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}
+ assert_bash_exec {PORTSDIR=$TESTDIR/tmp; sed -e s,PORTSDIR,$PORTSDIR,g $::srcdir/fixtures/pkgtools/ports/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_bash_exec {rm $PORTSDIR/INDEX $PORTSDIR/INDEX-5}
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/portupgrade.exp b/test/lib/completions/portupgrade.exp
index cb583923..62b5789d 100644
--- a/test/lib/completions/portupgrade.exp
+++ b/test/lib/completions/portupgrade.exp
@@ -1,12 +1,12 @@
proc setup {} {
assert_bash_exec {PKG_DBDIR=fixtures/pkgtools/db}
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/povray.exp b/test/lib/completions/povray.exp
index 1efeeddb..30d58e48 100644
--- a/test/lib/completions/povray.exp
+++ b/test/lib/completions/povray.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/pr.exp b/test/lib/completions/pr.exp
index 5d7a96c3..478017b2 100644
--- a/test/lib/completions/pr.exp
+++ b/test/lib/completions/pr.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/psql.exp b/test/lib/completions/psql.exp
index 56d56666..3dbffaf2 100644
--- a/test/lib/completions/psql.exp
+++ b/test/lib/completions/psql.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/ptx.exp b/test/lib/completions/ptx.exp
index 2defe049..220243c3 100644
--- a/test/lib/completions/ptx.exp
+++ b/test/lib/completions/ptx.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/pvchange.exp b/test/lib/completions/pvchange.exp
index fd4b73d0..a43ae9cd 100644
--- a/test/lib/completions/pvchange.exp
+++ b/test/lib/completions/pvchange.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/pvcreate.exp b/test/lib/completions/pvcreate.exp
index 47cebf7a..6bc9d4eb 100644
--- a/test/lib/completions/pvcreate.exp
+++ b/test/lib/completions/pvcreate.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/pvdisplay.exp b/test/lib/completions/pvdisplay.exp
index 151064cd..b9db558b 100644
--- a/test/lib/completions/pvdisplay.exp
+++ b/test/lib/completions/pvdisplay.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/pvmove.exp b/test/lib/completions/pvmove.exp
index 81c05e98..24d17006 100644
--- a/test/lib/completions/pvmove.exp
+++ b/test/lib/completions/pvmove.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/pvremove.exp b/test/lib/completions/pvremove.exp
index dd145bf6..1febcf37 100644
--- a/test/lib/completions/pvremove.exp
+++ b/test/lib/completions/pvremove.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/pvs.exp b/test/lib/completions/pvs.exp
index 6e5527e1..e50501a3 100644
--- a/test/lib/completions/pvs.exp
+++ b/test/lib/completions/pvs.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/pvscan.exp b/test/lib/completions/pvscan.exp
index e92cdbe0..d3b8ad33 100644
--- a/test/lib/completions/pvscan.exp
+++ b/test/lib/completions/pvscan.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/python.exp b/test/lib/completions/python.exp
index c9d70b43..446e3d09 100644
--- a/test/lib/completions/python.exp
+++ b/test/lib/completions/python.exp
@@ -1,19 +1,20 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
assert_complete_any "python "
+sync_after_int
-
+assert_complete_any "python -"
sync_after_int
diff --git a/test/lib/completions/qrunner.exp b/test/lib/completions/qrunner.exp
index b8fcf191..0dec16cc 100644
--- a/test/lib/completions/qrunner.exp
+++ b/test/lib/completions/qrunner.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/querybts.exp b/test/lib/completions/querybts.exp
index dc75cd62..4ed09d8a 100644
--- a/test/lib/completions/querybts.exp
+++ b/test/lib/completions/querybts.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/rcs.exp b/test/lib/completions/rcs.exp
index 19ae4d50..781ac37f 100644
--- a/test/lib/completions/rcs.exp
+++ b/test/lib/completions/rcs.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/rcsdiff.exp b/test/lib/completions/rcsdiff.exp
index 8383cdb9..23b009c6 100644
--- a/test/lib/completions/rcsdiff.exp
+++ b/test/lib/completions/rcsdiff.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/rdict.exp b/test/lib/completions/rdict.exp
index aa132617..5d6ad847 100644
--- a/test/lib/completions/rdict.exp
+++ b/test/lib/completions/rdict.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/readelf.exp b/test/lib/completions/readelf.exp
index a084a41e..c2d5ee5b 100644
--- a/test/lib/completions/readelf.exp
+++ b/test/lib/completions/readelf.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/readonly.exp b/test/lib/completions/readonly.exp
index 84be3c96..cf64ca0a 100644
--- a/test/lib/completions/readonly.exp
+++ b/test/lib/completions/readonly.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/remove_members.exp b/test/lib/completions/remove_members.exp
index 63d6a70e..59f7b6c4 100644
--- a/test/lib/completions/remove_members.exp
+++ b/test/lib/completions/remove_members.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/removepkg.exp b/test/lib/completions/removepkg.exp
index 7cf98805..882f1e70 100644
--- a/test/lib/completions/removepkg.exp
+++ b/test/lib/completions/removepkg.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/renice.exp b/test/lib/completions/renice.exp
index c91e0212..fdc859b4 100644
--- a/test/lib/completions/renice.exp
+++ b/test/lib/completions/renice.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
@@ -19,7 +19,7 @@ expect {
-re "$cmd\r\n\\d+.*/@$cmd$" { pass "$test" }
-re /@ { unresolved "$test at prompt" }
-re eof { unresolved "eof" }
-}; # expect
+}
sync_after_int
@@ -33,7 +33,7 @@ expect {
-re "$cmd\r\n\\d+.*/@$cmd$" { pass "$test" }
-re /@ { unresolved "$test at prompt" }
-re eof { unresolved "eof" }
-}; # expect
+}
sync_after_int
diff --git a/test/lib/completions/reportbug.exp b/test/lib/completions/reportbug.exp
index 1f66df2c..660778f7 100644
--- a/test/lib/completions/reportbug.exp
+++ b/test/lib/completions/reportbug.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/ri.exp b/test/lib/completions/ri.exp
index 160dc9a7..cd138ea0 100644
--- a/test/lib/completions/ri.exp
+++ b/test/lib/completions/ri.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/rlog.exp b/test/lib/completions/rlog.exp
index cbc06857..87984a8d 100644
--- a/test/lib/completions/rlog.exp
+++ b/test/lib/completions/rlog.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/rm.exp b/test/lib/completions/rm.exp
index ae670e83..f764a8e7 100644
--- a/test/lib/completions/rm.exp
+++ b/test/lib/completions/rm.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/rmdir.exp b/test/lib/completions/rmdir.exp
index 2b23a9c5..1a904b64 100644
--- a/test/lib/completions/rmdir.exp
+++ b/test/lib/completions/rmdir.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
@@ -17,4 +17,10 @@ assert_complete_any "rmdir "
sync_after_int
+assert_complete {"bar bar.d/" foo.d/} "rmdir $::srcdir/fixtures/shared/default/"
+
+
+sync_after_int
+
+
teardown
diff --git a/test/lib/completions/rmlist.exp b/test/lib/completions/rmlist.exp
index 91519ee8..d530d117 100644
--- a/test/lib/completions/rmlist.exp
+++ b/test/lib/completions/rmlist.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/rpcdebug.exp b/test/lib/completions/rpcdebug.exp
index 8629c947..7f1a1c2f 100644
--- a/test/lib/completions/rpcdebug.exp
+++ b/test/lib/completions/rpcdebug.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/rpm.exp b/test/lib/completions/rpm.exp
index 3ed154a9..82ab28dc 100644
--- a/test/lib/completions/rpm.exp
+++ b/test/lib/completions/rpm.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
@@ -20,7 +20,7 @@ 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
diff --git a/test/lib/completions/rsync.exp b/test/lib/completions/rsync.exp
index fb301a35..221d090b 100644
--- a/test/lib/completions/rsync.exp
+++ b/test/lib/completions/rsync.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/rtcwake.exp b/test/lib/completions/rtcwake.exp
index 0b9a974b..21c05eab 100644
--- a/test/lib/completions/rtcwake.exp
+++ b/test/lib/completions/rtcwake.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/sbcl-mt.exp b/test/lib/completions/sbcl-mt.exp
index 45e81f79..a80e543b 100644
--- a/test/lib/completions/sbcl-mt.exp
+++ b/test/lib/completions/sbcl-mt.exp
@@ -1,17 +1,17 @@
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/"
+assert_complete {bar "bar bar.d/" foo foo.d/} "sbcl-mt $::srcdir/fixtures/shared/default/"
sync_after_int
diff --git a/test/lib/completions/sbcl.exp b/test/lib/completions/sbcl.exp
index b68b2dce..3adeb6bf 100644
--- a/test/lib/completions/sbcl.exp
+++ b/test/lib/completions/sbcl.exp
@@ -1,17 +1,17 @@
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/"
+assert_complete {bar "bar bar.d/" foo foo.d/} "sbcl $::srcdir/fixtures/shared/default/"
sync_after_int
diff --git a/test/lib/completions/scp.exp b/test/lib/completions/scp.exp
index efe2b686..e6cbf8e3 100644
--- a/test/lib/completions/scp.exp
+++ b/test/lib/completions/scp.exp
@@ -1,15 +1,19 @@
proc setup {} {
save_env
-}; # setup()
+ # NOTE: Changing dir to $SRCDIR is necessary because file locations in the
+ # ssh config files (e.g. UserKnownHostsFile) are relative to $SRCDIR.
+ assert_bash_exec {cd $SRCDIR/fixtures/scp}
+}
proc teardown {} {
+ assert_bash_exec {cd $TESTDIR}
assert_env_unmodified {
/BASH_LINENO=/d
/BASH_SOURCE=/d
/OLDPWD=/d
}
-}; # teardown()
+}
setup
@@ -31,7 +35,7 @@ if {
# in `$HOME/.ssh/config' or `/etc/ssh_config'
set host_pwd ""
unsupported $test
-}; # if
+}
# Try completion
@@ -41,7 +45,7 @@ sync_after_tab
expect {
-re "^$cmd$host_pwd.*$" { pass "$test" }
-re /@ { unresolved "$test at prompt" }
-}; # expect
+}
sync_after_int
@@ -52,16 +56,15 @@ 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
+ # Hosts `blah', `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:
+}
+lappend expected blah: 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
+assert_complete $expected "scp -F config "
sync_after_int
@@ -76,7 +79,7 @@ expect {
-re "^$cmd\r\n.*\r\n/@" { pass "$test" }
-re /@ { unresolved "$test at prompt" }
default { unresolved "$test" }
-}; # expect
+}
sync_after_int
@@ -88,30 +91,26 @@ set test "Config file containing space should work"
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:
+ # Hosts `blah', `doo' and `ike' are defined in ./fixtures/scp/known_hosts
+lappend expected blah: 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]} {
+if {[match_items [lsort -unique $expected] -bash-sort]} {
expect {
- -re $prompt { pass "$test" }
+ -re /@ { 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
+}
+sync_after_int
assert_bash_exec {cd "$TESTDIR"}
diff --git a/test/lib/completions/screen.exp b/test/lib/completions/screen.exp
index 985862c1..e5bc4c15 100644
--- a/test/lib/completions/screen.exp
+++ b/test/lib/completions/screen.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified {/OLDPWD=/d}
-}; # teardown()
+}
setup
@@ -17,33 +17,8 @@ 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"}
-
+assert_complete {bar "bar bar.d/" foo foo.d/} \
+ "screen -c $::srcdir/fixtures/shared/default/" "-c should complete files/dirs"
sync_after_int
diff --git a/test/lib/completions/sed.exp b/test/lib/completions/sed.exp
index 8764cfb8..dd480a60 100644
--- a/test/lib/completions/sed.exp
+++ b/test/lib/completions/sed.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
@@ -13,7 +13,7 @@ setup
if {[assert_exec {sed --help} "" "" "unsupported"]} {
assert_complete_any "sed --"
-}; # if
+}
sync_after_int
diff --git a/test/lib/completions/seq.exp b/test/lib/completions/seq.exp
index b5333ef9..6e5ef8dc 100644
--- a/test/lib/completions/seq.exp
+++ b/test/lib/completions/seq.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/service.exp b/test/lib/completions/service.exp
index 917c5dcb..f3cf7355 100644
--- a/test/lib/completions/service.exp
+++ b/test/lib/completions/service.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/set.exp b/test/lib/completions/set.exp
index 2b2d40e9..c14ecff6 100644
--- a/test/lib/completions/set.exp
+++ b/test/lib/completions/set.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/sftp.exp b/test/lib/completions/sftp.exp
index 24c37cb5..27fe7511 100644
--- a/test/lib/completions/sftp.exp
+++ b/test/lib/completions/sftp.exp
@@ -1,15 +1,19 @@
proc setup {} {
save_env
-}; # setup()
+ # NOTE: Changing dir to $SRCDIR is necessary because file locations in the
+ # ssh config files (e.g. UserKnownHostsFile) are relative to $SRCDIR.
+ assert_bash_exec {cd $SRCDIR/fixtures/sftp}
+}
proc teardown {} {
+ assert_bash_exec {cd $TESTDIR}
assert_env_unmodified {
/BASH_LINENO=/d
/BASH_SOURCE=/d
/OLDPWD=/d
}
-}; # teardown()
+}
setup
@@ -18,10 +22,9 @@ 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
+ # Hosts `10.10.10.10', `doo' and `ike' are defined in ./fixtures/sftp/known_hosts
+lappend expected 10.10.10.10 doo gee hus ike
+assert_complete $expected "sftp -F config "
sync_after_int
@@ -36,7 +39,7 @@ expect {
-re "^$cmd\r\n.*\r\n/@" { pass "$test" }
-re /@ { unresolved "$test at prompt" }
default { unresolved "$test" }
-}; # expect
+}
sync_after_int
@@ -45,33 +48,17 @@ 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
+ # Hosts `gee', `hus' and `jar' are defined in "./fixtures/sftp/spaced conf"
+ # Hosts `10.10.10.10', `doo' and `ike' are defined in ./fixtures/sftp/known_hosts
+lappend expected 10.10.10.10 doo gee hus ike jar
+assert_complete $expected "sftp -F spaced\\ \\ conf "
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"}
+assert_complete "-Fspaced\\ \\ conf" "sftp -Fsp" "-F should complete filename"
+sync_after_int
teardown
diff --git a/test/lib/completions/sh.exp b/test/lib/completions/sh.exp
new file mode 100644
index 00000000..e1a51bb9
--- /dev/null
+++ b/test/lib/completions/sh.exp
@@ -0,0 +1,38 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "sh -"
+
+
+sync_after_int
+
+
+assert_complete_any "sh +"
+
+
+sync_after_int
+
+
+assert_complete_any "sh -o "
+
+
+sync_after_int
+
+
+assert_no_complete "sh -c "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/sha1sum.exp b/test/lib/completions/sha1sum.exp
index 17519087..c5983044 100644
--- a/test/lib/completions/sha1sum.exp
+++ b/test/lib/completions/sha1sum.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/shar.exp b/test/lib/completions/shar.exp
index 7ace9d6e..604a2031 100644
--- a/test/lib/completions/shar.exp
+++ b/test/lib/completions/shar.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/sitecopy.exp b/test/lib/completions/sitecopy.exp
index 49b78918..7e0c87fe 100644
--- a/test/lib/completions/sitecopy.exp
+++ b/test/lib/completions/sitecopy.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/smartctl.exp b/test/lib/completions/smartctl.exp
index a9eeb956..24919396 100644
--- a/test/lib/completions/smartctl.exp
+++ b/test/lib/completions/smartctl.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/snownews.exp b/test/lib/completions/snownews.exp
index 7502e587..c8ad6741 100644
--- a/test/lib/completions/snownews.exp
+++ b/test/lib/completions/snownews.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/sort.exp b/test/lib/completions/sort.exp
index 20516cc8..a130bbc8 100644
--- a/test/lib/completions/sort.exp
+++ b/test/lib/completions/sort.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/split.exp b/test/lib/completions/split.exp
index b74da369..e13df49a 100644
--- a/test/lib/completions/split.exp
+++ b/test/lib/completions/split.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
@@ -13,7 +13,7 @@ setup
if {[assert_exec {split --help} "" "" "unsupported"]} {
assert_complete_any "split --"
-}; # if
+}
sync_after_int
diff --git a/test/lib/completions/spovray.exp b/test/lib/completions/spovray.exp
index 30d81853..2b2c33de 100644
--- a/test/lib/completions/spovray.exp
+++ b/test/lib/completions/spovray.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/sqlite3.exp b/test/lib/completions/sqlite3.exp
new file mode 100644
index 00000000..af1ada82
--- /dev/null
+++ b/test/lib/completions/sqlite3.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "sqlite3 "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/ssh.exp b/test/lib/completions/ssh.exp
index 91955c1d..1599dccc 100644
--- a/test/lib/completions/ssh.exp
+++ b/test/lib/completions/ssh.exp
@@ -1,15 +1,19 @@
proc setup {} {
save_env
-}; # setup()
+ # NOTE: Changing dir to $SRCDIR is necessary because file locations in the
+ # ssh config files (e.g. UserKnownHostsFile) are relative to $SRCDIR.
+ assert_bash_exec {cd $SRCDIR/fixtures/ssh}
+}
proc teardown {} {
+ assert_bash_exec {cd $TESTDIR}
assert_env_unmodified {
/BASH_LINENO=/d
/BASH_SOURCE=/d
/OLDPWD=/d
}
-}; # teardown()
+}
setup
@@ -17,19 +21,14 @@ 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$"
+set expected "^$cmd\r\n.*ls.*ls_known_host.*\r\n/@$cmd$"
expect {
-re $expected { pass "$test" }
- -re $prompt { unresolved "$test at prompt" }
+ -re /@ { unresolved "$test at prompt" }
default { unresolved "$test" }
-}; # expect
-sync_after_int $prompt
-assert_bash_exec {cd "$TESTDIR"}
+}
sync_after_int
@@ -45,7 +44,7 @@ expect {
-re "^$cmd\r\n.*\r\n/@" { pass "$test" }
-re /@ { unresolved "$test at prompt" }
default { unresolved "$test" }
-}; # expect
+}
sync_after_int
@@ -61,30 +60,14 @@ sync_after_int
set test "First argument should complete partial hostname"
-assert_complete_partial [get_hosts] ssh "" $test /@ 20 \
- [list "ltrim_colon_completions"]
+assert_complete_partial [get_hosts] ssh "" $test -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"}
+assert_complete "-Fspaced\\ \\ conf" "ssh -Fsp" $test
sync_after_int
diff --git a/test/lib/completions/sshmitm.exp b/test/lib/completions/sshmitm.exp
index b8f8a2c9..13b50673 100644
--- a/test/lib/completions/sshmitm.exp
+++ b/test/lib/completions/sshmitm.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/sshow.exp b/test/lib/completions/sshow.exp
index 36a6cc2c..074d7b12 100644
--- a/test/lib/completions/sshow.exp
+++ b/test/lib/completions/sshow.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/strace.exp b/test/lib/completions/strace.exp
index 55004d20..933d1b48 100644
--- a/test/lib/completions/strace.exp
+++ b/test/lib/completions/strace.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/strip.exp b/test/lib/completions/strip.exp
index 46d9f362..00f4ab9c 100644
--- a/test/lib/completions/strip.exp
+++ b/test/lib/completions/strip.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/sudo.exp b/test/lib/completions/sudo.exp
index 1299a6da..d6bbbbb6 100644
--- a/test/lib/completions/sudo.exp
+++ b/test/lib/completions/sudo.exp
@@ -1,17 +1,24 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
- assert_env_unmodified
-}; # teardown()
+ assert_env_unmodified {/OLDPWD/d}
+}
setup
-assert_complete "fixtures/shared/default/foo.d/" "sudo cd fixtures/shared/default/fo"
+assert_complete_dir foo.d/ "sudo cd fo" $::srcdir/fixtures/shared/default \
+ "" -nospace
+
+
+sync_after_int
+
+
+assert_complete_dir fixtures/ "sudo sh fix" $::srcdir "" -nospace
sync_after_int
diff --git a/test/lib/completions/svk.exp b/test/lib/completions/svk.exp
index a08674dc..a794a008 100644
--- a/test/lib/completions/svk.exp
+++ b/test/lib/completions/svk.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/svn.exp b/test/lib/completions/svn.exp
index fe40d6f7..d1a08ae4 100644
--- a/test/lib/completions/svn.exp
+++ b/test/lib/completions/svn.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/svnadmin.exp b/test/lib/completions/svnadmin.exp
index 35e07021..f20d52cf 100644
--- a/test/lib/completions/svnadmin.exp
+++ b/test/lib/completions/svnadmin.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/svnlook.exp b/test/lib/completions/svnlook.exp
index 33b67052..114435ec 100644
--- a/test/lib/completions/svnlook.exp
+++ b/test/lib/completions/svnlook.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/sync_members.exp b/test/lib/completions/sync_members.exp
index 4cb84ad8..817432bb 100644
--- a/test/lib/completions/sync_members.exp
+++ b/test/lib/completions/sync_members.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/sysbench.exp b/test/lib/completions/sysbench.exp
new file mode 100644
index 00000000..2a0fe339
--- /dev/null
+++ b/test/lib/completions/sysbench.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "sysbench "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/sysctl.exp b/test/lib/completions/sysctl.exp
index e1866f55..6aa9ffe0 100644
--- a/test/lib/completions/sysctl.exp
+++ b/test/lib/completions/sysctl.exp
@@ -1,19 +1,20 @@
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
+ set test "sysctl kern should show completions"
+ assert_complete $values "sysctl kern" $test -expect-cmd-minus kern
+}
sync_after_int
diff --git a/test/lib/completions/tac.exp b/test/lib/completions/tac.exp
index 21230052..d4fe7937 100644
--- a/test/lib/completions/tac.exp
+++ b/test/lib/completions/tac.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/tail.exp b/test/lib/completions/tail.exp
index c8a82d97..fd685b1a 100644
--- a/test/lib/completions/tail.exp
+++ b/test/lib/completions/tail.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
@@ -13,7 +13,7 @@ setup
if {[assert_exec {tail --help} "" "" "unsupported"]} {
assert_complete_any "tail --"
-}; # if
+}
sync_after_int
diff --git a/test/lib/completions/tar.exp b/test/lib/completions/tar.exp
index 43c60ff9..37f1ae4b 100644
--- a/test/lib/completions/tar.exp
+++ b/test/lib/completions/tar.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/tcpkill.exp b/test/lib/completions/tcpkill.exp
index e8cc9c10..d3a45e43 100644
--- a/test/lib/completions/tcpkill.exp
+++ b/test/lib/completions/tcpkill.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/tcpnice.exp b/test/lib/completions/tcpnice.exp
index 44bb59c6..b4b93097 100644
--- a/test/lib/completions/tcpnice.exp
+++ b/test/lib/completions/tcpnice.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/tee.exp b/test/lib/completions/tee.exp
index c25057ba..1058bb8e 100644
--- a/test/lib/completions/tee.exp
+++ b/test/lib/completions/tee.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/texindex.exp b/test/lib/completions/texindex.exp
index d5b8cd77..43b4c09a 100644
--- a/test/lib/completions/texindex.exp
+++ b/test/lib/completions/texindex.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/tightvncviewer.exp b/test/lib/completions/tightvncviewer.exp
index 6eba24c2..ee987f60 100644
--- a/test/lib/completions/tightvncviewer.exp
+++ b/test/lib/completions/tightvncviewer.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/time.exp b/test/lib/completions/time.exp
index b114318b..3bed4fdf 100644
--- a/test/lib/completions/time.exp
+++ b/test/lib/completions/time.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/touch.exp b/test/lib/completions/touch.exp
index f0960ef7..61d22b33 100644
--- a/test/lib/completions/touch.exp
+++ b/test/lib/completions/touch.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
@@ -13,7 +13,7 @@ setup
if {[assert_exec {touch --help} "" "" "unsupported"]} {
assert_complete_any "touch --"
-}; # if
+}
sync_after_int
diff --git a/test/lib/completions/tr.exp b/test/lib/completions/tr.exp
index 68b11a36..c10c8ba1 100644
--- a/test/lib/completions/tr.exp
+++ b/test/lib/completions/tr.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
@@ -13,7 +13,7 @@ setup
if {[assert_exec {tr --help} "" "" "unsupported"]} {
assert_complete_any "tr --"
-}; # if
+}
sync_after_int
diff --git a/test/lib/completions/tune2fs.exp b/test/lib/completions/tune2fs.exp
new file mode 100644
index 00000000..df70d904
--- /dev/null
+++ b/test/lib/completions/tune2fs.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "tune2fs "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/unace.exp b/test/lib/completions/unace.exp
index 0afbaafb..c9d7606e 100644
--- a/test/lib/completions/unace.exp
+++ b/test/lib/completions/unace.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/uname.exp b/test/lib/completions/uname.exp
index 2179dafd..0c363ab5 100644
--- a/test/lib/completions/uname.exp
+++ b/test/lib/completions/uname.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
@@ -13,7 +13,7 @@ setup
if {[assert_exec {uname --help} "" "" "unsupported"]} {
assert_complete_any "uname --"
-}; # if
+}
sync_after_int
diff --git a/test/lib/completions/unexpand.exp b/test/lib/completions/unexpand.exp
index 31822561..c9aecc25 100644
--- a/test/lib/completions/unexpand.exp
+++ b/test/lib/completions/unexpand.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
@@ -13,7 +13,7 @@ setup
if {[assert_exec {unexpand --help} "" "" "unsupported"]} {
assert_complete_any "unexpand --"
-}; # if
+}
sync_after_int
diff --git a/test/lib/completions/uniq.exp b/test/lib/completions/uniq.exp
index 20dbcfac..d516106c 100644
--- a/test/lib/completions/uniq.exp
+++ b/test/lib/completions/uniq.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
@@ -13,7 +13,7 @@ setup
if {[assert_exec {uniq --help} "" "" "unsupported"]} {
assert_complete_any "uniq --"
-}; # if
+}
sync_after_int
diff --git a/test/lib/completions/units.exp b/test/lib/completions/units.exp
index a40b5f3f..96ec91d1 100644
--- a/test/lib/completions/units.exp
+++ b/test/lib/completions/units.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
@@ -13,7 +13,7 @@ setup
if {[assert_exec {units --help} "" "" "unsupported"]} {
assert_complete_any "units --"
-}; # if
+}
sync_after_int
diff --git a/test/lib/completions/unpack200.exp b/test/lib/completions/unpack200.exp
index 845701dd..b4360491 100644
--- a/test/lib/completions/unpack200.exp
+++ b/test/lib/completions/unpack200.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/unrar.exp b/test/lib/completions/unrar.exp
index e66e3c8b..b5e27b21 100644
--- a/test/lib/completions/unrar.exp
+++ b/test/lib/completions/unrar.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/unset.exp b/test/lib/completions/unset.exp
index a5e7fc9b..42e753cb 100644
--- a/test/lib/completions/unset.exp
+++ b/test/lib/completions/unset.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/unshunt.exp b/test/lib/completions/unshunt.exp
index 964cac68..96cd5860 100644
--- a/test/lib/completions/unshunt.exp
+++ b/test/lib/completions/unshunt.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/update-alternatives.exp b/test/lib/completions/update-alternatives.exp
index 10ff4e6d..b94d88c5 100644
--- a/test/lib/completions/update-alternatives.exp
+++ b/test/lib/completions/update-alternatives.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/update-rc.d.exp b/test/lib/completions/update-rc.d.exp
index 9c2c2464..f2eafea5 100644
--- a/test/lib/completions/update-rc.d.exp
+++ b/test/lib/completions/update-rc.d.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/urlsnarf.exp b/test/lib/completions/urlsnarf.exp
index c5b26922..ed543629 100644
--- a/test/lib/completions/urlsnarf.exp
+++ b/test/lib/completions/urlsnarf.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/vdir.exp b/test/lib/completions/vdir.exp
index b525c382..c0e5ee43 100644
--- a/test/lib/completions/vdir.exp
+++ b/test/lib/completions/vdir.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/vgcfgbackup.exp b/test/lib/completions/vgcfgbackup.exp
index 19ceeeca..b7e509a2 100644
--- a/test/lib/completions/vgcfgbackup.exp
+++ b/test/lib/completions/vgcfgbackup.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/vgcfgrestore.exp b/test/lib/completions/vgcfgrestore.exp
index e1c3c3b9..e40cd213 100644
--- a/test/lib/completions/vgcfgrestore.exp
+++ b/test/lib/completions/vgcfgrestore.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/vgchange.exp b/test/lib/completions/vgchange.exp
index 645eedb4..b6c0e1df 100644
--- a/test/lib/completions/vgchange.exp
+++ b/test/lib/completions/vgchange.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/vgck.exp b/test/lib/completions/vgck.exp
index 67209b15..b4d58aec 100644
--- a/test/lib/completions/vgck.exp
+++ b/test/lib/completions/vgck.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/vgconvert.exp b/test/lib/completions/vgconvert.exp
index 065c4828..362c44b6 100644
--- a/test/lib/completions/vgconvert.exp
+++ b/test/lib/completions/vgconvert.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/vgcreate.exp b/test/lib/completions/vgcreate.exp
index 7c324e62..4cb7dd45 100644
--- a/test/lib/completions/vgcreate.exp
+++ b/test/lib/completions/vgcreate.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/vgdisplay.exp b/test/lib/completions/vgdisplay.exp
index b6bc9125..6a8ed84d 100644
--- a/test/lib/completions/vgdisplay.exp
+++ b/test/lib/completions/vgdisplay.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/vgexport.exp b/test/lib/completions/vgexport.exp
index 2ad4230e..2900960f 100644
--- a/test/lib/completions/vgexport.exp
+++ b/test/lib/completions/vgexport.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/vgextend.exp b/test/lib/completions/vgextend.exp
index 18a491d2..3c46a8f0 100644
--- a/test/lib/completions/vgextend.exp
+++ b/test/lib/completions/vgextend.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/vgimport.exp b/test/lib/completions/vgimport.exp
index e4568f3b..ed04e282 100644
--- a/test/lib/completions/vgimport.exp
+++ b/test/lib/completions/vgimport.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/vgmerge.exp b/test/lib/completions/vgmerge.exp
index 8ba5e893..a4f8833b 100644
--- a/test/lib/completions/vgmerge.exp
+++ b/test/lib/completions/vgmerge.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/vgmknodes.exp b/test/lib/completions/vgmknodes.exp
index d24552f0..5c9feeb3 100644
--- a/test/lib/completions/vgmknodes.exp
+++ b/test/lib/completions/vgmknodes.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/vgreduce.exp b/test/lib/completions/vgreduce.exp
index 887ba8de..f6af3150 100644
--- a/test/lib/completions/vgreduce.exp
+++ b/test/lib/completions/vgreduce.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/vgremove.exp b/test/lib/completions/vgremove.exp
index 26dadf95..0dc5eda8 100644
--- a/test/lib/completions/vgremove.exp
+++ b/test/lib/completions/vgremove.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/vgrename.exp b/test/lib/completions/vgrename.exp
index 8ddaa758..81438631 100644
--- a/test/lib/completions/vgrename.exp
+++ b/test/lib/completions/vgrename.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/vgs.exp b/test/lib/completions/vgs.exp
index a27e3650..22ab176b 100644
--- a/test/lib/completions/vgs.exp
+++ b/test/lib/completions/vgs.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/vgscan.exp b/test/lib/completions/vgscan.exp
index 4bb8c35e..ae8168c8 100644
--- a/test/lib/completions/vgscan.exp
+++ b/test/lib/completions/vgscan.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/vgsplit.exp b/test/lib/completions/vgsplit.exp
index 54e7034f..b183cfda 100644
--- a/test/lib/completions/vgsplit.exp
+++ b/test/lib/completions/vgsplit.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/vncviewer.exp b/test/lib/completions/vncviewer.exp
index 3d47f49f..8c51e0b2 100644
--- a/test/lib/completions/vncviewer.exp
+++ b/test/lib/completions/vncviewer.exp
@@ -1,13 +1,13 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified {
/declare -f _vncviewer_bootstrap/d
}
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/wc.exp b/test/lib/completions/wc.exp
index 8ad2bf8d..b261b6a7 100644
--- a/test/lib/completions/wc.exp
+++ b/test/lib/completions/wc.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
@@ -13,7 +13,7 @@ setup
if {[assert_exec {wc --help} "" "" "unsupported"]} {
assert_complete_any "wc --"
-}; # if
+}
sync_after_int
diff --git a/test/lib/completions/webmitm.exp b/test/lib/completions/webmitm.exp
index 1d48a3a6..adb97cc2 100644
--- a/test/lib/completions/webmitm.exp
+++ b/test/lib/completions/webmitm.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/wget.exp b/test/lib/completions/wget.exp
index 245b27be..8e830a12 100644
--- a/test/lib/completions/wget.exp
+++ b/test/lib/completions/wget.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/who.exp b/test/lib/completions/who.exp
index 73928ef7..6cca6795 100644
--- a/test/lib/completions/who.exp
+++ b/test/lib/completions/who.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
@@ -13,7 +13,7 @@ setup
if {[assert_exec {who --help} "" "" "unsupported"]} {
assert_complete_any "who --"
-}; # if
+}
sync_after_int
diff --git a/test/lib/completions/withlist.exp b/test/lib/completions/withlist.exp
index 6310466d..e1f91f6a 100644
--- a/test/lib/completions/withlist.exp
+++ b/test/lib/completions/withlist.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/wol.exp b/test/lib/completions/wol.exp
index 84a2d88d..a4ac9e4e 100644
--- a/test/lib/completions/wol.exp
+++ b/test/lib/completions/wol.exp
@@ -1,14 +1,14 @@
proc setup {} {
# See fixtures/shared/bin/{arp,ifconfig}
- assert_bash_exec {OLDPATH="$PATH"; PATH="$TESTDIR/fixtures/shared/bin:$PATH";}
+ assert_bash_exec {OLDPATH="$PATH"; PATH="$SRCDIR/fixtures/shared/bin:$PATH";}
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
assert_bash_exec {PATH="$OLDPATH"; unset -v OLDPATH}
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/wtf.exp b/test/lib/completions/wtf.exp
index 8250becc..b1693c80 100644
--- a/test/lib/completions/wtf.exp
+++ b/test/lib/completions/wtf.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/wvdial.exp b/test/lib/completions/wvdial.exp
index 8d4669de..5b52daa8 100644
--- a/test/lib/completions/wvdial.exp
+++ b/test/lib/completions/wvdial.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/xhost.exp b/test/lib/completions/xhost.exp
index aeceadb6..d4098ade 100644
--- a/test/lib/completions/xhost.exp
+++ b/test/lib/completions/xhost.exp
@@ -1,12 +1,12 @@
proc setup {} {
assert_bash_exec {HOME=$TESTDIR}
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
@@ -17,7 +17,7 @@ set test "Tab should complete hostnames"
set hosts {}
foreach h [exec bash -c "compgen -A hostname"] {
lappend hosts $h
-}; # foreach
+}
assert_complete $hosts "xhost " $test
@@ -33,8 +33,8 @@ foreach h [exec bash -c "compgen -A hostname"] {
# 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
@@ -46,7 +46,7 @@ set test "Tab should complete hostnames prefixed with +"
set hosts {}
foreach h [exec bash -c "compgen -A hostname"] {
lappend hosts "+$h"
-}; # foreach
+}
assert_complete $hosts "xhost \+" $test
@@ -61,8 +61,8 @@ foreach h [exec bash -c "compgen -A hostname"] {
# Only append hostname if starting with $char
if {[string range $h 0 0] == "$char"} {
lappend hosts "+$h"
- }; # if
-}; # foreach
+ }
+}
assert_complete $hosts "xhost +$char"
@@ -74,7 +74,7 @@ set test "Tab should complete hostnames prefixed with -"
set hosts {}
foreach h [exec bash -c "compgen -A hostname"] {
lappend hosts "-$h"
-}; # foreach
+}
assert_complete $hosts "xhost -" $test
@@ -89,8 +89,8 @@ foreach h [exec bash -c "compgen -A hostname"] {
# 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
diff --git a/test/lib/completions/xmllint.exp b/test/lib/completions/xmllint.exp
index 15451471..20daab6d 100644
--- a/test/lib/completions/xmllint.exp
+++ b/test/lib/completions/xmllint.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/xmlwf.exp b/test/lib/completions/xmlwf.exp
index a996d458..6c306f34 100644
--- a/test/lib/completions/xmlwf.exp
+++ b/test/lib/completions/xmlwf.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/xmms.exp b/test/lib/completions/xmms.exp
index c4ad64e8..1f1f6d57 100644
--- a/test/lib/completions/xmms.exp
+++ b/test/lib/completions/xmms.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/xmodmap.exp b/test/lib/completions/xmodmap.exp
new file mode 100644
index 00000000..2bf4da1c
--- /dev/null
+++ b/test/lib/completions/xmodmap.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "xmodmap "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/xpovray.exp b/test/lib/completions/xpovray.exp
index 92cc903d..53a5fcd0 100644
--- a/test/lib/completions/xpovray.exp
+++ b/test/lib/completions/xpovray.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/xrandr.exp b/test/lib/completions/xrandr.exp
index 649ed43b..14beb762 100644
--- a/test/lib/completions/xrandr.exp
+++ b/test/lib/completions/xrandr.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/xrdb.exp b/test/lib/completions/xrdb.exp
new file mode 100644
index 00000000..f02625dc
--- /dev/null
+++ b/test/lib/completions/xrdb.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "xrdb "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/xsltproc.exp b/test/lib/completions/xsltproc.exp
index 2470c22e..2c558ff1 100644
--- a/test/lib/completions/xsltproc.exp
+++ b/test/lib/completions/xsltproc.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/xvnc4viewer.exp b/test/lib/completions/xvnc4viewer.exp
index 3456c3e7..b10e272c 100644
--- a/test/lib/completions/xvnc4viewer.exp
+++ b/test/lib/completions/xvnc4viewer.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/xz.exp b/test/lib/completions/xz.exp
index 820b0689..6e6b29ca 100644
--- a/test/lib/completions/xz.exp
+++ b/test/lib/completions/xz.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
- assert_env_unmodified
-}; # teardown()
+ assert_env_unmodified {/OLDPWD=/d}
+}
setup
@@ -17,14 +17,14 @@ assert_complete_any "xz "
sync_after_int
-assert_complete "a/ bashcomp.lzma bashcomp.tar.xz bashcomp.tlz bashcomp.xz" \
- "xz -d fixtures/xz/"
+assert_complete_dir "a/ bashcomp.lzma bashcomp.tar.xz bashcomp.tlz bashcomp.xz" \
+ "xz -d " $::srcdir/fixtures/xz
sync_after_int
-assert_complete "a/ bashcomp.tar" "xz fixtures/xz/"
+assert_complete_dir "a/ bashcomp.tar" "xz " $::srcdir/fixtures/xz
sync_after_int
diff --git a/test/lib/completions/ypcat.exp b/test/lib/completions/ypcat.exp
index f1bd0c0e..a8249dc2 100644
--- a/test/lib/completions/ypcat.exp
+++ b/test/lib/completions/ypcat.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/ypmatch.exp b/test/lib/completions/ypmatch.exp
index f1695f67..ac264c18 100644
--- a/test/lib/completions/ypmatch.exp
+++ b/test/lib/completions/ypmatch.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/yum-arch.exp b/test/lib/completions/yum-arch.exp
index defb7bf4..85c47c22 100644
--- a/test/lib/completions/yum-arch.exp
+++ b/test/lib/completions/yum-arch.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/completions/yum.exp b/test/lib/completions/yum.exp
index 09d7282c..899ecddb 100644
--- a/test/lib/completions/yum.exp
+++ b/test/lib/completions/yum.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified
-}; # teardown()
+}
setup
diff --git a/test/lib/library.exp b/test/lib/library.exp
index c76d9854..61b3f409 100644
--- a/test/lib/library.exp
+++ b/test/lib/library.exp
@@ -1,7 +1,8 @@
- # Source `init.tcl' again to restore the `unknown' procedure
- # NOTE: DejaGnu has an old `unknown' procedure which unfortunately disables
- # tcl auto-loading.
+# 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 cmdline
package require textutil::string
@@ -22,7 +23,7 @@ proc assert_bash_exec {{aCmd ""} {title ""} {prompt /@} {out -1}} {
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
@@ -33,24 +34,16 @@ proc assert_bash_exec {{aCmd ""} {title ""} {prompt /@} {out -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
+ fail "ERROR Unexpected output from bash command \"$title\""
+ }
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()
+ $prompt {fail "ERROR executing bash command \"$title\""}
+ }
+}
# Test `type ...' in bash
@@ -64,32 +57,45 @@ proc assert_bash_type {command} {
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}} {
+# Make sure the expected list matches the real list, as returned by executing
+# the specified bash command.
+# Specify `-sort' if the real list is sorted.
+# @param list $expected Expected list items
+# @param string $cmd Bash command to execute in order to generate real list
+# items
+# @param string $test Test title. Becomes "$cmd should show expected output"
+# if empty string.
+# @param list $args Options:
+# -sort Compare list sorted. Default is unsorted
+# -prompt Bash prompt. Default is `/@'
+# -chunk-size N Compare list N items at a time. Default
+# is 20.
+proc assert_bash_list {expected cmd test {args {}}} {
+ array set arg [::cmdline::getoptions args {
+ {sort "compare list sorted"}
+ {prompt.arg /@ "bash prompt"}
+ {chunk-size.arg 20 "compare N list items at a time"}
+ }]
+ set prompt $arg(prompt)
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" }
- }
+ if {$arg(sort)} {set bash_sort "-bash-sort"} {set bash_sort ""}
+ if {[
+ eval match_items \$expected $bash_sort -chunk-size \
+ \$arg(chunk-size) -end-newline -end-prompt \
+ -prompt \$prompt
+ ]} {
+ pass "$test"
} else {
fail "$test"
}
@@ -97,130 +103,235 @@ proc assert_bash_list {expected cmd {test ""} {prompt /@} {size 20}} {
}
-proc assert_bash_list_dir {expected cmd dir {test ""} {prompt /@} {size 20}} {
- set prompt "/$dir/@"
+# Make sure the expected list matches the real list, as returned by executing
+# the specified bash command within the specified directory.
+# Specify `-sort' if the real list is sorted.
+# @param list $expected Expected list items
+# @param string $cmd Bash command to generate real list items
+# @param string $dir Directory to execute $cmd within
+# @param string $test Test title. Becomes "$cmd should show expected output"
+# if empty string.
+# @param list $args Options:
+# -sort Compare list sorted. Default is unsorted
+# -prompt Bash prompt. Default is `/@'
+# -chunk-size N Compare list N items at a time. Default
+# is 20.
+proc assert_bash_list_dir {expected cmd dir test {args {}}} {
+ array set arg [::cmdline::getoptions args {
+ {sort "compare list sorted"}
+ {prompt.arg "/@" "bash prompt"}
+ {chunk-size.arg 20 "compare N list items at a time"}
+ }]
+ set prompt $arg(prompt)
+ if {$arg(sort)} {set arg_sort "-sort"} else {set arg_sort ""}
assert_bash_exec "cd $dir" "" $prompt
- assert_bash_list $expected $cmd $test $prompt $size
+ assert_bash_list $expected $cmd $test $arg_sort \
+ -chunk-size $arg(chunk-size) -prompt $prompt
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.
+# command. If the number of expected items is one, expected is:
+#
+# $cmd<TAB>$expected[<SPACE>]
+#
+# SPACE is not expected if -nospace is specified.
+#
+# If the number of expected items is greater than one, expected is:
+#
+# $cmd<TAB>\n
+# $expected\n
+# $prompt + ($cmd - AUTO) + longest-common-prefix-of-$expected
+#
+# AUTO is calculated like this: If $cmd ends with non-whitespace, and
+# the last argument of $cmd equals the longest-common-prefix of
+# $expected, $cmd minus this argument will be expected.
+#
+# If the algorithm above fails, you can manually specify the CWORD to be
+# subtracted from $cmd specifying `-expect-cmd-minus CWORD'. Known cases where
+# this is useful are when:
+# - the last whitespace is escaped, e.g. "finger foo\ " or "finger
+# 'foo "
+#
+# If the entire $cmd is expected, specify `-expect-cmd-full'.
+#
# @param list $expected Expected completions.
# @param string $cmd Command given to generate items
-# @param string $test (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 ""}} {
+# @param string $test Test title
+# @param list $args Options:
+# -prompt PROMPT Bash prompt. Default is `/@'
+# -chunk-size CHUNK-SIZE Compare list CHUNK-SIZE items at
+# a time. Default is 20.
+# -nospace Don't expect space character to be output after completion match.
+# Valid only if a single completion is expected.
+# -ltrim-colon-completions Left-trim completions with cword containing
+# colon (:)
+# -expect-cmd-full Expect the full $cmd to be echoed. Expected is:
+#
+# $cmd<TAB>\n
+# $expected\n
+# $prompt + $cmd + longest-common-prefix-of-$expected
+#
+# -expect-cmd-minus DWORD Expect $cmd minus DWORD to be echoed.
+# Expected is:
+#
+# $cmd<TAB>\n
+# $expected\n
+# $prompt + ($cmd - DWORD) + longest-common-prefix-of-$expected
+#
+proc assert_complete {expected cmd {test ""} {args {}}} {
+ set args_orig $args
+ array set arg [::cmdline::getoptions args {
+ {prompt.arg "/@" "bash prompt"}
+ {chunk-size.arg 20 "compare N list items at a time"}
+ {nospace "don't expect space after completion"}
+ {ltrim-colon-completions "left-trim completions with cword containing :"}
+ {expect-cmd-full "Expect full cmd after prompt"}
+ {expect-cmd-minus.arg "" "Expect cmd minus DWORD after prompt"}
+ }]
if {[llength $expected] == 0} {
assert_no_complete $cmd $test
+ } elseif {[llength $expected] == 1} {
+ eval assert_complete_one \$expected \$cmd \$test $args_orig
} 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()
+ eval assert_complete_many \$expected \$cmd \$test $args_orig
+ }
+}
+
+
+# Make sure the expected multiple items are returned by TAB-completing the
+# specified command.
+# @see assert_complete()
+proc assert_complete_many {expected cmd {test ""} {args {}}} {
+ array set arg [::cmdline::getoptions args {
+ {prompt.arg "/@" "bash prompt"}
+ {chunk-size.arg 20 "compare N list items at a time"}
+ {nospace "don't expect space after completion"}
+ {ltrim-colon-completions "left-trim completions with cword containing :"}
+ {expect-cmd-full "Expect full cmd after prompt"}
+ {expect-cmd-minus.arg "" "Expect cmd minus CWORD after prompt"}
+ }]
+ if {$test == ""} {set test "$cmd should show completions"}
+ set prompt $arg(prompt)
+ set dword ""
+ if {$arg(expect-cmd-minus) != ""} {set dword $arg(expect-cmd-minus)}
+
+ send "$cmd\t"
+ expect -ex "$cmd\r\n"
+ # Make sure expected items are unique
+ set expected [lsort -unique $expected]
-# @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.
+ # Determine common prefix of completions
+ set common [::textutil::string::longestCommonPrefixList $expected]
+
+ if {$arg(ltrim-colon-completions)} {
+ # If partial contains colon (:), remove partial from begin of items
+ _ltrim_colon_completions $cmd expected dword
+ }
+ set cmd2 [_remove_cword_from_cmd $cmd $dword $common]
+
+ set prompt "$prompt$cmd2$common"
+ if {$arg(nospace)} {set endspace ""} else {set endspace "-end-space"}
+ set endprompt "-end-prompt"
+ if {[
+ eval match_items \$expected -bash-sort -chunk-size \
+ \$arg(chunk-size) $endprompt $endspace -prompt \$prompt
+ ]} {
+ pass "$test"
+ } else {
+ fail "$test"
+ }
+}
+
+
+# Make sure the expected single item is returned by TAB-completing the
+# specified command.
+# @see assert_complete()
+proc assert_complete_one {expected cmd {test ""} {args {}}} {
+ array set arg [::cmdline::getoptions args {
+ {prompt.arg "/@" "bash prompt"}
+ {chunk-size.arg 20 "compare N list items at a time"}
+ {nospace "don't expect space after completion"}
+ {ltrim-colon-completions "left-trim completions with cword containing :"}
+ {expect-cmd-full "Expect full cmd after prompt"}
+ {expect-cmd-minus.arg "" "Expect cmd minus CWORD after prompt"}
+ }]
+ set prompt $arg(prompt)
+
+ if {$test == ""} {set test "$cmd should show completion"}
+ send "$cmd\t"
+ expect -ex "$cmd"
+ if {$arg(ltrim-colon-completions)} {
+ # If partial contains colon (:), remove partial from begin of items
+ _ltrim_colon_completions $cmd expected cword
+ } else {
+ 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]
+ }
+ # Remove second word from beginning of $expected
+ if {[string first $cur $expected] == 0} {
+ set expected [list [string range $expected [string length $cur] end]]
+ }
+ }
+
+ if {$arg(nospace)} {set endspace ""} else {set endspace "-end-space"}
+ if {[
+ eval match_items \$expected -bash-sort -chunk-size \
+ \$arg(chunk-size) $endspace -prompt \$prompt
+ ]} {
+ pass "$test"
+ } else {
+ fail "$test"
+ }
+}
+
+
+# @param string $cmd Command to remove current-word-to-complete from.
+# @param string $dword (optional) Manually specify current-word-to-complete,
+# i.e. word to remove from $cmd. If empty string (default),
+# `_remove_cword_from_cmd' autodetects if the last argument is the
+# current-word-to-complete by checking if $cmd doesn't end with whitespace.
+# Specifying `dword' 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 ""}} {
+# @param string $common (optional) Common prefix of expected completions.
+# @return string Command with current-word-to-complete removed
+proc _remove_cword_from_cmd {cmd {dword ""} {common ""}} {
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
+ # Is $dword specified?
+ if {[string length $dword] > 0} {
+ # Remove $dword from end of $cmd
+ if {[string last $dword $cmd] == [string length $cmd] - [string length $dword]} {
+ set cmd2 [string range $cmd 0 [expr [string last $dword $cmd] - 1]]
+ }
} else {
- # No, $cword not specified;
- # Check if last argument is really an-argument-to-complete, i.e.
+ # No, $dword not specified;
+ # Check if last argument is really a word-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.
+ # $dword 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
+ set cmds [split $cmd]
+ # Does word-to-complete start with $common?
+ if {[string first $common [lrange $cmds end end]] == 0} {
+ # Remove word-to-complete from end of $cmd
+ set cmd2 [lrange $cmds 0 end-1]
+ append cmd2 " "
+ }
+ }
+ }
return $cmd2
-}; # _remove_cword_from_cmd()
+}
# Escape regexp special characters
@@ -253,8 +364,8 @@ proc assert_complete_any {cmd {test ""} {prompt /@}} {
}
-re $prompt { unresolved "$test at prompt" }
eof { unresolved "eof" }
- }; # expect
-}; # assert_complete_any()
+ }
+}
# Make sure the expected files are returned by TAB-completing the
@@ -262,18 +373,16 @@ proc assert_complete_any {cmd {test ""} {prompt /@}} {
# @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()
+# @param string $test Test title
+# @param list $args 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/@"
+proc assert_complete_dir {expected cmd dir {test ""} {args {}}} {
+ set prompt "/@"
assert_bash_exec "cd $dir" "" $prompt
- assert_complete $expected $cmd $test $prompt $size $cword
+ assert_complete $expected $cmd $test $args
sync_after_int $prompt
assert_bash_exec {cd "$TESTDIR"}
-}; # assert_complete_dir
+}
@@ -284,14 +393,9 @@ proc assert_complete_dir {expected cmd dir {test ""} {size 20} {cword ""}} {
# @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 ""}} {
+# @param string $test Test title
+# @param list $args See: assert_complete()
+proc assert_complete_partial {expected cmd {partial ""} {test ""} {args {}}} {
if {$test == ""} {set test "$cmd should complete partial argument"}
if {[llength $expected] == 0} {
unresolved "$test"
@@ -301,39 +405,54 @@ proc assert_complete_partial {expected cmd {partial ""} {test ""} {prompt /@} {s
set expected [lsort -unique $expected]
foreach item $expected {
if {$partial == ""} {set partial [string range $item 0 0]}
- # Only append item if starting with $partial
+ # 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()
+ }
+ }
+ # NOTE: The `eval' is necessary to flatten the $args list
+ # See also: http://wiki.tcl.tk/11787 - {expand}
+ eval assert_complete \$pick \"\$cmd \$partial\" \$test $args; #"
+ }
+}
+# If cword contains colon (:), left-trim completions with cword
+# @param string $cmd Command to complete
+# @param list $items Reference to list of completions to trim
+# @param string $dword Reference to variable to contain word to remove from
+# expected cmd.
# See also: bash_completion._ltrim_colon_completions
-proc _ltrim_colon_completions {cword items} {
- upvar 1 $cword cword_out
+proc _ltrim_colon_completions {cmd items dword} {
upvar 1 $items items_out
+ upvar 1 $dword dword_out
+
+ 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 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 && (
+ [string first : $cur] > -1 && (
[lindex $::BASH_VERSINFO 0] < 4 ||
([lindex $::BASH_VERSINFO 0] >= 4 && [string first ":" $::COMP_WORDBREAKS] > -1)
)
} {
+ set dword_out $cur
for {set i 0} {$i < [llength $items_out]} {incr i} {
set item [lindex $items_out $i]
- if {[string first $cword_out $item] == 0} {
+ if {[string first $cur $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()
+ lset items_out $i [string range $item [string length $cur] end]
+ }
+ }
+ }
+}
# Make sure the bash environment hasn't changed between now and the last call
@@ -370,7 +489,7 @@ proc assert_env_unmodified {{sed ""} {file ""} {diff ""}} {
append diff "\r\n"
} else {
set diff ""
- }; # if
+ }
# Execute diff
@@ -392,11 +511,11 @@ proc assert_env_unmodified {{sed ""} {file ""} {diff ""}} {
# 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.
@@ -426,10 +545,10 @@ proc assert_exec {cmd {stdout ''} {test ''} {failcmd "unresolved"}} {
unsupported "$test"
} else {
$failcmd "$test"
- }; # if
- }; # if
+ }
+ }
return $result
-}; # assert_exec()
+}
# Check that no completion is attempted on a certain command.
@@ -439,7 +558,7 @@ proc assert_exec {cmd {stdout ''} {test ''} {failcmd "unresolved"}} {
proc assert_no_complete {{cmd} {test ""}} {
if {[string length $test] == 0} {
set test "$cmd shouldn't complete"
- }; # if
+ }
send "$cmd\t"
expect -ex "$cmd"
@@ -451,8 +570,8 @@ proc assert_no_complete {{cmd} {test ""}} {
-re "^$endguard$" { pass "$test" }
default { fail "$test" }
timeout { fail "$test" }
- }; # expect
-}; # assert_no_complete()
+ }
+}
# Check that no output is generated on a certain command.
@@ -483,7 +602,7 @@ proc assert_no_output {{cmd} {test ""} {prompt /@}} {
proc assert_source_completions {command {file ""}} {
if {[is_bash_completion_installed_for $command]} {
if {[string length $file] == 0} {
- set file "lib/completions/$command.exp"
+ set file "$::srcdir/lib/completions/$command.exp"
}
source $file
} else {
@@ -510,7 +629,7 @@ proc get_known_hosts {{cword ''}} {
assert_bash_exec "_known_hosts_real '$cword'; echo_array COMPREPLY" \
{} /@ result
return $result
-}; # get_known_hosts()
+}
# Get hostnames
@@ -524,9 +643,9 @@ proc get_hosts {} {
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
@@ -540,9 +659,9 @@ proc get_hosts_avahi {} {
# No, retrieving hosts yields error;
# Reset hosts
set hosts {}
- }; # if
+ }
return $hosts
-}; # get_hosts_avahi()
+}
# Get signals
@@ -558,21 +677,22 @@ proc get_signals {} {
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
+ global BASH_VERSINFO BASH_VERSION COMP_WORDBREAKS LC_CTYPE
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()
+ assert_bash_exec {eval $(locale); printf "%s" "$LC_CTYPE"} "" /@ LC_CTYPE
+}
# Check whether completion is installed for the specified command by executing
@@ -590,22 +710,44 @@ proc is_bash_completion_installed_for {command} {
}
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.
+# Expect items, a limited number (20) at a time.
# Break items into chunks because `expect' seems to have a limited buffer size
-# @param list $items
-# @param integer $size Chunk size
+# @param list $items Expected list items
+# @param list $args Options:
+# -bash-sort Compare list bash-sorted. Default is
+# unsorted
+# -prompt PROMPT Bash prompt. Default is `/@'
+# -chunk-size CHUNK-SIZE Compare list CHUNK-SIZE items at
+# a time. Default is 20.
+# -end-newline Expect newline after last item.
+# Default is not.
+# -end-prompt Expect prompt after last item.
+# Default is not.
+# -end-space Expect single space after last item.
+# Default is not. Valid only if
+# `end-newline' not set.
# @result boolean True if successful, False if not
-proc match_items {items test {prompt /@} {size 20}} {
- set items [bash_sort $items]
+proc match_items {items {args {}}} {
+ array set arg [::cmdline::getoptions args {
+ {bash-sort "compare list sorted"}
+ {prompt.arg "/@" "bash prompt"}
+ {chunk-size.arg 20 "compare N list items at a time"}
+ {end-newline "expect newline after last item"}
+ {end-prompt "expect prompt after last item"}
+ {end-space "expect space ater last item"}
+ }]
+ set prompt $arg(prompt)
+ set size $arg(chunk-size)
+ if {$arg(bash-sort)} {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
@@ -614,28 +756,43 @@ proc match_items {items test {prompt /@} {size 20}} {
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} {append expected {\s+}}
+ }
if {[llength $items] == 1} {
+ if {$arg(end-prompt)} {set end $prompt} {set end ""}
+ # Both trailing space and newline are specified?
+ if {$arg(end-newline) && $arg(end-space)} {
+ # Indicate both trailing space or newline are ok
+ set expected2 "|^$expected $end$"; # Include space
+ append expected "\r\n$end"; # Include newline
+ } else {
+ if {$arg(end-newline)} {append expected "\r\n$end"}
+ if {$arg(end-space)} {append expected " $end"}
+ set expected2 ""
+ }
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 "^$expected$$expected2" { 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 {
+ set end ""
+ if {$arg(end-prompt) && $i + $j == [llength $items]} {
+ set end "$prompt"
+ _escape_regexp_chars end
+ # \$ matches real end of expect_out buffer
+ set end "$end\$"
+ }
expect {
- -re "^$expected" { set result true }
+ -re "^$expected$end" { set result true }
default { set result false; break }
timeout { set result false; break }
- }; # expect
- }; # if
- }; # for
+ }
+ }
+ }
return $result
-}; # match_items()
+}
@@ -651,10 +808,10 @@ proc realcommand {cmd} {
set result [exec readlink -f $path]
} else {
set result $path
- }; # if
- }; # if
+ }
+ }
return $result
-}; # realcommand()
+}
# Generate filename to save environment to.
@@ -674,10 +831,10 @@ proc gen_env_filename {{file ""} {seq 1}} {
# 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
@@ -685,7 +842,7 @@ proc gen_env_filename {{file ""} {seq 1}} {
# `gen_env_filename()'.
proc save_env {{file ""}} {
_save_env [gen_env_filename $file 1]
-}; # save_env()
+}
# Save the environment for later comparison
@@ -693,16 +850,16 @@ proc save_env {{file ""}} {
# @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_DIR=$(cd "$SRCDIR/.."; pwd)/completions}
assert_bash_exec {BASH_COMPLETION_COMPAT_DIR=$BASH_COMPLETION_DIR}
- assert_bash_exec {BASH_COMPLETION=$(cd "$TESTDIR/.."; pwd)/bash_completion}
+ assert_bash_exec {BASH_COMPLETION=$(cd "$SRCDIR/.."; pwd)/bash_completion}
assert_bash_exec {source "$BASH_COMPLETION"}
-}; # source_bash_completion()
+}
# Split line into words, disregarding backslash escapes (e.g. \b (backspace),
@@ -727,7 +884,7 @@ proc split_words_bash {line} {
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;
@@ -738,11 +895,11 @@ proc split_words_bash {line} {
# 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
@@ -814,19 +971,22 @@ proc find_unique_completion_pair {{list} {partName} {fullName}} {
# Start bash running as test environment.
proc start_bash {} {
- global TESTDIR TOOL_EXECUTABLE spawn_id
+ global TESTDIR TOOL_EXECUTABLE spawn_id env srcdirabs
set TESTDIR [pwd]
+ set srcdirabs [file normalize $::srcdir]; # Absolute srcdir
# 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"
+ set env(SRCDIR) $::srcdir
+ set env(SRCDIRABS) $::srcdirabs
+ exp_spawn $TOOL_EXECUTABLE --rcfile $::srcdir/config/bashrc
+ assert_bash_exec {} "$TOOL_EXECUTABLE --rcfile $::srcdir/config/bashrc"
# Bash < 3.2.41 has a bug where 'history' disappears from SHELLOPTS
# whenever a shopt setting is sourced or eval'ed. Disabling 'history'
# makes it not show in tests "Environment should not be modified"
# for bash < 3.2.41.
# -- FVu, Tue Sep 15 22:52:00 CEST 2009
assert_bash_exec {is_bash_version_minimal 3 2 41 || set +o history}
-}; # start_bash()
+}
# Redirect xtrace output to a file.
@@ -896,7 +1056,7 @@ proc sync_after_tab {} {
# 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
@@ -905,4 +1065,4 @@ 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/unit.exp b/test/lib/unit.exp
index de870332..e113e1b5 100644
--- a/test/lib/unit.exp
+++ b/test/lib/unit.exp
@@ -1,4 +1,4 @@
-source lib/library.exp
+source $::srcdir/lib/library.exp
proc unit_exit {} {
@@ -7,6 +7,14 @@ proc unit_exit {} {
}
+proc unit_init {test_file_name} {
+ # Call unit_start() only once
+ if {! [info exists ::BASH_VERSINFO]} {
+ unit_start
+ }
+}
+
+
proc unit_start {} {
start_interactive_test
}
diff --git a/test/run b/test/run
index b798676f..498d98b7 100755
--- a/test/run
+++ b/test/run
@@ -44,7 +44,7 @@ while [[ $# > 0 ]]; do
--timeout=*) timeout=${1/--timeout=};;
--tool=*) set_tool "${1#/--tool=}";;
--tool) shift; set_tool "$1";;
- */completion/*.exp|*/unit/*.exp)
+ completion/*.exp|*/completion/*.exp|unit/*.exp|*/unit/*.exp)
arg=${1%/*}
set_tool "${arg##*/}"
args+=("${1##*/}")
diff --git a/test/runLint b/test/runLint
index b2bf005c..88c717a2 100755
--- a/test/runLint
+++ b/test/runLint
@@ -3,7 +3,7 @@
gitgrep()
{
local out=$(git grep -I -E -n "$1" | \
- grep -E '^(bash_completion|contrib/|test/)' | \
+ grep -E '^(bash_completion|completions/|test/)' | \
grep -Fv 'test/runLint')
if [ -n "$out" ] ; then
printf '***** %s\n' "$2"
diff --git a/test/unit/__expand_tilde_by_ref.exp b/test/unit/__expand_tilde_by_ref.exp
index d4a75d11..abd549cb 100644
--- a/test/unit/__expand_tilde_by_ref.exp
+++ b/test/unit/__expand_tilde_by_ref.exp
@@ -8,14 +8,14 @@ proc setup {home user} {
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
@@ -37,7 +37,7 @@ sync_after_int
set test "~user should return /home/user"
-set cmd [format {var="~%s"; __expand_tilde_by_ref var; printf "%%s" "$var"} $user]
+set cmd [format {var="~%s"; __expand_tilde_by_ref var; printf "%%s\n" "$var"} $user]
assert_bash_list "$home" $cmd $test
@@ -45,7 +45,7 @@ sync_after_int
set test "~/foo should return /home/user/foo"
-set cmd {var='~/foo'; __expand_tilde_by_ref var; printf "%s" "$var"}
+set cmd {var='~/foo'; __expand_tilde_by_ref var; printf "%s\n" "$var"}
assert_bash_list "$home/foo" $cmd $test
@@ -53,7 +53,7 @@ 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]
+set cmd [format {var="~%s/bar"; __expand_tilde_by_ref var; printf "%%s\n" "$var"} $user]
assert_bash_list "$home/bar" $cmd $test
@@ -61,7 +61,7 @@ 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]
+set cmd [format {var="~%s/\$HOME"; __expand_tilde_by_ref var; printf "%%s\n" "$var"} $user]
assert_bash_list "$home/\$HOME" $cmd $test
@@ -69,7 +69,7 @@ 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]
+set cmd [format {var="~%s/a b"; __expand_tilde_by_ref var; printf "%%s\n" "$var"} $user]
assert_bash_list [list [format {%s/a b} $home]] $cmd $test
@@ -77,7 +77,7 @@ sync_after_int
set test "~user/* should return /home/user/*"
-set cmd [format {var="~%s/*"; __expand_tilde_by_ref var; printf "%%s" "$var"} $user]
+set cmd [format {var="~%s/*"; __expand_tilde_by_ref var; printf "%%s\n" "$var"} $user]
assert_bash_list "$home/\*" $cmd $test
diff --git a/test/unit/_count_args.exp b/test/unit/_count_args.exp
index da61bdb6..b615cab8 100644
--- a/test/unit/_count_args.exp
+++ b/test/unit/_count_args.exp
@@ -1,7 +1,7 @@
proc setup {} {
assert_bash_exec {unset COMP_CWORD COMP_LINE COMP_POINT COMP_WORDS}
save_env
-}; # setup()
+}
proc teardown {} {
@@ -12,7 +12,7 @@ proc teardown {} {
d
}
}
-}; # teardown()
+}
setup
@@ -26,7 +26,7 @@ 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}
+set cmd {COMP_WORDS=(a b); COMP_CWORD=1; COMP_LINE='a b'; COMP_POINT=3; _count_args; echo $args}
assert_bash_list 1 $cmd $test
@@ -34,7 +34,7 @@ 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}
+set cmd {COMP_WORDS=(a bc); COMP_CWORD=1; COMP_LINE='a bc'; COMP_POINT=3; _count_args; echo $args}
assert_bash_list 1 $cmd $test
@@ -42,7 +42,7 @@ 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}
+set cmd {COMP_WORDS=(a b c); COMP_CWORD=2; COMP_LINE='a b c'; COMP_POINT=4; _count_args; echo $args}
assert_bash_list 2 $cmd $test
@@ -50,7 +50,7 @@ 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}
+set cmd {COMP_WORDS=(a b c); COMP_CWORD=1; COMP_LINE='a b c'; COMP_POINT=3; _count_args; echo $args}
assert_bash_list 1 $cmd $test
@@ -58,7 +58,7 @@ 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}
+set cmd {COMP_WORDS=(a b -c d); COMP_CWORD=2; COMP_LINE='a b -c d'; COMP_POINT=6; _count_args; echo $args}
assert_bash_list 2 $cmd $test
diff --git a/test/unit/_filedir.exp b/test/unit/_filedir.exp
index 204d31cf..de494084 100644
--- a/test/unit/_filedir.exp
+++ b/test/unit/_filedir.exp
@@ -20,17 +20,17 @@ proc setup {} {
# 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)}
+ assert_bash_exec {(cd $TESTDIR/tmp && [ ! -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)}
+ assert_bash_exec {(cd $TESTDIR/tmp && [ ! -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 {(cd $TESTDIR/tmp && rm -- a\\b/g && rmdir a\\b/ || true)}
+ assert_bash_exec {(cd $TESTDIR/tmp && rm -- a\*b/j && rmdir a\*b/ || true)}
}
assert_bash_exec {unset COMPREPLY cur}
assert_bash_exec {unset -f _f _g}
@@ -56,7 +56,7 @@ foreach name {f f2} {
set test "completing $name ab/ should return e"
set cmd "$name ab/"
- assert_complete_dir e $cmd "fixtures/_filedir" $test
+ assert_complete_dir e $cmd "$::srcdir/fixtures/_filedir" $test
sync_after_int
@@ -64,7 +64,7 @@ foreach name {f f2} {
set test "completing $name a\\ b/ should return i"
set cmd "$name a\\ b/"
- assert_complete_dir i $cmd "fixtures/_filedir" $test
+ assert_complete_dir i $cmd "$::srcdir/fixtures/_filedir" $test
sync_after_int
@@ -72,7 +72,7 @@ foreach name {f f2} {
set test "completing $name a\\\'b/ should return c"
set cmd "$name a\\\'b/"
- assert_complete_dir c $cmd "fixtures/_filedir" $test
+ assert_complete_dir c $cmd "$::srcdir/fixtures/_filedir" $test
sync_after_int
@@ -80,7 +80,7 @@ foreach name {f f2} {
set test "completing $name a\\\"b/ should return d"; #"
set cmd "$name a\\\"b/"; #"
- assert_complete_dir d $cmd "fixtures/_filedir" $test
+ assert_complete_dir d $cmd "$::srcdir/fixtures/_filedir" $test
sync_after_int
@@ -88,8 +88,8 @@ foreach name {f f2} {
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
+ assert_complete_dir "\b\b\b\b\b$::srcdirabs/fixtures/_filedir/a\\\\\$b/h" \
+ $cmd "$::srcdir/fixtures/_filedir" $test
sync_after_int
@@ -101,7 +101,7 @@ foreach name {f f2} {
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
+ assert_complete_dir g $cmd "$TESTDIR/tmp" $test
sync_after_int
@@ -110,7 +110,7 @@ foreach name {f f2} {
set test "completing $name a\\&b/ should return f"
set cmd "$name a\\&b/"
- assert_complete_dir f $cmd "fixtures/_filedir" $test
+ assert_complete_dir f $cmd "$::srcdir/fixtures/_filedir" $test
sync_after_int
@@ -118,7 +118,7 @@ foreach name {f f2} {
set test "completing $name a\$ should return a\\\$b/"
set cmd "$name a\$"
- assert_complete_dir "\b\\\\\$b/" $cmd "fixtures/_filedir" $test
+ assert_complete_dir "\b\\\\\$b/" $cmd "$::srcdir/fixtures/_filedir" $test -nospace
sync_after_int
@@ -132,21 +132,21 @@ foreach name {f f2} {
[lindex $::BASH_VERSINFO 2] < 35
)} {
set cmd "$name 'ab/"
- assert_complete_dir {e'} $cmd "fixtures/_filedir"
+ assert_complete_dir {e'} $cmd "$::srcdir/fixtures/_filedir"
sync_after_int
set cmd "$name 'a b/"
- assert_complete_dir {i'} $cmd "fixtures/_filedir"
+ assert_complete_dir {i'} $cmd "$::srcdir/fixtures/_filedir"
sync_after_int
set cmd "$name 'a\"b/"; #"
- assert_complete_dir {d'} $cmd "fixtures/_filedir"
+ assert_complete_dir {d'} $cmd "$::srcdir/fixtures/_filedir"
sync_after_int
@@ -154,9 +154,9 @@ foreach name {f f2} {
set cmd "$name 'a\$b/"
if {[lindex $::BASH_VERSINFO 0] == 4} {
- assert_complete_dir {h'} $cmd "fixtures/_filedir"
+ assert_complete_dir {h'} $cmd "$::srcdir/fixtures/_filedir"
} else {
- assert_complete_dir "\b\b\b\b$::TESTDIR/fixtures/_filedir/a\$b/h'" $cmd "fixtures/_filedir"
+ assert_complete_dir "\b\b\b\b$::srcdirabs/fixtures/_filedir/a\$b/h'" $cmd "$::srcdir/fixtures/_filedir"
}
@@ -166,8 +166,8 @@ foreach name {f f2} {
# 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"
+ set cmd "$name '$TESTDIR/tmp/a\\b/"
+ assert_complete_dir {g'} $cmd "$TESTDIR/tmp"
sync_after_int
@@ -175,63 +175,63 @@ foreach name {f f2} {
set cmd "$name 'a&b/"
- assert_complete_dir {f'} $cmd "fixtures/_filedir"
+ assert_complete_dir {f'} $cmd "$::srcdir/fixtures/_filedir"
sync_after_int
set cmd "$name \"ab/"; #"
- assert_complete_dir {e"} $cmd "fixtures/_filedir"; #"
+ assert_complete_dir {e"} $cmd "$::srcdir/fixtures/_filedir"; #"
sync_after_int
set cmd "$name \"a b/"; #"
- assert_complete_dir {i"} $cmd "fixtures/_filedir"; #"
+ assert_complete_dir {i"} $cmd "$::srcdir/fixtures/_filedir"; #"
sync_after_int
set cmd "$name \"a'b/"; #"
- assert_complete_dir {c"} $cmd "fixtures/_filedir"; #"
+ assert_complete_dir {c"} $cmd "$::srcdir/fixtures/_filedir"; #"
sync_after_int
set cmd "$name \"a\\\"b/"; #"
- assert_complete_dir {d"} $cmd "fixtures/_filedir"; #"
+ assert_complete_dir {d"} $cmd "$::srcdir/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"
+ assert_complete_dir "\b\b\b\b\b$::srcdirabs/fixtures/_filedir/a\\\\\$b/h\\\"" $cmd "$::srcdir/fixtures/_filedir"
sync_after_int
set cmd "$name \"a\\b/"; #"
- assert_complete_dir "\b\b\bb/e\\\"" $cmd "fixtures/_filedir"
+ assert_complete_dir "\b\b\bb/e\\\"" $cmd "$::srcdir/fixtures/_filedir"
sync_after_int
set cmd "$name \"a\\\\b/"; #"
- assert_complete_dir {g"} $cmd "fixtures/_filedir"; #"
+ assert_complete_dir {g"} $cmd "$TESTDIR/tmp"; #"
sync_after_int
set cmd "$name \"a&b/"; #"
- assert_complete_dir {f"} $cmd "fixtures/_filedir"; #"
+ assert_complete_dir {f"} $cmd "$::srcdir/fixtures/_filedir"; #"
sync_after_int
@@ -242,23 +242,27 @@ foreach name {f f2} {
set test "completing with filter '.e1' should show completions"
-assert_complete_dir {ee.e1 foo/ gg.e1} "g " "fixtures/_filedir/ext" $test
+assert_complete_dir {ee.e1 foo/ gg.e1 ii.E1} "g " "$::srcdir/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"
+set test "completing f aé should return g"
+# Execute this test only on bash >= 4 with LC_CTYPE matching *UTF-8*
+# See also: http://www.mail-archive.com/bash-completion-devel\
+# @lists.alioth.debian.org/msg02265.html
+# Don't execute this test on expect-5.44 cause it will segfault
+# See also: Alioth #312792
+if {
+ [lindex $::BASH_VERSINFO 0] >= 4 &&
+ [string first "UTF-8" $::LC_CTYPE] != -1 &&
+ [string first 5.44 [exp_version]] != 0
+} {
+ assert_complete_dir g "f aé/" "$::srcdir/fixtures/_filedir"
} else {
- assert_complete_dir "\b\b\b\b$'a\\\\303\\\\251/g'" "f aé/" \
- "fixtures/_filedir"
+ unsupported "$test"
}
-# Restore LC_CTYPE
-assert_bash_exec {[[ $OLD_CTYPE ]] && LC_CTYPE=$OLD_CTYPE || unset LC_CTYPE}
sync_after_int
diff --git a/test/unit/_get_comp_words_by_ref.exp b/test/unit/_get_comp_words_by_ref.exp
index 22561e7f..2ddcef23 100644
--- a/test/unit/_get_comp_words_by_ref.exp
+++ b/test/unit/_get_comp_words_by_ref.exp
@@ -1,7 +1,7 @@
proc setup {} {
assert_bash_exec {unset COMP_CWORD COMP_LINE COMP_POINT COMP_WORDS}
save_env
-}; # setup()
+}
proc teardown {} {
@@ -15,7 +15,7 @@ proc teardown {} {
d
}
}
-}; # teardown()
+}
setup
@@ -105,7 +105,7 @@ if {
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"
@@ -118,7 +118,7 @@ expect {
[lindex $::BASH_VERSINFO 2] < 35
} {xfail "$test"} {fail "$test"}
}
-}; # expect
+}
sync_after_int
@@ -133,7 +133,7 @@ if {
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"};
@@ -148,7 +148,7 @@ expect {
[lindex $::BASH_VERSINFO 2] < 35
} {xfail "$test"} {fail "$test"}
}
-}; # expect
+}
sync_after_int
@@ -161,7 +161,7 @@ if {[lindex $::BASH_VERSINFO 0] <= 3} {
} 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
@@ -177,7 +177,7 @@ 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"}
@@ -192,7 +192,7 @@ 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"}
@@ -202,6 +202,21 @@ assert_bash_list {"c: b"} $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=4}
+}
+append cmd {; COMP_LINE='a b:c '; COMP_POINT=6}
+assert_bash_exec $cmd $test
+set cmd {_get_comp_words_by_ref -n : cur prev; echo "$cur $prev"}
+assert_bash_list {" b: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}
assert_bash_exec $cmd
@@ -217,7 +232,7 @@ 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"}
@@ -232,7 +247,7 @@ sync_after_int
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}
+set cmd {_get_comp_words_by_ref cur; printf "%s\n" $cur}
assert_bash_list -n $cmd $test
@@ -256,7 +271,7 @@ if {[lindex $::BASH_VERSINFO] <= 3} {
} 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"}
@@ -286,7 +301,7 @@ expect {
-ex "\$(b c/@" { pass "$test" }
# Expected failure on bash-4
-ex "c/@" { xfail "$test" }
-}; # expect
+}
sync_after_int
@@ -303,7 +318,7 @@ expect {
-ex "\$(b c\\ d/@" { pass "$test" }
# Expected failure on bash-4
-ex "c\\ d/@" { xfail "$test" }
-}; # expect
+}
sync_after_int
@@ -318,7 +333,7 @@ if {
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"}
@@ -333,7 +348,7 @@ expect {
[lindex $::BASH_VERSINFO 2] < 35
} {xfail "$test"} {fail "$test"}
}
-}; # expect
+}
sync_after_int
diff --git a/test/unit/_get_cword.exp b/test/unit/_get_cword.exp
index 1e6e9bfb..ce749cec 100644
--- a/test/unit/_get_cword.exp
+++ b/test/unit/_get_cword.exp
@@ -1,7 +1,7 @@
proc setup {} {
assert_bash_exec {unset COMP_CWORD COMP_LINE COMP_POINT COMP_WORDS}
save_env
-}; # setup()
+}
proc teardown {} {
@@ -12,7 +12,7 @@ proc teardown {} {
d
}
}
-}; # teardown()
+}
setup
@@ -30,7 +30,7 @@ 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=3; _get_cword}
+set cmd {COMP_WORDS=(a b); COMP_CWORD=1; COMP_LINE='a b'; COMP_POINT=3; _get_cword; echo}
assert_bash_list b $cmd $test
@@ -65,7 +65,7 @@ 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}
+set cmd {COMP_WORDS=(a bc); COMP_CWORD=1; COMP_LINE='a bc'; COMP_POINT=3; _get_cword; echo}
assert_bash_list b $cmd $test
@@ -73,7 +73,7 @@ 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}
+set cmd {COMP_WORDS=(a 'b\ c'); COMP_CWORD=1; COMP_LINE='a b\ c'; COMP_POINT=6; _get_cword; echo}
assert_bash_list {"b\\ c"} $cmd $test
@@ -81,7 +81,7 @@ 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}
+set cmd {COMP_WORDS=(a 'b\ c'); COMP_CWORD=1; COMP_LINE='a b\ c'; COMP_POINT=4; _get_cword; echo}
assert_bash_list {"b\\"} $cmd $test
@@ -89,7 +89,7 @@ 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}
+set cmd {COMP_WORDS=(a '"b\'); COMP_CWORD=1; COMP_LINE='a "b\'; COMP_POINT=5; _get_cword; echo}
assert_bash_list {"\"b\\"} $cmd $test
@@ -105,7 +105,7 @@ if {
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"
@@ -118,7 +118,7 @@ expect {
[lindex $::BASH_VERSINFO 2] < 35
} {xfail "$test"} {fail "$test"}
}
-}; # expect
+}
sync_after_int
@@ -133,7 +133,7 @@ if {
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"
@@ -146,7 +146,7 @@ expect {
[lindex $::BASH_VERSINFO 2] < 35
} {xfail "$test"} {fail "$test"}
}
-}; # expect
+}
sync_after_int
@@ -159,8 +159,8 @@ if {[lindex $::BASH_VERSINFO 0] <= 3} {
} 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}
+}
+append cmd {; COMP_LINE='a b:c'; COMP_POINT=5; _get_cword; echo}
assert_bash_list $expected $cmd $test
@@ -172,8 +172,8 @@ 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 :}
+}
+append cmd {; COMP_LINE='a b:c'; COMP_POINT=5; _get_cword :; echo}
assert_bash_list b:c $cmd $test
@@ -185,8 +185,8 @@ 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 :}
+}
+append cmd {; COMP_LINE='a b c:'; COMP_POINT=6; _get_cword :; echo}
assert_bash_list c: $cmd $test
@@ -194,7 +194,7 @@ 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 :}
+set cmd {COMP_WORDS=(a :); COMP_CWORD=1; COMP_LINE='a :'; COMP_POINT=3; _get_cword :; echo}
assert_bash_list : $cmd $test
@@ -206,8 +206,8 @@ 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 :}
+}
+append cmd {; COMP_LINE='a b::'; COMP_POINT=5; _get_cword :; echo}
assert_bash_list b:: $cmd $test
@@ -217,7 +217,7 @@ 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}
+set cmd {COMP_WORDS=(a -n); COMP_CWORD=1; COMP_LINE='a -n'; COMP_POINT=4; _get_cword; echo}
assert_bash_list -n $cmd $test
@@ -225,7 +225,7 @@ 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}
+set cmd {COMP_WORDS=(a b \> c); COMP_CWORD=3; COMP_LINE='a b>c'; COMP_POINT=5; _get_cword; echo}
assert_bash_list c $cmd $test
@@ -239,8 +239,8 @@ if {[lindex $::BASH_VERSINFO] <= 3} {
} 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}
+}
+append cmd {; COMP_LINE='a b=c'; COMP_POINT=5; _get_cword; echo}
assert_bash_list $expected $cmd $test
@@ -248,7 +248,7 @@ 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}
+set cmd {COMP_WORDS=(a \*); COMP_CWORD=1; COMP_LINE='a *'; COMP_POINT=4; _get_cword; echo}
assert_bash_list * $cmd $test
@@ -264,7 +264,7 @@ expect {
-ex "\$(b c/@" { pass "$test" }
# Expected failure on bash-4
-ex "c/@" { xfail "$test" }
-}; # expect
+}
sync_after_int
@@ -279,7 +279,7 @@ expect {
-ex "\$(b c\\ d/@" { pass "$test" }
# Expected failure on bash-4
-ex "c\\ d/@" { xfail "$test" }
-}; # expect
+}
sync_after_int
@@ -294,7 +294,7 @@ if {
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"
@@ -307,7 +307,7 @@ expect {
[lindex $::BASH_VERSINFO 2] < 35
} {xfail "$test"} {fail "$test"}
}
-}; # expect
+}
sync_after_int
diff --git a/test/unit/_known_hosts_real.exp b/test/unit/_known_hosts_real.exp
index 152cf885..604b2d5e 100644
--- a/test/unit/_known_hosts_real.exp
+++ b/test/unit/_known_hosts_real.exp
@@ -1,6 +1,9 @@
proc setup {} {
+ # NOTE: Changing dir to $SRCDIR is necessary because file locations in the
+ # ssh config files (e.g. UserKnownHostsFile) are relative to $SRCDIR.
+ assert_bash_exec {cd $SRCDIR}
save_env
-}; # setup()
+}
proc teardown {} {
@@ -8,7 +11,8 @@ proc teardown {} {
/COMPREPLY=/d
/OLDHOME=/d
}
-}; # teardown()
+ assert_bash_exec {cd $TESTDIR}
+}
setup
@@ -17,10 +21,10 @@ 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
+ # doo, ike, jub, 10.0.0.1, kyl, 100.0.0.2, 10.10.0.3, blah, and bunch of IPv6 test cases in ./fixtures/_known_hosts_real/known_hosts
+lappend hosts blah doo gee hus ike jar jub kyl 10.0.0.1 100.0.0.2 10.10.0.3 fd00:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:5555 fe80::123:0xff:dead:beef%eth0 1111:2222:3333:4444:5555:6666:xxxx:abab 11xx:2222:3333:4444:5555:6666:xxxx:abab ::42
set cmd {unset COMPREPLY; _known_hosts_real -aF fixtures/_known_hosts_real/config ''; echo_array COMPREPLY}
-assert_bash_list $hosts $cmd $test
+assert_bash_list $hosts $cmd $test -sort
sync_after_int
@@ -29,16 +33,16 @@ 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
+ # doo, ike, jub, 10.0.0.1, kyl, 100.0.0.2, 10.10.0.3, blah, and bunch of IPv6 test cases in ./fixtures/_known_hosts_real/known_hosts
+lappend hosts blah doo gee hus ike jar jub kyl 10.0.0.1 100.0.0.2 10.10.0.3 fd00:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:5555 fe80::123:0xff:dead:beef%eth0 1111:2222:3333:4444:5555:6666:xxxx:abab 11xx:2222:3333:4444:5555:6666:xxxx:abab ::42
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
+assert_bash_list $expected $cmd $test -sort
sync_after_int
@@ -66,7 +70,7 @@ expect {
-re "^$hosts_config\r\n/@$" { fail "$test (known hosts file)" }
-re /@ { unresolved "$test at prompt" }
default { unresolved "$test" }
-}; # expect
+}
sync_after_int
@@ -79,7 +83,7 @@ set hosts [get_hosts]
lappend hosts two three
set hosts [join [bash_sort $hosts] "\\s+"]
# Setup environment
-set cmd {OLDHOME=$HOME; HOME=$TESTDIR}
+set cmd {OLDHOME=$HOME; HOME=$SRCDIRABS}
send "$cmd\r"
expect -ex "$cmd\r\n/@"
# Call _known_hosts
@@ -89,7 +93,7 @@ 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"
@@ -103,11 +107,11 @@ 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
+ # doo, ike, jub, 10.0.0.1, kyl, 100.0.0.2, 10.10.0.3, blah, and bunch of IPv6 test cases in ./fixtures/_known_hosts_real/known_hosts
+lappend hosts blah doo gee hus ike jar jub kyl 10.0.0.1 100.0.0.2 10.10.0.3 fd00:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:5555 fe80::123:0xff:dead:beef%eth0 1111:2222:3333:4444:5555:6666:xxxx:abab 11xx:2222:3333:4444:5555:6666:xxxx:abab ::42
# 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
+assert_bash_list $hosts $cmd $test -sort
sync_after_int
assert_bash_exec "unset -v COMP_KNOWN_HOSTS_WITH_HOSTFILE"
diff --git a/test/unit/_parse_help.exp b/test/unit/_parse_help.exp
new file mode 100644
index 00000000..4beb28d2
--- /dev/null
+++ b/test/unit/_parse_help.exp
@@ -0,0 +1,73 @@
+# By Stephen Gildea, October 2010.
+
+proc setup {} {
+ save_env
+}
+
+proc teardown {} {
+ assert_env_unmodified {
+ /declare -f fn/d
+ }
+}
+
+setup
+
+
+set cmd {fn() { printf '%s\n' ""; }; _parse_help fn}
+assert_bash_list "" $cmd "empty"
+sync_after_int
+
+set cmd {fn() { printf '%s\n' "no dashes here"; }; _parse_help fn}
+assert_bash_list "" $cmd "no dashes"
+sync_after_int
+
+set cmd {fn() { printf '%s\n' "internal-dash"; }; _parse_help fn}
+assert_bash_list "" $cmd "internal dash 1"
+sync_after_int
+
+set cmd {fn() { printf '%s\n' "no -leading-dashes"; }; _parse_help fn}
+assert_bash_list "" $cmd "no leading dash"
+sync_after_int
+
+set cmd {fn() { printf '%s\n' "-one dash"; }; _parse_help fn}
+assert_bash_list "-one" $cmd "one dash"
+sync_after_int
+
+set cmd {fn() { printf '%s\n' " -space dash"; }; _parse_help fn}
+assert_bash_list "-space" $cmd "one dash after space"
+sync_after_int
+
+set cmd {fn() { printf '%s\n' "-one -two dashes"; }; _parse_help fn}
+assert_bash_list "-one\n-two" $cmd "two dashes, space-separated"
+sync_after_int
+
+set cmd {fn() { printf '%s\n' "-one,-t dashes"; }; _parse_help fn}
+assert_bash_list "-one\n-t" $cmd "two dashes, comma-separated"
+sync_after_int
+
+set cmd {fn() { printf '%s\n' "-one dash-inside"; }; _parse_help fn}
+assert_bash_list "-one" $cmd "internal dash 2"
+sync_after_int
+
+set cmd {fn() { printf '%s\n' "--long-arg=value"; }; _parse_help fn}
+assert_bash_list "--long-arg" $cmd "value stripped"
+sync_after_int
+
+set cmd {fn() { printf '%s\n' "--long-arg=-value"; }; _parse_help fn}
+assert_bash_list "--long-arg" $cmd "value not seen as option"
+sync_after_int
+
+set cmd {fn() { printf '%s\n' "--long-arg=-value,--opt2=val"; }; _parse_help fn}
+assert_bash_list "--long-arg\n--opt2" $cmd "two options with values"
+sync_after_int
+
+set cmd {fn() { printf '%s\n' "-m,--mirror"; }; _parse_help fn}
+assert_bash_list "-m\n--mirror" $cmd "short + long"
+sync_after_int
+
+set cmd {fn() { printf '%s\n' "-T/--upload-file"; }; _parse_help fn}
+assert_bash_list "-T\n--upload-file" $cmd "short + long, slash separated"
+sync_after_int
+
+
+teardown
diff --git a/test/unit/_tilde.exp b/test/unit/_tilde.exp
new file mode 100644
index 00000000..2e22b848
--- /dev/null
+++ b/test/unit/_tilde.exp
@@ -0,0 +1,51 @@
+# @param string $part Reference to variable to hold partial unique username
+# @param string $full Reference to variable to hold full unique username
+proc setup {part full} {
+ upvar $part _part
+ upvar $full _full
+
+ assert_bash_exec {compgen -u} {} /@ users
+ find_unique_completion_pair $users _part _full
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified {
+ /COMPREPLY=/d
+ }
+}
+
+
+setup part full
+
+
+set test "function should run without errors"
+assert_bash_exec {_tilde > /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="~"; _tilde "$aa"; }; foo; unset foo} $test
+
+
+sync_after_int
+
+
+set test "~full should complete to ~full unmodified"
+set cmd [format {_tilde "~%s"; printf "%%s\n" "${COMPREPLY[@]}"} $full]
+assert_bash_list "~$full" $cmd $test
+
+
+sync_after_int
+
+
+set test "~part should complete to ~full"
+set cmd [format {_tilde "~%s"; printf "%%s\n" "${COMPREPLY[@]}"} $part]
+assert_bash_list "~$full" $cmd $test
+
+
+teardown
diff --git a/test/unit/compgen.exp b/test/unit/compgen.exp
index 6673bf0e..6e6f79c6 100644
--- a/test/unit/compgen.exp
+++ b/test/unit/compgen.exp
@@ -1,11 +1,11 @@
proc setup {} {
save_env
-}; # setup()
+}
proc teardown {} {
assert_env_unmodified {/OLDPWD/d}
-}; # teardown()
+}
setup
@@ -17,10 +17,9 @@ if {[lindex $::BASH_VERSINFO 0] <= 3} {
} 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
+}
+set dir $::srcdir/fixtures/compgen
+assert_bash_exec "cd $dir"
send "$cmd\r"
expect -ex "$cmd\r\n"
expect {
@@ -37,13 +36,13 @@ expect {
if {[lindex $::BASH_VERSINFO 0] <= 3 } \
{pass $test} else {fail $test}
}
- -re $prompt { pass "$test" }
+ -re /@ { pass "$test" }
-re eof { unresolved "eof" }
-}; # expect
-sync_after_int $prompt
+}
+sync_after_int
assert_bash_exec {cd "$TESTDIR"}
-#assert_bash_list_dir {a\\\'b/c} $cmd fixtures/compgen
+#assert_bash_list_dir {a\\\'b/c} $cmd $::srcdir/fixtures/compgen
sync_after_int