From 6d88f1055806932d9291f96847d2b691cccda2cd Mon Sep 17 00:00:00 2001 From: "Gabriel F. T. Gomes" Date: Mon, 25 Sep 2017 23:46:54 -0300 Subject: New upstream version 2.7 --- .dir-locals.el | 6 +- .editorconfig | 12 + .gitignore | 18 + .travis.yml | 17 + AUTHORS | 2 - CHANGES | 695 +++- CONTRIBUTING.md | 147 + Makefile.am | 17 +- Makefile.in | 836 ----- README | 411 --- README.md | 335 ++ aclocal.m4 | 617 ---- bash-completion-config-version.cmake.in | 7 + bash-completion-config.cmake.in | 11 + bash-completion.pc.in | 2 +- bash_completion | 421 ++- bash_completion.sh.in | 21 +- completions/.gitignore | 205 ++ completions/2to3 | 39 + completions/7z | 119 + completions/Makefile.am | 153 +- completions/Makefile.in | 1258 -------- completions/_cal | 37 + completions/_chfn | 8 + completions/_chsh | 30 + completions/_dmesg | 34 + completions/_eject | 33 + completions/_hexdump | 32 + completions/_hwclock | 26 + completions/_ionice | 60 + completions/_look | 17 + completions/_mock | 18 +- completions/_modules | 12 +- completions/_newgrp | 19 + completions/_nmcli | 201 ++ completions/_renice | 32 + completions/_repomanage | 24 + completions/_reptyr | 26 + completions/_rtcwake | 32 + completions/_runuser | 8 + completions/_su | 41 + completions/_subversion | 344 -- completions/_svn | 212 ++ completions/_svnadmin | 78 + completions/_svnlook | 63 + completions/_udevadm | 4 +- completions/_write | 8 + completions/_yum | 27 +- completions/_yum-utils | 24 - completions/a2x | 2 +- completions/abook | 23 +- completions/aclocal | 14 +- completions/acpi | 2 +- completions/adb | 66 + completions/add_members | 8 +- completions/alias | 4 +- completions/ant | 67 +- completions/apache2ctl | 4 +- completions/appdata-validate | 32 + completions/apt-build | 24 +- completions/apt-cache | 46 +- completions/apt-get | 23 +- completions/aptitude | 51 +- completions/arch | 11 +- completions/arping | 2 +- completions/arpspoof | 6 +- completions/asciidoc | 2 +- completions/aspell | 36 +- completions/autoconf | 12 +- completions/automake | 12 +- completions/autoreconf | 12 +- completions/autorpm | 2 +- completions/autoscan | 10 +- completions/avctrl | 2 +- completions/badblocks | 10 +- completions/bind | 36 + completions/bk | 5 +- completions/brctl | 4 +- completions/btdownloadheadless.py | 6 +- completions/bts | 115 + completions/bzip2 | 14 +- completions/cal | 34 - completions/cancel | 2 +- completions/cardctl | 2 +- completions/ccache | 22 +- completions/cfagent | 4 +- completions/cfrun | 6 +- completions/chage | 8 +- completions/change_pw | 6 +- completions/check_db | 2 +- completions/check_perms | 2 +- completions/checksec | 37 + completions/chgrp | 11 +- completions/chkconfig | 8 +- completions/chown | 8 +- completions/chpasswd | 8 +- completions/chronyc | 52 +- completions/chrpath | 2 +- completions/chsh | 28 - completions/cksfv | 10 +- completions/cleanarch | 2 +- completions/clisp | 3 +- completions/clone_member | 6 +- completions/complete | 14 +- completions/config_list | 6 +- completions/configure | 8 +- completions/convert | 48 +- completions/cowsay | 4 +- completions/cpan2dist | 8 +- completions/cpio | 12 +- completions/cppcheck | 28 +- completions/crontab | 18 +- completions/cryptsetup | 5 +- completions/curl | 2 +- completions/cvs | 81 +- completions/cvsps | 28 +- completions/dd | 27 +- completions/deja-dup | 33 + completions/desktop-file-validate | 2 +- completions/dhclient | 6 +- completions/dict | 18 +- completions/dmesg | 31 - completions/dnsspoof | 6 +- completions/dot | 10 +- completions/dpkg | 46 +- completions/dpkg-source | 23 +- completions/dselect | 7 +- completions/dsniff | 6 +- completions/dumpdb | 2 +- completions/dumpe2fs | 8 +- completions/e2freefrag | 6 +- completions/e2label | 2 +- completions/eject | 30 - completions/eog | 4 +- completions/ether-wake | 8 +- completions/evince | 4 +- completions/explodepkg | 2 +- completions/export | 9 +- completions/faillog | 9 +- completions/fbgs | 7 +- completions/fbi | 7 +- completions/feh | 10 +- completions/file | 2 +- completions/file-roller | 6 +- completions/filefrag | 4 +- completions/filesnarf | 4 +- completions/find | 33 +- completions/find_member | 6 +- completions/flake8 | 35 + completions/freebsd-update | 29 + completions/freeciv-gtk2 | 8 +- completions/freeciv-server | 4 +- completions/function | 27 +- completions/fusermount | 6 +- completions/gcc | 25 +- completions/gcl | 3 +- completions/gdb | 15 +- completions/genaliases | 2 +- completions/gendiff | 4 +- completions/genisoimage | 10 +- completions/getent | 26 +- completions/gkrellm | 14 +- completions/gm | 40 + completions/gnatmake | 16 +- completions/gnokii | 235 ++ completions/gnome-mplayer | 2 +- completions/gpasswd | 6 +- completions/gpg | 22 +- completions/gpg2 | 24 +- completions/gphoto2 | 33 +- completions/gprof | 2 +- completions/groupadd | 7 +- completions/groupdel | 2 +- completions/groupmems | 8 +- completions/groupmod | 8 +- completions/growisofs | 10 +- completions/grpck | 4 +- completions/gzip | 15 +- completions/hcitool | 60 +- completions/hddtemp | 2 +- completions/hexdump | 29 - completions/hid2hci | 2 +- completions/hostname | 23 + completions/hping2 | 10 +- completions/htop | 5 +- completions/htpasswd | 2 +- completions/hwclock | 23 - completions/iconv | 15 +- completions/id | 2 +- completions/idn | 2 +- completions/iftop | 8 +- completions/ifup | 3 +- completions/info | 9 +- completions/inject | 6 +- completions/insmod | 2 +- completions/installpkg | 15 +- completions/interdiff | 2 +- completions/invoke-rc.d | 7 +- completions/ionice | 57 - completions/ip | 62 +- completions/iperf | 6 +- completions/ipmitool | 30 +- completions/ipsec | 12 +- completions/iptables | 10 +- completions/ipv6calc | 18 +- completions/iscsiadm | 12 +- completions/isql | 4 +- completions/iwconfig | 26 +- completions/iwlist | 2 +- completions/iwpriv | 6 +- completions/iwspy | 2 +- completions/jar | 4 +- completions/jarsigner | 23 +- completions/java | 66 +- completions/javaws | 12 +- completions/jpegoptim | 38 + completions/jps | 2 +- completions/jshint | 38 + completions/k3b | 18 +- completions/kcov | 29 +- completions/kill | 2 +- completions/killall | 2 +- completions/kldload | 3 +- completions/kldunload | 6 +- completions/koji | 2 +- completions/ktutil | 14 +- completions/larch | 3 +- completions/lastlog | 8 +- completions/ldapsearch | 62 +- completions/ldapvi | 18 +- completions/lftp | 8 +- completions/lftpget | 2 +- completions/lilo | 14 +- completions/links | 5 +- completions/lintian | 43 +- completions/lisp | 3 +- completions/list_admins | 2 +- completions/list_lists | 2 +- completions/list_members | 10 +- completions/list_owners | 2 +- completions/look | 14 - completions/lpq | 8 +- completions/lpr | 10 +- completions/lrzip | 20 +- completions/lsof | 20 +- completions/lua | 2 +- completions/luac | 2 +- completions/luseradd | 2 +- completions/luserdel | 2 +- completions/lvm | 261 +- completions/lz4 | 53 + completions/lzip | 2 +- completions/lzma | 10 +- completions/lzop | 12 +- completions/macof | 4 +- completions/mailmanctl | 2 +- completions/make | 106 +- completions/makepkg | 9 +- completions/man | 25 +- completions/mc | 10 +- completions/mcrypt | 31 +- completions/mdadm | 14 +- completions/mdtool | 9 +- completions/medusa | 12 +- completions/mii-diag | 6 +- completions/mii-tool | 8 +- completions/minicom | 25 +- completions/mkinitrd | 10 +- completions/mktemp | 8 +- completions/mmsitepass | 2 +- completions/modinfo | 2 +- completions/modprobe | 33 +- completions/monodevelop | 3 +- completions/mount | 12 +- completions/mount.linux | 8 +- completions/mplayer | 102 +- completions/mr | 86 + completions/msynctool | 26 +- completions/mtx | 3 +- completions/munin-node-configure | 10 +- completions/munin-run | 6 +- completions/munin-update | 6 +- completions/munindoc | 2 +- completions/mussh | 8 +- completions/mutt | 36 +- completions/mysql | 38 +- completions/mysqladmin | 18 +- completions/nc | 6 +- completions/ncftp | 5 +- completions/nethogs | 5 +- completions/newgrp | 16 - completions/newlist | 18 +- completions/newusers | 10 +- completions/ngrep | 2 +- completions/nmap | 10 +- completions/nmcli | 199 -- completions/nslookup | 10 +- completions/ntpdate | 12 +- completions/openssl | 48 +- completions/opera | 5 +- completions/optipng | 52 + completions/p4 | 3 +- completions/pack200 | 18 +- completions/passwd | 6 +- completions/patch | 2 +- completions/pdftotext | 36 + completions/perl | 50 +- completions/pgrep | 26 +- completions/pidof | 12 +- completions/pine | 31 +- completions/ping | 2 +- completions/pkg-config | 12 +- completions/pkg-get | 34 +- completions/pkg_delete | 7 +- completions/pkgadd | 15 +- completions/pkgrm | 24 +- completions/pkgtool | 11 +- completions/pkgutil | 35 +- completions/plague-client | 2 +- completions/pm-hibernate | 2 +- completions/pm-is-supported | 2 +- completions/pm-powersave | 2 +- completions/pngfix | 35 + completions/portinstall | 5 +- completions/portsnap | 25 + completions/portupgrade | 7 +- completions/postcat | 17 +- completions/postconf | 9 +- completions/postfix | 8 +- completions/postmap | 9 +- completions/postsuper | 18 +- completions/povray | 16 +- completions/prelink | 2 +- completions/protoc | 4 +- completions/psql | 104 +- completions/puppet | 257 +- completions/pwck | 4 +- completions/pwd | 2 +- completions/pwdx | 12 +- completions/pwgen | 2 +- completions/py.test | 71 + completions/pydoc | 6 +- completions/pyflakes | 23 + completions/pylint | 2 +- completions/python | 62 +- completions/pyvenv | 25 + completions/qdbus | 6 +- completions/qemu | 52 +- completions/qrunner | 4 +- completions/querybts | 8 +- completions/quota | 42 +- completions/rcs | 4 +- completions/rdesktop | 12 +- completions/remove_members | 6 +- completions/removepkg | 2 +- completions/renice | 29 - completions/reportbug | 21 +- completions/reptyr | 23 - completions/resolvconf | 4 +- completions/rfkill | 4 +- completions/ri | 43 +- completions/rmlist | 2 +- completions/rmmod | 3 +- completions/route | 4 +- completions/rpcdebug | 10 +- completions/rpm | 86 +- completions/rpm2tgz | 5 +- completions/rpmcheck | 4 +- completions/rrdtool | 2 +- completions/rsync | 16 +- completions/rtcwake | 29 - completions/sbcl | 4 +- completions/sbopkg | 8 +- completions/screen | 20 +- completions/sh | 15 +- completions/sitecopy | 13 +- completions/slackpkg | 9 +- completions/slapt-get | 14 +- completions/slapt-src | 27 +- completions/smartctl | 30 +- completions/smbclient | 100 +- completions/snownews | 2 +- completions/sqlite3 | 10 +- completions/ss | 4 +- completions/ssh | 202 +- completions/ssh-add | 4 +- completions/ssh-copy-id | 8 +- completions/ssh-keygen | 50 + completions/sshfs | 8 +- completions/sshmitm | 2 +- completions/sshow | 4 +- completions/strace | 14 +- completions/strings | 6 +- completions/su | 37 - completions/sudo | 7 +- completions/svcadm | 16 +- completions/svk | 16 +- completions/sync_members | 8 +- completions/synclient | 24 + completions/sysbench | 52 +- completions/sysctl | 11 +- completions/tar | 777 ++++- completions/tcpdump | 16 +- completions/tcpkill | 4 +- completions/tcpnice | 4 +- completions/timeout | 38 + completions/tipc | 285 ++ completions/tracepath | 2 +- completions/tshark | 10 +- completions/tune2fs | 17 +- completions/umount | 2 +- completions/umount.linux | 18 +- completions/unace | 2 +- completions/unpack200 | 8 +- completions/unrar | 2 +- completions/unshunt | 4 +- completions/update-alternatives | 6 +- completions/update-rc.d | 6 +- completions/upgradepkg | 7 +- completions/urlsnarf | 4 +- completions/uscan | 39 + completions/useradd | 18 +- completions/userdel | 4 +- completions/usermod | 16 +- completions/valgrind | 6 +- completions/vipw | 6 +- completions/vmstat | 6 +- completions/vncviewer | 19 +- completions/vpnc | 22 +- completions/watch | 2 +- completions/webmitm | 2 +- completions/wget | 23 +- completions/wine | 2 +- completions/withlist | 2 +- completions/wodim | 4 +- completions/wol | 14 +- completions/wsimport | 2 +- completions/wtf | 25 +- completions/wvdial | 6 +- completions/xfreerdp | 17 +- completions/xgamma | 9 +- completions/xhost | 2 +- completions/xm | 10 +- completions/xmllint | 18 +- completions/xmlwf | 12 +- completions/xmms | 2 +- completions/xmodmap | 6 +- completions/xrandr | 15 +- completions/xrdb | 8 +- completions/xsltproc | 24 +- completions/xxd | 2 +- completions/xz | 22 +- completions/xzdec | 10 +- completions/ypmatch | 10 +- completions/yum-arch | 2 +- completions/zopfli | 31 + completions/zopflipng | 39 + configure | 3391 -------------------- configure.ac | 15 +- doc/Makefile.in | 336 -- doc/bash_completion.txt | 11 +- doc/bashrc | 42 +- doc/inputrc | 22 +- doc/testing.txt | 6 +- extra/make-changelog.py | 30 + helpers/Makefile.am | 2 +- helpers/Makefile.in | 385 --- helpers/perl | 21 +- helpers/python | 6 + install-sh | 527 --- missing | 331 -- test/.gitignore | 4 + test/Makefile.in | 387 --- test/completion/2to3.exp | 1 + test/completion/7z.exp | 1 + test/completion/acroread.exp | 11 +- test/completion/adb.exp | 1 + test/completion/alpine.exp | 1 + test/completion/appdata-validate.exp | 1 + test/completion/arch.exp | 2 + test/completion/bind.exp | 1 + test/completion/change_pw.exp | 2 + test/completion/checksec.exp | 1 + test/completion/chroot.exp | 1 + test/completion/cleanarch.exp | 2 + test/completion/configure.exp | 2 +- test/completion/createuser.exp | 1 + test/completion/declare.exp | 1 + test/completion/deja-dup.exp | 1 + test/completion/dropuser.exp | 1 + test/completion/dumpdb.exp | 2 + test/completion/flake8.exp | 1 + test/completion/freebsd-update.exp | 1 + test/completion/function.exp | 1 + test/completion/genaliases.exp | 2 + test/completion/gm.exp | 1 + test/completion/gnokii.exp | 1 + test/completion/hostname.exp | 1 + test/completion/hping3.exp | 1 + test/completion/indent.exp | 1 - test/completion/inject.exp | 2 + test/completion/jpegoptim.exp | 1 + test/completion/jshint.exp | 1 + test/completion/kdvi.exp | 4 +- test/completion/kpdf.exp | 4 +- test/completion/list_owners.exp | 2 + test/completion/lz4.exp | 1 + test/completion/mailmanctl.exp | 2 + test/completion/mock.exp | 1 + test/completion/mr.exp | 1 + test/completion/newgrp.exp | 1 + test/completion/optipng.exp | 1 + test/completion/pdftotext.exp | 1 + test/completion/pngfix.exp | 1 + test/completion/portsnap.exp | 1 + test/completion/pushd.exp | 1 + test/completion/py.test.exp | 1 + test/completion/pyflakes.exp | 1 + test/completion/pyvenv.exp | 1 + test/completion/qrunner.exp | 2 + test/completion/repomanage.exp | 1 + test/completion/ssh-keygen.exp | 1 + test/completion/synclient.exp | 1 + test/completion/timeout.exp | 1 + test/completion/tipc.exp | 1 + test/completion/udevadm.exp | 1 + test/completion/unshunt.exp | 2 + test/completion/vi.exp | 4 +- test/completion/zopfli.exp | 1 + test/completion/zopflipng.exp | 1 + test/config/bashrc | 18 +- test/config/default.exp | 18 +- test/config/inputrc | 5 +- test/docker/Dockerfile-centos6 | 18 + test/docker/Dockerfile-fedoradev | 41 + test/docker/Dockerfile-ubuntu14 | 197 ++ test/docker/docker-script.sh | 19 + test/fixtures/7z/a.7z | Bin 0 -> 109 bytes test/fixtures/7z/f.txt | 1 + "test/fixtures/_filedir/a\"b/d" | 0 test/fixtures/_get_cword/sea | 0 test/fixtures/_get_cword/seb | 0 test/fixtures/_get_cword/sec | 0 .../\303\244\303\244\303\244\303\244\302\247" | 0 .../_known_hosts_real/.ssh/config_relative_path | 1 + test/fixtures/_known_hosts_real/config | 1 + test/fixtures/_known_hosts_real/config_full_path | 1 + test/fixtures/_known_hosts_real/config_include | 5 + .../_known_hosts_real/config_include_recursion | 1 + test/fixtures/ant/.gitignore | 2 + test/fixtures/ant/build-with-import.xml | 8 + test/fixtures/ant/build.xml | 4 +- test/fixtures/ant/imported-build.xml | 6 + test/fixtures/ant/named-build.xml | 6 + test/fixtures/java/no-complete.txt | 1 + test/fixtures/make/.gitignore | 1 + test/fixtures/make/Makefile | 34 +- test/fixtures/make/empty_dir/.nothing_here | 0 test/fixtures/make/sample.c | 1 + test/fixtures/make/sample.d | 3 + test/fixtures/make/sample.h | 0 test/fixtures/man/man3/Bash::Completion.3pm.gz | 0 test/fixtures/perl/Devel/BashCompletion.pm | 1 + test/fixtures/perldoc/BashCompletionDoc.pod | 0 test/fixtures/perldoc/BashCompletionModule.pm | 0 .../ri/BashCompletion/cdesc-BashCompletion.ri | Bin 0 -> 197 bytes test/fixtures/ri/cache.ri | Bin 0 -> 136 bytes test/fixtures/ri/created.rid | 1 + test/fixtures/scp/config | 2 + test/fixtures/sftp/config | 2 + test/fixtures/shared/empty_dir/.nothing_here | 0 test/fixtures/ssh-copy-id/.ssh/id_rsa.pub | 1 + test/fixtures/tar/archive.tar.xz | Bin 0 -> 10240 bytes test/fixtures/tar/dir/fileA | 0 test/fixtures/tar/dir/fileB | 0 test/fixtures/tar/dir/fileC | 0 test/fixtures/tar/dir/hello | 0 test/fixtures/tar/dir2/.nothing_here | 0 test/fixtures/tar/escape.tar | Bin 0 -> 10240 bytes test/generate | 64 + test/lib/completions/2to3.exp | 18 + test/lib/completions/7z.exp | 37 + test/lib/completions/abook.exp | 2 +- test/lib/completions/adb.exp | 18 + test/lib/completions/alpine.exp | 18 + test/lib/completions/ant.exp | 15 + test/lib/completions/appdata-validate.exp | 18 + test/lib/completions/apt-get.exp | 13 +- test/lib/completions/arch.exp | 5 +- test/lib/completions/bind.exp | 21 + test/lib/completions/bts.exp | 21 + test/lib/completions/ccache.exp | 25 + test/lib/completions/cd.exp | 12 +- test/lib/completions/checksec.exp | 18 + test/lib/completions/chkconfig.exp | 9 +- test/lib/completions/chroot.exp | 18 + test/lib/completions/configure.exp | 8 +- test/lib/completions/createdb.exp | 4 +- test/lib/completions/createuser.exp | 18 + test/lib/completions/curl.exp | 2 +- test/lib/completions/dcop.exp | 2 +- test/lib/completions/dd.exp | 2 +- test/lib/completions/declare.exp | 26 + test/lib/completions/deja-dup.exp | 21 + test/lib/completions/dpkg.exp | 14 +- test/lib/completions/dropdb.exp | 4 +- test/lib/completions/dropuser.exp | 18 + test/lib/completions/feh.exp | 6 +- test/lib/completions/finger.exp | 4 +- test/lib/completions/flake8.exp | 18 + test/lib/completions/freebsd-update.exp | 18 + test/lib/completions/function.exp | 18 + test/lib/completions/gm.exp | 27 + test/lib/completions/gnokii.exp | 18 + test/lib/completions/hostname.exp | 18 + test/lib/completions/hping3.exp | 18 + test/lib/completions/ifdown.exp | 9 +- test/lib/completions/ifup.exp | 9 +- test/lib/completions/indent.exp | 20 - test/lib/completions/ip.exp | 3 +- test/lib/completions/javac.exp | 3 +- test/lib/completions/jpegoptim.exp | 18 + test/lib/completions/jshint.exp | 18 + test/lib/completions/kill.exp | 6 +- test/lib/completions/look.exp | 2 +- test/lib/completions/ls.exp | 10 +- test/lib/completions/lz4.exp | 18 + test/lib/completions/make.exp | 38 +- test/lib/completions/man.exp | 18 +- test/lib/completions/mcrypt.exp | 4 + test/lib/completions/mmsitepass.exp | 2 +- test/lib/completions/mock.exp | 18 + test/lib/completions/modinfo.exp | 7 +- test/lib/completions/modprobe.exp | 11 +- test/lib/completions/mount.exp | 81 - test/lib/completions/mr.exp | 46 + test/lib/completions/mysql.exp | 2 + test/lib/completions/newgrp.exp | 18 + test/lib/completions/newlist.exp | 2 +- test/lib/completions/openssl.exp | 3 + test/lib/completions/optipng.exp | 18 + test/lib/completions/pdftotext.exp | 18 + test/lib/completions/perl.exp | 13 +- test/lib/completions/perldoc.exp | 5 + test/lib/completions/pine.exp | 4 +- test/lib/completions/pngfix.exp | 21 + test/lib/completions/portsnap.exp | 18 + test/lib/completions/puppet.exp | 3 +- test/lib/completions/pushd.exp | 18 + test/lib/completions/py.test.exp | 21 + test/lib/completions/pyflakes.exp | 18 + test/lib/completions/python.exp | 24 + test/lib/completions/pyvenv.exp | 18 + test/lib/completions/quotacheck.exp | 2 +- test/lib/completions/quotaon.exp | 2 +- test/lib/completions/renice.exp | 27 +- test/lib/completions/repomanage.exp | 18 + test/lib/completions/ri.exp | 8 +- test/lib/completions/rsync.exp | 4 +- test/lib/completions/rtcwake.exp | 2 - test/lib/completions/scp.exp | 4 +- test/lib/completions/screen.exp | 4 + test/lib/completions/sftp.exp | 8 +- test/lib/completions/ssh-copy-id.exp | 8 +- test/lib/completions/ssh-keygen.exp | 18 + test/lib/completions/ssh.exp | 18 +- test/lib/completions/synclient.exp | 26 + test/lib/completions/tar.exp | 118 +- test/lib/completions/timeout.exp | 21 + test/lib/completions/tipc.exp | 18 + test/lib/completions/udevadm.exp | 18 + test/lib/completions/umount.exp | 83 +- test/lib/completions/unshunt.exp | 2 +- test/lib/completions/vgcreate.exp | 2 + test/lib/completions/wtf.exp | 2 +- test/lib/completions/zopfli.exp | 18 + test/lib/completions/zopflipng.exp | 18 + test/lib/library.exp | 68 +- test/lib/library.sh | 11 +- test/log/.gitignore | 1 + test/run | 63 + test/runCompletion | 8 + test/runInstall | 7 + test/runLint | 45 + test/runUnit | 8 + test/tmp/.gitignore | 1 + test/unit/__expand_tilde_by_ref.exp | 12 +- test/unit/_filedir.exp | 95 +- test/unit/_get_cword.exp | 15 + test/unit/_known_hosts_real.exp | 28 + test/unit/_tilde.exp | 6 + test/unit/_variables.exp | 39 + 692 files changed, 10525 insertions(+), 12784 deletions(-) create mode 100644 .editorconfig create mode 100644 .gitignore create mode 100644 .travis.yml create mode 100644 CONTRIBUTING.md delete mode 100644 Makefile.in delete mode 100644 README create mode 100644 README.md delete mode 100644 aclocal.m4 create mode 100644 bash-completion-config-version.cmake.in create mode 100644 bash-completion-config.cmake.in create mode 100644 completions/.gitignore create mode 100644 completions/2to3 create mode 100644 completions/7z delete mode 100644 completions/Makefile.in create mode 100644 completions/_cal create mode 100644 completions/_chfn create mode 100644 completions/_chsh create mode 100644 completions/_dmesg create mode 100644 completions/_eject create mode 100644 completions/_hexdump create mode 100644 completions/_hwclock create mode 100644 completions/_ionice create mode 100644 completions/_look create mode 100644 completions/_newgrp create mode 100644 completions/_nmcli create mode 100644 completions/_renice create mode 100644 completions/_repomanage create mode 100644 completions/_reptyr create mode 100644 completions/_rtcwake create mode 100644 completions/_runuser create mode 100644 completions/_su delete mode 100644 completions/_subversion create mode 100644 completions/_svn create mode 100644 completions/_svnadmin create mode 100644 completions/_svnlook create mode 100644 completions/_write delete mode 100644 completions/_yum-utils create mode 100644 completions/adb create mode 100644 completions/appdata-validate create mode 100644 completions/bind create mode 100644 completions/bts delete mode 100644 completions/cal create mode 100644 completions/checksec delete mode 100644 completions/chsh create mode 100644 completions/deja-dup delete mode 100644 completions/dmesg delete mode 100644 completions/eject create mode 100644 completions/flake8 create mode 100644 completions/freebsd-update create mode 100644 completions/gm create mode 100644 completions/gnokii delete mode 100644 completions/hexdump create mode 100644 completions/hostname delete mode 100644 completions/hwclock delete mode 100644 completions/ionice create mode 100644 completions/jpegoptim create mode 100644 completions/jshint delete mode 100644 completions/look create mode 100644 completions/lz4 create mode 100644 completions/mr delete mode 100644 completions/newgrp delete mode 100644 completions/nmcli create mode 100644 completions/optipng create mode 100644 completions/pdftotext create mode 100644 completions/pngfix create mode 100644 completions/portsnap create mode 100644 completions/py.test create mode 100644 completions/pyflakes create mode 100644 completions/pyvenv delete mode 100644 completions/renice delete mode 100644 completions/reptyr delete mode 100644 completions/rtcwake create mode 100644 completions/ssh-keygen delete mode 100644 completions/su create mode 100644 completions/synclient create mode 100644 completions/timeout create mode 100644 completions/tipc create mode 100644 completions/uscan create mode 100644 completions/zopfli create mode 100644 completions/zopflipng delete mode 100755 configure delete mode 100644 doc/Makefile.in mode change 100644 => 120000 doc/bashrc mode change 100644 => 120000 doc/inputrc create mode 100755 extra/make-changelog.py delete mode 100644 helpers/Makefile.in create mode 100644 helpers/python delete mode 100755 install-sh delete mode 100755 missing create mode 100644 test/.gitignore delete mode 100644 test/Makefile.in create mode 100644 test/completion/2to3.exp create mode 100644 test/completion/7z.exp create mode 100644 test/completion/adb.exp create mode 100644 test/completion/alpine.exp create mode 100644 test/completion/appdata-validate.exp create mode 100644 test/completion/bind.exp create mode 100644 test/completion/checksec.exp create mode 100644 test/completion/chroot.exp create mode 100644 test/completion/createuser.exp create mode 100644 test/completion/declare.exp create mode 100644 test/completion/deja-dup.exp create mode 100644 test/completion/dropuser.exp create mode 100644 test/completion/flake8.exp create mode 100644 test/completion/freebsd-update.exp create mode 100644 test/completion/function.exp create mode 100644 test/completion/gm.exp create mode 100644 test/completion/gnokii.exp create mode 100644 test/completion/hostname.exp create mode 100644 test/completion/hping3.exp delete mode 100644 test/completion/indent.exp create mode 100644 test/completion/jpegoptim.exp create mode 100644 test/completion/jshint.exp create mode 100644 test/completion/lz4.exp create mode 100644 test/completion/mock.exp create mode 100644 test/completion/mr.exp create mode 100644 test/completion/newgrp.exp create mode 100644 test/completion/optipng.exp create mode 100644 test/completion/pdftotext.exp create mode 100644 test/completion/pngfix.exp create mode 100644 test/completion/portsnap.exp create mode 100644 test/completion/pushd.exp create mode 100644 test/completion/py.test.exp create mode 100644 test/completion/pyflakes.exp create mode 100644 test/completion/pyvenv.exp create mode 100644 test/completion/repomanage.exp create mode 100644 test/completion/ssh-keygen.exp create mode 100644 test/completion/synclient.exp create mode 100644 test/completion/timeout.exp create mode 100644 test/completion/tipc.exp create mode 100644 test/completion/udevadm.exp create mode 100644 test/completion/zopfli.exp create mode 100644 test/completion/zopflipng.exp create mode 100644 test/docker/Dockerfile-centos6 create mode 100644 test/docker/Dockerfile-fedoradev create mode 100644 test/docker/Dockerfile-ubuntu14 create mode 100755 test/docker/docker-script.sh create mode 100644 test/fixtures/7z/a.7z create mode 100644 test/fixtures/7z/f.txt delete mode 100644 "test/fixtures/_filedir/a\"b/d" create mode 100644 test/fixtures/_get_cword/sea create mode 100644 test/fixtures/_get_cword/seb create mode 100644 test/fixtures/_get_cword/sec create mode 100644 "test/fixtures/_get_cword/\303\244\303\244\303\244\303\244\302\247" create mode 100644 test/fixtures/_known_hosts_real/.ssh/config_relative_path create mode 100644 test/fixtures/_known_hosts_real/config_full_path create mode 100644 test/fixtures/_known_hosts_real/config_include create mode 100644 test/fixtures/_known_hosts_real/config_include_recursion create mode 100644 test/fixtures/ant/.gitignore create mode 100644 test/fixtures/ant/build-with-import.xml create mode 100644 test/fixtures/ant/imported-build.xml create mode 100644 test/fixtures/ant/named-build.xml create mode 100644 test/fixtures/java/no-complete.txt create mode 100644 test/fixtures/make/.gitignore delete mode 100644 test/fixtures/make/empty_dir/.nothing_here create mode 100644 test/fixtures/make/sample.d create mode 100644 test/fixtures/make/sample.h delete mode 100644 test/fixtures/man/man3/Bash::Completion.3pm.gz create mode 100644 test/fixtures/perl/Devel/BashCompletion.pm create mode 100644 test/fixtures/perldoc/BashCompletionDoc.pod create mode 100644 test/fixtures/perldoc/BashCompletionModule.pm create mode 100644 test/fixtures/ri/BashCompletion/cdesc-BashCompletion.ri create mode 100644 test/fixtures/ri/cache.ri create mode 100644 test/fixtures/ri/created.rid create mode 100644 test/fixtures/shared/empty_dir/.nothing_here create mode 100644 test/fixtures/ssh-copy-id/.ssh/id_rsa.pub create mode 100644 test/fixtures/tar/archive.tar.xz create mode 100644 test/fixtures/tar/dir/fileA create mode 100644 test/fixtures/tar/dir/fileB create mode 100644 test/fixtures/tar/dir/fileC create mode 100644 test/fixtures/tar/dir/hello create mode 100644 test/fixtures/tar/dir2/.nothing_here create mode 100644 test/fixtures/tar/escape.tar create mode 100755 test/generate create mode 100644 test/lib/completions/2to3.exp create mode 100644 test/lib/completions/7z.exp create mode 100644 test/lib/completions/adb.exp create mode 100644 test/lib/completions/alpine.exp create mode 100644 test/lib/completions/appdata-validate.exp create mode 100644 test/lib/completions/bind.exp create mode 100644 test/lib/completions/bts.exp create mode 100644 test/lib/completions/checksec.exp create mode 100644 test/lib/completions/chroot.exp create mode 100644 test/lib/completions/createuser.exp create mode 100644 test/lib/completions/declare.exp create mode 100644 test/lib/completions/deja-dup.exp create mode 100644 test/lib/completions/dropuser.exp create mode 100644 test/lib/completions/flake8.exp create mode 100644 test/lib/completions/freebsd-update.exp create mode 100644 test/lib/completions/function.exp create mode 100644 test/lib/completions/gm.exp create mode 100644 test/lib/completions/gnokii.exp create mode 100644 test/lib/completions/hostname.exp create mode 100644 test/lib/completions/hping3.exp delete mode 100644 test/lib/completions/indent.exp create mode 100644 test/lib/completions/jpegoptim.exp create mode 100644 test/lib/completions/jshint.exp create mode 100644 test/lib/completions/lz4.exp create mode 100644 test/lib/completions/mock.exp create mode 100644 test/lib/completions/mr.exp create mode 100644 test/lib/completions/newgrp.exp create mode 100644 test/lib/completions/optipng.exp create mode 100644 test/lib/completions/pdftotext.exp create mode 100644 test/lib/completions/pngfix.exp create mode 100644 test/lib/completions/portsnap.exp create mode 100644 test/lib/completions/pushd.exp create mode 100644 test/lib/completions/py.test.exp create mode 100644 test/lib/completions/pyflakes.exp create mode 100644 test/lib/completions/pyvenv.exp create mode 100644 test/lib/completions/repomanage.exp create mode 100644 test/lib/completions/ssh-keygen.exp create mode 100644 test/lib/completions/synclient.exp create mode 100644 test/lib/completions/timeout.exp create mode 100644 test/lib/completions/tipc.exp create mode 100644 test/lib/completions/udevadm.exp create mode 100644 test/lib/completions/zopfli.exp create mode 100644 test/lib/completions/zopflipng.exp create mode 100644 test/log/.gitignore create mode 100755 test/run create mode 100755 test/runCompletion create mode 100755 test/runInstall create mode 100755 test/runLint create mode 100755 test/runUnit create mode 100644 test/tmp/.gitignore create mode 100644 test/unit/_variables.exp diff --git a/.dir-locals.el b/.dir-locals.el index 537ba6c3..ce251c0a 100644 --- a/.dir-locals.el +++ b/.dir-locals.el @@ -1,5 +1,3 @@ -;; bash-completion shell-script mode settings for Emacs +;; bash-completion shell-script mode additional settings for Emacs -((sh-mode . ((indent-tabs-mode . nil) - (sh-basic-offset . 4) - (sh-indent-comment . t)))) +((sh-mode . ((sh-indent-comment . t)))) diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..93f55b83 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,12 @@ +[*] +indent_style = space +indent_size = 4 +tab_width = 8 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true +max_line_length = 79 + +[Makefile.am] +indent_style = tab diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..083411ec --- /dev/null +++ b/.gitignore @@ -0,0 +1,18 @@ +*.tar* +*.swp +Makefile +Makefile.in +aclocal.m4 +autom4te.cache +config.log +config.status +configure +install-sh +missing +doc/*.xml +*~ +doc/html* +bash_completion.sh +bash-completion.pc +bash-completion-config.cmake +bash-completion-config-version.cmake diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..c287960c --- /dev/null +++ b/.travis.yml @@ -0,0 +1,17 @@ +language: generic + +sudo: required + +services: + - docker + +env: + - DIST=centos6 + - DIST=fedoradev + - DIST=ubuntu14 + +before_install: + - docker build -t bashcomp:$DIST -f test/docker/Dockerfile-$DIST . + +script: + - docker run -e CI=true -e DIST=$DIST -t bashcomp:$DIST test/docker/docker-script.sh diff --git a/AUTHORS b/AUTHORS index be87f3f2..4b547f10 100644 --- a/AUTHORS +++ b/AUTHORS @@ -5,5 +5,3 @@ Igor Murzov Mike Kelly (Exherbo) Santiago M. Mola (Exherbo) Ville Skyttä (Fedora/Red Hat) - -To contact us: bash-completion-devel@lists.alioth.debian.org diff --git a/CHANGES b/CHANGES index a4e8bcf8..7e0dc8fe 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,697 @@ +bash-completion (2.7) + + [ Eli Young ] + * Makefile: update default compatdir (#132) + + [ Ville Skyttä ] + * Make user completion file configurable, disable in tests + * test suite: Generalize xspec completion install check + * pyflakes: Remove redundant xspec completion + * test suite: Fix __expand_tilde_by_ref test expectation output + * pdfunite: New *.pdf completion + + -- Ville Skyttä Sat, 01 Jul 2017 14:08:43 +0300 + +bash-completion (2.6) + + [ Björn Kautler ] + * Add missing sidedoor to .gitignore (#114) + + [ Ville Skyttä ] + * test suite: Mark expected centos6 CI _filedir failures as such + * Expose version in BASH_COMPLETION_VERSINFO, use it in profile.d + script + * test suite: Skip an expected make test case failure in centos6 CI + * test suite: Fix ifdown and ifup CI test skipping + * test suite: Ignore env var pulled in by use of scp in tests + * test suite: If colon trim doesn't do anything, trim as usual + * tar: Comment spelling fixes + * test suite: Mark dpkg -L test case untested if no packages + installed + * test suite: Cosmetic tweaks + * dpkg: Fix dpkg -i home dir completion + * test suite: Improve ls home dir test descriptions + * python: Split module completion to separate helper + * micropython: New completion, aliased from python + * test suite: Add Python module completion test case + * python: Fix traceback avoidance on module completion error + * openssl: Parse available digests from dgst -h + * openssl: Add sha2 commands + * gm: New completion, commands only for now + * (test suite): Test screen -T completions + * (test suite): Set TERM to dumb, not dummy + * Revert "(test suite): Fix alias and cd cursor position tests" + * mplayer: Remove duplicate *.m4a and *.m4v associations + * mplayer, xine, etc: Associate *.mp4a and *.mp4v + * xine etc: Fix *.m4a association + * bind: Add option and argument (non-)completions + * _user_at_host: Set nospace only when completing username part + * _user_at_host: Append @ suffix to username part completions + * man: Don't check OSTYPE or GNU userland, just enable on all + systems + * (test suite): Set dcop result to untested if dcop server is not + running + * (test suite): Don't insist on loading all completions dynamically + * _configured_interfaces: Parse from /etc/network/interfaces.d/* on + Debian + * py.test: New completion + * oowriter: Associate with *.pdf + * Don't define BASH_COMPLETION_COMPAT_DIR + * ri: Add option and arg completions + * (test suite): Add our own dummy ri test fixture + * (test suite): Info test needs docs, don't exclude from CentOS + * (test suite): Fix CentOS 6 tcllib setup + * (test suite): Simplify renice test, fix with only one completion + * (test suite): Don't assume configured interfaces in CI setups + * Don't offer * as configured interface when there are none + * (test suite): Add basic CentOS 6 container for bash 4.1 coverage + * (test suite): Ignore runtime loaded env function changes + * (test suite): Add mailman bin dir to PATH for arch test + * arch: Parse options from --help + * (test suite): Load tested completions dynamically + * (test suite): Accept non-whitespace single word in + assert_complete_any + * (test suite): Avoid interference from user and system dirs (#87) + * (test suite): Install some things N/A in ubuntu14 to fedoradev + * (test suite): Add unrar to ubuntu14 container + * (test suite): Fix alias and cd cursor position tests + * (test suite): Add basic alpine test case + * alpine: Parse opts from -h output, add some opt arg completions + * (test suite): Install jshint globally in ubuntu14 + * (test suite): Add mailman bin dir to PATH for some mailman tools + * (test suite): Install jshint to ubuntu14 container with npm + * unshunt: Parse options from --help + * (test suite): Test lsof on ubuntu14 + * (test suite): Add basic hping3 test case + * (test suite): Add our ./configure to PATH to test it, test opts + * (test suite): Add bunch of packages to ubuntu14 container + * (test suite): Ensure /usr/(local/)games is in $PATH + * (test suite): Fix perl -d* test cases with no Devel::* installed + * (test suite): curl has lots of options, add more test prefix + * (test suite): Fix tar test case for ones having --owner-map + * (test suite): Unsupport various kill, renice cases if ps is N/A + * (test suite): Make chkconfig test behave better in container + * (test suite): Don't assume mounted filesystems in quota* tests + * newlist: Parse options from --help, add some arg non-completions + * (test suite): Delete trailing whitespace + * (test suite): Don't assume lists set up in newlist test cases + * (docker): Pull in missing fedoradev xvfb-run which dependency + * mr: Avoid stderr trash and test suite failure if man is N/A + * (test suite): Fix mmsitepass completion test + * tshark -G: Avoid stderr noise when running as superuser + * (docker): Run completion tests with xvfb-run, e.g. for gkrellm + * ssh-keygen: Make option parsing work with OpenSSH < 7 + * synclient, udevadm: Avoid use of posix char classes for awk + * test suite: Add WIP Fedora dev config + * Travis: Switch tests to docker, update to Ubuntu 14 + * xv: Associate with *.j2c, *.j2k, *.jp2, *.jpf, and *.jpg2 (Debian: + #859774) + * eog: Associate with *.j2c and *.jpg2 + * Bump copyright years + * xine etc: Associate uppercase *.WM[AV] + * mplayer: Associate *.weba (#112) + * xine etc: Associate *.webm and *.weba (#112) + + -- Ville Skyttä Tue, 27 Jun 2017 12:29:33 +0300 + +bash-completion (2.5) + + [ BartDeWaal ] + * Support for python gui source files (#91) + + [ Ben Webber ] + * mr: New completion + + [ Christian Kujau ] + * ssh-keygen: support ed25519 keys (#79) + + [ Dara Adib ] + * Add sidedoor to _ssh() completion (#106) + + [ George Kola ] + * .ipa is just a zip file and we should let unzip handle it (#71) + + [ Miroslav Šustek ] + * ant: parse targets in imported buildfiles (#84) + + [ Reuben Thomas ] + * Add more tests for ccache + * ccache: fix completing compiler's flags + + [ Ville Skyttä ] + * test suite: Add java/javac non-completion fixture + * javac: Complete -cp like -classpath + * travis: Skip bluez and nis for now due to post-install script + issues + * test/config/*: Delete trailing whitespace + * (test suite): Avoid loading user's ~/.bash_completion, fixes #87 + * ip: Recognize a as alias for address and l for link + * ip: Recognize address in addition to addr + * mr: Disable "clean" test case, command N/A before mr 1.20141023 + * ssh-keygen: Parse switches with _parse_usage, not _parse_help + * mplayer: Associate with *.mjpg, *.mjpeg (Debian: #837779) + * dd: Sync completions with coreutils 8.24 + * travis: Add mr + * perl: Remove full path to cat in PERLDOC_PAGER call + * deja-dup: New completion + * CONTRIBUTING: Reorder sections + * *: Move indentation settings to .editorconfig + * make: Declare _make_target_extract_script like other functions + * Travis: zopfli is AWOL? + * *: Whitespace fixes + + [ Zearin ] + * Minor edits to README.md (mostly formatting) (#110) + + [ l3nticular ] + * Fix bug in 'make' completion when using BSD sed (#108) + + [ osu ] + * Add support for Include in ssh config (#70) (#80) + + -- Ville Skyttä Sat, 04 Feb 2017 18:07:27 +0200 + +bash-completion (2.4) + + [ Arash Esbati ] + * xetex, xelatex, luatex, lualatex: Associate with tex files + + [ Gene Pavlovsky ] + * Use shell globbing instead of ls to source files in compat dir + + [ Grisha Levit ] + * Support completing array variables and expansions + * Add tests for declare/typeset + * Better handling of typeset/declare + + [ Kylie McClain ] + * tar: silence --version's stderr output + + [ Paul M. Lambert ] + * Support pod document files for perldoc (#39) + + [ Richard Alpe ] + * tipc: fix missing last char in link name completion + * tipc: handle complete words without trailing space + * tipc: suppress tipc error messages + * tipc: use double brackets in if conditions + * tipc: make loop variables local + * tipc: remove unnecessary return values + * tipc: readd call to complete command + * tipc: use cur variable for flag completion + * tipc: add command prefix to link sed + * tipc: remove unnecessary function _tipc_get_val() + * tipc: use bash here string instead of echo + * tipc: merge functions into main + * tipc: add test framework + * tipc: add tipc completions + + [ Ville Skyttä ] + * Release 2.4 + * rpm: Offer --filetriggers with -q + * javadoc: Add bunch of option arg (non)completions + * lrzip: Add -m arg noncompletion + * pkg-get: Don't use hyphens in function names + * jarsigner: Add some option arg (non)completions + * pkg-get,pkgrm: Drop unnecessary _have calls + * *: Trivial cleanups + * *: Remove redundant return 0's + * pypy*: Add basic --jit arg completion + * pypy3: Alias to python + * hcitool,svcadm,tar: Spelling fixes + * Travis: Install more packages for more test coverage + * (test suite): Pass assert_complete_any for exact/only given arg + completed + * tipc: Invoke ls with "command" + * tipc: Indentation fix + * (test suite): Fix fallout from + fec077d555f112b9f455c45860f90a3b47392fcf + * (test suite): Remove Bash::Completion.3pm.gz from git, create on + the fly + * (test suite): Remove test/fixtures/_filedir/a"b from git, create + on the fly + * CONTRIBUTING: Note patch preferences if not using GitHub pull + requests + * python: Support -Q and -W arg completion without space + * apache2ctl, aspell, make: Don't hardcode completion generator + command + * mysql: Avoid --default-character-set error with failglob, fixes + #46 + * test suite: Add perldoc module+pod completion test case + * perl: Remove some duplicated code + * pushd: Use _cd completion for CDPATH support, closes #38 + * test suite: Add basic pushd test case + * abook: Parse long options from command including full path + * pyvenv: New completion + * chroot: New (generic long options) completion, see #38 + * Travis: First steps toward testing with OS X + * test suite: Add bashcomp_bash env var for better control on tested + bash + * aptitude: List packages using _apt_cache_packages, fixes #33 + * vncviewer: Cleanup shopt use, drop an eval + * make: Avoid a grep + * rpm: Fix --whatenhances arg completion + * aspell, minicom, mysql: Replace use of ls with printf + * cppcheck: Complete filenames too for --platform + * man: Prioritize MANPATH, simplify, add fallback e.g. for busybox, + fixes #28 + * aclocal: Install completion for 1.14 and 1.15, fixes #25 + * mpv: Don't install symlink for it, fixes #24 + * test suite: Add function and declare test cases + * CONTRIBUTING: Highlight request for test cases + + [ Wayne Scott ] + * The BitKeeper completion used the wrong set of commands + + -- Ville Skyttä Fri, 12 Aug 2016 22:43:27 +0300 + +bash-completion (2.3) + + [ Daniel Milde ] + * Completion for python zip archives + + [ Liuhua Wang ] + * lvm: pvcreate should be able to use all block devcices + * lvm: fix all commands that should get all PVs + + [ Ville Skyttä ] + * Release 2.3 + * make-changelog: Don't output "Merge pull request" entries + * make: Use <<< instead of printf + pipe + * gnokii: Use <<< instead of echo + pipe + * *: Use [:blank:] instead of $'\t ' tricks where appropriate, fixes + #19 + * test suite: Fix abook test case + * test suite: Don't insist on property completions if synclient -l + fails + * test suite: Tolerate "See 'man feh'" feh --help output + * test suite: Fix tar failure caused by previous tar change + * tar: Detect GNU/other from --version only once per session + * tar: Remove unused variable + * tar: Fix GNU tar help output parsing regex, fixes #15 + * test suite: Add tar xvf filename test case + * tar: Don't write to /tmp/jetel + * python: Simplify code + * python: Complete all files also after -m + * python: Don't offer options after -c + * python: Complete all files only if -c is before current word + * test suite: Add some python test cases + * unzip, zipinfo: Complete on *.pyz + * travis: configure and run completions syntax check + * make check: Test syntax of all completion files + * CONTRIBUTING.md: Ask for test cases + + -- Ville Skyttä Mon, 28 Mar 2016 18:32:47 +0300 + +bash-completion (2.2) + + [ Barry Warsaw ] + * _init_completion: Handle cword < 0 (LP: #1289597) + + [ Damien Nadé ] + * (testsuite) Use 'set' command posix behaviour when saving env + (Alioth: #314720) + * Added test/site.{bak,exp} to .gitignore + * _parse_help: Fix failglob failures (Alioth: #314707) + * _lvm: using a single-pattern case and invoking function according + to words[1] + * lvm: _lvm_count_args parameter must be quoted in order to failglob + not to complain + * gendiff: Quoting suffix pattern to avoid triggering failglob + + [ Dams Nadé ] + * ssh-add, ssh-keygen: -? needs to be quoted under failglob (Alioth: + #314709) + * Quote unset array element to avoid globbing interference (Alioth: + #314708) + + [ David Paleino ] + * Refactor bts and uscan, since they use common functions + * uscan: New completion, thanks to Federico Ceratto + * bts: New completion, thanks to Federico Ceratto. + + [ Guillaume Rousse ] + * complete on freerdp-specific known hosts list + * nmcli completion was integrated upstream + + [ Igor Murzov ] + * isql: Fix failglob failure + * ssh-add, ssh-keygen: -? needs to be quoted under failglob (take 2) + (Alioth: #314709) + * (testsuite): move testing of _linux_fstab() to umount.exp + * umount: Fix mount points escaping/unescaping with Bash-4.3 + * slapt-src: Handle --config=FILE option properly + * sbopkg, slapt-{get,src}: expand tilde in config file name + * slapt-{get,src}: Fix issue with sed not being able to handle some + characters + * slapt-src: split options from their arguments + * Quote _filedir arguments when appropriate to prevent failglob + failures + * psql: Tell psql to not load .psqlrc as it may change output format + (Alioth: #314636) + * testsuite: Add basic tests for portsnap and freebsd-update + * mplayer: -dvd-devices takes dvd devices, dirs and .iso files as + argument + * 7z: Improve completion + * f77, f95: Use the same completion as for g77, g95 if they are + links to gfortran + * aptitude: safe-upgrade accepts package name as parameters (Alioth: + #313638, Debian: 673235) + * _longopt: Run commands in C locale. + * make: Use only posix basic regexps with sed (Alioth: #314345) + * cppcheck: Add new --enable option argument and --library argument + completion + * dpkg: Suppress unwanted error messages (Debian: #706502) + * perl: -d/-dt option argument is optional (Alioth: #314242) + * Add config for cmake to bash-completion. + * kcov: Add new sort types, complete --replace-src-path arguments + * feh: Add new sort type + + [ Mathieu Parent ] + * Puppet: describe: update options list, accordind to 'puppet help + describe' + * Puppet: cert: update options list, accordind to 'puppet help cert' + * Puppet: apply: update options list, accordind to 'puppet help + apply' + * Puppet: agent: update options list, accordind to 'puppet help + agent' + * Puppet: puppet parser support + * Puppet: puppet -* doesn't imply 'puppet apply' + * Puppet: use puppet terminology + + [ Matthew Gamble ] + * Modify all usages of 'sed' to be run with command bash builtin + * Use command built-in to run sed to avoid any custom aliases + + [ Matthieu Crapet ] + * man: Use -w instead of --path + + [ Michael Gold ] + * profile.d: Avoid some warnings from shells in "nounset" mode + (Debian: #776160) + + [ Miroslav Lichvar ] + * chronyc: Update help text parsing + * chronyc: Add missing subcommands + * chronyc: Add -6 option + + [ Nevo Hed ] + * minicom: Recognize user ~/.minirc.* as config files + + [ Ondrej Oprala ] + * __get_cword: avoid $index < 0 (Alioth: #315107) + + [ Patrick Monnerat ] + * rpmbuild: Complete *.spec on --clean (RedHat: #1132959) + + [ Pavel Raiskup ] + * tar: rework the completion completely + + [ Peter Cordes ] + * upstart support for service completion + + [ Peter Dave Hello ] + * freebsd-update: New completion. + * portsnap: New completion. + + [ Peter Wu ] + * modprobe: fix params with multi-line descriptions + * gdb: support --args style completion (Alioth: #314664) + + [ Rainer Müller ] + * make: Fix basic regex for portability (Alioth: #314345) + + [ Raphaël Droz ] + * gnokii: New completion + + [ Rune Schjellerup Philosof (Olberd) ] + * dpkg: Add support in dpkg completion for .ddeb (LP: #568404) + + [ Shaun McCance ] + * xmllint, xmlwf, xsltproc: Complete on Mallard *.page files + + [ Stefano Rivera ] + * pypy: New completion identical to python (Alioth: #314501) + + [ Thilo Six ] + * Use more straightforward way to check bash version + * _mac_addresses: Use explicit C locale for ifconfig (Debian: + #704832). + + [ Tristan Wibberley ] + * make: Don't pick up variables when makefile is reloaded + * make: Offer hidden targets when it is clear that the user is + trying to complete one of them + * make: Fix detection of intermediate targets where make has changed + its database whitespace + * make: Add __BASH_MAKE_COMPLETION__ variable + * make: completion shouldn't be confused by the output of $(info + confuse: make) + + [ Uwe Kleine-König ] + * Don't complete hostnames found after Hostname in ~/.ssh/config + + [ Ville Skyttä ] + * Release 2.2 + * README.md: Note autoreconf need only in unprepared tarball + * make-changelog.py: Set myself in footer + * make-changelog.py: Fix footer line output + * make-changelog.py: flake8 fixes + * make-changelog.py: Make work with Python 3 + * README.md: More markdown tweaks + * README.md: Markdown tweaks + * zopflipng: New completion + * README.md: Not need for autoreconf, fixes #11 + * README: Expand troubleshooting section somewhat + * Merge pull request #9 from shaunix/master + * ssh: Extract duplicate code to _ssh_configfile + * Remove various comments related to bash versions we don't support + * travis: Install more packages for [xyz]* test coverage + * travis: Install more packages for [stuvw]* test coverage + * travis: Install more packages for [qr]* test coverage + * travis: Install more packages for [op]* test coverage + * travis: Install more packages for m* test coverage + * travis: Install more packages for [jkl]* test coverage + * Merge pull request #7 from ukleinek/master + * indent: Remove generic long option completion + * Update copyright year + * travis: Install more packages for [hi]* test coverage + * travis: Install more packages for [fg]* test coverage + * mysql: Fix --default-character-set completion with mariadb + * mysql, puppet: sed portability fixes + * gnokii, minicom: Use grep through "command" + * lint: Check for sed without "command" + * Merge pull request #2 from djmattyg007/avoid_sed_alias + * travis: Install more packages for [de]* test coverage + * travis: Install more packages for c* test coverage + * travis: Add note about (currently) N/A packages + * test suite: Mark unsupported look test case as such, not + unresolved + * test suite: Use unsupported instead of xfail for modinfo/modprobe + cases + * travis: Install more packages for [0-9][ab]* test coverage + * travis: Run tests with --all to get some more useful output + * test suite: Fix ssh partial hostname completion test + * README: Split contributing to separate CONTRIBUTING doc + * README: Convert to markdown + * Drop references to bash-completion-devel@lists.alioth.debian.org + * build system: Switch to xz compressed tarball + * aclocal, automake: Install for versioned 1.14 and 1.15 executables + * Update URLs and various instructions to GitHub + * README: Update POSIX spec link + * travis: Avoid Travis default ri, use distro one instead + * test suite: Make apt-get test less sensitive to available commands + * test suite: Output tool log on failure in CI + * Set up Travis + * test suite: Expect failure in modinfo/modprobe if there are no + modules + * test suite: Fix ssh-copy-id test on old setups with no identities + * cppcheck: Add native to --platform completions + * ssh: Avoid completing commands before hostname + * chronyc: Parse command args from help output + * chronyc: Wrap long lines + * Load completions also from $XDG_DATA_DIRS (RedHat: #1264094) + * (testsuite) Ignore files generated by complete-ant-cmd.pl + * scp, sftp: Complete -S on commands + * scp, sftp: Fix querying ssh options + * sftp: Add -l arg non-completion + * ssh-copy-id: Offer only *.pub to -i + * mpv: Remove mplayer-aliased completion + * __load_completion: New function, use in _completion_loader and + _xfunc + * modplug*: Associate *.oct and *.okt + * rpm: Add --whatenhances/recommends/suggests/supplements and + --recommends/supplements completions + * pgrep, pidof, pkill, pwdx, vmstat: Add support for procps-ng + * pdftotext: New completion + * checksec: New completion + * ssh: Complete HostbasedKeyTypes,HostKeyAlgorithms,KexAlgorithms + values + * ssh: Query ciphers and macs from ssh before hardcoded fallback + * ssh: Add -Q argument completion + * sysctl: Return early on --help, --version + * sysctl: Try parsing options from help before usage + * Document how to avoid command_not_found_handler interference + * eog: Complete on *.ppm (RedHat: #1090481) + * tar: Plug $line var leak + * tar: Style tweaks + * (testsuite) Add required "empty" dir for tar + * bsdtar, tar: Remove symlinks from git, have make create them + * jshint: New completion + * gnokii: Include and install it + * gnokii: Fix completions of options that are prefixes for others + * gnokii: Drop dead code + * (testsuite): Add basic gnokii test case + * gnokii: Various minor and cosmetic fixes + * _filedir: Avoid some unnecessary work with -d + * _filedir: Remove unused variable + * _filedir: Fix overquoted argument to compgen -d (RedHat: #1171396) + * 2015 + * Load user completions from $BASH_COMPLETION_USER_DIR/completions + * Revert "README: Don't hardcode /etc in cmake fallback dir" + * README: Don't hardcode /etc in cmake fallback dir + * README: Add cmake usage example + * README: Add autotools and cmake tips + * Drop reference to no longer used sysconf_DATA + * synclient: New completion + * tune2fs: Add missing return in -M arg completion + * reptyr: Rename file to _reptyr to avoid conflict with upstreamed + completion + * cppcheck: Option argument (non-)completion update + * dropuser: New completion + * createuser: New completion + * createdb, dropdb: Drop -o default, it does not appear to do + anything good here + * tshark: Simplify cut usage + * mcrypt: Simplify -m arg completion + * (testsuite): Add mcrypt -a and -m argument completion tests + * strings: Fix -T/--target arg completion with non-English locale + * chrome, firefox etc: Complete on *.pdf + * ccache: Add -o/--set-config arg name completion + * gphoto2: Replace tail with awk + * *: Invoke command to be completed, not its basename + * gphoto2: Fix split argument handing, and colon treatment in --port + args + * _completion_loader: Protect compgen from -* leakage (Debian: + #769399) + * Actually install the lz4 completion + * _pnames: Add -s for producing (possibly) truncated names (RedHat: + #744406) + * (testsuite) Add cd in dir without subdirs or CDPATH test case + * Protect various compgen invocations from -* leakage (Debian: + #766163) + * pigz, unpigz: Handle *.zz + * _completion_loader: Set empty command to _EmptycmD_ for cross + version compat + * Comment update + * rpmbuild: Complete *.spec on --nobuild + * mplayer, *xine: Complete on *.mts (Debian: #759219) + * ant: Support buildfile set in $ANT_ARGS (Alioth: #314735) + * (testsuite) Add ant -f test case + * ant: Don't offer more completions after options that exit + * 7z, adb: Trivial cleanups + * python(3): Add -X argument non-completion + * xsltproc. TODO fix for previous commit + * xmllint, xmlwf, xsltproc: Complete on *.dbk and *.docbook (Alioth: + #314770) + * xz: Complete -T/--threads argument + * (testsuite) Save shell variables when saving env (Alioth: #314720) + * adb: New completion + * modprobe: Try parsing help before using hardcoding option list + * (testsuite) Add vgcreate test case for _lvm_count_args with + failglob on + * _filedir_xspec: Fix with failglob on + * Various mostly array element unsetting fixes under failglob + * __reassemble_comp_words_by_ref: Make work with failglob on + (Alioth: #312741) + * _services: README in sysv init dir is not a service + * mpv: New completion alias + adjustments for mplayer (Debian: + #749115) + * (testsuite) Add puppet subcommand option test case + * puppet: Recognize some short options + * puppet: Parse most subcommand options from "help subcommand" + output + * puppet: Exit early on -h|-V|--version in addition to --help + * hostname: New completion + * nslookup: complete on hosts (Alioth: #314673) + * eog: Complete on *.pgm (RedHat: #1090481) + * pngfix: New completion + * qemu: Fix -balloon arg completion + * qemu: Apply completion to qemu-kvm/-system-i386/-system-x86_64 too + * xrandr: Use the invoked command internally, not hardcoded "xrandr" + * xrandr: Add (some) --setprovider* arg completion support + * profile.d: Don't return from a sourced script (Debian: #741657) + * FAQ: Clarify that we mean the bash man page for M-/ + * (testsuite) Avoid complete-ant-cmd.pl errors with our build.xml + * ri: Fix class completion with ri >= 3. + * ri: Fix colon handling in class completion. + * flake8: New completion + * pyflakes: New completion + * cal,chfn,chsh,dmesg,eject,hexdump,look,newgrp,renice,runuser,su,wr + ite: Deprecate on Linux in favor of util-linux ones (Debian: + #737672) + * testsuite: Add basic newgrp test case + * testsuite: Add basic test cases for deprecated completions + * _*: Install our deprecated completions too, try loading them + secondarily + * hwclock,ionice,rtcwake: Deprecate in favor of util-linux ones + (Debian: #737672) + * ssh-keygen: New completion + * Bump copyright years to 2014. + * jpegoptim: New completion + * ip: Add some addr, addrlabel, and route arg completions + * aptitude, dpkg: Replace some grep+cuts with awk + * gcc, lintian, make, pkgadd, slackpkg: grep -> "command grep" + (Debian: #734095) + * lintian: Replace some grep+cuts with awk + * (testsuite) Check for grep and ls invoked without "command", see + README + * lz4: New completion. + * optipng: New completion. + * cppcheck: Include - in --file-list completions. + * (testsuite): Limit wtf completions to A* to keep expect happier. + * wtf: Look for acronym db from /usr/share/games/bsdgames/acronyms + too. + * wtf: Don't offer -f if it was already specified. + * wtf: Hush stderr when db file doesn't exist. + * appdata-validate: New completion. + * timeout: New completion. + * _known_hosts_real: Exclude %h HostName entries (RedHat: #1015935). + * cc, c++: Check path to binary when finding out if it's gcc + (Alioth: #314417). + * cc, c++: Install minimal completion for non-gcc ones (Alioth: + #314417). + * abook, kldunload: Pre-expand \t instead of relying on sed + supporting it. + * dict: Trivial regex cleanup. + * _known_hosts_real: Pre-expand \t instead of relying on sed + supporting it (Alioth: #314393). + * zopfli: New completion. + * bzip2, gzip, lzma: Cleanups. + * Cosmetics. + * export, _variables: Do TZ= completion (Redhat: #994646). + * 2to3: New completion. + * file-roller: Reuse unzip's xspec. + * 7z: New completion. + * hcitool, rfcomm, ciptool, hciconfig: Don't leak $args. + * perl: Fix -dt: completion. + * perl*: Fix handling of relative paths in @INC. + * wget: Add --accept-regex/--reject-regex/--regex-type arg + (non)completions. + * wget: Drop incorrect -nv arg completion. + * wget: Stop completing after --help/--version. + * Clean up/compact various globs. + * cvs: Fix checkout -j non-completion. + * sh: Complete script arguments with all filenames (Alioth: + #314226). + * nmcli: Deprecate our completion, upstream has one in 0.9.8.0. + * Revert "nmcli completion was integrated upstream" + * Use == instead of =. + * cvs rm: Don't filter existing files with -f (RedHat: #949479). + * aclocal, automake: Install for *-1.10, *-1.12, and *-1.13 too. + + -- Ville Skyttä Thu, 03 Mar 2016 17:22:50 +0200 + bash-completion (2.1) [ AllKind ] @@ -1272,4 +1966,3 @@ bash-completion (20060301-0ubuntu1) hardy; urgency=low Ubuntu: #139666. -- Matthias Klose Fri, 08 Feb 2008 16:46:34 +0100 - diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..41287366 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,147 @@ +# Contributing to bash-completion + +Contributions to the bash completion project are more than +welcome. Fixes, clean-ups and improvements of existing code are much +appreciated, as are completion functions for new commands. + +If you wish to contribute code, please bare the following coding +guidelines in mind: + +- Do not use Perl, Ruby, Python etc. to do text processing unless the + command for which you are writing the completion code implies the + presence of one of those languages. + + For example, if you were writing completion code for perldoc(1), the + use of Perl to achieve your goal would be acceptable. irb(1) + completion would similarly make the use of Ruby acceptable. + + Even so, please consider alternatives to these large and slow to + start interpreters. Use lightweight programs such as grep(1), awk(1) + and sed(1). + +- Use the full power of bash >= 4.1. We no longer support earlier bash + versions, so you may as well use all the features of that version of + bash to optimise your code. However, be careful when using features + added since bash 4.1, since not everyone will be able to use them. + + For example, extended globs often enable you to avoid the use of + external programs, which are expensive to fork and execute, so do + make full use of those: + + `?(pattern-list)` - match zero or one occurrences of patterns + `*(pattern-list)` - match zero or more occurrences of patterns + `+(pattern-list)` - match one or more occurrences of patterns + `@(pattern-list)` - match exactly one of the given patterns + `!(pattern-list)` - match anything except one of the given patterns + +- Following on from the last point, be sparing with the use of + external processes whenever you can. Completion functions need to be + fast, so sacrificing some code legibility for speed is acceptable. + + For example, judicious use of sed(1) can save you from having to + call grep(1) and pipe the output to cut(1), which saves a fork(2) + and exec(3). + + Sometimes you don't even need sed(1) or other external programs at + all, though. Use of constructs such as `${parameter#word}`, + `${parameter%word}` and `${parameter/pattern/string}` can provide + you a lot of power without having to leave the shell. + + For example, if `$foo` contains the path to an executable, + `${foo##*/}` will give you the basename of the program, without + having to call basename(1). Similarly, `${foo%/*}` will give you the + dirname, without having to call dirname(1). + + As another example, + + ```shell + bar=$( echo $foo | sed -e 's/bar/baz/g' ) + ``` + + can be replaced by: + + ```shell + bar=${foo//bar/baz} + ``` + + These forms of parameter substitutions can also be used on arrays, + which makes them very powerful (if a little slow). + +- Prefer `compgen -W '...' -- $cur` over embedding `$cur` in external + command arguments (often e.g. sed, grep etc) unless there's a good + reason to embed it. Embedding user input in command lines can result + in syntax errors and other undesired behavior, or messy quoting + requirements when the input contains unusual characters. Good + reasons for embedding include functionality (if the thing does not + sanely work otherwise) or performance (if it makes a big difference + in speed), but all embedding cases should be documented with + rationale in comments in the code. + +- When completing available options, offer only the most descriptive + ones as completion results if there are multiple options that do the + same thing. Usually this means that long options should be preferred + over the corresponding short ones. This way the user is more likely + to find what she's looking for and there's not too much noise to + choose from, and there are less situations where user choice would + be needed in the first place. Note that this concerns only display + of available completions; argument processing/completion for options + that take an argument should be made to work with all known variants + for the functionality at hand. For example if `-s`, `-S`, and + `--something` do the same thing and require an argument, offer only + `--something` as a completion when completing option names starting + with a dash, but do implement required argument processing for all + `-s`, `-S`, and `--something`. Note that GNU versions of various + standard commands tend to have long options while other userland + implementations of the same commands may not have them, and it would + be good to have the completions work for as many userlands as + possible so things aren't always that simple. + +- Do not write to the file-system under any circumstances. This can + create race conditions, is inefficient, violates the principle of + least surprise and lacks robustness. + +- Use printf(1) instead of echo(1) for portability reasons, and be + sure to invoke commands that are often found aliased (such as `ls` + or `grep` etc) using the `command` (or `builtin`) command as + appropriate. + +- Make small, incremental commits that do one thing. Don't cram + unrelated changes into a single commit. + +- If your code was written for a particular platform, try to make it + portable to other platforms, so that everyone may enjoy it. If your + code works only with the version of a binary on a particular + platform, ensure that it will not be loaded on other platforms that + have a command with the same name. + + In particular, do not use GNU extensions to commands like sed and + awk if you can write your code another way. If you really, REALLY must + use them, do so if there's no other sane way to do what you're doing. + The "Shell and Utilities" volume of the POSIX specification is a good + starting reference for portable use of various utilities, see + http://pubs.opengroup.org/onlinepubs/9699919799/ + +- Use an editor that supports EditorConfig, see http://editorconfig.org/, + and format source code according to our settings. + +- Read the existing source code for examples of how to solve + particular problems. Read the bash man page for details of all the + programming tools available to you within the shell. + +- Please test your code thoroughly before sending it to us. We don't + have access to all the commands for which we are sent completion + functions, so we are unable to test them all personally. If your + code is accepted into the distribution, a lot of people will try it + out, so try to do a thorough job of eradicating all the bugs before + you send it to us. If at all practical, **add test cases** to our + test suite (in the test/ dir) that verify that the code does what it + is intended to do, fixes issues it intends to fix, etc. + +- File bugs, enhancement, and pull requests at GitHub, + https://github.com/scop/bash-completion + Sending them to the developers might work too, but is really + discouraged as bits are more likely to fall through the cracks that + way compared to the tracker. Just use GitHub. If that's not an + option for some reason and you want to use email to send patches, + send them as attachments formatted by `git format-patch` or directly + with `git send-email`. diff --git a/Makefile.am b/Makefile.am index dbbba0c2..1df73ae0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -11,17 +11,26 @@ profile_DATA = bash_completion.sh pkgconfigdir = $(datadir)/pkgconfig pkgconfig_DATA = bash-completion.pc +cmakeconfigdir = $(datadir)/cmake/$(PACKAGE)/ +cmakeconfig_DATA = bash-completion-config.cmake \ + bash-completion-config-version.cmake + bash_completion.sh: bash_completion.sh.in Makefile sed -e 's|@pkgdatadir[@]|$(pkgdatadir)|' <$(srcdir)/$@.in >$@ CLEANFILES = bash_completion.sh bash-completion.pc -EXTRA_DIST = CHANGES $(sysconf_DATA) $(pkgdata_DATA) bash_completion.sh.in \ - .dir-locals.el +EXTRA_DIST = CHANGES $(pkgdata_DATA) bash_completion.sh.in .dir-locals.el \ + .editorconfig README.md CONTRIBUTING.md install-data-hook: tmpfile=`mktemp $${TMPDIR:-/tmp}/bash_completion.XXXXXX` && \ - sed -e 's|=/etc/bash_completion\.d|=$(compatdir)|' \ - $(DESTDIR)$(pkgdatadir)/bash_completion > $$tmpfile && \ + sed -e 's|-/etc/bash_completion\.d|-$(compatdir)|' \ + $(DESTDIR)$(pkgdatadir)/bash_completion > $$tmpfile && \ cat $$tmpfile > $(DESTDIR)$(pkgdatadir)/bash_completion && \ + sed -e 's|\$${prefix}|$(prefix)|' \ + $(DESTDIR)$(datadir)/cmake/$(PACKAGE)/bash-completion-config.cmake \ + > $$tmpfile && \ + cat $$tmpfile > \ + $(DESTDIR)$(datadir)/cmake/$(PACKAGE)/bash-completion-config.cmake && \ rm $$tmpfile diff --git a/Makefile.in b/Makefile.in deleted file mode 100644 index 488f4d08..00000000 --- a/Makefile.in +++ /dev/null @@ -1,836 +0,0 @@ -# Makefile.in generated by automake 1.11.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software -# Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -VPATH = @srcdir@ -am__make_dryrun = \ - { \ - am__dry=no; \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ - | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ - *) \ - for am__flg in $$MAKEFLAGS; do \ - case $$am__flg in \ - *=*|--*) ;; \ - *n*) am__dry=yes; break;; \ - esac; \ - done;; \ - esac; \ - test $$am__dry = yes; \ - } -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -subdir = . -DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ - $(srcdir)/Makefile.in $(srcdir)/bash-completion.pc.in \ - $(top_srcdir)/configure AUTHORS COPYING install-sh missing -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ - configure.lineno config.status.lineno -mkinstalldirs = $(install_sh) -d -CONFIG_CLEAN_FILES = bash-completion.pc -CONFIG_CLEAN_VPATH_FILES = -SOURCES = -DIST_SOURCES = -RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ - html-recursive info-recursive install-data-recursive \ - install-dvi-recursive install-exec-recursive \ - install-html-recursive install-info-recursive \ - install-pdf-recursive install-ps-recursive install-recursive \ - installcheck-recursive installdirs-recursive pdf-recursive \ - ps-recursive uninstall-recursive -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; -am__install_max = 40 -am__nobase_strip_setup = \ - srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` -am__nobase_strip = \ - for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" -am__nobase_list = $(am__nobase_strip_setup); \ - for p in $$list; do echo "$$p $$p"; done | \ - sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ - $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ - if (++n[$$2] == $(am__install_max)) \ - { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ - END { for (dir in files) print dir, files[dir] }' -am__base_list = \ - sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ - sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' -am__uninstall_files_from_dir = { \ - test -z "$$files" \ - || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ - || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ - $(am__cd) "$$dir" && rm -f $$files; }; \ - } -am__installdirs = "$(DESTDIR)$(compatdir)" "$(DESTDIR)$(pkgconfigdir)" \ - "$(DESTDIR)$(pkgdatadir)" "$(DESTDIR)$(profiledir)" -DATA = $(compat_DATA) $(pkgconfig_DATA) $(pkgdata_DATA) \ - $(profile_DATA) -RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ - distclean-recursive maintainer-clean-recursive -AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ - $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ - distdir dist dist-all distcheck -ETAGS = etags -CTAGS = ctags -DIST_SUBDIRS = $(SUBDIRS) -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -distdir = $(PACKAGE)-$(VERSION) -top_distdir = $(distdir) -am__remove_distdir = \ - if test -d "$(distdir)"; then \ - find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ - && rm -rf "$(distdir)" \ - || { sleep 5 && rm -rf "$(distdir)"; }; \ - else :; fi -am__relativize = \ - dir0=`pwd`; \ - sed_first='s,^\([^/]*\)/.*$$,\1,'; \ - sed_rest='s,^[^/]*/*,,'; \ - sed_last='s,^.*/\([^/]*\)$$,\1,'; \ - sed_butlast='s,/*[^/]*$$,,'; \ - while test -n "$$dir1"; do \ - first=`echo "$$dir1" | sed -e "$$sed_first"`; \ - if test "$$first" != "."; then \ - if test "$$first" = ".."; then \ - dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ - dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ - else \ - first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ - if test "$$first2" = "$$first"; then \ - dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ - else \ - dir2="../$$dir2"; \ - fi; \ - dir0="$$dir0"/"$$first"; \ - fi; \ - fi; \ - dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ - done; \ - reldir="$$dir2" -GZIP_ENV = --best -DIST_ARCHIVES = $(distdir).tar.bz2 -distuninstallcheck_listfiles = find . -type f -print -am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ - | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' -distcleancheck_listfiles = find . -type f -print -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MKDIR_P = @MKDIR_P@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -am__leading_dot = @am__leading_dot@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build_alias = @build_alias@ -builddir = @builddir@ -compatdir = @compatdir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host_alias = @host_alias@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -SUBDIRS = completions doc helpers test -pkgdata_DATA = bash_completion - -# Empty, but here just to get the compat dir created with install -compat_DATA = -profiledir = $(sysconfdir)/profile.d -profile_DATA = bash_completion.sh -pkgconfigdir = $(datadir)/pkgconfig -pkgconfig_DATA = bash-completion.pc -CLEANFILES = bash_completion.sh bash-completion.pc -EXTRA_DIST = CHANGES $(sysconf_DATA) $(pkgdata_DATA) bash_completion.sh.in \ - .dir-locals.el - -all: all-recursive - -.SUFFIXES: -am--refresh: Makefile - @: -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \ - $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --foreign Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - echo ' $(SHELL) ./config.status'; \ - $(SHELL) ./config.status;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - $(SHELL) ./config.status --recheck - -$(top_srcdir)/configure: $(am__configure_deps) - $(am__cd) $(srcdir) && $(AUTOCONF) -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) -$(am__aclocal_m4_deps): -bash-completion.pc: $(top_builddir)/config.status $(srcdir)/bash-completion.pc.in - cd $(top_builddir) && $(SHELL) ./config.status $@ -install-compatDATA: $(compat_DATA) - @$(NORMAL_INSTALL) - @list='$(compat_DATA)'; test -n "$(compatdir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(compatdir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(compatdir)" || exit 1; \ - fi; \ - for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - echo "$$d$$p"; \ - done | $(am__base_list) | \ - while read files; do \ - echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(compatdir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(compatdir)" || exit $$?; \ - done - -uninstall-compatDATA: - @$(NORMAL_UNINSTALL) - @list='$(compat_DATA)'; test -n "$(compatdir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - dir='$(DESTDIR)$(compatdir)'; $(am__uninstall_files_from_dir) -install-pkgconfigDATA: $(pkgconfig_DATA) - @$(NORMAL_INSTALL) - @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(pkgconfigdir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" || exit 1; \ - fi; \ - for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - echo "$$d$$p"; \ - done | $(am__base_list) | \ - while read files; do \ - echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgconfigdir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgconfigdir)" || exit $$?; \ - done - -uninstall-pkgconfigDATA: - @$(NORMAL_UNINSTALL) - @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - dir='$(DESTDIR)$(pkgconfigdir)'; $(am__uninstall_files_from_dir) -install-pkgdataDATA: $(pkgdata_DATA) - @$(NORMAL_INSTALL) - @list='$(pkgdata_DATA)'; test -n "$(pkgdatadir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(pkgdatadir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(pkgdatadir)" || exit 1; \ - fi; \ - for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - echo "$$d$$p"; \ - done | $(am__base_list) | \ - while read files; do \ - echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgdatadir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgdatadir)" || exit $$?; \ - done - -uninstall-pkgdataDATA: - @$(NORMAL_UNINSTALL) - @list='$(pkgdata_DATA)'; test -n "$(pkgdatadir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - dir='$(DESTDIR)$(pkgdatadir)'; $(am__uninstall_files_from_dir) -install-profileDATA: $(profile_DATA) - @$(NORMAL_INSTALL) - @list='$(profile_DATA)'; test -n "$(profiledir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(profiledir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(profiledir)" || exit 1; \ - fi; \ - for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - echo "$$d$$p"; \ - done | $(am__base_list) | \ - while read files; do \ - echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(profiledir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(profiledir)" || exit $$?; \ - done - -uninstall-profileDATA: - @$(NORMAL_UNINSTALL) - @list='$(profile_DATA)'; test -n "$(profiledir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - dir='$(DESTDIR)$(profiledir)'; $(am__uninstall_files_from_dir) - -# This directory's subdirectories are mostly independent; you can cd -# into them and run `make' without going through this Makefile. -# To change the values of `make' variables: instead of editing Makefiles, -# (1) if the variable is set in `config.status', edit `config.status' -# (which will cause the Makefiles to be regenerated when you run `make'); -# (2) otherwise, pass the desired values on the `make' command line. -$(RECURSIVE_TARGETS): - @fail= failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ - dot_seen=no; \ - target=`echo $@ | sed s/-recursive//`; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - dot_seen=yes; \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done; \ - if test "$$dot_seen" = "no"; then \ - $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ - fi; test -z "$$fail" - -$(RECURSIVE_CLEAN_TARGETS): - @fail= failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ - dot_seen=no; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - rev=''; for subdir in $$list; do \ - if test "$$subdir" = "."; then :; else \ - rev="$$subdir $$rev"; \ - fi; \ - done; \ - rev="$$rev ."; \ - target=`echo $@ | sed s/-recursive//`; \ - for subdir in $$rev; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done && test -z "$$fail" -tags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ - done -ctags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ - done - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - set x; \ - here=`pwd`; \ - if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ - include_option=--etags-include; \ - empty_fix=.; \ - else \ - include_option=--include; \ - empty_fix=; \ - fi; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test ! -f $$subdir/TAGS || \ - set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ - fi; \ - done; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - shift; \ - if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - if test $$# -gt 0; then \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - "$$@" $$unique; \ - else \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$unique; \ - fi; \ - fi -ctags: CTAGS -CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - test -z "$(CTAGS_ARGS)$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && $(am__cd) $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) "$$here" - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - $(am__remove_distdir) - test -d "$(distdir)" || mkdir "$(distdir)" - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done - @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - $(am__make_dryrun) \ - || test -d "$(distdir)/$$subdir" \ - || $(MKDIR_P) "$(distdir)/$$subdir" \ - || exit 1; \ - dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ - $(am__relativize); \ - new_distdir=$$reldir; \ - dir1=$$subdir; dir2="$(top_distdir)"; \ - $(am__relativize); \ - new_top_distdir=$$reldir; \ - echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ - echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ - ($(am__cd) $$subdir && \ - $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$$new_top_distdir" \ - distdir="$$new_distdir" \ - am__remove_distdir=: \ - am__skip_length_check=: \ - am__skip_mode_fix=: \ - distdir) \ - || exit 1; \ - fi; \ - done - -test -n "$(am__skip_mode_fix)" \ - || find "$(distdir)" -type d ! -perm -755 \ - -exec chmod u+rwx,go+rx {} \; -o \ - ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ - ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ - ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ - || chmod -R a+r "$(distdir)" -dist-gzip: distdir - tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz - $(am__remove_distdir) -dist-bzip2: distdir - tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 - $(am__remove_distdir) - -dist-lzip: distdir - tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz - $(am__remove_distdir) - -dist-lzma: distdir - tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma - $(am__remove_distdir) - -dist-xz: distdir - tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz - $(am__remove_distdir) - -dist-tarZ: distdir - tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z - $(am__remove_distdir) - -dist-shar: distdir - shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz - $(am__remove_distdir) - -dist-zip: distdir - -rm -f $(distdir).zip - zip -rq $(distdir).zip $(distdir) - $(am__remove_distdir) - -dist dist-all: distdir - tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 - $(am__remove_distdir) - -# This target untars the dist file and tries a VPATH configuration. Then -# it guarantees that the distribution is self-contained by making another -# tarfile. -distcheck: dist - case '$(DIST_ARCHIVES)' in \ - *.tar.gz*) \ - GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ - *.tar.bz2*) \ - bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ - *.tar.lzma*) \ - lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\ - *.tar.lz*) \ - lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ - *.tar.xz*) \ - xz -dc $(distdir).tar.xz | $(am__untar) ;;\ - *.tar.Z*) \ - uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ - *.shar.gz*) \ - GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ - *.zip*) \ - unzip $(distdir).zip ;;\ - esac - chmod -R a-w $(distdir); chmod u+w $(distdir) - mkdir $(distdir)/_build - mkdir $(distdir)/_inst - chmod a-w $(distdir) - test -d $(distdir)/_build || exit 0; \ - dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ - && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ - && am__cwd=`pwd` \ - && $(am__cd) $(distdir)/_build \ - && ../configure --srcdir=.. --prefix="$$dc_install_base" \ - $(AM_DISTCHECK_CONFIGURE_FLAGS) \ - $(DISTCHECK_CONFIGURE_FLAGS) \ - && $(MAKE) $(AM_MAKEFLAGS) \ - && $(MAKE) $(AM_MAKEFLAGS) dvi \ - && $(MAKE) $(AM_MAKEFLAGS) check \ - && $(MAKE) $(AM_MAKEFLAGS) install \ - && $(MAKE) $(AM_MAKEFLAGS) installcheck \ - && $(MAKE) $(AM_MAKEFLAGS) uninstall \ - && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ - distuninstallcheck \ - && chmod -R a-w "$$dc_install_base" \ - && ({ \ - (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ - distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ - } || { rm -rf "$$dc_destdir"; exit 1; }) \ - && rm -rf "$$dc_destdir" \ - && $(MAKE) $(AM_MAKEFLAGS) dist \ - && rm -rf $(DIST_ARCHIVES) \ - && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ - && cd "$$am__cwd" \ - || exit 1 - $(am__remove_distdir) - @(echo "$(distdir) archives ready for distribution: "; \ - list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ - sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' -distuninstallcheck: - @test -n '$(distuninstallcheck_dir)' || { \ - echo 'ERROR: trying to run $@ with an empty' \ - '$$(distuninstallcheck_dir)' >&2; \ - exit 1; \ - }; \ - $(am__cd) '$(distuninstallcheck_dir)' || { \ - echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ - exit 1; \ - }; \ - test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ - || { echo "ERROR: files left after uninstall:" ; \ - if test -n "$(DESTDIR)"; then \ - echo " (check DESTDIR support)"; \ - fi ; \ - $(distuninstallcheck_listfiles) ; \ - exit 1; } >&2 -distcleancheck: distclean - @if test '$(srcdir)' = . ; then \ - echo "ERROR: distcleancheck can only run from a VPATH build" ; \ - exit 1 ; \ - fi - @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ - || { echo "ERROR: files left in build directory after distclean:" ; \ - $(distcleancheck_listfiles) ; \ - exit 1; } >&2 -check-am: all-am -check: check-recursive -all-am: Makefile $(DATA) -installdirs: installdirs-recursive -installdirs-am: - for dir in "$(DESTDIR)$(compatdir)" "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(pkgdatadir)" "$(DESTDIR)$(profiledir)"; do \ - test -z "$$dir" || $(MKDIR_P) "$$dir"; \ - done -install: install-recursive -install-exec: install-exec-recursive -install-data: install-data-recursive -uninstall: uninstall-recursive - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-recursive -install-strip: - if test -z '$(STRIP)'; then \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - install; \ - else \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ - fi -mostlyclean-generic: - -clean-generic: - -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-recursive - -clean-am: clean-generic mostlyclean-am - -distclean: distclean-recursive - -rm -f $(am__CONFIG_DISTCLEAN_FILES) - -rm -f Makefile -distclean-am: clean-am distclean-generic distclean-tags - -dvi: dvi-recursive - -dvi-am: - -html: html-recursive - -html-am: - -info: info-recursive - -info-am: - -install-data-am: install-compatDATA install-pkgconfigDATA \ - install-pkgdataDATA install-profileDATA - @$(NORMAL_INSTALL) - $(MAKE) $(AM_MAKEFLAGS) install-data-hook -install-dvi: install-dvi-recursive - -install-dvi-am: - -install-exec-am: - -install-html: install-html-recursive - -install-html-am: - -install-info: install-info-recursive - -install-info-am: - -install-man: - -install-pdf: install-pdf-recursive - -install-pdf-am: - -install-ps: install-ps-recursive - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-recursive - -rm -f $(am__CONFIG_DISTCLEAN_FILES) - -rm -rf $(top_srcdir)/autom4te.cache - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-recursive - -mostlyclean-am: mostlyclean-generic - -pdf: pdf-recursive - -pdf-am: - -ps: ps-recursive - -ps-am: - -uninstall-am: uninstall-compatDATA uninstall-pkgconfigDATA \ - uninstall-pkgdataDATA uninstall-profileDATA - -.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ - install-am install-data-am install-strip tags-recursive - -.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ - all all-am am--refresh check check-am clean clean-generic \ - ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \ - dist-lzip dist-lzma dist-shar dist-tarZ dist-xz dist-zip \ - distcheck distclean distclean-generic distclean-tags \ - distcleancheck distdir distuninstallcheck dvi dvi-am html \ - html-am info info-am install install-am install-compatDATA \ - install-data install-data-am install-data-hook install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-info install-info-am install-man \ - install-pdf install-pdf-am install-pkgconfigDATA \ - install-pkgdataDATA install-profileDATA install-ps \ - install-ps-am install-strip installcheck installcheck-am \ - installdirs installdirs-am maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ - pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \ - uninstall-compatDATA uninstall-pkgconfigDATA \ - uninstall-pkgdataDATA uninstall-profileDATA - - -bash_completion.sh: bash_completion.sh.in Makefile - sed -e 's|@pkgdatadir[@]|$(pkgdatadir)|' <$(srcdir)/$@.in >$@ - -install-data-hook: - tmpfile=`mktemp $${TMPDIR:-/tmp}/bash_completion.XXXXXX` && \ - sed -e 's|=/etc/bash_completion\.d|=$(compatdir)|' \ - $(DESTDIR)$(pkgdatadir)/bash_completion > $$tmpfile && \ - cat $$tmpfile > $(DESTDIR)$(pkgdatadir)/bash_completion && \ - rm $$tmpfile - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/README b/README deleted file mode 100644 index 1558f62f..00000000 --- a/README +++ /dev/null @@ -1,411 +0,0 @@ -INSTALLATION ------------- - -The easiest way to install this software is to use a package; it is available -in many operating system distributions. The package's name is usually -bash-completion. Depending on the package, you may still need to source it -from either /etc/bashrc or ~/.bashrc (or any other file sourcing those). You -can do this by simply using: - -# Use bash-completion, if available -[[ $PS1 && -f /usr/share/bash-completion/bash_completion ]] && \ - . /usr/share/bash-completion/bash_completion - -(if you happen to have *only* bash >= 4.1 installed, see further if not) - -If you don't have the package readily available for your distribution, or -you simply don't want to use one, you can install bash completion using the -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. - -The profile.d script provides a configuration file hook that can be -used to prevent loading bash_completion on per user basis when it's -installed system wide. To do this, turn off programmable completion -with "shopt -u progcomp" in $XDG_CONFIG_HOME/bash_completion -(~/.config/bash_completion if $XDG_CONFIG_HOME is not set), and turn -it back on for example in ~/.bashrc if you want to use programmable -completion for other purposes. - -If you're using MacOS X, /etc/bashrc is apparently not sourced at all. -In that case, you can put the bash_completion file in /sw/etc and add -the following code to ~/.bash_profile: - -if [ -f /sw/etc/bash_completion ]; then - . /sw/etc/bash_completion -fi - - -TROUBLESHOOTING ---------------- - -If you find that a given function is producing errors under certain -circumstances when you attempt completion, try running 'set -v' or -'set -x' prior to attempting the completion again. This will produce -useful debugging output that will aid us in fixing the problem if you -are unable to do so yourself. Turn off the trace output by running -either 'set +v' or 'set +x'. - - -KNOWN PROBLEMS --------------- - -I. - -There seems to be some issue with using the bash built-in cd within -Makefiles. When invoked as /bin/sh within Makefiles, bash seems to -have a problem changing directory via the cd command. A work-around -for this is to define SHELL=/bin/bash within your Makefile. This is -believed to be a bug in bash. - -II. - -Many of the completion functions assume GNU versions of the various -text utilities that they call (e.g. grep, sed and awk). Your mileage -may vary. - -III. - -If you are seeing 'unbound variable' warnings from bash when hitting -, this is because you have either 'set -u' or 'set -o nounset' -somewhere in your start-up files. This causes bash to flag the use of -any uninitialised shell variables as an error. - -Whilst we try to avoid references to uninitialised variables in the -code, there seem to be at least some cases where bash issues this -warning even though the variable in question has been initialised. - -One place this appears to occur is within the _muttconffiles() helper -function used by mutt completion, where the function calls itself -recursively. This seems to confuse bash and it issues spurious -warnings if 'nounset' is set. - - -FAQ ---- - -Q. The bash completion code inhibits some commands from completing on - files with extensions that are legitimate in my environment. Do I - have to disable completion for that command in order to complete on - the files that I need to? - -A. No. Use M-/ to (in the words of the man page) attempt file name - completion on the text to the left of the cursor. This will - circumvent any file type restrictions put in place by the bash - completion code. - -Q. How can I insert my own local completions without having to - reinsert them every time you issue a new release? - -A. Put them in ~/.bash_completion, which is parsed at the end of the - main completion script. See also the next question. - -Q. I author/maintain package X and would like to maintain my own - completion code for this package. Where should I put it to be sure - that interactive bash shells will find it and source it? - - Install it in one of the directories pointed to by - bash-completion's pkgconfig file variables. There are two - alternatives: the recommended one is 'completionsdir' (get it with - "pkg-config --variable=completionsdir bash-completion") from which - completions are loaded on demand based on invoked commands' names, - so be sure to name your completion file accordingly, and to include - for example symbolic links in case the file provides completions - for more than one command. The other one which is present for - backwards compatibility reasons is 'compatdir' (get it with - "pkg-config --variable=compatdir bash-completion") from which files - are loaded when bash_completion is loaded. - -Q. I use CVS in combination with passwordless ssh access to my remote - repository. How can I have the cvs command complete on remotely - checked-out files where relevant? - -A. Define $COMP_CVS_REMOTE. Setting this to anything will result in - the behaviour you would like. - -Q. When I'm running a ./configure script and completion returns a list - of long options to me, some of these take a parameter, - e.g. --this-option=DESCRIPTION. - - Running ./configure --help lists these descriptions, but everything - after the '=' is stripped when returning completions, so I don't - know what kind of data is expected as a given option's parameter. - - Is there a way of getting ./configure completion to return the - entire option string, so that I can see what kind of data is - required and then simply delete the descriptive text and add my own - data? - -A. Define $COMP_CONFIGURE_HINTS. Setting this to anything will result - in the behaviour you would like. - -Q. When doing tar completion on a file within a tar file like this: - - tar tzvf foo.tar.gz - - the pathnames contained in the tar file are not displayed - correctly. The slashes are removed and everything looks like it's - in a single directory. Why is this? - -A. It's a choice we had to make. bash's programmable completion is - limited in how it handles the list of possible completions it - returns. - - Because the paths returned from within the tar file are likely not - existing paths on the file system, '-o dirnames' must be passed to - the complete built-in to make it treat them as such. However, then - bash will append a space when completing on directories during - pathname completion to the tar files themselves. - - It's more important to have proper completion of paths to tar files - than it is to have completion for their contents, so this sacrifice - was made and '-o filenames' is used with complete instead. - - If you would rather have correct path completion for tar file - contents, define $COMP_TAR_INTERNAL_PATHS *before* sourcing - bash_completion. - -Q. When completing on a symlink to a directory, bash does not append - the trailing / and I have to hit again. I don't like this. - -A. This has nothing to do with bash_completion. It's the default for - completing symlinks to directories since bash 2.05a, and was added - because sometimes you want to operate on the symlink itself, rather - than what it points to. - - You can get the pre-2.05a behaviour back by putting - 'set mark-symlinked-directories on' in your /etc/inputrc or ~/.inputrc - file. - -Q. Completion goes awry when I try to complete on something that contains - a colon. - -A. This is actually a 'feature' of bash. bash recognises a colon as - starting a new completion token, which is often what you want when - completing something like a PATH variable: - - $ export PATH=/bin:/sbin:/usr - - Without the special treatment of the colon, the above wouldn't work - without programmable completion, so it has long been a feature of - the shell. - - Unfortunately, you don't want the colon to be treated as a special - case when doing something like: - - $ man File::B - - Here, the colons make bash think that it's completing the a new - token that begins with 'B'. - - Unfortunately, there's no way to turn this off. The only thing you - can do is escape the colons with a backslash. - -Q. Why is rpm completion so slow with -q? - -A. Probably because the database is being queried every time and this uses a - lot of memory. - - You can make this faster by pregenerating the list of installed packages on - the system. Make sure you have a readable file called /var/log/rpmpkgs. - It's generated by /etc/cron.daily/rpm on modern Red Hat and Mandrake - Linux systems. - - If you don't have such a cron job, make one: - - #!/bin/sh - - rpm -qa --qf '%{name}-%{version}-%{release}.%{arch}.rpm\n' 2>&1 \ - | sort > /var/log/rpmpkgs - - rpm completion will use this flat text file instead of the RPM database, - unless it detects that the database has changed since the file was created, - in which case it will still use the database to ensure accuracy. - -Q. Can tab completion be made even easier? - -A. The readline(3) library offers a few settings that can make tab - completion easier (or at least different) to use. - - For example, try putting the following in either /etc/inputrc or - ~/.inputrc: - - set show-all-if-ambiguous on - - This will allow single tab completion as opposed to requiring a - double tab. This makes things much more pleasant, in our opinion. - - set visible-stats on - - This will suffix each returned file completion with a character - denoting its type, in a similar way to ls(1) with -F or --classify. - - set page-completions off - - This turns off the use of the internal pager when returning long - completion lists. - -Q. Is bash the be-all-and-end-all of completion as far as shells go? - -A. Absolutely not. zsh has an extremely sophisticated completion system - that offers many features absent from the bash implementation. Its - users often cannot resist pointing this out. More information can - be found at: - - http://www.zsh.org/ - - -CONTRIBUTING ------------- - -Contributions to the bash completion project are more than -welcome. Fixes, clean-ups and improvements of existing code are much -appreciated, as are completion functions for new commands. - -If you wish to contribute code, please bare the following coding -guidelines in mind: - -- Do not use Perl, Ruby, Python etc. to do text processing unless the - command for which you are writing the completion code implies the - presence of one of those languages. - - For example, if you were writing completion code for perldoc(1), the - use of Perl to achieve your goal would be acceptable. irb(1) - completion would similarly make the use of Ruby acceptable. - - Even so, please consider alternatives to these large and slow to - start interpreters. Use lightweight programs such as grep(1), awk(1) - and sed(1). - -- Use the full power of bash >= 4.1. We no longer support earlier bash - versions, so you may as well use all the features of that version of - bash to optimise your code. However, be careful when using features - added since bash 4.1, since not everyone will be able to use them. - - For example, extended globs often enable you to avoid the use of - external programs, which are expensive to fork and execute, so do - make full use of those: - - ?(pattern-list) - match zero or one occurrences of patterns - *(pattern-list) - match zero or more occurrences of patterns - +(pattern-list) - match one or more occurrences of patterns - @(pattern-list) - match exactly one of the given patterns - !(pattern-list) - match anything except one of the given patterns - -- Following on from the last point, be sparing with the use of - external processes whenever you can. Completion functions need to be - fast, so sacrificing some code legibility for speed is acceptable. - - For example, judicious use of sed(1) can save you from having to - call grep(1) and pipe the output to cut(1), which saves a fork(2) - and exec(3). - - Sometimes you don't even need sed(1) or other external programs at - all, though. Use of constructs such as ${parameter#word}, - ${parameter%word} and ${parameter/pattern/string} can provide you a - lot of power without having to leave the shell. - - For example, if $foo contains the path to an executable, ${foo##*/} - will give you the basename of the program, without having to call - basename(1). Similarly, ${foo%/*} will give you the dirname, without - having to call dirname(1). - - As another example, - - bar=$( echo $foo | sed -e 's/bar/baz/g' ) - - can be replaced by: - - bar=${foo//bar/baz} - - These forms of parameter substitutions can also be used on arrays, - which makes them very powerful (if a little slow). - -- Prefer "compgen -W '...' -- $cur" over embedding $cur in external - command arguments (often e.g. sed, grep etc) unless there's a good - reason to embed it. Embedding user input in command lines can - result in syntax errors and other undesired behavior, or messy - quoting requirements when the input contains unusual characters. - Good reasons for embedding include functionality (if the thing - does not sanely work otherwise) or performance (if it makes a big - difference in speed), but all embedding cases should be documented - with rationale in comments in the code. - -- When completing available options, offer only the most descriptive - ones as completion results if there are multiple options that do the - same thing. Usually this means that long options should be preferred - over the corresponding short ones. This way the user is more likely - to find what she's looking for and there's not too much noise to - choose from, and there are less situations where user choice would be - needed in the first place. Note that this concerns only display of - available completions; argument processing/completion for options that - take an argument should be made to work with all known variants for - the functionality at hand. For example if -s, -S, and --something do - the same thing and require an argument, offer only --something as a - completion when completing option names starting with a dash, but do - implement required argument processing for all -s, -S, and --something. - Note that GNU versions of various standard commands tend to have long - options while other userland implementations of the same commands may - not have them, and it would be good to have the completions work for - as many userlands as possible so things aren't always that simple. - -- Do not write to the file-system under any circumstances. This can - create race conditions, is inefficient, violates the principle of - least surprise and lacks robustness. - -- Send small, incremental diffs that do one thing. Don't cram unrelated - changes into a single diff. - -- Generate patches preferably against the git repository, with "git - format-patch origin/master" (assuming the diff was against the - origin/master branch), and send them preferably with "git - send-email". If you don't have git available or can't access the - repository for some reason, generate patches as unified diffs - ('diff -u'). - -- If your code was written for a particular platform, try to make it - portable to other platforms, so that everyone may enjoy it. If your - code works only with the version of a binary on a particular - platform, ensure that it will not be loaded on other platforms that - have a command with the same name. - - In particular, do not use GNU extensions to commands like sed and - awk if you can write your code another way. If you really, REALLY must - use them, do so if there's no other sane way to do what you're doing. - The "Shell and Utilities" volume of the POSIX specification is a good - starting reference for portable use of various utilities, see - http://www.opengroup.org/onlinepubs/9699919799/ - -- Read the existing source code for examples of how to solve - particular problems. Read the bash man page for details of all the - programming tools available to you within the shell. - -- Please test your code thoroughly before sending it to us. We don't - have access to all the commands for which we are sent completion - functions, so we are unable to test them all personally. If your code - is accepted into the distribution, a lot of people will try it out, - so try to do a thorough job of eradicating all the bugs before you - send it to us. - -- File bugs, enhancement requests (preferably with patches attached) at - the project tracker at https://alioth.debian.org/projects/bash-completion/ - Sending them to the developers list usually works too, but bits are more - likely to fall through the cracks that way compared to the tracker. - -- Use printf(1) instead of echo(1) for portability reasons, and be sure to - invoke commands that are often found aliased (such as ls or grep etc) - using the "command" (or "builtin") command as appropriate. - --- -bash-completion developers -bash-completion-devel@lists.alioth.debian.org diff --git a/README.md b/README.md new file mode 100644 index 00000000..71e9aad2 --- /dev/null +++ b/README.md @@ -0,0 +1,335 @@ +# bash-completion + +[![Build Status](https://travis-ci.org/scop/bash-completion.svg?branch=master)](https://travis-ci.org/scop/bash-completion) + +## Installation + +The easiest way to install this software is to use a package; it is +available in many operating system distributions. The package's name +is usually bash-completion. Depending on the package, you may still +need to source it from either `/etc/bashrc` or `~/.bashrc` (or any +other file sourcing those). You can do this by simply using: + +```shell +# Use bash-completion, if available +[[ $PS1 && -f /usr/share/bash-completion/bash_completion ]] && \ + . /usr/share/bash-completion/bash_completion +``` + +(if you happen to have *only* bash >= 4.1 installed, see further if not) + +If you don't have the package readily available for your distribution, or +you simply don't want to use one, you can install bash completion using the +standard commands for GNU autotools packages: + +```shell +autoreconf -i # if not installing from prepared release tarball +./configure +make +make check # optional, requires dejagnu and tcllib +make install # as root +``` + +These commands install 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`. + +The `profile.d` script provides a configuration file hook that can be +used to prevent loading `bash_completion` on per user basis when it's +installed system wide. To do this: + +1. Turn off programmable completion with `shopt -u progcomp` in + `$XDG_CONFIG_HOME/bash_completion` (or `~/.config/bash_completion` + if `$XDG_CONFIG_HOME` is not set) +2. Turn it back on (for example in `~/.bashrc`) if you want to use + programmable completion for other purposes. + +### macOS (OS X) + +If you're using macOS (formerly OS X), `/etc/bashrc` is apparently not sourced at +all. In that case, you can put the `bash_completion` file in `/sw/etc` +and add the following code to `~/.bash_profile`: + +```shell +if [ -f /sw/etc/bash_completion ]; then + . /sw/etc/bash_completion +fi +``` + + +## Troubleshooting + +If you find that a given function is producing errors or does not work +as it should under certain circumstances when you attempt completion, +try running `set -v` or `set -x` prior to attempting the completion +again. This will produce useful debugging output that will aid us in +fixing the problem if you are unable to do so yourself. Turn off the +trace output by running either `set +v` or `set +x`. + +To debug dynamic loading of a completion, tracing needs to be turned +on before the debugged completion is attempted the first time. The +easiest way to do this is to start a new shell session, and to turn +tracing on in it before doing anything else there. + + +## Known problems + +1. There seems to be some issue with using the bash built-in `cd` within + Makefiles. When invoked as `/bin/sh` within `Makefile`s, bash seems + to have a problem changing directory via the `cd` command. A + work-around for this is to define `SHELL=/bin/bash` within your + `Makefile`. This is believed to be a bug in bash. + +2. Many of the completion functions assume GNU versions of the various + text utilities that they call (e.g. `grep`, `sed`, and `awk`). Your + mileage may vary. + +3. If you are seeing 'unbound variable' warnings from bash when + hitting <Tab>, this is because you have either `set -u` + or `set -o nounset` somewhere in your start-up files. This causes bash + to flag the use of any uninitialised shell variables as an error. + + Whilst we try to avoid references to uninitialised variables in the + code, there seem to be at least some cases where bash issues this + warning even though the variable in question has been initialised. + + One place this appears to occur is within the `_muttconffiles()` + helper function used by `mutt` completion, where the function calls + itself recursively. This seems to confuse bash and it issues + spurious warnings if `nounset` is set. + + +## FAQ + +**Q. The bash completion code inhibits some commands from completing on + files with extensions that are legitimate in my environment. Do I + have to disable completion for that command in order to complete on + the files that I need to?** + +A. No. Use `M-/` to (in the words of the bash man page) attempt file + name completion on the text to the left of the cursor. This will + circumvent any file type restrictions put in place by the bash + completion code. + +**Q. How can I insert my own local completions without having to + reinsert them every time you issue a new release?** + +A. Put them in `~/.bash_completion`, which is parsed at the end of the + main completion script. See also the next question. + +**Q. I author/maintain package X and would like to maintain my own + completion code for this package. Where should I put it to be sure + that interactive bash shells will find it and source it?** + +A. Install it in one of the directories pointed to by + bash-completion's `pkgconfig` file variables. There are two + alternatives: + + - The recommended directory is `completionsdir`, which you can get with + `pkg-config --variable=completionsdir bash-completion`. From this + directory, completions are loaded on-demand based on invoked commands' names, + so be sure to name your completion file accordingly, and to include + (for example) symbolic links in case the file provides completions + for more than one command. + - The other directory (which only present for backwards compatibility) + is `compatdir` (get it with + `pkg-config --variable=compatdir bash-completion`) from which files + are loaded when `bash_completion` is loaded. + + For packages using GNU autotools the installation can be handled + for example like this in `configure.ac`: + + ``` + PKG_CHECK_VAR(bashcompdir, [bash-completion], [completionsdir], , + bashcompdir="${sysconfdir}/bash_completion.d") + AC_SUBST(bashcompdir) + ``` + + ...accompanied by this in `Makefile.am`: + + ```makefile + bashcompdir = @bashcompdir@ + dist_bashcomp_DATA = # completion files go here + ``` + + For cmake we ship the `bash-completion-config.cmake` and + `bash-completion-config-version.cmake` files. Example usage: + + ``` + find_package(bash-completion) + if(BASH_COMPLETION_FOUND) + message(STATUS + "Using bash completion dir ${BASH_COMPLETION_COMPLETIONSDIR}") + else() + set (BASH_COMPLETION_COMPLETIONSDIR "/etc/bash_completion.d") + message (STATUS + "Using fallback bash completion dir ${BASH_COMPLETION_COMPLETIONSDIR}") + endif() + + install(FILES your-completion-file DESTINATION + ${BASH_COMPLETION_COMPLETIONSDIR}) + ``` + +**Q. I use CVS in combination with passwordless SSH access to my remote + repository. How can I have the `cvs` command complete on remotely + checked-out files where relevant?** + +A. Define `$COMP_CVS_REMOTE`. Setting this to anything will result in + the behaviour you would like. + +**Q. When I'm running a `./configure` script and completion returns a list + of long options to me, some of these take a parameter, + e.g. `--this-option=DESCRIPTION`.** + + **Running `./configure --help` lists these descriptions, but + everything after the `=` is stripped when returning completions, so + I don't know what kind of data is expected as a given option's + parameter.** + + **Is there a way of getting `./configure` completion to return the + entire option string, so that I can see what kind of data is + required and then simply delete the descriptive text and add my own + data?** + +A. Define `$COMP_CONFIGURE_HINTS`. Setting this to anything will + result in the behaviour you would like. + +**Q. When doing tar completion on a file within a tar file like this:** + + ``` + tar tzvf foo.tar.gz + ``` + + **the pathnames contained in the tar file are not displayed + correctly. The slashes are removed, and everything looks like it's + in a single directory. Why is this?** + +A. It's a choice we had to make. bash's programmable completion is + limited in how it handles the list of possible completions it + returns. + + Because the paths returned from within the tar file are likely not + existing paths on the file system, `-o dirnames` must be passed to + the `complete` built-in to make it treat them as such. However, + then bash will append a space when completing on directories during + pathname completion to the tar files themselves. + + It's more important to have proper completion of paths to tar files + than it is to have completion for their contents, so this sacrifice + was made and `-o filenames` is used with complete instead. + + If you would rather have correct path completion for tar file + contents, define `$COMP_TAR_INTERNAL_PATHS` *before* sourcing + `bash_completion`. + +**Q. When completing on a symlink to a directory, bash does not append + the trailing `/` and I have to hit <Tab> again. + I don't like this.** + +A. This has nothing to do with `bash_completion`. It's the default for + completing symlinks to directories since bash 2.05a, and was added + because sometimes you want to operate on the symlink itself, rather + than what it points to. + + You can get the pre-2.05a behaviour back by putting `set + mark-symlinked-directories on` in your `/etc/inputrc` or + `~/.inputrc` file. + +**Q. Completion goes awry when I try to complete on something that contains + a colon.** + +A. This is actually a 'feature' of bash. bash recognises a colon as + starting a new completion token, which is often what you want when + completing something like a `PATH` variable: + + ```shell + export PATH=/bin:/sbin:/usr + ``` + + Without the special treatment of the colon, the above wouldn't work + without programmable completion, so it has long been a feature of + the shell. + + Unfortunately, you don't want the colon to be treated as a special + case when doing something like: + + ```shell + man File::B + ``` + + Here, the colons make bash think that it's completing a new token + that begins with 'B'. + + Unfortunately, there's no way to turn this off. The only thing you + can do is escape the colons with a backslash. + +**Q. Why is `rpm` completion so slow with `-q`?** + +A. Probably because the database is being queried every time and this uses a + lot of memory. + + You can make this faster by pregenerating the list of installed + packages on the system. Make sure you have a readable file called + `/var/log/rpmpkgs`. It's generated by `/etc/cron.daily/rpm` on + some Red Hat and Mandrake and derivative Linux systems. + + If you don't have such a cron job, make one: + + ```shell + #!/bin/sh + + rpm -qa --qf '%{name}-%{version}-%{release}.%{arch}.rpm\n' 2>&1 \ + | sort > /var/log/rpmpkgs + ``` + + rpm completion will use this flat text file instead of the RPM database, + unless it detects that the database has changed since the file was created, + in which case it will still use the database to ensure accuracy. + +**Q. bash-completion interferes with my `command_not_found_handler` function!** + +A. If your `command_not_found_handler` function is not intended to + address (possibly missing) commands invoked during bash + programmable completion functions, you can account for this + by, for example, testing if the `$COMP_`\* variables are set and + taking appropriate bypass or other action. + +**Q. Can tab completion be made even easier?** + +A. The `readline(3)` library offers a few settings that can make tab + completion easier (or at least different) to use. + + For example, try putting the following in either `/etc/inputrc` or + `~/.inputrc`: + + ``` + set show-all-if-ambiguous on + ``` + + This will allow single tab completion as opposed to requiring a + double tab. This makes things much more pleasant, in our opinion. + + ``` + set visible-stats on + ``` + + This will suffix each returned file completion with a character + denoting its type, in a similar way to `ls(1)` with `-F` or `--classify`. + + ``` + set page-completions off + ``` + + This turns off the use of the internal pager when returning long + completion lists. + +**Q. Is bash the be-all-and-end-all of completion as far as shells go?** + +A. Absolutely not. zsh has an extremely sophisticated completion system + that offers many features absent from the bash implementation. Its + users often cannot resist pointing this out. More information can + be found at: http://www.zsh.org/ diff --git a/aclocal.m4 b/aclocal.m4 deleted file mode 100644 index 279699f2..00000000 --- a/aclocal.m4 +++ /dev/null @@ -1,617 +0,0 @@ -# generated automatically by aclocal 1.11.6 -*- Autoconf -*- - -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -# 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, -# Inc. -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -m4_ifndef([AC_AUTOCONF_VERSION], - [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl -m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, -[m4_warning([this file was generated for autoconf 2.69. -You have another version of autoconf. It may work, but is not guaranteed to. -If you have problems, you may need to regenerate the build system entirely. -To do so, use the procedure documented by the package, typically `autoreconf'.])]) - -# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 Free Software -# Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 1 - -# AM_AUTOMAKE_VERSION(VERSION) -# ---------------------------- -# Automake X.Y traces this macro to ensure aclocal.m4 has been -# generated from the m4 files accompanying Automake X.Y. -# (This private macro should not be called outside this file.) -AC_DEFUN([AM_AUTOMAKE_VERSION], -[am__api_version='1.11' -dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to -dnl require some minimum version. Point them to the right macro. -m4_if([$1], [1.11.6], [], - [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl -]) - -# _AM_AUTOCONF_VERSION(VERSION) -# ----------------------------- -# aclocal traces this macro to find the Autoconf version. -# This is a private macro too. Using m4_define simplifies -# the logic in aclocal, which can simply ignore this definition. -m4_define([_AM_AUTOCONF_VERSION], []) - -# AM_SET_CURRENT_AUTOMAKE_VERSION -# ------------------------------- -# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. -# This function is AC_REQUIREd by AM_INIT_AUTOMAKE. -AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], -[AM_AUTOMAKE_VERSION([1.11.6])dnl -m4_ifndef([AC_AUTOCONF_VERSION], - [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl -_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) - -# AM_AUX_DIR_EXPAND -*- Autoconf -*- - -# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 1 - -# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets -# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to -# `$srcdir', `$srcdir/..', or `$srcdir/../..'. -# -# Of course, Automake must honor this variable whenever it calls a -# tool from the auxiliary directory. The problem is that $srcdir (and -# therefore $ac_aux_dir as well) can be either absolute or relative, -# depending on how configure is run. This is pretty annoying, since -# it makes $ac_aux_dir quite unusable in subdirectories: in the top -# source directory, any form will work fine, but in subdirectories a -# relative path needs to be adjusted first. -# -# $ac_aux_dir/missing -# fails when called from a subdirectory if $ac_aux_dir is relative -# $top_srcdir/$ac_aux_dir/missing -# fails if $ac_aux_dir is absolute, -# fails when called from a subdirectory in a VPATH build with -# a relative $ac_aux_dir -# -# The reason of the latter failure is that $top_srcdir and $ac_aux_dir -# are both prefixed by $srcdir. In an in-source build this is usually -# harmless because $srcdir is `.', but things will broke when you -# start a VPATH build or use an absolute $srcdir. -# -# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, -# iff we strip the leading $srcdir from $ac_aux_dir. That would be: -# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` -# and then we would define $MISSING as -# MISSING="\${SHELL} $am_aux_dir/missing" -# This will work as long as MISSING is not called from configure, because -# unfortunately $(top_srcdir) has no meaning in configure. -# However there are other variables, like CC, which are often used in -# configure, and could therefore not use this "fixed" $ac_aux_dir. -# -# Another solution, used here, is to always expand $ac_aux_dir to an -# absolute PATH. The drawback is that using absolute paths prevent a -# configured tree to be moved without reconfiguration. - -AC_DEFUN([AM_AUX_DIR_EXPAND], -[dnl Rely on autoconf to set up CDPATH properly. -AC_PREREQ([2.50])dnl -# expand $ac_aux_dir to an absolute path -am_aux_dir=`cd $ac_aux_dir && pwd` -]) - -# Do all the work for Automake. -*- Autoconf -*- - -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -# 2005, 2006, 2008, 2009 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 16 - -# This macro actually does too much. Some checks are only needed if -# your package does certain things. But this isn't really a big deal. - -# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) -# AM_INIT_AUTOMAKE([OPTIONS]) -# ----------------------------------------------- -# The call with PACKAGE and VERSION arguments is the old style -# call (pre autoconf-2.50), which is being phased out. PACKAGE -# and VERSION should now be passed to AC_INIT and removed from -# the call to AM_INIT_AUTOMAKE. -# We support both call styles for the transition. After -# the next Automake release, Autoconf can make the AC_INIT -# arguments mandatory, and then we can depend on a new Autoconf -# release and drop the old call support. -AC_DEFUN([AM_INIT_AUTOMAKE], -[AC_PREREQ([2.62])dnl -dnl Autoconf wants to disallow AM_ names. We explicitly allow -dnl the ones we care about. -m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl -AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl -AC_REQUIRE([AC_PROG_INSTALL])dnl -if test "`cd $srcdir && pwd`" != "`pwd`"; then - # Use -I$(srcdir) only when $(srcdir) != ., so that make's output - # is not polluted with repeated "-I." - AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl - # test to see if srcdir already configured - if test -f $srcdir/config.status; then - AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) - fi -fi - -# test whether we have cygpath -if test -z "$CYGPATH_W"; then - if (cygpath --version) >/dev/null 2>/dev/null; then - CYGPATH_W='cygpath -w' - else - CYGPATH_W=echo - fi -fi -AC_SUBST([CYGPATH_W]) - -# Define the identity of the package. -dnl Distinguish between old-style and new-style calls. -m4_ifval([$2], -[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl - AC_SUBST([PACKAGE], [$1])dnl - AC_SUBST([VERSION], [$2])], -[_AM_SET_OPTIONS([$1])dnl -dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. -m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, - [m4_fatal([AC_INIT should be called with package and version arguments])])dnl - AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl - AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl - -_AM_IF_OPTION([no-define],, -[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) - AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl - -# Some tools Automake needs. -AC_REQUIRE([AM_SANITY_CHECK])dnl -AC_REQUIRE([AC_ARG_PROGRAM])dnl -AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) -AM_MISSING_PROG(AUTOCONF, autoconf) -AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) -AM_MISSING_PROG(AUTOHEADER, autoheader) -AM_MISSING_PROG(MAKEINFO, makeinfo) -AC_REQUIRE([AM_PROG_INSTALL_SH])dnl -AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl -AC_REQUIRE([AM_PROG_MKDIR_P])dnl -# We need awk for the "check" target. The system "awk" is bad on -# some platforms. -AC_REQUIRE([AC_PROG_AWK])dnl -AC_REQUIRE([AC_PROG_MAKE_SET])dnl -AC_REQUIRE([AM_SET_LEADING_DOT])dnl -_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], - [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], - [_AM_PROG_TAR([v7])])]) -_AM_IF_OPTION([no-dependencies],, -[AC_PROVIDE_IFELSE([AC_PROG_CC], - [_AM_DEPENDENCIES(CC)], - [define([AC_PROG_CC], - defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl -AC_PROVIDE_IFELSE([AC_PROG_CXX], - [_AM_DEPENDENCIES(CXX)], - [define([AC_PROG_CXX], - defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl -AC_PROVIDE_IFELSE([AC_PROG_OBJC], - [_AM_DEPENDENCIES(OBJC)], - [define([AC_PROG_OBJC], - defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl -]) -_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl -dnl The `parallel-tests' driver may need to know about EXEEXT, so add the -dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro -dnl is hooked onto _AC_COMPILER_EXEEXT early, see below. -AC_CONFIG_COMMANDS_PRE(dnl -[m4_provide_if([_AM_COMPILER_EXEEXT], - [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl -]) - -dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion. Do not -dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further -dnl mangled by Autoconf and run in a shell conditional statement. -m4_define([_AC_COMPILER_EXEEXT], -m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) - - -# When config.status generates a header, we must update the stamp-h file. -# This file resides in the same directory as the config header -# that is generated. The stamp files are numbered to have different names. - -# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the -# loop where config.status creates the headers, so we can generate -# our stamp files there. -AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], -[# Compute $1's index in $config_headers. -_am_arg=$1 -_am_stamp_count=1 -for _am_header in $config_headers :; do - case $_am_header in - $_am_arg | $_am_arg:* ) - break ;; - * ) - _am_stamp_count=`expr $_am_stamp_count + 1` ;; - esac -done -echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) - -# Copyright (C) 2001, 2003, 2005, 2008, 2011 Free Software Foundation, -# Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 1 - -# AM_PROG_INSTALL_SH -# ------------------ -# Define $install_sh. -AC_DEFUN([AM_PROG_INSTALL_SH], -[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl -if test x"${install_sh}" != xset; then - case $am_aux_dir in - *\ * | *\ *) - install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; - *) - install_sh="\${SHELL} $am_aux_dir/install-sh" - esac -fi -AC_SUBST(install_sh)]) - -# Copyright (C) 2003, 2005 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 2 - -# Check whether the underlying file-system supports filenames -# with a leading dot. For instance MS-DOS doesn't. -AC_DEFUN([AM_SET_LEADING_DOT], -[rm -rf .tst 2>/dev/null -mkdir .tst 2>/dev/null -if test -d .tst; then - am__leading_dot=. -else - am__leading_dot=_ -fi -rmdir .tst 2>/dev/null -AC_SUBST([am__leading_dot])]) - -# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- - -# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008 -# Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 6 - -# AM_MISSING_PROG(NAME, PROGRAM) -# ------------------------------ -AC_DEFUN([AM_MISSING_PROG], -[AC_REQUIRE([AM_MISSING_HAS_RUN]) -$1=${$1-"${am_missing_run}$2"} -AC_SUBST($1)]) - - -# AM_MISSING_HAS_RUN -# ------------------ -# Define MISSING if not defined so far and test if it supports --run. -# If it does, set am_missing_run to use it, otherwise, to nothing. -AC_DEFUN([AM_MISSING_HAS_RUN], -[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl -AC_REQUIRE_AUX_FILE([missing])dnl -if test x"${MISSING+set}" != xset; then - case $am_aux_dir in - *\ * | *\ *) - MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; - *) - MISSING="\${SHELL} $am_aux_dir/missing" ;; - esac -fi -# Use eval to expand $SHELL -if eval "$MISSING --run true"; then - am_missing_run="$MISSING --run " -else - am_missing_run= - AC_MSG_WARN([`missing' script is too old or missing]) -fi -]) - -# Copyright (C) 2003, 2004, 2005, 2006, 2011 Free Software Foundation, -# Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 1 - -# AM_PROG_MKDIR_P -# --------------- -# Check for `mkdir -p'. -AC_DEFUN([AM_PROG_MKDIR_P], -[AC_PREREQ([2.60])dnl -AC_REQUIRE([AC_PROG_MKDIR_P])dnl -dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, -dnl while keeping a definition of mkdir_p for backward compatibility. -dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. -dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of -dnl Makefile.ins that do not define MKDIR_P, so we do our own -dnl adjustment using top_builddir (which is defined more often than -dnl MKDIR_P). -AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl -case $mkdir_p in - [[\\/$]]* | ?:[[\\/]]*) ;; - */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; -esac -]) - -# Helper functions for option handling. -*- Autoconf -*- - -# Copyright (C) 2001, 2002, 2003, 2005, 2008, 2010 Free Software -# Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 5 - -# _AM_MANGLE_OPTION(NAME) -# ----------------------- -AC_DEFUN([_AM_MANGLE_OPTION], -[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) - -# _AM_SET_OPTION(NAME) -# -------------------- -# Set option NAME. Presently that only means defining a flag for this option. -AC_DEFUN([_AM_SET_OPTION], -[m4_define(_AM_MANGLE_OPTION([$1]), 1)]) - -# _AM_SET_OPTIONS(OPTIONS) -# ------------------------ -# OPTIONS is a space-separated list of Automake options. -AC_DEFUN([_AM_SET_OPTIONS], -[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) - -# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) -# ------------------------------------------- -# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. -AC_DEFUN([_AM_IF_OPTION], -[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) - -# Check to make sure that the build environment is sane. -*- Autoconf -*- - -# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008 -# Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 5 - -# AM_SANITY_CHECK -# --------------- -AC_DEFUN([AM_SANITY_CHECK], -[AC_MSG_CHECKING([whether build environment is sane]) -# Just in case -sleep 1 -echo timestamp > conftest.file -# Reject unsafe characters in $srcdir or the absolute working directory -# name. Accept space and tab only in the latter. -am_lf=' -' -case `pwd` in - *[[\\\"\#\$\&\'\`$am_lf]]*) - AC_MSG_ERROR([unsafe absolute working directory name]);; -esac -case $srcdir in - *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) - AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);; -esac - -# Do `set' in a subshell so we don't clobber the current shell's -# arguments. Must try -L first in case configure is actually a -# symlink; some systems play weird games with the mod time of symlinks -# (eg FreeBSD returns the mod time of the symlink's containing -# directory). -if ( - set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` - if test "$[*]" = "X"; then - # -L didn't work. - set X `ls -t "$srcdir/configure" conftest.file` - fi - rm -f conftest.file - if test "$[*]" != "X $srcdir/configure conftest.file" \ - && test "$[*]" != "X conftest.file $srcdir/configure"; then - - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken -alias in your environment]) - fi - - test "$[2]" = conftest.file - ) -then - # Ok. - : -else - AC_MSG_ERROR([newly created file is older than distributed files! -Check your system clock]) -fi -AC_MSG_RESULT(yes)]) - -# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 1 - -# AM_PROG_INSTALL_STRIP -# --------------------- -# One issue with vendor `install' (even GNU) is that you can't -# specify the program used to strip binaries. This is especially -# annoying in cross-compiling environments, where the build's strip -# is unlikely to handle the host's binaries. -# Fortunately install-sh will honor a STRIPPROG variable, so we -# always use install-sh in `make install-strip', and initialize -# STRIPPROG with the value of the STRIP variable (set by the user). -AC_DEFUN([AM_PROG_INSTALL_STRIP], -[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl -# Installed binaries are usually stripped using `strip' when the user -# run `make install-strip'. However `strip' might not be the right -# tool to use in cross-compilation environments, therefore Automake -# will honor the `STRIP' environment variable to overrule this program. -dnl Don't test for $cross_compiling = yes, because it might be `maybe'. -if test "$cross_compiling" != no; then - AC_CHECK_TOOL([STRIP], [strip], :) -fi -INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" -AC_SUBST([INSTALL_STRIP_PROGRAM])]) - -# Copyright (C) 2006, 2008, 2010 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 3 - -# _AM_SUBST_NOTMAKE(VARIABLE) -# --------------------------- -# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. -# This macro is traced by Automake. -AC_DEFUN([_AM_SUBST_NOTMAKE]) - -# AM_SUBST_NOTMAKE(VARIABLE) -# -------------------------- -# Public sister of _AM_SUBST_NOTMAKE. -AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) - -# Check how to create a tarball. -*- Autoconf -*- - -# Copyright (C) 2004, 2005, 2012 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 2 - -# _AM_PROG_TAR(FORMAT) -# -------------------- -# Check how to create a tarball in format FORMAT. -# FORMAT should be one of `v7', `ustar', or `pax'. -# -# Substitute a variable $(am__tar) that is a command -# writing to stdout a FORMAT-tarball containing the directory -# $tardir. -# tardir=directory && $(am__tar) > result.tar -# -# Substitute a variable $(am__untar) that extract such -# a tarball read from stdin. -# $(am__untar) < result.tar -AC_DEFUN([_AM_PROG_TAR], -[# Always define AMTAR for backward compatibility. Yes, it's still used -# in the wild :-( We should find a proper way to deprecate it ... -AC_SUBST([AMTAR], ['$${TAR-tar}']) -m4_if([$1], [v7], - [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], - [m4_case([$1], [ustar],, [pax],, - [m4_fatal([Unknown tar format])]) -AC_MSG_CHECKING([how to create a $1 tar archive]) -# Loop over all known methods to create a tar archive until one works. -_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' -_am_tools=${am_cv_prog_tar_$1-$_am_tools} -# Do not fold the above two line into one, because Tru64 sh and -# Solaris sh will not grok spaces in the rhs of `-'. -for _am_tool in $_am_tools -do - case $_am_tool in - gnutar) - for _am_tar in tar gnutar gtar; - do - AM_RUN_LOG([$_am_tar --version]) && break - done - am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' - am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' - am__untar="$_am_tar -xf -" - ;; - plaintar) - # Must skip GNU tar: if it does not support --format= it doesn't create - # ustar tarball either. - (tar --version) >/dev/null 2>&1 && continue - am__tar='tar chf - "$$tardir"' - am__tar_='tar chf - "$tardir"' - am__untar='tar xf -' - ;; - pax) - am__tar='pax -L -x $1 -w "$$tardir"' - am__tar_='pax -L -x $1 -w "$tardir"' - am__untar='pax -r' - ;; - cpio) - am__tar='find "$$tardir" -print | cpio -o -H $1 -L' - am__tar_='find "$tardir" -print | cpio -o -H $1 -L' - am__untar='cpio -i -H $1 -d' - ;; - none) - am__tar=false - am__tar_=false - am__untar=false - ;; - esac - - # If the value was cached, stop now. We just wanted to have am__tar - # and am__untar set. - test -n "${am_cv_prog_tar_$1}" && break - - # tar/untar a dummy directory, and stop if the command works - rm -rf conftest.dir - mkdir conftest.dir - echo GrepMe > conftest.dir/file - AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) - rm -rf conftest.dir - if test -s conftest.tar; then - AM_RUN_LOG([$am__untar /dev/null 2>&1 && break - fi -done -rm -rf conftest.dir - -AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) -AC_MSG_RESULT([$am_cv_prog_tar_$1])]) -AC_SUBST([am__tar]) -AC_SUBST([am__untar]) -]) # _AM_PROG_TAR - diff --git a/bash-completion-config-version.cmake.in b/bash-completion-config-version.cmake.in new file mode 100644 index 00000000..265e0756 --- /dev/null +++ b/bash-completion-config-version.cmake.in @@ -0,0 +1,7 @@ +set (PACKAGE_VERSION "@VERSION@") +if (NOT ${PACKAGE_FIND_VERSION} VERSION_GREATER ${PACKAGE_VERSION}) + set (PACKAGE_VERSION_COMPATIBLE 1) + if (${PACKAGE_FIND_VERSION} VERSION_EQUAL ${PACKAGE_VERSION}) + set (PACKAGE_VERSION_EXACT 1) + endif () +endif () diff --git a/bash-completion-config.cmake.in b/bash-completion-config.cmake.in new file mode 100644 index 00000000..ccc6e052 --- /dev/null +++ b/bash-completion-config.cmake.in @@ -0,0 +1,11 @@ +# config file for bash-completion +# https://github.com/scop/bash-completion + +set (BASH_COMPLETION_VERSION "@VERSION@") + +set (BASH_COMPLETION_PREFIX "@prefix@") +set (BASH_COMPLETION_COMPATDIR "@compatdir@") +set (BASH_COMPLETION_COMPLETIONSDIR "@datarootdir@/@PACKAGE@/completions") +set (BASH_COMPLETION_HELPERSDIR "@datarootdir@/@PACKAGE@/helpers") + +set (BASH_COMPLETION_FOUND "TRUE") diff --git a/bash-completion.pc.in b/bash-completion.pc.in index c73cd39e..bde217db 100644 --- a/bash-completion.pc.in +++ b/bash-completion.pc.in @@ -5,5 +5,5 @@ helpersdir=@datarootdir@/@PACKAGE@/helpers Name: bash-completion Description: programmable completion for the bash shell -URL: http://bash-completion.alioth.debian.org/ +URL: https://github.com/scop/bash-completion Version: @VERSION@ diff --git a/bash_completion b/bash_completion index 6d3ba762..d16b10a5 100644 --- a/bash_completion +++ b/bash_completion @@ -3,8 +3,7 @@ # bash_completion - programmable completion functions for bash 4.1+ # # Copyright © 2006-2008, Ian Macdonald -# © 2009-2013, Bash Completion Maintainers -# +# © 2009-2017, Bash Completion Maintainers # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -22,9 +21,9 @@ # # The latest version of this software can be obtained here: # -# http://bash-completion.alioth.debian.org/ -# -# RELEASE: 2.1 +# https://github.com/scop/bash-completion + +BASH_COMPLETION_VERSINFO=(2 7) if [[ $- == *v* ]]; then BASH_COMPLETION_ORIGINAL_V_VALUE="-v" @@ -38,11 +37,6 @@ else set +v fi -# Set the following to the location of the backwards compat completion dir. -# -: ${BASH_COMPLETION_COMPAT_DIR:=/etc/bash_completion.d} -readonly BASH_COMPLETION_COMPAT_DIR - # Blacklisted completions, causing problems with our code. # _blacklist_glob='@(acroread.sh)' @@ -53,13 +47,10 @@ shopt -s extglob progcomp # A lot of the following one-liners were taken directly from the # completion examples provided with the bash 2.04 source distribution -# Make directory commands see only directories -complete -d pushd - # start of section containing compspecs that can be handled within bash # user commands see only users -complete -u write chfn groups slay w sux runuser +complete -u groups slay w sux # bg completes with stopped jobs complete -A stopped -P '"%' -S '"' bg @@ -82,9 +73,6 @@ complete -A helptopic help # unalias completes with aliases complete -a unalias -# bind completes with readline bindings (make this more intelligent) -complete -A binding bind - # type and which complete on commands complete -c command type which @@ -136,7 +124,7 @@ have() # _rl_enabled() { - [[ "$( bind -v )" = *$1+([[:space:]])on* ]] + [[ "$( bind -v )" == *$1+([[:space:]])on* ]] } # This function shell-quotes the argument @@ -246,7 +234,7 @@ __reassemble_comp_words_by_ref() fi # Default to cword unchanged - eval $3=$COMP_CWORD + printf -v "$3" %s "$COMP_CWORD" # Are characters excluded which were former included? if [[ $exclude ]]; then # Yes, list of word completion separators has shrunk; @@ -261,33 +249,35 @@ __reassemble_comp_words_by_ref() # Is word separator not preceded by whitespace in original line # and are we not going to append to word 0 (the command # itself), then append to current word. - [[ $line != [$' \t']* ]] && (( j >= 2 )) && ((j--)) + [[ $line != [[:blank:]]* ]] && (( j >= 2 )) && ((j--)) # Append word separator to current or new word ref="$2[$j]" - eval $2[$j]=\${!ref}\${COMP_WORDS[i]} + printf -v "$ref" %s "${!ref}${COMP_WORDS[i]}" # Indicate new cword - [[ $i == $COMP_CWORD ]] && eval $3=$j + [[ $i == $COMP_CWORD ]] && printf -v "$3" %s "$j" # Remove optional whitespace + word separator from line copy line=${line#*"${COMP_WORDS[$i]}"} # Start new word if word separator in original line is # followed by whitespace. - [[ $line == [$' \t']* ]] && ((j++)) + [[ $line == [[:blank:]]* ]] && ((j++)) # Indicate next word if available, else end *both* while and # for loop (( $i < ${#COMP_WORDS[@]} - 1)) && ((i++)) || break 2 done # Append word to current word ref="$2[$j]" - eval $2[$j]=\${!ref}\${COMP_WORDS[i]} + printf -v "$ref" %s "${!ref}${COMP_WORDS[i]}" # Remove optional whitespace + word from line copy line=${line#*"${COMP_WORDS[i]}"} # Indicate new cword - [[ $i == $COMP_CWORD ]] && eval $3=$j + [[ $i == $COMP_CWORD ]] && printf -v "$3" %s "$j" done - [[ $i == $COMP_CWORD ]] && eval $3=$j + [[ $i == $COMP_CWORD ]] && printf -v "$3" %s "$j" else # No, list of word completions separators hasn't changed; - eval $2=\( \"\${COMP_WORDS[@]}\" \) + for i in ${!COMP_WORDS[@]}; do + printf -v "$2[i]" %s "${COMP_WORDS[i]}" + done fi } # __reassemble_comp_words_by_ref() @@ -318,8 +308,8 @@ __get_cword_at_cursor_by_ref() ]]; do # Strip first character cur="${cur:1}" - # Decrease cursor position - ((index--)) + # Decrease cursor position, staying >= 0 + [[ $index -gt 0 ]] && ((index--)) done # Does found word match cword? @@ -448,8 +438,8 @@ _get_cword() ]]; do # Strip first character cur="${cur:1}" - # Decrease cursor position - ((index--)) + # Decrease cursor position, staying >= 0 + [[ $index -gt 0 ]] && ((index--)) done # Does found word matches cword? @@ -558,37 +548,37 @@ _quote_readline_by_ref() # _filedir() { - local i IFS=$'\n' xspec + local IFS=$'\n' - _tilde "$cur" || return 0 + _tilde "$cur" || return local -a toks - local quoted x tmp + local x tmp - _quote_readline_by_ref "$cur" quoted - x=$( compgen -d -- "$quoted" ) && + x=$( compgen -d -- "$cur" ) && while read -r tmp; do toks+=( "$tmp" ) done <<< "$x" if [[ "$1" != -d ]]; then + local quoted + _quote_readline_by_ref "$cur" quoted + # Munge xspec to contain uppercase version too # http://thread.gmane.org/gmane.comp.shells.bash.bugs/15294/focus=15306 - xspec=${1:+"!*.@($1|${1^^})"} + local xspec=${1:+"!*.@($1|${1^^})"} x=$( compgen -f -X "$xspec" -- $quoted ) && while read -r tmp; do toks+=( "$tmp" ) done <<< "$x" - fi - - # If the filter failed to produce anything, try without it if configured to - [[ -n ${COMP_FILEDIR_FALLBACK:-} && \ - -n "$1" && "$1" != -d && ${#toks[@]} -lt 1 ]] && \ - x=$( compgen -f -- $quoted ) && - while read -r tmp; do - toks+=( "$tmp" ) - done <<< "$x" + # Try without filter if it failed to produce anything and configured to + [[ -n ${COMP_FILEDIR_FALLBACK:-} && -n "$1" && ${#toks[@]} -lt 1 ]] && \ + x=$( compgen -f -- $quoted ) && + while read -r tmp; do + toks+=( "$tmp" ) + done <<< "$x" + fi if [[ ${#toks[@]} -ne 0 ]]; then # 2>/dev/null for direct invocation, e.g. in the _filedir unit test @@ -622,11 +612,59 @@ _split_longopt() # False (> 0) if not. _variables() { - if [[ $cur =~ ^(\$\{?)([A-Za-z0-9_]*)$ ]]; then - [[ $cur == *{* ]] && local suffix=} || local suffix= - COMPREPLY+=( $( compgen -P ${BASH_REMATCH[1]} -S "$suffix" -v -- \ - "${BASH_REMATCH[2]}" ) ) + if [[ $cur =~ ^(\$(\{[!#]?)?)([A-Za-z0-9_]*)$ ]]; then + # Completing $var / ${var / ${!var / ${#var + if [[ $cur == \${* ]]; then + local arrs vars + vars=( $( compgen -A variable -P ${BASH_REMATCH[1]} -S '}' -- ${BASH_REMATCH[3]} ) ) && \ + arrs=( $( compgen -A arrayvar -P ${BASH_REMATCH[1]} -S '[' -- ${BASH_REMATCH[3]} ) ) + if [[ ${#vars[@]} -eq 1 && $arrs ]]; then + # Complete ${arr with ${array[ if there is only one match, and that match is an array variable + compopt -o nospace + COMPREPLY+=( ${arrs[*]} ) + else + # Complete ${var with ${variable} + COMPREPLY+=( ${vars[*]} ) + fi + else + # Complete $var with $variable + COMPREPLY+=( $( compgen -A variable -P '$' -- "${BASH_REMATCH[3]}" ) ) + fi + return 0 + elif [[ $cur =~ ^(\$\{[#!]?)([A-Za-z0-9_]*)\[([^]]*)$ ]]; then + # Complete ${array[i with ${array[idx]} + local IFS=$'\n' + COMPREPLY+=( $( compgen -W '$(printf %s\\n "${!'${BASH_REMATCH[2]}'[@]}")' \ + -P "${BASH_REMATCH[1]}${BASH_REMATCH[2]}[" -S ']}' -- "${BASH_REMATCH[3]}" ) ) + # Complete ${arr[@ and ${arr[* + if [[ ${BASH_REMATCH[3]} == [@*] ]]; then + COMPREPLY+=( "${BASH_REMATCH[1]}${BASH_REMATCH[2]}[${BASH_REMATCH[3]}]}" ) + fi + __ltrim_colon_completions "$cur" # array indexes may have colons return 0 + elif [[ $cur =~ ^\$\{[#!]?[A-Za-z0-9_]*\[.*\]$ ]]; then + # Complete ${array[idx] with ${array[idx]} + COMPREPLY+=( "$cur}" ) + __ltrim_colon_completions "$cur" + return 0 + else + case $prev in + TZ) + cur=/usr/share/zoneinfo/$cur + _filedir + for i in ${!COMPREPLY[@]}; do + if [[ ${COMPREPLY[i]} == *.tab ]]; then + unset 'COMPREPLY[i]' + continue + elif [[ -d ${COMPREPLY[i]} ]]; then + COMPREPLY[i]+=/ + compopt -o nospace + fi + COMPREPLY[i]=${COMPREPLY[i]#/usr/share/zoneinfo/} + done + return 0 + ;; + esac fi return 1 } @@ -707,7 +745,7 @@ _init_completion() fi done - [[ $cword -eq 0 ]] && return 1 + [[ $cword -le 0 ]] && return 1 prev=${words[cword-1]} [[ ${split-} ]] && _split_longopt && split=true @@ -722,15 +760,17 @@ __parse_options() # Take first found long option, or first one (short) if not found. option= - for i in $1; do - case $i in + local -a array + read -a array <<<"$1" + for i in "${array[@]}"; do + case "$i" in ---*) break ;; --?*) option=$i ; break ;; -?*) [[ $option ]] || option=$i ;; *) break ;; esac done - [[ $option ]] || return 0 + [[ $option ]] || return IFS=$' \t\n' # affects parsing of the regexps below... @@ -760,7 +800,7 @@ _parse_help() esac } \ | while read -r line; do - [[ $line == *([ $'\t'])-* ]] || continue + [[ $line == *([[:blank:]])-* ]] || continue # transform "-f FOO, --foo=FOO" to "-f , --foo=FOO" etc while [[ $line =~ \ ((^|[^-])-[A-Za-z0-9?][[:space:]]+)\[?[A-Z0-9]+\]? ]]; do @@ -825,7 +865,8 @@ _mac_addresses() # - ifconfig on Linux: HWaddr or ether # - ifconfig on FreeBSD: ether # - ip link: link/ether - COMPREPLY+=( $( { ifconfig -a || ip link show; } 2>/dev/null | sed -ne \ + COMPREPLY+=( $( \ + { LC_ALL=C ifconfig -a || ip link show; } 2>/dev/null | command sed -ne \ "s/.*[[:space:]]HWaddr[[:space:]]\{1,\}\($re\)[[:space:]].*/\1/p" -ne \ "s/.*[[:space:]]HWaddr[[:space:]]\{1,\}\($re\)[[:space:]]*$/\1/p" -ne \ "s|.*[[:space:]]\(link/\)\{0,1\}ether[[:space:]]\{1,\}\($re\)[[:space:]].*|\2|p" -ne \ @@ -833,12 +874,12 @@ _mac_addresses() ) ) # ARP cache - COMPREPLY+=( $( { arp -an || ip neigh show; } 2>/dev/null | sed -ne \ + COMPREPLY+=( $( { arp -an || ip neigh show; } 2>/dev/null | command sed -ne \ "s/.*[[:space:]]\($re\)[[:space:]].*/\1/p" -ne \ "s/.*[[:space:]]\($re\)[[:space:]]*$/\1/p" ) ) # /etc/ethers - COMPREPLY+=( $( sed -ne \ + COMPREPLY+=( $( command sed -ne \ "s/^[[:space:]]*\($re\)[[:space:]].*/\1/p" /etc/ethers 2>/dev/null ) ) COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) ) @@ -851,23 +892,24 @@ _configured_interfaces() { if [[ -f /etc/debian_version ]]; then # Debian system - COMPREPLY=( $( compgen -W "$( sed -ne 's|^iface \([^ ]\{1,\}\).*$|\1|p'\ - /etc/network/interfaces )" -- "$cur" ) ) + COMPREPLY=( $( compgen -W "$( command sed -ne 's|^iface \([^ ]\{1,\}\).*$|\1|p'\ + /etc/network/interfaces /etc/network/interfaces.d/* 2>/dev/null )" \ + -- "$cur" ) ) elif [[ -f /etc/SuSE-release ]]; then # SuSE system COMPREPLY=( $( compgen -W "$( printf '%s\n' \ /etc/sysconfig/network/ifcfg-* | \ - sed -ne 's|.*ifcfg-\(.*\)|\1|p' )" -- "$cur" ) ) + command sed -ne 's|.*ifcfg-\([^*].*\)$|\1|p' )" -- "$cur" ) ) elif [[ -f /etc/pld-release ]]; then # PLD Linux COMPREPLY=( $( compgen -W "$( command ls -B \ /etc/sysconfig/interfaces | \ - sed -ne 's|.*ifcfg-\(.*\)|\1|p' )" -- "$cur" ) ) + command sed -ne 's|.*ifcfg-\([^*].*\)$|\1|p' )" -- "$cur" ) ) else # Assume Red Hat COMPREPLY=( $( compgen -W "$( printf '%s\n' \ /etc/sysconfig/network-scripts/ifcfg-* | \ - sed -ne 's|.*ifcfg-\(.*\)|\1|p' )" -- "$cur" ) ) + command sed -ne 's|.*ifcfg-\([^*].*\)$|\1|p' )" -- "$cur" ) ) fi } @@ -877,9 +919,9 @@ _ip_addresses() { local PATH=$PATH:/sbin COMPREPLY+=( $( compgen -W \ - "$( { LC_ALL=C ifconfig -a || ip addr show; } 2>/dev/null | - sed -ne 's/.*addr:\([^[:space:]]*\).*/\1/p' \ - -ne 's|.*inet[[:space:]]\{1,\}\([^[:space:]/]*\).*|\1|p' )" \ + "$( { LC_ALL=C ifconfig -a || ip addr show; } 2>/dev/null | command sed -ne \ + 's/.*addr:\([^[:space:]]*\).*/\1/p' -ne \ + 's|.*inet[[:space:]]\{1,\}\([^[:space:]/]*\).*|\1|p' )" \ -- "$cur" ) ) } @@ -929,7 +971,7 @@ _tilde() local result=0 if [[ $1 == \~* && $1 != */* ]]; then # Try generate ~username completions - COMPREPLY=( $( compgen -P '~' -u "${1#\~}" ) ) + COMPREPLY=( $( compgen -P '~' -u -- "${1#\~}" ) ) result=${#COMPREPLY[@]} # 2>/dev/null for direct invocation, e.g. in the _tilde unit test [[ $result -gt 0 ]] && compopt -o filenames 2>/dev/null @@ -996,7 +1038,7 @@ _expand() eval cur=$cur 2>/dev/null elif [[ "$cur" == \~* ]]; then cur=${cur#\~} - COMPREPLY=( $( compgen -P '~' -u "$cur" ) ) + COMPREPLY=( $( compgen -P '~' -u -- "$cur" ) ) [[ ${#COMPREPLY[@]} -eq 1 ]] && eval COMPREPLY[0]=${COMPREPLY[0]} return ${#COMPREPLY[@]} fi @@ -1007,7 +1049,7 @@ _expand() [[ $OSTYPE == *@(solaris|aix)* ]] && _pids() { - COMPREPLY=( $( compgen -W '$( command ps -efo pid | sed 1d )' -- "$cur" )) + COMPREPLY=( $( compgen -W '$( command ps -efo pid | command sed 1d )' -- "$cur" )) } || _pids() { @@ -1019,7 +1061,7 @@ _pids() [[ $OSTYPE == *@(solaris|aix)* ]] && _pgids() { - COMPREPLY=( $( compgen -W '$( command ps -efo pgid | sed 1d )' -- "$cur" )) + COMPREPLY=( $( compgen -W '$( command ps -efo pgid | command sed 1d )' -- "$cur" )) } || _pgids() { @@ -1028,25 +1070,32 @@ _pgids() # This function completes on process names. # AIX and SunOS prefer X/Open, all else should be BSD. +# @param $1 if -s, don't try to avoid truncated command names [[ $OSTYPE == *@(solaris|aix)* ]] && _pnames() { COMPREPLY=( $( compgen -X '' -W '$( command ps -efo comm | \ - sed -e 1d -e "s:.*/::" -e "s/^-//" | sort -u )' -- "$cur" ) ) + command sed -e 1d -e "s:.*/::" -e "s/^-//" | sort -u )' -- "$cur" ) ) } || _pnames() { - # FIXME: completes "[kblockd/0]" to "0". Previously it was completed - # to "kblockd" which isn't correct either. "kblockd/0" would be - # arguably most correct, but killall from psmisc 22 treats arguments - # containing "/" specially unless -r is given so that wouldn't quite - # work either. Perhaps it'd be best to not complete these to anything - # for now. - # Not using "ps axo comm" because under some Linux kernels, it - # truncates command names (see e.g. http://bugs.debian.org/497540#19) - COMPREPLY=( $( compgen -X '' -W '$( command ps axo command= | \ - sed -e "s/ .*//" -e "s:.*/::" -e "s/:$//" -e "s/^[[(-]//" \ - -e "s/[])]$//" | sort -u )' -- "$cur" ) ) + if [[ "$1" == -s ]]; then + COMPREPLY=( $( compgen -X '' \ + -W '$( command ps axo comm | command sed -e 1d )' -- "$cur" ) ) + else + # FIXME: completes "[kblockd/0]" to "0". Previously it was completed + # to "kblockd" which isn't correct either. "kblockd/0" would be + # arguably most correct, but killall from psmisc 22 treats arguments + # containing "/" specially unless -r is given so that wouldn't quite + # work either. Perhaps it'd be best to not complete these to anything + # for now. + COMPREPLY=( $( compgen -X '' -W '$( command ps axo command= | command sed -e \ + "s/ .*//" -e \ + "s:.*/::" -e \ + "s/:$//" -e \ + "s/^[[(-]//" -e \ + "s/[])]$//" | sort -u )' -- "$cur" ) ) + fi } # This function completes on user IDs @@ -1103,12 +1152,17 @@ _services() _sysvdirs local restore_nullglob=$(shopt -p nullglob); shopt -s nullglob - COMPREPLY=( $( printf '%s\n' ${sysvdirs[0]}/!($_backup_glob|functions) ) ) + COMPREPLY=( \ + $( printf '%s\n' ${sysvdirs[0]}/!($_backup_glob|functions|README) ) ) $restore_nullglob COMPREPLY+=( $( systemctl list-units --full --all 2>/dev/null | \ awk '$1 ~ /\.service$/ { sub("\\.service$", "", $1); print $1 }' ) ) + if [[ -x /sbin/upstart-udev-bridge ]]; then + COMPREPLY+=( $( initctl list 2>/dev/null | cut -d' ' -f1 ) ) + fi + COMPREPLY=( $( compgen -W '${COMPREPLY[@]#${sysvdirs[0]}/}' -- "$cur" ) ) } @@ -1122,7 +1176,7 @@ _service() _init_completion || return # don't complete past 2nd token - [[ $cword -gt 2 ]] && return 0 + [[ $cword -gt 2 ]] && return if [[ $cword -eq 1 && $prev == ?(*/)service ]]; then _services @@ -1130,7 +1184,7 @@ _service() else local sysvdirs _sysvdirs - COMPREPLY=( $( compgen -W '`sed -e "y/|/ /" \ + COMPREPLY=( $( compgen -W '`command sed -e "y/|/ /" \ -ne "s/^.*\(U\|msg_u\)sage.*{\(.*\)}.*$/\2/p" \ ${sysvdirs[0]}/${prev##*/} 2>/dev/null` start stop' -- "$cur" ) ) fi @@ -1151,7 +1205,7 @@ _modules() local modpath modpath=/lib/modules/$1 COMPREPLY=( $( compgen -W "$( command ls -RL $modpath 2>/dev/null | \ - sed -ne 's/^\(.*\)\.k\{0,1\}o\(\.[gx]z\)\{0,1\}$/\1/p' )" -- "$cur" ) ) + command sed -ne 's/^\(.*\)\.k\{0,1\}o\(\.[gx]z\)\{0,1\}$/\1/p' )" -- "$cur" ) ) } # This function completes on installed modules @@ -1171,10 +1225,10 @@ _installed_modules() # context of current completion. _usergroup() { - if [[ $cur = *\\\\* || $cur = *:*:* ]]; then + if [[ $cur == *\\\\* || $cur == *:*:* ]]; then # Give up early on if something seems horribly wrong. return - elif [[ $cur = *\\:* ]]; then + elif [[ $cur == *\\:* ]]; then # Completing group after 'user\:gr'. # Reply with a list of groups prefixed with 'user:', readline will # escape to the colon. @@ -1189,7 +1243,7 @@ _usergroup() COMPREPLY=( $( compgen -g -- "$mycur" ) ) fi COMPREPLY=( $( compgen -P "$prefix" -W "${COMPREPLY[@]}" ) ) - elif [[ $cur = *:* ]]; then + elif [[ $cur == *:* ]]; then # Completing group after 'user:gr'. # Reply with a list of unprefixed groups since readline with split on : # and only replace the 'gr' part @@ -1258,14 +1312,14 @@ _fstypes() if [[ -e /proc/filesystems ]]; then # Linux fss="$( cut -d$'\t' -f2 /proc/filesystems ) - $( awk '! /\*/ { print $NF }' /etc/filesystems 2>/dev/null )" + $( awk '! /\*/ { print $NF }' /etc/filesystems 2>/dev/null )" else # Generic fss="$( awk '/^[ \t]*[^#]/ { print $3 }' /etc/fstab 2>/dev/null ) - $( awk '/^[ \t]*[^#]/ { print $3 }' /etc/mnttab 2>/dev/null ) - $( awk '/^[ \t]*[^#]/ { print $4 }' /etc/vfstab 2>/dev/null ) - $( awk '{ print $1 }' /etc/dfs/fstypes 2>/dev/null ) - $( [[ -d /etc/fs ]] && command ls /etc/fs )" + $( awk '/^[ \t]*[^#]/ { print $3 }' /etc/mnttab 2>/dev/null ) + $( awk '/^[ \t]*[^#]/ { print $4 }' /etc/vfstab 2>/dev/null ) + $( awk '{ print $1 }' /etc/dfs/fstypes 2>/dev/null ) + $( [[ -d /etc/fs ]] && command ls /etc/fs )" fi [[ -n $fss ]] && COMPREPLY+=( $( compgen -W "$fss" -- "$cur" ) ) @@ -1354,7 +1408,7 @@ _dvd_devices() _terms() { COMPREPLY+=( $( compgen -W \ - "$( sed -ne 's/^\([^[:space:]#|]\{2,\}\)|.*/\1/p' /etc/termcap \ + "$( command sed -ne 's/^\([^[:space:]#|]\{2,\}\)|.*/\1/p' /etc/termcap \ 2>/dev/null )" -- "$cur" ) ) COMPREPLY+=( $( compgen -W "$( { toe -a 2>/dev/null || toe 2>/dev/null; } \ | awk '{ print $1 }' | sort -u )" -- "$cur" ) ) @@ -1375,12 +1429,11 @@ _user_at_host() if [[ $cur == *@* ]]; then _known_hosts_real "$cur" else - COMPREPLY=( $( compgen -u -- "$cur" ) ) + COMPREPLY=( $( compgen -u -S @ -- "$cur" ) ) + compopt -o nospace fi - - return 0 } -shopt -u hostcomplete && complete -F _user_at_host -o nospace talk ytalk finger +shopt -u hostcomplete && complete -F _user_at_host talk ytalk finger # NOTE: Using this function as a helper function is deprecated. Use # `_known_hosts_real' instead. @@ -1397,6 +1450,39 @@ _known_hosts() _known_hosts_real $options -- "$cur" } # _known_hosts() +# Helper function to locate ssh included files in configs +# This function look for the "Include" keyword in ssh config files and include +# them recursively adding each result to the config variable +_included_ssh_config_files() +{ + [[ $# -lt 1 ]] && echo "error: $FUNCNAME: missing mandatory argument CONFIG" + local configfile i f + configfile=$1 + local included=$( command sed -ne 's/^[[:blank:]]*[Ii][Nn][Cc][Ll][Uu][Dd][Ee][[:blank:]]\{1,\}\([^#%]*\)\(#.*\)\{0,1\}$/\1/p' "${configfile}" ) + for i in ${included[@]}; do + # Check the origin of $configfile to complete relative included paths on included + # files according to ssh_config(5): + # "[...] Files without absolute paths are assumed to be in ~/.ssh if included in a user + # configuration file or /etc/ssh if included from the system configuration file.[...]" + if ! [[ "$i" =~ ^\~.*|^\/.* ]]; then + if [[ "$configfile" =~ ^\/etc\/ssh.* ]]; then + i="/etc/ssh/$i" + else + i="$HOME/.ssh/$i" + fi + fi + __expand_tilde_by_ref i + # In case the expanded variable contains multiple paths + for f in ${i}; do + if [ -r $f ]; then + config+=( "$f" ) + # The Included file is processed to look for Included files in itself + _included_ssh_config_files $f + fi + done + done +} # _included_ssh_config_files() + # 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 if @@ -1441,6 +1527,11 @@ _known_hosts_real() done fi + # "Include" keyword in ssh config files + for i in "${config[@]}"; do + _included_ssh_config_files "$i" + done + # Known hosts files from configs if [[ ${#config[@]} -gt 0 ]]; then local OIFS=$IFS IFS=$'\n' j @@ -1533,7 +1624,7 @@ _known_hosts_real() # append any available aliases from config files if [[ ${#config[@]} -gt 0 && -n "$aliases" ]]; then - local hosts=$( sed -ne 's/^[ \t]*[Hh][Oo][Ss][Tt]\([Nn][Aa][Mm][Ee]\)\{0,1\}['"$'\t '"']\{1,\}\([^#*?]*\)\(#.*\)\{0,1\}$/\2/p' "${config[@]}" ) + local hosts=$( command sed -ne 's/^[[:blank:]]*[Hh][Oo][Ss][Tt][[:blank:]]\{1,\}\([^#*?%]*\)\(#.*\)\{0,1\}$/\1/p' "${config[@]}" ) COMPREPLY+=( $( compgen -P "$prefix$user" \ -S "$suffix" -W "$hosts" -- "$cur" ) ) fi @@ -1548,7 +1639,7 @@ _known_hosts_real() # time ago, so... COMPREPLY+=( $( compgen -P "$prefix$user" -S "$suffix" -W \ "$( avahi-browse -cpr _workstation._tcp 2>/dev/null | \ - awk -F';' '/^=/ { print $7 }' | sort -u )" -- "$cur" ) ) + awk -F';' '/^=/ { print $7 }' | sort -u )" -- "$cur" ) ) fi # Add hosts reported by ruptime. @@ -1565,7 +1656,6 @@ _known_hosts_real() __ltrim_colon_completions "$prefix$user$cur" - return 0 } # _known_hosts_real() complete -F _known_hosts traceroute traceroute6 tracepath tracepath6 \ fping fping6 telnet rsh rlogin ftp dig mtr ssh-installkeys showmount @@ -1586,7 +1676,7 @@ _cd() # ./ or ../ if [[ -z "${CDPATH:-}" || "$cur" == ?(.)?(.)/* ]]; then _filedir -d - return 0 + return fi local -r mark_dirs=$(_rl_enabled mark-directories && echo y) @@ -1596,7 +1686,7 @@ _cd() for i in ${CDPATH//:/$'\n'}; do # create an array of matched subdirs k="${#COMPREPLY[@]}" - for j in $( compgen -d $i/$cur ); do + for j in $( compgen -d -- $i/$cur ); do if [[ ( $mark_symdirs && -h $j || $mark_dirs && ! -h $j ) && ! -d ${j#$i/} ]]; then j+="/" fi @@ -1613,12 +1703,12 @@ _cd() fi fi - return 0 + return } if shopt -q cdable_vars; then - complete -v -F _cd -o nospace cd + complete -v -F _cd -o nospace cd pushd else - complete -F _cd -o nospace cd + complete -F _cd -o nospace cd pushd fi # a wrapper method for the next one, when the offset is unknown @@ -1664,7 +1754,7 @@ _command_offset() COMP_WORDS[i]=${COMP_WORDS[i+$word_offset]} done for (( i; i <= COMP_CWORD; i++ )); do - unset COMP_WORDS[i] + unset 'COMP_WORDS[i]' done ((COMP_CWORD -= $word_offset)) @@ -1751,49 +1841,49 @@ _longopt() case "${prev,,}" in --help|--usage|--version) - return 0 + return ;; --*dir*) _filedir -d - return 0 + return ;; --*file*|--*path*) _filedir - return 0 + return ;; --+([-a-z0-9_])) - local argtype=$( $1 --help 2>&1 | sed -ne \ + local argtype=$( LC_ALL=C $1 --help 2>&1 | command sed -ne \ "s|.*$prev\[\{0,1\}=[<[]\{0,1\}\([-A-Za-z0-9_]\{1,\}\).*|\1|p" ) case ${argtype,,} in *dir*) _filedir -d - return 0 + return ;; *file*|*path*) _filedir - return 0 + return ;; esac ;; esac - $split && return 0 + $split && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W "$( $1 --help 2>&1 | \ - sed -ne 's/.*\(--[-A-Za-z0-9]\{1,\}=\{0,1\}\).*/\1/p' | sort -u )" \ + COMPREPLY=( $( compgen -W "$( LC_ALL=C $1 --help 2>&1 | \ + command sed -ne 's/.*\(--[-A-Za-z0-9]\{1,\}=\{0,1\}\).*/\1/p' | sort -u )" \ -- "$cur" ) ) [[ $COMPREPLY == *= ]] && compopt -o nospace - elif [[ "$1" == @(mk|rm)dir ]]; then + elif [[ "$1" == @(@(mk|rm)dir|chroot) ]]; then _filedir -d else _filedir fi } # makeinfo and texi2dvi are defined elsewhere. -complete -F _longopt a2ps awk base64 bash bc bison cat colordiff cp csplit \ - cut date df diff dir du enscript env expand fmt fold gperf \ - grep grub head indent irb ld ldd less ln ls m4 md5sum mkdir mkfifo mknod \ +complete -F _longopt a2ps awk base64 bash bc bison cat chroot colordiff cp \ + csplit cut date df diff dir du enscript env expand fmt fold gperf \ + grep grub head irb ld ldd less ln ls m4 md5sum mkdir mkfifo mknod \ mv netstat nl nm objcopy objdump od paste pr ptx readelf rm rmdir \ sed seq sha{,1,224,256,384,512}sum shar sort split strip sum tac tail tee \ texindex touch tr uname unexpand uniq units vdir wc who @@ -1804,7 +1894,7 @@ _filedir_xspec() local cur prev words cword _init_completion || return - _tilde "$cur" || return 0 + _tilde "$cur" || return local IFS=$'\n' xspec=${_xspecs[${1##*/}]} tmp local -a toks @@ -1828,7 +1918,7 @@ _filedir_xspec() xspec="$matchop($xspec|${xspec^^})" 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 @@ -1852,10 +1942,11 @@ _install_xspec() } # bzcmp, bzdiff, bz*grep, bzless, bzmore intentionally not here, see Debian: #455510 _install_xspec '!*.?(t)bz?(2)' bunzip2 bzcat pbunzip2 pbzcat lbunzip2 lbzcat -_install_xspec '!*.@(zip|[ejsw]ar|exe|pk3|wsz|zargo|xpi|s[tx][cdiw]|sx[gm]|o[dt][tspgfc]|od[bm]|oxt|epub|apk|do[ct][xm]|p[op]t[mx]|xl[st][xm])' unzip zipinfo +_install_xspec '!*.@(zip|[ejsw]ar|exe|pk3|wsz|zargo|xpi|s[tx][cdiw]|sx[gm]|o[dt][tspgfc]|od[bm]|oxt|epub|apk|ipa|do[ct][xm]|p[op]t[mx]|xl[st][xm]|pyz)' unzip zipinfo _install_xspec '*.Z' compress znew # zcmp, zdiff, z*grep, zless, zmore intentionally not here, see Debian: #455510 -_install_xspec '!*.@(Z|[gGd]z|t[ag]z)' gunzip zcat unpigz +_install_xspec '!*.@(Z|[gGd]z|t[ag]z)' gunzip zcat +_install_xspec '!*.@(Z|[gGdz]z|t[ag]z)' unpigz _install_xspec '!*.Z' uncompress # lzcmp, lzdiff intentionally not here, see Debian: #455510 _install_xspec '!*.@(tlz|lzma)' lzcat lzegrep lzfgrep lzgrep lzless lzmore unlzma @@ -1863,21 +1954,21 @@ _install_xspec '!*.@(?(t)xz|tlz|lzma)' unxz xzcat _install_xspec '!*.lrz' lrunzip _install_xspec '!*.@(gif|jp?(e)g|miff|tif?(f)|pn[gm]|p[bgp]m|bmp|xpm|ico|xwd|tga|pcx)' ee _install_xspec '!*.@(gif|jp?(e)g|tif?(f)|png|p[bgp]m|bmp|x[bp]m|rle|rgb|pcx|fits|pm|svg)' qiv -_install_xspec '!*.@(gif|jp?(e)g|tif?(f)|png|p[bgp]m|bmp|x[bp]m|rle|rgb|pcx|fits|pm|?(e)ps)' xv +_install_xspec '!*.@(gif|jp?(e)g?(2)|j2[ck]|jp[2f]|tif?(f)|png|p[bgp]m|bmp|x[bp]m|rle|rgb|pcx|fits|pm|?(e)ps)' xv _install_xspec '!*.@(@(?(e)ps|?(E)PS|pdf|PDF)?(.gz|.GZ|.bz2|.BZ2|.Z))' gv ggv kghostview _install_xspec '!*.@(dvi|DVI)?(.@(gz|Z|bz2))' xdvi kdvi _install_xspec '!*.dvi' dvips dviselect dvitype dvipdf advi dvipdfm dvipdfmx _install_xspec '!*.[pf]df' acroread gpdf xpdf _install_xspec '!*.@(?(e)ps|pdf)' kpdf _install_xspec '!*.@(okular|@(?(e|x)ps|?(E|X)PS|[pf]df|[PF]DF|dvi|DVI|cb[rz]|CB[RZ]|djv?(u)|DJV?(U)|dvi|DVI|gif|jp?(e)g|miff|tif?(f)|pn[gm]|p[bgp]m|bmp|xpm|ico|xwd|tga|pcx|GIF|JP?(E)G|MIFF|TIF?(F)|PN[GM]|P[BGP]M|BMP|XPM|ICO|XWD|TGA|PCX|epub|EPUB|odt|ODT|fb?(2)|FB?(2)|mobi|MOBI|g3|G3|chm|CHM)?(.?(gz|GZ|bz2|BZ2)))' okular -_install_xspec '!*.pdf' epdfview +_install_xspec '!*.pdf' epdfview pdfunite _install_xspec '!*.@(cb[rz7t]|djv?(u)|?(e)ps|pdf)' zathura _install_xspec '!*.@(?(e)ps|pdf)' ps2pdf ps2pdf12 ps2pdf13 ps2pdf14 ps2pdfwr _install_xspec '!*.texi*' makeinfo texi2html -_install_xspec '!*.@(?(la)tex|texi|dtx|ins|ltx|dbj)' tex latex slitex jadetex pdfjadetex pdftex pdflatex texi2dvi +_install_xspec '!*.@(?(la)tex|texi|dtx|ins|ltx|dbj)' tex latex slitex jadetex pdfjadetex pdftex pdflatex texi2dvi xetex xelatex luatex lualatex _install_xspec '!*.mp3' mpg123 mpg321 madplay -_install_xspec '!*@(.@(mp?(e)g|MP?(E)G|wma|avi|AVI|asf|vob|VOB|bin|dat|divx|DIVX|vcd|ps|pes|fli|flv|FLV|fxm|FXM|viv|rm|ram|yuv|mov|MOV|qt|QT|wmv|mp[234]|MP[234]|m4[pv]|M4[PV]|mkv|MKV|og[gmv]|OG[GMV]|t[ps]|T[PS]|m2t?(s)|M2T?(S)|wav|WAV|flac|FLAC|asx|ASX|mng|MNG|srt|m[eo]d|M[EO]D|s[3t]m|S[3T]M|it|IT|xm|XM)|+([0-9]).@(vdr|VDR))?(.part)' xine aaxine fbxine -_install_xspec '!*@(.@(mp?(e)g|MP?(E)G|wma|avi|AVI|asf|vob|VOB|bin|dat|divx|DIVX|vcd|ps|pes|fli|flv|FLV|fxm|FXM|viv|rm|ram|yuv|mov|MOV|qt|QT|wmv|mp[234]|MP[234]|m4[pv]|M4[PV]|mkv|MKV|og[gmv]|OG[GMV]|t[ps]|T[PS]|m2t?(s)|M2T?(S)|wav|WAV|flac|FLAC|asx|ASX|mng|MNG|srt|m[eo]d|M[EO]D|s[3t]m|S[3T]M|it|IT|xm|XM|iso|ISO)|+([0-9]).@(vdr|VDR))?(.part)' kaffeine dragon +_install_xspec '!*@(.@(mp?(e)g|MP?(E)G|wm[av]|WM[AV]|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|web[am]|WEB[AM]|mp[234]|MP[234]|m?(p)4[av]|M?(P)4[AV]|mkv|MKV|og[gmv]|OG[GMV]|t[ps]|T[PS]|m2t?(s)|M2T?(S)|mts|MTS|wav|WAV|flac|FLAC|asx|ASX|mng|MNG|srt|m[eo]d|M[EO]D|s[3t]m|S[3T]M|it|IT|xm|XM)|+([0-9]).@(vdr|VDR))?(.part)' xine aaxine fbxine +_install_xspec '!*@(.@(mp?(e)g|MP?(E)G|wm[av]|WM[AV]|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|web[am]|WEB[AM]|mp[234]|MP[234]|m?(p)4[av]|M?(P)4[AV]|mkv|MKV|og[gmv]|OG[GMV]|t[ps]|T[PS]|m2t?(s)|M2T?(S)|mts|MTS|wav|WAV|flac|FLAC|asx|ASX|mng|MNG|srt|m[eo]d|M[EO]D|s[3t]m|S[3T]M|it|IT|xm|XM|iso|ISO)|+([0-9]).@(vdr|VDR))?(.part)' kaffeine dragon _install_xspec '!*.@(avi|asf|wmv)' aviplay _install_xspec '!*.@(rm?(j)|ra?(m)|smi?(l))' realplay _install_xspec '!*.@(mpg|mpeg|avi|mov|qt)' xanim @@ -1886,12 +1977,13 @@ _install_xspec '!*.@(mp3|ogg|pls|m3u)' gqmpeg freeamp _install_xspec '!*.fig' xfig _install_xspec '!*.@(mid?(i)|cmf)' playmidi _install_xspec '!*.@(mid?(i)|rmi|rcp|[gr]36|g18|mod|xm|it|x3m|s[3t]m|kar)' timidity -_install_xspec '!*.@(669|abc|am[fs]|d[bs]m|dmf|far|it|mdl|m[eo]d|mid?(i)|mt[2m]|okta|p[st]m|s[3t]m|ult|umx|wav|xm)' modplugplay modplug123 -_install_xspec '*.@(o|so|so.!(conf|*/*)|a|[rs]pm|gif|jp?(e)g|mp3|mp?(e)g|avi|asf|ogg|class)' vi vim gvim rvim view rview rgvim rgview gview emacs xemacs sxemacs kate kwrite +_install_xspec '!*.@(669|abc|am[fs]|d[bs]m|dmf|far|it|mdl|m[eo]d|mid?(i)|mt[2m]|oct|okt?(a)|p[st]m|s[3t]m|ult|umx|wav|xm)' modplugplay modplug123 +_install_xspec '*.@([ao]|so|so.!(conf|*/*)|[rs]pm|gif|jp?(e)g|mp3|mp?(e)g|avi|asf|ogg|class)' vi vim gvim rvim view rview rgvim rgview gview emacs xemacs sxemacs kate kwrite _install_xspec '!*.@(zip|z|gz|tgz)' bzme # konqueror not here on purpose, it's more than a web/html browser -_install_xspec '!*.@(?([xX]|[sS])[hH][tT][mM]?([lL]))' netscape mozilla lynx galeon dillo elinks amaya firefox mozilla-firefox iceweasel google-chrome chromium-browser epiphany -_install_xspec '!*.@(sxw|stw|sxg|sgl|doc?([mx])|dot?([mx])|rtf|txt|htm|html|?(f)odt|ott|odm)' oowriter +_install_xspec '!*.@(?([xX]|[sS])[hH][tT][mM]?([lL]))' netscape mozilla lynx galeon dillo elinks amaya epiphany +_install_xspec '!*.@(?([xX]|[sS])[hH][tT][mM]?([lL])|[pP][dD][fF])' firefox mozilla-firefox iceweasel google-chrome chromium-browser +_install_xspec '!*.@(sxw|stw|sxg|sgl|doc?([mx])|dot?([mx])|rtf|txt|htm|html|?(f)odt|ott|odm|pdf)' oowriter _install_xspec '!*.@(sxi|sti|pps?(x)|ppt?([mx])|pot?([mx])|?(f)odp|otp)' ooimpress _install_xspec '!*.@(sxc|stc|xls?([bmx])|xlw|xlt?([mx])|[ct]sv|?(f)ods|ots)' oocalc _install_xspec '!*.@(sxd|std|sda|sdd|?(f)odg|otg)' oodraw @@ -1906,7 +1998,6 @@ _install_xspec '!*.ly' lilypond ly2dvi _install_xspec '!*.@(dif?(f)|?(d)patch)?(.@([gx]z|bz2|lzma))' cdiff _install_xspec '!@(*.@(ks|jks|jceks|p12|pfx|bks|ubr|gkr|cer|crt|cert|p7b|pkipath|pem|p10|csr|crl)|cacerts)' portecle _install_xspec '!*.@(mp[234c]|og[ag]|@(fl|a)ac|m4[abp]|spx|tta|w?(a)v|wma|aif?(f)|asf|ape)' kid3 kid3-qt -_install_xspec '!*.py' pyflakes unset -f _install_xspec # Minimal completion to use as fallback in _completion_loader. @@ -1917,23 +2008,47 @@ _minimal() $split && return _filedir } -# Complete the empty string to allow completion of '>', '>>', and '<' +# Complete the empty string to allow completion of '>', '>>', and '<' on < 4.3 # http://lists.gnu.org/archive/html/bug-bash/2012-01/msg00045.html complete -F _minimal '' +__load_completion() +{ + local -a dirs=( ${BASH_COMPLETION_USER_DIR:-${XDG_DATA_HOME:-$HOME/.local/share}/bash-completion}/completions ) + local OIFS=$IFS IFS=: dir cmd="$1" compfile + for dir in ${XDG_DATA_DIRS:-/usr/local/share:/usr/share}; do + dirs+=( $dir/bash-completion/completions ) + done + IFS=$OIFS + + if [[ $BASH_SOURCE == */* ]]; then + dirs+=( "${BASH_SOURCE%/*}/completions" ) + else + dirs+=( ./completions ) + fi + + for dir in "${dirs[@]}"; do + for compfile in "${cmd##*/}" "${cmd##*/}".bash _"${cmd##*/}"; do + compfile="$dir/$compfile" + # Avoid trying to source dirs; https://bugzilla.redhat.com/903540 + [[ -f "$compfile" ]] && . "$compfile" &>/dev/null && return 0 + done + done + + return 1 +} + # set up dynamic completion loading _completion_loader() { - local compfile=./completions - [[ $BASH_SOURCE == */* ]] && compfile="${BASH_SOURCE%/*}/completions" - compfile+="/${1##*/}" + # $1=_EmptycmD_ already for empty cmds in bash 4.3, set to it for earlier + local cmd="${1:-_EmptycmD_}" - # Avoid trying to source dirs; https://bugzilla.redhat.com/903540 - [[ -f "$compfile" ]] && . "$compfile" &>/dev/null && return 124 + __load_completion "$cmd" && return 124 # Need to define *something*, otherwise there will be no completion at all. - complete -F _minimal "$1" && return 124 + complete -F _minimal -- "$cmd" && return 124 } && complete -D -F _completion_loader @@ -1947,31 +2062,31 @@ _xfunc() local srcfile=$1 shift declare -F $1 &>/dev/null || { - local compdir=./completions - [[ $BASH_SOURCE == */* ]] && compdir="${BASH_SOURCE%/*}/completions" - . "$compdir/$srcfile" + __load_completion "$srcfile" } "$@" } # source compat completion directory definitions -if [[ -d $BASH_COMPLETION_COMPAT_DIR && -r $BASH_COMPLETION_COMPAT_DIR && \ - -x $BASH_COMPLETION_COMPAT_DIR ]]; then - for i in $(LC_ALL=C command ls "$BASH_COMPLETION_COMPAT_DIR"); do - i=$BASH_COMPLETION_COMPAT_DIR/$i +compat_dir=${BASH_COMPLETION_COMPAT_DIR:-/etc/bash_completion.d} +if [[ -d $compat_dir && -r $compat_dir && -x $compat_dir ]]; then + for i in "$compat_dir"/*; do [[ ${i##*/} != @($_backup_glob|Makefile*|$_blacklist_glob) \ && -f $i && -r $i ]] && . "$i" done fi -unset i _blacklist_glob +unset compat_dir i _blacklist_glob # source user completion file -[[ ${BASH_SOURCE[0]} != ~/.bash_completion && -r ~/.bash_completion ]] \ - && . ~/.bash_completion +user_completion=${BASH_COMPLETION_USER_FILE:-~/.bash_completion} +[[ ${BASH_SOURCE[0]} != $user_completion && -r $user_completion ]] \ + && . $user_completion +unset user_completion + unset -f have unset have set $BASH_COMPLETION_ORIGINAL_V_VALUE unset BASH_COMPLETION_ORIGINAL_V_VALUE -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/bash_completion.sh.in b/bash_completion.sh.in index 2fb74625..4e410d4a 100644 --- a/bash_completion.sh.in +++ b/bash_completion.sh.in @@ -1,14 +1,15 @@ # Check for interactive bash and that we haven't already been sourced. -[ -z "$BASH_VERSION" -o -z "$PS1" -o -n "$BASH_COMPLETION_COMPAT_DIR" ] && return +if [ -n "${BASH_VERSION-}" -a -n "${PS1-}" -a -z "${BASH_COMPLETION_VERSINFO-}" ]; then -# Check for recent enough version of bash. -bash=${BASH_VERSION%.*}; bmajor=${bash%.*}; bminor=${bash#*.} -if [ $bmajor -gt 4 ] || [ $bmajor -eq 4 -a $bminor -ge 1 ]; then - [ -r "${XDG_CONFIG_HOME:-$HOME/.config}/bash_completion" ] && \ - . "${XDG_CONFIG_HOME:-$HOME/.config}/bash_completion" - if shopt -q progcomp && [ -r @pkgdatadir@/bash_completion ]; then - # Source completion code. - . @pkgdatadir@/bash_completion + # Check for recent enough version of bash. + if [ ${BASH_VERSINFO[0]} -gt 4 ] || \ + [ ${BASH_VERSINFO[0]} -eq 4 -a ${BASH_VERSINFO[1]} -ge 1 ]; then + [ -r "${XDG_CONFIG_HOME:-$HOME/.config}/bash_completion" ] && \ + . "${XDG_CONFIG_HOME:-$HOME/.config}/bash_completion" + if shopt -q progcomp && [ -r @pkgdatadir@/bash_completion ]; then + # Source completion code. + . @pkgdatadir@/bash_completion + fi fi + fi -unset bash bmajor bminor diff --git a/completions/.gitignore b/completions/.gitignore new file mode 100644 index 00000000..60a2d949 --- /dev/null +++ b/completions/.gitignore @@ -0,0 +1,205 @@ +7za +aclocal-1.1[012345] +alpine +alternatives +animate +apropos +arm-koji +asciidoc.py +autoheader +automake-1.1[012345] +autossh +autoupdate +bsdtar +btdownloadcurses.py +btdownloadgui.py +c++ +cc +cdrecord +ci +ciptool +civclient +civserver +clzip +co +colormake +compare +compgen +composite +conjure +cowthink +createdb +createuser +dcop +declare +dfutool +display +dpkg-deb +dpkg-query +dpkg-reconfigure +dropdb +dropuser +edquota +f77 +f95 +filebucket +freeciv-sdl +freeciv-xaw +g++ +g4 +g77 +g95 +gcj +gfortran +gkrellm2 +gmake +gmplayer +gnumake +gpc +hciattach +hciconfig +hd +host +hping +hping3 +identify +ifdown +ifstatus +import +insmod.static +javac +javadoc +kplayer +l2ping +lbzip2 +ldapadd +ldapcompare +ldapdelete +ldapmodify +ldapmodrdn +ldappasswd +ldapwhoami +lintian-info +lusermod +lvchange +lvcreate +lvdisplay +lvextend +lvmdiskscan +lvreduce +lvremove +lvrename +lvresize +lvs +lvscan +lz4c +mailsnarf +mdecrypt +mencoder +micropython +mkisofs +mogrify +montage +mplayer2 +msgsnarf +muttng +ncal +pbzip2 +pccardctl +pdlzip +perldoc +phing +pigz +pinfo +ping6 +pkg_deinstall +pkg_info +pkill +plzip +pm-suspend +pm-suspend-hybrid +pmake +postalias +ppc-koji +puppetca +puppetd +puppetdoc +puppetmasterd +puppetqd +puppetrun +pvchange +pvcreate +pvdisplay +pvmove +pvremove +pvs +pvscan +pxz +py.test-[23] +pydoc3 +python2 +python3 +pypy +pypy3 +pyvenv-3.[45] +qemu-kvm +qemu-system-i386 +qemu-system-x86_64 +quotacheck +quotaoff +quotaon +ralsh +rcsdiff +rdict +repquota +rfcomm +rlog +rpm2targz +rpm2txz +rpmbuild +rpmbuild-md5 +s390-koji +sbcl-mt +scp +sdptool +setquota +sftp +sidedoor +slogin +smbcacls +smbcquotas +smbget +smbpasswd +smbtar +smbtree +sparc-koji +spovray +star +stream +sudoedit +tightvncviewer +tracepath6 +typeset +vgcfgbackup +vgcfgrestore +vgchange +vgck +vgconvert +vgcreate +vgdisplay +vgexport +vgextend +vgimport +vgmerge +vgmknodes +vgreduce +vgremove +vgrename +vgs +vgscan +vgsplit +vigr +whatis +xpovray +xvnc4viewer +ypcat diff --git a/completions/2to3 b/completions/2to3 new file mode 100644 index 00000000..4dd29bf4 --- /dev/null +++ b/completions/2to3 @@ -0,0 +1,39 @@ +# bash completion for 2to3 -*- shell-script -*- + +_2to3() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + -h|--help|--add-suffix) + return + ;; + -f|--fix|-x|--nofix) + COMPREPLY=( $( compgen -W \ + "$( $1 --list-fixes 2>/dev/null | command sed -e 1d )" -- "$cur" ) ) + return + ;; + -j|--processes) + COMPREPLY=( $( compgen -W "{1..$(_ncpus)}" -- "$cur" ) ) + return + ;; + -o|--output-dir) + _filedir -d + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + return + fi + + _filedir py +} && +complete -F _2to3 2to3 + +# ex: filetype=sh diff --git a/completions/7z b/completions/7z new file mode 100644 index 00000000..5599b708 --- /dev/null +++ b/completions/7z @@ -0,0 +1,119 @@ +# 7z(1) completion -*- shell-script -*- + +_7z() +{ + local cur prev words cword + _init_completion -n = || return + + if [[ $cword -eq 1 ]]; then + COMPREPLY=( $( compgen -W 'a b d e l t u x' -- "$cur" ) ) + return + fi + + local mode + [[ ${words[1]} == [adu] ]] && mode=w || mode=r + + case $cur in + -ao*) + COMPREPLY=( $( compgen -P${cur:0:3} -W 'a s t u' -- "${cur:3}" ) ) + return + ;; + -?(a)[ix]*) + local opt + if [[ $cur == -a[ix]* ]]; then + opt=${cur:0:3} cur=${cur:3} + else + opt=${cur:0:2} cur=${cur:2} + fi + if [[ $cur != *[@\!]* ]]; then + COMPREPLY=( $( compgen -P$opt -W '@ ! r@ r-@ r0@ r! r-! r0!' \ + -- "$cur" ) ) + elif [[ $cur == ?(r@(-|0|))@* ]]; then + local x tmp + x=$( compgen -P"${opt}${cur%%@*}@" -f -- "${cur#*@}" ) && + while read -r tmp; do + COMPREPLY+=( "$tmp" ) + done <<< "$x" + compopt -o filenames + fi + return + ;; + -mhe=*|-mhc=*|-ms=*|-mt=*) + COMPREPLY=( $( compgen -W 'on off' -- "${cur#*=}" ) ) + return + ;; + -mx=*) + COMPREPLY=( $( compgen -W '0 1 3 5 7 9' -- "${cur#*=}" ) ) + return + ;; + -o*|-w?*) + local x tmp + x=$( compgen -P${cur:0:2} -S/ -d -- "${cur:2}" ) && + while read -r tmp; do + COMPREPLY+=( "$tmp" ) + done <<< "$x" + compopt -o nospace -o filenames + return + ;; + -r?*) + COMPREPLY=( $( compgen -P${cur:0:2} -W '- 0' -- "${cur:2}" ) ) + return + ;; + -scs*) + COMPREPLY=( $( compgen -P${cur:0:4} -W 'UTF-8 WIN DOS' \ + -- "${cur:4}" ) ) + return + ;; + -ssc?*) + COMPREPLY=( $( compgen -P${cur:0:4} -W '-' -- "${cur:4}" ) ) + return + ;; + -t*) + if [[ $mode == w ]]; then + COMPREPLY=( $( compgen -P${cur:0:2} -W '7z bzip2 gzip swfc + tar wim xz zip' -- "${cur:2}" ) ) + else + COMPREPLY=( $( compgen -P${cur:0:2} -W '7z apm arj bzip2 cab + chm cpio cramfs deb dmg elf fat flv gzip hfs iso lzh lzma + lzma86 macho mbr mslz mub nsis ntfs pe ppmd rar rpm + squashfs swf swfc tar udf vhd wim xar xz z zip' \ + -- "${cur:2}" ) ) + fi + return + ;; + -m*=*|-p*|-u*|-v*) + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '-ai -an -ao -ax -bd -i -m{x,s,f,he,hc,mt}= + -o -p -r -scs -sfx -si -slp -slt -so -ssc -t -u -v -w -x -y' \ + -- "$cur" ) ) + [[ $COMPREPLY == -@(an|bd|sfx|si|slt|so|ssc|[rwy]) ]] || + compopt -o nospace + return + fi + + local args + _count_args = + if [[ $args -eq 2 ]]; then + _filedir_xspec unzip + [[ $mode == w ]] && + _filedir '@(7z|bz2|swf|?(g)tar|?(t)[bglx]z|tb?(z)2|wim)' || + _filedir '@(7z|arj|bz2|cab|chm|cpio|deb|dmg|flv|gem|img|iso|lz[ah]|lzma?(86)|pmd|[rx]ar|rpm|sw[fm]|?(g)tar|taz|?(t)[bglx]z|tb?(z)2|vhd|wim|Z)' + else + if [[ ${words[1]} == d ]]; then + local IFS=$'\n' + COMPREPLY=( $( compgen -W "$( printf '%s\n' $( $1 l ${words[2]} \ + -slt 2>/dev/null | command sed -n '/^Path =/s/^Path = \(.*\)$/\1/p' \ + 2>/dev/null | tail -n+2 ) )" -- "$cur" ) ) + compopt -o filenames + else + _filedir + fi + fi +} && +complete -F _7z 7z 7za + +# ex: filetype=sh diff --git a/completions/Makefile.am b/completions/Makefile.am index f312b3a9..f04d7c36 100644 --- a/completions/Makefile.am +++ b/completions/Makefile.am @@ -1,12 +1,16 @@ bashcompdir = $(pkgdatadir)/completions -bashcomp_DATA = a2x \ +bashcomp_DATA = 2to3 \ + 7z \ + a2x \ abook \ aclocal \ acpi \ + adb \ add_members \ alias \ ant \ apache2ctl \ + appdata-validate \ apt-build \ apt-cache \ apt-get \ @@ -23,11 +27,13 @@ bashcomp_DATA = a2x \ autoscan \ avctrl \ badblocks \ + bind \ bk \ brctl \ btdownloadheadless.py \ + bts \ bzip2 \ - cal \ + _cal \ cancel \ cardctl \ ccache \ @@ -37,13 +43,15 @@ bashcomp_DATA = a2x \ change_pw \ check_db \ check_perms \ + checksec \ + _chfn \ chgrp \ chkconfig \ chown \ chpasswd \ chronyc \ chrpath \ - chsh \ + _chsh \ cksfv \ cleanarch \ clisp \ @@ -62,10 +70,11 @@ bashcomp_DATA = a2x \ cvs \ cvsps \ dd \ + deja-dup \ desktop-file-validate \ dhclient \ dict \ - dmesg \ + _dmesg \ dnsspoof \ dot \ dpkg \ @@ -76,7 +85,7 @@ bashcomp_DATA = a2x \ dumpe2fs \ e2freefrag \ e2label \ - eject \ + _eject \ eog \ ether-wake \ evince \ @@ -92,6 +101,8 @@ bashcomp_DATA = a2x \ filesnarf \ find \ find_member \ + flake8 \ + freebsd-update \ freeciv-gtk2 \ freeciv-server \ function \ @@ -104,7 +115,9 @@ bashcomp_DATA = a2x \ genisoimage \ getent \ gkrellm \ + gm \ gnatmake \ + gnokii \ gnome-mplayer \ gpasswd \ gpg \ @@ -120,12 +133,13 @@ bashcomp_DATA = a2x \ gzip \ hcitool \ hddtemp \ - hexdump \ + _hexdump \ hid2hci \ + hostname \ hping2 \ htop \ htpasswd \ - hwclock \ + _hwclock \ iconv \ id \ idn \ @@ -137,7 +151,7 @@ bashcomp_DATA = a2x \ installpkg \ interdiff \ invoke-rc.d \ - ionice \ + _ionice \ ip \ iperf \ ipmitool \ @@ -154,7 +168,9 @@ bashcomp_DATA = a2x \ jarsigner \ java \ javaws \ + jpegoptim \ jps \ + jshint \ k3b \ kcov \ kill \ @@ -177,7 +193,7 @@ bashcomp_DATA = a2x \ list_lists \ list_members \ list_owners \ - look \ + _look \ lpq \ lpr \ lrzip \ @@ -187,6 +203,7 @@ bashcomp_DATA = a2x \ luseradd \ luserdel \ lvm \ + lz4 \ lzip \ lzma \ lzop \ @@ -206,12 +223,15 @@ bashcomp_DATA = a2x \ mkinitrd \ mktemp \ mmsitepass \ + _mock \ modinfo \ modprobe \ + _modules \ monodevelop \ mount \ mount.linux \ mplayer \ + mr \ msynctool \ mtx \ munindoc \ @@ -225,20 +245,22 @@ bashcomp_DATA = a2x \ nc \ ncftp \ nethogs \ - newgrp \ + _newgrp \ newlist \ newusers \ ngrep \ nmap \ - nmcli \ + _nmcli \ nslookup \ ntpdate \ openssl \ opera \ + optipng \ p4 \ pack200 \ passwd \ patch \ + pdftotext \ perl \ pgrep \ pidof \ @@ -255,7 +277,9 @@ bashcomp_DATA = a2x \ pm-hibernate \ pm-is-supported \ pm-powersave \ + pngfix \ portinstall \ + portsnap \ portupgrade \ postcat \ postconf \ @@ -271,9 +295,12 @@ bashcomp_DATA = a2x \ pwd \ pwdx \ pwgen \ + py.test \ pydoc \ + pyflakes \ pylint \ python \ + pyvenv \ qdbus \ qemu \ qrunner \ @@ -283,9 +310,10 @@ bashcomp_DATA = a2x \ rdesktop \ remove_members \ removepkg \ - renice \ + _renice \ + _repomanage \ reportbug \ - reptyr \ + _reptyr \ resolvconf \ rfkill \ ri \ @@ -298,7 +326,8 @@ bashcomp_DATA = a2x \ rpmcheck \ rrdtool \ rsync \ - rtcwake \ + _rtcwake \ + _runuser \ sbcl \ sbopkg \ screen \ @@ -315,25 +344,33 @@ bashcomp_DATA = a2x \ ssh \ ssh-add \ ssh-copy-id \ + ssh-keygen \ sshfs \ sshmitm \ sshow \ strace \ strings \ - su \ + _su \ sudo \ svcadm \ svk \ + _svn \ + _svnadmin \ + _svnlook \ sync_members \ + synclient \ sysbench \ sysctl \ tar \ tcpdump \ tcpkill \ tcpnice \ + timeout \ + tipc \ tracepath \ tshark \ tune2fs \ + _udevadm \ umount \ umount.linux \ unace \ @@ -359,6 +396,7 @@ bashcomp_DATA = a2x \ withlist \ wodim \ wol \ + _write \ wsimport \ wtf \ wvdial \ @@ -377,13 +415,21 @@ bashcomp_DATA = a2x \ xz \ xzdec \ ypmatch \ - yum-arch + _yum \ + yum-arch \ + zopfli \ + zopflipng -EXTRA_DIST = $(bashcomp_DATA) \ - _mock _modules _subversion _udevadm _yum _yum-utils +EXTRA_DIST = $(bashcomp_DATA) CLEANFILES = \ + 7za \ + aclocal-1.10 \ aclocal-1.11 \ + aclocal-1.12 \ + aclocal-1.13 \ + aclocal-1.14 \ + aclocal-1.15 \ alpine \ alternatives \ animate \ @@ -391,9 +437,15 @@ CLEANFILES = \ arm-koji \ asciidoc.py \ autoheader \ + automake-1.10 \ automake-1.11 \ + automake-1.12 \ + automake-1.13 \ + automake-1.14 \ + automake-1.15 \ autossh \ autoupdate \ + bsdtar \ btdownloadcurses.py \ btdownloadgui.py \ c++ \ @@ -412,6 +464,7 @@ CLEANFILES = \ conjure \ cowthink \ createdb \ + createuser \ dcop \ declare \ dfutool \ @@ -420,14 +473,19 @@ CLEANFILES = \ dpkg-query \ dpkg-reconfigure \ dropdb \ + dropuser \ edquota \ + f77 \ + f95 \ filebucket \ freeciv-sdl \ freeciv-xaw \ g++ \ g4 \ g77 \ + g95 \ gcj \ + gfortran \ gkrellm2 \ gmake \ gmplayer \ @@ -469,9 +527,11 @@ CLEANFILES = \ lvresize \ lvs \ lvscan \ + lz4c \ mailsnarf \ mdecrypt \ mencoder \ + micropython \ mkisofs \ mogrify \ montage \ @@ -510,9 +570,18 @@ CLEANFILES = \ pvs \ pvscan \ pxz \ + py.test-2 \ + py.test-3 \ pydoc3 \ + pypy \ + pypy3 \ python2 \ python3 \ + pyvenv-3.4 \ + pyvenv-3.5 \ + qemu-kvm \ + qemu-system-i386 \ + qemu-system-x86_64 \ quotacheck \ quotaoff \ quotaon \ @@ -532,6 +601,7 @@ CLEANFILES = \ sdptool \ setquota \ sftp \ + sidedoor \ slogin \ smbcacls \ smbcquotas \ @@ -541,6 +611,7 @@ CLEANFILES = \ smbtree \ sparc-koji \ spovray \ + star \ stream \ sudoedit \ tightvncviewer \ @@ -571,7 +642,12 @@ CLEANFILES = \ ypcat symlinks: $(targetdir) $(DATA) - for file in aclocal-1.11 ; do \ + for file in 7za ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) 7z $(targetdir)/$$file ; \ + done + for file in aclocal-1.10 aclocal-1.11 aclocal-1.12 aclocal-1.13 \ + aclocal-1.14 aclocal-1.15 ; do \ rm -f $(targetdir)/$$file && \ $(LN_S) aclocal $(targetdir)/$$file ; \ done @@ -583,7 +659,8 @@ symlinks: $(targetdir) $(DATA) rm -f $(targetdir)/$$file && \ $(LN_S) asciidoc $(targetdir)/$$file ; \ done - for file in automake-1.11 ; do \ + for file in automake-1.10 automake-1.11 automake-1.12 automake-1.13 \ + automake-1.14 automake-1.15 ; do \ rm -f $(targetdir)/$$file && \ $(LN_S) automake $(targetdir)/$$file ; \ done @@ -605,7 +682,7 @@ symlinks: $(targetdir) $(DATA) done for file in ncal ; do \ rm -f $(targetdir)/$$file && \ - $(LN_S) cal $(targetdir)/$$file ; \ + $(LN_S) _cal $(targetdir)/$$file ; \ done for file in pccardctl ; do \ rm -f $(targetdir)/$$file && \ @@ -648,7 +725,7 @@ symlinks: $(targetdir) $(DATA) rm -f $(targetdir)/$$file && \ $(LN_S) function $(targetdir)/$$file ; \ done - for file in g++ c++ g77 gcj gpc cc ; do \ + for file in cc c++ g++ gfortran f77 g77 f95 g95 gcj gpc ; do \ rm -f $(targetdir)/$$file && \ $(LN_S) gcc $(targetdir)/$$file ; \ done @@ -671,7 +748,7 @@ symlinks: $(targetdir) $(DATA) done for file in hd ; do \ rm -f $(targetdir)/$$file && \ - $(LN_S) hexdump $(targetdir)/$$file ; \ + $(LN_S) _hexdump $(targetdir)/$$file ; \ done for file in hping hping3 ; do \ rm -f $(targetdir)/$$file && \ @@ -719,6 +796,10 @@ symlinks: $(targetdir) $(DATA) rm -f $(targetdir)/$$file && \ $(LN_S) lvm $(targetdir)/$$file ; \ done + for file in lz4c ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) lz4 $(targetdir)/$$file ; \ + done for file in clzip pdlzip plzip ; do \ rm -f $(targetdir)/$$file && \ $(LN_S) lzip $(targetdir)/$$file ; \ @@ -775,7 +856,7 @@ symlinks: $(targetdir) $(DATA) rm -f $(targetdir)/$$file && \ $(LN_S) pm-hibernate $(targetdir)/$$file ; \ done - for file in createdb dropdb ; do \ + for file in createdb createuser dropdb dropuser ; do \ rm -f $(targetdir)/$$file && \ $(LN_S) psql $(targetdir)/$$file ; \ done @@ -792,18 +873,30 @@ symlinks: $(targetdir) $(DATA) rm -f $(targetdir)/$$file && \ $(LN_S) puppet $(targetdir)/$$file ; \ done + for file in py.test-2 py.test-3 ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) py.test $(targetdir)/$$file ; \ + done for file in pydoc3 ; do \ rm -f $(targetdir)/$$file && \ $(LN_S) pydoc $(targetdir)/$$file ; \ done - for file in python2 python3 ; do \ + for file in pypy pypy3 python2 python3 micropython ; do \ rm -f $(targetdir)/$$file && \ $(LN_S) python $(targetdir)/$$file ; \ done + for file in pyvenv-3.4 pyvenv-3.5 ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) pyvenv $(targetdir)/$$file ; \ + done for file in dcop ; do \ rm -f $(targetdir)/$$file && \ $(LN_S) qdbus $(targetdir)/$$file ; \ done + for file in qemu-kvm qemu-system-i386 qemu-system-x86_64 ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) qemu $(targetdir)/$$file ; \ + done for file in setquota edquota quotacheck repquota quotaon quotaoff ; do \ rm -f $(targetdir)/$$file && \ $(LN_S) quota $(targetdir)/$$file ; \ @@ -828,7 +921,7 @@ symlinks: $(targetdir) $(DATA) rm -f $(targetdir)/$$file && \ $(LN_S) sbcl $(targetdir)/$$file ; \ done - for file in slogin autossh sftp scp ; do \ + for file in slogin autossh sftp scp sidedoor ; do \ rm -f $(targetdir)/$$file && \ $(LN_S) ssh $(targetdir)/$$file ; \ done @@ -871,3 +964,11 @@ all-local: symlinks install-data-local: targetdir = $(DESTDIR)$(bashcompdir) install-data-local: symlinks + +check-local: + ret=0 + for file in $(bashcomp_DATA) ; do \ + $${bashcomp_bash:-$${BASH:-bash}} \ + -O extglob -n $$file || ret=$$? ; \ + done ; \ + exit $$ret diff --git a/completions/Makefile.in b/completions/Makefile.in deleted file mode 100644 index fef6ebc6..00000000 --- a/completions/Makefile.in +++ /dev/null @@ -1,1258 +0,0 @@ -# Makefile.in generated by automake 1.11.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software -# Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -VPATH = @srcdir@ -am__make_dryrun = \ - { \ - am__dry=no; \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ - | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ - *) \ - for am__flg in $$MAKEFLAGS; do \ - case $$am__flg in \ - *=*|--*) ;; \ - *n*) am__dry=yes; break;; \ - esac; \ - done;; \ - esac; \ - test $$am__dry = yes; \ - } -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -subdir = completions -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -SOURCES = -DIST_SOURCES = -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; -am__install_max = 40 -am__nobase_strip_setup = \ - srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` -am__nobase_strip = \ - for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" -am__nobase_list = $(am__nobase_strip_setup); \ - for p in $$list; do echo "$$p $$p"; done | \ - sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ - $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ - if (++n[$$2] == $(am__install_max)) \ - { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ - END { for (dir in files) print dir, files[dir] }' -am__base_list = \ - sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ - sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' -am__uninstall_files_from_dir = { \ - test -z "$$files" \ - || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ - || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ - $(am__cd) "$$dir" && rm -f $$files; }; \ - } -am__installdirs = "$(DESTDIR)$(bashcompdir)" -DATA = $(bashcomp_DATA) -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MKDIR_P = @MKDIR_P@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -am__leading_dot = @am__leading_dot@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build_alias = @build_alias@ -builddir = @builddir@ -compatdir = @compatdir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host_alias = @host_alias@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -bashcompdir = $(pkgdatadir)/completions -bashcomp_DATA = a2x \ - abook \ - aclocal \ - acpi \ - add_members \ - alias \ - ant \ - apache2ctl \ - apt-build \ - apt-cache \ - apt-get \ - aptitude \ - arch \ - arping \ - arpspoof \ - asciidoc \ - aspell \ - autoconf \ - automake \ - autoreconf \ - autorpm \ - autoscan \ - avctrl \ - badblocks \ - bk \ - brctl \ - btdownloadheadless.py \ - bzip2 \ - cal \ - cancel \ - cardctl \ - ccache \ - cfagent \ - cfrun \ - chage \ - change_pw \ - check_db \ - check_perms \ - chgrp \ - chkconfig \ - chown \ - chpasswd \ - chronyc \ - chrpath \ - chsh \ - cksfv \ - cleanarch \ - clisp \ - clone_member \ - complete \ - config_list \ - configure \ - convert \ - cowsay \ - cpan2dist \ - cpio \ - cppcheck \ - crontab \ - cryptsetup \ - curl \ - cvs \ - cvsps \ - dd \ - desktop-file-validate \ - dhclient \ - dict \ - dmesg \ - dnsspoof \ - dot \ - dpkg \ - dpkg-source \ - dselect \ - dsniff \ - dumpdb \ - dumpe2fs \ - e2freefrag \ - e2label \ - eject \ - eog \ - ether-wake \ - evince \ - explodepkg \ - export \ - faillog \ - fbgs \ - fbi \ - feh \ - file \ - file-roller \ - filefrag \ - filesnarf \ - find \ - find_member \ - freeciv-gtk2 \ - freeciv-server \ - function \ - fusermount \ - gcc \ - gcl \ - gdb \ - genaliases \ - gendiff \ - genisoimage \ - getent \ - gkrellm \ - gnatmake \ - gnome-mplayer \ - gpasswd \ - gpg \ - gpg2 \ - gphoto2 \ - gprof \ - groupadd \ - groupdel \ - groupmems \ - groupmod \ - growisofs \ - grpck \ - gzip \ - hcitool \ - hddtemp \ - hexdump \ - hid2hci \ - hping2 \ - htop \ - htpasswd \ - hwclock \ - iconv \ - id \ - idn \ - iftop \ - ifup \ - info \ - inject \ - insmod \ - installpkg \ - interdiff \ - invoke-rc.d \ - ionice \ - ip \ - iperf \ - ipmitool \ - ipsec \ - iptables \ - ipv6calc \ - iscsiadm \ - isql \ - iwconfig \ - iwlist \ - iwpriv \ - iwspy \ - jar \ - jarsigner \ - java \ - javaws \ - jps \ - k3b \ - kcov \ - kill \ - killall \ - kldload \ - kldunload \ - koji \ - ktutil \ - larch \ - lastlog \ - ldapsearch \ - ldapvi \ - lftp \ - lftpget \ - lilo \ - links \ - lintian \ - lisp \ - list_admins \ - list_lists \ - list_members \ - list_owners \ - look \ - lpq \ - lpr \ - lrzip \ - lsof \ - lua \ - luac \ - luseradd \ - luserdel \ - lvm \ - lzip \ - lzma \ - lzop \ - macof \ - mailmanctl \ - make \ - makepkg \ - man \ - mc \ - mcrypt \ - mdadm \ - mdtool \ - medusa \ - mii-diag \ - mii-tool \ - minicom \ - mkinitrd \ - mktemp \ - mmsitepass \ - modinfo \ - modprobe \ - monodevelop \ - mount \ - mount.linux \ - mplayer \ - msynctool \ - mtx \ - munindoc \ - munin-node-configure \ - munin-run \ - munin-update \ - mussh \ - mutt \ - mysql \ - mysqladmin \ - nc \ - ncftp \ - nethogs \ - newgrp \ - newlist \ - newusers \ - ngrep \ - nmap \ - nmcli \ - nslookup \ - ntpdate \ - openssl \ - opera \ - p4 \ - pack200 \ - passwd \ - patch \ - perl \ - pgrep \ - pidof \ - pine \ - ping \ - pkg-config \ - pkg-get \ - pkg_delete \ - pkgadd \ - pkgrm \ - pkgtool \ - pkgutil \ - plague-client \ - pm-hibernate \ - pm-is-supported \ - pm-powersave \ - portinstall \ - portupgrade \ - postcat \ - postconf \ - postfix \ - postmap \ - postsuper \ - povray \ - prelink \ - protoc \ - psql \ - puppet \ - pwck \ - pwd \ - pwdx \ - pwgen \ - pydoc \ - pylint \ - python \ - qdbus \ - qemu \ - qrunner \ - querybts \ - quota \ - rcs \ - rdesktop \ - remove_members \ - removepkg \ - renice \ - reportbug \ - reptyr \ - resolvconf \ - rfkill \ - ri \ - rmlist \ - rmmod \ - route \ - rpcdebug \ - rpm \ - rpm2tgz \ - rpmcheck \ - rrdtool \ - rsync \ - rtcwake \ - sbcl \ - sbopkg \ - screen \ - sh \ - sitecopy \ - slackpkg \ - slapt-get \ - slapt-src \ - smartctl \ - smbclient \ - snownews \ - sqlite3 \ - ss \ - ssh \ - ssh-add \ - ssh-copy-id \ - sshfs \ - sshmitm \ - sshow \ - strace \ - strings \ - su \ - sudo \ - svcadm \ - svk \ - sync_members \ - sysbench \ - sysctl \ - tar \ - tcpdump \ - tcpkill \ - tcpnice \ - tracepath \ - tshark \ - tune2fs \ - umount \ - umount.linux \ - unace \ - unpack200 \ - unrar \ - unshunt \ - update-alternatives \ - update-rc.d \ - upgradepkg \ - urlsnarf \ - useradd \ - userdel \ - usermod \ - valgrind \ - vipw \ - vmstat \ - vncviewer \ - vpnc \ - watch \ - webmitm \ - wget \ - wine \ - withlist \ - wodim \ - wol \ - wsimport \ - wtf \ - wvdial \ - xfreerdp \ - xgamma \ - xhost \ - xm \ - xmllint \ - xmlwf \ - xmms \ - xmodmap \ - xrandr \ - xrdb \ - xsltproc \ - xxd \ - xz \ - xzdec \ - ypmatch \ - yum-arch - -EXTRA_DIST = $(bashcomp_DATA) \ - _mock _modules _subversion _udevadm _yum _yum-utils - -CLEANFILES = \ - aclocal-1.11 \ - alpine \ - alternatives \ - animate \ - apropos \ - arm-koji \ - asciidoc.py \ - autoheader \ - automake-1.11 \ - autossh \ - autoupdate \ - btdownloadcurses.py \ - btdownloadgui.py \ - c++ \ - cc \ - cdrecord \ - ci \ - ciptool \ - civclient \ - civserver \ - clzip \ - co \ - colormake \ - compare \ - compgen \ - composite \ - conjure \ - cowthink \ - createdb \ - dcop \ - declare \ - dfutool \ - display \ - dpkg-deb \ - dpkg-query \ - dpkg-reconfigure \ - dropdb \ - edquota \ - filebucket \ - freeciv-sdl \ - freeciv-xaw \ - g++ \ - g4 \ - g77 \ - gcj \ - gkrellm2 \ - gmake \ - gmplayer \ - gnumake \ - gpc \ - hciattach \ - hciconfig \ - hd \ - host \ - hping \ - hping3 \ - identify \ - ifdown \ - ifstatus \ - import \ - insmod.static \ - javac \ - javadoc \ - kplayer \ - l2ping \ - lbzip2 \ - ldapadd \ - ldapcompare \ - ldapdelete \ - ldapmodify \ - ldapmodrdn \ - ldappasswd \ - ldapwhoami \ - lintian-info \ - lusermod \ - lvchange \ - lvcreate \ - lvdisplay \ - lvextend \ - lvmdiskscan \ - lvreduce \ - lvremove \ - lvrename \ - lvresize \ - lvs \ - lvscan \ - mailsnarf \ - mdecrypt \ - mencoder \ - mkisofs \ - mogrify \ - montage \ - mplayer2 \ - msgsnarf \ - muttng \ - ncal \ - pbzip2 \ - pccardctl \ - pdlzip \ - perldoc \ - phing \ - pigz \ - pinfo \ - ping6 \ - pkg_deinstall \ - pkg_info \ - pkill \ - plzip \ - pm-suspend \ - pm-suspend-hybrid \ - pmake \ - postalias \ - ppc-koji \ - puppetca \ - puppetd \ - puppetdoc \ - puppetmasterd \ - puppetqd \ - puppetrun \ - pvchange \ - pvcreate \ - pvdisplay \ - pvmove \ - pvremove \ - pvs \ - pvscan \ - pxz \ - pydoc3 \ - python2 \ - python3 \ - quotacheck \ - quotaoff \ - quotaon \ - ralsh \ - rcsdiff \ - rdict \ - repquota \ - rfcomm \ - rlog \ - rpm2targz \ - rpm2txz \ - rpmbuild \ - rpmbuild-md5 \ - s390-koji \ - sbcl-mt \ - scp \ - sdptool \ - setquota \ - sftp \ - slogin \ - smbcacls \ - smbcquotas \ - smbget \ - smbpasswd \ - smbtar \ - smbtree \ - sparc-koji \ - spovray \ - stream \ - sudoedit \ - tightvncviewer \ - tracepath6 \ - typeset \ - vgcfgbackup \ - vgcfgrestore \ - vgchange \ - vgck \ - vgconvert \ - vgcreate \ - vgdisplay \ - vgexport \ - vgextend \ - vgimport \ - vgmerge \ - vgmknodes \ - vgreduce \ - vgremove \ - vgrename \ - vgs \ - vgscan \ - vgsplit \ - vigr \ - whatis \ - xpovray \ - xvnc4viewer \ - ypcat - -all: all-am - -.SUFFIXES: -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign completions/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --foreign completions/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): -install-bashcompDATA: $(bashcomp_DATA) - @$(NORMAL_INSTALL) - @list='$(bashcomp_DATA)'; test -n "$(bashcompdir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(bashcompdir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(bashcompdir)" || exit 1; \ - fi; \ - for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - echo "$$d$$p"; \ - done | $(am__base_list) | \ - while read files; do \ - echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(bashcompdir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(bashcompdir)" || exit $$?; \ - done - -uninstall-bashcompDATA: - @$(NORMAL_UNINSTALL) - @list='$(bashcomp_DATA)'; test -n "$(bashcompdir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - dir='$(DESTDIR)$(bashcompdir)'; $(am__uninstall_files_from_dir) -tags: TAGS -TAGS: - -ctags: CTAGS -CTAGS: - - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(DATA) all-local -installdirs: - for dir in "$(DESTDIR)$(bashcompdir)"; do \ - test -z "$$dir" || $(MKDIR_P) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - if test -z '$(STRIP)'; then \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - install; \ - else \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ - fi -mostlyclean-generic: - -clean-generic: - -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic mostlyclean-am - -distclean: distclean-am - -rm -f Makefile -distclean-am: clean-am distclean-generic - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: install-bashcompDATA install-data-local - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: - -install-html: install-html-am - -install-html-am: - -install-info: install-info-am - -install-info-am: - -install-man: - -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-generic - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-bashcompDATA - -.MAKE: install-am install-strip - -.PHONY: all all-am all-local check check-am clean clean-generic \ - distclean distclean-generic distdir dvi dvi-am html html-am \ - info info-am install install-am install-bashcompDATA \ - install-data install-data-am install-data-local install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-info install-info-am install-man \ - install-pdf install-pdf-am install-ps install-ps-am \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am \ - uninstall-bashcompDATA - - -symlinks: $(targetdir) $(DATA) - for file in aclocal-1.11 ; do \ - rm -f $(targetdir)/$$file && \ - $(LN_S) aclocal $(targetdir)/$$file ; \ - done - for file in phing ; do \ - rm -f $(targetdir)/$$file && \ - $(LN_S) ant $(targetdir)/$$file ; \ - done - for file in asciidoc.py ; do \ - rm -f $(targetdir)/$$file && \ - $(LN_S) asciidoc $(targetdir)/$$file ; \ - done - for file in automake-1.11 ; do \ - rm -f $(targetdir)/$$file && \ - $(LN_S) automake $(targetdir)/$$file ; \ - done - for file in autoheader ; do \ - rm -f $(targetdir)/$$file && \ - $(LN_S) autoreconf $(targetdir)/$$file ; \ - done - for file in autoupdate ; do \ - rm -f $(targetdir)/$$file && \ - $(LN_S) autoscan $(targetdir)/$$file ; \ - done - for file in btdownloadcurses.py btdownloadgui.py ; do \ - rm -f $(targetdir)/$$file && \ - $(LN_S) btdownloadheadless.py $(targetdir)/$$file ; \ - done - for file in lbzip2 pbzip2 ; do \ - rm -f $(targetdir)/$$file && \ - $(LN_S) bzip2 $(targetdir)/$$file ; \ - done - for file in ncal ; do \ - rm -f $(targetdir)/$$file && \ - $(LN_S) cal $(targetdir)/$$file ; \ - done - for file in pccardctl ; do \ - rm -f $(targetdir)/$$file && \ - $(LN_S) cardctl $(targetdir)/$$file ; \ - done - for file in compgen ; do \ - rm -f $(targetdir)/$$file && \ - $(LN_S) complete $(targetdir)/$$file ; \ - done - for file in mogrify display animate identify montage composite \ - compare conjure import stream ; do \ - rm -f $(targetdir)/$$file && \ - $(LN_S) convert $(targetdir)/$$file ; \ - done - for file in cowthink ; do \ - rm -f $(targetdir)/$$file && \ - $(LN_S) cowsay $(targetdir)/$$file ; \ - done - for file in rdict ; do \ - rm -f $(targetdir)/$$file && \ - $(LN_S) dict $(targetdir)/$$file ; \ - done - for file in dpkg-deb dpkg-query dpkg-reconfigure ; do \ - rm -f $(targetdir)/$$file && \ - $(LN_S) dpkg $(targetdir)/$$file ; \ - done - for file in mailsnarf msgsnarf ; do \ - rm -f $(targetdir)/$$file && \ - $(LN_S) filesnarf $(targetdir)/$$file ; \ - done - for file in civclient freeciv-sdl freeciv-xaw ; do \ - rm -f $(targetdir)/$$file && \ - $(LN_S) freeciv-gtk2 $(targetdir)/$$file ; \ - done - for file in civserver ; do \ - rm -f $(targetdir)/$$file && \ - $(LN_S) freeciv-server $(targetdir)/$$file ; \ - done - for file in declare typeset ; do \ - rm -f $(targetdir)/$$file && \ - $(LN_S) function $(targetdir)/$$file ; \ - done - for file in g++ c++ g77 gcj gpc cc ; do \ - rm -f $(targetdir)/$$file && \ - $(LN_S) gcc $(targetdir)/$$file ; \ - done - for file in mkisofs ; do \ - rm -f $(targetdir)/$$file && \ - $(LN_S) genisoimage $(targetdir)/$$file ; \ - done - for file in gkrellm2 ; do \ - rm -f $(targetdir)/$$file && \ - $(LN_S) gkrellm $(targetdir)/$$file ; \ - done - for file in pigz ; do \ - rm -f $(targetdir)/$$file && \ - $(LN_S) gzip $(targetdir)/$$file ; \ - done - for file in sdptool l2ping rfcomm ciptool dfutool hciconfig \ - hciattach ; do \ - rm -f $(targetdir)/$$file && \ - $(LN_S) hcitool $(targetdir)/$$file ; \ - done - for file in hd ; do \ - rm -f $(targetdir)/$$file && \ - $(LN_S) hexdump $(targetdir)/$$file ; \ - done - for file in hping hping3 ; do \ - rm -f $(targetdir)/$$file && \ - $(LN_S) hping2 $(targetdir)/$$file ; \ - done - for file in ifdown ifstatus ; do \ - rm -f $(targetdir)/$$file && \ - $(LN_S) ifup $(targetdir)/$$file ; \ - done - for file in pinfo ; do \ - rm -f $(targetdir)/$$file && \ - $(LN_S) info $(targetdir)/$$file ; \ - done - for file in insmod.static ; do \ - rm -f $(targetdir)/$$file && \ - $(LN_S) insmod $(targetdir)/$$file ; \ - done - for file in javac javadoc ; do \ - rm -f $(targetdir)/$$file && \ - $(LN_S) java $(targetdir)/$$file ; \ - done - for file in arm-koji ppc-koji s390-koji sparc-koji ; do \ - rm -f $(targetdir)/$$file && \ - $(LN_S) koji $(targetdir)/$$file ; \ - done - for file in ldapadd ldapmodify ldapdelete ldapcompare ldapmodrdn \ - ldapwhoami ldappasswd ; do \ - rm -f $(targetdir)/$$file && \ - $(LN_S) ldapsearch $(targetdir)/$$file ; \ - done - for file in lintian-info ; do \ - rm -f $(targetdir)/$$file && \ - $(LN_S) lintian $(targetdir)/$$file ; \ - done - for file in lusermod ; do \ - rm -f $(targetdir)/$$file && \ - $(LN_S) luseradd $(targetdir)/$$file ; \ - done - for file in lvmdiskscan pvscan pvs pvdisplay pvchange pvcreate pvmove \ - pvremove vgscan vgs vgdisplay vgchange vgremove vgrename \ - vgreduce vgextend vgimport vgexport vgck vgconvert vgcreate \ - vgcfgbackup vgcfgrestore vgmerge vgsplit vgmknodes lvscan lvs \ - lvdisplay lvchange lvcreate lvremove lvrename lvreduce \ - lvresize lvextend ; do \ - rm -f $(targetdir)/$$file && \ - $(LN_S) lvm $(targetdir)/$$file ; \ - done - for file in clzip pdlzip plzip ; do \ - rm -f $(targetdir)/$$file && \ - $(LN_S) lzip $(targetdir)/$$file ; \ - done - for file in colormake gmake gnumake pmake ; do \ - rm -f $(targetdir)/$$file && \ - $(LN_S) make $(targetdir)/$$file ; \ - done - for file in apropos whatis ; do \ - rm -f $(targetdir)/$$file && \ - $(LN_S) man $(targetdir)/$$file ; \ - done - for file in mdecrypt ; do \ - rm -f $(targetdir)/$$file && \ - $(LN_S) mcrypt $(targetdir)/$$file ; \ - done - for file in mplayer2 mencoder gmplayer kplayer ; do \ - rm -f $(targetdir)/$$file && \ - $(LN_S) mplayer $(targetdir)/$$file ; \ - done - for file in muttng ; do \ - rm -f $(targetdir)/$$file && \ - $(LN_S) mutt $(targetdir)/$$file ; \ - done - for file in host ; do \ - rm -f $(targetdir)/$$file && \ - $(LN_S) nslookup $(targetdir)/$$file ; \ - done - for file in g4 ; do \ - rm -f $(targetdir)/$$file && \ - $(LN_S) p4 $(targetdir)/$$file ; \ - done - for file in perldoc ; do \ - rm -f $(targetdir)/$$file && \ - $(LN_S) perl $(targetdir)/$$file ; \ - done - for file in alpine ; do \ - rm -f $(targetdir)/$$file && \ - $(LN_S) pine $(targetdir)/$$file ; \ - done - for file in ping6 ; do \ - rm -f $(targetdir)/$$file && \ - $(LN_S) ping $(targetdir)/$$file ; \ - done - for file in pkg_info pkg_deinstall ; do \ - rm -f $(targetdir)/$$file && \ - $(LN_S) pkg_delete $(targetdir)/$$file ; \ - done - for file in pkill ; do \ - rm -f $(targetdir)/$$file && \ - $(LN_S) pgrep $(targetdir)/$$file ; \ - done - for file in pm-suspend pm-suspend-hybrid ; do \ - rm -f $(targetdir)/$$file && \ - $(LN_S) pm-hibernate $(targetdir)/$$file ; \ - done - for file in createdb dropdb ; do \ - rm -f $(targetdir)/$$file && \ - $(LN_S) psql $(targetdir)/$$file ; \ - done - for file in postalias ; do \ - rm -f $(targetdir)/$$file && \ - $(LN_S) postmap $(targetdir)/$$file ; \ - done - for file in xpovray spovray ; do \ - rm -f $(targetdir)/$$file && \ - $(LN_S) povray $(targetdir)/$$file ; \ - done - for file in puppetmasterd puppetd puppetca ralsh puppetrun puppetqd \ - filebucket puppetdoc ; do \ - rm -f $(targetdir)/$$file && \ - $(LN_S) puppet $(targetdir)/$$file ; \ - done - for file in pydoc3 ; do \ - rm -f $(targetdir)/$$file && \ - $(LN_S) pydoc $(targetdir)/$$file ; \ - done - for file in python2 python3 ; do \ - rm -f $(targetdir)/$$file && \ - $(LN_S) python $(targetdir)/$$file ; \ - done - for file in dcop ; do \ - rm -f $(targetdir)/$$file && \ - $(LN_S) qdbus $(targetdir)/$$file ; \ - done - for file in setquota edquota quotacheck repquota quotaon quotaoff ; do \ - rm -f $(targetdir)/$$file && \ - $(LN_S) quota $(targetdir)/$$file ; \ - done - for file in ci co rlog rcsdiff ; do \ - rm -f $(targetdir)/$$file && \ - $(LN_S) rcs $(targetdir)/$$file ; \ - done - for file in rpmbuild rpmbuild-md5 ; do \ - rm -f $(targetdir)/$$file && \ - $(LN_S) rpm $(targetdir)/$$file ; \ - done - for file in rpm2txz rpm2targz ; do \ - rm -f $(targetdir)/$$file && \ - $(LN_S) rpm2tgz $(targetdir)/$$file ; \ - done - for file in smbget smbcacls smbcquotas smbpasswd smbtar smbtree ; do \ - rm -f $(targetdir)/$$file && \ - $(LN_S) smbclient $(targetdir)/$$file ; \ - done - for file in sbcl-mt ; do \ - rm -f $(targetdir)/$$file && \ - $(LN_S) sbcl $(targetdir)/$$file ; \ - done - for file in slogin autossh sftp scp ; do \ - rm -f $(targetdir)/$$file && \ - $(LN_S) ssh $(targetdir)/$$file ; \ - done - for file in sudoedit ; do \ - rm -f $(targetdir)/$$file && \ - $(LN_S) sudo $(targetdir)/$$file ; \ - done - for file in tracepath6 ; do \ - rm -f $(targetdir)/$$file && \ - $(LN_S) tracepath $(targetdir)/$$file ; \ - done - for file in alternatives ; do \ - rm -f $(targetdir)/$$file && \ - $(LN_S) update-alternatives $(targetdir)/$$file ; \ - done - for file in vigr ; do \ - rm -f $(targetdir)/$$file && \ - $(LN_S) vipw $(targetdir)/$$file ; \ - done - for file in tightvncviewer xvnc4viewer ; do \ - rm -f $(targetdir)/$$file && \ - $(LN_S) vncviewer $(targetdir)/$$file ; \ - done - for file in cdrecord ; do \ - rm -f $(targetdir)/$$file && \ - $(LN_S) wodim $(targetdir)/$$file ; \ - done - for file in pxz ; do \ - rm -f $(targetdir)/$$file && \ - $(LN_S) xz $(targetdir)/$$file ; \ - done - for file in ypcat ; do \ - rm -f $(targetdir)/$$file && \ - $(LN_S) ypmatch $(targetdir)/$$file ; \ - done -.PHONY: symlinks - -all-local: targetdir = . -all-local: symlinks - -install-data-local: targetdir = $(DESTDIR)$(bashcompdir) -install-data-local: symlinks - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/completions/_cal b/completions/_cal new file mode 100644 index 00000000..dfe49903 --- /dev/null +++ b/completions/_cal @@ -0,0 +1,37 @@ +# cal(1) completion -*- shell-script -*- + +# Use of this file is deprecated on Linux. Upstream completion is +# available in util-linux >= 2.23, use that instead. + +_cal() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -m) + if [[ $OSTYPE == *bsd* ]]; then + COMPREPLY=( $( compgen -W '{1..12}' -- "$cur" ) ) + return + fi + ;; + -s) + [[ $OSTYPE == *bsd* ]] && return + ;; + -A|-B|-d|-H) + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + return + fi + + local args + _count_args + [[ $args -eq 1 ]] && COMPREPLY=( $( compgen -W '{1..12}' -- "$cur" ) ) +} && +complete -F _cal cal ncal + +# ex: filetype=sh diff --git a/completions/_chfn b/completions/_chfn new file mode 100644 index 00000000..334967fa --- /dev/null +++ b/completions/_chfn @@ -0,0 +1,8 @@ +# chfn(1) completion -*- shell-script -*- + +# Use of this file is deprecated on Linux. Upstream completion is +# available in util-linux >= 2.23, use that instead. + +complete -u chfn + +# ex: filetype=sh diff --git a/completions/_chsh b/completions/_chsh new file mode 100644 index 00000000..88e8522e --- /dev/null +++ b/completions/_chsh @@ -0,0 +1,30 @@ +# chsh(1) completion -*- shell-script -*- + +# Use of this file is deprecated on Linux. Upstream completion is +# available in util-linux >= 2.23, use that instead. + +_chsh() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --list-shells|--help|-v|--version) + return + ;; + -s|--shell) + _shells + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + else + _allowed_users + fi + +} && +complete -F _chsh chsh + +# ex: filetype=sh diff --git a/completions/_dmesg b/completions/_dmesg new file mode 100644 index 00000000..2ca7fdf1 --- /dev/null +++ b/completions/_dmesg @@ -0,0 +1,34 @@ +# dmesg(1) completion -*- shell-script -*- + +# Use of this file is deprecated on Linux. Upstream completion is +# available in util-linux >= 2.23, use that instead. + +_dmesg() +{ + [[ $OSTYPE == *solaris* ]] && return # no args there + + local cur prev words cword + _init_completion || return + + case $prev in + -h|--help|-V|--version|-s|--buffer-size|-M|-N) + return + ;; + -f|--facility) + COMPREPLY=( $( compgen -W 'kern user mail daemon auth syslog lpr + news' -- "$cur" ) ) + return + ;; + -l|--level|-n|--console-level) + COMPREPLY=( $( compgen -W '{1..8}' -- "$cur" ) ) + return + ;; + esac + + local opts=$( _parse_help "$1" ) + [[ $opts ]] || opts=$( _parse_usage "$1" ) + COMPREPLY=( $( compgen -W "$opts" -- "$cur" ) ) +} && +complete -F _dmesg dmesg + +# ex: filetype=sh diff --git a/completions/_eject b/completions/_eject new file mode 100644 index 00000000..8f800f15 --- /dev/null +++ b/completions/_eject @@ -0,0 +1,33 @@ +# bash completion for eject(1) -*- shell-script -*- + +# Use of this file is deprecated on Linux. Upstream completion is +# available in util-linux >= 2.23, use that instead. + +_eject() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -h|--help|-V|--version|-c|--changerslot|-x|--cdspeed) + return + ;; + -a|--auto|-i|--manualeject) + COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) ) + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + return + elif [[ $prev == @(-d|--default) ]]; then + return + fi + + _cd_devices + _dvd_devices +} && +complete -F _eject eject + +# ex: filetype=sh diff --git a/completions/_hexdump b/completions/_hexdump new file mode 100644 index 00000000..ed5cb08b --- /dev/null +++ b/completions/_hexdump @@ -0,0 +1,32 @@ +# hexdump(1) completion -*- shell-script -*- + +# Use of this file is deprecated on Linux. Upstream completion is +# available in util-linux >= 2.23, use that instead. + +_hexdump() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -V|-e|-n|-s) + return + ;; + -f) + _filedir + return + ;; + esac + + if [[ $cur == -* ]]; then + local opts="$( _parse_help "$1" )" + [[ $opts ]] || opts="$( _parse_usage "$1" )" + COMPREPLY=( $( compgen -W "$opts" -- "$cur" ) ) + return + fi + + _filedir +} && +complete -F _hexdump hexdump hd + +# ex: filetype=sh diff --git a/completions/_hwclock b/completions/_hwclock new file mode 100644 index 00000000..2d190283 --- /dev/null +++ b/completions/_hwclock @@ -0,0 +1,26 @@ +# hwclock(8) completion -*- shell-script -*- + +# Use of this file is deprecated. Upstream completion is available in +# util-linux >= 2.23, use that instead. + +_hwclock() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -h|--help|-V|--version|--date|--epoch) + return + ;; + -f|--rtc|--adjfile) + _filedir + return + ;; + esac + + COMPREPLY=( + $( PATH="$PATH:/sbin" compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) +} && +complete -F _hwclock hwclock + +# ex: filetype=sh diff --git a/completions/_ionice b/completions/_ionice new file mode 100644 index 00000000..9b378ee8 --- /dev/null +++ b/completions/_ionice @@ -0,0 +1,60 @@ +# ionice(1) completion -*- shell-script -*- + +# Use of this file is deprecated. Upstream completion is available in +# util-linux >= 2.23, use that instead. + +_ionice() +{ + local cur prev words cword + _init_completion || return + + local offset=0 i + for (( i=1; i <= cword; i++ )); do + case ${words[i]} in + -h) + return + ;; + -p) + offset=0 + break + ;; + -c|-n) + (( i++ )) + continue + ;; + -*) + continue + ;; + esac + offset=$i + break + done + + if [[ $offset -gt 0 ]]; then + _command_offset $offset + return + fi + + case $prev in + -c) + COMPREPLY=( $( compgen -W '{0..3}' -- "$cur" ) ) + return + ;; + -n) + COMPREPLY=( $( compgen -W '{0..7}' -- "$cur" ) ) + return + ;; + -p) + _pids + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" -h )' -- "$cur" ) ) + return + fi +} && +complete -F _ionice ionice + +# ex: filetype=sh diff --git a/completions/_look b/completions/_look new file mode 100644 index 00000000..6ea41cce --- /dev/null +++ b/completions/_look @@ -0,0 +1,17 @@ +# look(1) completion -*- shell-script -*- + +# Use of this file is deprecated on Linux. Upstream completion is +# available in util-linux >= 2.23, use that instead. + +_look() +{ + local cur prev words cword + _init_completion || return + + if [[ $cword -eq 1 ]]; then + COMPREPLY=( $( compgen -W '$(look "$cur" 2>/dev/null)' -- "$cur" ) ) + fi +} && +complete -F _look -o default look + +# ex: filetype=sh diff --git a/completions/_mock b/completions/_mock index c616aed0..9649d306 100644 --- a/completions/_mock +++ b/completions/_mock @@ -24,20 +24,20 @@ _mock() case $prev in -h|--help|--copyin|--copyout|--arch|-D|--define|--with|--without|\ --uniqueext|--rpmbuild_timeout|--sources|--cwd) - return 0 + return ;; -r|--root) COMPREPLY=( $( compgen -W "$( command ls $cfgdir )" -- "$cur" ) ) COMPREPLY=( ${COMPREPLY[@]/%.cfg/} ) - return 0 + return ;; --configdir|--resultdir) _filedir -d - return 0 + return ;; --spec) _filedir spec - return 0 + return ;; --target) # Yep, compatible archs, not compatible build archs @@ -45,17 +45,17 @@ _mock() # This would actually depend on what the target root # can be used to build for... COMPREPLY=( $( compgen -W "$( command rpm --showrc | \ - sed -ne 's/^\s*compatible\s\s*archs\s*:\s*\(.*\)/\1/i p' )" \ + command sed -ne 's/^\s*compatible\s\s*archs\s*:\s*\(.*\)/\1/i p' )" \ -- "$cur" ) ) - return 0 + return ;; --enable-plugin|--disable-plugin) COMPREPLY=( $( compgen -W "$plugins" -- "$cur" ) ) - return 0 + return ;; esac - $split && return 0 + $split && return if [[ "$cur" == -* ]] ; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) @@ -66,4 +66,4 @@ _mock() } && complete -F _mock mock -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/_modules b/completions/_modules index b5a1d94a..9e48589b 100644 --- a/completions/_modules +++ b/completions/_modules @@ -23,13 +23,13 @@ _module_list () { - local modules="$( sed 's/:/ /g' <<<$LOADEDMODULES | sort )" + local modules="$( command sed 's/:/ /g' <<<$LOADEDMODULES | sort )" compgen -W "$modules" -- $1 } _module_path () { - local modules="$( sed 's/:/ /g' <<<$MODULEPATH | sort )" + local modules="$( command sed 's/:/ /g' <<<$MODULEPATH | sort )" compgen -W "$modules" -- $1 } @@ -38,7 +38,7 @@ _module_avail () local modules="$( \ module avail 2>&1 | \ command grep -E -v '^(-|$)' | \ - xargs printf '%s\n' | sed -e 's/(default)//g' | sort )" + xargs printf '%s\n' | command sed -e 's/(default)//g' | sort )" compgen -W "$modules" -- $1 } @@ -54,7 +54,7 @@ _module () local options options="$( module help 2>&1 | command grep -E '^[[:space:]]*\+' | \ - awk '{print $2}' | sed -e 's/|/ /g' | sort )" + awk '{print $2}' | command sed -e 's/|/ /g' | sort )" COMPREPLY=( $(compgen -W "$options" -- "$cur") ) @@ -77,8 +77,8 @@ _module () ;; esac fi - return 0 + } && complete -F _module -o default module -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/_newgrp b/completions/_newgrp new file mode 100644 index 00000000..0f0d3f93 --- /dev/null +++ b/completions/_newgrp @@ -0,0 +1,19 @@ +# newgrp(1) completion -*- shell-script -*- + +# Use of this file is deprecated on Linux. Upstream completion is +# available in util-linux >= 2.23, use that instead. + +_newgrp() +{ + local cur prev words cword + _init_completion || return + + if [[ "$cur" == "-" ]]; then + COMPREPLY=( - ) + else + _allowed_groups "$cur" + fi +} && +complete -F _newgrp newgrp + +# ex: filetype=sh diff --git a/completions/_nmcli b/completions/_nmcli new file mode 100644 index 00000000..f77f0505 --- /dev/null +++ b/completions/_nmcli @@ -0,0 +1,201 @@ +# nmcli completion -*- shell-script -*- + +# Use of this file is deprecated. Upstream completion is available in +# NetworkManager >= 0.9.8.0, use that instead. + +_nmcli_list() +{ + COMPREPLY=( $( compgen -W '$1' -- "$cur" ) ) +} + +_nmcli_con_id() +{ + local IFS=$'\n' + COMPREPLY=( $( compgen -W "$(nmcli con list 2>/dev/null | \ + tail -n +2 | awk -F ' {2,}' '{print $1 }')" -- "$cur" ) ) +} + +_nmcli_con_uuid() +{ + COMPREPLY=( $( compgen -W "$(nmcli con list 2>/dev/null | \ + tail -n +2 | awk -F ' {2,}' '{print $2}')" -- "$cur" ) ) +} + +_nmcli_ap_ssid() +{ + local IFS=$'\n' + COMPREPLY=( $( compgen -W "$(nmcli dev wifi list 2>/dev/null | \ + tail -n +2 | awk -F ' {2,}' '{print $1}')" -- "$cur" ) ) +} + +_nmcli_ab_bssid() +{ + COMPREPLY=( $( compgen -W "$(nmcli dev wifi list 2>/dev/null | \ + tail -n +2 | awk -F ' {2,}' '{print $2}')" -- "$cur" ) ) +} + +_nmcli() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -m|--mode) + COMPREPLY=( $( compgen -W 'tabular multiline' -- "$cur" ) ) + return + ;; + -f|--fields) + COMPREPLY=( $( compgen -W 'all common' -- "$cur" ) ) + return + ;; + -e|--escape) + _nmcli_list "yes no" + return + ;; + id) + _nmcli_con_id + return + ;; + uuid) + _nmcli_con_uuid + return + ;; + iface) + _available_interfaces + return + ;; + bssid) + _nmcli_ab_bssid + return + ;; + wep-key-type) + _nmcli_list "key phrase" + return + ;; + esac + + if [[ $cword -eq 1 ]] ; then + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--terse --pretty --mode --fields + --escape --version --help' -- "$cur" ) ) + else + COMPREPLY=( $( compgen -W "nm con dev" -- "$cur" ) ) + fi + else + local object=${words[1]} + local command=${words[2]} + + case $object in + nm) + case $command in + enable) + _nmcli_list "true false" + return + ;; + sleep) + _nmcli_list "true false" + return + ;; + wifi) + _nmcli_list "on off" + return + ;; + wwan) + _nmcli_list "on off" + return + ;; + wimax) + _nmcli_list "on off" + return + ;; + esac + + COMPREPLY=( $( compgen -W 'status permissions enable sleep + wifi wwan wimax' -- "$cur" ) ) + ;; + con) + case $command in + list) + COMPREPLY=( $( compgen -W 'id uuid' -- "$cur" ) ) + return + ;; + up) + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--nowait --timeout' \ + -- "$cur" ) ) + else + COMPREPLY=( $( compgen -W 'id uuid iface ap nsp' \ + -- "$cur" ) ) + fi + return + ;; + down) + COMPREPLY=( $( compgen -W 'id uuid' -- "$cur" ) ) + return + ;; + delete) + COMPREPLY=( $( compgen -W 'id uuid' -- "$cur" ) ) + return + ;; + esac + + COMPREPLY=( $( compgen -W 'list status up down delete' \ + -- "$cur" ) ) + ;; + dev) + case $command in + list) + COMPREPLY=( $( compgen -W 'iface' -- "$cur" ) ) + return + ;; + disconnect) + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--nowait --timeout' \ + -- "$cur" ) ) + else + COMPREPLY=( $( compgen -W 'iface' -- "$cur" ) ) + fi + return + ;; + wifi) + local subcommand=${words[3]} + + case $subcommand in + list) + COMPREPLY=( $( compgen -W 'iface bssid' \ + -- "$cur" ) ) + return + ;; + connect) + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--private + --nowait --timeout' -- "$cur" ) ) + else + if [[ "$prev" == "connect" ]]; then + _nmcli_ap_ssid + else + COMPREPLY=( $( compgen -W 'password + wep-key-type iface bssid name' \ + -- "$cur" ) ) + fi + fi + return + ;; + esac + + COMPREPLY=( $( compgen -W 'list connect' -- "$cur" ) ) + return + ;; + esac + + COMPREPLY=( $( compgen -W 'status list disconnect wifi' \ + -- "$cur" ) ) + ;; + esac + + fi + +} && +complete -F _nmcli nmcli + +# ex: filetype=sh diff --git a/completions/_renice b/completions/_renice new file mode 100644 index 00000000..1f1a6102 --- /dev/null +++ b/completions/_renice @@ -0,0 +1,32 @@ +# renice(8) completion -*- shell-script -*- + +# Use of this file is deprecated on Linux. Upstream completion is +# available in util-linux >= 2.23, use that instead. + +_renice() +{ + local cur prev words cword + _init_completion || return + + local command=$1 curopt i=0 + + # walk back through command line and find last option + while [[ $i -le $cword && ${#COMPREPLY[@]} -eq 0 ]]; do + curopt=${words[cword-$i]} + case "$curopt" in + -u) + _allowed_users + ;; + -g) + _pgids + ;; + -p|$command) + _pids + ;; + esac + i=$(( ++i )) + done +} && +complete -F _renice renice + +# ex: filetype=sh diff --git a/completions/_repomanage b/completions/_repomanage new file mode 100644 index 00000000..c1072e79 --- /dev/null +++ b/completions/_repomanage @@ -0,0 +1,24 @@ +# bash completion for repomanage -*- shell-script -*- + +# Use of this file is deprecated. Upstream completion is available in +# yum-utils >= 1.1.24, use that instead. + +_repomanage() +{ + local cur prev words cword split + _init_completion -s || return + + [[ "$prev" == -@([hk]|-help|-keep) ]] && return + + $split && return + + if [[ "$cur" == -* ]] ; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + else + _filedir -d + fi +} && +complete -F _repomanage repomanage + +# ex: filetype=sh diff --git a/completions/_reptyr b/completions/_reptyr new file mode 100644 index 00000000..4a087b49 --- /dev/null +++ b/completions/_reptyr @@ -0,0 +1,26 @@ +# bash completion for reptyr(1) -*- shell-script -*- + +# Use of this file is deprecated. Upstream completion is available in +# reptyr > 0.6.2, use that instead. + +_reptyr() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -l) + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + return + fi + + [[ $prev != +([0-9]) ]] && _pids +} && +complete -F _reptyr reptyr + +# ex: filetype=sh diff --git a/completions/_rtcwake b/completions/_rtcwake new file mode 100644 index 00000000..b03c1244 --- /dev/null +++ b/completions/_rtcwake @@ -0,0 +1,32 @@ +# bash completion for rtcwake -*- shell-script -*- + +# Use of this file is deprecated. Upstream completion is available in +# util-linux >= 2.23, use that instead. + +_rtcwake() +{ + local cur prev words cword split + _init_completion -s || return + + case "$prev" in + --help|-h|--version|-V|--seconds|-s|--time|-t) + return + ;; + --mode|-m) + COMPREPLY=( $( compgen -W 'standby mem disk on no off' -- "$cur" ) ) + return + ;; + --device|-d) + COMPREPLY=( $( command ls -d /dev/rtc?* 2>/dev/null ) ) + COMPREPLY=( $( compgen -W '${COMPREPLY[@]#/dev/}' -- "$cur" ) ) + return + ;; + esac + + $split && return + + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) +} && +complete -F _rtcwake rtcwake + +# ex: filetype=sh diff --git a/completions/_runuser b/completions/_runuser new file mode 100644 index 00000000..95cf930a --- /dev/null +++ b/completions/_runuser @@ -0,0 +1,8 @@ +# runuser(1) completion -*- shell-script -*- + +# Use of this file is deprecated on Linux. Upstream completion is +# available in util-linux >= 2.23, use that instead. + +complete -u runuser + +# ex: filetype=sh diff --git a/completions/_su b/completions/_su new file mode 100644 index 00000000..2b069498 --- /dev/null +++ b/completions/_su @@ -0,0 +1,41 @@ +# bash completion for su(1) -*- shell-script -*- + +# Use of this file is deprecated on Linux. Upstream completion is +# available in util-linux >= 2.23, use that instead. + +if [[ $OSTYPE != *linux* ]]; then + complete -u su # default completion + return +fi + +_su() # linux-specific completion +{ + local cur prev words cword split + _init_completion -s || return + + case "$prev" in + -s|--shell) + _shells + return + ;; + -c|--command|--session-command) + local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $( compgen -d -c -- "$cur" ) ) + return + ;; + esac + + $split && return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" --help )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + return + fi + + COMPREPLY=( $( compgen -u -- "$cur" ) ) +} && +complete -F _su su + +# ex: filetype=sh diff --git a/completions/_subversion b/completions/_subversion deleted file mode 100644 index 2f1752c0..00000000 --- a/completions/_subversion +++ /dev/null @@ -1,344 +0,0 @@ -# svn completion -*- shell-script -*- - -# Use of this file is deprecated. Upstream completion is available in -# subversion >= 0.12.0, use that instead. - -_svn() -{ - local cur prev words cword - _init_completion || return - - local commands - commands='add blame praise annotate ann cat checkout co cleanup commit \ - ci copy cp delete del remove rm diff di export help ? h import \ - info list ls lock log merge mkdir move mv rename ren \ - 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 [[ $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) - words=(words[0] $cur) - cword=1 - _command - return 0 - ;; - esac - - local command=${words[1]} - - if [[ "$cur" == -* ]]; then - # possible options for the command - local options - case $command in - add) - options='--auto-props --no-auto-props --force --targets - --no-ignore --non-recursive --quiet' - ;; - blame|annotate|ann|praise) - options='--revision --username --password --no-auth-cache - --non-interactive --verbose --incremental --xml' - ;; - cat) - options='--revision --username --password --no-auth-cache - --non-interactive' - ;; - checkout|co) - options='--revision --quiet --non-recursive --username - --password --no-auth-cache --non-interactive - --ignore-externals' - ;; - cleanup) - options='--diff3-cmd' - ;; - commit|ci) - options='--message --file --encoding --force-log --quiet - --non-recursive --targets --editor-cmd --username - --password --no-auth-cache --non-interactive - --no-unlock' - ;; - copy|cp) - options='--message --file --encoding --force-log --revision - --quiet --editor-cmd -username --password - --no-auth-cache --non-interactive' - ;; - delete|del|remove|rm) - options='--force --message --file --encoding --force-log - --quiet --targets --editor-cmd --username - --password --no-auth-cache --non-interactive' - ;; - diff|di) - options='--revision --extensions --diff-cmd - --no-diff-deleted --non-recursive --username - --password --no-auth-cache --non-interactive - --force --old --new --notice-ancestry' - ;; - export) - options='--revision --quiet --username --password - --no-auth-cache --non-interactive --non-recursive - --force --native-eol --ignore-externals' - ;; - import) - options='--auto-props --no-auto-props --message --file - --encoding --force-log --quiet --non-recursive - --no-ignore --editor-cmd --username --password - --no-auth-cache --non-interactive' - ;; - info) - options='--username --password --no-auth-cache - --non-interactive --revision --xml --targets - --recursive --incremental' - ;; - list|ls) - options='--revision --verbose --recursive --username - --password --no-auth-cache --non-interactive - --incremental --xml' - ;; - lock) - options='--message --file --encoding --force-log --targets - --force --username --password --no-auth-cache - --non-interactive' - ;; - log) - options='--revision --verbose --targets --username - --password --no-auth-cache --non-interactive - --stop-on-copy --incremental --xml --quiet - --limit' - ;; - merge) - options='--revision --non-recursive --quiet --force - --dry-run --diff3-cmd --username --password - --no-auth-cache --non-interactive - --ignore-ancestry' - ;; - mkdir) - options='--message --file --encoding --force-log --quiet - --editor-cmd --username --password --no-auth-cache - --non-interactive' - ;; - move|mv|rename|ren) - options='--message --file --encoding --force-log --revision - --quiet --force --editor-cmd --username --password - --no-auth-cache --non-interactive' - ;; - propdel|pdel|pd) - options='--quiet --recursive --revision --revprop - --username --password --no-auth-cache - --non-interactive' - ;; - propedit|pedit|pe) - options='--revision --revprop --encoding --editor-cmd - --username --password --no-auth-cache - --non-interactive --force' - ;; - propget|pget|pg) - options='--recursive --revision --revprop --strict - --username --password --no-auth-cache - --non-interactive' - ;; - proplist|plist|pl) - options='--verbose --recursive --revision --revprop --quiet - --username --password --no-auth-cache - --non-interactive' - ;; - propset|pset|ps) - options='--file --quiet --targets --recursive --revprop - --encoding --username --password --no-auth-cache - --non-interactive --revision --force' - ;; - resolved) - options='--targets --recursive --quiet' - ;; - revert) - options='--targets --recursive --quiet' - ;; - status|stat|st) - options='--show-updates --verbose --non-recursive --quiet - --username --password --no-auth-cache - --non-interactive --no-ignore --ignore-externals - --incremental --xml' - ;; - switch|sw) - options='--relocate --revision --non-recursive --quiet - --username --password --no-auth-cache - --non-interactive --diff3-cmd' - ;; - unlock) - options='--targets --force --username --password - --no-auth-cache --non-interactive' - ;; - update|up) - options='--revision --non-recursive --quiet --username - --password --no-auth-cache --non-interactive - --diff3-cmd --ignore-externals' - ;; - esac - options+=" --help --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 words cword - _init_completion || return - - local commands - commands='create deltify dump help ? hotcopy list-dblogs list-unused-dblogs - load lslocks lstxns recover rmlocks rmtxns setlog verify' - - if [[ $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 - - local command=${words[1]} - - if [[ "$cur" == -* ]]; then - # possible options for the command - local options - case $command in - create) - options='--bdb-txn-nosync --bdb-log-keep --config-dir - --fs-type' - ;; - deltify) - options='--revision --quiet' - ;; - dump) - options='--revision --incremental --quiet --deltas' - ;; - hotcopy) - options='--clean-logs' - ;; - load) - options='--ignore-uuid --force-uuid --parent-dir --quiet - --use-pre-commit-hook --use-post-commit-hook' - ;; - rmtxns) - options='--quiet' - ;; - setlog) - options='--revision --bypass-hooks' - ;; - esac - - options+=" --help" - 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 words cword - _init_completion || return - - local commands - commands='author cat changed date diff dirs-changed help ? h history info - lock log propget pget pg proplist plist pl tree uuid youngest' - - if [[ $cword -eq 1 ]] ; then - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--version' -- "$cur" ) ) - else - COMPREPLY=( $( compgen -W "$commands" -- "$cur" ) ) - fi - else - local command=${words[1]} - - if [[ "$cur" == -* ]]; then - # possible options for the command - local options - case $command in - author|cat|date|dirs-changed|info|log) - options='--revision --transaction' - ;; - changed) - options='--revision --transaction --copy-info' - ;; - diff) - options='--revision --transaction --no-diff-deleted - --no-diff-added --diff-copy-from' - ;; - history) - options='--revision --show-ids' - ;; - propget|proplist) - options='--revision --transaction --revprop' - ;; - tree) - options='--revision --transaction --show-ids --full-paths' - ;; - esac - - options+=" --help" - 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 - -# ex: ts=4 sw=4 et filetype=sh diff --git a/completions/_svn b/completions/_svn new file mode 100644 index 00000000..37b6b2b4 --- /dev/null +++ b/completions/_svn @@ -0,0 +1,212 @@ +# svn completion -*- shell-script -*- + +# Use of this file is deprecated. Upstream completion is available in +# subversion >= 0.12.0, use that instead. + +_svn() +{ + local cur prev words cword + _init_completion || return + + local commands + commands='add blame praise annotate ann cat checkout co cleanup commit \ + ci copy cp delete del remove rm diff di export help ? h import \ + info list ls lock log merge mkdir move mv rename ren \ + 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 [[ $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 + ;; + -F|--file|--targets) + _filedir + return + ;; + --encoding) + COMPREPLY=( $( compgen -W '$( iconv --list | \ + command sed -e "s@//@@;" )' -- "$cur" ) ) + return + ;; + --editor-cmd|--diff-cmd|--diff3-cmd) + words=(words[0] $cur) + cword=1 + _command + return + ;; + esac + + local command=${words[1]} + + if [[ "$cur" == -* ]]; then + # possible options for the command + local options + case $command in + add) + options='--auto-props --no-auto-props --force --targets + --no-ignore --non-recursive --quiet' + ;; + blame|annotate|ann|praise) + options='--revision --username --password --no-auth-cache + --non-interactive --verbose --incremental --xml' + ;; + cat) + options='--revision --username --password --no-auth-cache + --non-interactive' + ;; + checkout|co) + options='--revision --quiet --non-recursive --username + --password --no-auth-cache --non-interactive + --ignore-externals' + ;; + cleanup) + options='--diff3-cmd' + ;; + commit|ci) + options='--message --file --encoding --force-log --quiet + --non-recursive --targets --editor-cmd --username + --password --no-auth-cache --non-interactive + --no-unlock' + ;; + copy|cp) + options='--message --file --encoding --force-log --revision + --quiet --editor-cmd -username --password + --no-auth-cache --non-interactive' + ;; + delete|del|remove|rm) + options='--force --message --file --encoding --force-log + --quiet --targets --editor-cmd --username + --password --no-auth-cache --non-interactive' + ;; + diff|di) + options='--revision --extensions --diff-cmd + --no-diff-deleted --non-recursive --username + --password --no-auth-cache --non-interactive + --force --old --new --notice-ancestry' + ;; + export) + options='--revision --quiet --username --password + --no-auth-cache --non-interactive --non-recursive + --force --native-eol --ignore-externals' + ;; + import) + options='--auto-props --no-auto-props --message --file + --encoding --force-log --quiet --non-recursive + --no-ignore --editor-cmd --username --password + --no-auth-cache --non-interactive' + ;; + info) + options='--username --password --no-auth-cache + --non-interactive --revision --xml --targets + --recursive --incremental' + ;; + list|ls) + options='--revision --verbose --recursive --username + --password --no-auth-cache --non-interactive + --incremental --xml' + ;; + lock) + options='--message --file --encoding --force-log --targets + --force --username --password --no-auth-cache + --non-interactive' + ;; + log) + options='--revision --verbose --targets --username + --password --no-auth-cache --non-interactive + --stop-on-copy --incremental --xml --quiet + --limit' + ;; + merge) + options='--revision --non-recursive --quiet --force + --dry-run --diff3-cmd --username --password + --no-auth-cache --non-interactive + --ignore-ancestry' + ;; + mkdir) + options='--message --file --encoding --force-log --quiet + --editor-cmd --username --password --no-auth-cache + --non-interactive' + ;; + move|mv|rename|ren) + options='--message --file --encoding --force-log --revision + --quiet --force --editor-cmd --username --password + --no-auth-cache --non-interactive' + ;; + propdel|pdel|pd) + options='--quiet --recursive --revision --revprop + --username --password --no-auth-cache + --non-interactive' + ;; + propedit|pedit|pe) + options='--revision --revprop --encoding --editor-cmd + --username --password --no-auth-cache + --non-interactive --force' + ;; + propget|pget|pg) + options='--recursive --revision --revprop --strict + --username --password --no-auth-cache + --non-interactive' + ;; + proplist|plist|pl) + options='--verbose --recursive --revision --revprop --quiet + --username --password --no-auth-cache + --non-interactive' + ;; + propset|pset|ps) + options='--file --quiet --targets --recursive --revprop + --encoding --username --password --no-auth-cache + --non-interactive --revision --force' + ;; + resolved) + options='--targets --recursive --quiet' + ;; + revert) + options='--targets --recursive --quiet' + ;; + status|stat|st) + options='--show-updates --verbose --non-recursive --quiet + --username --password --no-auth-cache + --non-interactive --no-ignore --ignore-externals + --incremental --xml' + ;; + switch|sw) + options='--relocate --revision --non-recursive --quiet + --username --password --no-auth-cache + --non-interactive --diff3-cmd' + ;; + unlock) + options='--targets --force --username --password + --no-auth-cache --non-interactive' + ;; + update|up) + options='--revision --non-recursive --quiet --username + --password --no-auth-cache --non-interactive + --diff3-cmd --ignore-externals' + ;; + esac + options+=" --help --config-dir" + + COMPREPLY=( $( compgen -W "$options" -- "$cur" ) ) + else + if [[ "$command" == @(help|[h?]) ]]; then + COMPREPLY=( $( compgen -W "$commands" -- "$cur" ) ) + else + _filedir + fi + fi + fi + +} && +complete -F _svn svn + +# ex: filetype=sh diff --git a/completions/_svnadmin b/completions/_svnadmin new file mode 100644 index 00000000..395ae119 --- /dev/null +++ b/completions/_svnadmin @@ -0,0 +1,78 @@ +# svnadmin completion -*- shell-script -*- + +# Use of this file is deprecated. Upstream completion is available in +# subversion >= 0.12.0, use that instead. + +_svnadmin() +{ + local cur prev words cword + _init_completion || return + + local commands + commands='create deltify dump help ? hotcopy list-dblogs list-unused-dblogs + load lslocks lstxns recover rmlocks rmtxns setlog verify' + + if [[ $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 + ;; + --fs-type) + COMPREPLY=( $( compgen -W 'fsfs bdb' -- "$cur" ) ) + return + ;; + esac + + local command=${words[1]} + + if [[ "$cur" == -* ]]; then + # possible options for the command + local options + case $command in + create) + options='--bdb-txn-nosync --bdb-log-keep --config-dir + --fs-type' + ;; + deltify) + options='--revision --quiet' + ;; + dump) + options='--revision --incremental --quiet --deltas' + ;; + hotcopy) + options='--clean-logs' + ;; + load) + options='--ignore-uuid --force-uuid --parent-dir --quiet + --use-pre-commit-hook --use-post-commit-hook' + ;; + rmtxns) + options='--quiet' + ;; + setlog) + options='--revision --bypass-hooks' + ;; + esac + + options+=" --help" + COMPREPLY=( $( compgen -W "$options" -- "$cur" ) ) + else + if [[ "$command" == @(help|[h?]) ]]; then + COMPREPLY=( $( compgen -W "$commands" -- "$cur" ) ) + else + _filedir + fi + fi + fi + +} && +complete -F _svnadmin -o default svnadmin + +# ex: filetype=sh diff --git a/completions/_svnlook b/completions/_svnlook new file mode 100644 index 00000000..a4f34243 --- /dev/null +++ b/completions/_svnlook @@ -0,0 +1,63 @@ +# svnlook completion -*- shell-script -*- + +# Use of this file is deprecated. Upstream completion is available in +# subversion >= 0.12.0, use that instead. + +_svnlook() +{ + local cur prev words cword + _init_completion || return + + local commands + commands='author cat changed date diff dirs-changed help ? h history info + lock log propget pget pg proplist plist pl tree uuid youngest' + + if [[ $cword -eq 1 ]] ; then + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--version' -- "$cur" ) ) + else + COMPREPLY=( $( compgen -W "$commands" -- "$cur" ) ) + fi + else + local command=${words[1]} + + if [[ "$cur" == -* ]]; then + # possible options for the command + local options + case $command in + author|cat|date|dirs-changed|info|log) + options='--revision --transaction' + ;; + changed) + options='--revision --transaction --copy-info' + ;; + diff) + options='--revision --transaction --no-diff-deleted + --no-diff-added --diff-copy-from' + ;; + history) + options='--revision --show-ids' + ;; + propget|proplist) + options='--revision --transaction --revprop' + ;; + tree) + options='--revision --transaction --show-ids --full-paths' + ;; + esac + + options+=" --help" + COMPREPLY=( $( compgen -W "$options" -- "$cur" ) ) + else + if [[ "$command" == @(help|[h?]) ]]; then + COMPREPLY=( $( compgen -W "$commands" -- "$cur" ) ) + else + _filedir + fi + fi + fi + +} && +complete -F _svnlook -o default svnlook + +# ex: filetype=sh diff --git a/completions/_udevadm b/completions/_udevadm index 51ec0e5d..80424dca 100644 --- a/completions/_udevadm +++ b/completions/_udevadm @@ -61,7 +61,7 @@ _udevadm() ;; *) COMPREPLY=( $( compgen -W "$( "$1" --help 2>/dev/null | - awk '/^[[:space:]]+/ { print $1 }' )" -- "$cur" ) ) + awk '/^[ \t]/ { print $1 }' )" -- "$cur" ) ) ;; esac return @@ -76,4 +76,4 @@ _udevadm() } && complete -F _udevadm udevadm -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/_write b/completions/_write new file mode 100644 index 00000000..49e56ffe --- /dev/null +++ b/completions/_write @@ -0,0 +1,8 @@ +# write(1) completion -*- shell-script -*- + +# Use of this file is deprecated on Linux. Upstream completion is +# available in util-linux >= 2.23, use that instead. + +complete -u write + +# ex: filetype=sh diff --git a/completions/_yum b/completions/_yum index 7b3f76a4..f3a104bd 100644 --- a/completions/_yum +++ b/completions/_yum @@ -9,12 +9,12 @@ _yum_list() # Try to strip in between headings like "Available Packages" # This will obviously only work for English :P COMPREPLY=( $( yum -d 0 -C list $1 "$cur*" 2>/dev/null | \ - sed -ne '/^Available /d' -e '/^Installed /d' -e '/^Updated /d' \ + command sed -ne '/^Available /d' -e '/^Installed /d' -e '/^Updated /d' \ -e 's/[[:space:]].*//p' ) ) else # Drop first line (e.g. "Updated Packages") COMPREPLY=( $( yum -d 0 -C list $1 "$cur*" 2>/dev/null | \ - sed -ne 1d -e 's/[[:space:]].*//p' ) ) + command sed -ne 1d -e 's/[[:space:]].*//p' ) ) fi } @@ -24,13 +24,13 @@ _yum_repolist() # http://yum.baseurl.org/ticket/83 # Drop first ("repo id repo name") and last ("repolist: ...") rows yum --noplugins -C repolist $1 2>/dev/null | \ - sed -ne '/^repo\s\s*id/d' -e '/^repolist:/d' -e 's/[[:space:]].*//p' + command sed -ne '/^repo\s\s*id/d' -e '/^repolist:/d' -e 's/[[:space:]].*//p' } _yum_plugins() { command ls /usr/lib/yum-plugins/*.py{,c,o} 2>/dev/null \ - | sed -ne 's|.*/\([^./]*\)\.py[co]\{0,1\}$|\1|p' | sort -u + | command sed -ne 's|.*/\([^./]*\)\.py[co]\{0,1\}$|\1|p' | sort -u } _yum() @@ -50,25 +50,25 @@ _yum() if [[ "$cur" == @(*/|[.~])* && \ "$special" == @(deplist|install|update|upgrade) ]]; then _filedir rpm - return 0 + return fi case $special in install) _yum_list available - return 0 + return ;; deplist|info) _yum_list all - return 0 + return ;; upgrade|update) _yum_list updates - return 0 + return ;; remove|erase) # _rpm_installed_packages is not arch-qualified _yum_list installed - return 0 + return ;; esac fi @@ -117,11 +117,11 @@ _yum() ;; -R|-x|--exclude) # argument required but no completions available - return 0 + return ;; -h|--help|--version) # no other options useful with these - return 0 + return ;; *) COMPREPLY=( $( compgen -W 'install update check-update upgrade @@ -132,14 +132,13 @@ _yum() ;; esac - $split && return 0 + $split && return if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) [[ $COMPREPLY == *= ]] && compopt -o nospace - return 0 fi } && complete -F _yum yum -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/_yum-utils b/completions/_yum-utils deleted file mode 100644 index 22b97af8..00000000 --- a/completions/_yum-utils +++ /dev/null @@ -1,24 +0,0 @@ -# bash completion for repomanage -*- shell-script -*- - -# Use of this file is deprecated. Upstream completion is available in -# yum-utils >= 1.1.24, use that instead. - -_repomanage() -{ - local cur prev words cword split - _init_completion -s || return - - [[ "$prev" == -@(h|-help|k|-keep) ]] && return 0 - - $split && return - - if [[ "$cur" == -* ]] ; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) - [[ $COMPREPLY == *= ]] && compopt -o nospace - else - _filedir -d - fi -} && -complete -F _repomanage repomanage - -# ex: ts=4 sw=4 et filetype=sh diff --git a/completions/a2x b/completions/a2x index 7c330908..06c7c3a4 100644 --- a/completions/a2x +++ b/completions/a2x @@ -37,4 +37,4 @@ _a2x() } && complete -F _a2x a2x -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/abook b/completions/abook index 07a0f090..4bb0e8e3 100644 --- a/completions/abook +++ b/completions/abook @@ -10,43 +10,40 @@ _abook() { compopt -o nospace COMPREPLY=( "-" ) - return 0 + return } case $cur in -*) - _longopt abook - return 0 + _longopt "$1" + return ;; esac case $prev in --informat) - COMPREPLY=( $( compgen -W "$(abook --formats | \ - sed -n -e 's/^\t\([a-z]*\).*/\1/p' -e '/^$/q')" -- "$cur" ) ) - return 0 + COMPREPLY=( $( compgen -W "$($1 --formats | \ + command sed -n -e 's/^'$'\t''\([a-z]*\).*/\1/p' -e '/^$/q')" \ + -- "$cur" ) ) ;; --outformat) - COMPREPLY=( $( compgen -W "$(abook --formats | \ - sed -n -e '/^$/,$s/^\t\([a-z]*\).*/\1/p')" -- "$cur" ) ) - return 0 + COMPREPLY=( $( compgen -W "$($1 --formats | \ + command sed -n -e '/^$/,$s/^'$'\t''\([a-z]*\).*/\1/p')" \ + -- "$cur" ) ) ;; --infile) COMPREPLY=( $( compgen -W stdin -- "$cur" ) ) _filedir - return 0 ;; --outfile) COMPREPLY=( $( compgen -W stdout -- "$cur" ) ) _filedir - return 0 ;; --config|--datafile) _filedir - return 0 ;; esac } && complete -F _abook abook -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/aclocal b/completions/aclocal index 2bbc3152..7a3d6467 100644 --- a/completions/aclocal +++ b/completions/aclocal @@ -7,29 +7,29 @@ _aclocal() case "$prev" in --help|--print-ac-dir|--version) - return 0 + return ;; --acdir|-I) _filedir -d - return 0 + return ;; --output) _filedir - return 0 + return ;; --warnings|-W) local cats=( syntax unsupported ) COMPREPLY=( $( compgen -W \ '${cats[@]} ${cats[@]/#/no-} all none error' -- "$cur" ) ) - return 0 + return ;; esac - $split && return 0 + $split && return COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) [[ $COMPREPLY == *= ]] && compopt -o nospace } && -complete -F _aclocal aclocal aclocal-1.11 +complete -F _aclocal aclocal aclocal-1.1{0..5} -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/acpi b/completions/acpi index 16ae0d6e..b748cbde 100644 --- a/completions/acpi +++ b/completions/acpi @@ -19,4 +19,4 @@ _acpi() } && complete -F _acpi acpi -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/adb b/completions/adb new file mode 100644 index 00000000..d069b425 --- /dev/null +++ b/completions/adb @@ -0,0 +1,66 @@ +# adb completion -*- shell-script -*- + +_adb_command_usage() +{ + COMPREPLY=( $( compgen -W \ + '$( "$1" help 2>&1 | command grep "^ *\(adb \)\? *$2 " \ + | command sed -e "s/[]|[]/\n/g" | _parse_help - )' -- "$cur" ) ) +} + +_adb() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -s|-p|--algo|--key|--iv) + return + ;; + -f) + _filedir + return + ;; + esac + + local cmd i + for (( i=1; i < cword; i++ )); do + if [[ "${words[i]}" != -* && "${words[i-1]}" != -[sp] ]]; then + cmd="${words[i]}" + break + fi + done + + if [[ ! "$cmd" ]]; then + local tmp=() + if [[ ! $cur || $cur == -* ]]; then + tmp+=( $( compgen -W '$( _parse_help "$1" help )' -- "$cur" ) ) + fi + if [[ ! $cur || $cur != -* ]]; then + tmp+=( $( $1 help 2>&1 | awk '$1 == "adb" { print $2 }' ) ) + tmp+=( devices connect disconnect sideload ) + fi + COMPREPLY=( $( compgen -W '${tmp[@]}' -- "$cur" ) ) + return + fi + + # TODO: more and better command completions + + _adb_command_usage "$1" $cmd + + case $cmd in + push|restore|sideload) + _filedir + ;; + forward) + COMPREPLY=( $( compgen -W \ + '$( "$1" help 2>&1 | command sed -ne "s/^ *adb *forward *-/-/p" | \ + _parse_help - )' -- "$cur" ) ) + ;; + reboot) + COMPREPLY=( $( compgen -W 'bootloader recovery' -- "$cur" ) ) + ;; + esac +} && +complete -F _adb adb + +# ex: filetype=sh diff --git a/completions/add_members b/completions/add_members index 70b916be..d582d94b 100644 --- a/completions/add_members +++ b/completions/add_members @@ -8,15 +8,15 @@ _add_members() case $prev in -r|-d|--regular-members-file|--digest-members-file) _filedir - return 0 + return ;; -w|-a|--welcome-msg|--admin-notify) COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) - return 0 + return ;; esac - $split && return 0 + $split && return if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '--regular-members-file --digest-members-file @@ -28,4 +28,4 @@ _add_members() } && complete -F _add_members add_members -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/alias b/completions/alias index 112dea3b..de2a57e8 100644 --- a/completions/alias +++ b/completions/alias @@ -10,11 +10,11 @@ _alias() COMPREPLY=( $( compgen -A alias -- "$cur" ) ) ;; *=) - COMPREPLY=( "$( alias ${cur%=} 2>/dev/null | sed \ + COMPREPLY=( "$( alias ${cur%=} 2>/dev/null | command sed \ -e 's|^alias '"$cur"'\(.*\)$|\1|' )" ) ;; esac } && complete -F _alias -o nospace alias -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/ant b/completions/ant index dd3606dc..639cde97 100644 --- a/completions/ant +++ b/completions/ant @@ -1,38 +1,66 @@ # bash completion for ant and phing -*- shell-script -*- +_ant_parse_targets() +{ + local line basedir + + [[ $1 == */* ]] && basedir=${1%/*} || basedir=. + + # parse buildfile for targets + while read -rd '>' line; do + if [[ $line =~ \<(target|extension-point)[[:space:]].*name=[\"\']([^\"\']+) ]]; then + targets+=" ${BASH_REMATCH[2]}" + fi + done < $1 + + # parse imports + while read -rd '>' line; do + if [[ $line =~ \' line; do - [[ $line =~ \ - \<(targe|extension-poin)t[[:space:]].*name=[\"\']([^\"\']+) ]] \ - && targets+=" ${BASH_REMATCH[2]}" - done < $buildfile COMPREPLY=( $( compgen -W '$targets' -- "$cur" ) ) fi } && @@ -61,4 +96,4 @@ complete -F _ant ant phing type complete-ant-cmd.pl &>/dev/null && \ complete -C complete-ant-cmd.pl -F _ant ant || : -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/apache2ctl b/completions/apache2ctl index f6fdeb30..74789744 100644 --- a/completions/apache2ctl +++ b/completions/apache2ctl @@ -6,11 +6,11 @@ _apache2ctl() _init_completion || return local APWORDS - APWORDS=$(apache2ctl 2>&1 >/dev/null | awk 'NR<2 { print $3; exit }' | \ + APWORDS=$($1 2>&1 >/dev/null | awk 'NR<2 { print $3; exit }' | \ tr "|" " ") COMPREPLY=( $( compgen -W "$APWORDS" -- "$cur" ) ) } && complete -F _apache2ctl apache2ctl -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/appdata-validate b/completions/appdata-validate new file mode 100644 index 00000000..3285a3b3 --- /dev/null +++ b/completions/appdata-validate @@ -0,0 +1,32 @@ +# appdata-validate(1) completion -*- shell-script -*- + +_appdata_validate() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + -h|--help|--version) + return + ;; + --output-format) + COMPREPLY=( $( compgen -W "$( $1 --help | + command sed -ne 's/--output-format.*\[\(.*\)\]/\1/' -e 's/|/ /gp' )" \ + -- "$cur" ) ) + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + return + fi + + _filedir appdata.xml +} && +complete -F _appdata_validate appdata-validate + +# ex: filetype=sh diff --git a/completions/apt-build b/completions/apt-build index 3812b20d..0723bcc4 100644 --- a/completions/apt-build +++ b/completions/apt-build @@ -16,27 +16,23 @@ _apt_build() case $special in install|source|info) COMPREPLY=( $( apt-cache pkgnames "$cur" 2> /dev/null ) ) - return 0 ;; remove) COMPREPLY=( \ $( _xfunc dpkg _comp_dpkg_installed_packages "$cur" ) ) - return 0 - ;; - *) - return 0 ;; esac + return fi case $prev in - --patch|--build-dir|--repository-dir) - _filedir - return 0 - ;; - -h|--help) - return 0 - ;; + --patch|--build-dir|--repository-dir) + _filedir + return + ;; + -h|--help) + return + ;; esac if [[ "$cur" == -* ]]; then @@ -51,9 +47,7 @@ _apt_build() -- "$cur" ) ) fi - - return 0 } && complete -F _apt_build apt-build -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/apt-cache b/completions/apt-cache index 085a964d..bedae4e9 100644 --- a/completions/apt-cache +++ b/completions/apt-cache @@ -1,5 +1,20 @@ # Debian apt-cache(8) completion -*- shell-script -*- +# List APT binary packages +_apt_cache_packages() { + apt-cache --no-generate pkgnames "$cur" 2> /dev/null +} + +# List APT source packages +_apt_cache_sources() { + apt-cache dumpavail | command grep "^Source: $1" | cut -f2 -d" " | sort -u +} + +# List APT source packages +_apt_cache_src_packages() { + compgen -W '$( _apt_cache_sources "$cur" )' -- "$cur" +} + _apt_cache() { local cur prev words cword @@ -19,34 +34,31 @@ _apt_cache() case $special in add) _filedir - return 0 ;; showsrc) - COMPREPLY=( $( apt-cache dumpavail | \ - command grep "^Source: $cur" | sort -u | cut -f2 -d" " ) ) - return 0 + COMPREPLY=( $( _apt_cache_sources "$cur" ) ) ;; *) - COMPREPLY=( $( apt-cache --no-generate pkgnames "$cur" 2> /dev/null ) ) - return 0 + COMPREPLY=( $( _apt_cache_packages ) ) ;; esac + return fi case $prev in - -c|-p|-s|--config-file|--pkg-cache|--src-cache) - _filedir - return 0 - ;; - search) - if [[ "$cur" != -* ]]; then - return 0 - fi - ;; + -c|-p|-s|--config-file|--pkg-cache|--src-cache) + _filedir + return + ;; + search) + if [[ "$cur" != -* ]]; then + return + fi + ;; esac if [[ "$cur" == -* ]]; then @@ -64,9 +76,7 @@ _apt_cache() fi - - return 0 } && complete -F _apt_cache apt-cache -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/apt-get b/completions/apt-get index 8fe36f13..ce951050 100644 --- a/completions/apt-get +++ b/completions/apt-get @@ -23,33 +23,31 @@ _apt_get() # assume RPM based _xfunc rpm _rpm_installed_packages fi - return 0 ;; source) COMPREPLY=( $( apt-cache --no-generate pkgnames "$cur" \ 2> /dev/null ) $( apt-cache dumpavail | \ command grep "^Source: $cur" | sort -u | cut -f2 -d" " ) ) - return 0 ;; *) COMPREPLY=( $( apt-cache --no-generate pkgnames "$cur" \ 2> /dev/null ) ) - return 0 ;; esac + return fi case $prev in -c|--config-file) - _filedir - return 0 - ;; + _filedir + return + ;; -t|--target-release|--default-release) - COMPREPLY=( $( apt-cache policy | \ - command grep "release.o=Debian,a=$cur" | \ - sed -e "s/.*a=\(\w*\).*/\1/" | uniq 2> /dev/null) ) - return 0 - ;; + COMPREPLY=( $( apt-cache policy | \ + command grep "release.o=Debian,a=$cur" | \ + command sed -e "s/.*a=\(\w*\).*/\1/" | uniq 2> /dev/null) ) + return + ;; esac if [[ "$cur" == -* ]]; then @@ -68,8 +66,7 @@ _apt_get() changelog check clean autoclean autoremove' -- "$cur" ) ) fi - return 0 } && complete -F _apt_get apt-get -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/aptitude b/completions/aptitude index 3bcfa5cf..32c1dacf 100644 --- a/completions/aptitude +++ b/completions/aptitude @@ -9,7 +9,7 @@ _comp_dpkg_hold_packages() _comp_dpkg_hold_packages() { command grep -B 2 'hold' /var/lib/dpkg/status | \ - command grep "Package: $1" | cut -d\ -f2 + awk "/Package: $1/ { print \$2 }" } } @@ -26,7 +26,7 @@ _aptitude() local special i for (( i=0; i < ${#words[@]}-1; i++ )); do - if [[ ${words[i]} == @(@(|re)install|@(|un)hold|@(|un)markauto|@(dist|full)-upgrade|download|show|forbid-version|purge|remove|changelog|why@(|-not)|keep@(|-all)|build-dep|@(add|remove)-user-tag|versions) ]]; then + if [[ ${words[i]} == @(@(|re)install|@(|un)hold|@(|un)markauto|@(dist|full|safe)-upgrade|download|show|forbid-version|purge|remove|changelog|why@(|-not)|keep@(|-all)|build-dep|@(add|remove)-user-tag|versions) ]]; then special=${words[i]} fi #exclude some mutually exclusive options @@ -35,39 +35,39 @@ _aptitude() done if [[ -n "$special" ]]; then - case $special in - install|hold|markauto|unmarkauto|dist-upgrade|full-upgrade| \ - download|show|changelog|why|why-not|build-dep|add-user-tag| \ - remove-user-tag|versions) - COMPREPLY=( $( apt-cache pkgnames $cur 2> /dev/null ) ) - return 0 - ;; - purge|remove|reinstall|forbid-version) - COMPREPLY=( \ - $( _xfunc dpkg _comp_dpkg_installed_packages "$cur" ) ) - return 0 - ;; - unhold) - COMPREPLY=( $( _comp_dpkg_hold_packages "$cur" ) ) - return 0 - ;; - esac + case $special in + install|hold|markauto|unmarkauto|dist-upgrade|full-upgrade| \ + safe-upgrade|download|show|changelog|why|why-not|build-dep| \ + add-user-tag|remove-user-tag|versions) + COMPREPLY=( $( _xfunc apt-cache _apt_cache_packages ) ) + return + ;; + purge|remove|reinstall|forbid-version) + COMPREPLY=( \ + $( _xfunc dpkg _comp_dpkg_installed_packages "$cur" ) ) + return + ;; + unhold) + COMPREPLY=( $( _comp_dpkg_hold_packages "$cur" ) ) + return + ;; + esac fi case $prev in # don't complete anything if these options are found - autoclean|clean|forget-new|search|safe-upgrade|upgrade|update|keep-all) - return 0 + autoclean|clean|forget-new|search|upgrade|update|keep-all) + return ;; -S) _filedir - return 0 + return ;; -t|--target-release|--default-release) COMPREPLY=( $( apt-cache policy | \ command grep "release.o=Debian,a=$cur" | \ - sed -e "s/.*a=\(\w*\).*/\1/" | uniq 2> /dev/null ) ) - return 0 + command sed -e "s/.*a=\(\w*\).*/\1/" | uniq 2> /dev/null ) ) + return ;; esac @@ -81,8 +81,7 @@ _aptitude() remove-user-tag versions' -- "$cur" ) ) fi - return 0 } && complete -F _aptitude -o default aptitude -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/arch b/completions/arch index 74e9adec..cd33b4f0 100644 --- a/completions/arch +++ b/completions/arch @@ -11,19 +11,18 @@ _arch() case $prev in -w|-g|-d|--welcome-msg|--goodbye-msg|--digest) COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) - return 0 + return ;; -d|--file) _filedir - return 0 + return ;; esac - $split && return 0 + $split && return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--wipe --start --end --quiet --help' \ - -- "$cur" ) ) + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) else local args=$cword for (( i=1; i < cword; i++ )); do @@ -44,4 +43,4 @@ _arch() } && complete -F _arch arch -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/arping b/completions/arping index 231a63be..a719e916 100644 --- a/completions/arping +++ b/completions/arping @@ -28,4 +28,4 @@ _arping() } && complete -F _arping arping -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/arpspoof b/completions/arpspoof index cf9c497a..7b515edb 100644 --- a/completions/arpspoof +++ b/completions/arpspoof @@ -8,11 +8,11 @@ _arpspoof() case $prev in -i) _available_interfaces -a - return 0 + return ;; -t) _known_hosts_real "$cur" - return 0 + return ;; esac @@ -25,4 +25,4 @@ _arpspoof() } && complete -F _arpspoof arpspoof -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/asciidoc b/completions/asciidoc index 722614f6..fb29fad4 100644 --- a/completions/asciidoc +++ b/completions/asciidoc @@ -49,4 +49,4 @@ _asciidoc() } && complete -F _asciidoc asciidoc asciidoc.py -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/aspell b/completions/aspell index b1cd4c5d..9457a5fa 100644 --- a/completions/aspell +++ b/completions/aspell @@ -2,15 +2,15 @@ _aspell_dictionary() { - local datadir - datadir=$( aspell config data-dir 2>/dev/null || echo /usr/lib/aspell ) + local datadir aspell=${1:-aspell} + datadir=$( $aspell config data-dir 2>/dev/null || echo /usr/lib/aspell ) # First, get aliases (dicts dump does not list them) - COMPREPLY=( $( command ls $datadir/*.alias 2>/dev/null ) ) - COMPREPLY=( ${COMPREPLY[@]%.alias} ) - COMPREPLY=( ${COMPREPLY[@]#$datadir/} ) + COMPREPLY=( $( printf '%s\n' $datadir/*.alias ) ) + COMPREPLY=( "${COMPREPLY[@]%.alias}" ) + COMPREPLY=( "${COMPREPLY[@]#$datadir/}" ) # Then, add the canonical dicts - COMPREPLY+=( $( aspell dicts 2>/dev/null ) ) - COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) ) + COMPREPLY+=( $( $aspell dicts 2>/dev/null ) ) + COMPREPLY=( $( compgen -X '\*' -W '${COMPREPLY[@]}' -- "$cur" ) ) } _aspell() @@ -21,42 +21,42 @@ _aspell() case $prev in -c|-p|check|--conf|--personal|--repl|--per-conf) _filedir - return 0 + return ;; --conf-dir|--data-dir|--dict-dir|--home-dir|--local-data-dir|--prefix) _filedir -d - return 0 + return ;; dump|create|merge) COMPREPLY=( $( compgen -W 'master personal repl' -- "$cur" ) ) - return 0 + return ;; --mode) COMPREPLY=( $( compgen -W "$( $1 modes 2>/dev/null | \ awk '{ print $1 }' )" -- "$cur" ) ) - return 0 + return ;; --sug-mode) COMPREPLY=( $( compgen -W 'ultra fast normal bad-speller' \ -- "$cur" ) ) - return 0 + return ;; --keymapping) COMPREPLY=( $( compgen -W 'aspell ispell' -- "$cur" ) ) - return 0 + return ;; -d|--master) - _aspell_dictionary - return 0 + _aspell_dictionary "$1" + return ;; --add-filter|--rem-filter) COMPREPLY=( $( compgen -W "$( $1 filters 2>/dev/null | \ awk '{ print $1 }' )" -- "$cur" ) ) - return 0 + return ;; esac - $split && return 0 + $split && return if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '--conf= --conf-dir= --data-dir= --dict-dir= @@ -85,4 +85,4 @@ _aspell() } && complete -F _aspell aspell -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/autoconf b/completions/autoconf index fea524e7..c67f1bdb 100644 --- a/completions/autoconf +++ b/completions/autoconf @@ -7,25 +7,25 @@ _autoconf() case "$prev" in --help|-h|--version|-V|--trace|-t) - return 0 + return ;; --output|-o) _filedir - return 0 + return ;; --warnings|-W) local cats=( cross obsolete syntax ) COMPREPLY=( $( compgen -W \ '${cats[@]} ${cats[@]/#/no-} all none error' -- "$cur" ) ) - return 0 + return ;; --prepend-include|-B|--include|-I) _filedir -d - return 0 + return ;; esac - $split && return 0 + $split && return if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) @@ -37,4 +37,4 @@ _autoconf() } && complete -F _autoconf autoconf -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/automake b/completions/automake index 78bc6db2..c5fe1a10 100644 --- a/completions/automake +++ b/completions/automake @@ -7,21 +7,21 @@ _automake() case "$prev" in --help|--version) - return 0 + return ;; --warnings|-W) local cats=( gnu obsolete override portability syntax unsupported ) COMPREPLY=( $( compgen -W \ '${cats[@]} ${cats[@]/#/no-} all none error' -- "$cur" ) ) - return 0 + return ;; --libdir) _filedir -d - return 0 + return ;; esac - $split && return 0 + $split && return if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) @@ -31,6 +31,6 @@ _automake() _filedir } && -complete -F _automake automake automake-1.11 +complete -F _automake automake automake-1.1{0..5} -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/autoreconf b/completions/autoreconf index 8de40c88..c067cec1 100644 --- a/completions/autoreconf +++ b/completions/autoreconf @@ -7,27 +7,27 @@ _autoreconf() case "$prev" in --help|-h|--version|-V) - return 0 + return ;; --warnings|-W) local cats=( cross gnu obsolete override portability syntax \ unsupported ) COMPREPLY=( $( compgen -W \ '${cats[@]} ${cats[@]/#/no-} all none error' -- "$cur" ) ) - return 0 + return ;; --prepend-include|-B|--include|-I) _filedir -d - return 0 + return ;; esac - $split && return 0 + $split && return if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) [[ $COMPREPLY == *= ]] && compopt -o nospace - return 0 + return fi if [[ $1 == autoheader ]] ; then @@ -38,4 +38,4 @@ _autoreconf() } && complete -F _autoreconf autoreconf autoheader -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/autorpm b/completions/autorpm index 616ad8b6..8c6e299a 100644 --- a/completions/autorpm +++ b/completions/autorpm @@ -11,4 +11,4 @@ _autorpm() } && complete -F _autorpm autorpm -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/autoscan b/completions/autoscan index 80b051cf..054a58af 100644 --- a/completions/autoscan +++ b/completions/autoscan @@ -7,20 +7,20 @@ _autoscan() case "$prev" in --help|-h|--version|-V) - return 0 + return ;; --prepend-include|-B|--include|-I) _filedir -d - return 0 + return ;; esac - $split && return 0 + $split && return if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) [[ $COMPREPLY == *= ]] && compopt -o nospace - return 0 + return fi if [[ $1 == autoupdate ]] ; then @@ -31,4 +31,4 @@ _autoscan() } && complete -F _autoscan autoscan autoupdate -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/avctrl b/completions/avctrl index bac38cd6..acd9aeb7 100644 --- a/completions/avctrl +++ b/completions/avctrl @@ -17,4 +17,4 @@ _avctrl() } && complete -F _avctrl avctrl -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/badblocks b/completions/badblocks index 2dc8eb43..d70affe2 100644 --- a/completions/badblocks +++ b/completions/badblocks @@ -7,11 +7,11 @@ _badblocks() case $prev in -b|-c|-e|-d|-p|-t) - return 0 + return ;; -i|-o) _filedir - return 0 + return ;; esac @@ -19,9 +19,9 @@ _badblocks() COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) # Filter out -w (dangerous) and -X (internal use) for i in ${!COMPREPLY[@]}; do - [[ ${COMPREPLY[i]} == -[wX] ]] && unset COMPREPLY[i] + [[ ${COMPREPLY[i]} == -[wX] ]] && unset 'COMPREPLY[i]' done - return 0 + return fi cur=${cur:=/dev/} @@ -29,4 +29,4 @@ _badblocks() } && complete -F _badblocks badblocks -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/bind b/completions/bind new file mode 100644 index 00000000..ec5d0b81 --- /dev/null +++ b/completions/bind @@ -0,0 +1,36 @@ +# bash bind completion -*- shell-script -*- + +_bind() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -l|-p|-P|-s|-S|-v|-V|-r|-x|-X) + return + ;; + -m) + COMPREPLY=( $( compgen -W "emacs emacs-standard emacs-meta + emacs-ctlx vi vi-move vi-command vi-insert" -- "$cur" ) ) + return + ;; + -f) + _filedir + return + ;; + -q|-u) + COMPREPLY=( $( compgen -W '$( "$1" -l )' -- "$cur" ) ) + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + return + fi + + COMPREPLY=( $( compgen -A binding -- "$cur" ) ) +} && +complete -F _bind bind + +# ex: filetype=sh diff --git a/completions/bk b/completions/bk index 8be6fb76..334e25b4 100644 --- a/completions/bk +++ b/completions/bk @@ -7,13 +7,12 @@ _bk() _init_completion || return local BKCMDS="$( bk help topics 2>/dev/null | \ - awk '/^ bk/ { print $4 }' | xargs printf '%s ' )" + awk '/^ bk/ { print $2 }' | xargs printf '%s ' )" COMPREPLY=( $( compgen -W "$BKCMDS" -- "$cur" ) ) _filedir - return 0 } && complete -F _bk bk -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/brctl b/completions/brctl index 27207158..01370654 100644 --- a/completions/brctl +++ b/completions/brctl @@ -18,7 +18,7 @@ _brctl() show) ;; *) - COMPREPLY=( $( compgen -W "$(brctl show | \ + COMPREPLY=( $( compgen -W "$($1 show | \ awk 'NR>1 {print $1}' )" -- "$cur" ) ) esac ;; @@ -36,4 +36,4 @@ _brctl() } && complete -F _brctl -o default brctl -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/btdownloadheadless.py b/completions/btdownloadheadless.py index dc9789a9..f0b74615 100644 --- a/completions/btdownloadheadless.py +++ b/completions/btdownloadheadless.py @@ -8,11 +8,11 @@ _btdownload() case $prev in --responsefile|--saveas) _filedir - return 0 + return ;; esac - if [[ "$cur" == -* ]]; then + if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '--max_uploads --keepalive_interval --download_slice_size --request_backlog --max_message_length --ip --minport --maxport --responsefile --url --saveas --timeout @@ -29,4 +29,4 @@ _btdownload() complete -F _btdownload btdownloadheadless.py btdownloadcurses.py \ btdownloadgui.py -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/bts b/completions/bts new file mode 100644 index 00000000..ba33fd66 --- /dev/null +++ b/completions/bts @@ -0,0 +1,115 @@ +# bts completion -*- shell-script -*- + +# List bug numbers from bugs cache in ~/.devscripts_cache/bts +_cached_bugs() { + [[ -d $HOME/.devscripts_cache/bts ]] && \ + find $HOME/.devscripts_cache/bts -maxdepth 1 -name "$cur[0-9]*.html" \ + -printf "%f\n" | cut -d'.' -f1 +} + +# List APT source packages prefixed with "src:" +_src_packages_with_prefix() { + ppn=${cur:4} # partial package name, after stripping "src:" + compgen -P "src:" -W '$( _xfunc apt-cache _apt_cache_sources "$ppn" )' \ + -- "$ppn" +} + + +_bts() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + show|bugs) + COMPREPLY=( $( compgen -W 'release-critical RC from: tag: + usertag:' -- "$cur" ) $( _cached_bugs ) + $( _src_packages_with_prefix ) ) + return + ;; + select) + COMPREPLY=( $( compgen -W 'package: source: maintainer: submitter: + severity: status: tag: owner: correspondent: affects: bugs: + users: archive:' -- "$cur" ) ) + return + ;; + status) + COMPREPLY=( $( compgen -W 'file: fields: verbose' -- "$cur" ) + $( _cached_bugs ) ) + return + ;; + block|unblock) + COMPREPLY=( $( compgen -W 'by with' -- "$cur" ) ) + return + ;; + severity) + COMPREPLY=( $( compgen -W 'wishlist minor normal important serious + grave critical' -- "$cur" ) ) + return + ;; + limit) + COMPREPLY=( $( compgen -W 'submitter date subject msgid package + source tag severity owner affects archive' -- "$cur" ) ) + return + ;; + clone|done|reopen|archive|unarchive|retitle|summary|submitter|found\ + |notfound|fixed|notfixed|merge|forcemerge|unmerge|claim|unclaim\ + |forwarded|notforwarded|owner|noowner|subscribe|unsubscribe\ + |reportspam|spamreport|affects|usertag|usertags|reassign|tag\ + |tags) + COMPREPLY=( $( _cached_bugs ) ) + return + ;; + package) + COMPREPLY=( $( _xfunc apt-cache _apt_cache_packages ) ) + return + ;; + cache) + COMPREPLY=( $( _xfunc apt-cache _apt_cache_packages ) + $( _src_packages_with_prefix ) + $( compgen -W 'from: release-critical RC' -- "$cur" ) ) + return + ;; + cleancache) + COMPREPLY=( $( _xfunc apt-cache _apt_cache_packages ) + $( _src_packages_with_prefix ) + $( compgen -W 'from: tag: usertag: ALL' -- "$cur" ) ) + return + ;; + user) + # non-predicible arguments + COMPREPLY=( ) + return + ;; + :) + # Chances are that "src:" is being completed + # COMP_WORDS would be: "bts cleancache src : " + pos=$((COMP_CWORD - 2)) + if [[ $pos -gt 0 && "${COMP_WORDS[$pos]}" == "src" ]]; then + COMPREPLY=( $( _xfunc apt-cache _apt_cache_src_packages ) ) + return + fi + ;; + esac + + $split && return + + COMPREPLY=( $( compgen -W '--offline --online --no-offline + --no-action --cache --no-cache --cache-mode --cache-delay --mbox + --mailreader --cc-addr --use-default-cc --no-use-default-cc + --sendmail --mutt --no-mutt --smtp-host --smtp-username + --smtp-helo --bts-server --force-refresh --no-force-refresh + --only-new --include-resolved --no-include-resolved --no-ack --ack + --interactive --force-interactive --no-interactive --quiet + --no-conf --noconf + show bugs select status clone done reopen archive unarchive retitle + summary submitter reassign found notfound fixed notfixed block unblock + merge forcemerge unmerge tag tags affects user usertag usertags claim + unclaim severity forwarded notforwarded package limit owner noowner + subscribe unsubscribe reportspam spamreport cache cleancache version + help' -- "$cur" ) ) + +} && +complete -F _bts bts + +# ex: filetype=sh diff --git a/completions/bzip2 b/completions/bzip2 index 1bc98288..8362a595 100644 --- a/completions/bzip2 +++ b/completions/bzip2 @@ -7,11 +7,11 @@ _bzip2() case $prev in -b|-h|--help|-p) - return 0 + return ;; -n) COMPREPLY=( $( compgen -W "{1..$(_ncpus)}" -- "$cur" ) ) - return 0 + return ;; esac @@ -19,22 +19,20 @@ _bzip2() local helpopts=$( _parse_help "$1" ) COMPREPLY=( $( compgen -W "${helpopts//#/} -2 -3 -4 -5 -6 -7 -8 -9" \ -- "$cur" ) ) - return 0 + return fi local IFS=$'\n' xspec="*.bz2" if [[ "$prev" == --* ]]; then - [[ "$prev" == --decompress || \ - "$prev" == --list || \ - "$prev" == --test ]] && xspec="!"$xspec + [[ "$prev" == --@(decompress|list|test) ]] && xspec="!"$xspec [[ "$prev" == --compress ]] && xspec= elif [[ "$prev" == -* ]]; then [[ "$prev" == -*[dt]* ]] && xspec="!"$xspec [[ "$prev" == -*z* ]] && xspec= fi - _expand || return 0 + _expand || return compopt -o filenames COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \ @@ -42,4 +40,4 @@ _bzip2() } && complete -F _bzip2 bzip2 pbzip2 lbzip2 -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/cal b/completions/cal deleted file mode 100644 index 880b0b35..00000000 --- a/completions/cal +++ /dev/null @@ -1,34 +0,0 @@ -# cal(1) completion -*- shell-script -*- - -_cal() -{ - local cur prev words cword - _init_completion || return - - case $prev in - -m) - if [[ $OSTYPE == *bsd* ]]; then - COMPREPLY=( $( compgen -W '{1..12}' -- "$cur" ) ) - return - fi - ;; - -s) - [[ $OSTYPE == *bsd* ]] && return - ;; - -A|-B|-d|-H) - return - ;; - esac - - if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) - return - fi - - local args - _count_args - [[ $args -eq 1 ]] && COMPREPLY=( $( compgen -W '{1..12}' -- "$cur" ) ) -} && -complete -F _cal cal ncal - -# ex: ts=4 sw=4 et filetype=sh diff --git a/completions/cancel b/completions/cancel index 3e9a3781..2722d2a8 100644 --- a/completions/cancel +++ b/completions/cancel @@ -9,4 +9,4 @@ _cancel() } && complete -F _cancel cancel -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/cardctl b/completions/cardctl index 5b5bb5d5..273d1a90 100644 --- a/completions/cardctl +++ b/completions/cardctl @@ -12,4 +12,4 @@ _cardctl() } && complete -F _cardctl cardctl pccardctl -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/ccache b/completions/ccache index 63f5a1c6..7184d74e 100644 --- a/completions/ccache +++ b/completions/ccache @@ -5,15 +5,27 @@ _ccache() local cur prev words cword split _init_completion -s || return - if [[ $COMP_CWORD -eq 1 && ${COMP_WORDS[COMP_CWORD]} != -* ]]; then - _command_offset 1 - return - fi + local i + for (( i=1; i <= COMP_CWORD; i++ )); do + if [[ ${COMP_WORDS[i]} != -* ]]; then + _command_offset $i + return + fi + [[ ${COMP_WORDS[i]} == -[oFM] ]] && ((i++)) + done case $prev in -h|--help|-V|--version|-F|--max-files|-M|--max-size) return ;; + -o|--set-config) + if [[ $cur != *=* ]]; then + COMPREPLY=( $( compgen -S = -W "$( $1 -p 2>/dev/null | \ + awk '$3 = "=" { print $2 }' )" -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + fi + return + ;; esac $split && return @@ -23,4 +35,4 @@ _ccache() } && complete -F _ccache ccache -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/cfagent b/completions/cfagent index f3e227a4..fbf364ed 100644 --- a/completions/cfagent +++ b/completions/cfagent @@ -8,7 +8,7 @@ _cfagent() case $prev in -f|--file) _filedir - return 0 + return ;; esac @@ -18,4 +18,4 @@ _cfagent() } && complete -F _cfagent cfagent -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/cfrun b/completions/cfrun index 7dd1beff..f4d1f265 100644 --- a/completions/cfrun +++ b/completions/cfrun @@ -17,7 +17,7 @@ _cfrun() case $prev in -f) _filedir - return 0 + return ;; esac @@ -31,7 +31,7 @@ _cfrun() break fi done - [[ ! -f $hostfile ]] && return 0 + [[ ! -f $hostfile ]] && return COMPREPLY=( $(compgen -W "$( command grep -v \ -E '(=|^$|^#)' $hostfile )" -- "$cur" ) ) @@ -44,4 +44,4 @@ _cfrun() } && complete -F _cfrun cfrun -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/chage b/completions/chage index 1842bb8a..9b11f169 100644 --- a/completions/chage +++ b/completions/chage @@ -8,19 +8,19 @@ _chage() case $prev in -d|--lastday|-E|--expiredate|-h|--help|-I|--inactive|-m|--mindays|\ -M|--maxdays|-W|--warndays) - return 0 + return ;; esac - $split && return 0 + $split && return if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) - return 0 + return fi COMPREPLY=( $( compgen -u -- "$cur" ) ) } && complete -F _chage chage -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/change_pw b/completions/change_pw index abc7d6b1..b0f2061f 100644 --- a/completions/change_pw +++ b/completions/change_pw @@ -8,11 +8,11 @@ _change_pw() case $prev in -l|--listname) _xfunc list_lists _mailman_lists - return 0 + return ;; esac - $split && return 0 + $split && return if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '--all --domain --listname --password --quiet @@ -22,4 +22,4 @@ _change_pw() } && complete -F _change_pw change_pw -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/check_db b/completions/check_db index 651b375c..6f666173 100644 --- a/completions/check_db +++ b/completions/check_db @@ -14,4 +14,4 @@ _check_db() } && complete -F _check_db check_db -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/check_perms b/completions/check_perms index 472b9266..0fb05b11 100644 --- a/completions/check_perms +++ b/completions/check_perms @@ -12,4 +12,4 @@ _check_perms() } && complete -F _check_perms check_perms -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/checksec b/completions/checksec new file mode 100644 index 00000000..4e9fb601 --- /dev/null +++ b/completions/checksec @@ -0,0 +1,37 @@ +# bash completion for checksec -*- shell-script -*- + +_checksec() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --version|--help) + return + ;; + --file|--fortify-file) + _filedir + return + ;; + --dir) + _filedir -d + return + ;; + --proc) + _pnames + return + ;; + --proc-libs|--fortify-proc) + _pids + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + return + fi +} && +complete -F _checksec checksec + +# ex: filetype=sh diff --git a/completions/chgrp b/completions/chgrp index 26220d9e..986a77a6 100644 --- a/completions/chgrp +++ b/completions/chgrp @@ -9,10 +9,10 @@ _chgrp() if [[ "$prev" == --reference ]]; then _filedir - return 0 + return fi - $split && return 0 + $split && return # options completion if [[ "$cur" == -* ]]; then @@ -23,18 +23,17 @@ _chgrp() COMPREPLY=( $( compgen -W '-c -h -f -R -v --changes --dereference --no-dereference --silent --quiet --reference --recursive --verbose --help --version $opts' -- "$cur" ) ) - return 0 + return fi # first parameter on line or first since an option? if [[ $cword -eq 1 && "$cur" != -* || "$prev" == -* ]]; then _allowed_groups "$cur" else - _filedir || return 0 + _filedir fi - return 0 } && complete -F _chgrp chgrp -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/chkconfig b/completions/chkconfig index b1dd925e..8766b3a2 100644 --- a/completions/chkconfig +++ b/completions/chkconfig @@ -9,15 +9,15 @@ _chkconfig() --level=[1-6]|[1-6]|--list|--add|--del|--override) _services _xinetd_services - return 0 + return ;; --level) COMPREPLY=( $( compgen -W '{1..6}' -- "$cur" ) ) - return 0 + return ;; esac - $split && return 0 + $split && return if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '--list --add --del --override --level' \ @@ -34,4 +34,4 @@ _chkconfig() } && complete -F _chkconfig chkconfig -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/chown b/completions/chown index 54d89fb8..c4479dd2 100644 --- a/completions/chown +++ b/completions/chown @@ -9,15 +9,15 @@ _chown() case "$prev" in --from) _usergroup - return 0 + return ;; --reference) _filedir - return 0 + return ;; esac - $split && return 0 + $split && return if [[ "$cur" == -* ]]; then # Complete -options @@ -43,4 +43,4 @@ _chown() } && complete -F _chown chown -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/chpasswd b/completions/chpasswd index 499ec93b..93e74f8c 100644 --- a/completions/chpasswd +++ b/completions/chpasswd @@ -9,18 +9,18 @@ _chpasswd() -c|--crypt) COMPREPLY=( $( compgen -W 'DES MD5 NONE SHA256 SHA512' \ -- "$cur" ) ) - return 0 + return ;; -s|--sha-rounds) - return 0 + return ;; esac - $split && return 0 + $split && return COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) [[ $COMPREPLY == *= ]] && compopt -o nospace } && complete -F _chpasswd chpasswd -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/chronyc b/completions/chronyc index 3544c753..ede6bb09 100644 --- a/completions/chronyc +++ b/completions/chronyc @@ -1,5 +1,16 @@ # chronyc(1) completion -*- shell-script -*- +_chronyc_command_args() +{ + local -a args=( $( compgen -W "$( $1 help 2>/dev/null | \ + awk '/^'$prev'\s[^ []/ { gsub("\\|", " ", $2); print $2 }' )" ) ) + case $args in + \) _known_hosts_real "$cur" ;; + \<*) ;; + *) COMPREPLY+=( $( compgen -W '${args[@]}' -- "$cur" ) ) ;; + esac +} + _chronyc() { local cur prev words cword @@ -16,7 +27,7 @@ _chronyc() esac if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" ) -6' -- "$cur" ) ) return fi @@ -24,40 +35,19 @@ _chronyc() for (( i=1; i < cword; i++ )); do [[ ${words[i]} != -* && ${words[i-1]} != @(-p|-h) ]] && (( args++ )) done - + case $args in 0) COMPREPLY=( $( compgen -W "$( $1 help 2>/dev/null | \ - awk 'NR > 1 { sub("\\|", " ", $1); print $1 }' )" -- "$cur" ) ) + awk '!/(^ |: *$)/ { sub("\\|", " ", $1); print $1 }' )" \ + -- "$cur" ) ) ;; 1) - case $prev in - accheck|cmdaccheck|delete|maxdelay|maxdelayratio|\ - maxdelaydevratio|maxpoll|minpoll|minstratum|polltarget) - _known_hosts_real "$cur" - ;; - add) - COMPREPLY=( $( compgen -W 'peer server' -- "$cur" ) ) - ;; - allow|cmdallow|cmddeny|deny) - COMPREPLY=( $( compgen -W 'all' -- "$cur" ) ) - ;; - authhash) - COMPREPLY=( $( compgen -W 'MD5 SHA1' -- "$cur" ) ) - ;; - dns) - COMPREPLY=( $( compgen -W '-n +n -4 -6 -46' -- "$cur" ) ) - ;; - local) - COMPREPLY=( $( compgen -W 'off stratum' -- "$cur" ) ) - ;; - manual) - COMPREPLY=( $( compgen -W 'list on off reset' -- "$cur" ) ) - ;; - sources|sourcestats) - COMPREPLY=( $( compgen -W '-v' -- "$cur" ) ) - ;; - esac + _chronyc_command_args "$1" + if [[ ! $COMPREPLY && $prev == sources?(tats) ]]; then + # [-v] not handled by _chronyc_command_args yet + COMPREPLY=( $( compgen -W '-v' -- "$cur" ) ) + fi ;; 2) [[ $prev == @(peer|server) ]] && _known_hosts_real "$cur" @@ -66,4 +56,4 @@ _chronyc() } && complete -F _chronyc chronyc -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/chrpath b/completions/chrpath index 29a71851..13e43ad0 100644 --- a/completions/chrpath +++ b/completions/chrpath @@ -24,4 +24,4 @@ _chrpath() } && complete -F _chrpath chrpath -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/chsh b/completions/chsh deleted file mode 100644 index f65291a1..00000000 --- a/completions/chsh +++ /dev/null @@ -1,28 +0,0 @@ -# chsh(1) completion -*- shell-script -*- - -_chsh() -{ - local cur prev words cword - _init_completion || return - - case $prev in - --list-shells|--help|-v|--version) - return 0 - ;; - -s|--shell) - _shells - return 0 - ;; - esac - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) - else - _allowed_users - fi - - return 0 -} && -complete -F _chsh chsh - -# ex: ts=4 sw=4 et filetype=sh diff --git a/completions/cksfv b/completions/cksfv index eabe3730..dd90816e 100644 --- a/completions/cksfv +++ b/completions/cksfv @@ -7,23 +7,23 @@ _cksfv() if [[ $cword -eq 1 ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) - return 0 + return fi case "$prev" in -C|-g) _filedir -d - return 0 + return ;; -f) _filedir 'sfv' - return 0 + return ;; esac _filedir - return 0 + } && complete -F _cksfv cksfv -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/cleanarch b/completions/cleanarch index 7fb05299..edac34f8 100644 --- a/completions/cleanarch +++ b/completions/cleanarch @@ -13,4 +13,4 @@ _cleanarch() } && complete -F _cleanarch cleanarch -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/clisp b/completions/clisp index cdbf6bd2..23b04f04 100644 --- a/completions/clisp +++ b/completions/clisp @@ -16,8 +16,7 @@ _clisp() _filedir fi - return 0 } && complete -F _clisp -o default clisp -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/clone_member b/completions/clone_member index 9dd55fe8..fe45e494 100644 --- a/completions/clone_member +++ b/completions/clone_member @@ -8,11 +8,11 @@ _clone_member() case $prev in -l|--listname) _xfunc list_lists _mailman_lists - return 0 + return ;; esac - $split && return 0 + $split && return if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '--listname --remove --admin --quiet @@ -22,4 +22,4 @@ _clone_member() } && complete -F _clone_member clone_member -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/complete b/completions/complete index bcac435d..5de2d168 100644 --- a/completions/complete +++ b/completions/complete @@ -9,7 +9,7 @@ _complete() -o) COMPREPLY=( $( compgen -W 'bashdefault default dirnames filenames nospace plusdirs' -- "$cur" ) ) - return 0 + return ;; -A) @@ -17,21 +17,21 @@ _complete() directory disabled enabled export file function group helptopic hostname job keyword running service setopt shopt signal stopped user variable' -- "$cur" ) ) - return 0 + return ;; -C) COMPREPLY=( $( compgen -A command -- "$cur" ) ) - return 0 + return ;; -F) COMPREPLY=( $( compgen -A function -- "$cur" ) ) - return 0 + return ;; -p|-r) - COMPREPLY=( $( complete -p | sed -e 's|.* ||' ) ) + COMPREPLY=( $( complete -p | command sed -e 's|.* ||' ) ) COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) ) - return 0 + return ;; esac @@ -47,4 +47,4 @@ _complete() } && complete -F _complete compgen complete -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/config_list b/completions/config_list index 68ab6cb7..653c628a 100644 --- a/completions/config_list +++ b/completions/config_list @@ -8,11 +8,11 @@ _config_list() case $prev in -i|-o|--inputfile|--outputfile) _filedir - return 0 + return ;; esac - $split && return 0 + $split && return if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '--inputfile --outputfile --checkonly @@ -24,4 +24,4 @@ _config_list() } && complete -F _config_list config_list -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/configure b/completions/configure index 2337c497..0e37726b 100644 --- a/completions/configure +++ b/completions/configure @@ -20,16 +20,16 @@ _configure() ;; esac - $split && return 0 + $split && return # if $COMP_CONFIGURE_HINTS is not null, then completions of the form # --option=SETTING will include 'SETTING' as a contextual hint - [[ "$cur" != -* ]] && return 0 + [[ "$cur" != -* ]] && return if [[ -n $COMP_CONFIGURE_HINTS ]]; then COMPREPLY=( $( compgen -W "$( $1 --help 2>&1 | \ awk '/^ --[A-Za-z]/ { print $1; \ - if ($2 ~ /--[A-Za-z]/) print $2 }' | sed -e 's/[[,].*//g' )" \ + if ($2 ~ /--[A-Za-z]/) print $2 }' | command sed -e 's/[[,].*//g' )" \ -- "$cur" ) ) [[ $COMPREPLY == *=* ]] && compopt -o nospace else @@ -39,4 +39,4 @@ _configure() } && complete -F _configure configure -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/convert b/completions/convert index ffb320e2..59647d59 100644 --- a/completions/convert +++ b/completions/convert @@ -6,88 +6,88 @@ _ImageMagick() -channel) COMPREPLY=( $( compgen -W 'Red Green Blue Opacity Matte Cyan Magenta Yellow Black' -- "$cur" ) ) - return 0 + return ;; -colormap) COMPREPLY=( $( compgen -W 'shared private' -- "$cur" ) ) - return 0 + return ;; -colorspace) COMPREPLY=( $( compgen -W 'GRAY OHTA RGB Transparent XYZ YCbCr YIQ YPbPr YUV CMYK' -- "$cur" ) ) - return 0 + return ;; -compose) COMPREPLY=( $( compgen -W 'Over In Out Atop Xor Plus Minus Add Subtract Difference Multiply Bumpmap Copy CopyRed CopyGreen CopyBlue CopyOpacity' -- "$cur" ) ) - return 0 + return ;; -compress) COMPREPLY=( $( compgen -W 'None BZip Fax Group4 JPEG Lossless LZW RLE Zip' -- "$cur" ) ) - return 0 + return ;; -dispose) COMPREPLY=( $( compgen -W 'Undefined None Background Previous' \ -- "$cur" ) ) - return 0 + return ;; -encoding) COMPREPLY=( $( compgen -W 'AdobeCustom AdobeExpert AdobeStandard AppleRoman BIG5 GB2312 Latin2 None SJIScode Symbol Unicode Wansung' -- "$cur" ) ) - return 0 + return ;; -endian) COMPREPLY=( $( compgen -W 'MSB LSB' -- "$cur" ) ) - return 0 + return ;; -filter) COMPREPLY=( $( compgen -W 'Point Box Triangle Hermite Hanning Hamming Blackman Gaussian Quadratic Cubic Catrom Mitchell Lanczos Bessel Sinc' -- "$cur" ) ) - return 0 + return ;; -format) COMPREPLY=( $( compgen -W "$( convert -list format | awk \ '/ [r-][w-][+-] / { sub("[*]$","",$1); print tolower($1) }' )" \ -- "$cur" ) ) - return 0 + return ;; -gravity) COMPREPLY=( $( compgen -W 'Northwest North NorthEast West Center East SouthWest South SouthEast' -- "$cur" ) ) - return 0 + return ;; -intent) COMPREPLY=( $( compgen -W 'Absolute Perceptual Relative Saturation' -- "$cur" ) ) - return 0 + return ;; -interlace) COMPREPLY=( $( compgen -W 'None Line Plane Partition' -- "$cur" ) ) - return 0 + return ;; -limit) COMPREPLY=( $( compgen -W 'Disk File Map Memory' -- "$cur" ) ) - return 0 + return ;; -list) COMPREPLY=( $( compgen -W 'Delegate Format Magic Module Resource Type' -- "$cur" ) ) - return 0 + return ;; -map) COMPREPLY=( $( compgen -W 'best default gray red green blue' \ -- "$cur" ) ) _filedir - return 0 + return ;; -noise) COMPREPLY=( $( compgen -W 'Uniform Gaussian Multiplicative Impulse Laplacian Poisson' -- "$cur" ) ) - return 0 + return ;; -preview) COMPREPLY=( $( compgen -W 'Rotate Shear Roll Hue Saturation @@ -95,32 +95,32 @@ _ImageMagick() ReduceNoise AddNoise Sharpen Blur Treshold EdgeDetect Spread Shade Raise Segment Solarize Swirl Implode Wave OilPaint CharcoalDrawing JPEG' -- "$cur" ) ) - return 0 + return ;; -mask|-profile|-texture|-tile|-write) _filedir - return 0 + return ;; -type) COMPREPLY=( $( compgen -W 'Bilevel Grayscale Palette PaletteMatte TrueColor TrueColorMatte ColorSeparation ColorSeparationlMatte Optimize' -- "$cur" ) ) - return 0 + return ;; -units) COMPREPLY=( $( compgen -W 'Undefined PixelsPerInch PixelsPerCentimeter' -- "$cur" ) ) - return 0 + return ;; -virtual-pixel) COMPREPLY=( $( compgen -W 'Constant Edge mirror tile' -- "$cur" ) ) - return 0 + return ;; -visual) COMPREPLY=( $( compgen -W 'StaticGray GrayScale StaticColor PseudoColor TrueColor DirectColor defaut visualid' \ -- "$cur" ) ) - return 0 + return ;; esac @@ -321,4 +321,4 @@ _stream() } && complete -F _stream stream -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/cowsay b/completions/cowsay index 8e96b91e..4f4411ac 100644 --- a/completions/cowsay +++ b/completions/cowsay @@ -9,7 +9,7 @@ _cowsay() -f) COMPREPLY=( $( compgen -W \ '$( cowsay -l 2>/dev/null | tail -n +2 )' -- "$cur" ) ) - return 0 + return ;; esac @@ -20,4 +20,4 @@ _cowsay() } && complete -F _cowsay -o default cowsay cowthink -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/cpan2dist b/completions/cpan2dist index f6a67ac6..9704782d 100644 --- a/completions/cpan2dist +++ b/completions/cpan2dist @@ -11,11 +11,11 @@ _cpan2dist() COMPREPLY=( $( compgen -W '$(perl -MCPANPLUS::Dist -e \ "print map { \"\$_\n\" } CPANPLUS::Dist->dist_types")' \ -- "$cur" ) ) - return 0 + return ;; --banlist|--ignorelist|--modulelist|--logfile) _filedir - return 0 + return ;; esac @@ -29,9 +29,9 @@ _cpan2dist() packagelist="$dir/02packages.details.txt.gz" done [[ $packagelist ]] && COMPREPLY=( $( zgrep "^${cur//-/::}" \ - $packagelist 2>/dev/null | awk '{print $1}' | sed -e 's/::/-/g' ) ) + $packagelist 2>/dev/null | awk '{print $1}' | command sed -e 's/::/-/g' ) ) fi } && complete -F _cpan2dist -o default cpan2dist -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/cpio b/completions/cpio index d63d15a9..36e3fe90 100644 --- a/completions/cpio +++ b/completions/cpio @@ -10,24 +10,24 @@ _cpio() -H|--format) COMPREPLY=( $( compgen -W \ 'bin odc newc crc tar ustar hpbin hpodc' -- "$cur" ) ) - return 0 + return ;; -E|-F|-I|--file|--pattern-file) _filedir - return 0 + return ;; -R|--owner) _usergroup - return 0 + return ;; --rsh-command) compopt -o filenames COMPREPLY=( $( compgen -c -- "$cur" ) ) - return 0 + return ;; esac - $split && return 0 + $split && return if [[ $cword -eq 1 ]]; then COMPREPLY=( $( compgen -W '-o --create -i --extract -p --pass-through @@ -75,4 +75,4 @@ _cpio() } && complete -F _cpio cpio -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/cppcheck b/completions/cppcheck index 64bb9b02..86990dd5 100644 --- a/completions/cppcheck +++ b/completions/cppcheck @@ -6,12 +6,13 @@ _cppcheck() _init_completion -s || return case $prev in - --append|--exitcode-suppressions|--file-list|--rule-file|\ + --append|--exitcode-suppressions|--rule-file|--config-excludes-file|\ --suppressions-list|--includes-file|--include|-i) _filedir return ;; - -D|-U|--rule|--suppress|--template|--max-configs) + -D|-U|--rule|--suppress|--template|--max-configs|-h|--help|--version|\ + --errorlist|--config-exclude|-l) return ;; --enable) @@ -22,8 +23,9 @@ _cppcheck() cur="${cur##*,}" split=true fi - COMPREPLY=( $( compgen -W 'all style performance portability - information unusedFunction missingInclude' -- "$cur" ) ) + COMPREPLY=( $( compgen -W 'all warning style performance + portability information unusedFunction missingInclude' \ + -- "$cur" ) ) $split && COMPREPLY=( ${COMPREPLY[@]/#/"$prev,"} ) return ;; @@ -31,6 +33,11 @@ _cppcheck() COMPREPLY=( $( compgen -W '{0..255}' -- "$cur" ) ) return ;; + --file-list) + _filedir + [[ -z $cur || $cur == - ]] && COMPREPLY+=( - ) + return + ;; -I) _filedir -d return @@ -49,8 +56,9 @@ _cppcheck() return ;; --platform) - COMPREPLY=( $( compgen -W 'unix32 unix64 win32A win32W win64' \ - -- "$cur" ) ) + _filedir + COMPREPLY+=( $( compgen -W 'unix32 unix64 win32A win32W win64 + native' -- "$cur" ) ) return ;; -rp|--relative-paths) @@ -59,6 +67,10 @@ _cppcheck() return fi ;; + --library) + _filedir cfg + return + ;; --xml-version) COMPREPLY=( $( compgen -W '1 2' -- "$cur" ) ) return @@ -71,9 +83,9 @@ _cppcheck() COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) [[ $COMPREPLY == *= ]] && compopt -o nospace else - _filedir @(cpp|cxx|cc|c++|c|h|hpp|hxx|h++|tpp|txx) + _filedir '@([cht]pp|[cht]xx|cc|[ch]++|[ch])' fi } && complete -F _cppcheck cppcheck -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/crontab b/completions/crontab index ddd0066c..bb8d0e24 100644 --- a/completions/crontab +++ b/completions/crontab @@ -8,7 +8,7 @@ _crontab() case $prev in -u) _allowed_users - return 0 + return ;; esac @@ -18,31 +18,31 @@ _crontab() local i for (( i=0; i < ${#words[@]}-1; i++ )); do - [[ ${words[i]} ]] && unset opts[${words[i]}] + [[ ${words[i]} ]] && unset "opts[${words[i]}]" case "${words[i]}" in -l) - unset opts[-r] opts[-e] opts[-i] opts[-s] + unset 'opts[-r]' 'opts[-e]' 'opts[-i]' 'opts[-s]' ;; -e) - unset opts[-l] opts[-r] opts[-i] + unset 'opts[-l]' 'opts[-r]' 'opts[-i]' ;; -r) - unset opts[-l] opts[-e] + unset 'opts[-l]' 'opts[-e]' ;; -u) - unset opts[-i] + unset 'opts[-i]' ;; esac done if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '${!opts[@]}' -- "$cur" ) ) - return 0 + return fi # do filenames only if we did not have -l, -r, or -e - [[ "${words[@]}" == *\ -@(l|r|e)* ]] || _filedir + [[ "${words[@]}" == *\ -[lre]* ]] || _filedir } && complete -F _crontab crontab -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/cryptsetup b/completions/cryptsetup index a295a147..9411ad7a 100644 --- a/completions/cryptsetup +++ b/completions/cryptsetup @@ -20,7 +20,7 @@ _cryptsetup() case $prev in --key-file|--master-key-file|--header-backup-file|-d) _filedir - return 0 + return ;; esac @@ -99,8 +99,7 @@ _cryptsetup() esac fi - return 0 } && complete -F _cryptsetup cryptsetup -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/curl b/completions/curl index 6b56aa57..8251674c 100644 --- a/completions/curl +++ b/completions/curl @@ -92,4 +92,4 @@ _curl() } && complete -F _curl curl -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/cvs b/completions/cvs index 71277556..fee256f2 100644 --- a/completions/cvs +++ b/completions/cvs @@ -51,7 +51,7 @@ _cvs() _init_completion -n : || return local count mode i cvsroot cvsroots pwd - local -a flags miss files entries changed newremoved + local -a flags files entries changed newremoved count=0 for i in "${words[@]}"; do @@ -64,7 +64,7 @@ _cvs() case $i in -H|--help) COMPREPLY=( $( compgen -W "$( _cvs_commands )" -- "$cur" ) ) - return 0 + return ;; -d) mode=cvsroot @@ -131,7 +131,7 @@ _cvs() mode=version ;; esac - elif [[ "$i" = -* ]]; then + elif [[ "$i" == -* ]]; then flags+=( $i ) fi count=$((++count)) @@ -141,11 +141,11 @@ _cvs() add) case $prev in -m) - return 0 + return ;; -k) _cvs_kflags - return 0 + return ;; esac @@ -156,11 +156,11 @@ _cvs() local f for i in ${!files[@]}; do if [[ ${files[i]} == ?(*/)CVS ]]; then - unset files[i] + unset 'files[i]' else for f in "${entries[@]}"; do if [[ ${files[i]} == $f && ! -d $f ]]; then - unset files[i] + unset 'files[i]' break fi done @@ -175,19 +175,19 @@ _cvs() admin) case $prev in -a|-A|-b|-c|-e|-l|-m|-n|-N|-o|-s|-t-|-u) - return 0 + return ;; -t) _filedir - return 0 + return ;; -k) _cvs_kflags - return 0 + return ;; esac - if [[ "$cur" = -* ]]; then + if [[ "$cur" == -* ]]; then _cvs_command_options "$1" $mode else _cvs_entries @@ -195,9 +195,9 @@ _cvs() fi ;; annotate) - [[ "$prev" == -@(r|D) ]] && return 0 + [[ "$prev" == -[rD] ]] && return - if [[ "$cur" = -* ]]; then + if [[ "$cur" == -* ]]; then _cvs_command_options "$1" $mode else _cvs_entries @@ -206,16 +206,16 @@ _cvs() ;; checkout) case $prev in - -r|-D|j) - return 0 + -r|-D|-j) + return ;; -d) _filedir -d - return 0 + return ;; -k) _cvs_kflags - return 0 + return ;; esac @@ -231,11 +231,11 @@ _cvs() commit) case $prev in -m|-r) - return 0 + return ;; -F) _filedir - return 0 + return ;; esac @@ -248,9 +248,9 @@ _cvs() # far, but other changes (something other than # changed/removed/new) may be missing changed=( $( cvs -q diff --brief 2>&1 | \ - sed -ne 's/^Files [^ ]* and \([^ ]*\) differ$/\1/p' ) ) + command sed -ne 's/^Files [^ ]* and \([^ ]*\) differ$/\1/p' ) ) newremoved=( $( cvs -q diff --brief 2>&1 | \ - sed -ne 's/^cvs diff: \([^ ]*\) .*, no comparison available$/\1/p' ) ) + command sed -ne 's/^cvs diff: \([^ ]*\) .*, no comparison available$/\1/p' ) ) COMPREPLY=( $( compgen -W '${changed[@]:-} \ ${newremoved[@]:-}' -- "$cur" ) ) else @@ -274,7 +274,7 @@ _cvs() fi ;; editors|watchers) - if [[ "$cur" = -* ]]; then + if [[ "$cur" == -* ]]; then _cvs_command_options "$1" $mode else _cvs_entries @@ -284,15 +284,15 @@ _cvs() export) case $prev in -r|-D) - return 0 + return ;; -d) _filedir -d - return 0 + return ;; -k) _cvs_kflags - return 0 + return ;; esac @@ -307,11 +307,11 @@ _cvs() import) case $prev in -I|-b|-m|-W) - return 0 + return ;; -k) _cvs_kflags - return 0 + return ;; esac @@ -334,11 +334,13 @@ _cvs() remove) if [[ "$cur" != -* ]]; then _cvs_entries - # find out what files are missing - for i in "${entries[@]}"; do - [[ ! -r $i ]] && miss+=( $i ) - done - COMPREPLY=( $( compgen -W '${miss[@]:-}' -- "$cur" ) ) + if [[ "$prev" != -f ]]; then + # find out what files are missing + for i in ${!entries[@]}; do + [[ -r "${entries[i]}" ]] && unset 'entries[i]' + done + fi + COMPREPLY=( $( compgen -W '${entries[@]:-}' -- "$cur" ) ) else _cvs_command_options "$1" $mode fi @@ -346,15 +348,15 @@ _cvs() update) case $prev in -r|-D|-j|-I|-W) - return 0 + return ;; -k) _cvs_kflags - return 0 + return ;; esac - if [[ "$cur" = -* ]]; then + if [[ "$cur" == -* ]]; then _cvs_command_options "$1" $mode else _cvs_entries @@ -365,14 +367,14 @@ _cvs() case $prev in -T) _filedir -d - return 0 + return ;; -e|-s) - return 0 + return ;; -z) COMPREPLY=( $( compgen -W '{1..9}' -- "$cur" ) ) - return 0 + return ;; esac @@ -382,8 +384,7 @@ _cvs() ;; esac - return 0 } && complete -F _cvs cvs -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/cvsps b/completions/cvsps index 8b986f57..64dab54f 100644 --- a/completions/cvsps +++ b/completions/cvsps @@ -7,43 +7,43 @@ _cvsps() case $prev in -h|-z|-f|-d|-l|--diff-opts|--debuglvl) - return 0 + return ;; -s) - COMPREPLY=( $( compgen -W "$( cvsps 2>/dev/null | + COMPREPLY=( $( compgen -W "$( $1 2>/dev/null | awk '/^PatchSet:?[ \t]/ { print $2 }' )" -- "$cur" ) ) - return 0 + return ;; -a) - COMPREPLY=( $( compgen -W "$( cvsps 2>/dev/null | + COMPREPLY=( $( compgen -W "$( $1 2>/dev/null | awk '/^Author:[ \t]/ { print $2 }' )" -- "$cur" ) ) - return 0 + return ;; -b) - COMPREPLY=( $( compgen -W "$( cvsps 2>/dev/null | + COMPREPLY=( $( compgen -W "$( $1 2>/dev/null | awk '/^Branch:[ \t]/ { print $2 }' )" -- "$cur" ) ) - return 0 + return ;; -r) - COMPREPLY=( $( compgen -W "$( cvsps 2>/dev/null | + COMPREPLY=( $( compgen -W "$( $1 2>/dev/null | awk '/^Tag:[ \t]+[^(]/ { print $2 }' )" -- "$cur" ) ) - return 0 + return ;; -p) _filedir -d - return 0 + return ;; --test-log) _filedir - return 0 + return ;; -Z) COMPREPLY=( $( compgen -W '{1..9}' -- "$cur" ) ) - return 0 + return ;; --root) _xfunc cvs _cvs_roots - return 0 + return ;; esac @@ -55,4 +55,4 @@ _cvsps() } && complete -F _cvsps cvsps -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/dd b/completions/dd index 53132dcc..daaebbe1 100644 --- a/completions/dd +++ b/completions/dd @@ -9,22 +9,35 @@ _dd() if=*|of=*) cur=${cur#*=} _filedir - return 0 + return ;; conv=*) cur=${cur#*=} COMPREPLY=( $( compgen -W 'ascii ebcdic ibm block unblock lcase - notrunc ucase swab noerror sync' -- "$cur" ) ) - return 0 + ucase sparse swab sync excl nocreat notrunc noerror fdatasync + fsync' -- "$cur" ) ) + return + ;; + iflag=*|oflag=*) + cur=${cur#*=} + COMPREPLY=( $( compgen -W 'append direct directory dsync sync + fullblock nonblock noatime nocache noctty nofollow count_bytes + skip_bytes seek_bytes' -- "$cur" ) ) + return + ;; + status=*) + cur=${cur#*=} + COMPREPLY=( $( compgen -W 'none noxfer progress' -- "$cur" ) ) + return ;; esac - _expand || return 0 + _expand || return COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) \ - $( compgen -W 'bs cbs conv count ibs if obs of seek skip' \ - -S '=' -- "$cur" ) ) + $( compgen -W 'bs cbs conv count ibs if iflag obs of oflag + seek skip status' -S '=' -- "$cur" ) ) } && complete -F _dd -o nospace dd -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/deja-dup b/completions/deja-dup new file mode 100644 index 00000000..a508bb1e --- /dev/null +++ b/completions/deja-dup @@ -0,0 +1,33 @@ +# bash completion for deja-dup(1) -*- shell-script -*- + +_deja_dup() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + -'?'|--help|--help-*) + return + ;; + --restore) + _filedir + return + ;; + --restore-missing) + _filedir -d + return + ;; + esac + + $split && return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" --help-all )' \ + -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + return + fi +} && +complete -F _deja_dup deja-dup + +# ex: filetype=sh diff --git a/completions/desktop-file-validate b/completions/desktop-file-validate index faae6c37..93f21061 100644 --- a/completions/desktop-file-validate +++ b/completions/desktop-file-validate @@ -20,4 +20,4 @@ _desktop_file_validate() } && complete -F _desktop_file_validate desktop-file-validate -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/dhclient b/completions/dhclient index 54d89d31..8b44f6c3 100644 --- a/completions/dhclient +++ b/completions/dhclient @@ -8,11 +8,11 @@ _dhclient() case $prev in -cf|-lf|-pf|-sf) _filedir - return 0 + return ;; -s) _known_hosts_real "$cur" - return 0 + return ;; esac @@ -25,4 +25,4 @@ _dhclient() } && complete -F _dhclient dhclient -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/dict b/completions/dict index a2ecd9b1..ac7df3fc 100644 --- a/completions/dict +++ b/completions/dict @@ -2,8 +2,8 @@ _dictdata() { - dict $host $port $1 2>/dev/null | sed -ne \ - 's/^['$'\t '']['$'\t '']*\([^'$'\t '']*\).*$/\1/p' + dict $host $port $1 2>/dev/null | command sed -ne \ + 's/^[[:blank:]]\{1,\}\([^[:blank:]]*\).*$/\1/p' } _dict() @@ -30,26 +30,22 @@ _dict() [[ -n $db ]] && host="-d $db" i=$((++i)) ;; - *) - ;; esac done - if [[ "$cur" = -* ]]; then + if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) - return 0 + return fi case $prev in -d|--database|-i|-info) COMPREPLY=( $( compgen -W '$( _dictdata -D )' -- "$cur" ) ) - return 0 + return ;; -s|--strategy) COMPREPLY=( $( compgen -W '$( _dictdata -S )' -- "$cur" ) ) - return 0 - ;; - *) + return ;; esac @@ -68,4 +64,4 @@ _dict() } && complete -F _dict -o default dict rdict -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/dmesg b/completions/dmesg deleted file mode 100644 index 3d9bc662..00000000 --- a/completions/dmesg +++ /dev/null @@ -1,31 +0,0 @@ -# dmesg(1) completion -*- shell-script -*- - -_dmesg() -{ - [[ $OSTYPE == *solaris* ]] && return # no args there - - local cur prev words cword - _init_completion || return - - case $prev in - -h|--help|-V|--version|-s|--buffer-size|-M|-N) - return - ;; - -f|--facility) - COMPREPLY=( $( compgen -W 'kern user mail daemon auth syslog lpr - news' -- "$cur" ) ) - return - ;; - -l|--level|-n|--console-level) - COMPREPLY=( $( compgen -W '{1..8}' -- "$cur" ) ) - return - ;; - esac - - local opts=$( _parse_help "$1" ) - [[ $opts ]] || opts=$( _parse_usage "$1" ) - COMPREPLY=( $( compgen -W "$opts" -- "$cur" ) ) -} && -complete -F _dmesg dmesg - -# ex: ts=4 sw=4 et filetype=sh diff --git a/completions/dnsspoof b/completions/dnsspoof index 2518af69..d6b7872b 100644 --- a/completions/dnsspoof +++ b/completions/dnsspoof @@ -8,11 +8,11 @@ _dnsspoof() case $prev in -i) _available_interfaces -a - return 0 + return ;; -f) _filedir - return 0 + return ;; esac @@ -23,4 +23,4 @@ _dnsspoof() } && complete -F _dnsspoof dnsspoof -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/dot b/completions/dot index ef946e4b..bc3531bb 100644 --- a/completions/dot +++ b/completions/dot @@ -5,7 +5,7 @@ _dot() local cur prev words cword _init_completion -n := || return - [[ $prev == -@(V|\?) ]] && return + [[ $prev == -[V?] ]] && return case $cur in -G*|-N*|-E*|-l?*|-q?*|-s?*|-Ln*|-LU*|-LC*|-LT*) @@ -13,13 +13,13 @@ _dot() ;; -T*) local langs=( $( "$1" -TNON_EXISTENT 2>&1 | \ - sed -ne 's/.*one of://p' ) ) + command sed -ne 's/.*one of://p' ) ) COMPREPLY=( $( compgen -P -T -W '${langs[@]}' -- "${cur#-T}" ) ) return ;; -K*) local layouts=( $( "$1" -KNON_EXISTENT 2>&1 | \ - sed -ne 's/.*one of://p' ) ) + command sed -ne 's/.*one of://p' ) ) COMPREPLY=( $( compgen -P -K -W '${layouts[@]}' -- "${cur#-K}" ) ) return ;; @@ -34,7 +34,7 @@ _dot() if [[ $cur == -* ]]; then COMPREPLY=( $( compgen -W '-V -v -G -N -E -T -K -l -o -O -P -q -s -y -n -n1 -n2 -x -Lg -LO -Ln -LU -LC -LT -m -c -?' -- "$cur" ) ) - [[ $COMPREPLY == -@(G|N|E|T|K|o|L[nUCT]) ]] && compopt -o nospace + [[ $COMPREPLY == -@([GNETKo]|L[nUCT]) ]] && compopt -o nospace return fi @@ -42,4 +42,4 @@ _dot() } && complete -F _dot dot -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/dpkg b/completions/dpkg index d14e5e3e..725542a7 100644 --- a/completions/dpkg +++ b/completions/dpkg @@ -8,11 +8,11 @@ _comp_dpkg_installed_packages() } || { _comp_dpkg_installed_packages() { - command grep -A 1 "Package: $1" /var/lib/dpkg/status | \ + command grep -A 1 "Package: $1" /var/lib/dpkg/status 2>/dev/null | \ command grep -B 1 -Ee "ok installed|half-installed|unpacked| \ half-configured" \ -Ee "^Essential: yes" | \ - command grep "Package: $1" | cut -d\ -f2 + awk "/Package: $1/ { print \$2 }" 2>/dev/null } } @@ -24,11 +24,11 @@ _comp_dpkg_purgeable_packages() } || { _comp_dpkg_purgeable_packages() { - command grep -A 1 "Package: $1" /var/lib/dpkg/status | \ + command grep -A 1 "Package: $1" /var/lib/dpkg/status 2>/dev/null | \ command grep -B 1 -Ee "ok installed|half-installed|unpacked| \ half-configured|config-files" \ -Ee "^Essential: yes" | \ - command grep "Package: $1" | cut -d\ -f2 + awk "/Package: $1/ { print \$2 }" 2>/dev/null } } @@ -39,8 +39,6 @@ _dpkg() local cur prev words cword split _init_completion -s || return - _expand || return 0 - local i=$cword # find the last option flag @@ -55,28 +53,28 @@ _dpkg() -c|-i|-A|-I|-f|-e|-x|-X|-W|--install|--unpack|--record-avail| \ --contents|--info|--fsys-tarfile|--field|--control|--extract| \ --show) - _filedir '?(u)deb' - return 0 + _filedir '?(u|d)deb' + return ;; -b|--build) _filedir -d - return 0 + return ;; -s|-p|-l|--status|--print-avail|--list) COMPREPLY=( $( apt-cache pkgnames "$cur" 2>/dev/null ) ) - return 0 + return ;; -S|--search) _filedir - return 0 + return ;; -r|--remove) COMPREPLY=( $( _comp_dpkg_installed_packages "$cur" ) ) - return 0 + return ;; -L|-P|--listfiles|--purge) COMPREPLY=( $( _comp_dpkg_purgeable_packages "$cur" ) ) - return 0 + return ;; esac @@ -98,25 +96,25 @@ _dpkg_reconfigure() case $prev in -f|--frontend) - opt=( $( printf '%s\n' /usr/share/perl5/Debconf/FrontEnd/* ) ) - opt=( ${opt[@]##*/} ) - opt=( ${opt[@]%.pm} ) - COMPREPLY=( $( compgen -W '${opt[@]}' -- "$cur" ) ) - return 0 - ;; + opt=( $( printf '%s\n' /usr/share/perl5/Debconf/FrontEnd/* ) ) + opt=( ${opt[@]##*/} ) + opt=( ${opt[@]%.pm} ) + COMPREPLY=( $( compgen -W '${opt[@]}' -- "$cur" ) ) + return + ;; -p|--priority) - COMPREPLY=( $( compgen -W 'low medium high critical' -- "$cur" ) ) - return 0 - ;; + COMPREPLY=( $( compgen -W 'low medium high critical' -- "$cur" ) ) + return + ;; esac if [[ "$cur" == -* ]]; then COMPREPLY=( $(compgen -W '--frontend --priority --all --unseen-only - --help --showold --force --terse' -- "$cur" ) ) + --help --showold --force --terse' -- "$cur" ) ) else COMPREPLY=( $( _comp_dpkg_installed_packages "$cur" ) ) fi } && complete -F _dpkg_reconfigure -o default dpkg-reconfigure -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/dpkg-source b/completions/dpkg-source index 6cd9bde3..54403851 100644 --- a/completions/dpkg-source +++ b/completions/dpkg-source @@ -8,7 +8,7 @@ _dpkg_source() local options work i action packopts unpackopts fields packopts="-c -l -F -V -T -D -U -W -E -sa -i -I -sk -sr -ss -sA -sK -sP \ - -sU -sR" + -sU -sR" unpackopts="-sp -sn -su" options="-x -b $packopts $unpackopts" fields="Format Source Version Binary Maintainer Uploader Architecture \ @@ -31,22 +31,19 @@ _dpkg_source() -x) _filedir -d _filedir 'dsc' - return 0 ;; *) COMPREPLY=( $( compgen -W "$unpackopts" -- "$cur" ) ) _filedir -d _filedir - return 0 ;; esac - return 0 + return ;; pack) case $prev in -b) _filedir -d - return 0 ;; -c|-l|-T|-i|-I) # -c: get controlfile @@ -57,19 +54,16 @@ _dpkg_source() # return directory names and file names _filedir -d _filedir - return 0 ;; -F) # -F: force change log format COMPREPLY=( $( command ls /usr/lib/dpkg/parsechangelog ) ) - return 0 ;; -V|-D) # -V: set a substitution variable # we don't know anything about possible variables or values # so we don't try to suggest any completion. COMPREPLY=() - return 0 ;; -D) # -D: override or add a .dsc field and value @@ -77,31 +71,28 @@ _dpkg_source() if [[ "$cur" == *=* ]]; then # $cur contains a "=" COMPREPLY=() - return 0 else COMPREPLY=( $( compgen -W "$fields" -- "$cur" ) ) - return 0 fi ;; -U) # -U: remove a field # Suggest possible fieldnames COMPREPLY=( $( compgen -W "$fields" -- "$cur" ) ) - return 0 ;; *) - COMPREPLY=( $( compgen -W "$packopts $unpackopts" -- "$cur" ) ) - return 0 + COMPREPLY=( $( compgen -W "$packopts $unpackopts" \ + -- "$cur" ) ) ;; esac - return 0 + return ;; *) COMPREPLY=( $( compgen -W "$options" -- "$cur" ) ) - return 0 + return ;; esac } && complete -F _dpkg_source dpkg-source -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/dselect b/completions/dselect index ee3cb2a7..e5f148cb 100644 --- a/completions/dselect +++ b/completions/dselect @@ -8,11 +8,11 @@ _dselect() case $prev in --admindir) _filedir -d - return 0 + return ;; -D|-debug) _filedir - return 0 + return ;; esac @@ -24,8 +24,7 @@ _dselect() quit' -- "$cur" ) ) fi - return 0 } && complete -F _dselect dselect -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/dsniff b/completions/dsniff index db9b02ac..165ab74b 100644 --- a/completions/dsniff +++ b/completions/dsniff @@ -8,11 +8,11 @@ _dsniff() case $prev in -r|-w|-f|-p) _filedir - return 0 + return ;; -i) _available_interfaces -a - return 0 + return ;; esac @@ -23,4 +23,4 @@ _dsniff() } && complete -F _dsniff dsniff -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/dumpdb b/completions/dumpdb index f097f895..ced754f5 100644 --- a/completions/dumpdb +++ b/completions/dumpdb @@ -15,4 +15,4 @@ _dumpdb() } && complete -F _dumpdb dumpdb -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/dumpe2fs b/completions/dumpe2fs index 127b46fc..90f84791 100644 --- a/completions/dumpe2fs +++ b/completions/dumpe2fs @@ -7,17 +7,17 @@ _dumpe2fs() case $prev in -o|-V) - return 0 + return ;; -i) _filedir - return 0 + return ;; esac if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) - return 0 + return fi cur=${cur:=/dev/} @@ -25,4 +25,4 @@ _dumpe2fs() } && complete -F _dumpe2fs dumpe2fs -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/e2freefrag b/completions/e2freefrag index 6a971156..bee4a169 100644 --- a/completions/e2freefrag +++ b/completions/e2freefrag @@ -7,13 +7,13 @@ _e2freefrag() case $prev in -c|-h) - return 0 + return ;; esac if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_usage "$1" -h )' -- "$cur" ) ) - return 0 + return fi cur=${cur:=/dev/} @@ -21,4 +21,4 @@ _e2freefrag() } && complete -F _e2freefrag e2freefrag -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/e2label b/completions/e2label index 94bcc1c8..c145c3a0 100644 --- a/completions/e2label +++ b/completions/e2label @@ -12,4 +12,4 @@ _e2label() } && complete -F _e2label e2label -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/eject b/completions/eject deleted file mode 100644 index d6b1f6d9..00000000 --- a/completions/eject +++ /dev/null @@ -1,30 +0,0 @@ -# bash completion for eject(1) -*- shell-script -*- - -_eject() -{ - local cur prev words cword - _init_completion || return - - case $prev in - -h|--help|-V|--version|-c|--changerslot|-x|--cdspeed) - return - ;; - -a|--auto|-i|--manualeject) - COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) ) - return - ;; - esac - - if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) - return - elif [[ $prev == @(-d|--default) ]]; then - return - fi - - _cd_devices - _dvd_devices -} && -complete -F _eject eject - -# ex: ts=4 sw=4 et filetype=sh diff --git a/completions/eog b/completions/eog index 6da35e15..d5621119 100644 --- a/completions/eog +++ b/completions/eog @@ -20,8 +20,8 @@ _eog() return fi - _filedir '@(ani|?(w)bmp|gif|ico|j2k|jp[cefgx2]|jpeg|pcx|pn[gm]|ras|svg?(z)|tga|tif?(f)|x[bp]m)' + _filedir '@(ani|?(w)bmp|gif|ico|j2[ck]|jp[cefgx2]|jpeg|jpg2|pcx|p[gp]m|pn[gm]|ras|svg?(z)|tga|tif?(f)|x[bp]m)' } && complete -F _eog eog -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/ether-wake b/completions/ether-wake index 4957e055..387b2d64 100644 --- a/completions/ether-wake +++ b/completions/ether-wake @@ -8,20 +8,20 @@ _ether_wake() case $prev in -i) _available_interfaces -a - return 0 + return ;; -p) - return 0 + return ;; esac if [[ $cur == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" -u ) -V' -- "$cur" ) ) - return 0 + return fi _mac_addresses } && complete -F _ether_wake ether-wake -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/evince b/completions/evince index 8ef75160..eb6c7305 100644 --- a/completions/evince +++ b/completions/evince @@ -17,7 +17,7 @@ _evince() ;; esac - $split && return 0 + $split && return if [[ $cur == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" --help-all )' \ @@ -30,4 +30,4 @@ _evince() } && complete -F _evince evince -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/explodepkg b/completions/explodepkg index b6914750..a281f81e 100644 --- a/completions/explodepkg +++ b/completions/explodepkg @@ -2,4 +2,4 @@ complete -o plusdirs -f -X '!*.t[bglx]z' explodepkg -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/export b/completions/export index 42273a9e..31715f9a 100644 --- a/completions/export +++ b/completions/export @@ -24,7 +24,12 @@ _export() break done - [[ $cur == *=\$* ]] && { cur=${cur#*=}; _variables; } && return + if [[ $cur == *=* ]]; then + local ocur=$cur oprev=$prev + prev=${cur%%=*} cur=${cur#*=} + _variables && return + cur=$ocur prev=$oprev + fi case $cur in *=) @@ -58,4 +63,4 @@ _export() } && complete -F _export export -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/faillog b/completions/faillog index 77ca9c72..3b4a23d0 100644 --- a/completions/faillog +++ b/completions/faillog @@ -7,22 +7,21 @@ _faillog() case $prev in -h|--help|-l|--lock-time|-m|--maximum|-t|--time) - return 0 + return ;; -u|--user) COMPREPLY=( $( compgen -u -- "$cur" ) ) - return 0 + return ;; esac - $split && return 0 + $split && return if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) [[ $COMPREPLY == *= ]] && compopt -o nospace - return 0 fi } && complete -F _faillog faillog -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/fbgs b/completions/fbgs index 8058e01a..c58a7af9 100644 --- a/completions/fbgs +++ b/completions/fbgs @@ -12,7 +12,7 @@ _fbgs() return ;; -m|--mode) - COMPREPLY=( $( compgen -W '$( sed \ + COMPREPLY=( $( compgen -W '$( command sed \ -n "/^mode/{s/^mode \{1,\}\"\([^\"]\{1,\}\)\"/\1/g;p}" \ /etc/fb.modes 2> /dev/null )' -- "$cur" ) ) return @@ -44,6 +44,7 @@ _fbgs() fi _filedir '?(e)ps|pdf' -} && complete -F _fbgs fbgs +} && +complete -F _fbgs fbgs -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/fbi b/completions/fbi index 5073607a..75b46b61 100644 --- a/completions/fbi +++ b/completions/fbi @@ -20,7 +20,7 @@ _fbi() return ;; -m|--mode) - COMPREPLY=( $( compgen -W '$( sed \ + COMPREPLY=( $( compgen -W '$( command sed \ -n "/^mode/{s/^mode \{1,\}\"\([^\"]\{1,\}\)\"/\1/g;p}" \ /etc/fb.modes 2> /dev/null )' -- "$cur" ) ) return @@ -48,6 +48,7 @@ _fbi() # FIXME: It is hard to determine correct supported extensions. # fbi can handle any format that imagemagick can plus some others _filedir 'bmp|gif|jp?(e)g|pcd|png|p[pgb]m|tif?(f)|webp|xpm|xwd|?(e)ps|pdf|dvi|txt|svg?(z)|cdr|[ot]tf' -} && complete -F _fbi fbi +} && +complete -F _fbi fbi -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/feh b/completions/feh index e53ca2b1..1cd75420 100644 --- a/completions/feh +++ b/completions/feh @@ -52,8 +52,8 @@ _feh() return ;; -S|--sort) - COMPREPLY=( $( compgen -W 'name filename width height pixels size - format' -- "$cur" ) ) + COMPREPLY=( $( compgen -W 'name filename mtime width height + pixels size format' -- "$cur" ) ) return ;; -R|--reload|-H|--limit-height|-W|--limit-width|-E|--thumb-height|\ @@ -100,6 +100,7 @@ _feh() $split && return if [[ "$cur" == -* ]]; then + # Some versions of feh just output "See 'man feh'" for --help :( COMPREPLY=( $( compgen -W '$( _parse_help "$1" --help )' -- "$cur" ) ) [[ $COMPREPLY == *= ]] && compopt -o nospace [[ $COMPREPLY ]] && return @@ -108,6 +109,7 @@ _feh() # FIXME: It is hard to determine correct supported extensions. # feh can handle any format that imagemagick can plus some others _filedir 'xpm|tif?(f)|png|p[npgba]m|iff|?(i)lbm|jp?(e)g|jfi?(f)|gif|bmp|arg?(b)|tga|xcf|ani|ico|?(e)ps|pdf|dvi|txt|svg?(z)|cdr|[ot]tf' -} && complete -F _feh feh +} && +complete -F _feh feh -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/file b/completions/file index 172fd5e0..f3f6df88 100644 --- a/completions/file +++ b/completions/file @@ -29,4 +29,4 @@ _file() } && complete -F _file file -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/file-roller b/completions/file-roller index c05565d9..3c627585 100644 --- a/completions/file-roller +++ b/completions/file-roller @@ -5,7 +5,7 @@ _file_roller() local cur prev words cword split _init_completion -s || return - local exts='@(7z|ace|alz|ar|arj|[bglx]z|bz2|tb?(z)2|cab|cb[rz]|iso?(9660)|Z|t[abglx]z|cpio|deb|[ejrw]ar|exe|?(g)tar|gem|lh[az]|lzh|?(t)lrz|lzma|lzo|wim|swm|rpm|sit|zip|zoo)' + local exts='@(7z|ace|alz|ar|arj|[bglx]z|bz2|tb?(z)2|cab|cb[rz]|iso?(9660)|Z|t[abglx]z|cpio|deb|rar|?(g)tar|gem|lh[az]|lzh|?(t)lrz|lzma|lzo|wim|swm|rpm|sit|zoo)' case $prev in -'?'|--help|--help-all|--help-gtk|--help-sm-client) @@ -16,6 +16,7 @@ _file_roller() return ;; -a|--add-to) + _filedir_xspec unzip _filedir "$exts" return ;; @@ -34,8 +35,9 @@ _file_roller() return fi + _filedir_xspec unzip _filedir "$exts" } && complete -F _file_roller file-roller -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/filefrag b/completions/filefrag index ee9d0d81..b4866dc0 100644 --- a/completions/filefrag +++ b/completions/filefrag @@ -7,11 +7,11 @@ _filefrag() if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) - return 0 + return fi _filedir } && complete -F _filefrag filefrag -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/filesnarf b/completions/filesnarf index dbadd434..0cdcfe27 100644 --- a/completions/filesnarf +++ b/completions/filesnarf @@ -8,7 +8,7 @@ _snarf() case $prev in -i) _available_interfaces -a - return 0 + return ;; esac @@ -19,4 +19,4 @@ _snarf() } && complete -F _snarf filesnarf mailsnarf msgsnarf -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/find b/completions/find index 1896fc22..39029345 100644 --- a/completions/find +++ b/completions/find @@ -10,70 +10,70 @@ _find() case $prev in -maxdepth|-mindepth) COMPREPLY=( $( compgen -W '{0..9}' -- "$cur" ) ) - return 0 + return ;; -newer|-anewer|-cnewer|-fls|-fprint|-fprint0|-fprintf|-name|-iname|\ -lname|-ilname|-wholename|-iwholename|-samefile) _filedir - return 0 + return ;; -fstype) _fstypes [[ $OSTYPE == *bsd* ]] && \ COMPREPLY+=( $( compgen -W 'local rdonly' -- "$cur" ) ) - return 0 + return ;; -gid) _gids - return 0 + return ;; -group) COMPREPLY=( $( compgen -g -- "$cur" 2>/dev/null) ) - return 0 + return ;; -xtype|-type) COMPREPLY=( $( compgen -W 'b c d p f l s' -- "$cur" ) ) - return 0 + return ;; -uid) _uids - return 0 + return ;; -user) COMPREPLY=( $( compgen -u -- "$cur" ) ) - return 0 + return ;; -exec|-execdir|-ok|-okdir) words=(words[0] "$cur") cword=1 _command - return 0 + return ;; -[acm]min|-[acm]time|-iname|-lname|-wholename|-iwholename|-lwholename|\ -ilwholename|-inum|-path|-ipath|-regex|-iregex|-links|-perm|-size|\ -used|-printf|-context) # do nothing, just wait for a parameter to be given - return 0 + return ;; -regextype) COMPREPLY=( $( compgen -W 'emacs posix-awk posix-basic posix-egrep posix-extended' -- "$cur" ) ) - return 0 + return ;; esac - _expand || return 0 + _expand || return local i exprfound=false # set exprfound to true if there is already an expression present for i in ${words[@]}; do - [[ "$i" = [-\(\),\!]* ]] && exprfound=true && break + [[ "$i" == [-\(\),\!]* ]] && exprfound=true && break done # handle case where first parameter is not a dash option if ! $exprfound && [[ "$cur" != [-\(\),\!]* ]]; then _filedir -d - return 0 + return fi # complete using basic options @@ -101,15 +101,14 @@ _find() for i in "${words[@]}"; do [[ $i && ${onlyonce[$i]} ]] || continue for j in ${!COMPREPLY[@]}; do - [[ ${COMPREPLY[j]} == $i ]] && unset COMPREPLY[j] + [[ ${COMPREPLY[j]} == $i ]] && unset 'COMPREPLY[j]' done done fi _filedir - return 0 } && complete -F _find find -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/find_member b/completions/find_member index b1fcaf62..df1a24f9 100644 --- a/completions/find_member +++ b/completions/find_member @@ -8,11 +8,11 @@ _find_member() case $prev in -l|-x|--listname|--exclude) _xfunc list_lists _mailman_lists - return 0 + return ;; esac - $split && return 0 + $split && return if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '--listname --exclude --owners --help' \ @@ -22,4 +22,4 @@ _find_member() } && complete -F _find_member find_member -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/flake8 b/completions/flake8 new file mode 100644 index 00000000..60ad9e2b --- /dev/null +++ b/completions/flake8 @@ -0,0 +1,35 @@ +# flake8 completion -*- shell-script -*- + +_flake8() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + -h|--help|--version|--exclude|--filename|--select|--ignore|\ + --max-line-length|--max-complexity|--builtins) + return + ;; + --format) + COMPREPLY=( $( compgen -W 'default pylint' -- "$cur" ) ) + return + ;; + --config) + _filedir + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + return + fi + + _filedir py +} && +complete -F _flake8 flake8 + +# ex: filetype=sh diff --git a/completions/freebsd-update b/completions/freebsd-update new file mode 100644 index 00000000..6ee2438b --- /dev/null +++ b/completions/freebsd-update @@ -0,0 +1,29 @@ +# bash completion for FreeBSD update tool - freebsd-update -*- shell-script -*- + +[[ $OSTYPE == *freebsd* ]] || return 1 + +_freebsd_update() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -b|-d) + _filedir -d + return + ;; + -f) + _filedir + return + ;; + -k|-r|-s|-t) + return + ;; + esac + + COMPREPLY=( $(compgen -W "fetch cron upgrade install rollback IDS" -- \ + $cur) ) +} && +complete -F _freebsd_update freebsd-update + +# ex: filetype=sh diff --git a/completions/freeciv-gtk2 b/completions/freeciv-gtk2 index c818433d..246d4f20 100644 --- a/completions/freeciv-gtk2 +++ b/completions/freeciv-gtk2 @@ -8,15 +8,15 @@ _civclient() case $prev in -l|-S|-t|--log|--Sound|--tiles) _filedir - return 0 + return ;; -P|--Plugin) COMPREPLY=( $( compgen -W 'none esd sdl' -- "$cur" ) ) - return 0 + return ;; -s|--server) _known_hosts_real "$cur" - return 0 + return ;; esac @@ -27,4 +27,4 @@ _civclient() } && complete -F _civclient civclient freeciv-gtk2 freeciv-sdl freeciv-xaw -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/freeciv-server b/completions/freeciv-server index 7daa30ce..78f57afa 100644 --- a/completions/freeciv-server +++ b/completions/freeciv-server @@ -8,7 +8,7 @@ _civserver() case $prev in -f|-g|-l|-r|--file|--log|--gamelog|--read) _filedir - return 0 + return ;; esac @@ -19,4 +19,4 @@ _civserver() } && complete -F _civserver civserver freeciv-server -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/function b/completions/function index e8e4d751..fbcf10d2 100644 --- a/completions/function +++ b/completions/function @@ -6,17 +6,32 @@ _function() _init_completion || return if [[ $1 == @(declare|typeset) ]]; then - if [[ $prev == -f ]]; then - COMPREPLY=( $( compgen -A function -- "$cur" ) ) - elif [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + if [[ $cur == [-+]* ]]; then + local opts + opts=( $( _parse_usage "$1" ) ) + # Most options also have a '+' form. We'll exclude the ones that don't with compgen. + opts+=( ${opts[*]/-/+} ) + COMPREPLY=( $( compgen -W "${opts[*]}" -X '+[Ffgp]' -- "$cur" ) ) + else + local i=1 + while [[ ${words[i]} == [-+]* ]]; do + if [[ ${words[i]} == -*[fF]* ]]; then + COMPREPLY=( $( compgen -A function -- "$cur" ) ) + return + fi + ((i++)) + done + if [[ $i -gt 1 ]]; then + # There was at least one option and it was not one that limited operations to functions + COMPREPLY=( $( compgen -A variable -- "$cur" ) ) + fi fi elif [[ $cword -eq 1 ]]; then COMPREPLY=( $( compgen -A function -- "$cur" ) ) else - COMPREPLY=( "() $( type -- ${words[1]} | sed -e 1,2d )" ) + COMPREPLY=( "() $( type -- ${words[1]} | command sed -e 1,2d )" ) fi } && complete -F _function function declare typeset -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/fusermount b/completions/fusermount index e711e791..23671bd6 100644 --- a/completions/fusermount +++ b/completions/fusermount @@ -7,13 +7,13 @@ _fusermount() case $prev in -h|-V|-o) - return 0 + return ;; -u) COMPREPLY=( $( compgen -W "$( awk \ '{ if ($3 ~ /^fuse(\.|$)/) print $2 }' /etc/mtab \ 2>/dev/null )" -- "$cur" ) ) - return 0 + return ;; esac @@ -25,4 +25,4 @@ _fusermount() } && complete -F _fusermount fusermount -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/gcc b/completions/gcc index c86fd7e6..174e0718 100644 --- a/completions/gcc +++ b/completions/gcc @@ -13,7 +13,7 @@ _gcc() local cur prev words cword _init_completion || return - _expand || return 0 + _expand || return local cc backend @@ -27,6 +27,9 @@ _gcc() *77) backend=f771 ;; + *95) + backend=f951 + ;; *) backend=cc1 # (near-)universal backend ;; @@ -39,16 +42,26 @@ _gcc() # for C/C++/ObjectiveC it's useless # for FORTRAN/Java it's an error COMPREPLY=( $( compgen -W "$( $cc --help 2>/dev/null | tr '\t' ' ' |\ - sed -e '/^ *-/!d' -e 's/ *-\([^][ <>]*\).*/-\1/' )" -- "$cur" ) ) + command sed -e '/^ *-/!d' -e 's/ *-\([^][ <>]*\).*/-\1/' )" -- "$cur" ) ) [[ $COMPREPLY == *= ]] && compopt -o nospace else _filedir fi } && -complete -F _gcc gcc g++ g77 gcj gpc && +complete -F _gcc gcc g++ gfortran g77 g95 gcj gpc && { - cc --version 2>/dev/null | grep -q GCC && complete -F _gcc cc || : - c++ --version 2>/dev/null | grep -q GCC && complete -F _gcc c++ || : + cc --version 2>/dev/null | command grep -q GCC || \ + [[ $( _realcommand cc ) == *gcc* ]] && \ + complete -F _gcc cc || complete -F _minimal cc + c++ --version 2>/dev/null | command grep -q GCC || \ + [[ $( _realcommand c++ ) == *g++* ]] && \ + complete -F _gcc c++ || complete -F _minimal c++ + f77 --version 2>/dev/null | command grep -q GCC || \ + [[ $( _realcommand f77 ) == *gfortran* ]] && \ + complete -F _gcc f77 || complete -F _minimal f77 + f95 --version 2>/dev/null | command grep -q GCC || \ + [[ $( _realcommand f95 ) == *gfortran* ]] && \ + complete -F _gcc f95 || complete -F _minimal f95 } -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/gcl b/completions/gcl index 385a2e06..5d1ca5f3 100644 --- a/completions/gcl +++ b/completions/gcl @@ -15,8 +15,7 @@ _gcl() _filedir fi - return 0 } && complete -F _gcl -o default gcl -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/gdb b/completions/gdb index 125d0b15..75414782 100644 --- a/completions/gdb +++ b/completions/gdb @@ -2,9 +2,18 @@ _gdb() { - local cur prev words cword + local cur prev words cword i _init_completion || return + # gdb [options] --args executable-file [inferior-arguments ...] + for (( i=1; i < cword; i++ )); do + if [[ "${words[i]}" == --args ]]; then + _command_offset $((i+1)) + return $? + fi + done + + # gdb [options] [executable-file [core-file or process-id]] if [[ $cword -eq 1 ]]; then local IFS compopt -o filenames @@ -18,7 +27,7 @@ _gdb() # names manually. IFS=":" local path_array=( $( \ - sed -e 's/:\{2,\}/:/g' -e 's/^://' -e 's/:$//' <<<"$PATH" ) ) + command sed -e 's/:\{2,\}/:/g' -e 's/^://' -e 's/:$//' <<<"$PATH" ) ) IFS=$'\n' COMPREPLY=( $( compgen -d -W '$(find "${path_array[@]}" . \ -mindepth 1 -maxdepth 1 -not -type d -executable \ @@ -34,4 +43,4 @@ _gdb() } && complete -F _gdb gdb -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/genaliases b/completions/genaliases index 32f5919a..f9a9890a 100644 --- a/completions/genaliases +++ b/completions/genaliases @@ -12,4 +12,4 @@ _genaliases() } && complete -F _genaliases genaliases -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/gendiff b/completions/gendiff index 38c0828e..cb9bab39 100644 --- a/completions/gendiff +++ b/completions/gendiff @@ -3,10 +3,10 @@ _gendiff() { local cur prev words cword - _init_completion -o @(diff|patch) || return + _init_completion -o '@(diff|patch)' || return [[ $cword -eq 1 ]] && _filedir -d } && complete -F _gendiff gendiff -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/genisoimage b/completions/genisoimage index 1d8f0401..caf6d457 100644 --- a/completions/genisoimage +++ b/completions/genisoimage @@ -9,20 +9,20 @@ _mkisofs() -o|-abstract|-biblio|-check-session|-copyright|-log-file| \ -root-info|-prep-boot|-*-list) _filedir - return 0 + return ;; -*-charset) COMPREPLY=( $( compgen -W '$( mkisofs -input-charset \ help 2>&1 | tail -n +3 )' -- "$cur" ) ) - return 0 + return ;; -uid) _uids - return 0 + return ;; -gid) _gids - return 0 + return ;; esac @@ -35,4 +35,4 @@ _mkisofs() } && complete -F _mkisofs mkisofs genisoimage -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/getent b/completions/getent index 2e99f524..0658b0bb 100644 --- a/completions/getent +++ b/completions/getent @@ -26,30 +26,30 @@ _getent() case $db in passwd) - COMPREPLY=( $( compgen -u "$cur" ) ) - return 0 + COMPREPLY=( $( compgen -u -- "$cur" ) ) + return ;; group) - COMPREPLY=( $( compgen -g "$cur" ) ) - return 0 + COMPREPLY=( $( compgen -g -- "$cur" ) ) + return ;; services) - COMPREPLY=( $( compgen -s "$cur" ) ) - return 0 + COMPREPLY=( $( compgen -s -- "$cur" ) ) + return ;; hosts) - COMPREPLY=( $( compgen -A hostname "$cur" ) ) - return 0 + COMPREPLY=( $( compgen -A hostname -- "$cur" ) ) + return ;; protocols|networks|ahosts|ahostsv4|ahostsv6|rpc) - COMPREPLY=( $( compgen -W "$( getent $db | \ + COMPREPLY=( $( compgen -W "$( $1 $db | \ awk '{ print $1 }' )" -- "$cur" ) ) - return 0 + return ;; aliases|shadow|gshadow) - COMPREPLY=( $( compgen -W "$( getent $db | cut -d: -f1 )" \ + COMPREPLY=( $( compgen -W "$( $1 $db | cut -d: -f1 )" \ -- "$cur" ) ) - return 0 + return ;; ethers|netgroup) return @@ -75,4 +75,4 @@ _getent() } && complete -F _getent getent -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/gkrellm b/completions/gkrellm index db439ebd..cfe65429 100644 --- a/completions/gkrellm +++ b/completions/gkrellm @@ -8,27 +8,27 @@ _gkrellm() case $prev in -t|--theme) _filedir -d - return 0 + return ;; -p|--plugin) _filedir so - return 0 + return ;; -s|--server) _known_hosts_real "$cur" - return 0 + return ;; -l|--logfile) _filedir - return 0 + return ;; -g|--geometry|-c|--config|-P|--port|-d|--debug-level) # Argument required but no completions available - return 0 + return ;; -h|--help|-v|--version) # All other options are noop with these - return 0 + return ;; esac @@ -36,4 +36,4 @@ _gkrellm() } && complete -F _gkrellm gkrellm gkrellm2 -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/gm b/completions/gm new file mode 100644 index 00000000..88c233c6 --- /dev/null +++ b/completions/gm @@ -0,0 +1,40 @@ +# bash completion for gm(1) -*- shell-script -*- + +_gm_commands() +{ + COMPREPLY+=( $( compgen -W '$( "$1" help | + awk "/^ +[^ ]+ +- / { print \$1 }" )' -- "$cur" ) ) +} + +_gm() +{ + local cur prev words cword + _init_completion || return + + if [[ $cword -eq 1 ]]; then + _gm_commands "$1" + return + elif [[ $cword -eq 2 && ${words[1]} == time ]]; then + _gm_commands "$1" + return + fi + + local gmcmd=${words[1]} + [[ $gmcmd == time ]] && gmcmd=${words[2]} + + case $gmcmd in + help) + [[ $prev == help ]] && _gm_commands "$1" + return + ;; + version) + return + ;; + esac + + # TODO... defer some commnds to the imagemagick "gm"less completions etc? + compopt -o default +} && +complete -F _gm gm + +# ex: filetype=sh diff --git a/completions/gnatmake b/completions/gnatmake index 458ad070..4cd24d2e 100644 --- a/completions/gnatmake +++ b/completions/gnatmake @@ -9,13 +9,13 @@ _gnatmake() if [[ "$cur" == -* ]]; then # relevant (and less relevant ;-) )options completion COMPREPLY=( $( compgen -W '-a -c -f -i -j -k -m -M -n -o -q -s -v -z - -aL -A -aO -aI -I -I- -L -nostdinc -nostdlib -cargs -bargs -largs - -fstack-check -fno-inline -g -O1 -O0 -O2 -O3 -gnata -gnatA -gnatb - -gnatc -gnatd -gnatD -gnate -gnatE -gnatf -gnatF -gnatg -gnatG - -gnath -gnati -gnatk -gnatl -gnatL -gnatm -gnatn -gnato -gnatO - -gnatp -gnatP -gnatq -gnatR -gnats -gnatt -gnatT -gnatu -gnatU - -gnatv -gnatws -gnatwe -gnatwl -gnatwu -gnatW -gnatx -gnatX -gnaty - -gnatz -gnatZ -gnat83' -- "$cur" ) ) + -aL -A -aO -aI -I -I- -L -nostdinc -nostdlib -cargs -bargs -largs + -fstack-check -fno-inline -g -O1 -O0 -O2 -O3 -gnata -gnatA -gnatb + -gnatc -gnatd -gnatD -gnate -gnatE -gnatf -gnatF -gnatg -gnatG + -gnath -gnati -gnatk -gnatl -gnatL -gnatm -gnatn -gnato -gnatO + -gnatp -gnatP -gnatq -gnatR -gnats -gnatt -gnatT -gnatu -gnatU + -gnatv -gnatws -gnatwe -gnatwl -gnatwu -gnatW -gnatx -gnatX -gnaty + -gnatz -gnatZ -gnat83' -- "$cur" ) ) else # source file completion _filedir '@(adb|ads)' @@ -23,4 +23,4 @@ _gnatmake() } && complete -F _gnatmake gnatmake -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/gnokii b/completions/gnokii new file mode 100644 index 00000000..95ccaeae --- /dev/null +++ b/completions/gnokii @@ -0,0 +1,235 @@ +# gnokii(1) completion -*- shell-script -*- + +_gnokii_memory_type() +{ + # TODO: reduce the number of choices + COMPREPLY=( $( compgen -W "IN OU SM ME MT" -- "$cur" ) ) +} + +_gnokii() +{ + local cur prev words cword pprev tprev fprev + _init_completion || return + + case $prev in + --config) + _filedir + return + ;; + --phone) + local config_file + for config_file in "$XDG_CONFIG_HOME/gnokii/config" \ + "$HOME/.config/gnokii/config" "$HOME/.gnokiirc" \ + "$XDG_CONFIG_DIRS/gnokii/config" /etc/gnokiirc ; do + [[ -f $config_file ]] && break + done + [[ ! -f $config_file ]] && return + COMPREPLY=( $( compgen -W \ + "$( command sed -n 's/^\[phone_\(.*\)\]/\1/p' $config_file )" \ + -- "$cur" ) ) + return + ;; + --help) + COMPREPLY=( $( compgen -W 'all monitor sms mms phonebook calendar + todo dial profile settings wap logo ringtone security file + other' -- "$cur" ) ) + return + ;; + --version|--shell|ping) + return + ;; + + # MONITOR + --monitor) + COMPREPLY=( $( compgen -W 'delay once' -- "$cur" ) ) + return + ;; + --getdisplaystatus|--displayoutput) + return + ;; + --netmonitor) + COMPREPLY=( $( compgen -W 'reset off field devel next nr' \ + -- "$cur" ) ) + return + ;; + + # SMS + --sendsms) + # (how)TODO ? + return + ;; + --savesms) + COMPREPLY=( $( compgen -W '--sender --smsc --smscno --folder + --location --sent --read --deliver --datetime' -- "$cur" ) ) + return + ;; + --memory-type|--memory|--getsms|--deletesms|--getmms|--deletemms|\ + --getphonebook|--deletephonebook) + _gnokii_memory_type + return + ;; + --getsmsc|--getcalendarnote|--deletecalendarnote|--gettodo|\ + --getspeeddial) + # TODO: grab a specific entry ID + return + ;; + --setsmsc|--smsreader|--createsmsfolder|--deletealltodos|\ + --showsmsfolderstatus) + return + ;; + --deletesmsfolder|--folder) + # TODO: folderid + return + ;; + --writephonebook) + COMPREPLY=( $( compgen -W '--overwrite --find-free --memory-type + --location --vcard --ldif' -- "$cur" ) ) + return + ;; + --writecalendarnote|--writetodo) + _filedir vcf + return + ;; + + # DIAL + --setspeeddial|--dialvoice|--senddtmf|--answercall|--hangup) + # TODO + return + ;; + --divert) + COMPREPLY=( $( compgen -W '--op' -- "$cur" ) ) + return + ;; + + # PROFILE + --getprofile|--setactiveprofile) + # TODO + return + ;; + --setprofile|--getactiveprofile) + return + ;; + + # SETTINGS + --reset) + COMPREPLY=( $( compgen -W 'soft hard' -- "$cur" ) ) + return + ;; + --setdatetime|--setalarm) + # TODO + return + ;; + --getdatetime|--getalarm) + return + ;; + + # WAP + --getwapbookmark|--writewapbookmark|--deletewapbookmark|\ + --getwapsetting|--writewapsetting|--activatewapsetting) + return + ;; + + # LOGOS + --sendlogo) + COMPREPLY=( $( compgen -W 'caller op picture' -- "$cur" ) ) + return + ;; + --setlogo|--getlogo) + COMPREPLY=( $( compgen -W 'op startup caller dealer text' \ + -- "$cur" ) ) + return + ;; + --viewlogo) + # TODO: logofile + return + ;; + + --entersecuritycode) + COMPREPLY=( $( compgen -W 'PIN PIN2 PUK PUK2 SEC' -- "$cur" ) ) + return + ;; + + # TODO: RINGTONES + esac + + # second level completion + if [[ $((cword-2)) -ge 1 && ${words[cword-2]} =~ --* ]]; then + pprev=${words[cword-2]} + case $pprev in + --setspeeddial) + _gnokii_memory_type + return + ;; + --getsms|--deletesms|--getmms|--deletemms|--getphonebook|\ + --writetodo|--writecalendarnote) + # TODO: start number + return + ;; + --gettodo|--getcalendarnote) + COMPREPLY=( $( compgen -W '{1..9} end --vCal' -- "$cur" ) ) + return + ;; + --deletecalendarnote) + COMPREPLY=( $( compgen -W '{1..9} end' -- "$cur" ) ) + return + ;; + --divert) + COMPREPLY=( $( compgen -W 'register enable query disable + erasure' -- "$cur" ) ) + return + ;; + esac + fi + + # third level completion + if [[ $((cword-3)) -ge 1 && ${words[cword-3]} =~ --* ]]; then + tprev=${words[cword-3]} + case $tprev in + --deletesms|--deletemms) + COMPREPLY=( $( compgen -W 'end' -- "$cur" ) ) + return + ;; + --getphonebook|--writetodo|--writecalendarnote) + COMPREPLY=( $( compgen -W '{1..9} end' -- "$cur" ) ) + return + ;; + --gettodo|--getcalendarnote) + [[ ${words[cword-1]} == end ]] && \ + COMPREPLY=( $( compgen -W '--vCal' -- "$cur" ) ) + return + ;; + --divert) + COMPREPLY=( $( compgen -W '--type' -- "$cur" ) ) + return + esac + fi + + # fourth level completion + if [[ $((cword-4)) -ge 1 && ${words[cword-4]} =~ --* ]]; then + fprev=${words[cword-4]} + case $fprev in + --getphonebook) + COMPREPLY=( $( compgen -W '--raw --vcard --ldif' -- "$cur" ) ) + return + ;; + --divert) + COMPREPLY=( $( compgen -W 'all busy noans outofreach notavail' \ + -- "$cur" ) ) + return + esac + fi + + # safer to use LANG=C + local all_cmd="$( LANG=C _parse_help $1 "--help all" )" + # these 2 below are allowed in combination with others + local main_cmd=$( command grep -v -- '--config\|--phone' <<<"$all_cmd" ) + + # don't provide main command completions if one is + # already on the command line + [[ $COMP_LINE =~ $( tr ' ' '\b|'<<<$main_cmd ) ]] && return + + COMPREPLY=( $( compgen -W "$all_cmd" -- "$cur" ) ) +} && +complete -F _gnokii gnokii + +# ex: filetype=sh diff --git a/completions/gnome-mplayer b/completions/gnome-mplayer index 00701702..9a250419 100644 --- a/completions/gnome-mplayer +++ b/completions/gnome-mplayer @@ -36,4 +36,4 @@ _gnome_mplayer() } && complete -F _gnome_mplayer gnome-mplayer -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/gpasswd b/completions/gpasswd index eb5a7e48..ada12b8d 100644 --- a/completions/gpasswd +++ b/completions/gpasswd @@ -8,18 +8,18 @@ _gpasswd() case $prev in -a|--add|-d|--delete|-A|--administrators|-M|--members) COMPREPLY=( $( compgen -u -- "$cur" ) ) - return 0 + return ;; esac if [[ "$cur" == -* ]]; then # TODO: only -A and -M can be combined COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) - return 0 + return fi COMPREPLY=( $( compgen -g -- "$cur" ) ) } && complete -F _gpasswd gpasswd -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/gpg b/completions/gpg index 91436f7a..3fee3df3 100644 --- a/completions/gpg +++ b/completions/gpg @@ -8,31 +8,31 @@ _gpg() case $prev in -s|--sign|--clearsign|--decrypt-files|--load-extension) _filedir - return 0 + return ;; --export|--sign-key|--lsign-key|--nrsign-key|--nrlsign-key|--edit-key) # return list of public keys - COMPREPLY=( $( compgen -W "$( gpg --list-keys 2>/dev/null | \ - sed -ne 's@^pub.*/\([^ ]*\).*$@\1@p' \ - -ne 's@^.*\(<\([^>]*\)>\).*$@\2@p' )" -- "$cur" ) ) - return 0 + COMPREPLY=( $( compgen -W "$( $1 --list-keys 2>/dev/null | command sed -ne \ + 's@^pub.*/\([^ ]*\).*$@\1@p' -ne \ + 's@^.*\(<\([^>]*\)>\).*$@\2@p' )" -- "$cur" ) ) + return ;; -r|--recipient) - COMPREPLY=( $( compgen -W "$( gpg --list-keys 2>/dev/null | \ - sed -ne 's@^.*<\([^>]*\)>.*$@\1@p')" -- "$cur" ) ) + COMPREPLY=( $( compgen -W "$( $1 --list-keys 2>/dev/null | command sed -ne \ + 's@^.*<\([^>]*\)>.*$@\1@p')" -- "$cur" ) ) if [[ -e ~/.gnupg/gpg.conf ]]; then - COMPREPLY+=( $( compgen -W "$( sed -ne \ + COMPREPLY+=( $( compgen -W "$( command sed -ne \ 's@^[ \t]*group[ \t][ \t]*\([^=]*\).*$@\1@p' \ ~/.gnupg/gpg.conf )" -- "$cur" ) ) fi - return 0 + return ;; esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$(gpg --dump-options)' -- "$cur" ) ) + COMPREPLY=( $( compgen -W '$($1 --dump-options)' -- "$cur" ) ) fi } && complete -F _gpg -o default gpg -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/gpg2 b/completions/gpg2 index 3efc2dbb..66630590 100644 --- a/completions/gpg2 +++ b/completions/gpg2 @@ -8,35 +8,35 @@ _gpg2() case $prev in --homedir) _filedir -d - return 0 + return ;; -s|--sign|--clearsign|--options|--decrypt) _filedir - return 0 + return ;; --export|--sign-key|--lsign-key|--nrsign-key|--nrlsign-key|--edit-key) # return list of public keys - COMPREPLY=( $( compgen -W "$( gpg2 --list-keys 2>/dev/null | \ - sed -ne 's@^pub.*/\([^ ]*\).*$@\1@p' \ - -ne 's@^.*\(<\([^>]*\)>\).*$@\2@p' )" -- "$cur" ) ) - return 0 + COMPREPLY=( $( compgen -W "$( $1 --list-keys 2>/dev/null | command sed -ne \ + 's@^pub.*/\([^ ]*\).*$@\1@p' -ne \ + 's@^.*\(<\([^>]*\)>\).*$@\2@p' )" -- "$cur" ) ) + return ;; -r|--recipient) - COMPREPLY=( $( compgen -W "$( gpg2 --list-keys 2>/dev/null | \ - sed -ne 's@^.*<\([^>]*\)>.*$@\1@p')" -- "$cur" ) ) + COMPREPLY=( $( compgen -W "$( $1 --list-keys 2>/dev/null | \ + command sed -ne 's@^.*<\([^>]*\)>.*$@\1@p')" -- "$cur" ) ) if [[ -e ~/.gnupg/gpg.conf ]]; then - COMPREPLY+=( $( compgen -W "$( sed -ne \ + COMPREPLY+=( $( compgen -W "$( command sed -ne \ 's@^[ \t]*group[ \t][ \t]*\([^=]*\).*$@\1@p' \ ~/.gnupg/gpg.conf)" -- "$cur" ) ) fi - return 0 + return ;; esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '$(gpg2 --dump-options)' -- "$cur" ) ) + COMPREPLY=( $( compgen -W '$($1 --dump-options)' -- "$cur" ) ) fi } && complete -F _gpg2 -o default gpg2 -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/gphoto2 b/completions/gphoto2 index 02ddf785..94bf0634 100644 --- a/completions/gphoto2 +++ b/completions/gphoto2 @@ -3,49 +3,52 @@ _gphoto2() { local cur prev words cword split - _init_completion -s || return + _init_completion -s -n : || return case $prev in --debug-logfile) _filedir - return 0 + return ;; --hook-script) _filedir - return 0 + return ;; --filename) _filedir - return 0 + return ;; -u|--upload-file) _filedir - return 0 + return ;; --port) - COMPREPLY=( $(compgen -W "$( gphoto2 --list-ports 2>/dev/null | \ - tail -n +4 | awk '{ print $1 }' )" -- "$cur") ) - return 0 + COMPREPLY=( $(compgen -W "$( $1 --list-ports 2>/dev/null | \ + awk 'NR>3 { print $1 }' )" -- "$cur") ) + __ltrim_colon_completions "$cur" + return ;; --camera) local IFS=$'\n' - COMPREPLY=( $(compgen -W "$( gphoto2 --list-cameras 2>/dev/null | \ - tail -n +3 | awk -F'"' '{ print $2 }' )" -- "$cur") ) - return 0 + COMPREPLY=( $(compgen -W "$( $1 --list-cameras 2>/dev/null | \ + awk -F'"' 'NR>2 { print $2 }' )" -- "$cur") ) + return ;; --get-config|--set-config|--set-config-index|--set-config-value) - COMPREPLY=( $(compgen -W "$( gphoto2 --list-config 2>/dev/null \ + COMPREPLY=( $(compgen -W "$( $1 --list-config 2>/dev/null \ )" -- "$cur") ) - return 0 + return ;; esac + $split && return + if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) - return 0 + [[ $COMPREPLY == *= ]] && compopt -o nospace fi } && complete -F _gphoto2 gphoto2 -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/gprof b/completions/gprof index 810255a4..b9692bad 100644 --- a/completions/gprof +++ b/completions/gprof @@ -62,4 +62,4 @@ _gprof() } && complete -F _gprof gprof -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/groupadd b/completions/groupadd index db5ff872..c5a74b7a 100644 --- a/completions/groupadd +++ b/completions/groupadd @@ -10,18 +10,17 @@ _groupadd() case $prev in -g|--gid|-K|--key|-p|--password) - return 0 + return ;; esac - $split && return 0 + $split && return if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) [[ $COMPREPLY == *= ]] && compopt -o nospace - return 0 fi } && complete -F _groupadd groupadd -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/groupdel b/completions/groupdel index bf6e5c6a..91ba3583 100644 --- a/completions/groupdel +++ b/completions/groupdel @@ -2,4 +2,4 @@ complete -g groupdel -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/groupmems b/completions/groupmems index 9c993eb7..3bb5d820 100644 --- a/completions/groupmems +++ b/completions/groupmems @@ -8,15 +8,15 @@ _groupmems() case $prev in -a|--add|-d|--delete) COMPREPLY=( $( compgen -u -- "$cur" ) ) - return 0 + return ;; -g|--group) COMPREPLY=( $( compgen -g -- "$cur" ) ) - return 0 + return ;; -R|--root) _filedir -d - return 0 + return ;; esac @@ -24,4 +24,4 @@ _groupmems() } && complete -F _groupmems groupmems -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/groupmod b/completions/groupmod index 1a0241a7..51e23b5c 100644 --- a/completions/groupmod +++ b/completions/groupmod @@ -10,20 +10,20 @@ _groupmod() case $prev in -g|--gid|-h|--help|-n|--new-name|-p|--password) - return 0 + return ;; esac - $split && return 0 + $split && return if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) [[ $COMPREPLY == *= ]] && compopt -o nospace - return 0 + return fi COMPREPLY=( $( compgen -g -- "$cur" ) ) } && complete -F _groupmod groupmod -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/growisofs b/completions/growisofs index c4cb7162..04b29a55 100644 --- a/completions/growisofs +++ b/completions/growisofs @@ -7,19 +7,19 @@ _growisofs() case $prev in -version|-speed) - return 0 + return ;; -Z|-M) compopt -o nospace _dvd_devices - return 0 + return ;; /?(r)dev/*) if [[ $cur == =* ]] ; then # e.g. /dev/dvd=foo.iso, /dev/dvdrw=/dev/zero cur="${cur#=}" _filedir - return 0 + return fi ;; esac @@ -29,11 +29,11 @@ _growisofs() COMPREPLY=( $( compgen -W '-dvd-compat -overburn -speed= -Z -M' \ -- "$cur" ) ) [[ ${COMPREPLY[@]} == *= ]] && compopt -o nospace - return 0 + return fi _filedir } && complete -F _growisofs growisofs -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/grpck b/completions/grpck index 0aff1439..18a53920 100644 --- a/completions/grpck +++ b/completions/grpck @@ -7,11 +7,11 @@ _grpck() if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) - return 0 + return fi _filedir } && complete -F _grpck grpck -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/gzip b/completions/gzip index 35e5f231..8093e41e 100644 --- a/completions/gzip +++ b/completions/gzip @@ -7,11 +7,11 @@ _gzip() case $prev in -b|--blocksize|-S|--suffix|-h|--help|-V|--version) - return 0 + return ;; -p|--processes) COMPREPLY=( $( compgen -W "{1..$(_ncpus)}" -- "$cur" ) ) - return 0 + return ;; esac @@ -19,22 +19,21 @@ _gzip() COMPREPLY=( $( compgen -W '$( _parse_help "$1" ) {-1..-9}' \ -- "$cur" ) ) [[ $COMPREPLY == *= ]] && compopt -o nospace - return 0 + return fi local IFS=$'\n' xspec="*.@(gz|t[ag]z)" + [[ ${1##*/} == pigz ]] && xspec="*.@([gz]z|t[ag]z)" if [[ "$prev" == --* ]]; then - [[ "$prev" == --decompress || \ - "$prev" == --list || \ - "$prev" == --test ]] && xspec="!"$xspec + [[ "$prev" == --@(decompress|list|test) ]] && xspec="!"$xspec [[ "$prev" == --force ]] && xspec= elif [[ "$prev" == -* ]]; then [[ "$prev" == -*[dlt]* ]] && xspec="!"$xspec [[ "$prev" == -*f* ]] && xspec= fi - _expand || return 0 + _expand || return compopt -o filenames COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \ @@ -42,4 +41,4 @@ _gzip() } && complete -F _gzip gzip pigz -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/hcitool b/completions/hcitool index b650e205..38d66427 100644 --- a/completions/hcitool +++ b/completions/hcitool @@ -1,6 +1,6 @@ # bash completion for bluez utils -*- shell-script -*- -_bluetooth_adresses() +_bluetooth_addresses() { if [[ -n ${COMP_BLUETOOTH_SCAN:-} ]]; then COMPREPLY+=( $( compgen -W "$( hcitool scan | \ @@ -35,19 +35,19 @@ _hcitool() case $prev in -i) _bluetooth_devices - return 0 + return ;; --role) COMPREPLY=( $( compgen -W 'm s' -- "$cur" ) ) - return 0 + return ;; --pkt-type) _bluetooth_packet_types - return 0 + return ;; esac - $split && return 0 + $split && return local arg _get_first_arg @@ -60,11 +60,12 @@ _hcitool() clock' -- "$cur" ) ) fi else + local args case $arg in name|info|dc|rssi|lq|afh|auth|key|clkoff|lst) _count_args if [[ $args -eq 2 ]]; then - _bluetooth_adresses + _bluetooth_addresses fi ;; cc) @@ -73,14 +74,14 @@ _hcitool() else _count_args if [[ $args -eq 2 ]]; then - _bluetooth_adresses + _bluetooth_addresses fi fi ;; sr) _count_args if [[ $args -eq 2 ]]; then - _bluetooth_adresses + _bluetooth_addresses else COMPREPLY=( $( compgen -W 'master slave' -- "$cur" ) ) fi @@ -88,7 +89,7 @@ _hcitool() cpt) _count_args if [[ $args -eq 2 ]]; then - _bluetooth_adresses + _bluetooth_addresses else _bluetooth_packet_types fi @@ -96,7 +97,7 @@ _hcitool() tpl|enc|clock) _count_args if [[ $args -eq 2 ]]; then - _bluetooth_adresses + _bluetooth_addresses else COMPREPLY=( $( compgen -W '0 1' -- "$cur" ) ) fi @@ -113,12 +114,12 @@ _sdptool() case $prev in --bdaddr) - _bluetooth_adresses - return 0 + _bluetooth_addresses + return ;; esac - $split && return 0 + $split && return local arg _get_first_arg @@ -143,7 +144,7 @@ _sdptool() if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '--tree --raw --xml' -- "$cur" ) ) else - _bluetooth_adresses + _bluetooth_addresses fi ;; add) @@ -172,17 +173,17 @@ _l2ping() case $prev in -i) _bluetooth_devices - return 0 + return ;; -s|-c|-t|-d) - return 0 + return ;; esac if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) else - _bluetooth_adresses + _bluetooth_addresses fi } && complete -F _l2ping l2ping @@ -195,12 +196,12 @@ _rfcomm() case $prev in -f|--config) _filedir - return 0 + return ;; -i) _bluetooth_devices - _bluetooth_adresses - return 0 + _bluetooth_addresses + return ;; esac @@ -214,6 +215,7 @@ _rfcomm() release' -- "$cur" ) ) fi else + local args _count_args if [[ $args -eq 2 ]]; then _bluetooth_devices @@ -221,7 +223,7 @@ _rfcomm() case $arg in connect|bind) if [[ $args -eq 3 ]]; then - _bluetooth_adresses + _bluetooth_addresses fi ;; esac @@ -238,8 +240,8 @@ _ciptool() case $prev in -i) _bluetooth_devices - _bluetooth_adresses - return 0 + _bluetooth_addresses + return ;; esac @@ -253,11 +255,12 @@ _ciptool() -- "$cur" ) ) fi else + local args case $arg in connect|release|loopback) _count_args if [[ $args -eq 2 ]]; then - _bluetooth_adresses + _bluetooth_addresses fi ;; esac @@ -273,7 +276,7 @@ _dfutool() case $prev in -d|--device) _bluetooth_devices - return 0 + return ;; esac @@ -313,11 +316,12 @@ _hciconfig() version revision lm' -- "$cur" ) ) fi else + local args case $arg in putkey|delkey) _count_args if [[ $args -eq 2 ]]; then - _bluetooth_adresses + _bluetooth_addresses fi ;; lm) @@ -366,11 +370,11 @@ _hciattach() COMPREPLY=( $( compgen -W 'flow noflow' -- "$cur" ) ) ;; 5) - _bluetooth_adresses + _bluetooth_addresses ;; esac fi } && complete -F _hciattach hciattach -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/hddtemp b/completions/hddtemp index 75641045..123b74a1 100644 --- a/completions/hddtemp +++ b/completions/hddtemp @@ -35,4 +35,4 @@ _hddtemp() } && complete -F _hddtemp hddtemp -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/hexdump b/completions/hexdump deleted file mode 100644 index c566f9d6..00000000 --- a/completions/hexdump +++ /dev/null @@ -1,29 +0,0 @@ -# hexdump(1) completion -*- shell-script -*- - -_hexdump() -{ - local cur prev words cword - _init_completion || return - - case $prev in - -V|-e|-n|-s) - return - ;; - -f) - _filedir - return - ;; - esac - - if [[ $cur == -* ]]; then - local opts="$( _parse_help "$1" )" - [[ $opts ]] || opts="$( _parse_usage "$1" )" - COMPREPLY=( $( compgen -W "$opts" -- "$cur" ) ) - return - fi - - _filedir -} && -complete -F _hexdump hexdump hd - -# ex: ts=4 sw=4 et filetype=sh diff --git a/completions/hid2hci b/completions/hid2hci index d840166a..9221c4d0 100644 --- a/completions/hid2hci +++ b/completions/hid2hci @@ -12,4 +12,4 @@ _hid2hci() } && complete -F _hid2hci hid2hci -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/hostname b/completions/hostname new file mode 100644 index 00000000..48f4222f --- /dev/null +++ b/completions/hostname @@ -0,0 +1,23 @@ +# hostname(1) completion -*- shell-script -*- + +_hostname() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -h|--help|-V|--version) + return + ;; + -F|--file) + _filedir + return + ;; + esac + + [[ $cur == -* ]] && \ + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) +} && +complete -F _hostname hostname + +# ex: filetype=sh diff --git a/completions/hping2 b/completions/hping2 index 45c2c4c6..9d454622 100644 --- a/completions/hping2 +++ b/completions/hping2 @@ -8,19 +8,19 @@ _hping2() case $prev in -I|--interface) _available_interfaces - return 0 + return ;; -a|--spoof) _known_hosts_real "$cur" - return 0 + return ;; -o|--tos) COMPREPLY=( $( compgen -W '02 04 08 10' ) ) - return 0 + return ;; -E|--file) _filedir - return 0 + return ;; esac @@ -32,4 +32,4 @@ _hping2() } && complete -F _hping2 hping hping2 hping3 -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/htop b/completions/htop index 7735f9b5..13c06b15 100644 --- a/completions/htop +++ b/completions/htop @@ -27,6 +27,7 @@ _htop() [[ $COMPREPLY == *= ]] && compopt -o nospace return fi -} && complete -F _htop htop +} && +complete -F _htop htop -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/htpasswd b/completions/htpasswd index b0990fe1..bf3acb22 100644 --- a/completions/htpasswd +++ b/completions/htpasswd @@ -30,4 +30,4 @@ _htpasswd() } && complete -F _htpasswd htpasswd -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/hwclock b/completions/hwclock deleted file mode 100644 index 9f8f9b15..00000000 --- a/completions/hwclock +++ /dev/null @@ -1,23 +0,0 @@ -# hwclock(8) completion -*- shell-script -*- - -_hwclock() -{ - local cur prev words cword - _init_completion || return - - case $prev in - -h|--help|-V|--version|--date|--epoch) - return - ;; - -f|--rtc|--adjfile) - _filedir - return - ;; - esac - - COMPREPLY=( - $( PATH="$PATH:/sbin" compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) -} && -complete -F _hwclock hwclock - -# ex: ts=4 sw=4 et filetype=sh diff --git a/completions/iconv b/completions/iconv index b33cc704..50edb4c5 100644 --- a/completions/iconv +++ b/completions/iconv @@ -8,27 +8,26 @@ _iconv() case $prev in -'?'|--help|--usage|-V|--version|--unicode-subst|--byte-subst|\ --widechar-subst) - return 0 + return ;; -f|--from-code|-t|--to-code) COMPREPLY=( $( compgen -W '$( iconv -l | \ - sed -e "s@/*\$@@" -e "s/[,()]//g" )' -- "$cur" ) ) - return 0 + command sed -e "s@/*\$@@" -e "s/[,()]//g" )' -- "$cur" ) ) + return ;; -o|--output) _filedir - return 0 + return ;; esac - $split && return 0 + $split && return - if [[ "$cur" = -* ]]; then + if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) [[ $COMPREPLY == *= ]] && compopt -o nospace - return 0 fi } && complete -F _iconv -o default iconv -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/id b/completions/id index c985c9eb..137a5f7e 100644 --- a/completions/id +++ b/completions/id @@ -15,4 +15,4 @@ _id() } && complete -F _id id -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/idn b/completions/idn index 14e4cc1a..12f4bdd1 100644 --- a/completions/idn +++ b/completions/idn @@ -23,4 +23,4 @@ _idn() } && complete -F _idn idn -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/iftop b/completions/iftop index 8c606172..831e327b 100644 --- a/completions/iftop +++ b/completions/iftop @@ -7,15 +7,15 @@ _iftop() case $prev in -h|-f|-F|-m) - return 0 + return ;; -i) _available_interfaces -a - return 0 + return ;; -c) _filedir - return 0 + return ;; esac @@ -23,4 +23,4 @@ _iftop() } && complete -F _iftop iftop -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/ifup b/completions/ifup index fcd34994..42cb8f80 100644 --- a/completions/ifup +++ b/completions/ifup @@ -12,8 +12,7 @@ _ifupdown() COMPREPLY=( $(compgen -W '${COMPREPLY[@]}' -- "$cur") ) fi - return 0 } && complete -F _ifupdown ifup ifdown ifstatus -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/info b/completions/info index 36550449..f71cbf5b 100644 --- a/completions/info +++ b/completions/info @@ -5,12 +5,12 @@ _info() local cur prev words cword split _init_completion -s || return - _expand || return 0 + _expand || return # default completion if parameter looks like a path if [[ "$cur" == @(*/|[.~])* ]]; then _filedir - return 0 + return fi case $prev in @@ -62,14 +62,13 @@ _info() COMPREPLY=( ${COMPREPLY[@]##*/?(:)} ) # weed out info dir file for (( i=0 ; i < ${#COMPREPLY[@]} ; ++i )); do - [[ ${COMPREPLY[$i]} == dir ]] && unset COMPREPLY[$i] + [[ ${COMPREPLY[$i]} == dir ]] && unset "COMPREPLY[$i]" done # strip suffix from info pages COMPREPLY=( ${COMPREPLY[@]%.@(gz|bz2|xz|lzma)} ) COMPREPLY=( $( compgen -W '${COMPREPLY[@]%.*}' -- "${cur//\\\\/}" ) ) - return 0 } && complete -F _info info pinfo -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/inject b/completions/inject index da2d9a9e..20ea9b7f 100644 --- a/completions/inject +++ b/completions/inject @@ -8,11 +8,11 @@ _inject() case $prev in -l|--listname) _xfunc list_lists _mailman_lists - return 0 + return ;; esac - $split && return 0 + $split && return if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '--listname --queue --help' -- "$cur" ) ) @@ -23,4 +23,4 @@ _inject() } && complete -F _inject inject -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/insmod b/completions/insmod index 545f8bc5..ec81c93e 100644 --- a/completions/insmod +++ b/completions/insmod @@ -15,4 +15,4 @@ _insmod() } && complete -F _insmod insmod insmod.static -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/installpkg b/completions/installpkg index cdaf816c..f002f775 100644 --- a/completions/installpkg +++ b/completions/installpkg @@ -8,25 +8,26 @@ _installpkg() case "$prev" in --root) _filedir -d - return 0 + return ;; --priority) COMPREPLY=( $( compgen -W 'ADD REC OPT SKP' -- "$cur" ) ) - return 0 + return ;; --tagfile) _filedir - return 0 + return ;; esac if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '--warn --md5sum --root --infobox --terse --menu --ask --priority --tagfile' -- "$cur" ) ) - return 0 + return fi - _filedir "t[bglx]z" -} && complete -F _installpkg installpkg + _filedir 't[bglx]z' +} && +complete -F _installpkg installpkg -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/interdiff b/completions/interdiff index 8b07572f..cf71002e 100644 --- a/completions/interdiff +++ b/completions/interdiff @@ -30,4 +30,4 @@ _interdiff() } && complete -F _interdiff interdiff -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/invoke-rc.d b/completions/invoke-rc.d index d4e0d245..777f6ace 100644 --- a/completions/invoke-rc.d +++ b/completions/invoke-rc.d @@ -20,20 +20,19 @@ _invoke_rc_d() if [[ ($cword -eq 1) || ("$prev" == --* ) ]]; then valid_options=( $( \ tr " " "\n" <<<"${words[@]} ${options[@]}" \ - | sed -ne "/$( sed "s/ /\\\\|/g" <<<"${options[@]}" )/p" \ + | command sed -ne "/$( command sed "s/ /\\\\|/g" <<<"${options[@]}" )/p" \ | sort | uniq -u \ ) ) COMPREPLY=( $( compgen -W '${valid_options[@]} ${services[@]}' -- "$cur" ) ) elif [[ -x $sysvdir/$prev ]]; then - COMPREPLY=( $( compgen -W '`sed -e "y/|/ /" \ + COMPREPLY=( $( compgen -W '`command sed -e "y/|/ /" \ -ne "s/^.*Usage:[ ]*[^ ]*[ ]*{*\([^}\"]*\).*$/\1/p" \ $sysvdir/$prev`' -- "$cur" ) ) else COMPREPLY=() fi - return 0 } && complete -F _invoke_rc_d invoke-rc.d -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/ionice b/completions/ionice deleted file mode 100644 index 6d9bdd46..00000000 --- a/completions/ionice +++ /dev/null @@ -1,57 +0,0 @@ -# ionice(1) completion -*- shell-script -*- - -_ionice() -{ - local cur prev words cword - _init_completion || return - - local offset=0 i - for (( i=1; i <= cword; i++ )); do - case ${words[i]} in - -h) - return - ;; - -p) - offset=0 - break - ;; - -c|-n) - (( i++ )) - continue - ;; - -*) - continue - ;; - esac - offset=$i - break - done - - if [[ $offset -gt 0 ]]; then - _command_offset $offset - return - fi - - case $prev in - -c) - COMPREPLY=( $( compgen -W '{0..3}' -- "$cur" ) ) - return - ;; - -n) - COMPREPLY=( $( compgen -W '{0..7}' -- "$cur" ) ) - return - ;; - -p) - _pids - return - ;; - esac - - if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W '$( _parse_help "$1" -h )' -- "$cur" ) ) - return - fi -} && -complete -F _ionice ionice - -# ex: ts=4 sw=4 et filetype=sh diff --git a/completions/ip b/completions/ip index b073c36f..00dd839d 100644 --- a/completions/ip +++ b/completions/ip @@ -14,25 +14,25 @@ _ip() case $prev in -V|-Version|-rc|-rcvbuf) - return 0 + return ;; -f|-family) COMPREPLY=( $( compgen -W 'inet inet6 ipx dnet link' -- "$cur" ) ) - return 0 + return ;; -b|-batch) _filedir - return 0 + return ;; -force) COMPREPLY=( $( compgen -W '-batch' -- "$cur" ) ) - return 0 + return ;; esac local subcword cmd subcmd for (( subcword=1; subcword < ${#words[@]}-1; subcword++ )); do - [[ ${words[subcword]} == -b?(atch) ]] && return 0 + [[ ${words[subcword]} == -b?(atch) ]] && return [[ -n $cmd ]] && subcmd=${words[subcword]} && break [[ ${words[subcword]} != -* && \ ${words[subcword-1]} != -@(f?(amily)|rc?(vbuf)) ]] && \ @@ -46,21 +46,23 @@ _ip() -oneline -timestamp -batch -rcvbuf" [[ $cword -eq 1 ]] && c+=" -force" COMPREPLY=( $( compgen -W "$c" -- "$cur" ) ) - return 0 + return ;; *) - COMPREPLY=( $( compgen -W "help $( ip help 2>&1 | \ - sed -e '/OBJECT := /,/}/!d' \ - -e 's/.*{//' -e 's/}.*//' -e 's/|//g' )" -- "$cur" ) ) - return 0 + COMPREPLY=( $( compgen -W "help $( ip help 2>&1 | command sed -e \ + '/OBJECT := /,/}/!d' -e \ + 's/.*{//' -e \ + 's/}.*//' -e \ + 's/|//g' )" -- "$cur" ) ) + return ;; esac fi - [[ $subcmd == help ]] && return 0 + [[ $subcmd == help ]] && return case $cmd in - link) + l|link) case $subcmd in add) # TODO @@ -120,13 +122,25 @@ _ip() esac ;; - addr) + a|addr|address) case $subcmd in add|change|replace) - # TODO + if [[ $prev == dev ]]; then + _available_interfaces + elif [[ $prev == scope ]]; then + _iproute2_etc rt_scopes + else + : # TODO + fi ;; del) - # TODO + if [[ $prev == dev ]]; then + _available_interfaces + elif [[ $prev == scope ]]; then + _iproute2_etc rt_scopes + else + : # TODO + fi ;; show|flush) if [[ $cword -eq $subcword+1 ]]; then @@ -151,7 +165,11 @@ _ip() addrlabel) case $subcmd in list|add|del|flush) - # TODO + if [[ $prev == dev ]]; then + _available_interfaces + else + : # TODO + fi ;; *) [[ $cword -eq $subcword ]] && \ @@ -164,7 +182,11 @@ _ip() route) case $subcmd in list|flush) - # TODO + if [[ $prev == proto ]]; then + _iproute2_etc rt_protos + else + : # TODO + fi ;; get) # TODO @@ -275,7 +297,7 @@ _ip() esac ;; - monitor) + monitor) case $subcmd in all) ;; *) @@ -285,7 +307,7 @@ _ip() esac ;; - xfrm) + xfrm) case $subcmd in state|policy|monitor) # TODO @@ -301,4 +323,4 @@ _ip() } && complete -F _ip ip -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/iperf b/completions/iperf index 721825e2..4652879c 100644 --- a/completions/iperf +++ b/completions/iperf @@ -45,10 +45,10 @@ _iperf() for i in ${words[@]}; do case $i in -s|--server) - filter='sed -e /^Client.specific/,/^$/d' + filter='command sed -e /^Client.specific/,/^$/d' ;; -c|--client) - filter='sed -e /^Server.specific/,/^$/d' + filter='command sed -e /^Server.specific/,/^$/d' ;; esac done @@ -60,4 +60,4 @@ _iperf() } && complete -F _iperf iperf -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/ipmitool b/completions/ipmitool index 281d9eac..8e2637c7 100644 --- a/completions/ipmitool +++ b/completions/ipmitool @@ -3,7 +3,7 @@ _ipmitool_singleline_help() { COMPREPLY=( $( compgen -W "$( $1 $2 2>&1 | \ - sed -ne 's/[,\r]//g' -e 's/^.*[Cc]ommands://p' )" -- "$cur" ) ) + command sed -ne 's/[,\r]//g' -e 's/^.*[Cc]ommands://p' )" -- "$cur" ) ) } _ipmitool() @@ -13,53 +13,53 @@ _ipmitool() case $prev in -h|-V|-p|-U|-e|-k|-y|-P|-m|-b|-t|-B|-T|-l) - return 0 + return ;; -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' )" \ + 2>/dev/null | command sed -ne 's/^[^0-9]*\([0-9]\{1,\}\)/\1/p' )" \ -- "$cur" ) ) - return 0 + return ;; -I) COMPREPLY=( $( compgen -W "$( $1 -h 2>&1 | \ - sed -e '/^Interfaces:/,/^[[:space:]]*$/!d' \ + command sed -e '/^Interfaces:/,/^[[:space:]]*$/!d' \ -ne 's/^[[:space:]]\{1,\}\([^[:space:]]\{1,\}\).*/\1/p' )" \ -- "$cur" ) ) - return 0 + return ;; -H) _known_hosts_real "$cur" - return 0 + return ;; -f|-S|-O) _filedir - return 0 + return ;; -C) COMPREPLY=( $( compgen -W '{0..14}' -- "$cur" ) ) - return 0 + return ;; -L) COMPREPLY=( $( compgen -W 'CALLBACK USER OPERATOR ADMINISTRATOR' \ -- "$cur" ) ) - return 0 + return ;; -A) COMPREPLY=( $( compgen -W 'NONE PASSWORD MD2 MD5 OEM' -- "$cur" ) ) - return 0 + return ;; -o) COMPREPLY=( $( compgen -W "$( $1 -o list 2>&1 | \ awk '/^[ \t]+/ { print $1 }' ) list" -- "$cur" ) ) - return 0 + return ;; esac if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" -h)' -- "$cur" ) ) - return 0 + return fi # Find out command and subcommand @@ -77,7 +77,7 @@ _ipmitool() if [[ -z $cmd ]]; then COMPREPLY=( $( compgen -W '${cmds[@]}' -- "$cur" ) ) - return 0 + return fi # Command/subcommand completions @@ -197,4 +197,4 @@ _ipmitool() } && complete -F _ipmitool ipmitool -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/ipsec b/completions/ipsec index b1161b0a..357d5055 100644 --- a/completions/ipsec +++ b/completions/ipsec @@ -7,7 +7,7 @@ _ipsec_connections() { local keyword name while read -r keyword name; do - if [[ $keyword = [#]* ]]; then continue; fi + if [[ $keyword == [#]* ]]; then continue; fi [[ $keyword == conn && $name != '%default' ]] && COMPREPLY+=( "$name" ) done COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) ) @@ -22,7 +22,7 @@ _ipsec_freeswan() COMPREPLY=( $( compgen -W 'auto barf eroute klipsdebug look manual pluto ranbits rsasigkey setup showdefaults showhostkey spi spigrp tncfg whack' -- "$cur" ) ) - return 0 + return fi case ${words[1]} in @@ -45,8 +45,6 @@ _ipsec_freeswan() *) ;; esac - - return 0 } _ipsec_strongswan() @@ -64,7 +62,7 @@ _ipsec_strongswan() scencrypt scepclient secrets start starter status statusall stop stroke unroute uci up update version whack --confdir --copyright --directory --help --version --versioncode' -- "$cur" ) ) - return 0 + return fi case ${words[1]} in @@ -91,8 +89,6 @@ _ipsec_strongswan() *) ;; esac - - return 0 } case "$( ipsec --version 2>/dev/null )" in @@ -104,4 +100,4 @@ case "$( ipsec --version 2>/dev/null )" in ;; esac -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/iptables b/completions/iptables index 0d54afbd..0ecb1ebd 100644 --- a/completions/iptables +++ b/completions/iptables @@ -18,7 +18,7 @@ _iptables() case $prev in -*[AIDRPFXLZ]) COMPREPLY=( $( compgen -W '`iptables $table -nL | \ - sed -ne "s/^Chain \([^ ]\{1,\}\).*$/\1/p"`' -- "$cur" ) ) + command sed -ne "s/^Chain \([^ ]\{1,\}\).*$/\1/p"`' -- "$cur" ) ) ;; -*t) COMPREPLY=( $( compgen -W 'nat filter mangle' -- "$cur" ) ) @@ -26,17 +26,17 @@ _iptables() -j) if [[ "$table" == "-t filter" || -z "$table" ]]; then COMPREPLY=( $( compgen -W 'ACCEPT DROP LOG ULOG REJECT - `iptables $table -nL | sed -ne "$chain" \ + `iptables $table -nL | command sed -ne "$chain" \ -e "s/INPUT|OUTPUT|FORWARD|PREROUTING|POSTROUTING//"`' -- \ "$cur" ) ) elif [[ $table == "-t nat" ]]; then COMPREPLY=( $( compgen -W 'ACCEPT DROP LOG ULOG REJECT MIRROR SNAT DNAT MASQUERADE `iptables $table -nL | \ - sed -ne "$chain" -e "s/OUTPUT|PREROUTING|POSTROUTING//"`' \ + command sed -ne "$chain" -e "s/OUTPUT|PREROUTING|POSTROUTING//"`' \ -- "$cur" ) ) elif [[ $table == "-t mangle" ]]; then COMPREPLY=( $( compgen -W 'ACCEPT DROP LOG ULOG REJECT MARK TOS - `iptables $table -nL | sed -ne "$chain" \ + `iptables $table -nL | command sed -ne "$chain" \ -e "s/INPUT|OUTPUT|FORWARD|PREROUTING|POSTROUTING//"`' -- \ "$cur" ) ) fi @@ -57,4 +57,4 @@ _iptables() } && complete -F _iptables iptables -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/ipv6calc b/completions/ipv6calc index 5db7271f..0dacff94 100644 --- a/completions/ipv6calc +++ b/completions/ipv6calc @@ -7,25 +7,25 @@ _ipv6calc() case "$prev" in -d|--debug) - return 0 + return ;; -I|--in|-O|--out|-A|--action) # With ipv6calc < 0.73.0, -m does nothing here, so use sed instead. - COMPREPLY=( $( compgen -W "$( ipv6calc "$prev" -h 2>&1 | \ - sed -ne 's/^[[:space:]]\{1,\}\([^[:space:]:]\{1,\}\)[[:space:]]*:.*/\1/p' )" \ + COMPREPLY=( $( compgen -W "$( $1 "$prev" -h 2>&1 | \ + command sed -ne 's/^[[:space:]]\{1,\}\([^[:space:]:]\{1,\}\)[[:space:]]*:.*/\1/p' )" \ -- "$cur" ) ) - return 0 + return ;; --db-geoip|--db-ip2location-ipv4|--db-ip2location-ipv6) _filedir - return 0 + return ;; --printstart|--printend) - return 0 + return ;; esac - $split && return 0 + $split && return if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '--help --debug --quiet --in --out --action @@ -35,11 +35,9 @@ _ipv6calc() --masksuffix --printstart --printend --printcompressed --printuncompressed --printfulluncompressed --printmirrored' \ -- "$cur" ) ) - return 0 fi - return 0 } && complete -F _ipv6calc ipv6calc -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/iscsiadm b/completions/iscsiadm index 326dc208..e5218d75 100644 --- a/completions/iscsiadm +++ b/completions/iscsiadm @@ -9,23 +9,23 @@ _iscsiadm() -m|--mode) COMPREPLY=( $( compgen -W 'discovery node session iface fw host' \ -- "$cur" ) ) - return 0 + return ;; -o|--op) COMPREPLY=( $( compgen -W 'new delete update show' -- "$cur" ) ) - return 0 + return ;; -t|--type) COMPREPLY=( $( compgen -W 'sendtargets st slp isns fw' -- "$cur" ) ) - return 0 + return ;; -L|-U|--loginall|--logoutall) COMPREPLY=( $( compgen -W 'all manual automatic' -- "$cur" ) ) - return 0 + return ;; esac - $split && return 0 + $split && return local options if [[ $cword -gt 1 ]] ; then @@ -63,4 +63,4 @@ _iscsiadm() } && complete -F _iscsiadm iscsiadm -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/isql b/completions/isql index 43cd6dd3..862a9304 100644 --- a/completions/isql +++ b/completions/isql @@ -7,8 +7,8 @@ _isql() _init_completion || return [[ -f $ODBCINI ]] \ - && COMPREPLY=( $( command grep \\["$cur" "$ODBCINI" | tr -d \\[\\] ) ) + && COMPREPLY=( $( command grep "\[$cur" "$ODBCINI" | tr -d \[\] ) ) } && complete -F _isql isql -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/iwconfig b/completions/iwconfig index 36213d2c..114081dd 100644 --- a/completions/iwconfig +++ b/completions/iwconfig @@ -9,7 +9,7 @@ _iwconfig() mode) COMPREPLY=( $( compgen -W 'managed ad-hoc master repeater secondary monitor' -- "$cur" ) ) - return 0 + return ;; essid) COMPREPLY=( $( compgen -W 'on off any' -- "$cur" ) ) @@ -18,22 +18,22 @@ _iwconfig() "$( iwlist ${words[1]} scan | \ awk -F'\"' '/ESSID/ {print $2}' )" -- "$cur" ) ) fi - return 0 + return ;; nwid) COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) ) - return 0 + return ;; channel) COMPREPLY=( $( compgen -W "$( iwlist ${words[1]} channel | \ awk '/^[ \t]*Channel/ {print $2}' )" -- "$cur" ) ) - return 0 + return ;; freq) COMPREPLY=( $( compgen -W "$( iwlist ${words[1]} channel | \ awk '/^[ \t]*Channel/ {print $4"G"}')" -- "$cur" ) ) - return 0 + return ;; ap) COMPREPLY=( $( compgen -W 'on off any' -- "$cur" ) ) @@ -42,34 +42,34 @@ _iwconfig() "$( iwlist ${words[1]} scan | \ awk -F ': ' '/Address/ {print $2}' )" -- "$cur" ) ) fi - return 0 + return ;; rate) COMPREPLY=( $( compgen -W 'auto fixed' -- "$cur" ) ) COMPREPLY+=( $( compgen -W \ "$( iwlist ${words[1]} rate | \ awk '/^[ \t]*[0-9]/ {print $1"M"}' )" -- "$cur" ) ) - return 0 + return ;; rts|frag) COMPREPLY=( $( compgen -W 'auto fixed off' -- "$cur" ) ) - return 0 + return ;; key|enc) COMPREPLY=( $( compgen -W 'off on open restricted' -- "$cur" ) ) - return 0 + return ;; power) COMPREPLY=( $( compgen -W 'period timeout off on' -- "$cur" ) ) - return 0 + return ;; txpower) COMPREPLY=( $( compgen -W 'off on auto' -- "$cur" ) ) - return 0 + return ;; retry) COMPREPLY=( $( compgen -W 'limit lifetime' -- "$cur" ) ) - return 0 + return ;; esac @@ -87,4 +87,4 @@ _iwconfig() } && complete -F _iwconfig iwconfig -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/iwlist b/completions/iwlist index 78c15b71..b27dbe8b 100644 --- a/completions/iwlist +++ b/completions/iwlist @@ -19,4 +19,4 @@ _iwlist() } && complete -F _iwlist iwlist -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/iwpriv b/completions/iwpriv index 05952c5e..c7f8209e 100644 --- a/completions/iwpriv +++ b/completions/iwpriv @@ -8,11 +8,11 @@ _iwpriv() case $prev in roam) COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) ) - return 0 + return ;; port) COMPREPLY=( $( compgen -W 'ad-hoc managed' -- "$cur" ) ) - return 0 + return ;; esac @@ -28,4 +28,4 @@ _iwpriv() } && complete -F _iwpriv iwpriv -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/iwspy b/completions/iwspy index b59b0693..1cf3a283 100644 --- a/completions/iwspy +++ b/completions/iwspy @@ -17,4 +17,4 @@ _iwspy() } && complete -F _iwspy iwspy -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/jar b/completions/jar index 8af86a17..b7de930f 100644 --- a/completions/jar +++ b/completions/jar @@ -7,7 +7,7 @@ _jar() if [[ $cword -eq 1 ]]; then COMPREPLY=( $( compgen -W 'c t x u' -- "$cur" ) ) - return 0 + return fi case ${words[1]} in @@ -24,4 +24,4 @@ _jar() } && complete -F _jar jar -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/jarsigner b/completions/jarsigner index c1c72af7..2441bd1a 100644 --- a/completions/jarsigner +++ b/completions/jarsigner @@ -9,23 +9,24 @@ _jarsigner() -keystore) COMPREPLY=( $( compgen -W 'NONE' -- "$cur" ) ) _filedir '@(jks|ks|p12|pfx)' - return 0 + return ;; - -storepass|-keypass|-sigfile|-digestalg|-sigalg|-tsacert|-altsigner|\ - -altsignerpath|-providerName|-providerClass|-providerArg) - return 0 + -storepass|-keypass|-sigfile|-digestalg|-sigalg|-tsacert|-tsapolicyid|\ + -tsadigestalg|-altsigner|-altsignerpath|-providerName|-providerClass|\ + -providerArg) + return + ;; + -certchain|-sigfile|-tsa) + _filedir + return ;; -storetype) COMPREPLY=( $( compgen -W 'JKS PKCS11 PKCS12' -- "$cur" ) ) - return 0 + return ;; -signedjar) _filedir jar - return 0 - ;; - -tsa) - _filedir - return 0 + return ;; esac @@ -53,4 +54,4 @@ _jarsigner() } && complete -F _jarsigner jarsigner -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/java b/completions/java index c302d1e5..7d1cf1fe 100644 --- a/completions/java +++ b/completions/java @@ -71,9 +71,9 @@ _java_classes() elif [[ -d $i ]]; then COMPREPLY+=( - $( compgen -d -- "$i/$cur" | sed -e "s|^$i/\(.*\)|\1.|" ) + $( compgen -d -- "$i/$cur" | command sed -e "s|^$i/\(.*\)|\1.|" ) $( compgen -f -X '!*.class' -- "$i/$cur" | \ - sed -e '/\$/d' -e "s|^$i/||" ) + command sed -e '/\$/d' -e "s|^$i/||" ) ) [[ $COMPREPLY == *.class ]] || compopt -o nospace @@ -103,7 +103,7 @@ _java_packages() for i in ${sourcepath//:/ }; do if [[ -d $i ]]; then COMPREPLY+=( $( command ls -F -d $i/$cur* 2>/dev/null | \ - sed -e 's|^'$i'/||' ) ) + command sed -e 's|^'$i'/||' ) ) fi done # keep only packages @@ -134,7 +134,7 @@ _java() *) # once we've seen a class, just do filename completion _filedir - return 0 + return ;; esac done @@ -143,70 +143,70 @@ _java() # standard option completions -verbose:*) COMPREPLY=( $( compgen -W 'class gc jni' -- "${cur#*:}" ) ) - return 0 + return ;; -javaagent:*) cur=${cur#*:} _filedir '@(jar|zip)' - return 0 + return ;; -agentpath:*) cur=${cur#*:} _filedir so - return 0 + return ;; # various non-standard option completions -splash:*) cur=${cur#*:} _filedir '@(gif|jp?(e)g|png)' - return 0 + return ;; -Xbootclasspath*:*) _java_path - return 0 + return ;; -Xcheck:*) COMPREPLY=( $( compgen -W 'jni' -- "${cur#*:}" ) ) - return 0 + return ;; -Xgc:*) COMPREPLY=( $( compgen -W 'singlecon gencon singlepar genpar' \ -- "${cur#*:}" ) ) - return 0 + return ;; -Xgcprio:*) COMPREPLY=( $( compgen -W 'throughput pausetime deterministic' \ -- "${cur#*:}" ) ) - return 0 + return ;; -Xloggc:*|-Xverboselog:*) cur=${cur#*:} _filedir - return 0 + return ;; -Xshare:*) COMPREPLY=( $( compgen -W 'auto off on' -- "${cur#*:}" ) ) - return 0 + return ;; -Xverbose:*) COMPREPLY=( $( compgen -W 'memory load jni cpuinfo codegen opt gcpause gcreport' -- "${cur#*:}" ) ) - return 0 + return ;; -Xverify:*) COMPREPLY=( $( compgen -W 'all none remote' -- "${cur#*:}" ) ) - return 0 + return ;; # the rest that we have no completions for -D*|-*:*) - return 0 + return ;; esac case $prev in -cp|-classpath) _java_path - return 0 + return ;; esac @@ -238,19 +238,29 @@ _javadoc() case $prev in -overview|-helpfile) _filedir '?(x)htm?(l)' - return 0 + return + ;; + -doclet|-exclude|-subpackages|-source|-locale|-encoding|-windowtitle|\ + -doctitle|-header|-footer|-top|-bottom|-group|-noqualifier|-tag|\ + -charset|-sourcetab|-docencoding) + return ;; -stylesheetfile) _filedir css - return 0 + return ;; -d|-link|-linkoffline) _filedir -d - return 0 + return ;; - -classpath|-bootclasspath|-docletpath|-sourcepath|-extdirs) + -classpath|-cp|-bootclasspath|-docletpath|-sourcepath|-extdirs|\ + -excludedocfilessubdir) _java_path - return 0 + return + ;; + -helpfile) + _filedir + return ;; esac @@ -279,11 +289,11 @@ _javac() case $prev in -d) _filedir -d - return 0 + return ;; - -classpath|-bootclasspath|-sourcepath|-extdirs) + -cp|-classpath|-bootclasspath|-sourcepath|-extdirs) _java_path - return 0 + return ;; esac @@ -294,7 +304,7 @@ _javac() # For some reason there may be -g:none AND -g:{lines,source,vars}; # convert the none case to the curly brace format so it parses like # the others. - local opts=$( "$1" $helpopt 2>&1 | sed -e 's/-g:none/-g:{none}/' -ne \ + local opts=$( "$1" $helpopt 2>&1 | command sed -e 's/-g:none/-g:{none}/' -ne \ "s/^[[:space:]]*${cur%%:*}:{\([^}]\{1,\}\)}.*/\1/p" ) COMPREPLY=( $( compgen -W "${opts//,/ }" -- "${cur#*:}" ) ) return @@ -315,4 +325,4 @@ _javac() } && complete -F _javac javac -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/javaws b/completions/javaws index b9afefd7..7d6e22c8 100644 --- a/completions/javaws +++ b/completions/javaws @@ -7,28 +7,28 @@ _javaws() case $prev in -help|-license|-about|-viewer|-arg|-param|-property|-update|-umask) - return 0 + return ;; -basedir|-codebase) _filedir -d - return 0 + return ;; -uninstall|-import) _filedir jnlp - return 0 + return ;; esac if [[ $cur == *= ]]; then - return 0 + return elif [[ $cur == -* ]]; then COMPREPLY=( $( compgen -W "$( _parse_help "$1" -help ) " -- "$cur" ) ) [[ $COMPREPLY == *= ]] && compopt -o nospace - return 0 + return fi _filedir jnlp } && complete -F _javaws javaws -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/jpegoptim b/completions/jpegoptim new file mode 100644 index 00000000..754f16a2 --- /dev/null +++ b/completions/jpegoptim @@ -0,0 +1,38 @@ +# jpegoptim(1) completion -*- shell-script -*- + +_jpegoptim() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + -h|--help|-V|--version) + return + ;; + -d|--dest) + _filedir -d + return + ;; + -m|--max|-T|--threshold) + COMPREPLY=( $( compgen -W '{0..100}' -- "$cur" ) ) + return + ;; + -S|--size) + COMPREPLY=( $( compgen -W '{1..99}%' -- "$cur" ) ) + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + return + fi + + _filedir 'jp?(e)g' +} && +complete -F _jpegoptim jpegoptim + +# ex: filetype=sh diff --git a/completions/jps b/completions/jps index 774ad6ce..42f8d1a5 100644 --- a/completions/jps +++ b/completions/jps @@ -22,4 +22,4 @@ _jps() } && complete -F _jps jps -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/jshint b/completions/jshint new file mode 100644 index 00000000..ea9bbeb5 --- /dev/null +++ b/completions/jshint @@ -0,0 +1,38 @@ +# bash completion for jshint -*- shell-script -*- + +_jshint() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + -v|--version|-h|--help|--exclude|--filename|-e|--extra-ext) + return + ;; + -c|--config) + _filedir + return + ;; + --reporter) + COMPREPLY=( $( compgen -W "jslint checkstyle unix" -- "$cur" ) ) + return + ;; + --extract) + COMPREPLY=( $( compgen -W "auto always never" -- "$cur" ) ) + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + return + fi + + _filedir js +} && +complete -F _jshint jshint + +# ex: filetype=sh diff --git a/completions/k3b b/completions/k3b index 9c03642f..2cbcbb1b 100644 --- a/completions/k3b +++ b/completions/k3b @@ -7,32 +7,32 @@ _k3b() case $prev in --help*|--author|-v|--version|--license|--lang) - return 0 + return ;; --datacd|--audiocd|--videocd|--mixedcd|--emovixcd|--videodvd) _filedir - return 0 + return ;; --copydvd|--formatdvd|--videodvdrip) _dvd_devices - return 0 + return ;; --copycd|--erasecd|--cddarip|--videocdrip) _cd_devices _dvd_devices - return 0 + return ;; --cdimage|--image) - _filedir @(cue|iso|toc) - return 0 + _filedir '@(cue|iso|toc)' + return ;; --dvdimage) _filedir iso - return 0 + return ;; --ao) COMPREPLY=( $( compgen -W 'alsa arts' -- "$cur" ) ) - return 0 + return ;; esac @@ -45,4 +45,4 @@ _k3b() } && complete -F _k3b k3b -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/kcov b/completions/kcov index 86d2d10c..7e9aa1e0 100644 --- a/completions/kcov +++ b/completions/kcov @@ -3,7 +3,7 @@ _kcov() { local cur prev words cword split - _init_completion -s || return + _init_completion -s -n : || return case "$prev" in --pid|-p) @@ -11,25 +11,31 @@ _kcov() return ;; --sort-type|-s) - COMPREPLY=( $( compgen -W 'filename percentage lines uncovered' \ - -- "$cur" ) ) + COMPREPLY=( $( compgen -W 'filename percent reverse lines + uncovered' -- "$cur" ) ) return ;; --include-path|--exclude-path) _filedir return ;; + --replace-src-path) + if [[ "$cur" == ?*:* ]]; then + cur="${cur##*:}" + _filedir + else + _filedir + compopt -o nospace + fi + return + ;; --limits|-l) - split=false if [[ "$cur" == ?*,* ]]; then prev="${cur%,*}" cur="${cur##*,}" - split=true - fi - COMPREPLY=( $( compgen -W "{0..100}" -- "$cur" ) ) - if $split; then - COMPREPLY=( ${COMPREPLY[@]/#/"$prev,"} ) + COMPREPLY=( $( compgen -P "$prev," -W "{0..100}" -- "$cur" ) ) else + COMPREPLY=( $( compgen -W "{0..100}" -- "$cur" ) ) compopt -o nospace fi return @@ -49,6 +55,7 @@ _kcov() fi _filedir -} && complete -F _kcov kcov +} && +complete -F _kcov kcov -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/kill b/completions/kill index ed5ae585..ac179cd9 100644 --- a/completions/kill +++ b/completions/kill @@ -26,4 +26,4 @@ _kill() } && complete -F _kill kill -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/killall b/completions/killall index ed502f97..6d1532c3 100644 --- a/completions/killall +++ b/completions/killall @@ -33,4 +33,4 @@ _killall() } && complete -F _killall killall -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/kldload b/completions/kldload index f362db69..0442e95e 100644 --- a/completions/kldload +++ b/completions/kldload @@ -15,8 +15,7 @@ _kldload() COMPREPLY=( ${COMPREPLY[@]#$moddir} ) COMPREPLY=( ${COMPREPLY[@]%.ko} ) - return 0 } && complete -F _kldload kldload -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/kldunload b/completions/kldunload index adb268d8..82770189 100644 --- a/completions/kldunload +++ b/completions/kldunload @@ -7,9 +7,9 @@ _kldunload() local cur prev words cword _init_completion || return - COMPREPLY=( $( kldstat | \ - sed -ne "s/^.*[ \t]\{1,\}\($cur[a-z_]\{1,\}\).ko$/\1/p" ) ) + COMPREPLY=( $( kldstat | command sed -ne \ + "s/^.*[[:blank:]]\{1,\}\($cur[a-z_]\{1,\}\).ko$/\1/p" ) ) } && complete -F _kldunload kldunload -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/koji b/completions/koji index bd6cb2fd..30b8d49a 100644 --- a/completions/koji +++ b/completions/koji @@ -244,4 +244,4 @@ _koji() } && complete -F _koji koji arm-koji ppc-koji s390-koji sparc-koji -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/ktutil b/completions/ktutil index 88eb5275..384db329 100644 --- a/completions/ktutil +++ b/completions/ktutil @@ -29,27 +29,27 @@ _ktutil() case $prev in -p|--principal) _heimdal_principals - return 0 + return ;; -e|--enctype) _heimdal_encodings - return 0 + return ;; -a|--admin-server) _known_hosts_real "$cur" - return 0 + return ;; -r|--realm) _heimdal_realms - return 0 + return ;; -s|-k|--srvtab|--keytab) _filedir - return 0 + return ;; esac - $split && return 0 + $split && return commands='add change copy get list remove rename purge srvconvert srv2keytab srvcreate key2srvtab' @@ -117,4 +117,4 @@ _ktutil() } && complete -F _ktutil ktutil -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/larch b/completions/larch index 79716a5f..5b7ebd14 100644 --- a/completions/larch +++ b/completions/larch @@ -33,8 +33,7 @@ _larch() "$cur" ) ) fi - return 0 } && complete -F _larch -o default larch -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/lastlog b/completions/lastlog index a8724029..4ac6b520 100644 --- a/completions/lastlog +++ b/completions/lastlog @@ -7,19 +7,19 @@ _lastlog() case $prev in -b|--before|-h|--help|-t|--time) - return 0 + return ;; -u|--user) COMPREPLY=( $( compgen -u -- "$cur" ) ) - return 0 + return ;; esac - $split && return 0 + $split && return COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) [[ $COMPREPLY == *= ]] && compopt -o nospace } && complete -F _lastlog lastlog -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/ldapsearch b/completions/ldapsearch index 6a9b7b1b..282760f7 100644 --- a/completions/ldapsearch +++ b/completions/ldapsearch @@ -18,32 +18,32 @@ _ldapsearch() case $prev in -h) _known_hosts_real "$cur" - return 0 + return ;; -H) _ldap_uris - return 0 + return ;; -T) _filedir -d - return 0 + return ;; -f|-y) _filedir - return 0 + return ;; -s) COMPREPLY=( $( compgen -W 'base one sub children' -- "$cur" ) ) - return 0 + return ;; -a) COMPREPLY=( $( compgen -W 'never always search find' \ -- "$cur" ) ) - return 0 + return ;; -P) _ldap_protocols - return 0 + return ;; esac @@ -61,19 +61,19 @@ _ldapaddmodify() case $prev in -h) _known_hosts_real "$cur" - return 0 + return ;; -H) _ldap_uris - return 0 + return ;; -S|-f|-y) _filedir - return 0 + return ;; -P) _ldap_protocols - return 0 + return ;; esac @@ -91,19 +91,19 @@ _ldapdelete() case $prev in -h) _known_hosts_real "$cur" - return 0 + return ;; -H) _ldap_uris - return 0 + return ;; -f|-y) _filedir - return 0 + return ;; -P) _ldap_protocols - return 0 + return ;; esac @@ -121,19 +121,19 @@ _ldapcompare() case $prev in -h) _known_hosts_real "$cur" - return 0 + return ;; -H) _ldap_uris - return 0 + return ;; -y) _filedir - return 0 + return ;; -P) _ldap_protocols - return 0 + return ;; esac @@ -151,19 +151,19 @@ _ldapmodrdn() case $prev in -h) _known_hosts_real "$cur" - return 0 + return ;; -H) _ldap_uris - return 0 + return ;; -f|-y) _filedir - return 0 + return ;; -P) _ldap_protocols - return 0 + return ;; esac @@ -181,19 +181,19 @@ _ldapwhoami() case $prev in -h) _known_hosts_real "$cur" - return 0 + return ;; -H) _ldap_uris - return 0 + return ;; -f|-y) _filedir - return 0 + return ;; -P) _ldap_protocols - return 0 + return ;; esac @@ -211,15 +211,15 @@ _ldappasswd() case $prev in -h) _known_hosts_real "$cur" - return 0 + return ;; -H) _ldap_uris - return 0 + return ;; -t|-T|-y) _filedir - return 0 + return ;; esac @@ -229,4 +229,4 @@ _ldappasswd() } && complete -F _ldappasswd ldappasswd -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/ldapvi b/completions/ldapvi index 9c9b6491..e3c1f103 100644 --- a/completions/ldapvi +++ b/completions/ldapvi @@ -8,37 +8,37 @@ _ldapvi() case $prev in -h|--host) _known_hosts_real "$cur" - return 0 + return ;; -Y|--sasl-mech) COMPREPLY=( $( compgen -W 'EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 PLAIN ANONYMOUS' -- "$cur" ) ) - return 0 + return ;; --bind) COMPREPLY=( $( compgen -W 'simple sasl' -- "$cur" ) ) - return 0 + return ;; --bind-dialog) COMPREPLY=( $( compgen -W 'never auto always' -- "$cur" ) ) - return 0 + return ;; --scope) COMPREPLY=( $( compgen -W 'base one sub' -- "$cur" ) ) - return 0 + return ;; --deref) COMPREPLY=( $( compgen -W 'never searching finding always' \ -- "$cur" ) ) - return 0 + return ;; --encoding) COMPREPLY=( $( compgen -W 'ASCII UTF-8 binary' -- "$cur" ) ) - return 0 + return ;; --tls) COMPREPLY=( $( compgen -W 'never allow try strict' -- "$cur" ) ) - return 0 + return ;; esac @@ -48,4 +48,4 @@ _ldapvi() } && complete -F _ldapvi ldapvi -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/lftp b/completions/lftp index 86706002..edb363b2 100644 --- a/completions/lftp +++ b/completions/lftp @@ -8,16 +8,16 @@ _lftp() case $prev in -f) _filedir - return 0 + return ;; -c|-h|--help|-v|--version|-e|-u|-p) - return 0 + return ;; esac if [[ "$cur" == -* ]] ; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) - return 0 + return fi COMPREPLY=( $( compgen -W \ @@ -26,4 +26,4 @@ _lftp() } && complete -F _lftp lftp -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/lftpget b/completions/lftpget index 88ab31f6..8f1d4a2f 100644 --- a/completions/lftpget +++ b/completions/lftpget @@ -11,4 +11,4 @@ _lftpget() } && complete -F _lftpget lftpget -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/lilo b/completions/lilo index 3073183c..1ccca35c 100644 --- a/completions/lilo +++ b/completions/lilo @@ -3,7 +3,7 @@ _lilo_labels() { COMPREPLY=( $( compgen -W "$( awk -F'=' '/label/ {print $2}' \ - /etc/lilo.conf | sed -e 's/\"//g' )" -- "$cur" ) ) + /etc/lilo.conf | command sed -e 's/\"//g' )" -- "$cur" ) ) } _lilo() @@ -14,28 +14,28 @@ _lilo() case $prev in -C|-i|-m|-s|-S) _filedir - return 0 + return ;; -r) _filedir -d - return 0 + return ;; -I|-D|-R) # label completion _lilo_labels - return 0 + return ;; -A|-b|-M|-u|-U) # device completion cur=${cur:=/dev/} _filedir - return 0 + return ;; -T) # topic completion COMPREPLY=( $( compgen -W 'help ChRul EBDA geom geom= table= video' -- "$cur" ) ) - return 0 + return ;; esac @@ -47,4 +47,4 @@ _lilo() } && complete -F _lilo lilo -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/links b/completions/links index abb19900..8c72970e 100644 --- a/completions/links +++ b/completions/links @@ -23,12 +23,11 @@ _links() -- "$cur" ) ) fi _filedir '@(htm|html)' - return 0 + return ;; esac - return 0 } && complete -F _links links -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/lintian b/completions/lintian index 1c9eaa6e..e62a6265 100644 --- a/completions/lintian +++ b/completions/lintian @@ -4,13 +4,13 @@ _lintian_tags() { local match search tags - tags=$( grep -e ^Tag /usr/share/lintian/checks/*.desc | cut -d\ -f2 ) + tags=$( awk '/^Tag/ { print $2 }' /usr/share/lintian/checks/*.desc ) if [[ "$cur" == *, ]]; then search=${cur//,/ } for item in $search; do - match=$(grep -nE "^Tag: $item$" /usr/share/lintian/checks/*.desc \ - | cut -d: -f1 ) - tags=$( sed -e "s/\<$item\>//g" <<<$tags ) + match=$( command grep -nE "^Tag: $item$" \ + /usr/share/lintian/checks/*.desc | cut -d: -f1 ) + tags=$( command sed -e "s/\<$item\>//g" <<<$tags ) done COMPREPLY+=( $(compgen -W "$tags") ) elif [[ "$cur" == *,* ]]; then @@ -18,24 +18,22 @@ _lintian_tags() else COMPREPLY+=( $(compgen -W "$tags" -- "$cur") ) fi - return 0 } _lintian_checks() { local match search todisable checks - checks=$(grep -e ^Check-Script -e ^Abbrev \ - /usr/share/lintian/checks/*.desc | cut -d\ -f2 ) + checks=$( awk '/^(Check-Script|Abbrev)/ { print $2 }' \ + /usr/share/lintian/checks/*.desc ) if [[ "$cur" == *, ]]; then search=${cur//,/ } for item in $search; do - match=$(grep -nE "^(Check-Script|Abbrev): $item$" \ - /usr/share/lintian/checks/*.desc | cut -d: -f1 ) - todisable=$(grep -e ^Check-Script -e ^Abbrev $match | \ - cut -d\ -f2 ) + match=$( command grep -nE "^(Check-Script|Abbrev): $item$" \ + /usr/share/lintian/checks/*.desc | cut -d: -f1 ) + todisable=$( awk '/^(Check-Script|Abbrev)/ { print $2 }' $match ) for name in $todisable; do - checks=$( sed -e "s/\<$name\>//g" <<<$checks ) + checks=$( command sed -e "s/\<$name\>//g" <<<$checks ) done done COMPREPLY+=( $(compgen -W "$checks") ) @@ -44,21 +42,20 @@ _lintian_checks() else COMPREPLY+=( $(compgen -W "$checks" -- "$cur") ) fi - return 0 } _lintian_infos() { local match search infos - infos=$(grep -e ^Collector /usr/share/lintian/collection/*.desc \ - | cut -d\ -f2 ) + infos=$( awk '/^Collector/ { print $2 }' \ + /usr/share/lintian/collection/*.desc ) if [[ "$cur" == *, ]]; then search=${cur//,/ } for item in $search; do - match=$( grep -nE "^Collector: $item$" \ - /usr/share/lintian/collection/*.desc | cut -d: -f1 ) - infos=$( sed -e "s/\<$item\>//g" <<<$infos ) + match=$( command grep -nE "^Collector: $item$" \ + /usr/share/lintian/collection/*.desc | cut -d: -f1 ) + infos=$( command sed -e "s/\<$item\>//g" <<<$infos ) done COMPREPLY+=( $(compgen -W "$infos") ) elif [[ "$cur" == *,* ]]; then @@ -66,12 +63,6 @@ _lintian_infos() else COMPREPLY+=( $(compgen -W "$infos" -- "$cur") ) fi - return 0 -} - -_lintian_arches() -{ - return 0 } _lintian() @@ -94,7 +85,7 @@ _lintian() --root" selection_opts="--all --binary --source --udeb --packages-file" - if [[ "$prev" = -* ]]; then + if [[ "$prev" == -* ]]; then case $prev in -C|--check-part|-X|--dont-check-part) _lintian_checks @@ -176,4 +167,4 @@ _lintian_info() } && complete -F _lintian_info lintian-info -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/lisp b/completions/lisp index 45cd4e6f..279ffcdb 100644 --- a/completions/lisp +++ b/completions/lisp @@ -16,8 +16,7 @@ _lisp() _filedir fi - return 0 } && complete -F _lisp -o default lisp -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/list_admins b/completions/list_admins index 6c05a7d3..06542f91 100644 --- a/completions/list_admins +++ b/completions/list_admins @@ -14,4 +14,4 @@ _list_admins() } && complete -F _list_admins list_admins -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/list_lists b/completions/list_lists index 04471e1e..629e4c07 100644 --- a/completions/list_lists +++ b/completions/list_lists @@ -18,4 +18,4 @@ _list_lists() } && complete -F _list_lists list_lists -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/list_members b/completions/list_members index d432b36c..e60f61da 100644 --- a/completions/list_members +++ b/completions/list_members @@ -8,20 +8,20 @@ _list_members() case $prev in -o|--output) _filedir - return 0 + return ;; -d|--digest) COMPREPLY=( $( compgen -W 'mime plain' -- "$cur" ) ) - return 0 + return ;; -n|--nomail) COMPREPLY=( $( compgen -W 'byadmin byuser bybounce unknown' \ -- "$cur" ) ) - return 0 + return ;; esac - $split && return 0 + $split && return if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '--output --regular --digest --nomail @@ -33,4 +33,4 @@ _list_members() } && complete -F _list_members list_members -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/list_owners b/completions/list_owners index a780265b..88b25bb3 100644 --- a/completions/list_owners +++ b/completions/list_owners @@ -15,4 +15,4 @@ _list_owners() } && complete -F _list_owners list_owners -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/look b/completions/look deleted file mode 100644 index df914452..00000000 --- a/completions/look +++ /dev/null @@ -1,14 +0,0 @@ -# look(1) completion -*- shell-script -*- - -_look() -{ - local cur prev words cword - _init_completion || return - - if [[ $cword -eq 1 ]]; then - COMPREPLY=( $( compgen -W '$(look "$cur" 2>/dev/null)' -- "$cur" ) ) - fi -} && -complete -F _look -o default look - -# ex: ts=4 sw=4 et filetype=sh diff --git a/completions/lpq b/completions/lpq index d667713e..b02705af 100644 --- a/completions/lpq +++ b/completions/lpq @@ -8,21 +8,21 @@ _lpq() case $prev in -P) COMPREPLY=( $( compgen -W "$( lpstat -a 2>/dev/null | cut -d' ' -f1 )" -- "$cur" ) ) - return 0 + return ;; -U) COMPREPLY=( $( compgen -u -- "$cur" ) ) - return 0 + return ;; esac if [[ "$cur" == - ]]; then COMPREPLY=( $( compgen -W '-E -P -U -a -h -l' -- "$cur" ) ) - return 0 + return fi _filedir } && complete -F _lpq lpq -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/lpr b/completions/lpr index 35ddd625..b1515bd5 100644 --- a/completions/lpr +++ b/completions/lpr @@ -8,26 +8,26 @@ _lpr() case $prev in -P) COMPREPLY=( $( compgen -W "$( lpstat -a 2>/dev/null | cut -d' ' -f1 )" -- "$cur" ) ) - return 0 + return ;; -U) COMPREPLY=( $( compgen -u -- "$cur" ) ) - return 0 + return ;; -o) COMPREPLY=( $( compgen -W "media= landscape orientation-requested= sides= fitplot number-up= scaling= cpi= lpi= page-bottom= page-top= page-left= page-right=" -- "$cur" ) ) [[ $COMPREPLY == *= ]] && compopt -o nospace - return 0 + return ;; esac if [[ "$cur" == - ]]; then COMPREPLY=( $( compgen -W '-E -H -C -J -T -P -U -h -l -m -o -p -q -r' -- "$cur" ) ) - return 0 + return fi _filedir } && complete -F _lpr lpr -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/lrzip b/completions/lrzip index d4106fb2..f8e2cf1c 100644 --- a/completions/lrzip +++ b/completions/lrzip @@ -8,39 +8,39 @@ _lrzip() local xspec="*.lrz" case $prev in - -w|-S|-V|-h|-'?') - return 0 + -w|-S|-V|-h|-'?'|-m) + return ;; -d) xspec="!"$xspec ;; -o) _filedir - return 0 + return ;; -O) _filedir -d - return 0 + return ;; -L) COMPREPLY=( $( compgen -W '{1..9}' -- "$cur" ) ) - return 0 + return ;; -N) COMPREPLY=( $( compgen -W '{-20..19}' -- "$cur" ) ) - return 0 + return ;; -p) COMPREPLY=( $( compgen -W "{1..$(_ncpus)}" -- "$cur" ) ) - return 0 + return ;; esac - _expand || return 0 + _expand || return if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) - return 0 + return fi local IFS=$'\n' @@ -50,4 +50,4 @@ _lrzip() } && complete -F _lrzip lrzip -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/lsof b/completions/lsof index 6ff7786c..329946d5 100644 --- a/completions/lsof +++ b/completions/lsof @@ -7,38 +7,38 @@ _lsof() case $prev in -'?'|-h|+c|-c|-d|-F|-i|+r|-r|-s|-S|-T) - return 0 + return ;; -A|-k|-m|+m|-o) _filedir - return 0 + return ;; +d|+D) _filedir -d - return 0 + return ;; -D) COMPREPLY=( $( compgen -W '? b i r u' -- "$cur" ) ) - return 0 + return ;; -f) COMPREPLY=( $( compgen -W 'c f g G n' -- "$cur" ) ) - return 0 + return ;; -g) # TODO: handle ^foo exclusions, comma separated lists _pgids - return 0 + return ;; -p) # TODO: handle ^foo exclusions, comma separated lists _pids - return 0 + return ;; -u) # TODO: handle ^foo exclusions, comma separated lists COMPREPLY=( $( compgen -u -- "$cur" ) ) - return 0 + return ;; esac @@ -46,11 +46,11 @@ _lsof() 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 + return fi _filedir } && complete -F _lsof lsof -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/lua b/completions/lua index 83dc7368..9413319e 100644 --- a/completions/lua +++ b/completions/lua @@ -20,4 +20,4 @@ _lua() } && complete -F _lua lua -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/luac b/completions/luac index a0330735..9c91f25a 100644 --- a/completions/luac +++ b/completions/luac @@ -24,4 +24,4 @@ _luac() } && complete -F _luac luac -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/luseradd b/completions/luseradd index e5b00c3c..41769b00 100644 --- a/completions/luseradd +++ b/completions/luseradd @@ -37,4 +37,4 @@ _luseradd() } && complete -F _luseradd luseradd lusermod -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/luserdel b/completions/luserdel index 05faaac2..83e1818b 100644 --- a/completions/luserdel +++ b/completions/luserdel @@ -20,4 +20,4 @@ _luserdel() } && complete -F _luserdel luserdel -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/lvm b/completions/lvm index ba0720ed..fb83a3fb 100644 --- a/completions/lvm +++ b/completions/lvm @@ -1,26 +1,38 @@ # bash completion for lvm -*- shell-script -*- +_lvm_filedir() +{ + cur=${cur:-/dev/} + _filedir +} + _lvm_volumegroups() { COMPREPLY=( $(compgen -W "$( vgscan 2>/dev/null | \ - sed -n -e 's|.*Found.*"\(.*\)".*$|\1|p' )" -- "$cur" ) ) + command sed -n -e 's|.*Found.*"\(.*\)".*$|\1|p' )" -- "$cur" ) ) +} + +_lvm_physicalvolumes_all() +{ + COMPREPLY=( $(compgen -W "$( pvscan 2>/dev/null | \ + command sed -n -e 's|^.*PV \([^ ]*\) .*|\1|p' )" -- "$cur" ) ) } _lvm_physicalvolumes() { COMPREPLY=( $(compgen -W "$( pvscan 2>/dev/null | \ - sed -n -e 's|^.*PV \(.*\) VG.*$|\1|p' )" -- "$cur" ) ) + command sed -n -e 's|^.*PV \(.*\) VG.*$|\1|p' )" -- "$cur" ) ) } _lvm_logicalvolumes() { COMPREPLY=( $(compgen -W "$( lvscan 2>/dev/null | \ - sed -n -e "s|^.*'\(.*\)'.*$|\1|p" )" -- "$cur" ) ) + command sed -n -e "s|^.*'\(.*\)'.*$|\1|p" )" -- "$cur" ) ) if [[ $cur == /dev/mapper/* ]]; then _filedir local i for i in ${!COMPREPLY[@]}; do - [[ ${COMPREPLY[i]} == */control ]] && unset COMPREPLY[i] + [[ ${COMPREPLY[i]} == */control ]] && unset 'COMPREPLY[i]' done fi } @@ -85,18 +97,18 @@ _pvs() -o|-O|--options|--sort) COMPREPLY=( $( compgen -W 'pv_fmt pv_uuid pv_size pv_free pv_used pv_name pv_attr pv_pe_count pv_pe_alloc_count' -- "$cur" ) ) - return 0 + return ;; --units) _lvm_units - return 0 + return ;; esac if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) else - _lvm_physicalvolumes + _lvm_physicalvolumes_all fi } && complete -F _pvs pvs @@ -109,14 +121,14 @@ _pvdisplay() case $prev in --units) _lvm_units - return 0 + return ;; esac if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) else - _lvm_physicalvolumes + _lvm_physicalvolumes_all fi } && complete -F _pvdisplay pvdisplay @@ -129,14 +141,14 @@ _pvchange() case $prev in -A|-x|--autobackup|--allocatable) COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) - return 0 + return ;; esac if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) else - _lvm_physicalvolumes + _lvm_physicalvolumes_all fi } && complete -F _pvchange pvchange @@ -149,26 +161,26 @@ _pvcreate() case $prev in --restorefile) _filedir - return 0 + return ;; -M|--metadatatype) COMPREPLY=( $( compgen -W '1 2' -- "$cur" ) ) - return 0 + return ;; --metadatacopies) COMPREPLY=( $( compgen -W '0 1 2' -- "$cur" ) ) - return 0 + return ;; --metadatasize|--setphysicalvolumesize) _lvm_sizes - return 0 + return ;; esac if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) else - _lvm_physicalvolumes + _lvm_filedir fi } && complete -F _pvcreate pvcreate @@ -181,11 +193,11 @@ _pvmove() case $prev in -A|--autobackup) COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) - return 0 + return ;; -n|--name) _lvm_logicalvolumes - return 0 + return esac if [[ "$cur" == -* ]]; then @@ -206,7 +218,7 @@ _pvremove() if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) else - _lvm_physicalvolumes + _lvm_physicalvolumes_all fi } && complete -F _pvremove pvremove @@ -233,11 +245,11 @@ _vgs() vg_free vg_sysid vg_extent_size vg_extent_count vg_free_count max_lv max_pv pv_count lv_count snap_count vg_seqno' \ -- "$cur" ) ) - return 0 + return ;; --units) _lvm_units - return 0 + return ;; esac @@ -257,7 +269,7 @@ _vgdisplay() case $prev in --units) _lvm_units - return 0 + return ;; esac @@ -277,7 +289,7 @@ _vgchange() case $prev in -a|-A|-x|--available|--autobackup|--resizeable) COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) - return 0 + return ;; esac @@ -300,15 +312,15 @@ _vgcreate() case $prev in -A|--autobackup) COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) - return 0 + return ;; -M|--metadatatype) COMPREPLY=( $( compgen -W '1 2' -- "$cur" ) ) - return 0 + return ;; -s|--physicalextentsize) _lvm_sizes - return 0 + return ;; esac @@ -318,11 +330,11 @@ _vgcreate() --physicalextentsize --test --verbose --version' -- "$cur" ) ) else local args - _lvm_count_args @(-A|--autobackup|-M|--metadatatype|-s|--physicalextentsize) + _lvm_count_args '@(-A|--autobackup|-M|--metadatatype|-s|--physicalextentsize)' if [[ $args -eq 0 ]]; then _lvm_volumegroups else - _lvm_physicalvolumes + _lvm_physicalvolumes_all fi fi } && @@ -349,7 +361,7 @@ _vgrename() case $prev in -A|--autobackup) COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) - return 0 + return ;; esac @@ -369,7 +381,7 @@ _vgreduce() case $prev in -A|--autobackup) COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) - return 0 + return ;; esac @@ -378,7 +390,7 @@ _vgreduce() else local args - _lvm_count_args @(-A|--autobackup) + _lvm_count_args '@(-A|--autobackup)' if [[ $args -eq 0 ]]; then _lvm_volumegroups else @@ -396,11 +408,11 @@ _vgextend() case $prev in -A|--autobackup) COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) - return 0 + return ;; -L|--size) _lvm_sizes - return 0 + return ;; esac @@ -408,11 +420,11 @@ _vgextend() COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) else local args - _lvm_count_args @(-A|--autobackup|-L|--size) + _lvm_count_args '@(-A|--autobackup|-L|--size)' if [[ $args -eq 0 ]]; then _lvm_volumegroups else - _lvm_physicalvolumes + _lvm_physicalvolumes_all fi fi } && @@ -452,15 +464,15 @@ _vgconvert() case $prev in -M|--metadatatype) COMPREPLY=( $( compgen -W '1 2' -- "$cur" ) ) - return 0 + return ;; --metadatacopies) COMPREPLY=( $( compgen -W '0 1 2' -- "$cur" ) ) - return 0 + return ;; --metadatasize) _lvm_sizes - return 0 + return ;; esac @@ -480,7 +492,7 @@ _vgcfgbackup() case $prev in -f|--file) _filedir - return 0 + return ;; esac @@ -500,15 +512,15 @@ _vgcfgrestore() case $prev in -f|--file) _filedir - return 0 + return ;; -M|--metadatatype) COMPREPLY=( $( compgen -W '1 2' -- "$cur" ) ) - return 0 + return ;; -n|--name) _lvm_volumegroups - return 0 + return ;; esac @@ -528,7 +540,7 @@ _vgmerge() case $prev in -A|--autobackup) COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) - return 0 + return ;; esac @@ -548,11 +560,11 @@ _vgsplit() case $prev in -A|--autobackup) COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) - return 0 + return ;; -M|--metadatatype) COMPREPLY=( $( compgen -W '1 2' -- "$cur" ) ) - return 0 + return ;; esac @@ -561,7 +573,7 @@ _vgsplit() --metadatatype --test --verbose --version' -- "$cur" ) ) else local args - _lvm_count_args @(-A|--autobackup|-M|--metadatatype) + _lvm_count_args '@(-A|--autobackup|-M|--metadatatype)' if [[ $args -eq 0 || $args -eq 1 ]]; then _lvm_volumegroups else @@ -605,11 +617,11 @@ _lvs() COMPREPLY=( $( compgen -W 'lv_uuid lv_name lv_attr lv_minor lv_size seg_count origin snap_percent segtype stripes stripesize chunksize seg_start seg_size' -- "$cur" ) ) - return 0 + return ;; --units) _lvm_units - return 0 + return ;; esac @@ -629,7 +641,7 @@ _lvdisplay() case $prev in --units) _lvm_units - return 0 + return ;; esac @@ -649,11 +661,11 @@ _lvchange() case $prev in -a|-A|-C|-M|--available|--autobackup|--contiguous|--persistent) COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) - return 0 + return ;; -p|--permission) COMPREPLY=( $( compgen -W 'r rw' -- "$cur" ) ) - return 0 + return ;; esac @@ -673,19 +685,19 @@ _lvcreate() case $prev in -A|-C|-M|-Z|--autobackup|--contiguous|--persistent|--zero) COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) - return 0 + return ;; -L|--size) _lvm_sizes - return 0 + return ;; -p|--permission) COMPREPLY=( $( compgen -W 'r rw' -- "$cur" ) ) - return 0 + return ;; -n|--name) _lvm_logicalvolumes - return 0 + return ;; esac @@ -693,7 +705,7 @@ _lvcreate() COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) else local args - _lvm_count_args @(-A|-C|-M|-Z|--autobackup|--contiguous|--persistent|--zero|-L|--size|-p|--permission|-n|--name) + _lvm_count_args '@(-A|-C|-M|-Z|--autobackup|--contiguous|--persistent|--zero|-L|--size|-p|--permission|-n|--name)' if [[ $args -eq 0 ]]; then _lvm_volumegroups else @@ -711,7 +723,7 @@ _lvremove() case $prev in -A|--autobackup) COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) - return 0 + return ;; esac @@ -731,7 +743,7 @@ _lvrename() case $prev in -A|--autobackup) COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) - return 0 + return ;; esac @@ -751,11 +763,11 @@ _lvreduce() case $prev in -A|--autobackup) COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) - return 0 + return ;; -L|--size) _lvm_sizes - return 0 + return ;; esac @@ -775,11 +787,11 @@ _lvresize() case $prev in -A|--autobackup) COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) - return 0 + return ;; -L|--size) _lvm_sizes - return 0 + return ;; esac @@ -787,7 +799,7 @@ _lvresize() COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) else local args - _lvm_count_args @(-A|--autobackup|-L|--size) + _lvm_count_args '@(-A|--autobackup|-L|--size)' if [[ $args -eq 0 ]]; then _lvm_logicalvolumes else @@ -805,11 +817,11 @@ _lvextend() case $prev in -A|--autobackup) COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) ) - return 0 + return ;; -L|--size) _lvm_sizes - return 0 + return ;; esac @@ -817,7 +829,7 @@ _lvextend() COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) else local args - _lvm_count_args @(-A|--autobackup|-L|--size) + _lvm_count_args '@(-A|--autobackup|-L|--size)' if [[ $args -eq 0 ]]; then _lvm_logicalvolumes else @@ -841,118 +853,17 @@ _lvm() vgimport vgmerge vgmknodes vgreduce vgremove vgrename vgs vgscan vgsplit version' -- "$cur" ) ) else - case ${words[1]} in - pvchange) - _pvchange - ;; - pvcreate) - _pvcreate - ;; - pvdisplay) - _pvdisplay - ;; - pvmove) - _pvmove - ;; - pvremove) - _pvremove - ;; - pvresize) - _pvresize - ;; - pvs) - _pvs - ;; - pvscan) - _pvscan - ;; - vgcfgbackup) - _vgcfgbackup - ;; - vgcfgrestore) - _vgcfgrestore - ;; - vgchange) - _vgchange - ;; - vgck) - _vgck - ;; - vgconvert) - _vgconvert - ;; - vgcreate) - _vgcreate - ;; - vgdisplay) - _vgdisplay - ;; - vgexport) - _vgexport - ;; - vgextend) - _vgextend - ;; - vgimport) - _vgimport - ;; - vgmerge) - _vgmerge - ;; - vgmknodes) - _vgmknodes - ;; - vgreduce) - _vgreduce - ;; - vgremove) - _vgremove - ;; - vgrename) - _vgrename - ;; - vgs) - _vgs - ;; - vgscan) - _vgscan - ;; - vgsplit) - _vgsplit - ;; - lvchange) - _lvchange - ;; - lvcreate) - _lvcreate - ;; - lvdisplay) - _lvdisplay - ;; - lvextend) - _lvextend - ;; - lvreduce) - _lvreduce - ;; - lvremove) - _lvremove - ;; - lvrename) - _lvrename - ;; - lvresize) - _lvresize - ;; - lvs) - _lvs - ;; - lvscan) - _lvscan + case "${words[1]}" in + pvchange|pvcreate|pvdisplay|pvmove|pvremove|pvresize|pvs|pvscan|\ + vgcfgbackup|vgcfgrestore|vgchange|vgck|vgconvert|vgcreate|\ + vgdisplay|vgexport|vgextend|vgimport|vgmerge|vgmknodes|vgreduce|\ + vgremove|vgrename|vgs|vgscan|vgsplit|lvchange|lvcreate|lvdisplay|\ + lvextend|lvreduce|lvremove|lvrename|lvresize|lvscan) + _${words[1]} ;; esac fi } && complete -F _lvm lvm -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/lz4 b/completions/lz4 new file mode 100644 index 00000000..56602ca2 --- /dev/null +++ b/completions/lz4 @@ -0,0 +1,53 @@ +# lz4 completion -*- shell-script -*- + +_lz4() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -b) + _filedir + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W \ + '$( _parse_help "$1" -h | command sed -e "/#/d" ) -B{4..7} -i{1..9}' \ + -- "$cur" ) ) + return + fi + + local args word xspec="*.?(t)lz4" + _count_args + [[ $args -gt 2 ]] && return + + for word in ${words[@]}; do + case $word in + -*[dt]*) + case $args in + 1) xspec="!"$xspec ;; + 2) [[ $word == *t* ]] && return + esac + break + ;; + -z) + case $args in + 1) xspec= ;; + 2) xspec="!"$xspec ;; + esac + break + ;; + esac + done + + _expand || return + local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \ + $( compgen -d -- "$cur" ) ) +} && +complete -F _lz4 lz4 lz4c + +# ex: filetype=sh diff --git a/completions/lzip b/completions/lzip index ae35b9d4..c1aab4a8 100644 --- a/completions/lzip +++ b/completions/lzip @@ -46,4 +46,4 @@ _lzip() } && complete -F _lzip clzip lzip pdlzip plzip -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/lzma b/completions/lzma index 30566ed0..74dac25c 100644 --- a/completions/lzma +++ b/completions/lzma @@ -11,22 +11,20 @@ _lzma() --help --decompress --compress --keep --force --suffix --test --stdout --quiet --verbose --license --list --version --small --fast --best --text' -- "$cur" ) ) - return 0 + return fi local IFS=$'\n' xspec="*.@(lzma|tlz)" if [[ "$prev" == --* ]]; then - [[ "$prev" == --decompress || \ - "$prev" == --list || \ - "$prev" == --test ]] && xspec="!"$xspec + [[ "$prev" == --@(decompress|list|test) ]] && xspec="!"$xspec [[ "$prev" == --compress ]] && xspec= elif [[ "$prev" == -* ]]; then [[ "$prev" == -*[dt]* ]] && xspec="!"$xspec [[ "$prev" == -*z* ]] && xspec= fi - _expand || return 0 + _expand || return compopt -o filenames COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \ @@ -34,4 +32,4 @@ _lzma() } && complete -F _lzma lzma -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/lzop b/completions/lzop index e23d5410..f6753529 100644 --- a/completions/lzop +++ b/completions/lzop @@ -8,14 +8,14 @@ _lzop() case $prev in -o|--output) _filedir - return 0 + return ;; --path) _filedir -d - return 0 + return ;; -S|--suffix) - return 0 + return ;; esac @@ -27,7 +27,7 @@ _lzop() --keep --delete --crc32 --no-warn --ignore-warn --quiet --verbose --no-stdin --filter --checksum --no-color --mono --color' \ -- "$cur" ) ) - return 0 + return fi local xspec="*.?(t)lzo" @@ -48,7 +48,7 @@ _lzop() ;; esac - _expand || return 0 + _expand || return local IFS=$'\n' compopt -o filenames @@ -57,4 +57,4 @@ _lzop() } && complete -F _lzop lzop -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/macof b/completions/macof index 264f1c9d..dacae2fd 100644 --- a/completions/macof +++ b/completions/macof @@ -8,7 +8,7 @@ _macof() case $prev in -i) _available_interfaces -a - return 0 + return ;; esac @@ -20,4 +20,4 @@ _macof() } && complete -F _macof macof -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/mailmanctl b/completions/mailmanctl index 5e6ed2ee..717df7b9 100644 --- a/completions/mailmanctl +++ b/completions/mailmanctl @@ -15,4 +15,4 @@ _mailmanctl() } && complete -F _mailmanctl mailmanctl -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/completions/make b/completions/make index b4ad9e73..1075b37a 100644 --- a/completions/make +++ b/completions/make @@ -1,13 +1,12 @@ # bash completion for GNU make -*- shell-script -*- -function _make_target_extract_script() +_make_target_extract_script() { local mode="$1" shift local prefix="$1" - local prefix_pat=$( printf "%s\n" "$prefix" | \ - sed 's/[][\,.*^$(){}?+|/]/\\&/g' ) + local prefix_pat=$( command sed 's/[][\,.*^$(){}?+|/]/\\&/g' <<<"$prefix" ) local basename=${prefix##*/} local dirname_len=$(( ${#prefix} - ${#basename} )) @@ -20,51 +19,63 @@ function _make_target_extract_script() fi cat <