From 0bc58b66a4850cdb8458a86c3d9a2fc81de82aa3 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 28 Apr 2024 11:14:42 +0200 Subject: Adding upstream version 1:2.11. Signed-off-by: Daniel Baumann --- completions/.gitignore | 235 ++++++++++ completions/2to3 | 39 ++ completions/7z | 128 +++++ completions/Makefile.am | 950 ++++++++++++++++++++++++++++++++++++++ completions/_adb | 69 +++ completions/_cal | 38 ++ completions/_chfn | 8 + completions/_chsh | 31 ++ completions/_dmesg | 33 ++ completions/_eject | 33 ++ completions/_hexdump | 31 ++ completions/_hwclock | 26 ++ completions/_ionice | 60 +++ completions/_look | 17 + completions/_mock | 69 +++ completions/_modules | 85 ++++ completions/_mount | 65 +++ completions/_mount.linux | 252 ++++++++++ completions/_newgrp | 19 + completions/_nmcli | 201 ++++++++ completions/_renice | 32 ++ completions/_repomanage | 24 + completions/_reptyr | 26 ++ completions/_rfkill | 31 ++ completions/_rtcwake | 32 ++ completions/_runuser | 8 + completions/_su | 41 ++ completions/_svn | 210 +++++++++ completions/_svnadmin | 78 ++++ completions/_svnlook | 63 +++ completions/_udevadm | 77 +++ completions/_umount | 24 + completions/_umount.linux | 145 ++++++ completions/_write | 8 + completions/_xm | 224 +++++++++ completions/_yum | 144 ++++++ completions/a2x | 39 ++ completions/abook | 49 ++ completions/aclocal | 35 ++ completions/acpi | 22 + completions/add_members | 31 ++ completions/alias | 20 + completions/ant | 102 ++++ completions/apache2ctl | 16 + completions/appdata-validate | 32 ++ completions/apt-build | 54 +++ completions/apt-cache | 85 ++++ completions/apt-get | 104 +++++ completions/aptitude | 119 +++++ completions/arch | 46 ++ completions/arp | 59 +++ completions/arping | 31 ++ completions/arpspoof | 28 ++ completions/asciidoc | 52 +++ completions/aspell | 88 ++++ completions/autoconf | 40 ++ completions/automake | 36 ++ completions/autoreconf | 41 ++ completions/autorpm | 14 + completions/autoscan | 34 ++ completions/avctrl | 20 + completions/badblocks | 29 ++ completions/bind | 36 ++ completions/bk | 18 + completions/brctl | 40 ++ completions/btdownloadheadless.py | 32 ++ completions/bts | 112 +++++ completions/bzip2 | 42 ++ completions/cancel | 27 ++ completions/cardctl | 15 + completions/carton | 81 ++++ completions/ccache | 38 ++ completions/ccze | 44 ++ completions/cfagent | 21 + completions/cfrun | 47 ++ completions/chage | 30 ++ completions/change_pw | 25 + completions/check_db | 17 + completions/check_perms | 15 + completions/checksec | 37 ++ completions/chgrp | 39 ++ completions/chkconfig | 37 ++ completions/chmod | 41 ++ completions/chown | 46 ++ completions/chpasswd | 30 ++ completions/chromium-browser | 50 ++ completions/chronyc | 61 +++ completions/chrpath | 27 ++ completions/cksfv | 29 ++ completions/cleanarch | 16 + completions/clisp | 22 + completions/clone_member | 25 + completions/complete | 49 ++ completions/config_list | 27 ++ completions/configure | 42 ++ completions/convert | 324 +++++++++++++ completions/cowsay | 23 + completions/cpan2dist | 37 ++ completions/cpio | 78 ++++ completions/cppcheck | 91 ++++ completions/crontab | 48 ++ completions/cryptsetup | 103 +++++ completions/curl | 99 ++++ completions/cvs | 398 ++++++++++++++++ completions/cvsps | 58 +++ completions/dd | 42 ++ completions/deja-dup | 32 ++ completions/desktop-file-validate | 23 + completions/dhclient | 34 ++ completions/dict | 64 +++ completions/dmypy | 48 ++ completions/dnssec-keygen | 48 ++ completions/dnsspoof | 26 ++ completions/dot | 45 ++ completions/dpkg | 126 +++++ completions/dpkg-source | 98 ++++ completions/dselect | 29 ++ completions/dsniff | 26 ++ completions/dumpdb | 18 + completions/dumpe2fs | 28 ++ completions/e2freefrag | 24 + completions/e2label | 15 + completions/ebtables | 78 ++++ completions/ecryptfs-migrate-home | 22 + completions/eog | 26 ++ completions/ether-wake | 27 ++ completions/evince | 32 ++ completions/explodepkg | 5 + completions/export | 65 +++ completions/faillog | 27 ++ completions/fbgs | 50 ++ completions/fbi | 54 +++ completions/feh | 120 +++++ completions/file | 32 ++ completions/file-roller | 42 ++ completions/filefrag | 17 + completions/filesnarf | 22 + completions/find | 113 +++++ completions/find_member | 25 + completions/fio | 90 ++++ completions/firefox | 46 ++ completions/flake8 | 42 ++ completions/freebsd-update | 29 ++ completions/freeciv | 41 ++ completions/freeciv-server | 22 + completions/function | 37 ++ completions/fusermount | 28 ++ completions/gcc | 75 +++ completions/gcl | 21 + completions/gdb | 47 ++ completions/genaliases | 15 + completions/gendiff | 12 + completions/genisoimage | 38 ++ completions/geoiplookup | 33 ++ completions/getconf | 32 ++ completions/getent | 77 +++ completions/gkrellm | 39 ++ completions/gm | 40 ++ completions/gnatmake | 26 ++ completions/gnokii | 237 ++++++++++ completions/gnome-mplayer | 38 ++ completions/gnome-screenshot | 31 ++ completions/gpasswd | 25 + completions/gpg | 38 ++ completions/gpg2 | 42 ++ completions/gpgv | 46 ++ completions/gphoto2 | 55 +++ completions/gprof | 56 +++ completions/groupadd | 26 ++ completions/groupdel | 27 ++ completions/groupmems | 27 ++ completions/groupmod | 29 ++ completions/growisofs | 39 ++ completions/grpck | 25 + completions/gssdp-discover | 34 ++ completions/gzip | 43 ++ completions/hcitool | 380 +++++++++++++++ completions/hddtemp | 38 ++ completions/hid2hci | 15 + completions/hostname | 23 + completions/hping2 | 35 ++ completions/htop | 33 ++ completions/htpasswd | 36 ++ completions/hunspell | 43 ++ completions/iconv | 38 ++ completions/id | 18 + completions/idn | 26 ++ completions/ifstat | 68 +++ completions/iftop | 26 ++ completions/ifup | 39 ++ completions/influx | 35 ++ completions/info | 74 +++ completions/inject | 26 ++ completions/inotifywait | 47 ++ completions/insmod | 18 + completions/installpkg | 33 ++ completions/interdiff | 33 ++ completions/invoke-rc.d | 38 ++ completions/ip | 378 +++++++++++++++ completions/ipcalc | 25 + completions/iperf | 69 +++ completions/ipmitool | 199 ++++++++ completions/ipsec | 102 ++++ completions/iptables | 51 ++ completions/ipv6calc | 38 ++ completions/iscsiadm | 66 +++ completions/isort | 41 ++ completions/isql | 14 + completions/iwconfig | 90 ++++ completions/iwlist | 22 + completions/iwpriv | 31 ++ completions/iwspy | 20 + completions/jar | 27 ++ completions/jarsigner | 57 +++ completions/java | 333 +++++++++++++ completions/javaws | 34 ++ completions/jpegoptim | 38 ++ completions/jps | 25 + completions/jq | 54 +++ completions/jshint | 38 ++ completions/json_xs | 31 ++ completions/jsonschema | 30 ++ completions/k3b | 48 ++ completions/kcov | 64 +++ completions/kill | 29 ++ completions/killall | 36 ++ completions/kldload | 21 + completions/kldunload | 15 + completions/koji | 245 ++++++++++ completions/ktutil | 120 +++++ completions/larch | 39 ++ completions/lastlog | 25 + completions/ldapsearch | 231 +++++++++ completions/ldapvi | 51 ++ completions/lftp | 28 ++ completions/lftpget | 14 + completions/lilo | 66 +++ completions/links | 100 ++++ completions/lintian | 176 +++++++ completions/lisp | 22 + completions/list_admins | 17 + completions/list_lists | 21 + completions/list_members | 36 ++ completions/list_owners | 18 + completions/locale-gen | 32 ++ completions/lpq | 28 ++ completions/lpr | 33 ++ completions/lrzip | 52 +++ completions/lsof | 56 +++ completions/lspci | 41 ++ completions/lsscsi | 27 ++ completions/lsusb | 20 + completions/lua | 23 + completions/luac | 27 ++ completions/luseradd | 40 ++ completions/luserdel | 23 + completions/lvm | 861 ++++++++++++++++++++++++++++++++++ completions/lz4 | 52 +++ completions/lzip | 47 ++ completions/lzma | 34 ++ completions/lzop | 59 +++ completions/macof | 22 + completions/mailmanctl | 18 + completions/make | 170 +++++++ completions/makepkg | 48 ++ completions/man | 101 ++++ completions/mc | 29 ++ completions/mcrypt | 67 +++ completions/mdadm | 149 ++++++ completions/mdtool | 62 +++ completions/medusa | 30 ++ completions/mii-diag | 26 ++ completions/mii-tool | 32 ++ completions/minicom | 40 ++ completions/mkinitrd | 50 ++ completions/mktemp | 29 ++ completions/mmsitepass | 15 + completions/modinfo | 47 ++ completions/modprobe | 123 +++++ completions/monodevelop | 19 + completions/mplayer | 287 ++++++++++++ completions/mr | 91 ++++ completions/msynctool | 42 ++ completions/mtx | 44 ++ completions/munin-node-configure | 33 ++ completions/munin-run | 28 ++ completions/munin-update | 27 ++ completions/munindoc | 13 + completions/mussh | 52 +++ completions/mutt | 160 +++++++ completions/mypy | 57 +++ completions/mysql | 99 ++++ completions/mysqladmin | 63 +++ completions/nc | 51 ++ completions/ncftp | 27 ++ completions/nethogs | 26 ++ completions/newlist | 25 + completions/newusers | 30 ++ completions/ngrep | 38 ++ completions/nmap | 56 +++ completions/nproc | 23 + completions/nslookup | 86 ++++ completions/nsupdate | 40 ++ completions/ntpdate | 35 ++ completions/oggdec | 38 ++ completions/op | 59 +++ completions/openssl | 138 ++++++ completions/opera | 47 ++ completions/optipng | 52 +++ completions/p4 | 51 ++ completions/pack200 | 74 +++ completions/passwd | 24 + completions/patch | 70 +++ completions/pdftotext | 39 ++ completions/perl | 146 ++++++ completions/perlcritic | 51 ++ completions/perltidy | 55 +++ completions/pgrep | 62 +++ completions/pidof | 27 ++ completions/pine | 32 ++ completions/ping | 71 +++ completions/pkg-config | 45 ++ completions/pkg-get | 72 +++ completions/pkg_delete | 18 + completions/pkgadd | 62 +++ completions/pkgrm | 46 ++ completions/pkgtool | 35 ++ completions/pkgutil | 95 ++++ completions/plague-client | 14 + completions/pm-hibernate | 12 + completions/pm-is-supported | 13 + completions/pm-powersave | 12 + completions/pngfix | 36 ++ completions/portinstall | 31 ++ completions/portsnap | 25 + completions/portupgrade | 19 + completions/postcat | 39 ++ completions/postconf | 39 ++ completions/postfix | 33 ++ completions/postmap | 41 ++ completions/postsuper | 56 +++ completions/povray | 64 +++ completions/prelink | 42 ++ completions/printenv | 23 + completions/protoc | 63 +++ completions/psql | 188 ++++++++ completions/puppet | 338 ++++++++++++++ completions/pv | 31 ++ completions/pwck | 18 + completions/pwd | 20 + completions/pwdx | 24 + completions/pwgen | 28 ++ completions/pycodestyle | 34 ++ completions/pydoc | 42 ++ completions/pydocstyle | 35 ++ completions/pyflakes | 23 + completions/pylint | 87 ++++ completions/pytest | 134 ++++++ completions/python | 67 +++ completions/pyvenv | 25 + completions/qdbus | 14 + completions/qemu | 108 +++++ completions/qrunner | 18 + completions/querybts | 40 ++ completions/quota | 191 ++++++++ completions/radvdump | 22 + completions/rcs | 36 ++ completions/rdesktop | 57 +++ completions/remove_members | 27 ++ completions/removepkg | 25 + completions/reportbug | 96 ++++ completions/resolvconf | 21 + completions/ri | 120 +++++ completions/rmlist | 17 + completions/rmmod | 24 + completions/route | 30 ++ completions/rpcdebug | 46 ++ completions/rpm | 302 ++++++++++++ completions/rpm2tgz | 17 + completions/rpmcheck | 24 + completions/rrdtool | 17 + completions/rsync | 86 ++++ completions/sbcl | 21 + completions/sbopkg | 73 +++ completions/screen | 123 +++++ completions/scrub | 36 ++ completions/secret-tool | 50 ++ completions/sh | 36 ++ completions/shellcheck | 63 +++ completions/sitecopy | 50 ++ completions/slackpkg | 112 +++++ completions/slapt-get | 86 ++++ completions/slapt-src | 68 +++ completions/smartctl | 165 +++++++ completions/smbclient | 322 +++++++++++++ completions/snownews | 15 + completions/sqlite3 | 38 ++ completions/ss | 41 ++ completions/ssh | 563 ++++++++++++++++++++++ completions/ssh-add | 35 ++ completions/ssh-copy-id | 32 ++ completions/ssh-keygen | 123 +++++ completions/sshfs | 23 + completions/sshmitm | 17 + completions/sshow | 26 ++ completions/strace | 99 ++++ completions/strings | 45 ++ completions/sudo | 56 +++ completions/svcadm | 150 ++++++ completions/svk | 214 +++++++++ completions/sync_members | 31 ++ completions/synclient | 24 + completions/sysbench | 132 ++++++ completions/sysctl | 31 ++ completions/tar | 711 ++++++++++++++++++++++++++++ completions/tcpdump | 64 +++ completions/tcpkill | 22 + completions/tcpnice | 22 + completions/timeout | 39 ++ completions/tipc | 289 ++++++++++++ completions/tox | 51 ++ completions/tracepath | 26 ++ completions/tshark | 136 ++++++ completions/tsig-keygen | 28 ++ completions/tune2fs | 61 +++ completions/ulimit | 42 ++ completions/unace | 20 + completions/unpack200 | 48 ++ completions/unrar | 23 + completions/unshunt | 17 + completions/update-alternatives | 92 ++++ completions/update-rc.d | 58 +++ completions/upgradepkg | 30 ++ completions/urlsnarf | 26 ++ completions/uscan | 33 ++ completions/useradd | 46 ++ completions/userdel | 27 ++ completions/usermod | 51 ++ completions/valgrind | 111 +++++ completions/vipw | 22 + completions/vmstat | 27 ++ completions/vncviewer | 99 ++++ completions/vpnc | 82 ++++ completions/watch | 54 +++ completions/webmitm | 17 + completions/wget | 174 +++++++ completions/wine | 20 + completions/withlist | 18 + completions/wodim | 96 ++++ completions/wol | 42 ++ completions/wsimport | 48 ++ completions/wtf | 42 ++ completions/wvdial | 46 ++ completions/xdg-mime | 74 +++ completions/xdg-settings | 31 ++ completions/xfreerdp | 67 +++ completions/xgamma | 61 +++ completions/xhost | 16 + completions/xmllint | 53 +++ completions/xmlwf | 32 ++ completions/xmms | 29 ++ completions/xmodmap | 23 + completions/xrandr | 63 +++ completions/xrdb | 27 ++ completions/xsltproc | 49 ++ completions/xvfb-run | 36 ++ completions/xxd | 23 + completions/xz | 56 +++ completions/xzdec | 29 ++ completions/ypmatch | 26 ++ completions/yum-arch | 16 + completions/zopfli | 29 ++ completions/zopflipng | 39 ++ 473 files changed, 29614 insertions(+) create mode 100644 completions/.gitignore create mode 100644 completions/2to3 create mode 100644 completions/7z create mode 100644 completions/Makefile.am create mode 100644 completions/_adb 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/_mock create mode 100644 completions/_modules create mode 100644 completions/_mount create mode 100644 completions/_mount.linux 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/_rfkill create mode 100644 completions/_rtcwake create mode 100644 completions/_runuser create mode 100644 completions/_su create mode 100644 completions/_svn create mode 100644 completions/_svnadmin create mode 100644 completions/_svnlook create mode 100644 completions/_udevadm create mode 100644 completions/_umount create mode 100644 completions/_umount.linux create mode 100644 completions/_write create mode 100644 completions/_xm create mode 100644 completions/_yum create mode 100644 completions/a2x create mode 100644 completions/abook create mode 100644 completions/aclocal create mode 100644 completions/acpi create mode 100644 completions/add_members create mode 100644 completions/alias create mode 100644 completions/ant create mode 100644 completions/apache2ctl create mode 100644 completions/appdata-validate create mode 100644 completions/apt-build create mode 100644 completions/apt-cache create mode 100644 completions/apt-get create mode 100644 completions/aptitude create mode 100644 completions/arch create mode 100644 completions/arp create mode 100644 completions/arping create mode 100644 completions/arpspoof create mode 100644 completions/asciidoc create mode 100644 completions/aspell create mode 100644 completions/autoconf create mode 100644 completions/automake create mode 100644 completions/autoreconf create mode 100644 completions/autorpm create mode 100644 completions/autoscan create mode 100644 completions/avctrl create mode 100644 completions/badblocks create mode 100644 completions/bind create mode 100644 completions/bk create mode 100644 completions/brctl create mode 100644 completions/btdownloadheadless.py create mode 100644 completions/bts create mode 100644 completions/bzip2 create mode 100644 completions/cancel create mode 100644 completions/cardctl create mode 100644 completions/carton create mode 100644 completions/ccache create mode 100644 completions/ccze create mode 100644 completions/cfagent create mode 100644 completions/cfrun create mode 100644 completions/chage create mode 100644 completions/change_pw create mode 100644 completions/check_db create mode 100644 completions/check_perms create mode 100644 completions/checksec create mode 100644 completions/chgrp create mode 100644 completions/chkconfig create mode 100644 completions/chmod create mode 100644 completions/chown create mode 100644 completions/chpasswd create mode 100644 completions/chromium-browser create mode 100644 completions/chronyc create mode 100644 completions/chrpath create mode 100644 completions/cksfv create mode 100644 completions/cleanarch create mode 100644 completions/clisp create mode 100644 completions/clone_member create mode 100644 completions/complete create mode 100644 completions/config_list create mode 100644 completions/configure create mode 100644 completions/convert create mode 100644 completions/cowsay create mode 100644 completions/cpan2dist create mode 100644 completions/cpio create mode 100644 completions/cppcheck create mode 100644 completions/crontab create mode 100644 completions/cryptsetup create mode 100644 completions/curl create mode 100644 completions/cvs create mode 100644 completions/cvsps create mode 100644 completions/dd create mode 100644 completions/deja-dup create mode 100644 completions/desktop-file-validate create mode 100644 completions/dhclient create mode 100644 completions/dict create mode 100644 completions/dmypy create mode 100644 completions/dnssec-keygen create mode 100644 completions/dnsspoof create mode 100644 completions/dot create mode 100644 completions/dpkg create mode 100644 completions/dpkg-source create mode 100644 completions/dselect create mode 100644 completions/dsniff create mode 100644 completions/dumpdb create mode 100644 completions/dumpe2fs create mode 100644 completions/e2freefrag create mode 100644 completions/e2label create mode 100644 completions/ebtables create mode 100644 completions/ecryptfs-migrate-home create mode 100644 completions/eog create mode 100644 completions/ether-wake create mode 100644 completions/evince create mode 100644 completions/explodepkg create mode 100644 completions/export create mode 100644 completions/faillog create mode 100644 completions/fbgs create mode 100644 completions/fbi create mode 100644 completions/feh create mode 100644 completions/file create mode 100644 completions/file-roller create mode 100644 completions/filefrag create mode 100644 completions/filesnarf create mode 100644 completions/find create mode 100644 completions/find_member create mode 100644 completions/fio create mode 100644 completions/firefox create mode 100644 completions/flake8 create mode 100644 completions/freebsd-update create mode 100644 completions/freeciv create mode 100644 completions/freeciv-server create mode 100644 completions/function create mode 100644 completions/fusermount create mode 100644 completions/gcc create mode 100644 completions/gcl create mode 100644 completions/gdb create mode 100644 completions/genaliases create mode 100644 completions/gendiff create mode 100644 completions/genisoimage create mode 100644 completions/geoiplookup create mode 100644 completions/getconf create mode 100644 completions/getent create mode 100644 completions/gkrellm create mode 100644 completions/gm create mode 100644 completions/gnatmake create mode 100644 completions/gnokii create mode 100644 completions/gnome-mplayer create mode 100644 completions/gnome-screenshot create mode 100644 completions/gpasswd create mode 100644 completions/gpg create mode 100644 completions/gpg2 create mode 100644 completions/gpgv create mode 100644 completions/gphoto2 create mode 100644 completions/gprof create mode 100644 completions/groupadd create mode 100644 completions/groupdel create mode 100644 completions/groupmems create mode 100644 completions/groupmod create mode 100644 completions/growisofs create mode 100644 completions/grpck create mode 100644 completions/gssdp-discover create mode 100644 completions/gzip create mode 100644 completions/hcitool create mode 100644 completions/hddtemp create mode 100644 completions/hid2hci create mode 100644 completions/hostname create mode 100644 completions/hping2 create mode 100644 completions/htop create mode 100644 completions/htpasswd create mode 100644 completions/hunspell create mode 100644 completions/iconv create mode 100644 completions/id create mode 100644 completions/idn create mode 100644 completions/ifstat create mode 100644 completions/iftop create mode 100644 completions/ifup create mode 100644 completions/influx create mode 100644 completions/info create mode 100644 completions/inject create mode 100644 completions/inotifywait create mode 100644 completions/insmod create mode 100644 completions/installpkg create mode 100644 completions/interdiff create mode 100644 completions/invoke-rc.d create mode 100644 completions/ip create mode 100644 completions/ipcalc create mode 100644 completions/iperf create mode 100644 completions/ipmitool create mode 100644 completions/ipsec create mode 100644 completions/iptables create mode 100644 completions/ipv6calc create mode 100644 completions/iscsiadm create mode 100644 completions/isort create mode 100644 completions/isql create mode 100644 completions/iwconfig create mode 100644 completions/iwlist create mode 100644 completions/iwpriv create mode 100644 completions/iwspy create mode 100644 completions/jar create mode 100644 completions/jarsigner create mode 100644 completions/java create mode 100644 completions/javaws create mode 100644 completions/jpegoptim create mode 100644 completions/jps create mode 100644 completions/jq create mode 100644 completions/jshint create mode 100644 completions/json_xs create mode 100644 completions/jsonschema create mode 100644 completions/k3b create mode 100644 completions/kcov create mode 100644 completions/kill create mode 100644 completions/killall create mode 100644 completions/kldload create mode 100644 completions/kldunload create mode 100644 completions/koji create mode 100644 completions/ktutil create mode 100644 completions/larch create mode 100644 completions/lastlog create mode 100644 completions/ldapsearch create mode 100644 completions/ldapvi create mode 100644 completions/lftp create mode 100644 completions/lftpget create mode 100644 completions/lilo create mode 100644 completions/links create mode 100644 completions/lintian create mode 100644 completions/lisp create mode 100644 completions/list_admins create mode 100644 completions/list_lists create mode 100644 completions/list_members create mode 100644 completions/list_owners create mode 100644 completions/locale-gen create mode 100644 completions/lpq create mode 100644 completions/lpr create mode 100644 completions/lrzip create mode 100644 completions/lsof create mode 100644 completions/lspci create mode 100644 completions/lsscsi create mode 100644 completions/lsusb create mode 100644 completions/lua create mode 100644 completions/luac create mode 100644 completions/luseradd create mode 100644 completions/luserdel create mode 100644 completions/lvm create mode 100644 completions/lz4 create mode 100644 completions/lzip create mode 100644 completions/lzma create mode 100644 completions/lzop create mode 100644 completions/macof create mode 100644 completions/mailmanctl create mode 100644 completions/make create mode 100644 completions/makepkg create mode 100644 completions/man create mode 100644 completions/mc create mode 100644 completions/mcrypt create mode 100644 completions/mdadm create mode 100644 completions/mdtool create mode 100644 completions/medusa create mode 100644 completions/mii-diag create mode 100644 completions/mii-tool create mode 100644 completions/minicom create mode 100644 completions/mkinitrd create mode 100644 completions/mktemp create mode 100644 completions/mmsitepass create mode 100644 completions/modinfo create mode 100644 completions/modprobe create mode 100644 completions/monodevelop create mode 100644 completions/mplayer create mode 100644 completions/mr create mode 100644 completions/msynctool create mode 100644 completions/mtx create mode 100644 completions/munin-node-configure create mode 100644 completions/munin-run create mode 100644 completions/munin-update create mode 100644 completions/munindoc create mode 100644 completions/mussh create mode 100644 completions/mutt create mode 100644 completions/mypy create mode 100644 completions/mysql create mode 100644 completions/mysqladmin create mode 100644 completions/nc create mode 100644 completions/ncftp create mode 100644 completions/nethogs create mode 100644 completions/newlist create mode 100644 completions/newusers create mode 100644 completions/ngrep create mode 100644 completions/nmap create mode 100644 completions/nproc create mode 100644 completions/nslookup create mode 100644 completions/nsupdate create mode 100644 completions/ntpdate create mode 100644 completions/oggdec create mode 100644 completions/op create mode 100644 completions/openssl create mode 100644 completions/opera create mode 100644 completions/optipng create mode 100644 completions/p4 create mode 100644 completions/pack200 create mode 100644 completions/passwd create mode 100644 completions/patch create mode 100644 completions/pdftotext create mode 100644 completions/perl create mode 100644 completions/perlcritic create mode 100644 completions/perltidy create mode 100644 completions/pgrep create mode 100644 completions/pidof create mode 100644 completions/pine create mode 100644 completions/ping create mode 100644 completions/pkg-config create mode 100644 completions/pkg-get create mode 100644 completions/pkg_delete create mode 100644 completions/pkgadd create mode 100644 completions/pkgrm create mode 100644 completions/pkgtool create mode 100644 completions/pkgutil create mode 100644 completions/plague-client create mode 100644 completions/pm-hibernate create mode 100644 completions/pm-is-supported create mode 100644 completions/pm-powersave create mode 100644 completions/pngfix create mode 100644 completions/portinstall create mode 100644 completions/portsnap create mode 100644 completions/portupgrade create mode 100644 completions/postcat create mode 100644 completions/postconf create mode 100644 completions/postfix create mode 100644 completions/postmap create mode 100644 completions/postsuper create mode 100644 completions/povray create mode 100644 completions/prelink create mode 100644 completions/printenv create mode 100644 completions/protoc create mode 100644 completions/psql create mode 100644 completions/puppet create mode 100644 completions/pv create mode 100644 completions/pwck create mode 100644 completions/pwd create mode 100644 completions/pwdx create mode 100644 completions/pwgen create mode 100644 completions/pycodestyle create mode 100644 completions/pydoc create mode 100644 completions/pydocstyle create mode 100644 completions/pyflakes create mode 100644 completions/pylint create mode 100644 completions/pytest create mode 100644 completions/python create mode 100644 completions/pyvenv create mode 100644 completions/qdbus create mode 100644 completions/qemu create mode 100644 completions/qrunner create mode 100644 completions/querybts create mode 100644 completions/quota create mode 100644 completions/radvdump create mode 100644 completions/rcs create mode 100644 completions/rdesktop create mode 100644 completions/remove_members create mode 100644 completions/removepkg create mode 100644 completions/reportbug create mode 100644 completions/resolvconf create mode 100644 completions/ri create mode 100644 completions/rmlist create mode 100644 completions/rmmod create mode 100644 completions/route create mode 100644 completions/rpcdebug create mode 100644 completions/rpm create mode 100644 completions/rpm2tgz create mode 100644 completions/rpmcheck create mode 100644 completions/rrdtool create mode 100644 completions/rsync create mode 100644 completions/sbcl create mode 100644 completions/sbopkg create mode 100644 completions/screen create mode 100644 completions/scrub create mode 100644 completions/secret-tool create mode 100644 completions/sh create mode 100644 completions/shellcheck create mode 100644 completions/sitecopy create mode 100644 completions/slackpkg create mode 100644 completions/slapt-get create mode 100644 completions/slapt-src create mode 100644 completions/smartctl create mode 100644 completions/smbclient create mode 100644 completions/snownews create mode 100644 completions/sqlite3 create mode 100644 completions/ss create mode 100644 completions/ssh create mode 100644 completions/ssh-add create mode 100644 completions/ssh-copy-id create mode 100644 completions/ssh-keygen create mode 100644 completions/sshfs create mode 100644 completions/sshmitm create mode 100644 completions/sshow create mode 100644 completions/strace create mode 100644 completions/strings create mode 100644 completions/sudo create mode 100644 completions/svcadm create mode 100644 completions/svk create mode 100644 completions/sync_members create mode 100644 completions/synclient create mode 100644 completions/sysbench create mode 100644 completions/sysctl create mode 100644 completions/tar create mode 100644 completions/tcpdump create mode 100644 completions/tcpkill create mode 100644 completions/tcpnice create mode 100644 completions/timeout create mode 100644 completions/tipc create mode 100644 completions/tox create mode 100644 completions/tracepath create mode 100644 completions/tshark create mode 100644 completions/tsig-keygen create mode 100644 completions/tune2fs create mode 100644 completions/ulimit create mode 100644 completions/unace create mode 100644 completions/unpack200 create mode 100644 completions/unrar create mode 100644 completions/unshunt create mode 100644 completions/update-alternatives create mode 100644 completions/update-rc.d create mode 100644 completions/upgradepkg create mode 100644 completions/urlsnarf create mode 100644 completions/uscan create mode 100644 completions/useradd create mode 100644 completions/userdel create mode 100644 completions/usermod create mode 100644 completions/valgrind create mode 100644 completions/vipw create mode 100644 completions/vmstat create mode 100644 completions/vncviewer create mode 100644 completions/vpnc create mode 100644 completions/watch create mode 100644 completions/webmitm create mode 100644 completions/wget create mode 100644 completions/wine create mode 100644 completions/withlist create mode 100644 completions/wodim create mode 100644 completions/wol create mode 100644 completions/wsimport create mode 100644 completions/wtf create mode 100644 completions/wvdial create mode 100644 completions/xdg-mime create mode 100644 completions/xdg-settings create mode 100644 completions/xfreerdp create mode 100644 completions/xgamma create mode 100644 completions/xhost create mode 100644 completions/xmllint create mode 100644 completions/xmlwf create mode 100644 completions/xmms create mode 100644 completions/xmodmap create mode 100644 completions/xrandr create mode 100644 completions/xrdb create mode 100644 completions/xsltproc create mode 100644 completions/xvfb-run create mode 100644 completions/xxd create mode 100644 completions/xz create mode 100644 completions/xzdec create mode 100644 completions/ypmatch create mode 100644 completions/yum-arch create mode 100644 completions/zopfli create mode 100644 completions/zopflipng (limited to 'completions') diff --git a/completions/.gitignore b/completions/.gitignore new file mode 100644 index 0000000..5edc172 --- /dev/null +++ b/completions/.gitignore @@ -0,0 +1,235 @@ +7za +aclocal-1.1[0123456] +alpine +alternatives +animate +apropos +aptitude-curses +arm-koji +asciidoc.py +autoheader +automake-1.1[0123456] +autossh +autoupdate +bmake +bsdtar +btdownloadcurses.py +btdownloadgui.py +c++ +cc +cdrecord +chrome +chromium +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 +etherwake +f77 +f95 +filebucket +freeciv-gtk2 +freeciv-gtk3 +freeciv-sdl +freeciv-xaw +g++ +g++-[5678] +g4 +g77 +g95 +gcc-[5678] +gccgo +gccgo-[5678] +gcj +geoiplookup6 +gfortran +gfortran-[5678] +gkrellm2 +gmake +gmplayer +gnumake +google-chrome +google-chrome-stable +gpc +gpgv2 +gtar +hciattach +hciconfig +hd +host +hping +hping3 +iceweasel +identify +ifdown +ifquery +ifstatus +import +inotifywatch +insmod.static +iperf3 +javac +javadoc +kplayer +l2ping +lbzip2 +ldapadd +ldapcompare +ldapdelete +ldapmodify +ldapmodrdn +ldappasswd +ldapwhoami +links2 +lintian-info +lusermod +lvchange +lvcreate +lvdisplay +lvextend +lvmdiskscan +lvreduce +lvremove +lvrename +lvresize +lvs +lvscan +lz4c +mailsnarf +mdecrypt +mencoder +micropython +mkisofs +mogrify +montage +mozilla-firefox +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 +py.test-[23] +pydoc3 +pylint-[23] +pytest-[23] +python2 +python2.7 +python3 +python3.[345678] +pypy +pypy3 +pyvenv-3.[45678] +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 +wine-development +wine-stable +xpovray +xvnc4viewer +ypcat diff --git a/completions/2to3 b/completions/2to3 new file mode 100644 index 0000000..7c5b330 --- /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 0000000..a8acbc5 --- /dev/null +++ b/completions/7z @@ -0,0 +1,128 @@ +# 7z(1) completion -*- shell-script -*- + +_7z() +{ + local cur prev words cword + _init_completion -n = || return + + if ((cword == 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 IFS=$' \t\n' reset=$(shopt -po noglob) + set -o noglob + COMPREPLY=($(compgen -P"${opt}${cur%%@*}@" -f -- "${cur#*@}")) + $reset + 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 reset=$(shopt -po noglob) + set -o noglob + compopt -o filenames + local ifs=$IFS IFS=$'\n' + COMPREPLY=($(compgen -d -P${cur:0:2} -S/ -- "${cur:2}")) + IFS=$ifs + $reset + compopt -o nospace + 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 == 2)); then + _filedir_xspec unzip + # TODO: parsing 7z i output? + # - how to figure out if the format is input or output? + # - find string Formats:, read until next empty line + # - extensions start from column 26 + # - ignore everything in parens + # - terminate on two spaces + # - terminate on token containing anything [^a-z0-9] + # (assumption: extensions are all lowercase) + [[ $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)|msi|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 new file mode 100644 index 0000000..723b42f --- /dev/null +++ b/completions/Makefile.am @@ -0,0 +1,950 @@ +bashcompdir = $(datadir)/$(PACKAGE)/completions +bashcomp_DATA = 2to3 \ + 7z \ + a2x \ + abook \ + aclocal \ + acpi \ + _adb \ + add_members \ + alias \ + ant \ + apache2ctl \ + appdata-validate \ + apt-build \ + apt-cache \ + apt-get \ + aptitude \ + arch \ + arp \ + arping \ + arpspoof \ + asciidoc \ + aspell \ + autoconf \ + automake \ + autoreconf \ + autorpm \ + autoscan \ + avctrl \ + badblocks \ + bind \ + bk \ + brctl \ + btdownloadheadless.py \ + bts \ + bzip2 \ + _cal \ + cancel \ + cardctl \ + carton \ + ccache \ + ccze \ + cfagent \ + cfrun \ + chage \ + change_pw \ + check_db \ + check_perms \ + checksec \ + _chfn \ + chgrp \ + chkconfig \ + chmod \ + chown \ + chpasswd \ + chromium-browser \ + chronyc \ + chrpath \ + _chsh \ + cksfv \ + cleanarch \ + clisp \ + clone_member \ + complete \ + config_list \ + configure \ + convert \ + cowsay \ + cpan2dist \ + cpio \ + cppcheck \ + crontab \ + cryptsetup \ + curl \ + cvs \ + cvsps \ + dd \ + deja-dup \ + desktop-file-validate \ + dhclient \ + dict \ + _dmesg \ + dmypy \ + dnssec-keygen \ + dnsspoof \ + dot \ + dpkg \ + dpkg-source \ + dselect \ + dsniff \ + dumpdb \ + dumpe2fs \ + e2freefrag \ + e2label \ + ebtables \ + ecryptfs-migrate-home \ + _eject \ + eog \ + ether-wake \ + evince \ + explodepkg \ + export \ + faillog \ + fbgs \ + fbi \ + feh \ + file \ + file-roller \ + filefrag \ + filesnarf \ + find \ + find_member \ + fio \ + firefox \ + flake8 \ + freebsd-update \ + freeciv \ + freeciv-server \ + function \ + fusermount \ + gcc \ + gcl \ + gdb \ + genaliases \ + gendiff \ + genisoimage \ + geoiplookup \ + getconf \ + getent \ + gkrellm \ + gm \ + gnatmake \ + gnokii \ + gnome-mplayer \ + gnome-screenshot \ + gpasswd \ + gpg \ + gpg2 \ + gpgv \ + gphoto2 \ + gprof \ + groupadd \ + groupdel \ + groupmems \ + groupmod \ + growisofs \ + grpck \ + gssdp-discover \ + gzip \ + hcitool \ + hddtemp \ + _hexdump \ + hid2hci \ + hostname \ + hping2 \ + htop \ + htpasswd \ + hunspell \ + _hwclock \ + iconv \ + id \ + idn \ + ifstat \ + iftop \ + ifup \ + influx \ + info \ + inject \ + inotifywait \ + insmod \ + installpkg \ + interdiff \ + invoke-rc.d \ + _ionice \ + ip \ + ipcalc \ + iperf \ + ipmitool \ + ipsec \ + iptables \ + ipv6calc \ + iscsiadm \ + isort \ + isql \ + iwconfig \ + iwlist \ + iwpriv \ + iwspy \ + jar \ + jarsigner \ + java \ + javaws \ + jq \ + jpegoptim \ + jps \ + jshint \ + json_xs \ + jsonschema \ + 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 \ + locale-gen \ + lpq \ + lpr \ + lrzip \ + lsof \ + lsscsi \ + lsusb \ + lua \ + luac \ + luseradd \ + luserdel \ + lvm \ + lz4 \ + lzip \ + lzma \ + lzop \ + macof \ + mailmanctl \ + make \ + makepkg \ + man \ + mc \ + mcrypt \ + mdadm \ + mdtool \ + medusa \ + mii-diag \ + mii-tool \ + minicom \ + mkinitrd \ + mktemp \ + mmsitepass \ + _mock \ + modinfo \ + modprobe \ + _modules \ + monodevelop \ + _mount \ + _mount.linux \ + mplayer \ + mr \ + msynctool \ + mtx \ + munindoc \ + munin-node-configure \ + munin-run \ + munin-update \ + mussh \ + mutt \ + mypy \ + mysql \ + mysqladmin \ + nc \ + ncftp \ + nethogs \ + _newgrp \ + newlist \ + newusers \ + ngrep \ + nmap \ + _nmcli \ + nproc \ + nslookup \ + nsupdate \ + ntpdate \ + oggdec \ + op \ + openssl \ + opera \ + optipng \ + p4 \ + pack200 \ + passwd \ + patch \ + pdftotext \ + perl \ + perlcritic \ + perltidy \ + pgrep \ + pidof \ + pine \ + ping \ + pkg-config \ + pkg-get \ + pkg_delete \ + pkgadd \ + pkgrm \ + pkgtool \ + pkgutil \ + plague-client \ + pm-hibernate \ + pm-is-supported \ + pm-powersave \ + pngfix \ + portinstall \ + portsnap \ + portupgrade \ + postcat \ + postconf \ + postfix \ + postmap \ + postsuper \ + povray \ + prelink \ + printenv \ + protoc \ + psql \ + puppet \ + pv \ + pwck \ + pwd \ + pwdx \ + pwgen \ + pycodestyle \ + pydoc \ + pydocstyle \ + pyflakes \ + pylint \ + pytest \ + python \ + pyvenv \ + qdbus \ + qemu \ + qrunner \ + querybts \ + quota \ + radvdump \ + rcs \ + rdesktop \ + remove_members \ + removepkg \ + _renice \ + _repomanage \ + reportbug \ + _reptyr \ + resolvconf \ + _rfkill \ + ri \ + rmlist \ + rmmod \ + route \ + rpcdebug \ + rpm \ + rpm2tgz \ + rpmcheck \ + rrdtool \ + rsync \ + _rtcwake \ + _runuser \ + sbcl \ + sbopkg \ + screen \ + scrub \ + secret-tool \ + sh \ + shellcheck \ + sitecopy \ + slackpkg \ + slapt-get \ + slapt-src \ + smartctl \ + smbclient \ + snownews \ + sqlite3 \ + ss \ + ssh \ + ssh-add \ + ssh-copy-id \ + ssh-keygen \ + sshfs \ + sshmitm \ + sshow \ + strace \ + strings \ + _su \ + sudo \ + svcadm \ + svk \ + _svn \ + _svnadmin \ + _svnlook \ + sync_members \ + synclient \ + sysbench \ + sysctl \ + tar \ + tcpdump \ + tcpkill \ + tcpnice \ + timeout \ + tipc \ + tox \ + tracepath \ + tshark \ + tsig-keygen \ + tune2fs \ + _udevadm \ + ulimit \ + _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 \ + _write \ + wsimport \ + wtf \ + wvdial \ + xdg-mime \ + xdg-settings \ + xfreerdp \ + xgamma \ + xhost \ + _xm \ + xmllint \ + xmlwf \ + xmms \ + xmodmap \ + xrandr \ + xrdb \ + xsltproc \ + xvfb-run \ + xxd \ + xz \ + xzdec \ + ypmatch \ + _yum \ + yum-arch \ + zopfli \ + zopflipng + +EXTRA_DIST = $(bashcomp_DATA) + +CLEANFILES = \ + 7za \ + aclocal-1.10 \ + aclocal-1.11 \ + aclocal-1.12 \ + aclocal-1.13 \ + aclocal-1.14 \ + aclocal-1.15 \ + aclocal-1.16 \ + alpine \ + alternatives \ + animate \ + apropos \ + aptitude-curses \ + arm-koji \ + asciidoc.py \ + autoheader \ + automake-1.10 \ + automake-1.11 \ + automake-1.12 \ + automake-1.13 \ + automake-1.14 \ + automake-1.15 \ + automake-1.16 \ + autossh \ + autoupdate \ + bmake \ + bsdtar \ + btdownloadcurses.py \ + btdownloadgui.py \ + c++ \ + cc \ + cdrecord \ + chrome \ + chromium \ + 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 \ + etherwake \ + f77 \ + f95 \ + filebucket \ + freeciv-gtk2 \ + freeciv-gtk3 \ + freeciv-sdl \ + freeciv-xaw \ + g++ \ + g++-5 \ + g++-6 \ + g++-7 \ + g++-8 \ + g4 \ + g77 \ + g95 \ + gcc-5 \ + gcc-6 \ + gcc-7 \ + gcc-8 \ + gccgo \ + gccgo-5 \ + gccgo-6 \ + gccgo-7 \ + gccgo-8 \ + gcj \ + geoiplookup6 \ + gfortran \ + gfortran-5 \ + gfortran-6 \ + gfortran-7 \ + gfortran-8 \ + gkrellm2 \ + gmake \ + gmplayer \ + gnumake \ + google-chrome \ + google-chrome-stable \ + gpc \ + gpgv2 \ + gtar \ + hciattach \ + hciconfig \ + hd \ + host \ + hping \ + hping3 \ + iceweasel \ + identify \ + ifdown \ + ifquery \ + ifstatus \ + import \ + inotifywatch \ + insmod.static \ + iperf3 \ + javac \ + javadoc \ + kplayer \ + l2ping \ + lbzip2 \ + ldapadd \ + ldapcompare \ + ldapdelete \ + ldapmodify \ + ldapmodrdn \ + ldappasswd \ + ldapwhoami \ + links2 \ + lintian-info \ + lusermod \ + lvchange \ + lvcreate \ + lvdisplay \ + lvextend \ + lvmdiskscan \ + lvreduce \ + lvremove \ + lvrename \ + lvresize \ + lvs \ + lvscan \ + lz4c \ + mailsnarf \ + mdecrypt \ + mencoder \ + micropython \ + mkisofs \ + mogrify \ + montage \ + mozilla-firefox \ + 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 \ + py.test-2 \ + py.test-3 \ + pydoc3 \ + pylint-2 \ + pylint-3 \ + pypy \ + pypy3 \ + pytest-2 \ + pytest-3 \ + python2 \ + python2.7 \ + python3 \ + python3.3 \ + python3.4 \ + python3.5 \ + python3.6 \ + python3.7 \ + python3.8 \ + pyvenv-3.4 \ + pyvenv-3.5 \ + pyvenv-3.6 \ + pyvenv-3.7 \ + pyvenv-3.8 \ + 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 + +symlinks: $(DATA) + $(ss) 7z \ + 7za + $(ss) aclocal \ + aclocal-1.10 aclocal-1.11 aclocal-1.12 aclocal-1.13 \ + aclocal-1.14 aclocal-1.15 aclocal-1.16 + $(ss) ant \ + phing + $(ss) aptitude \ + aptitude-curses + $(ss) asciidoc \ + asciidoc.py + $(ss) automake \ + automake-1.10 automake-1.11 automake-1.12 automake-1.13 \ + automake-1.14 automake-1.15 automake-1.16 + $(ss) autoreconf \ + autoheader + $(ss) autoscan \ + autoupdate + $(ss) btdownloadheadless.py \ + btdownloadcurses.py btdownloadgui.py + $(ss) bzip2 \ + lbzip2 pbzip2 + $(ss) _cal \ + ncal + $(ss) cardctl \ + pccardctl + $(ss) chromium-browser \ + chrome chromium google-chrome google-chrome-stable + $(ss) complete \ + compgen + $(ss) convert \ + animate compare composite conjure display identify import \ + mogrify montage stream + $(ss) cowsay \ + cowthink + $(ss) dict \ + rdict + $(ss) dpkg \ + dpkg-deb dpkg-query dpkg-reconfigure + $(ss) ether-wake \ + etherwake + $(ss) filesnarf \ + mailsnarf msgsnarf + $(ss) firefox \ + iceweasel mozilla-firefox + $(ss) freeciv \ + civclient freeciv-gtk2 freeciv-gtk3 freeciv-sdl freeciv-xaw + $(ss) freeciv-server \ + civserver + $(ss) function \ + declare typeset + $(ss) gcc \ + c++ cc f77 f95 g++ g++-5 g++-6 g++-7 g++-8 g77 g95 gcc-5 \ + gcc-6 gcc-7 gcc-8 gccgo gccgo-5 gccgo-6 gccgo-7 gccgo-8 gcj \ + gfortran gfortran-5 gfortran-6 gfortran-7 gfortran-8 gpc + $(ss) genisoimage \ + mkisofs + $(ss) geoiplookup \ + geoiplookup6 + $(ss) gkrellm \ + gkrellm2 + $(ss) gpgv \ + gpgv2 + $(ss) gzip \ + pigz + $(ss) hcitool \ + ciptool dfutool hciattach hciconfig l2ping rfcomm sdptool + $(ss) _hexdump \ + hd + $(ss) hping2 \ + hping hping3 + $(ss) ifup \ + ifdown ifquery ifstatus + $(ss) info \ + pinfo + $(ss) inotifywait \ + inotifywatch + $(ss) insmod \ + insmod.static + $(ss) iperf \ + iperf3 + $(ss) java \ + javac javadoc + $(ss) koji \ + arm-koji ppc-koji s390-koji sparc-koji + $(ss) ldapsearch \ + ldapadd ldapcompare ldapdelete ldapmodify ldapmodrdn \ + ldappasswd ldapwhoami + $(ss) links \ + links2 + $(ss) lintian \ + lintian-info + $(ss) luseradd \ + lusermod + $(ss) lvm \ + lvchange lvcreate lvdisplay lvextend lvmdiskscan lvreduce \ + lvremove lvrename lvresize lvs lvscan pvchange pvcreate \ + pvdisplay pvmove pvremove pvs pvscan vgcfgbackup vgcfgrestore \ + vgchange vgck vgconvert vgcreate vgdisplay vgexport vgextend \ + vgimport vgmerge vgmknodes vgreduce vgremove vgrename vgs \ + vgscan vgsplit + $(ss) lz4 \ + lz4c + $(ss) lzip \ + clzip pdlzip plzip + $(ss) make \ + bmake colormake gmake gnumake pmake + $(ss) man \ + apropos whatis + $(ss) mcrypt \ + mdecrypt + $(ss) mplayer \ + gmplayer kplayer mencoder mplayer2 + $(ss) mutt \ + muttng + $(ss) nslookup \ + host + $(ss) p4 \ + g4 + $(ss) perl \ + perldoc + $(ss) pine \ + alpine + $(ss) ping \ + ping6 + $(ss) pkg_delete \ + pkg_deinstall pkg_info + $(ss) pgrep \ + pkill + $(ss) pm-hibernate \ + pm-suspend pm-suspend-hybrid + $(ss) psql \ + createdb createuser dropdb dropuser + $(ss) postmap \ + postalias + $(ss) povray \ + spovray xpovray + $(ss) puppet \ + filebucket puppetca puppetd puppetdoc puppetmasterd puppetqd \ + puppetrun ralsh + $(ss) pytest \ + py.test py.test-2 py.test-3 pytest-2 pytest-3 + $(ss) pydoc \ + pydoc3 + $(ss) pylint \ + pylint-2 pylint-3 + $(ss) python \ + micropython pypy pypy3 python2 python2.7 python3 python3.3 python3.4 python3.5 python3.6 python3.7 python3.8 + $(ss) pyvenv \ + pyvenv-3.4 pyvenv-3.5 pyvenv-3.6 pyvenv-3.7 pyvenv-3.8 + $(ss) qdbus \ + dcop + $(ss) qemu \ + qemu-kvm qemu-system-i386 qemu-system-x86_64 + $(ss) quota \ + edquota quotacheck quotaoff quotaon repquota setquota + $(ss) rcs \ + ci co rcsdiff rlog + $(ss) rpm \ + rpmbuild rpmbuild-md5 + $(ss) rpm2tgz \ + rpm2targz rpm2txz + $(ss) smbclient \ + smbcacls smbcquotas smbget smbpasswd smbtar smbtree + $(ss) sbcl \ + sbcl-mt + $(ss) ssh \ + autossh scp sftp sidedoor slogin + $(ss) sudo \ + sudoedit + $(ss) tar \ + bsdtar gtar star + $(ss) tracepath \ + tracepath6 + $(ss) update-alternatives \ + alternatives + $(ss) vipw \ + vigr + $(ss) vncviewer \ + tightvncviewer xvnc4viewer + $(ss) wine \ + wine-development wine-stable + $(ss) wodim \ + cdrecord + $(ss) xz \ + pxz + $(ss) ypmatch \ + ypcat +.PHONY: symlinks + +SETUP_SYMLINKS = $(srcdir)/../setup-symlinks.sh + +all-local: ss = $(SETUP_SYMLINKS) . +all-local: symlinks + +install-data-hook: ss = $(SETUP_SYMLINKS) $(DESTDIR)$(bashcompdir) +install-data-hook: symlinks + +check-local: + ret=0; \ + for file in $(bashcomp_DATA); do \ + $${bashcomp_bash:-$${BASH:-bash}} \ + -O extglob -n $(srcdir)/$$file || ret=$$?; \ + done; \ + exit $$ret diff --git a/completions/_adb b/completions/_adb new file mode 100644 index 0000000..e8ebab1 --- /dev/null +++ b/completions/_adb @@ -0,0 +1,69 @@ +# adb completion -*- shell-script -*- + +# Use of this file is deprecated. Upstream completion is available in +# the Android SDK, use that instead. + +_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 [[ ! -v 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/_cal b/completions/_cal new file mode 100644 index 0000000..1eec267 --- /dev/null +++ b/completions/_cal @@ -0,0 +1,38 @@ +# 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 + local opts=$(_parse_help "$1") + COMPREPLY=($(compgen -W '${opts:-$(_parse_usage "$1")}' -- "$cur")) + return + fi + + local args + _count_args + ((args == 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 0000000..334967f --- /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 0000000..8f8a807 --- /dev/null +++ b/completions/_chsh @@ -0,0 +1,31 @@ +# 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 + local opts=$(_parse_help "$1") + COMPREPLY=($(compgen -W '${opts:-$(_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 0000000..8306654 --- /dev/null +++ b/completions/_dmesg @@ -0,0 +1,33 @@ +# 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") + COMPREPLY=($(compgen -W '${opts:-$(_parse_usage "$1")}' -- "$cur")) +} && + complete -F _dmesg dmesg + +# ex: filetype=sh diff --git a/completions/_eject b/completions/_eject new file mode 100644 index 0000000..52168f7 --- /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 0000000..785f597 --- /dev/null +++ b/completions/_hexdump @@ -0,0 +1,31 @@ +# 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")" + COMPREPLY=($(compgen -W '${opts:-$(_parse_usage "$1")}' -- "$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 0000000..ef437a2 --- /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 0000000..b0d96a1 --- /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 > 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 0000000..9788dec --- /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 == 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 new file mode 100644 index 0000000..b468148 --- /dev/null +++ b/completions/_mock @@ -0,0 +1,69 @@ +# bash completion for mock -*- shell-script -*- + +# Use of this file is deprecated. Upstream completion is available in +# mock > 1.1.0, use that instead. + +_mock() +{ + local cur prev words cword split + _init_completion -s || return + + local plugins='tmpfs root_cache yum_cache bind_mount ccache' + local cfgdir=/etc/mock count=0 i + + for i in "${words[@]}"; do + ((count == cword)) && break + if [[ $i == --configdir ]]; then + cfgdir="${words[count + 1]}" + elif [[ $i == --configdir=* ]]; then + cfgdir=${i/*=/} + fi + ((count++)) + done + + case $prev in + -h | --help | --copyin | --copyout | --arch | -D | --define | --with | --without | \ + --uniqueext | --rpmbuild_timeout | --sources | --cwd) + return + ;; + -r | --root) + COMPREPLY=($(compgen -W "$(command ls $cfgdir)" -- "$cur")) + COMPREPLY=(${COMPREPLY[@]/%.cfg/}) + return + ;; + --configdir | --resultdir) + _filedir -d + return + ;; + --spec) + _filedir spec + return + ;; + --target) + # Yep, compatible archs, not compatible build archs + # (e.g. ix86 chroot builds in x86_64 mock host) + # This would actually depend on what the target root + # can be used to build for... + COMPREPLY=($(compgen -W "$(command rpm --showrc | + command sed -ne 's/^\s*compatible\s\s*archs\s*:\s*\(.*\)/\1/i p')" \ + -- "$cur")) + return + ;; + --enable-plugin | --disable-plugin) + COMPREPLY=($(compgen -W "$plugins" -- "$cur")) + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + [[ ${COMPREPLY-} == *= ]] && compopt -o nospace + else + _filedir '@(?(no)src.r|s)pm' + fi +} && + complete -F _mock mock + +# ex: filetype=sh diff --git a/completions/_modules b/completions/_modules new file mode 100644 index 0000000..4f7c4d4 --- /dev/null +++ b/completions/_modules @@ -0,0 +1,85 @@ +# module completion by Ted Stern -*- shell-script -*- +# +# Use of this file is deprecated, upstream completion is available in +# modules >= 3.2.7, use that instead. +# +# Completion for Environment Modules `module' alias. +# +# See https://sourceforge.net/projects/modules/ +# https://modules.sourceforge.net/ +# +# There are several versions of modules that are commonly used. Older +# Cray UNICOS systems and many other sites use 2.2.2b. The latest GPL'd +# version is 3.1.6. But the module alias is somewhat self-documenting +# via the `module help' command, so use that to print the options. +# +# Programmable completion might be more difficult under tcsh since the +# module command is an alias, and the `module avail' command returns +# its output as stderr. + +# Test for existence of /etc/profile.d/modules.sh too because we may end up +# being sourced before it and thus before the `module' alias has been defined. +[ -f /etc/profile.d/modules.sh ] || return 1 + +_module_list() +{ + local modules="$(command sed 's/:/ /g' <<<$LOADEDMODULES | sort)" + compgen -W "$modules" -- $1 +} + +_module_path() +{ + local modules="$(command sed 's/:/ /g' <<<$MODULEPATH | sort)" + compgen -W "$modules" -- $1 +} + +_module_avail() +{ + local modules="$( + module avail 2>&1 | + command grep -E -v '^(-|$)' | + xargs printf '%s\n' | command sed -e 's/(default)//g' | sort + )" + + compgen -W "$modules" -- $1 +} + +# A completion function for the module alias +_module() +{ + local cur prev words cword + _init_completion || return + + if ((cword == 1)); then + # First parameter on line -- we expect it to be a mode selection + + local options + options="$(module help 2>&1 | command grep -E '^[[:space:]]*\+' | + awk '{print $2}' | command sed -e 's/|/ /g' | sort)" + + COMPREPLY=($(compgen -W "$options" -- "$cur")) + + elif ((cword == 2)); then + case $prev in + add | display | help | load | show | whatis) + COMPREPLY=($(_module_avail "$cur")) + ;; + rm | switch | swap | unload | update) + COMPREPLY=($(_module_list "$cur")) + ;; + unuse) + COMPREPLY=($(_module_path "$cur")) + ;; + esac + elif ((cword == 3)); then + case ${words[1]} in + swap | switch) + COMPREPLY=($(_module_avail "$cur")) + ;; + esac + fi + +} && + complete -F _module -o default module + +# ex: filetype=sh diff --git a/completions/_mount b/completions/_mount new file mode 100644 index 0000000..85f5490 --- /dev/null +++ b/completions/_mount @@ -0,0 +1,65 @@ +# mount(8) completion -*- shell-script -*- + +# Use of this file is deprecated on Linux. Upstream completion is +# available in util-linux >= 2.28, use that instead. + +if [[ $OSTYPE == *linux* ]]; then + . "$BASH_SOURCE.linux" + return +fi + +# This will pull a list of possible mounts out of +# /etc/{,v}fstab, unless the word being completed contains a ':', which +# would indicate the specification of an NFS server. In that case, we +# query the server for a list of all available exports and complete on +# that instead. +# +_mount() +{ + local cur prev words cword + _init_completion -n : || return + + local sm host + + case $prev in + -t | --types) + _fstypes + return + ;; + esac + + [[ $cur == \\ ]] && cur="/" + + if [[ $cur == *:* ]]; then + for sm in "$(type -P showmount)" {,/usr}/{,s}bin/showmount; do + [[ -x $sm ]] || continue + COMPREPLY=($(compgen -W "$("$sm" -e ${cur%%:*} | + awk 'NR>1 {print $1}')" -- "${cur#*:}")) + return + done + fi + + if [[ $cur == //* ]]; then + host=${cur#//} + host=${host%%/*} + if [[ -n $host ]]; then + COMPREPLY=($(compgen -P "//$host" -W \ + "$(smbclient -d 0 -NL $host 2>/dev/null | + command sed -ne '/^[[:blank:]]*Sharename/,/^$/p' | + command sed -ne '3,$s|^[^A-Za-z]*\([^[:blank:]]*\).*$|/\1|p')" \ + -- "${cur#//$host}")) + fi + elif [[ -r /etc/vfstab ]]; then + # Solaris + COMPREPLY=($(compgen -W "$(awk '! /^[ \t]*#/ {if ($3 ~ /\//) print $3}' /etc/vfstab)" -- "$cur")) + elif [[ ! -e /etc/fstab ]]; then + # probably Cygwin + COMPREPLY=($(compgen -W "$($1 | awk '! /^[ \t]*#/ {if ($3 ~ /\//) print $3}')" -- "$cur")) + else + # probably BSD + COMPREPLY=($(compgen -W "$(awk '! /^[ \t]*#/ {if ($2 ~ /\//) print $2}' /etc/fstab)" -- "$cur")) + fi +} && + complete -F _mount -o default -o dirnames mount + +# ex: filetype=sh diff --git a/completions/_mount.linux b/completions/_mount.linux new file mode 100644 index 0000000..f40865e --- /dev/null +++ b/completions/_mount.linux @@ -0,0 +1,252 @@ +# mount(8) completion -*- shell-script -*- + +# Use of this file is deprecated on Linux. Upstream completion is +# available in util-linux >= 2.28, use that instead. + +_mount() +{ + local cur prev words cword + _init_completion -n =: || return + + local split=false + case "$prev" in + -t | --types) + # find /lib/modules/$(uname -r)/ -type f -path '*/fs/*.ko' -printf '%f\n' | cut -d. -f1 + # FIXME: no + if [[ $cur == ?*,* ]]; then + prev="${cur%,*}" + cur="${cur##*,}" + split=true + fi + COMPREPLY=($(compgen -W 'auto adfs affs autofs btrfs cifs coda + cramfs davfs debugfs devpts efs ext2 ext3 ext4 fuse hfs hfsplus + hpfs iso9660 jffs2 jfs minix msdos ncpfs nfs nfs4 ntfs ntfs-3g + proc qnx4 ramfs reiserfs romfs squashfs smbfs sysv tmpfs ubifs + udf ufs umsdos usbfs vfat xfs' -- "$cur")) + _fstypes + $split && COMPREPLY=(${COMPREPLY[@]/#/$prev,}) + return + ;; + --bind | -B | --rbind | -R) + _filedir -d + return + ;; + -p | --pass-fd) + COMPREPLY=($(compgen -W '{0..9}')) + compopt -o nospace + return + ;; + -L) + COMPREPLY=($( + cd "/dev/disk/by-label/" 2>/dev/null || return + compgen -f -- "$cur" + )) + return + ;; + -U) + COMPREPLY=($( + cd "/dev/disk/by-uuid/" 2>/dev/null || return + compgen -f -- "$cur" + )) + return + ;; + -O | --test-opts) + # argument required but no completions available + return + ;; + -o | --options) + local fstype=auto # default fstype + for ((i = ${#words[@]} - 1; i > 0; i--)); do + if [[ ${words[i]} == -@(t|-types)* ]]; then + if [[ ${words[i]} == *=* ]]; then + [[ ${words[i]} == ?*,* ]] && break + fstype="${words[i]#-*=}" + else + [[ ${words[i + 1]} == ?*,* ]] && break + fstype="${words[i + 1]}" + fi + break + fi + done + # no is not a real fstype, reset to "auto" + [[ $fstype == no?* ]] && fstype=auto + # split options list + if [[ $cur == ?*,* ]]; then + prev="${cur%,*}" + cur="${cur##*,}" + split=true + fi + # no completion if $cur is opt=smth + [[ $cur == *=* ]] && return + # mount options + COMPREPLY=($(compgen -W 'loop {,a}sync {,no}atime {,no}auto + {,fs,def,root}context= defaults {,no}dev {,no}diratime dirsync + {,no}exec group {,no}iversion {,no}mand _netdev nofail + {,no}relatime {,no}strictatime {,no}suid owner remount ro rw + {,no}user users' -- "$cur")) + case "$fstype" in + adfs | auto) + COMPREPLY+=($(compgen -W '{u,g}id= {own,oth}mask=' -- "$cur")) + ;;& + affs | auto) + COMPREPLY+=($(compgen -W '{u,g}id= set{u,g}id= mode= protect + usemp verbose prefix= volume= reserved= root= bs= + {,no,usr,grp}quota' -- "$cur")) + ;;& + btrfs | auto) + COMPREPLY+=($(compgen -W 'degraded subvol= subvolid= device= + nodatasum nodatacow nobarrier max_inline= alloc_start= + thread_pool= compress= compress-force= ssd noacl notreelog + flushoncommit metadata_ratio= {,no}space_cache clear_cache + user_subvol_rm_allowed autodefrag inode_cache' -- "$cur")) + ;;& + cifs | auto) + COMPREPLY+=($(compgen -W 'user= password= credentials= {u,g}id= + force{u,g}id port= servern= netbiosname= {file,dir}_mode= + ip= domain= guest iocharset {,no}setuids {,no,dyn}perm + directio {,no}mapchars {,no}intr hard soft noacl nocase sec= + nobrl sfu {,no}serverino nounix nouser_xattr {r,w}size= + rwpidforward backup{u,g}id cache=' -- "$cur")) + ;;& + davfs | auto) + COMPREPLY+=($(compgen -W 'conf= {file,dir}_mode= {u,g}id= + username=' -- "$cur")) + ;;& + ext[2-4] | auto) + COMPREPLY+=($(compgen -W '{,no}acl bsddf minixdf check= debug + errors= {,no}grpid {bsd,sysv}groups {,no,usr,grp}quota + nobh nouid32 oldalloc orlov res{u,g}id= sb= + {,no}user_xattr' -- "$cur")) + ;;& + ext[34] | auto) + COMPREPLY+=($(compgen -W 'journal= journal_dev= norecovery + noload data= barrier= commit=' -- "$cur")) + ;;& + ext4 | auto) + COMPREPLY+=($(compgen -W 'journal_checksum journal_async_commit + nobarrier inode_readahead= stripe= {,no}delalloc abort + {max,min}_batch_time= journal_ioprio= {,no}auto_da_alloc + {,no}discard nouid32 resize {,no}block_validity + dioread_{,no}lock max_dir_size_kb= i_version' -- "$cur")) + ;;& + msdos | umsdos | vfat | auto) + COMPREPLY+=($(compgen -W 'blocksize= {u,g}id= {u,d,f}mask= + allow_utime= check= codepage= conv= cvf_format= cvf_option= + debug fat= iocharset= tz= quiet showexec sys_immutable flush + usefree {,no}dots dotsOK=' -- "$cur")) + ;;& + vfat | auto) + COMPREPLY+=($(compgen -W 'uni_xlate posix nonumtail utf8 + shortname=' -- "$cur")) + ;;& + iso9660 | auto) + COMPREPLY+=($(compgen -W 'norock nojoliet check= {u,g}id= map= + mode= unhide block= conv= cruft session= sbsector= + iocharset= utf8' -- "$cur")) + ;;& + jffs2 | auto) + COMPREPLY+=($(compgen -W 'compr= rp_size=' -- "$cur")) + ;;& + jfs | auto) + COMPREPLY+=($(compgen -W 'iocharset= resize= {,no}integrity + errors= {,no,usr,grp}quota' -- "$cur")) + ;;& + nfs | nfs4 | auto) + COMPREPLY+=($(compgen -W 'soft hard timeo= retrans= {r,w}size= + {,no}ac acreg{min,max}= acdir{min,max}= actimeo= bg fg + retry= sec= {,no}sharecache {,no}resvport lookupcache= + proto= port= {,no}intr {,no}cto {,nfs}vers= ' -- "$cur")) + ;;& + nfs | auto) + COMPREPLY+=($(compgen -W 'udp tcp rdma mount{port,proto,host}= + mountvers= namlen={,no}lock {,no}acl {,no}rdirplus + {,no}fsc' -- "$cur")) + ;;& + nfs4 | auto) + COMPREPLY+=($(compgen -W 'clientaddr= {,no}migration' \ + -- "$cur")) + ;;& + ntfs-3g) + COMPREPLY+=($(compgen -W '{u,g}id= {u,f,d}mask= usermapping= + permissions inherit locale= force {,no}recover + ignore_case remove_hiberfile show_sys_files + hide_{hid,dot}_files windows_names allow_other max_read= + silent no_def_opts streams_interface= user_xattr efs_raw + {,no}compression debug no_detach' -- "$cur")) + ;;& + proc | auto) + COMPREPLY+=($(compgen -W '{u,g}id=' -- "$cur")) + ;;& + reiserfs | auto) + COMPREPLY+=($(compgen -W 'conv hash= {,no_un}hashed_relocation + noborder nolog notail replayonly resize= user_xattr acl + barrier=' -- "$cur")) + ;;& + tmpfs | auto) + COMPREPLY+=($(compgen -W 'size= nr_blocks= nr_inodes= mode= + {u,g}id= mpol=' -- "$cur")) + ;;& + udf | auto) + COMPREPLY+=($(compgen -W '{u,g}id= umask= unhide undelete + nostrict iocharset bs= novrs session= anchor= volume= + partition= lastblock= fileset= rootdir=' -- "$cur")) + ;;& + usbfs | auto) + COMPREPLY+=($(compgen -W 'dev{u,g}id= devmode= bus{u,g}id= + busmode= list{u,g}id= listmode=' -- "$cur")) + ;;& + xfs | auto) + COMPREPLY+=($(compgen -W 'allocsize= {,no}attr2 barrier dmapi + {,no}grpid {bsd,sysv}groups ihashsize= {,no}ikeep + inode{32,64} {,no}largeio logbufs= logbsize= logdev= + rtdev= mtpt= noalign norecovery nouuid osyncisosync + {u,g,p}qnoenforce {,u,usr,g,grp,p,prj}quota sunit= swidth= + swalloc' -- "$cur")) + ;;& + esac + # COMP_WORDBREAKS is a real pain in the ass + prev="${prev##*[$COMP_WORDBREAKS]}" + $split && COMPREPLY=(${COMPREPLY[@]/#/"$prev,"}) + [[ ${COMPREPLY-} == *= ]] && compopt -o nospace + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '--version --help --verbose --all --fork + --fake --internal-only -l --no-mtab --no-canonicalize --pass-fd -s + --read-only --rw -L -U --types --test-opts --options --bind --rbind + --move' -- "$cur")) + [[ ${COMPREPLY-} ]] && return + fi + + [[ $cur == \\ ]] && cur="/" + + local sm host + + if [[ $cur == *:* ]]; then + for sm in "$(type -P showmount)" {,/usr}/{,s}bin/showmount; do + [[ -x $sm ]] || continue + COMPREPLY=($(compgen -W "$("$sm" -e ${cur%%:*} | + awk 'NR>1 {print $1}')" -- "${cur#*:}")) + return + done + fi + + if [[ $cur == //* ]]; then + host=${cur#//} + host=${host%%/*} + if [[ -n $host ]]; then + COMPREPLY=($(compgen -P "//$host" -W \ + "$(smbclient -d 0 -NL $host 2>/dev/null | + command sed -ne '/^[[:blank:]]*Sharename/,/^$/p' | + command sed -ne '3,$s|^[^A-Za-z]*\([^[:blank:]]*\).*$|/\1|p')" \ + -- "${cur#//$host}")) + fi + fi + + _filedir +} && + complete -F _mount mount + +# ex: filetype=sh diff --git a/completions/_newgrp b/completions/_newgrp new file mode 100644 index 0000000..a2dc3ed --- /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 0000000..eac285b --- /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 == 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 0000000..a416744 --- /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 <= cword && ${#COMPREPLY[@]} == 0)); do + curopt=${words[cword - i]} + case "$curopt" in + -u) + _allowed_users + ;; + -g) + _pgids + ;; + -p | "$command") + _pids + ;; + esac + ((i++)) + done +} && + complete -F _renice renice + +# ex: filetype=sh diff --git a/completions/_repomanage b/completions/_repomanage new file mode 100644 index 0000000..ba0787e --- /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 0000000..01d61b2 --- /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/_rfkill b/completions/_rfkill new file mode 100644 index 0000000..96a6c09 --- /dev/null +++ b/completions/_rfkill @@ -0,0 +1,31 @@ +# bash completion for rfkill -*- shell-script -*- + +# Use of this file is deprecated on systems with util-linux >= 2.31, which +# ships completion for the rfkill included with it. + +_rfkill() +{ + local cur prev words cword + _init_completion || return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '--version' -- "$cur")) + else + case $cword in + 1) + COMPREPLY=($(compgen -W "help event list block unblock" \ + -- "$cur")) + ;; + 2) + if [[ $prev == block || $prev == unblock ]]; then + COMPREPLY=($(compgen -W "$($1 list | awk -F: \ + '/^[0-9]/ {print $1}') all wifi bluetooth uwb wimax \ + wwan gps" -- "$cur")) + fi + ;; + esac + fi +} && + complete -F _rfkill rfkill + +# ex: filetype=sh diff --git a/completions/_rtcwake b/completions/_rtcwake new file mode 100644 index 0000000..4ca452d --- /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 0000000..95cf930 --- /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 0000000..1a03c8f --- /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/_svn b/completions/_svn new file mode 100644 index 0000000..5d85c2b --- /dev/null +++ b/completions/_svn @@ -0,0 +1,210 @@ +# 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 == 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) + _xfunc iconv _iconv_charsets + return + ;; + --editor-cmd | --diff-cmd | --diff3-cmd) + compopt -o filenames + COMPREPLY=($(compgen -c -- "$cur")) + 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 0000000..654fd3e --- /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 == 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 0000000..36188a5 --- /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 == 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 new file mode 100644 index 0000000..19624be --- /dev/null +++ b/completions/_udevadm @@ -0,0 +1,77 @@ +# udevadm(8) completion -*- shell-script -*- + +# Use of this file is deprecated. Upstream completion is available in +# systemd >= 196, use that instead. + +_udevadm() +{ + local cur prev words cword split + _init_completion -s || return + + local i udevcmd + for ((i = 1; i < cword; i++)); do + if [[ ${words[i]} != -* ]]; then + udevcmd=${words[i]} + break + fi + done + + case $prev in + --help | --version | --property | --children-max | --timeout | --seq-start | \ + --seq-end | --attr-match | --attr-nomatch | --parent-match | --property-match | \ + --tag-match | --subsystem-match | --subsystem-nomatch | --sysname-match | \ + --path) + return + ;; + --log-priority) + COMPREPLY=($(compgen -W 'err info debug' -- "$cur")) + return + ;; + --query) + COMPREPLY=($(compgen -W 'name symlink path property all' \ + -- "$cur")) + return + ;; + --name) + cur=${cur:=/dev/} + _filedir + return + ;; + --device-id-of-file | --exit-if-exists) + _filedir + return + ;; + --action) + COMPREPLY=($(compgen -W 'add change remove' -- "$cur")) + return + ;; + --type) + COMPREPLY=($(compgen -W 'devices subsystems failed' -- "$cur")) + return + ;; + esac + + $split && return + + if [[ ! -v udevcmd ]]; then + case $cur in + -*) + COMPREPLY=($(compgen -W '--help --version --debug' -- "$cur")) + ;; + *) + COMPREPLY=($(compgen -W "$("$1" --help 2>/dev/null | + awk '/^[ \t]/ { print $1 }')" -- "$cur")) + ;; + esac + return + fi + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W \ + '$("$1" ${udevcmd-} --help 2>/dev/null | _parse_help -)' -- "$cur")) + [[ ${COMPREPLY-} == *= ]] && compopt -o nospace + fi +} && + complete -F _udevadm udevadm + +# ex: filetype=sh diff --git a/completions/_umount b/completions/_umount new file mode 100644 index 0000000..36d5703 --- /dev/null +++ b/completions/_umount @@ -0,0 +1,24 @@ +# umount(8) completion -*- shell-script -*- + +# Use of this file is deprecated on Linux. Upstream completion is +# available in util-linux >= 2.28, use that instead. + +if [[ $OSTYPE == *linux* ]]; then + . "$BASH_SOURCE.linux" + return +fi + +# umount(8) completion. This relies on the mount point being the third +# space-delimited field in the output of mount(8) +# +_umount() +{ + local cur prev words cword + _init_completion || return + + local IFS=$'\n' + COMPREPLY=($(compgen -W '$(mount | cut -d" " -f 3)' -- "$cur")) +} && + complete -F _umount -o dirnames umount + +# ex: filetype=sh diff --git a/completions/_umount.linux b/completions/_umount.linux new file mode 100644 index 0000000..cf8a259 --- /dev/null +++ b/completions/_umount.linux @@ -0,0 +1,145 @@ +# umount(8) completion -*- shell-script -*- + +# Use of this file is deprecated on Linux. Upstream completion is +# available in util-linux >= 2.28, use that instead. + +# Just like COMPREPLY=(`compgen -W "${COMPREPLY[*]}" -- "$cur"`), only better! +# +# This will correctly escape special characters in COMPREPLY. +_reply_compgen_array() +{ + # Create the argument for compgen -W by escaping twice. + # + # One round of escape is because we want to reply with escaped arguments. A + # second round is required because compgen -W will helpfully expand it's + # argument. + local i wlist + for i in ${!COMPREPLY[*]}; do + local q=$(quote "$(printf %q "${COMPREPLY[i]}")") + wlist+=$q$'\n' + done + + # We also have to add another round of escaping to $cur. + local ecur="$cur" + ecur=${ecur//\\/\\\\} + ecur=${ecur//\'/\\\'} + + # Actually generate completions. + local ifs=$IFS + IFS=$'\n' eval 'COMPREPLY=(`compgen -W "$wlist" -- "${ecur}"`)' + IFS=$ifs +} + +# Unescape strings in the linux fstab(5) format (with octal escapes). +__linux_fstab_unescape() +{ + eval $1="'${!1//\'/\\047}'" + eval $1="'${!1/%\\/\\\\}'" + eval "$1=$'${!1}'" +} + +# Complete linux fstab entries. +# +# Reads a file from stdin in the linux fstab(5) format; as used by /etc/fstab +# and /proc/mounts. With 1st arg -L, look for entries by label. +# shellcheck disable=SC2120 +_linux_fstab() +{ + COMPREPLY=() + + # Read and unescape values into COMPREPLY + local fs_spec fs_file fs_other + local ifs="$IFS" + while read -r fs_spec fs_file fs_other; do + if [[ $fs_spec == [#]* ]]; then continue; fi + if [[ ${1-} == -L ]]; then + local fs_label=${fs_spec/#LABEL=/} + if [[ $fs_label != "$fs_spec" ]]; then + __linux_fstab_unescape fs_label + IFS=$'\0' + COMPREPLY+=("$fs_label") + IFS=$ifs + fi + else + __linux_fstab_unescape fs_spec + __linux_fstab_unescape fs_file + IFS=$'\0' + [[ $fs_spec == */* ]] && COMPREPLY+=("$fs_spec") + [[ $fs_file == */* ]] && COMPREPLY+=("$fs_file") + IFS=$ifs + fi + done + + # Add relative paths to COMPREPLY + if [[ $cur && $cur != /* ]]; then + local realcur + [[ $cur == */ ]] && # don't let readlink drop last / from path + realcur="$(readlink -f "$cur." 2>/dev/null)/" || + realcur=$(readlink -f "$cur" 2>/dev/null) + if [[ $realcur ]]; then + local dirrealcur="" dircur="" basecur + if [[ $cur == */* ]]; then + dirrealcur="${realcur%/*}/" + dircur="${cur%/*}/" + fi + basecur=${cur#"$dircur"} + local i + for i in ${!COMPREPLY[*]}; do + [[ ${COMPREPLY[i]} == "$realcur"* ]] && + COMPREPLY+=($(cd "$dircur" 2>/dev/null && + compgen -f -d -P "$dircur" \ + -X "!${COMPREPLY[i]##"$dirrealcur"}" -- "$basecur")) + done + fi + fi + + _reply_compgen_array +} + +_umount() +{ + local cur prev words cword + _init_completion || return + + case "$prev" in + -t) + # FIXME: no + local split=false + if [[ $cur == ?*,* ]]; then + prev="${cur%,*}" + cur="${cur##*,}" + split=true + fi + COMPREPLY=($(compgen -W 'adfs affs autofs btrfs cifs coda + cramfs debugfs devpts efs ext2 ext3 ext4 fuse hfs hfsplus hpfs + iso9660 jfs minix msdos ncpfs nfs nfs4 ntfs ntfs-3g proc qnx4 + ramfs reiserfs romfs squashfs smbfs sysv tmpfs ubifs udf ufs + umsdos usbfs vfat xfs' -- "$cur")) + _fstypes + $split && COMPREPLY=(${COMPREPLY[@]/#/$prev,}) + return + ;; + -O) + # argument required but no completions available + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '-V -h -v -n -r -d -i -a -t -O -f -l + --no-canonicalize --fake' -- "$cur")) + [[ ${COMPREPLY-} ]] && return + fi + + if [[ -r /proc/mounts ]]; then + # Linux /proc/mounts is properly quoted. This is important when + # unmounting usb devices with pretty names. + _linux_fstab = 2.23, use that instead. + +complete -u write + +# ex: filetype=sh diff --git a/completions/_xm b/completions/_xm new file mode 100644 index 0000000..06b25d3 --- /dev/null +++ b/completions/_xm @@ -0,0 +1,224 @@ +# bash completion for xm -*- shell-script -*- + +# Use of this file is deprecated. The 'xm' command itself is no longer +# provided by upstream. It has been replaced with the 'xl' command, for +# which upstream provides completion, use that instead. + +_xen_domain_names() +{ + COMPREPLY=($(compgen -W "$(xm list 2>/dev/null | + awk '!/Name|Domain-0/ { print $1 }')" -- "$cur")) +} + +_xen_domain_ids() +{ + COMPREPLY=($(compgen -W "$(xm list 2>/dev/null | + awk '!/Name|Domain-0/ { print $2 }')" -- "$cur")) +} + +_xm() +{ + local cur prev words cword + _init_completion || return + + # TODO: _split_longopt + + local args command commands options + + commands='console vncviewer create new delete destroy domid domname + dump-core list mem-max mem-set migrate pause reboot rename reset + restore resume save shutdown start suspend sysrq trigger top unpause + uptime usb-add usb-del vcpu-list vcpu-pin vcpu-set debug-keys dmesg + info log serve sched-credit sched-sedf block-attach block-detach + block-list block-configure network-attach network-detach network-list + vtpm-list pci-attach pci-detach pci-list pci-list-assignable-devices + scsi-attach scsi-detach scsi-list vnet-list vnet-create vnet-delete + labels addlabel rmlabel getlabel dry-run resources dumppolicy setpolicy + resetpolicy getpolicy shell help' + + if ((cword == 1)); then + COMPREPLY=($(compgen -W "$commands" -- "$cur")) + else + if [[ $cur == *=* ]]; then + prev=${cur/=*/} + cur=${cur/*=/} + fi + + command=${words[1]} + if [[ $cur == -* ]]; then + # possible options for the command + case $command in + create) + options='-c' + ;; + dmesg) + options='--clear' + ;; + list) + options='--long' + ;; + reboot) + options='-w -a' + ;; + shutdown) + options='-w -a -R -H' + ;; + sched-credit) + options='-d -w -c' + ;; + block-list | network-list | vtpm-list | vnet-list) + options='-l --long' + ;; + getpolicy) + options='--dumpxml' + ;; + new) + options='-h --help --help_config -q --quiet --path= -f= + --defconfig= -F= --config= -b --dryrun -x --xmldryrun + -s --skipdtd -p --paused -c --console_autoconnect' + ;; + esac + COMPREPLY=($(compgen -W "$options" -- "$cur")) + else + case $command in + console | destroy | domname | domid | list | mem-set | mem-max | \ + pause | reboot | rename | shutdown | unpause | vcpu-list | vcpu-pin | \ + vcpu-set | block-list | network-list | vtpm-list) + _count_args + case $args in + 2) + _xen_domain_names + ;; + esac + ;; + migrate) + _count_args + case $args in + 2) + _xen_domain_names + ;; + 3) + _known_hosts_real -- "$cur" + ;; + esac + ;; + restore | dry-run | vnet-create) + _filedir + ;; + save) + _count_args + case $args in + 2) + _xen_domain_names + ;; + 3) + _filedir + ;; + esac + ;; + sysrq) + _count_args + case $args in + 2) + _xen_domain_names + ;; + 3) + COMPREPLY=($(compgen -W "r s e i u b" -- "$cur")) + ;; + esac + ;; + block-attach) + _count_args + case $args in + 2) + _xen_domain_names + ;; + 3) + COMPREPLY=($(compgen -W "phy: file:" -- "$cur")) + ;; + 5) + COMPREPLY=($(compgen -W "w r" -- "$cur")) + ;; + 6) + _xen_domain_names + ;; + esac + ;; + block-detach) + _count_args + case $args in + 2) + _xen_domain_names + ;; + 3) + COMPREPLY=($(compgen -W "$(xm block-list $prev \ + 2>/dev/null | awk '!/Vdev/ { print $1 }')" \ + -- "$cur")) + ;; + esac + ;; + network-attach) + _count_args + case $args in + 2) + _xen_domain_names + ;; + *) + COMPREPLY=($(compgen -W "script= ip= mac= bridge= + backend=" -- "$cur")) + ;; + esac + ;; + network-detach) + _count_args + case $args in + 2) + _xen_domain_names + ;; + 3) + COMPREPLY=($(compgen -W "$(xm network-list $prev \ + 2>/dev/null | awk '!/Idx/ { print $1 }')" \ + -- "$cur")) + ;; + esac + ;; + sched-credit) + case $prev in + -d) + _xen_domain_names + return + ;; + esac + ;; + create) + _filedir + COMPREPLY+=( + $(compgen -W '$(command ls /etc/xen 2>/dev/null)' \ + -- "$cur")) + ;; + new) + case $prev in + -f | -F | --defconfig | --config) + _filedir + return + ;; + --path) + _filedir -d + return + ;; + esac + + _count_args + case $args in + 2) + _xen_domain_names + ;; + esac + ;; + esac + fi + fi +} && + complete -F _xm xm + +# ex: filetype=sh diff --git a/completions/_yum b/completions/_yum new file mode 100644 index 0000000..224ea25 --- /dev/null +++ b/completions/_yum @@ -0,0 +1,144 @@ +# yum(8) completion -*- shell-script -*- + +# Use of this file is deprecated. Upstream completion is available in +# yum > 3.2.25, use that instead. + +_yum_list() +{ + if [[ $1 == all ]]; then + # Try to strip in between headings like "Available Packages" + # This will obviously only work for English :P + COMPREPLY=($(yum -d 0 -C list $1 "$cur*" 2>/dev/null | + 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 | + command sed -ne 1d -e 's/[[:space:]].*//p')) + fi +} + +_yum_repolist() +{ + # -d 0 causes repolist to output nothing as of yum 3.2.22: + # http://yum.baseurl.org/ticket/83 + # Drop first ("repo id repo name") and last ("repolist: ...") rows + yum --noplugins -C repolist $1 2>/dev/null | + 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 | + command sed -ne 's|.*/\([^./]*\)\.py[co]\{0,1\}$|\1|p' | sort -u +} + +_yum() +{ + local cur prev words cword split + _init_completion -s || return + + local special i + for ((i = 1; i < ${#words[@]} - 1; i++)); do + if [[ ${words[i]} == @(install|update|upgrade|remove|erase|deplist|info) ]]; then + special=${words[i]} + break + fi + done + + if [[ -v special ]]; then + # TODO: install|update|upgrade should not match *src.rpm + if [[ $cur == @(*/|[.~])* && \ + $special == @(deplist|install|update|upgrade) ]]; then + _filedir rpm + return + fi + case $special in + install) + _yum_list available + return + ;; + deplist | info) + _yum_list all + return + ;; + upgrade | update) + _yum_list updates + return + ;; + remove | erase) + # _rpm_installed_packages is not arch-qualified + _yum_list installed + return + ;; + esac + fi + + case $prev in + list) + COMPREPLY=($(compgen -W 'all available updates installed extras + obsoletes recent' -- "$cur")) + ;; + clean) + COMPREPLY=($(compgen -W 'packages headers metadata cache dbcache + all' -- "$cur")) + ;; + repolist) + COMPREPLY=($(compgen -W 'all enabled disabled' -- "$cur")) + ;; + localinstall | localupdate) + # TODO: should not match *src.rpm + _filedir rpm + ;; + -d | -e) + COMPREPLY=($(compgen -W '{0..10}' -- "$cur")) + ;; + -c) + _filedir + ;; + --installroot) + _filedir -d + ;; + --enablerepo) + COMPREPLY=($(compgen -W '$(_yum_repolist disabled)' -- "$cur")) + ;; + --disablerepo) + COMPREPLY=($(compgen -W '$(_yum_repolist enabled)' -- "$cur")) + ;; + --disableexcludes) + COMPREPLY=($(compgen -W '$(_yum_repolist all) all main' \ + -- "$cur")) + ;; + --enableplugin | --disableplugin) + COMPREPLY=($(compgen -W '$(_yum_plugins)' -- "$cur")) + ;; + --color) + COMPREPLY=($(compgen -W 'always auto never' -- "$cur")) + ;; + -R | -x | --exclude) + # argument required but no completions available + return + ;; + -h | --help | --version) + # no other options useful with these + return + ;; + *) + COMPREPLY=($(compgen -W 'install update check-update upgrade + remove erase list info provides whatprovides clean makecache + groupinstall groupupdate grouplist groupremove groupinfo + search shell resolvedep localinstall localupdate deplist + repolist help' -- "$cur")) + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + [[ ${COMPREPLY-} == *= ]] && compopt -o nospace + fi +} && + complete -F _yum yum + +# ex: filetype=sh diff --git a/completions/a2x b/completions/a2x new file mode 100644 index 0000000..b59c786 --- /dev/null +++ b/completions/a2x @@ -0,0 +1,39 @@ +# a2x(1) completion -*- shell-script -*- + +_a2x() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + --attribute | --asciidoc-opts | --dblatex-opts | --fop-opts | --help | \ + --version | --xsltproc-opts | -!(-*)[ah]) + return + ;; + --destination-dir | --icons-dir | -!(-*)D) + _filedir -d + return + ;; + --doctype | -!(-*)d) + _xfunc asciidoc _asciidoc_doctype + return + ;; + --stylesheet) + _filedir css + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1" --help)' -- "$cur")) + [[ ${COMPREPLY-} == *= ]] && compopt -o nospace + return + fi + + _filedir +} && + complete -F _a2x a2x + +# ex: filetype=sh diff --git a/completions/abook b/completions/abook new file mode 100644 index 0000000..42197d1 --- /dev/null +++ b/completions/abook @@ -0,0 +1,49 @@ +# abook(1) completion -*- shell-script -*- + +_abook() +{ + local cur prev words cword + _init_completion || return + + # abook only takes options, tabbing after command name adds a single dash + [[ $cword -eq 1 && -z $cur ]] && + { + compopt -o nospace + COMPREPLY=("-") + return + } + + case $cur in + -*) + _longopt "$1" + return + ;; + esac + + case $prev in + --informat) + COMPREPLY=($(compgen -W "$($1 --formats | + command sed -n -e 's/^'$'\t''\([a-z]*\).*/\1/p' -e '/^$/q')" \ + -- "$cur")) + ;; + --outformat) + COMPREPLY=($(compgen -W "$($1 --formats | + command sed -n -e '/^$/,$s/^'$'\t''\([a-z]*\).*/\1/p')" \ + -- "$cur")) + ;; + --infile) + COMPREPLY=($(compgen -W stdin -- "$cur")) + _filedir + ;; + --outfile) + COMPREPLY=($(compgen -W stdout -- "$cur")) + _filedir + ;; + --config | --datafile) + _filedir + ;; + esac +} && + complete -F _abook abook + +# ex: filetype=sh diff --git a/completions/aclocal b/completions/aclocal new file mode 100644 index 0000000..010862f --- /dev/null +++ b/completions/aclocal @@ -0,0 +1,35 @@ +# aclocal(1) completion -*- shell-script -*- + +_aclocal() +{ + local cur prev words cword split + _init_completion -s || return + + case "$prev" in + --help | --print-ac-dir | --version) + return + ;; + --acdir | -I) + _filedir -d + return + ;; + --output) + _filedir + return + ;; + --warnings | -W) + local cats=(syntax unsupported) + COMPREPLY=($(compgen -W \ + '${cats[@]} ${cats[@]/#/no-} all none error' -- "$cur")) + return + ;; + esac + + $split && return + + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + [[ ${COMPREPLY-} == *= ]] && compopt -o nospace +} && + complete -F _aclocal aclocal aclocal-1.1{0..6} + +# ex: filetype=sh diff --git a/completions/acpi b/completions/acpi new file mode 100644 index 0000000..f2c38b2 --- /dev/null +++ b/completions/acpi @@ -0,0 +1,22 @@ +# acpi(1) completion -*- shell-script -*- + +_acpi() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --help | --version | -!(-*)[hv]) + return + ;; + --directory | -!(-*)d) + _filedir -d + return + ;; + esac + + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) +} && + complete -F _acpi acpi + +# ex: filetype=sh diff --git a/completions/add_members b/completions/add_members new file mode 100644 index 0000000..efa4f1e --- /dev/null +++ b/completions/add_members @@ -0,0 +1,31 @@ +# mailman add_members completion -*- shell-script -*- + +_add_members() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + -r | -d | --regular-members-file | --digest-members-file) + _filedir + return + ;; + -w | -a | --welcome-msg | --admin-notify) + COMPREPLY=($(compgen -W 'y n' -- "$cur")) + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '--regular-members-file --digest-members-file + --welcome-msg --admin-notify --help' -- "$cur")) + else + _xfunc list_lists _mailman_lists + fi + +} && + complete -F _add_members add_members + +# ex: filetype=sh diff --git a/completions/alias b/completions/alias new file mode 100644 index 0000000..92211d8 --- /dev/null +++ b/completions/alias @@ -0,0 +1,20 @@ +# bash alias completion -*- shell-script -*- + +_alias() +{ + local cur prev words cword + _init_completion -n = || return + + case ${words[@]} in + *[^=]) + COMPREPLY=($(compgen -A alias -- "$cur")) + ;; + *=) + COMPREPLY=("$(alias ${cur%=} 2>/dev/null | command sed \ + -e 's|^alias '"$cur"'\(.*\)$|\1|')") + ;; + esac +} && + complete -F _alias -o nospace alias + +# ex: filetype=sh diff --git a/completions/ant b/completions/ant new file mode 100644 index 0000000..197c0e9 --- /dev/null +++ b/completions/ant @@ -0,0 +1,102 @@ +# 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 =~ \/dev/null && + complete -C complete-ant-cmd.pl -F _ant ant || : + +# ex: filetype=sh diff --git a/completions/apache2ctl b/completions/apache2ctl new file mode 100644 index 0000000..980b3c5 --- /dev/null +++ b/completions/apache2ctl @@ -0,0 +1,16 @@ +# apache2ctl(1) completion -*- shell-script -*- + +_apache2ctl() +{ + local cur prev words cword + _init_completion || return + + local APWORDS + APWORDS=$($1 2>&1 >/dev/null | awk 'NR<2 { print $3; exit }' | + tr "|" " ") + + COMPREPLY=($(compgen -W "$APWORDS" -- "$cur")) +} && + complete -F _apache2ctl apache2ctl + +# ex: filetype=sh diff --git a/completions/appdata-validate b/completions/appdata-validate new file mode 100644 index 0000000..03d8cc9 --- /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 new file mode 100644 index 0000000..713f4c3 --- /dev/null +++ b/completions/apt-build @@ -0,0 +1,54 @@ +# Debian apt-build(1) completion -*- shell-script -*- + +_apt_build() +{ + local cur prev words cword + _init_completion || return + + local special i + for ((i = 1; i < ${#words[@]} - 1; i++)); do + if [[ ${words[i]} == @(install|remove|source|info|clean) ]]; then + special=${words[i]} + break + fi + done + + if [[ -v special ]]; then + case $special in + install | source | info) + COMPREPLY=($(_xfunc apt-cache _apt_cache_packages)) + ;; + remove) + COMPREPLY=( + $(_xfunc dpkg _comp_dpkg_installed_packages "$cur")) + ;; + esac + return + fi + + case $prev in + --patch | --build-dir | --repository-dir) + _filedir + return + ;; + -h | --help) + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '--help --show-upgraded -u --build-dir + --repository-dir --build-only --build-command --reinstall --rebuild + --remove-builddep --no-wrapper --purge --patch --patch-strip -p + --yes -y --version -v --no-source' -- "$cur")) + + else + COMPREPLY=($(compgen -W 'update upgrade install remove source + dist-upgrade world clean info clean-build update-repository' \ + -- "$cur")) + fi + +} && + complete -F _apt_build apt-build + +# ex: filetype=sh diff --git a/completions/apt-cache b/completions/apt-cache new file mode 100644 index 0000000..61aa07b --- /dev/null +++ b/completions/apt-cache @@ -0,0 +1,85 @@ +# 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() +{ + compgen -W "$(apt-cache dumpavail | + awk '$1 == "Source:" { print $2 }' | sort -u)" -- "$1" +} + +# List APT source packages +_apt_cache_src_packages() +{ + compgen -W '$(_apt_cache_sources "$cur")' -- "$cur" +} + +_apt_cache() +{ + local cur prev words cword + _init_completion || return + + local special ispecial + if [[ $cur != show ]]; then + for ((ispecial = 1; ispecial < ${#words[@]} - 1; ispecial++)); do + if [[ ${words[ispecial]} == @(add|depends|dotty|madison|policy|rdepends|show?(pkg|src|)) ]]; then + special=${words[ispecial]} + break + fi + done + fi + + if [[ -v special && $ispecial -lt $cword ]]; then + case $special in + add) + _filedir + ;; + + showsrc) + COMPREPLY=($(_apt_cache_sources "$cur")) + ;; + + *) + COMPREPLY=($(_apt_cache_packages)) + ;; + + esac + return + fi + + case $prev in + --config-file | --pkg-cache | --src-cache | -!(-*)[cps]) + _filedir + return + ;; + search) + if [[ $cur != -* ]]; then + return + fi + ;; + esac + + if [[ $cur == -* ]]; then + + COMPREPLY=($(compgen -W '-h -v -p -s -q -i -f -a -g -c -o --help + --version --pkg-cache --src-cache --quiet --important --full + --all-versions --no-all-versions --generate --no-generate + --names-only --all-names --recurse --config-file --option + --installed' -- "$cur")) + elif [[ ! -v special ]]; then + + COMPREPLY=($(compgen -W 'add gencaches show showpkg showsrc stats + dump dumpavail unmet search search depends rdepends pkgnames + dotty xvcg policy madison' -- "$cur")) + + fi + +} && + complete -F _apt_cache apt-cache + +# ex: filetype=sh diff --git a/completions/apt-get b/completions/apt-get new file mode 100644 index 0000000..4aee263 --- /dev/null +++ b/completions/apt-get @@ -0,0 +1,104 @@ +# Debian apt-get(8) completion -*- shell-script -*- + +_apt_get() +{ + local cur prev words cword package + _init_completion -n ':=' || return + + local special i + for ((i = 1; i < ${#words[@]} - 1; i++)); do + if [[ ${words[i]} == @(install|remove|autoremove|purge|source|build-dep|download|changelog) ]]; then + special=${words[i]} + break + fi + done + + if [[ -v special ]]; then + case $special in + remove | autoremove | purge) + if [[ -f /etc/debian_version ]]; then + # Debian system + COMPREPLY=($( + _xfunc dpkg _comp_dpkg_installed_packages $cur + )) + else + # assume RPM based + _xfunc rpm _rpm_installed_packages + fi + ;; + source) + COMPREPLY=($(_xfunc apt-cache _apt_cache_packages) + $(compgen -W "$(apt-cache dumpavail | + awk '$1 == "Source:" { print $2 }' | sort -u)" -- "$cur")) + ;; + install) + if [[ $cur == */* ]]; then + _filedir deb + return + elif [[ $cur == *=* ]]; then + package="${cur%%=*}" + cur="${cur#*=}" + COMPREPLY=($(IFS=$'\n' compgen -W "$( + apt-cache --no-generate madison "$package" 2>/dev/null | + while IFS=' |' read -r _ version _; do + echo "$version" + done + )" \ + -- "$cur")) + __ltrim_colon_completions "$cur" + return + fi + ;;& + build-dep) + _filedir -d + [[ $cur != */* ]] || return + ;;& + *) + COMPREPLY+=($(_xfunc apt-cache _apt_cache_packages)) + ;; + esac + return + fi + + case $prev in + --help | --version | --option | -!(-*)[hvo]) + return + ;; + --config-file | -!(-*)c) + _filedir + return + ;; + --target-release | --default-release | -!(-*)t) + COMPREPLY=($(compgen -W "$(apt-cache policy | command sed -ne \ + 's/^ *release.*[ ,]o=\(Debian\|Ubuntu\),a=\(\w*\).*/\2/p')" \ + -- "$cur")) + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '--no-install-recommends --install-suggests + --download-only --fix-broken --ignore-missing --fix-missing + --no-download --quiet --simulate --just-print --dry-run --recon + --no-act --yes --assume-yes --assume-no --no-show-upgraded + --verbose-versions --host-architecture --build-profiles --compile + --build --ignore-hold --with-new-pkgs --no-upgrade --only-upgrade + --allow-downgrades --allow-remove-essential + --allow-change-held-packages --force-yes --print-uris --purge + --reinstall --list-cleanup --target-release --default-release + --trivial-only --no-remove --auto-remove --autoremove --only-source + --diff-only --dsc-only --tar-only --arch-only --indep-only + --allow-unauthenticated --no-allow-insecure-repositories + --allow-releaseinfo-change --show-progress --with-source --help + --version --config-file --option' -- "$cur")) + else + COMPREPLY=($(compgen -W 'update upgrade dist-upgrade + dselect-upgrade install remove purge source build-dep check + download clean autoclean autoremove changelog indextargets' \ + -- "$cur")) + fi + +} && + complete -F _apt_get apt-get + +# ex: filetype=sh diff --git a/completions/aptitude b/completions/aptitude new file mode 100644 index 0000000..e5ea163 --- /dev/null +++ b/completions/aptitude @@ -0,0 +1,119 @@ +# Debian aptitude(1) completion -*- shell-script -*- + +_have grep-status && { + _comp_dpkg_hold_packages() + { + grep-status -P -e "^$1" -a -FStatus 'hold' -n -s Package + } +} || { + _comp_dpkg_hold_packages() + { + command grep -B 2 'hold' /var/lib/dpkg/status | + awk "/Package: $1/ { print \$2 }" + } +} + +_aptitude() +{ + local cur prev words cword + _init_completion || return + + local special i + for ((i = 1; i < ${#words[@]} - 1; i++)); do + 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]} + break + fi + done + + if [[ -v special ]]; then + 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 | upgrade | update | keep-all) + return + ;; + -!(-*)S) + _filedir + return + ;; + --display-format | --width | -!(-*)[wFo]) + return + ;; + --sort | -!(-*)O) + COMPREPLY=($(compgen -W 'installsize installsizechange debsize + name priority version' -- "$cur")) + return + ;; + --target-release | --default-release | -!(-*)t) + 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 + local opts=" $($1 --help 2>&1 | command sed -e \ + 's/--with(out)-recommends/--without-recommends\n--with-recommends/' | + _parse_help - | tr '\n' ' ') " + + # Exclude some mutually exclusive options + for i in "${words[@]}"; do + [[ $i == -u ]] && opts=${opts/ -i / } + [[ $i == -i ]] && opts=${opts/ -u / } + done + + # Do known short -> long replacements; at least up to 0.8.12, --help + # outputs mostly only short ones. + COMPREPLY=($opts) + for i in "${!COMPREPLY[@]}"; do + case ${COMPREPLY[i]} in + -h) COMPREPLY[i]=--help ;; + -s) COMPREPLY[i]=--simulate ;; + -d) COMPREPLY[i]=--download-only ;; + -P) COMPREPLY[i]=--prompt ;; + -y) COMPREPLY[i]=--assume-yes ;; + -F) COMPREPLY[i]=--display-format ;; + -O) COMPREPLY[i]=--sort ;; + -W) COMPREPLY[i]=--show-why ;; + -w) COMPREPLY[i]=--width ;; + -V) COMPREPLY[i]=--show-versions ;; + -D) COMPREPLY[i]=--show-deps ;; + -v) COMPREPLY[i]=--verbose ;; + -t) COMPREPLY[i]=--target-release ;; + -q) COMPREPLY[i]=--quiet ;; + esac + done + + COMPREPLY=($(compgen -W '${COMPREPLY[@]}' -- "$cur")) + else + COMPREPLY=($(compgen -W 'update upgrade safe-upgrade forget-new + clean autoclean install reinstall remove hold unhold purge markauto + unmarkauto why why-not dist-upgrade full-upgrade download search + show forbid-version changelog keep keep-all build-dep add-user-tag + remove-user-tag versions' -- "$cur")) + fi + +} && + complete -F _aptitude -o default aptitude aptitude-curses + +# ex: filetype=sh diff --git a/completions/arch b/completions/arch new file mode 100644 index 0000000..afeed05 --- /dev/null +++ b/completions/arch @@ -0,0 +1,46 @@ +# mailman arch completion -*- shell-script -*- + +# Try to detect whether this is the mailman "arch" to avoid installing +# it for the coreutils/util-linux-ng one. +_have mailmanctl && + _arch() + { + local cur prev words cword split + _init_completion -s || return + + case $prev in + -w | -g | -d | --welcome-msg | --goodbye-msg | --digest) + COMPREPLY=($(compgen -W 'y n' -- "$cur")) + return + ;; + --file) + _filedir + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + else + local args=$cword + for ((i = 1; i < cword; i++)); do + if [[ ${words[i]} == -* ]]; then + ((args--)) + fi + done + case $args in + 1) + _xfunc list_lists _mailman_lists + ;; + 2) + _filedir + ;; + esac + fi + + } && + complete -F _arch arch + +# ex: filetype=sh diff --git a/completions/arp b/completions/arp new file mode 100644 index 0000000..922e800 --- /dev/null +++ b/completions/arp @@ -0,0 +1,59 @@ +# arp(8) completion -*- shell-script -*- + +_arp() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --device | -!(-*)i) + _available_interfaces -a + return + ;; + --protocol | -!(-*)[Ap]) + # TODO protocol/address family + return + ;; + --file | -!(-*)f) + _filedir + return + ;; + --hw-type | -!(-*)[Ht]) + # TODO: parse from --help output? + COMPREPLY=($(compgen -W 'ash ether ax25 netrom rose arcnet \ + dlci fddi hippi irda x25 eui64' -- "$cur")) + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + return + fi + + local args + _count_args "" "@(--device|--protocol|--file|--hw-type|-!(-*)[iApfHt])" + case $args in + 1) + local ips=$("$1" -an | command sed -ne \ + 's/.*(\([0-9]\{1,3\}\(\.[0-9]\{1,3\}\)\{3\}\)).*/\1/p') + COMPREPLY=($(compgen -W '$ips' -- "$cur")) + ;; + 2) + # TODO if -d mode: "pub"; if not -f mode: hw_addr + # TODO hw_addr is a configured interface with --use-device/-*D* + ;; + 3) + # TODO netmask|pub|temp if -s mode + ;; + 4) + # TODO netmask value if previous was "netmask" + ;; + 5) + # TODO "pub" if 3rd was "netmask" + ;; + esac +} && + complete -F _arp arp + +# ex: filetype=sh diff --git a/completions/arping b/completions/arping new file mode 100644 index 0000000..57e1e19 --- /dev/null +++ b/completions/arping @@ -0,0 +1,31 @@ +# arping(8) completion -*- shell-script -*- + +_arping() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -*c | -*w) + return + ;; + -*I) + _available_interfaces -a + return + ;; + -*s) + _ip_addresses + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1" -h)' -- "$cur")) + return + fi + + _known_hosts_real -- "$cur" +} && + complete -F _arping arping + +# ex: filetype=sh diff --git a/completions/arpspoof b/completions/arpspoof new file mode 100644 index 0000000..d1a1373 --- /dev/null +++ b/completions/arpspoof @@ -0,0 +1,28 @@ +# arpspoof completion -*- shell-script -*- + +_arpspoof() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -i) + _available_interfaces -a + return + ;; + -t) + _known_hosts_real -- "$cur" + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1")' -- "$cur")) + else + _known_hosts_real -- "$cur" + fi + +} && + complete -F _arpspoof arpspoof + +# ex: filetype=sh diff --git a/completions/asciidoc b/completions/asciidoc new file mode 100644 index 0000000..1ea4abf --- /dev/null +++ b/completions/asciidoc @@ -0,0 +1,52 @@ +# asciidoc(1) completion -*- shell-script -*- + +_asciidoc_doctype() +{ + COMPREPLY+=($(compgen -W 'article book manpage' -- "$cur")) +} + +_asciidoc() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + --attribute | -!(-*)a) + return + ;; + --backend | -!(-*)b) + COMPREPLY=($(compgen -W 'docbook html4 xhtml11' -- "$cur")) + return + ;; + --conf-file | -!(-*)f) + _filedir conf + return + ;; + --doctype | -!(-*)d) + _asciidoc_doctype + return + ;; + --help | -!(-*)h) + COMPREPLY=($(compgen -W 'manpage syntax topics' -- "$cur")) + return + ;; + --out-file | -!(-*)o) + _filedir + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1" "--help manpage")' \ + -- "$cur")) + [[ ${COMPREPLY-} == *= ]] && compopt -o nospace + return + fi + + _filedir +} && + complete -F _asciidoc asciidoc asciidoc.py + +# ex: filetype=sh diff --git a/completions/aspell b/completions/aspell new file mode 100644 index 0000000..e080a07 --- /dev/null +++ b/completions/aspell @@ -0,0 +1,88 @@ +# bash completion for aspell -*- shell-script -*- + +_aspell_dictionary() +{ + 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=($(printf '%s\n' $datadir/*.alias)) + COMPREPLY=("${COMPREPLY[@]%.alias}") + COMPREPLY=("${COMPREPLY[@]#$datadir/}") + # Then, add the canonical dicts + COMPREPLY+=($($aspell dicts 2>/dev/null)) + COMPREPLY=($(compgen -X '\*' -W '${COMPREPLY[@]}' -- "$cur")) +} + +_aspell() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + -c | -p | check | --conf | --personal | --repl | --per-conf) + _filedir + return + ;; + --conf-dir | --data-dir | --dict-dir | --home-dir | --local-data-dir | --prefix) + _filedir -d + return + ;; + dump | create | merge) + COMPREPLY=($(compgen -W 'master personal repl' -- "$cur")) + return + ;; + --mode) + COMPREPLY=($(compgen -W "$($1 modes 2>/dev/null | + awk '{ print $1 }')" -- "$cur")) + return + ;; + --sug-mode) + COMPREPLY=($(compgen -W 'ultra fast normal bad-speller' \ + -- "$cur")) + return + ;; + --keymapping) + COMPREPLY=($(compgen -W 'aspell ispell' -- "$cur")) + return + ;; + -d | --master) + _aspell_dictionary "$1" + return + ;; + --add-filter | --rem-filter) + COMPREPLY=($(compgen -W "$($1 filters 2>/dev/null | + awk '{ print $1 }')" -- "$cur")) + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '--conf= --conf-dir= --data-dir= --dict-dir= + --encoding= --add-filter= --rem-filter= --mode= --add-extra-dicts= + --rem-extra-dicts= --home-dir= --ignore= --ignore-accents + --dont-ignore-accents --ignore-case --dont-ignore-case + --ignore-repl --dont-ignore-repl --jargon --keyboard= --lang= + --language-tag --local-data-dir= --master= --module + --add-module-search-order --rem-module-search-order --per-conf= + --personal= --prefix= --repl= --run-together --dont-run-together + --run-together-limit= --run-together-min= --save-repl + --dont-save-repl --set-prefix --dont-set-prefix --size= --spelling + --strip-accents --dont-strip-accents --sug-mode= + --add-word-list-path --rem-word-list-path --backup --dont-backup + --reverse --dont-reverse --time --dont-time --keymapping= + --add-email-quote= --rem-email-quote= --email-margin= + --add-tex-command= --rem-tex-command= --tex-check-comments + --dont-tex-check-comments --add-tex-extension --rem-tex-extension + --add-sgml-check= --rem-sgml-check= --add-sgml-extension + --rem-sgml-extension' -- "$cur")) + [[ ${COMPREPLY-} == *= ]] && compopt -o nospace + else + COMPREPLY=($(compgen -W 'usage help check pipe list config soundslike + filter version dump create merge' -- "$cur")) + fi +} && + complete -F _aspell aspell + +# ex: filetype=sh diff --git a/completions/autoconf b/completions/autoconf new file mode 100644 index 0000000..b51e797 --- /dev/null +++ b/completions/autoconf @@ -0,0 +1,40 @@ +# autoconf(1) completion -*- shell-script -*- + +_autoconf() +{ + local cur prev words cword split + _init_completion -s || return + + case "$prev" in + --help | -h | --version | -V | --trace | -t) + return + ;; + --output | -o) + _filedir + return + ;; + --warnings | -W) + local cats=(cross obsolete syntax) + COMPREPLY=($(compgen -W \ + '${cats[@]} ${cats[@]/#/no-} all none error' -- "$cur")) + return + ;; + --prepend-include | -B | --include | -I) + _filedir -d + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + [[ ${COMPREPLY-} == *= ]] && compopt -o nospace + return + fi + + _filedir '@(ac|in)' +} && + complete -F _autoconf autoconf + +# ex: filetype=sh diff --git a/completions/automake b/completions/automake new file mode 100644 index 0000000..5fe5f4f --- /dev/null +++ b/completions/automake @@ -0,0 +1,36 @@ +# automake(1) completion -*- shell-script -*- + +_automake() +{ + local cur prev words cword split + _init_completion -s || return + + case "$prev" in + --help | --version) + return + ;; + --warnings | -W) + local cats=(gnu obsolete override portability syntax unsupported) + COMPREPLY=($(compgen -W \ + '${cats[@]} ${cats[@]/#/no-} all none error' -- "$cur")) + return + ;; + --libdir) + _filedir -d + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + [[ ${COMPREPLY-} == *= ]] && compopt -o nospace + return + fi + + _filedir +} && + complete -F _automake automake automake-1.1{0..6} + +# ex: filetype=sh diff --git a/completions/autoreconf b/completions/autoreconf new file mode 100644 index 0000000..9b0f0dc --- /dev/null +++ b/completions/autoreconf @@ -0,0 +1,41 @@ +# autoreconf(1) completion -*- shell-script -*- + +_autoreconf() +{ + local cur prev words cword split + _init_completion -s || return + + case "$prev" in + --help | -h | --version | -V) + return + ;; + --warnings | -W) + local cats=(cross gnu obsolete override portability syntax + unsupported) + COMPREPLY=($(compgen -W \ + '${cats[@]} ${cats[@]/#/no-} all none error' -- "$cur")) + return + ;; + --prepend-include | -B | --include | -I) + _filedir -d + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + [[ ${COMPREPLY-} == *= ]] && compopt -o nospace + return + fi + + if [[ $1 == *autoheader ]]; then + _filedir '@(ac|in)' + else + _filedir -d + fi +} && + complete -F _autoreconf autoreconf autoheader + +# ex: filetype=sh diff --git a/completions/autorpm b/completions/autorpm new file mode 100644 index 0000000..d55322a --- /dev/null +++ b/completions/autorpm @@ -0,0 +1,14 @@ +# autorpm(8) completion -*- shell-script -*- + +_autorpm() +{ + local cur prev words cword + _init_completion || return + + COMPREPLY=($(compgen -W '--notty --debug --help --version auto add + fullinfo info help install list remove set' -- "$cur")) + +} && + complete -F _autorpm autorpm + +# ex: filetype=sh diff --git a/completions/autoscan b/completions/autoscan new file mode 100644 index 0000000..e007143 --- /dev/null +++ b/completions/autoscan @@ -0,0 +1,34 @@ +# autoscan(1) completion -*- shell-script -*- + +_autoscan() +{ + local cur prev words cword split + _init_completion -s || return + + case "$prev" in + --help | --version | -!(-*)[hV]) + return + ;; + --prepend-include | --include | -!(-*)[BI]) + _filedir -d + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + [[ ${COMPREPLY-} == *= ]] && compopt -o nospace + return + fi + + if [[ $1 == *autoupdate ]]; then + _filedir '@(ac|in)' + else + _filedir -d + fi +} && + complete -F _autoscan autoscan autoupdate + +# ex: filetype=sh diff --git a/completions/avctrl b/completions/avctrl new file mode 100644 index 0000000..89c24e4 --- /dev/null +++ b/completions/avctrl @@ -0,0 +1,20 @@ +# avctrl completion -*- shell-script -*- + +_avctrl() +{ + local cur prev words cword + _init_completion || return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '--help --quiet' -- "$cur")) + else + local args + _count_args + if ((args == 1)); then + COMPREPLY=($(compgen -W 'discover switch' -- "$cur")) + fi + fi +} && + complete -F _avctrl avctrl + +# ex: filetype=sh diff --git a/completions/badblocks b/completions/badblocks new file mode 100644 index 0000000..29c4e00 --- /dev/null +++ b/completions/badblocks @@ -0,0 +1,29 @@ +# badblocks(8) completion -*- shell-script -*- + +_badblocks() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -*[bcedpt]) + return + ;; + -*[io]) + _filedir + return + ;; + esac + + if [[ $cur == -* ]]; then + # Filter out -w (dangerous) and -X (internal use) + COMPREPLY=($(compgen -X -[wX] -W '$(_parse_usage "$1")' -- "$cur")) + return + fi + + cur=${cur:=/dev/} + _filedir +} && + complete -F _badblocks badblocks + +# ex: filetype=sh diff --git a/completions/bind b/completions/bind new file mode 100644 index 0000000..2ee428b --- /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 + -*[lpPsSvVrxX]) + return + ;; + -*m) + COMPREPLY=($(compgen -W "emacs emacs-standard emacs-meta + emacs-ctlx vi vi-move vi-command vi-insert" -- "$cur")) + return + ;; + -*f) + _filedir + return + ;; + -*[qu]) + 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 new file mode 100644 index 0000000..4e4d140 --- /dev/null +++ b/completions/bk @@ -0,0 +1,18 @@ +# BitKeeper completion -*- shell-script -*- +# adapted from code by Bart Trojanowski + +_bk() +{ + local cur prev words cword + _init_completion || return + + local BKCMDS="$(bk help topics 2>/dev/null | + awk '/^ bk/ { print $2 }' | xargs printf '%s ')" + + COMPREPLY=($(compgen -W "$BKCMDS" -- "$cur")) + _filedir + +} && + complete -F _bk bk + +# ex: filetype=sh diff --git a/completions/brctl b/completions/brctl new file mode 100644 index 0000000..14569b6 --- /dev/null +++ b/completions/brctl @@ -0,0 +1,40 @@ +# bash completion for brctl -*- shell-script -*- + +_brctl() +{ + local cur prev words cword + _init_completion || return + + local command=${words[1]} + + case $cword in + 1) + COMPREPLY=($(compgen -W "addbr delbr addif delif setageing + setbridgeprio setfd sethello setmaxage setpathcost setportprio + show showmacs showstp stp" -- "$cur")) + ;; + 2) + case $command in + show) ;; + + *) + COMPREPLY=($(compgen -W "$($1 show | + awk 'NR>1 {print $1}')" -- "$cur")) + ;; + esac + ;; + 3) + case $command in + addif | delif) + _configured_interfaces + ;; + stp) + COMPREPLY=($(compgen -W 'on off' -- "$cur")) + ;; + esac + ;; + esac +} && + complete -F _brctl -o default brctl + +# ex: filetype=sh diff --git a/completions/btdownloadheadless.py b/completions/btdownloadheadless.py new file mode 100644 index 0000000..a470e53 --- /dev/null +++ b/completions/btdownloadheadless.py @@ -0,0 +1,32 @@ +# btdownloadheadless(1) completion -*- shell-script -*- + +_btdownload() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --responsefile | --saveas) + _filedir + return + ;; + esac + + 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 + --timeout_check_interval --max_slice_length --max_rate_period + --bind --upload_rate_fudge --display_interval --rerequest_interval + --min_peers --http_timeout --max_initiate --max_allow_in + --check_hashes --max_upload_rate --snub_time --spew + --rarest_first_cutoff --min_uploads --report_hash_failures' \ + -- "$cur")) + else + _filedir + fi +} && + complete -F _btdownload btdownloadheadless.py btdownloadcurses.py \ + btdownloadgui.py + +# ex: filetype=sh diff --git a/completions/bts b/completions/bts new file mode 100644 index 0000000..d535d13 --- /dev/null +++ b/completions/bts @@ -0,0 +1,112 @@ +# 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 new file mode 100644 index 0000000..40e50fe --- /dev/null +++ b/completions/bzip2 @@ -0,0 +1,42 @@ +# bash completion for bzip2 -*- shell-script -*- + +_bzip2() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --help | -!(-*)[bhp]) + return + ;; + -!(-*)n) + COMPREPLY=($(compgen -W "{1..$(_ncpus)}" -- "$cur")) + return + ;; + esac + + if [[ $cur == -* ]]; then + local helpopts=$(_parse_help "$1") + COMPREPLY=($(compgen -W "${helpopts//#/} -2 -3 -4 -5 -6 -7 -8 -9" \ + -- "$cur")) + return + fi + + local IFS=$'\n' xspec="*.?(t)bz2" + + if [[ $prev == --* ]]; then + [[ $prev == --@(decompress|list|test) ]] && xspec="!"$xspec + [[ $prev == --compress ]] && xspec= + elif [[ $prev == -* ]]; then + [[ $prev == -*[dt]* ]] && xspec="!"$xspec + [[ $prev == -*z* ]] && xspec= + fi + + _tilde "$cur" || return + + compopt -o filenames + COMPREPLY=($(compgen -f -X "$xspec" -- "$cur") $(compgen -d -- "$cur")) +} && + complete -F _bzip2 bzip2 pbzip2 lbzip2 + +# ex: filetype=sh diff --git a/completions/cancel b/completions/cancel new file mode 100644 index 0000000..3e0c1d5 --- /dev/null +++ b/completions/cancel @@ -0,0 +1,27 @@ +# cancel(1) completion -*- shell-script -*- + +_cancel() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -h) + _known_hosts_real -- "$cur" + return + ;; + -U) + return + ;; + -u) + COMPREPLY=($(compgen -u -- "$cur")) + return + ;; + esac + + COMPREPLY=($(compgen -W \ + "$(lpstat 2>/dev/null | cut -d' ' -f1)" -- "$cur")) +} && + complete -F _cancel cancel + +# ex: filetype=sh diff --git a/completions/cardctl b/completions/cardctl new file mode 100644 index 0000000..bb3a0db --- /dev/null +++ b/completions/cardctl @@ -0,0 +1,15 @@ +# Linux cardctl(8) completion -*- shell-script -*- + +_cardctl() +{ + local cur prev words cword + _init_completion || return + + if ((cword == 1)); then + COMPREPLY=($(compgen -W 'status config ident suspend resume reset + eject insert scheme' -- "$cur")) + fi +} && + complete -F _cardctl cardctl pccardctl + +# ex: filetype=sh diff --git a/completions/carton b/completions/carton new file mode 100644 index 0000000..5d700c8 --- /dev/null +++ b/completions/carton @@ -0,0 +1,81 @@ +# carton(3pm) completion -*- shell-script -*- + +_carton_commands() +{ + local cmds=$("${1:-carton}" usage 2>&1 | + command sed -ne '/.*command.* is one of/{n;p;q;}') + COMPREPLY+=($(IFS="$IFS," compgen -W "$cmds" -- "$cur")) +} + +_carton_command_help() +{ + local help=$(PERLDOC_PAGER=cat PERLDOC=-otext "${1:-carton}" -h $2 2>&1) + COMPREPLY+=($(compgen -W '$help' -- "$cur")) +} + +_carton() +{ + local cur prev words cword split + _init_completion -s || return + + local i command + for ((i = 1; i < cword; i++)); do + case ${words[i]} in + -*) ;; + *) + command=${words[i]} + break + ;; + esac + done + + if [[ ! -v command ]]; then + _carton_commands "$1" + return + fi + + case $prev in + --version | -v) + return + ;; + --help | -h) + [[ -n $command ]] || _carton_commands "$1" + return + ;; + --cpanfile) + if [[ $command == install ]]; then + _filedir + return + fi + ;; + --path) + if [[ $command == install ]]; then + _filedir -d + return + fi + ;; + --without) + if [[ $command == install ]]; then + local phases="configure build test runtime develop" + COMPREPLY+=($(compgen -W '$phases' -- "$cur")) + return + fi + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + [[ $command == @(help|usage) ]] || COMPREPLY=(--help) + _carton_command_help "$1" $command + fi + + case $command in + show | update) + : # TODO modules completion + ;; + esac +} && + complete -F _carton carton + +# ex: filetype=sh diff --git a/completions/ccache b/completions/ccache new file mode 100644 index 0000000..80c39de --- /dev/null +++ b/completions/ccache @@ -0,0 +1,38 @@ +# ccache(1) completion -*- shell-script -*- + +_ccache() +{ + local cur prev words cword split + _init_completion -s || return + + 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 + --help | --version | --max-files | --max-size | -!(-*)[hVFM]) + return + ;; + --set-config | -!(-*)o) + 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 + + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + [[ ${COMPREPLY-} == *= ]] && compopt -o nospace +} && + complete -F _ccache ccache + +# ex: filetype=sh diff --git a/completions/ccze b/completions/ccze new file mode 100644 index 0000000..35f4c3f --- /dev/null +++ b/completions/ccze @@ -0,0 +1,44 @@ +# ccze(1) completion -*- shell-script -*- + +_ccze() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + -'?' | --help | --usage | -V | --version) + return + ;; + --argument | --color | -!(-*)[ac]) + # TODO? + return + ;; + --rcfile | -!(-*)F) + _filedir + return + ;; + --mode | -!(-*)m) + COMPREPLY=($(compgen -W "curses ansi html" -- "$cur")) + return + ;; + --option | -!(-*)o) + local -a opts=(scroll wordcolor lookups transparent cssfile) + COMPREPLY=($(compgen -W '${opts[@]} ${opts[@]/#/no}' -- "$cur")) + return + ;; + --plugin | -!(-*)p) + COMPREPLY=($(compgen -W '$("$1" --list-plugins | command \ + sed -ne "s/^\([a-z0-9]\{1,\}\)[[:space:]]\{1,\}|.*/\1/p")' \ + -- "$cur")) + return + ;; + esac + + $split && return + + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + [[ ${COMPREPLY-} == *= ]] && compopt -o nospace +} && + complete -F _ccze ccze + +# ex: filetype=sh diff --git a/completions/cfagent b/completions/cfagent new file mode 100644 index 0000000..e7ba04d --- /dev/null +++ b/completions/cfagent @@ -0,0 +1,21 @@ +# cfagent completion -*- shell-script -*- + +_cfagent() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -f | --file) + _filedir + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + fi +} && + complete -F _cfagent cfagent + +# ex: filetype=sh diff --git a/completions/cfrun b/completions/cfrun new file mode 100644 index 0000000..72b6138 --- /dev/null +++ b/completions/cfrun @@ -0,0 +1,47 @@ +# cfrun completion -*- shell-script -*- + +_cfrun() +{ + local cur prev words cword + _init_completion || return + + local i section=1 + for ((i = 1; i < cword; i++)); do + if [[ ${words[i]} == -- ]]; then + ((section++)) + fi + done + + case $section in + 1) + case $prev in + -f) + _filedir + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '-f -h -d -S -T -v' -- "$cur")) + else + local hostfile=${CFINPUTS:-/var/lib/cfengine/inputs}/cfrun.hosts + for ((i = 1; i < cword; i++)); do + if [[ ${words[i]} == -f ]]; then + hostfile=${words[i + 1]} + break + fi + done + [[ ! -f $hostfile ]] && return + + COMPREPLY=($(compgen -W "$(command grep -v \ + -E '(=|^$|^#)' $hostfile)" -- "$cur")) + fi + ;; + 2) + COMPREPLY=($(compgen -W '$(_parse_help cfagent)' -- "$cur")) + ;; + esac +} && + complete -F _cfrun cfrun + +# ex: filetype=sh diff --git a/completions/chage b/completions/chage new file mode 100644 index 0000000..fcf87cd --- /dev/null +++ b/completions/chage @@ -0,0 +1,30 @@ +# chage(1) completion -*- shell-script -*- + +_chage() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + --lastday | --expiredate | --help | --inactive | --mindays | --maxdays | \ + --warndays | -!(-*)[dEhImMW]) + return + ;; + --root | -!(-*)R) + _filedir -d + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + return + fi + + COMPREPLY=($(compgen -u -- "$cur")) +} && + complete -F _chage chage + +# ex: filetype=sh diff --git a/completions/change_pw b/completions/change_pw new file mode 100644 index 0000000..04837ea --- /dev/null +++ b/completions/change_pw @@ -0,0 +1,25 @@ +# mailman change_pw completion -*- shell-script -*- + +_change_pw() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + -l | --listname) + _xfunc list_lists _mailman_lists + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '--all --domain --listname --password --quiet + --help' -- "$cur")) + fi + +} && + complete -F _change_pw change_pw + +# ex: filetype=sh diff --git a/completions/check_db b/completions/check_db new file mode 100644 index 0000000..aaec99f --- /dev/null +++ b/completions/check_db @@ -0,0 +1,17 @@ +# mailman check_db completion -*- shell-script -*- + +_check_db() +{ + local cur prev words cword + _init_completion || return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '--all --verbose --help' -- "$cur")) + else + _xfunc list_lists _mailman_lists + fi + +} && + complete -F _check_db check_db + +# ex: filetype=sh diff --git a/completions/check_perms b/completions/check_perms new file mode 100644 index 0000000..8ff276e --- /dev/null +++ b/completions/check_perms @@ -0,0 +1,15 @@ +# mailman check_perms completion -*- shell-script -*- + +_check_perms() +{ + local cur prev words cword + _init_completion || return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '-f -v -h' -- "$cur")) + fi + +} && + complete -F _check_perms check_perms + +# ex: filetype=sh diff --git a/completions/checksec b/completions/checksec new file mode 100644 index 0000000..fc2fef7 --- /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 new file mode 100644 index 0000000..4793a45 --- /dev/null +++ b/completions/chgrp @@ -0,0 +1,39 @@ +# chgrp(1) completion -*- shell-script -*- + +_chgrp() +{ + local cur prev words cword split + _init_completion -s || return + + cur=${cur//\\\\/} + + if [[ $prev == --reference ]]; then + _filedir + return + fi + + $split && return + + # options completion + if [[ $cur == -* ]]; then + local w opts + for w in "${words[@]}"; do + [[ $w == -@(R|-recursive) ]] && opts="-H -L -P" && break + done + COMPREPLY=($(compgen -W '-c -h -f -R -v --changes --dereference + --no-dereference --silent --quiet --reference --recursive --verbose + --help --version $opts' -- "$cur")) + return + fi + + # first parameter on line or first since an option? + if [[ $cword -eq 1 && $cur != -* || $prev == -* ]]; then + _allowed_groups "$cur" + else + _filedir + fi + +} && + complete -F _chgrp chgrp + +# ex: filetype=sh diff --git a/completions/chkconfig b/completions/chkconfig new file mode 100644 index 0000000..8ff6637 --- /dev/null +++ b/completions/chkconfig @@ -0,0 +1,37 @@ +# chkconfig(8) completion -*- shell-script -*- + +_chkconfig() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + --level=[1-6] | [1-6] | --list | --add | --del | --override) + _services + _xinetd_services + return + ;; + --level) + COMPREPLY=($(compgen -W '{1..6}' -- "$cur")) + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '--list --add --del --override --level' \ + -- "$cur")) + else + if ((cword == 2 || cword == 4)); then + COMPREPLY=($(compgen -W 'on off reset resetpriorities' \ + -- "$cur")) + else + _services + _xinetd_services + fi + fi +} && + complete -F _chkconfig chkconfig + +# ex: filetype=sh diff --git a/completions/chmod b/completions/chmod new file mode 100644 index 0000000..d3fc349 --- /dev/null +++ b/completions/chmod @@ -0,0 +1,41 @@ +# chmod(1) completion -*- shell-script -*- + +_chmod() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + --help | --version) + return + ;; + --reference) + _filedir + return + ;; + esac + + $split && return + + # Adapted from coreutils 8.28 chmod man page + local modearg="-@(@(+([rwxXst])|[ugo])|+([0-7]))" + + # shellcheck disable=SC2053 + if [[ $cur == -* && $cur != $modearg ]]; then + local opts=$(_parse_help "$1") + COMPREPLY=($(compgen -W '${opts:-$(_parse_usage "$1")}' -- "$cur")) + [[ ${COMPREPLY-} == *= ]] && compopt -o nospace + return + fi + + local args + _count_args "" "" "$modearg" + + case $args in + 1) ;; # mode + *) _filedir ;; + esac +} && + complete -F _chmod chmod + +# ex: filetype=sh diff --git a/completions/chown b/completions/chown new file mode 100644 index 0000000..1d746b7 --- /dev/null +++ b/completions/chown @@ -0,0 +1,46 @@ +# chown(1) completion -*- shell-script -*- + +_chown() +{ + local cur prev words cword split + # Don't treat user:group as separate words. + _init_completion -s -n : || return + + case "$prev" in + --from) + _usergroup + return + ;; + --reference) + _filedir + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + # Complete -options + local w opts + for w in "${words[@]}"; do + [[ $w == -@(R|-recursive) ]] && opts="-H -L -P" && break + done + COMPREPLY=($(compgen -W '-c -h -f -R -v --changes --dereference + --no-dereference --from --silent --quiet --reference --recursive + --verbose --help --version $opts' -- "$cur")) + else + local args + + # The first argument is an usergroup; the rest are filedir. + _count_args : + + if ((args == 1)); then + _usergroup -u + else + _filedir + fi + fi +} && + complete -F _chown chown + +# ex: filetype=sh diff --git a/completions/chpasswd b/completions/chpasswd new file mode 100644 index 0000000..3abea99 --- /dev/null +++ b/completions/chpasswd @@ -0,0 +1,30 @@ +# chpasswd(8) completion -*- shell-script -*- + +_chpasswd() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + --crypt | -!(-*)c) + COMPREPLY=($(compgen -W 'DES MD5 NONE SHA256 SHA512' \ + -- "$cur")) + return + ;; + --sha-rounds | -!(-*)s) + return + ;; + --root | -!(-*)R) + _filedir -d + return + ;; + esac + + $split && return + + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + [[ ${COMPREPLY-} == *= ]] && compopt -o nospace +} && + complete -F _chpasswd chpasswd + +# ex: filetype=sh diff --git a/completions/chromium-browser b/completions/chromium-browser new file mode 100644 index 0000000..9ee9896 --- /dev/null +++ b/completions/chromium-browser @@ -0,0 +1,50 @@ +# chromium-browser completion -*- shell-script -*- + +_chromium_browser() +{ + local cur prev words cword split + _init_completion -s -n : || return + + case $prev in + --help | --app | --proxy-pac-url | -h) + return + ;; + --user-data-dir) + _filedir -d + return + ;; + --proxy-server) + case $cur in + *://*) + local prefix="${cur%%://*}://" + _known_hosts_real -- "${cur#*://}" + COMPREPLY=("${COMPREPLY[@]/#/$prefix}") + __ltrim_colon_completions "$cur" + ;; + *) + compopt -o nospace + COMPREPLY=($(compgen -S :// -W 'http socks socks4 socks5' -- "$cur")) + ;; + esac + return + ;; + --password-store) + COMPREPLY=($(compgen -W 'basic gnome kwallet' -- "$cur")) + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + [[ ${COMPREPLY-} == *= ]] && compopt -o nospace + return + fi + + _filedir "@(?([mxs])htm?(l)|pdf|txt)" +} && + complete -F _chromium_browser chromium-browser google-chrome \ + google-chrome-stable chromium chrome + +# ex: filetype=sh diff --git a/completions/chronyc b/completions/chronyc new file mode 100644 index 0000000..e6bb8e9 --- /dev/null +++ b/completions/chronyc @@ -0,0 +1,61 @@ +# chronyc(1) completion -*- shell-script -*- + +_chronyc_command_args() +{ + local -a args + 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 + _init_completion || return + + case $prev in + --help | -*p) + return + ;; + -*h) + _known_hosts_real -- "$cur" + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1") -6' -- "$cur")) + return + fi + + local i args + args=0 + 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 '!/(^ |: *$)/ { sub("\\|", " ", $1); print $1 }')" \ + -- "$cur")) + ;; + 1) + _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" + ;; + esac +} && + complete -F _chronyc chronyc + +# ex: filetype=sh diff --git a/completions/chrpath b/completions/chrpath new file mode 100644 index 0000000..2883967 --- /dev/null +++ b/completions/chrpath @@ -0,0 +1,27 @@ +# chrpath(1) completion -*- shell-script -*- + +_chrpath() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --version | --help | -!(-*)[vh]) + return + ;; + --replace | -!(-*)r) + _filedir -d + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + return + fi + + _filedir +} && + complete -F _chrpath chrpath + +# ex: filetype=sh diff --git a/completions/cksfv b/completions/cksfv new file mode 100644 index 0000000..da404dd --- /dev/null +++ b/completions/cksfv @@ -0,0 +1,29 @@ +# cksfv completion by Chris -*- shell-script -*- + +_cksfv() +{ + local cur prev words cword + _init_completion || return + + if ((cword == 1)); then + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + return + fi + + case "$prev" in + -*C | -*g) + _filedir -d + return + ;; + -*f) + _filedir 'sfv' + return + ;; + esac + + _filedir + +} && + complete -F _cksfv cksfv + +# ex: filetype=sh diff --git a/completions/cleanarch b/completions/cleanarch new file mode 100644 index 0000000..0f7d5f5 --- /dev/null +++ b/completions/cleanarch @@ -0,0 +1,16 @@ +# mailman cleanarch completion -*- shell-script -*- + +_cleanarch() +{ + local cur prev words cword + _init_completion || return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '--status --dry-run --quiet --help' \ + -- "$cur")) + fi + +} && + complete -F _cleanarch cleanarch + +# ex: filetype=sh diff --git a/completions/clisp b/completions/clisp new file mode 100644 index 0000000..c4259a0 --- /dev/null +++ b/completions/clisp @@ -0,0 +1,22 @@ +# -*- shell-script -*- +# bash brogrammable completion for various Common Lisp implementations by +# Nikodemus Siivola + +_clisp() +{ + local cur prev words cword + _init_completion || return + + # completing an option (may or may not be separated by a space) + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '-h --help --version --license -B -K -M -m -L + -N -E -q --quiet --silent -w -I -ansi -traditional -p -C -norc -i + -c -l -o -x ' -- "$cur")) + else + _filedir + fi + +} && + complete -F _clisp -o default clisp + +# ex: filetype=sh diff --git a/completions/clone_member b/completions/clone_member new file mode 100644 index 0000000..a3ca2b3 --- /dev/null +++ b/completions/clone_member @@ -0,0 +1,25 @@ +# mailman clone_member completion -*- shell-script -*- + +_clone_member() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + -l | --listname) + _xfunc list_lists _mailman_lists + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '--listname --remove --admin --quiet + --nomodify --help' -- "$cur")) + fi + +} && + complete -F _clone_member clone_member + +# ex: filetype=sh diff --git a/completions/complete b/completions/complete new file mode 100644 index 0000000..a57f366 --- /dev/null +++ b/completions/complete @@ -0,0 +1,49 @@ +# bash complete completion -*- shell-script -*- + +_complete() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -*o) + COMPREPLY=($(compgen -W 'bashdefault default dirnames filenames + nospace plusdirs' -- "$cur")) + return + ;; + + -*A) + COMPREPLY=($(compgen -W 'alias arrayvar binding builtin command + directory disabled enabled export file function group helptopic + hostname job keyword running service setopt shopt signal + stopped user variable' -- "$cur")) + return + ;; + + -*C) + COMPREPLY=($(compgen -A command -- "$cur")) + return + ;; + -*F) + COMPREPLY=($(compgen -A function -- "$cur")) + return + ;; + -*p | -*r) + COMPREPLY=($(complete -p | command sed -e 's|.* ||')) + COMPREPLY=($(compgen -W '${COMPREPLY[@]}' -- "$cur")) + return + ;; + esac + + if [[ $cur == -* ]]; then + # relevant options completion + local opts="-a -b -c -d -e -f -g -j -k -o -s -u -v -A -G -W -P -S -X" + [[ $1 != compgen ]] && opts+=" -F -C" + COMPREPLY=($(compgen -W "$opts" -- "$cur")) + else + COMPREPLY=($(compgen -A command -- "$cur")) + fi +} && + complete -F _complete compgen complete + +# ex: filetype=sh diff --git a/completions/config_list b/completions/config_list new file mode 100644 index 0000000..1807e33 --- /dev/null +++ b/completions/config_list @@ -0,0 +1,27 @@ +# mailman config_list completion -*- shell-script -*- + +_config_list() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + -i | -o | --inputfile | --outputfile) + _filedir + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '--inputfile --outputfile --checkonly + --verbose --help' -- "$cur")) + else + _xfunc list_lists _mailman_lists + fi + +} && + complete -F _config_list config_list + +# ex: filetype=sh diff --git a/completions/configure b/completions/configure new file mode 100644 index 0000000..3f59a01 --- /dev/null +++ b/completions/configure @@ -0,0 +1,42 @@ +# bash completion for configure -*- shell-script -*- + +_configure() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + -h | --help | -V | --version | --program-prefix | --program-suffix | \ + --program-transform-name) + return + ;; + --*file) + _filedir + return + ;; + --*prefix | --*dir) + _filedir -d + return + ;; + esac + + $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 + + if [[ ${COMP_CONFIGURE_HINTS-} ]]; then + COMPREPLY=($(compgen -W "$($1 --help 2>&1 | + awk '/^ --[A-Za-z]/ { print $1; \ + if ($2 ~ /--[A-Za-z]/) print $2 }' | command sed -e 's/[[,].*//g')" \ + -- "$cur")) + [[ ${COMPREPLY-} == *=* ]] && compopt -o nospace + else + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + [[ ${COMPREPLY-} == *= ]] && compopt -o nospace + fi +} && + complete -F _configure configure + +# ex: filetype=sh diff --git a/completions/convert b/completions/convert new file mode 100644 index 0000000..ef7baea --- /dev/null +++ b/completions/convert @@ -0,0 +1,324 @@ +# bash completion for ImageMagick -*- shell-script -*- + +_ImageMagick() +{ + case $prev in + -channel) + COMPREPLY=($(compgen -W 'Red Green Blue Opacity Matte Cyan + Magenta Yellow Black' -- "$cur")) + return + ;; + -colormap) + COMPREPLY=($(compgen -W 'shared private' -- "$cur")) + return + ;; + -colorspace) + COMPREPLY=($(compgen -W 'GRAY OHTA RGB Transparent XYZ YCbCr YIQ + YPbPr YUV CMYK' -- "$cur")) + return + ;; + -compose) + COMPREPLY=($(compgen -W 'Over In Out Atop Xor Plus Minus Add + Subtract Difference Multiply Bumpmap Copy CopyRed CopyGreen + CopyBlue CopyOpacity' -- "$cur")) + return + ;; + -compress) + COMPREPLY=($(compgen -W 'None BZip Fax Group4 JPEG Lossless LZW + RLE Zip' -- "$cur")) + return + ;; + -dispose) + COMPREPLY=($(compgen -W 'Undefined None Background Previous' \ + -- "$cur")) + return + ;; + -encoding) + COMPREPLY=($(compgen -W 'AdobeCustom AdobeExpert AdobeStandard + AppleRoman BIG5 GB2312 Latin2 None SJIScode Symbol Unicode + Wansung' -- "$cur")) + return + ;; + -endian) + COMPREPLY=($(compgen -W 'MSB LSB' -- "$cur")) + return + ;; + -filter) + COMPREPLY=($(compgen -W 'Point Box Triangle Hermite Hanning + Hamming Blackman Gaussian Quadratic Cubic Catrom Mitchell + Lanczos Bessel Sinc' -- "$cur")) + return + ;; + -format) + COMPREPLY=($(compgen -W "$(convert -list format | awk \ + '/ [r-][w-][+-] / { sub("[*]$","",$1); print tolower($1) }')" \ + -- "$cur")) + return + ;; + -gravity) + COMPREPLY=($(compgen -W 'Northwest North NorthEast West Center + East SouthWest South SouthEast' -- "$cur")) + return + ;; + -intent) + COMPREPLY=($(compgen -W 'Absolute Perceptual Relative + Saturation' -- "$cur")) + return + ;; + -interlace) + COMPREPLY=($(compgen -W 'None Line Plane Partition' -- "$cur")) + return + ;; + -limit) + COMPREPLY=($(compgen -W 'Disk File Map Memory' -- "$cur")) + return + ;; + -list) + COMPREPLY=($(compgen -W 'Delegate Format Magic Module Resource + Type' -- "$cur")) + return + ;; + -map) + COMPREPLY=($(compgen -W 'best default gray red green blue' \ + -- "$cur")) + _filedir + return + ;; + -noise) + COMPREPLY=($(compgen -W 'Uniform Gaussian Multiplicative + Impulse Laplacian Poisson' -- "$cur")) + return + ;; + -preview) + COMPREPLY=($(compgen -W 'Rotate Shear Roll Hue Saturation + Brightness Gamma Spiff Dull Grayscale Quantize Despeckle + ReduceNoise AddNoise Sharpen Blur Treshold EdgeDetect Spread + Shade Raise Segment Solarize Swirl Implode Wave OilPaint + CharcoalDrawing JPEG' -- "$cur")) + return + ;; + -mask | -profile | -texture | -tile | -write) + _filedir + return + ;; + -type) + COMPREPLY=($(compgen -W 'Bilevel Grayscale Palette PaletteMatte + TrueColor TrueColorMatte ColorSeparation ColorSeparationlMatte + Optimize' -- "$cur")) + return + ;; + -units) + COMPREPLY=($(compgen -W 'Undefined PixelsPerInch + PixelsPerCentimeter' -- "$cur")) + return + ;; + -virtual-pixel) + COMPREPLY=($(compgen -W 'Constant Edge mirror tile' -- "$cur")) + return + ;; + -visual) + COMPREPLY=($(compgen -W 'StaticGray GrayScale StaticColor + PseudoColor TrueColor DirectColor defaut visualid' \ + -- "$cur")) + return + ;; + esac + + return 1 +} + +_convert() +{ + local cur prev words cword + _init_completion || return + + _ImageMagick && return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1" -help)' -- "$cur")) + elif [[ $cur == +* ]]; then + COMPREPLY=($(compgen -W '+adjoin +append +compress +contrast +debug + +dither +endian +gamma +label +map +mask +matte +negate +noise + +page +raise +render +write' -- "$cur")) + else + _filedir + fi +} && + complete -F _convert convert + +_mogrify() +{ + local cur prev words cword + _init_completion || return + + _ImageMagick && return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1" -help)' -- "$cur")) + elif [[ $cur == +* ]]; then + COMPREPLY=($(compgen -W '+compress +contrast +debug +dither +endian + +gamma +label +map +mask +matte +negate +page +raise' -- "$cur")) + else + _filedir + fi +} && + complete -F _mogrify mogrify + +_display() +{ + local cur prev words cword + _init_completion || return + + _ImageMagick && return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1" -help)' -- "$cur")) + elif [[ $cur == +* ]]; then + COMPREPLY=($(compgen -W '+compress +contrast +debug +dither +endian + +gamma +label +map +matte +negate +page +raise +write' -- "$cur")) + else + _filedir + fi +} && + complete -F _display display + +_animate() +{ + local cur prev words cword + _init_completion || return + + _ImageMagick && return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1" -help)' -- "$cur")) + elif [[ $cur == +* ]]; then + COMPREPLY=($(compgen -W '+debug +dither +gamma +map +matte' \ + -- "$cur")) + else + _filedir + fi +} && + complete -F _animate animate + +_identify() +{ + local cur prev words cword + _init_completion || return + + _ImageMagick && return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1" -help)' -- "$cur")) + elif [[ $cur == +* ]]; then + COMPREPLY=($(compgen -W '+debug' -- "$cur")) + else + _filedir + fi +} && + complete -F _identify identify + +_montage() +{ + local cur prev words cword + _init_completion || return + + _ImageMagick && return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1" -help)' -- "$cur")) + elif [[ $cur == +* ]]; then + COMPREPLY=($(compgen -W '+adjoin +compress +debug +dither +endian + +gamma +label +matte +page' -- "$cur")) + else + _filedir + fi +} && + complete -F _montage montage + +_composite() +{ + local cur prev words cword + _init_completion || return + + _ImageMagick && return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1" -help)' -- "$cur")) + elif [[ $cur == +* ]]; then + COMPREPLY=($(compgen -W '+compress +debug +dither +endian +label + +matte +negate +page +write' -- "$cur")) + else + _filedir + fi +} && + complete -F _composite composite + +_compare() +{ + local cur prev words cword + _init_completion || return + + _ImageMagick && return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1" -help)' -- "$cur")) + elif [[ $cur == +* ]]; then + COMPREPLY=($(compgen -W '+debug' -- "$cur")) + else + _filedir + fi +} && + complete -F _compare compare + +_conjure() +{ + local cur prev words cword + _init_completion || return + + _ImageMagick && return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1" -help)' -- "$cur")) + elif [[ $cur == +* ]]; then + COMPREPLY=($(compgen -W '+debug' -- "$cur")) + else + _filedir + fi +} && + complete -F _conjure conjure + +_import() +{ + local cur prev words cword + _init_completion || return + + _ImageMagick && return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1" -help)' -- "$cur")) + elif [[ $cur == +* ]]; then + COMPREPLY=($(compgen -W '+debug' -- "$cur")) + else + _filedir + fi +} && + complete -F _import import + +_stream() +{ + local cur prev words cword + _init_completion || return + + _ImageMagick && return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1" -help)' -- "$cur")) + elif [[ $cur == +* ]]; then + COMPREPLY=($(compgen -W '+debug' -- "$cur")) + else + _filedir + fi +} && + complete -F _stream stream + +# ex: filetype=sh diff --git a/completions/cowsay b/completions/cowsay new file mode 100644 index 0000000..6ba1d0f --- /dev/null +++ b/completions/cowsay @@ -0,0 +1,23 @@ +# bash completion for cowsay -*- shell-script -*- + +_cowsay() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -f) + COMPREPLY=($(compgen -W \ + '$(cowsay -l 2>/dev/null | tail -n +2)' -- "$cur")) + return + ;; + esac + + # relevant options completion + COMPREPLY=($(compgen -W '-b -d -g -p -s -t -w -y -e -f -h -l -n -T -W' \ + -- "$cur")) + +} && + complete -F _cowsay -o default cowsay cowthink + +# ex: filetype=sh diff --git a/completions/cpan2dist b/completions/cpan2dist new file mode 100644 index 0000000..b5e59da --- /dev/null +++ b/completions/cpan2dist @@ -0,0 +1,37 @@ +# bash completion for cpan2dist -*- shell-script -*- + +_cpan2dist() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --format) + # should remove ":" from COMP_WORDBREAKS, but doesn't work (?) + COMPREPLY=($(compgen -W '$(perl -MCPANPLUS::Dist -e \ + "print map { \"\$_\n\" } CPANPLUS::Dist->dist_types")' \ + -- "$cur")) + return + ;; + --banlist | --ignorelist | --modulelist | --logfile) + _filedir + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + else + local cpandirs=("$HOME/.cpanplus/" "$HOME/.cpan/source/modules/") + local packagelist + for dir in "${cpandirs[@]}"; do + [[ -d $dir && -r "$dir/02packages.details.txt.gz" ]] && + packagelist="$dir/02packages.details.txt.gz" + done + [[ -v packagelist ]] && COMPREPLY=($(zgrep "^${cur//-/::}" \ + $packagelist 2>/dev/null | awk '{print $1}' | command sed -e 's/::/-/g')) + fi +} && + complete -F _cpan2dist -o default cpan2dist + +# ex: filetype=sh diff --git a/completions/cpio b/completions/cpio new file mode 100644 index 0000000..d6fde0c --- /dev/null +++ b/completions/cpio @@ -0,0 +1,78 @@ +# bash completion for cpio -*- shell-script -*- + +_cpio() +{ + local cur prev words cword split + _init_completion -s -n : || return + + # --name value style option + case $prev in + --format | -!(-*)H) + COMPREPLY=($(compgen -W \ + 'bin odc newc crc tar ustar hpbin hpodc' -- "$cur")) + return + ;; + --file | --pattern-file | -!(-*)[EFI]) + _filedir + return + ;; + --owner | -!(-*)R) + _usergroup + return + ;; + --rsh-command) + compopt -o filenames + COMPREPLY=($(compgen -c -- "$cur")) + return + ;; + esac + + $split && return + + if ((cword == 1)); then + COMPREPLY=($(compgen -W '-o --create -i --extract -p --pass-through + -? --help --license --usage --version' -- "$cur")) + else + case ${words[1]} in + -o | --create) + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '-0 -a -c -v -A -B -L -V -C -H -M + -O -F --file --format --message --null + --reset-access-time --verbose --dot --append + --block-size --dereference --io-size --quiet + --force-local --rsh-command --help --version' \ + -- "$cur")) + fi + ;; + -i | --extract) + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '-b -c -d -f -m -n -r -t -s -u -v + -B -S -V -C -E -H -M -R -I -F --file --make-directories + --nonmatching --preserve-modification-time + --numeric-uid-gid --rename --list --swap-bytes --swap + --dot --unconditional --verbose --block-size + --swap-halfwords --io-size --pattern-file --format + --owner --no-preserve-owner --message --force-local + --no-absolute-filenames --sparse --only-verify-crc + --quiet --rsh-command --help --to-stdout --version' \ + -- "$cur")) + fi + ;; + -p* | --pass-through) + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '-0 -a -d -l -m -u -v -L -V -R + --null --reset-access-time --make-directories --link + --quiet --preserve-modification-time --unconditional + --verbose --dot --dereference --owner + --no-preserve-owner --sparse --help --version' \ + -- "$cur")) + else + _filedir -d + fi + ;; + esac + fi +} && + complete -F _cpio cpio + +# ex: filetype=sh diff --git a/completions/cppcheck b/completions/cppcheck new file mode 100644 index 0000000..8ea9571 --- /dev/null +++ b/completions/cppcheck @@ -0,0 +1,91 @@ +# bash completion for cppcheck(1) -*- shell-script -*- + +_cppcheck() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + --append | --exitcode-suppressions | --rule-file | --config-excludes-file | \ + --suppressions-list | --includes-file | --include | -i) + _filedir + return + ;; + -D | -U | --rule | --suppress | --template | --max-configs | -h | --help | --version | \ + --errorlist | --config-exclude | -l) + return + ;; + --enable) + # split comma-separated list + split=false + if [[ $cur == ?*,* ]]; then + prev="${cur%,*}" + cur="${cur##*,}" + split=true + fi + COMPREPLY=($(compgen -W 'all warning style performance + portability information unusedFunction missingInclude' \ + -- "$cur")) + $split && COMPREPLY=(${COMPREPLY[@]/#/"$prev,"}) + return + ;; + --error-exitcode) + COMPREPLY=($(compgen -W '{0..255}' -- "$cur")) + return + ;; + --file-list) + _filedir + [[ -z $cur || $cur == - ]] && COMPREPLY+=(-) + return + ;; + -I) + _filedir -d + return + ;; + -j) + COMPREPLY=($(compgen -W "{2..$(_ncpus)}" -- "$cur")) + return + ;; + --language | -x) + COMPREPLY=($(compgen -W 'c c++' -- "$cur")) + return + ;; + --std) + COMPREPLY=($(compgen -W 'c89 c99 c11 c++03 c++11 c++14 c++17 + c++20' -- "$cur")) + return + ;; + --platform) + _filedir + COMPREPLY+=($(compgen -W 'unix32 unix64 win32A win32W win64 + native' -- "$cur")) + return + ;; + -rp | --relative-paths) + if $split; then # -rp without argument is allowed + _filedir -d + return + fi + ;; + --library) + _filedir cfg + return + ;; + --xml-version) + COMPREPLY=($(compgen -W '1 2' -- "$cur")) + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + [[ ${COMPREPLY-} == *= ]] && compopt -o nospace + else + _filedir '@([cht]pp|[cht]xx|cc|[ch]++|[ch])' + fi +} && + complete -F _cppcheck cppcheck + +# ex: filetype=sh diff --git a/completions/crontab b/completions/crontab new file mode 100644 index 0000000..cac7853 --- /dev/null +++ b/completions/crontab @@ -0,0 +1,48 @@ +# crontab(1) completion -*- shell-script -*- + +_crontab() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -*u) + _allowed_users + return + ;; + esac + + local -A opts=([-u]="" [-l]="" [-r]="" [-e]="") + [[ $OSTYPE == *linux* ]] && opts[-i]= + [[ -d /sys/fs/selinux || -d /selinux ]] && opts[-s]= + + local i + for i in "${!words[@]}"; do + [[ ${words[i]} && $i -ne $cword ]] && unset "opts[${words[i]}]" + case "${words[i]}" in + -l) + unset 'opts[-r]' 'opts[-e]' 'opts[-i]' 'opts[-s]' + ;; + -e) + unset 'opts[-l]' 'opts[-r]' 'opts[-i]' + ;; + -r) + unset 'opts[-l]' 'opts[-e]' + ;; + -u) + unset 'opts[-i]' + ;; + esac + done + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '${!opts[@]}' -- "$cur")) + return + fi + + # do filenames only if we did not have -l, -r, or -e + [[ ${words[*]} == *\ -[lre]* ]] || _filedir +} && + complete -F _crontab crontab + +# ex: filetype=sh diff --git a/completions/cryptsetup b/completions/cryptsetup new file mode 100644 index 0000000..e73e165 --- /dev/null +++ b/completions/cryptsetup @@ -0,0 +1,103 @@ +# bash completion for cryptsetup -*- shell-script -*- + +_cryptsetup_name() +{ + COMPREPLY=($(compgen -X control -W '$(command ls /dev/mapper)' -- "$cur")) +} + +_cryptsetup_device() +{ + cur=${cur:=/dev/} + _filedir +} + +_cryptsetup() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + --help | --version | --cipher | --hash | --*-size | --key-slot | --size | --offset | \ + --skip | --iter-time | --timeout | --tries | -!(-*)[chslSbopitT]) + return + ;; + --key-file | --master-key-file | --header-backup-file | -!(-*)d) + _filedir + return + ;; + --type | -!(-*)M) + COMPREPLY=($(compgen -W "luks plain loopaes tcrypt" -- "$cur")) + return + ;; + esac + + $split && return + + local arg + _get_first_arg + if [[ -z $arg ]]; then + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + [[ ${COMPREPLY-} == *= ]] && compopt -o nospace + else + COMPREPLY=($(compgen -W 'open close resize status benchmark + repair erase luksFormat luksAddKey luksRemoveKey luksChangeKey + luksKillSlot luksUUID isLuks luksDump tcryptDump luksSuspend + luksResume luksHeaderBackup luksHeaderRestore' -- "$cur")) + fi + else + local args + _count_args "" "-!(-*)[chslSbopitTdM]" + case $arg in + open | create | luksOpen | loopaesOpen | tcryptOpen) + case $args in + 2) + _cryptsetup_device + ;; + 3) + _cryptsetup_name + ;; + esac + ;; + close | remove | luksClose | loopaesClose | tcryptClose | status | resize | \ + luksSuspend | luksResume) + case $args in + 2) + _cryptsetup_name + ;; + esac + ;; + luksFormat | luksAddKey | luksRemoveKey | luksChangeKey) + case $args in + 2) + _cryptsetup_device + ;; + 3) + _filedir + ;; + esac + ;; + luksKillSlot | luksDelKey | luksUUID | isLuks | luksDump) + case $args in + 2) + _cryptsetup_device + ;; + esac + ;; + luksHeaderBackup | luksHeaderRestore) + case $args in + 2) + _cryptsetup_device + ;; + 3) + COMPREPLY=('--header-backup-file') + ;; + esac + ;; + esac + fi + +} && + complete -F _cryptsetup cryptsetup + +# ex: filetype=sh diff --git a/completions/curl b/completions/curl new file mode 100644 index 0000000..6e84269 --- /dev/null +++ b/completions/curl @@ -0,0 +1,99 @@ +# curl(1) completion -*- shell-script -*- + +_curl() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --ciphers | --connect-timeout | --continue-at | --form | --form-string | \ + --ftp-account | --ftp-alternative-to-user | --ftp-port | --header | --help | \ + --hostpubmd5 | --keepalive-time | --krb | --limit-rate | --local-port | \ + --mail-from | --mail-rcpt | --max-filesize | --max-redirs | --max-time | --pass | \ + --proto | --proto-redir | --proxy-user | --proxy1.0 | --quote | --range | \ + --request | --retry | --retry-delay | --retry-max-time | \ + --socks5-gssapi-service | --telnet-option | --tftp-blksize | --time-cond | \ + --url | --user | --user-agent | --version | --write-out | --resolve | --tlsuser | \ + --tlspassword | -!(-*)[CFPHhmQrXtzuAVw]) + return + ;; + --config | --cookie | --cookie-jar | --dump-header | --egd-file | \ + --key | --libcurl | --output | --random-file | --upload-file | --trace | \ + --trace-ascii | --netrc-file | -!(-*)[KbcDoT]) + _filedir + return + ;; + --cacert | --cert | -!(-*)E) + _filedir '@(c?(e)rt|cer|pem|der)' + return + ;; + --capath) + _filedir -d + return + ;; + --cert-type | --key-type) + COMPREPLY=($(compgen -W 'DER PEM ENG' -- "$cur")) + return + ;; + --crlfile) + _filedir crl + return + ;; + --data | --data-ascii | --data-binary | --data-urlencode | -!(-*)d) + if [[ $cur == \@* ]]; then + cur=${cur:1} + _filedir + if [[ ${#COMPREPLY[@]} -eq 1 && -d ${COMPREPLY[0]} ]]; then + COMPREPLY[0]+=/ + compopt -o nospace + fi + COMPREPLY=("${COMPREPLY[@]/#/@}") + fi + return + ;; + --delegation) + COMPREPLY=($(compgen -W 'none policy always' -- "$cur")) + return + ;; + --engine) + COMPREPLY=($(compgen -W 'list' -- "$cur")) + return + ;; + --ftp-method) + COMPREPLY=($(compgen -W 'multicwd nocwd singlecwd' -- "$cur")) + return + ;; + --ftp-ssl-ccc-mode) + COMPREPLY=($(compgen -W 'active passive' -- "$cur")) + return + ;; + --interface) + _available_interfaces -a + return + ;; + --proxy | --socks4 | --socks4a | --socks5 | --socks5-hostname | -!(-*)x) + _known_hosts_real -- "$cur" + return + ;; + --pubkey) + _xfunc ssh _ssh_identityfile pub + return + ;; + --stderr) + COMPREPLY=($(compgen -W '-' -- "$cur")) + _filedir + return + ;; + --tlsauthtype) + COMPREPLY=($(compgen -W 'SRP' -- "$cur")) + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + fi +} && + complete -F _curl curl + +# ex: filetype=sh diff --git a/completions/cvs b/completions/cvs new file mode 100644 index 0000000..ba1f062 --- /dev/null +++ b/completions/cvs @@ -0,0 +1,398 @@ +# cvs(1) completion -*- shell-script -*- + +_cvs_entries() +{ + local prefix=${cur%/*}/ IFS=$'\n' + [[ -e ${prefix:-}CVS/Entries ]] || prefix="" + entries=($(cut -d/ -f2 -s ${prefix:-}CVS/Entries 2>/dev/null)) + if [[ $entries ]]; then + entries=("${entries[@]/#/${prefix:-}}") + compopt -o filenames + fi +} + +_cvs_modules() +{ + if [[ -n $prefix ]]; then + COMPREPLY=($(command ls -d ${cvsroot}/${prefix}/!(CVSROOT))) + else + COMPREPLY=($(command ls -d ${cvsroot}/!(CVSROOT))) + fi +} + +_cvs_commands() +{ + cvs --help-commands 2>&1 | awk '/^( *|\t)/ { print $1 }' +} + +_cvs_command_options() +{ + COMPREPLY=($(compgen -W '$(_parse_help "$1" "--help $2")' -- "$cur")) +} + +_cvs_kflags() +{ + COMPREPLY=($(compgen -W 'kv kvl k o b v' -- "$cur")) +} + +_cvs_roots() +{ + local -a cvsroots + [[ -v CVSROOT ]] && cvsroots=("$CVSROOT") + [[ -r ~/.cvspass ]] && cvsroots+=($(awk '{ print $2 }' ~/.cvspass)) + [[ -r CVS/Root ]] && mapfile -tO ${#cvsroots[@]} cvsroots /dev/null)) + local f + for i in "${!files[@]}"; do + if [[ ${files[i]} == ?(*/)CVS ]]; then + unset 'files[i]' + else + for f in "${entries[@]}"; do + if [[ ${files[i]} == "$f" && ! -d $f ]]; then + unset 'files[i]' + break + fi + done + fi + done + COMPREPLY=($(compgen -X "$_backup_glob" -W '${files[@]}' \ + -- "$cur")) + else + _cvs_command_options "$1" $mode + fi + ;; + admin) + case $prev in + --*) ;; + -*@([aAbcelmnNosu]|t-)) + return + ;; + -*t) + _filedir + return + ;; + -*k) + _cvs_kflags + return + ;; + esac + + if [[ $cur == -* ]]; then + _cvs_command_options "$1" $mode + else + _cvs_entries + COMPREPLY=($(compgen -W '${entries[@]}' -- "$cur")) + fi + ;; + annotate) + [[ $prev == -[rD] ]] && return + + if [[ $cur == -* ]]; then + _cvs_command_options "$1" $mode + else + _cvs_entries + COMPREPLY=($(compgen -W '${entries[@]}' -- "$cur")) + fi + ;; + checkout) + case $prev in + --*) ;; + -*[rDj]) + return + ;; + -*d) + _filedir -d + return + ;; + -*k) + _cvs_kflags + return + ;; + esac + + if [[ $cur != -* ]]; then + [[ ! -v cvsroot ]] && cvsroot=${CVSROOT-} + COMPREPLY=($(cvs -d "$cvsroot" co -c 2>/dev/null | + awk '{print $1}')) + COMPREPLY=($(compgen -W '${COMPREPLY[@]}' -- "$cur")) + else + _cvs_command_options "$1" $mode + fi + ;; + commit) + case $prev in + --*) ;; + -*[mr]) + return + ;; + -*F) + _filedir + return + ;; + esac + + if [[ $cur != -* ]]; then + # if $COMP_CVS_REMOTE is not null, 'cvs commit' will + # complete on remotely checked-out files (requires + # passwordless access to the remote repository + if [[ -n ${COMP_CVS_REMOTE:-} ]]; then + # this is the least computationally intensive way found so + # far, but other changes (something other than + # changed/removed/new) may be missing + changed=($(cvs -q diff --brief 2>&1 | + command sed -ne 's/^Files [^ ]* and \([^ ]*\) differ$/\1/p')) + newremoved=($(cvs -q diff --brief 2>&1 | + command sed -ne 's/^cvs diff: \([^ ]*\) .*, no comparison available$/\1/p')) + COMPREPLY=($(compgen -W '${changed[@]:-} \ + ${newremoved[@]:-}' -- "$cur")) + else + _cvs_entries + COMPREPLY=($(compgen -W '${entries[@]}' -- "$cur")) + fi + else + _cvs_command_options "$1" $mode + fi + ;; + cvsroot) + _cvs_roots + ;; + diff | log) + if [[ $cur == -* ]]; then + _cvs_command_options "$1" $mode + [[ ${COMPREPLY-} == *= ]] && compopt -o nospace + else + _cvs_entries + COMPREPLY=($(compgen -W '${entries[@]:-}' -- "$cur")) + fi + ;; + editors | watchers) + if [[ $cur == -* ]]; then + _cvs_command_options "$1" $mode + else + _cvs_entries + COMPREPLY=($(compgen -W '${entries[@]}' -- "$cur")) + fi + ;; + export) + case $prev in + --*) ;; + -*[rD]) + return + ;; + -*d) + _filedir -d + return + ;; + -*k) + _cvs_kflags + return + ;; + esac + + if [[ $cur != -* ]]; then + [[ ! -v cvsroot ]] && cvsroot=${CVSROOT-} + COMPREPLY=($(cvs -d "$cvsroot" co -c | awk '{print $1}')) + COMPREPLY=($(compgen -W '${COMPREPLY[@]}' -- "$cur")) + else + _cvs_command_options "$1" $mode + fi + ;; + import) + case $prev in + --*) ;; + -*[IbmW]) + return + ;; + -*k) + _cvs_kflags + return + ;; + esac + + if [[ $cur != -* ]]; then + # starts with same algorithm as checkout + [[ ! -v cvsroot ]] && cvsroot=${CVSROOT-} + local prefix=${cur%/*} + if [[ -r ${cvsroot}/${prefix} ]]; then + _cvs_modules + COMPREPLY=(${COMPREPLY[@]#$cvsroot}) + COMPREPLY=(${COMPREPLY[@]#\/}) + fi + pwd=$(pwd) + pwd=${pwd##*/} + COMPREPLY=($(compgen -W '${COMPREPLY[@]} $pwd' -- "$cur")) + else + _cvs_command_options "$1" $mode + fi + ;; + remove) + if [[ $cur != -* ]]; then + _cvs_entries + 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 + ;; + update) + case $prev in + --*) ;; + -*[rDjIW]) + return + ;; + -*k) + _cvs_kflags + return + ;; + esac + + if [[ $cur == -* ]]; then + _cvs_command_options "$1" $mode + else + _cvs_entries + COMPREPLY=($(compgen -W '${entries[@]}' -- "$cur")) + fi + ;; + "") + case $prev in + --*) ;; + -*T) + _filedir -d + return + ;; + -*[es]) + return + ;; + -*z) + COMPREPLY=($(compgen -W '{1..9}' -- "$cur")) + return + ;; + esac + + COMPREPLY=($(compgen -W '$(_cvs_commands) + $(_parse_help "$1" --help-options) --help --help-commands + --help-options --version' -- "$cur")) + ;; + esac + +} && + complete -F _cvs cvs + +# ex: filetype=sh diff --git a/completions/cvsps b/completions/cvsps new file mode 100644 index 0000000..4fdfefc --- /dev/null +++ b/completions/cvsps @@ -0,0 +1,58 @@ +# bash completion for cvsps -*- shell-script -*- + +_cvsps() +{ + local cur prev words cword + _init_completion -n : || return + + case $prev in + -h | -z | -f | -d | -l | --diff-opts | --debuglvl) + return + ;; + -s) + COMPREPLY=($(compgen -W "$($1 2>/dev/null | + awk '/^PatchSet:?[ \t]/ { print $2 }')" -- "$cur")) + return + ;; + -a) + COMPREPLY=($(compgen -W "$($1 2>/dev/null | + awk '/^Author:[ \t]/ { print $2 }')" -- "$cur")) + return + ;; + -b) + COMPREPLY=($(compgen -W "$($1 2>/dev/null | + awk '/^Branch:[ \t]/ { print $2 }')" -- "$cur")) + return + ;; + -r) + COMPREPLY=($(compgen -W "$($1 2>/dev/null | + awk '/^Tag:[ \t]+[^(]/ { print $2 }')" -- "$cur")) + return + ;; + -p) + _filedir -d + return + ;; + --test-log) + _filedir + return + ;; + -Z) + COMPREPLY=($(compgen -W '{1..9}' -- "$cur")) + return + ;; + --root) + _xfunc cvs _cvs_roots + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1" -h)' -- "$cur")) + else + _xfunc cvs _cvs_roots + fi +} && + complete -F _cvsps cvsps + +# ex: filetype=sh diff --git a/completions/dd b/completions/dd new file mode 100644 index 0000000..04d876a --- /dev/null +++ b/completions/dd @@ -0,0 +1,42 @@ +# bash completion for dd -*- shell-script -*- + +_dd() +{ + local cur prev words cword + _init_completion -n = || return + + case $cur in + if=* | of=*) + cur=${cur#*=} + _filedir + return + ;; + conv=*) + cur=${cur#*=} + COMPREPLY=($(compgen -W 'ascii ebcdic ibm block unblock lcase + 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 + + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur") + $(compgen -W 'bs cbs conv count ibs if iflag obs of oflag + seek skip status' -S '=' -- "$cur")) + [[ ${COMPREPLY-} == *= ]] && compopt -o nospace +} && + complete -F _dd dd + +# ex: filetype=sh diff --git a/completions/deja-dup b/completions/deja-dup new file mode 100644 index 0000000..1854d6a --- /dev/null +++ b/completions/deja-dup @@ -0,0 +1,32 @@ +# 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 new file mode 100644 index 0000000..8f4e139 --- /dev/null +++ b/completions/desktop-file-validate @@ -0,0 +1,23 @@ +# desktop-file-validate completion -*- shell-script -*- + +_desktop_file_validate() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --help) + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + return + fi + + _filedir desktop +} && + complete -F _desktop_file_validate desktop-file-validate + +# ex: filetype=sh diff --git a/completions/dhclient b/completions/dhclient new file mode 100644 index 0000000..ce4b745 --- /dev/null +++ b/completions/dhclient @@ -0,0 +1,34 @@ +# bash completion for dhclient -*- shell-script -*- + +_dhclient() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -p | -e) + return + ;; + -D) + COMPREPLY=($(compgen -W 'LL LLT' -- "$cur")) + return + ;; + -*f) + _filedir + return + ;; + -s) + _known_hosts_real -- "$cur" + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1")' -- "$cur")) + else + _available_interfaces + fi +} && + complete -F _dhclient dhclient + +# ex: filetype=sh diff --git a/completions/dict b/completions/dict new file mode 100644 index 0000000..f3426ff --- /dev/null +++ b/completions/dict @@ -0,0 +1,64 @@ +# dict(1) completion -*- shell-script -*- + +_dictdata() +{ + dict $host $port $1 2>/dev/null | command sed -ne \ + 's/^[[:blank:]]\{1,\}\([^[:blank:]]*\).*$/\1/p' +} + +_dict() +{ + local cur prev words cword + _init_completion || return + + local host port db i + + for ((i = 1; i < cword; i++)); do + case ${words[i]} in + --host | -!(-*)h) + host=${words[++i]} + [[ -n $host ]] && host="-h $host" + ;; + --port | -!(-*)p) + port=${words[++i]} + [[ -n $port ]] && port="-p $port" + ;; + --database | -!(-*)d) + db=${words[++i]} + [[ -n $db ]] && host="-d $db" + ;; + esac + done + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + return + fi + + case $prev in + --database | -info | -!(-*)[di]) + COMPREPLY=($(compgen -W '$(_dictdata -D)' -- "$cur")) + return + ;; + --strategy | -!(-*)s) + COMPREPLY=($(compgen -W '$(_dictdata -S)' -- "$cur")) + return + ;; + esac + + local dictfile=/usr/share/dict/words + if [[ -r $dictfile ]]; then + # Dictfile may be too large for practical compgen -W usage, so narrow + # it down with grep if $cur looks like something that's safe to embed + # in a pattern instead. + if [[ $cur == +([-A-Za-z0-9/.]) ]]; then + COMPREPLY=($(compgen -W \ + '$(command grep "^${cur//./\\.}" $dictfile)' -- "$cur")) + else + COMPREPLY=($(compgen -W '$(cat $dictfile)' -- "$cur")) + fi + fi +} && + complete -F _dict -o default dict rdict + +# ex: filetype=sh diff --git a/completions/dmypy b/completions/dmypy new file mode 100644 index 0000000..5abe37d --- /dev/null +++ b/completions/dmypy @@ -0,0 +1,48 @@ +# dmypy completion -*- shell-script -*- + +_dmypy() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --help | --version | -[hV]) + return + ;; + --status-file) + _filedir + return + ;; + esac + + local cmd i + for ((i = 1; i < cword; i++)); do + if [[ ${words[i]} != -* && ${words[i - 1]} != --status-file ]]; then + cmd=${words[i]} + break + fi + done + + case ${cmd-} in + check | run) + _filedir '@(py|pyi)' + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + return + fi + + if [[ ! -v cmd ]]; then + local cmds=$($1 --help 2>&1 | + command sed -ne '/positional arguments/{p;n;p;q}' | + command sed -ne 's/{\(.*\)}/\1/p') + COMPREPLY=($(IFS="," compgen -W '$cmds' -- "$cur")) + return + fi +} && + complete -F _dmypy dmypy + +# ex: filetype=sh diff --git a/completions/dnssec-keygen b/completions/dnssec-keygen new file mode 100644 index 0000000..3f68a68 --- /dev/null +++ b/completions/dnssec-keygen @@ -0,0 +1,48 @@ +# bash completion for dnssec-keygen(8) -*- shell-script -*- + +_dnssec_keygen_optarg() +{ + local args=$("$1" -h 2>&1 | + command sed -e 's/|/ /g' -e 's/(.*//' \ + -ne '/^[[:space:]]*'$2'/,/^[[:space:]]*[(-]/p' | + command sed -e 's/^[[:space:]]*'$2'.*://' -e '/^[[:space:]]*-/d') + COMPREPLY+=($(compgen -W '$args' -- "$cur")) +} + +_dnssec_keygen() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -[hbEgLpsPARIDSi]) + return + ;; + -K) + _filedir -d + return + ;; + -[ancdfTtm]) + _dnssec_keygen_optarg "$1" $prev + return + ;; + -r) + cur=${cur:=/dev/} + _filedir + return + ;; + -v) + COMPREPLY=($(compgen -W '{0..10}' -- "$cur")) + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1" | \ + command sed -e "s/:\$//")' -- "$cur")) + return + fi +} && + complete -F _dnssec_keygen dnssec-keygen + +# ex: filetype=sh diff --git a/completions/dnsspoof b/completions/dnsspoof new file mode 100644 index 0000000..86ade91 --- /dev/null +++ b/completions/dnsspoof @@ -0,0 +1,26 @@ +# dnsspoof completion -*- shell-script -*- + +_dnsspoof() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -i) + _available_interfaces -a + return + ;; + -f) + _filedir + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1")' -- "$cur")) + fi + +} && + complete -F _dnsspoof dnsspoof + +# ex: filetype=sh diff --git a/completions/dot b/completions/dot new file mode 100644 index 0000000..8122229 --- /dev/null +++ b/completions/dot @@ -0,0 +1,45 @@ +# dot(1) completion -*- shell-script -*- + +_dot() +{ + local cur prev words cword + _init_completion -n := || return + + [[ $prev == -[V?] ]] && return + + case $cur in + -G* | -N* | -E* | -l?* | -q?* | -s?* | -Ln* | -LU* | -LC* | -LT*) + return + ;; + -T*) + local langs=($("$1" -TNON_EXISTENT 2>&1 | + command sed -ne 's/.*one of://p')) + COMPREPLY=($(compgen -P -T -W '${langs[@]}' -- "${cur#-T}")) + return + ;; + -K*) + local layouts=($("$1" -KNON_EXISTENT 2>&1 | + command sed -ne 's/.*one of://p')) + COMPREPLY=($(compgen -P -K -W '${layouts[@]}' -- "${cur#-K}")) + return + ;; + -o*) + cur=${cur#-o} + _filedir + COMPREPLY=($(compgen -P -o -W '${COMPREPLY[@]}' -- "$cur")) + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '-V -v -G -N -E -T -K -l -o -O -P -q -s -y -n + -n1 -n2 -x -Lg -LO -Ln -LU -LC -LT -m -c -?' -- "$cur")) + [[ ${COMPREPLY-} == -@([GNETKo]|L[nUCT]) ]] && compopt -o nospace + return + fi + + _filedir dot +} && + complete -F _dot dot + +# ex: filetype=sh diff --git a/completions/dpkg b/completions/dpkg new file mode 100644 index 0000000..0b90b14 --- /dev/null +++ b/completions/dpkg @@ -0,0 +1,126 @@ +# This function is required by _dpkg and _dpkg-reconfigure -*- shell-script -*- + +_have grep-status && { + _comp_dpkg_installed_packages() + { + grep-status -P -e "^$1" -a -FStatus 'ok installed' -n -s Package + } +} || { + _comp_dpkg_installed_packages() + { + 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" | + awk "/Package: $1/ { print \$2 }" 2>/dev/null + } +} + +_have grep-status && { + _comp_dpkg_purgeable_packages() + { + grep-status -P -e "^$1" -a -FStatus 'ok installed' -o -FStatus 'ok config-files' -n -s Package + } +} || { + _comp_dpkg_purgeable_packages() + { + 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" | + awk "/Package: $1/ { print \$2 }" 2>/dev/null + } +} + +# Debian dpkg(1) completion +# +_dpkg() +{ + local cur prev words cword split + _init_completion -s || return + + local i=$cword + + # find the last option flag + if [[ $cur != -* ]]; then + while [[ $prev != -* && $i -ne 1 ]]; do + prev=${words[--i - 1]} + done + fi + + case $prev in + --install | --unpack | --record-avail | --contents | --info | --fsys-tarfile | \ + --field | --control | --extract | --vextract | --raw-extract | -!(-*)[ciAIfexX]) + _filedir '?(u|d)deb' + return + ;; + --build | -!(-*)b) + _filedir -d + return + ;; + --status | --print-avail | --list | -!(-*)[spl]) + COMPREPLY=($(_xfunc apt-cache _apt_cache_packages)) + return + ;; + --show | -!(-*)W) + if [[ $1 == *dpkg-query ]]; then + COMPREPLY=($(_xfunc apt-cache _apt_cache_packages)) + else + _filedir '?(u|d)deb' + fi + return + ;; + --search | -!(-*)S) + _filedir + return + ;; + --remove | --verify | -!(-*)[rV]) + COMPREPLY=($(_comp_dpkg_installed_packages "$cur")) + return + ;; + --listfiles | --purge | -!(-*)[LP]) + COMPREPLY=($(_comp_dpkg_purgeable_packages "$cur")) + return + ;; + esac + + $split && return + + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + [[ ${COMPREPLY-} == *= ]] && compopt -o nospace +} && + complete -F _dpkg dpkg dpkg-deb dpkg-query + +# Debian GNU dpkg-reconfigure(8) completion +# +_dpkg_reconfigure() +{ + local cur prev words cword + _init_completion || return + + local opt + + case $prev in + --frontend | -!(-*)f) + opt=($(printf '%s\n' /usr/share/perl5/Debconf/FrontEnd/*)) + opt=(${opt[@]##*/}) + opt=(${opt[@]%.pm}) + COMPREPLY=($(compgen -W '${opt[@]}' -- "$cur")) + return + ;; + --priority | -!(-*)p) + 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")) + else + COMPREPLY=($(_comp_dpkg_installed_packages "$cur")) + fi +} && + complete -F _dpkg_reconfigure -o default dpkg-reconfigure + +# ex: filetype=sh diff --git a/completions/dpkg-source b/completions/dpkg-source new file mode 100644 index 0000000..05fa3a1 --- /dev/null +++ b/completions/dpkg-source @@ -0,0 +1,98 @@ +# Debian dpkg-source completion -*- shell-script -*- + +_dpkg_source() +{ + local cur prev words cword + _init_completion || return + + local options word action packopts unpackopts fields + + packopts="-c -l -F -V -T -D -U -W -E -sa -i -I -sk -sr -ss -sA -sK -sP \ + -sU -sR" + unpackopts="-sp -sn -su" + options="-x -b --print-format --before-build --after-build --commit $packopts $unpackopts" + fields="Format Source Version Binary Maintainer Uploader Architecture \ + Standards-Version Build-Depends Files" + + action=options + for word in "${words[@]:1}"; do + if [[ $word == -x ]]; then + action=unpack + elif [[ $word == -b ]]; then + action=pack + elif [[ $word == -h ]]; then + action=help + fi + done + + case $action in + unpack) + case $prev in + -x) + _filedir -d + _filedir 'dsc' + ;; + *) + COMPREPLY=($(compgen -W "$unpackopts" -- "$cur")) + _filedir -d + _filedir + ;; + esac + return + ;; + pack) + case $prev in + -b) + _filedir -d + ;; + -c | -l | -T | -i | -I) + # -c: get controlfile + # -l: get per-version info from this file + # -T: read variables here, not debian/substvars + # -i: filter out files to ignore diffs of. + # -I: filter out files when building tarballs. + # return directory names and file names + _filedir -d + _filedir + ;; + -F) + # -F: force change log format + COMPREPLY=($(command ls /usr/lib/dpkg/parsechangelog)) + ;; + -V) + # -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=() + ;; + -D) + # -D: override or add a .dsc field and value + # if $cur doesn't contain a = yet, suggest variable names + if [[ $cur == *=* ]]; then + # $cur contains a "=" + COMPREPLY=() + else + COMPREPLY=($(compgen -W "$fields" -- "$cur")) + fi + ;; + -U) + # -U: remove a field + # Suggest possible fieldnames + COMPREPLY=($(compgen -W "$fields" -- "$cur")) + ;; + *) + COMPREPLY=($(compgen -W "$packopts $unpackopts" \ + -- "$cur")) + ;; + esac + return + ;; + *) + COMPREPLY=($(compgen -W "$options" -- "$cur")) + return + ;; + esac +} && + complete -F _dpkg_source dpkg-source + +# ex: filetype=sh diff --git a/completions/dselect b/completions/dselect new file mode 100644 index 0000000..4c18026 --- /dev/null +++ b/completions/dselect @@ -0,0 +1,29 @@ +# Debian Linux dselect(8) completion -*- shell-script -*- + +_dselect() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --admindir) + _filedir -d + return + ;; + -D | -debug) + _filedir + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + else + COMPREPLY=($(compgen -W 'access update select install config remove + quit' -- "$cur")) + fi + +} && + complete -F _dselect dselect + +# ex: filetype=sh diff --git a/completions/dsniff b/completions/dsniff new file mode 100644 index 0000000..749c533 --- /dev/null +++ b/completions/dsniff @@ -0,0 +1,26 @@ +# dsniff completion -*- shell-script -*- + +_dsniff() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -r | -w | -f | -p) + _filedir + return + ;; + -i) + _available_interfaces -a + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1") -r -w -p' -- "$cur")) + fi + +} && + complete -F _dsniff dsniff + +# ex: filetype=sh diff --git a/completions/dumpdb b/completions/dumpdb new file mode 100644 index 0000000..eb1927f --- /dev/null +++ b/completions/dumpdb @@ -0,0 +1,18 @@ +# mailman dumpdb completion -*- shell-script -*- + +_dumpdb() +{ + local cur prev words cword + _init_completion || return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '--marshal --pickle --noprint --help' \ + -- "$cur")) + else + _filedir + fi + +} && + complete -F _dumpdb dumpdb + +# ex: filetype=sh diff --git a/completions/dumpe2fs b/completions/dumpe2fs new file mode 100644 index 0000000..413a5bf --- /dev/null +++ b/completions/dumpe2fs @@ -0,0 +1,28 @@ +# dumpe2fs(8) completion -*- shell-script -*- + +_dumpe2fs() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -*[oV]) + return + ;; + -*i) + _filedir + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1")' -- "$cur")) + return + fi + + cur=${cur:=/dev/} + _filedir +} && + complete -F _dumpe2fs dumpe2fs + +# ex: filetype=sh diff --git a/completions/e2freefrag b/completions/e2freefrag new file mode 100644 index 0000000..c89dc9c --- /dev/null +++ b/completions/e2freefrag @@ -0,0 +1,24 @@ +# e2freefrag(8) completion -*- shell-script -*- + +_e2freefrag() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -c | -h) + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1" -h)' -- "$cur")) + return + fi + + cur=${cur:=/dev/} + _filedir +} && + complete -F _e2freefrag e2freefrag + +# ex: filetype=sh diff --git a/completions/e2label b/completions/e2label new file mode 100644 index 0000000..ac8e4b5 --- /dev/null +++ b/completions/e2label @@ -0,0 +1,15 @@ +# e2label(8) completion -*- shell-script -*- + +_e2label() +{ + local cur prev words cword + _init_completion || return + + if ((cword == 1)); then + cur=${cur:=/dev/} + _filedir + fi +} && + complete -F _e2label e2label + +# ex: filetype=sh diff --git a/completions/ebtables b/completions/ebtables new file mode 100644 index 0000000..de6bc54 --- /dev/null +++ b/completions/ebtables @@ -0,0 +1,78 @@ +# bash completion for ebtables -*- shell-script -*- + +_ebtables() +{ + local cur prev words cword split + _init_completion -s || return + + local table chain='s/^Bridge chain: \([^ ,]\{1,\}\).*$/\1/p' \ + targets='ACCEPT DROP CONTINUE RETURN' + + [[ ${words[*]} =~ [[:space:]]-(t|-table=?)[[:space:]]*([^[:space:]]+) ]] && + table="-t ${BASH_REMATCH[2]}" + + case $prev in + -!(-*)[AIDPFXLZ]) + COMPREPLY=($(compgen -W '`"$1" $table -L 2>/dev/null | \ + command sed -ne "$chain"`' -- "$cur")) + ;; + -!(-*)t) + COMPREPLY=($(compgen -W 'nat filter broute' -- "$cur")) + ;; + -!(-*)j) + if [[ $table == "-t filter" || -z $table ]]; then + COMPREPLY=($(compgen -W '$targets + $("$1" $table -L 2>/dev/null | \ + command sed -n -e "s/INPUT\|OUTPUT\|FORWARD//" \ + -e "$chain")' \ + -- "$cur")) + elif [[ $table == "-t nat" ]]; then + COMPREPLY=($(compgen -W '$targets + $("$1" $table -L 2>/dev/null | \ + command sed -n -e "s/OUTPUT|PREROUTING|POSTROUTING//" \ + -e "$chain")' \ + -- "$cur")) + elif [[ $table == "-t broute" ]]; then + COMPREPLY=($(compgen -W 'ACCEPT DROP + $("$1" $table -L 2>/dev/null | \ + command sed -n -e "s/BROUTING//" -e "$chain")' \ + -- "$cur")) + fi + ;; + *) + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '--802_3-sap --802_3-type --among-dst + --among-dst-file --among-src --among-src-file --append + --arp-gratuitous --arp-htype --arp-ip-dst --arp-ip-src + --arp-mac-dst --arp-mac-src --arp-opcode --arp-ptype --arpreply-mac + --arpreply-target --atomic-commit --atomic-file --atomic-init + --atomic-save --change-counters --concurrent --delete + --delete-chain --destination --dnat-target --dst --flush --help + --in-if --in-interface --init-table --insert --ip6-destination + --ip6-destination-port --ip6-dport --ip6-dst --ip6-icmp-type + --ip6-prococol --ip6-proto --ip6-protocol --ip6-source + --ip6-source-port --ip6-sport --ip6-src --ip6-tclass + --ip-destination --ip-destination-port --ip-dport --ip-dst + --ip-proto --ip-protocol --ip-source --ip-source-port --ip-sport + --ip-src --ip-tos --jump --Lc --limit --limit-burst --list --Lmac2 + --Ln --log --log-arp --logical-in --logical-out --log-ip --log-ip6 + --log-level --log-prefix --Lx --mark --mark-and --mark-or + --mark-set --mark-target --mark-xor --modprobe --new-chain --nflog + --nflog-group --nflog-prefix --nflog-range --nflog-threshold + --out-if --out-interface --pkttype-type --policy --proto --protocol + --redirect-target --rename-chain --set-counter --snat-arp + --snat-target --source --src --stp-flags --stp-forward-delay + --stp-hello-time --stp-max-age --stp-msg-age --stp-port + --stp-root-addr --stp-root-cost --stp-root-prio --stp-sender-addr + --stp-sender-prio --stp-type --table --to-destination --to-dst + --to-source --to-src --ulog --ulog-cprange --ulog-nlgroup + --ulog-prefix --ulog-qthreshold --version --vlan-encap --vlan-id + --vlan-prio --zero' -- "$cur")) + fi + ;; + esac + +} && + complete -F _ebtables ebtables + +# ex: filetype=sh diff --git a/completions/ecryptfs-migrate-home b/completions/ecryptfs-migrate-home new file mode 100644 index 0000000..d2eeb38 --- /dev/null +++ b/completions/ecryptfs-migrate-home @@ -0,0 +1,22 @@ +# ecryptfs-migrate-home(8) completion -*- shell-script -*- + +_ecryptfs_migrate_home() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --help) + return + ;; + --user | -u) + COMPREPLY=($(compgen -u -- "$cur")) + return + ;; + esac + + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) +} && + complete -F _ecryptfs_migrate_home ecryptfs-migrate-home + +# ex: filetype=sh diff --git a/completions/eog b/completions/eog new file mode 100644 index 0000000..2330e1a --- /dev/null +++ b/completions/eog @@ -0,0 +1,26 @@ +# eog(1) completion -*- shell-script -*- + +_eog() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + -'?' | --help | --help-all | --help-gtk) + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1" --help-all)' -- "$cur")) + [[ ${COMPREPLY-} == *= ]] && compopt -o nospace + return + fi + + _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: filetype=sh diff --git a/completions/ether-wake b/completions/ether-wake new file mode 100644 index 0000000..d952673 --- /dev/null +++ b/completions/ether-wake @@ -0,0 +1,27 @@ +# ether-wake(8) completion -*- shell-script -*- + +_ether_wake() +{ + local cur prev words cword + _init_completion -n : || return + + case $prev in + -i) + _available_interfaces -a + return + ;; + -p) + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1" -u) -V' -- "$cur")) + return + fi + + _mac_addresses +} && + complete -F _ether_wake ether-wake etherwake + +# ex: filetype=sh diff --git a/completions/evince b/completions/evince new file mode 100644 index 0000000..1c97dd9 --- /dev/null +++ b/completions/evince @@ -0,0 +1,32 @@ +# evince(1) completion -*- shell-script -*- + +_evince() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + --help* | --sm-client-id | --class | --name | --screen | --gdk-debug | \ + --gdk-no-debug | --gtk-module | --gtk-debug | --gtk-no-debug | --page-label | \ + --page-index | --find | --display | -!(-*)[hpil]) + return + ;; + --sm-client-state-file) + _filedir + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1" --help-all)' -- "$cur")) + [[ ${COMPREPLY-} == *= ]] && compopt -o nospace + return + fi + + _filedir '@(@(?(e)ps|?(E)PS|[pf]df|[PF]DF|dvi|DVI)?(.gz|.GZ|.bz2|.BZ2|.xz|.XZ)|cb[rz]|djv?(u)|gif|jp?(e)g|miff|tif?(f)|pn[gm]|p[bgp]m|bmp|xpm|ico|xwd|tga|pcx)' +} && + complete -F _evince evince + +# ex: filetype=sh diff --git a/completions/explodepkg b/completions/explodepkg new file mode 100644 index 0000000..a281f81 --- /dev/null +++ b/completions/explodepkg @@ -0,0 +1,5 @@ +# Slackware Linux explodepkg completion -*- shell-script -*- + +complete -o plusdirs -f -X '!*.t[bglx]z' explodepkg + +# ex: filetype=sh diff --git a/completions/export b/completions/export new file mode 100644 index 0000000..8d82361 --- /dev/null +++ b/completions/export @@ -0,0 +1,65 @@ +# bash export completion -*- shell-script -*- + +_export() +{ + local cur prev words cword + _init_completion -n = || return + + local i action=variable remove=false + for ((i = 1; i < cword; i++)); do + case ${words[i]} in + -p) + return + ;; + -*f*) + action=function + ;;& + -*n*) + remove=true + ;; + -*) + continue + ;; + esac + break + done + + if [[ $cur == *=* ]]; then + local ocur=$cur oprev=$prev + prev=${cur%%=*} cur=${cur#*=} + _variables && return + cur=$ocur prev=$oprev + fi + + case $cur in + *=) + local pval=$(quote "$(eval printf %s \"\$\{${cur%=}-\}\")") + # Complete previous value if it's not empty. + if [[ $pval != \'\' ]]; then + COMPREPLY=("$pval") + else + cur=${cur#*=} + _filedir + fi + ;; + *=*) + cur=${cur#*=} + _filedir + ;; + *) + if [[ $cword -eq 1 && $cur == -* ]]; then + COMPREPLY=($(compgen -W '-p $(_parse_usage "$1")' -- "$cur")) + return + fi + local suffix="" + if ! $remove; then + suffix="=" + compopt -o nospace + fi + COMPREPLY=($(compgen -A $action -S "$suffix" -- "$cur")) + ;; + esac +} && + complete -F _export export + +# ex: filetype=sh diff --git a/completions/faillog b/completions/faillog new file mode 100644 index 0000000..c8b81bd --- /dev/null +++ b/completions/faillog @@ -0,0 +1,27 @@ +# faillog(8) completion -*- shell-script -*- + +_faillog() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + --help | --lock-time | --maximum | --time | -!(-*)[hlmt]) + return + ;; + --user | -!(-*)u) + COMPREPLY=($(compgen -u -- "$cur")) + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + [[ ${COMPREPLY-} == *= ]] && compopt -o nospace + fi +} && + complete -F _faillog faillog + +# ex: filetype=sh diff --git a/completions/fbgs b/completions/fbgs new file mode 100644 index 0000000..1947b87 --- /dev/null +++ b/completions/fbgs @@ -0,0 +1,50 @@ +# bash completion for fbgs(1) -*- shell-script -*- + +_fbgs() +{ + local cur prev words cword + _init_completion || return + + case "$prev" in + -f | --font) + local IFS=$'\n' + COMPREPLY=($(compgen -W '$(fc-list 2>/dev/null)' -- "$cur")) + return + ;; + -m | --mode) + COMPREPLY=($(compgen -W '$(command sed \ + -n "/^mode/{s/^mode \{1,\}\"\([^\"]\{1,\}\)\"/\1/g;p}" \ + /etc/fb.modes 2>/dev/null)' -- "$cur")) + return + ;; + -d | --device) + COMPREPLY=($(compgen -f -d -- "${cur:-/dev/}")) + return + ;; + -fp | --firstpage | -lp | --lastpage | -r | --resolution | -s | --scroll | -t | \ + --timeout) + # expect integer value + COMPREPLY+=($(compgen -W '{0..9}')) + compopt -o nospace + return + ;; + -T | --vt | -p | --password | -g | --gamma) + # argument required but no completions available + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '--bell --help --password -fp --firstpage + -lp --lastpage --color -l -xl -xxl --resolution --autozoom + --{,no}autoup --{,no}autodown --{,no}fitwidth --{,no}verbose + --{,no}random --vt --scroll --timeout --{,no}once --gamma --font + --device --mode' -- "$cur")) + [[ ${COMPREPLY-} ]] && return + fi + + _filedir '?(e)ps|pdf' +} && + complete -F _fbgs fbgs + +# ex: filetype=sh diff --git a/completions/fbi b/completions/fbi new file mode 100644 index 0000000..455887a --- /dev/null +++ b/completions/fbi @@ -0,0 +1,54 @@ +# bash completion for fbi(1) -*- shell-script -*- + +_fbi() +{ + local cur prev words cword + _init_completion || return + + case "$prev" in + -l | --list) + _filedir + return + ;; + -r | --resolution) + COMPREPLY+=($(compgen -W '{1..5}')) + return + ;; + -f | --font) + local IFS=$'\n' + COMPREPLY=($(compgen -W '$(fc-list 2>/dev/null)' -- "$cur")) + return + ;; + -m | --mode) + COMPREPLY=($(compgen -W '$(command sed \ + -n "/^mode/{s/^mode \{1,\}\"\([^\"]\{1,\}\)\"/\1/g;p}" \ + /etc/fb.modes 2>/dev/null)' -- "$cur")) + return + ;; + -d | --device) + COMPREPLY=($(compgen -f -d -- "${cur:-/dev/}")) + return + ;; + --cachemem | --blend | -T | --vt | -s | --scroll | -t | --timeout | -g | --gamma) + # argument required but no completions available + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '--help --version --store --list --text + --autozoom --{,no}autoup --{,no}autodown --{,no}fitwidth + --{,no}verbose --{,no}random --{,no}comments --{,no}edit + --{,no}backup --{,no}preserve --{,no}readahead --cachemem --blend + --vt --scroll --timeout --{,no}once --resolution --gamma --font + --device --mode' -- "$cur")) + [[ ${COMPREPLY-} ]] && return + fi + + # FIXME: It is hard to determine correct supported extensions. + # fbi can handle any format that imagemagick can plus some others + _filedir 'bmp|gif|jp?(e)g|pcd|png|p[pgb]m|tif?(f)|webp|xpm|xwd|?(e)ps|pdf|dvi|txt|svg?(z)|cdr|[ot]tf' +} && + complete -F _fbi fbi + +# ex: filetype=sh diff --git a/completions/feh b/completions/feh new file mode 100644 index 0000000..f1d4b18 --- /dev/null +++ b/completions/feh @@ -0,0 +1,120 @@ +# bash completion for feh(1) -*- shell-script -*- + +_feh() +{ + local cur prev words cword split + _init_completion -s || return + + case "$prev" in + --image-bg | -B) + COMPREPLY=($(compgen -W 'checks white black' -- "$cur")) + return + ;; + --filelist | --output | --output-only | --start-at | -!(-*)[foO\|]) + _filedir + return + ;; + --caption-path | --fontpath | --output-dir | -!(-*)[KCj]) + _filedir -d + return + ;; + --font | --menu-font | --title-font | -!(-*)[eM@]) + # expect string like "dejavu.ttf/12" + if [[ $cur == */* ]]; then # expect integer value + COMPREPLY=($(compgen -P "$cur" -W '{0..9}')) + compopt -o nospace + return + fi + local font_path + # font_path="$(imlib2-config --prefix 2>/dev/null)/share/imlib2/data/fonts" + # COMPREPLY=( $(cd "$font_path" 2>/dev/null; compgen -f \ + # -X "!*.@([tT][tT][fF])" -S / -- "$cur") ) + for ((i = ${#words[@]} - 1; i > 0; i--)); do + if [[ ${words[i]} == -@(C|-fontpath) ]]; then + font_path="${words[i + 1]}" + COMPREPLY+=($( + cd "$font_path" 2>/dev/null + compgen -f \ + -X "!*.@([tT][tT][fF])" -S / -- "$cur" + )) + fi + done + compopt -o nospace + return + ;; + --theme | -!(-*)T) + local conf_path=~/.config/feh/themes + local theme_name theme_opts + [[ -r $conf_path ]] || return + while read theme_name theme_opts; do + if [[ $theme_name == '#'* || $theme_name == "" ]]; then + continue + fi + COMPREPLY+=($(compgen -W "$theme_name" -- "$cur")) + done <"$conf_path" + return + ;; + --sort | -!(-*)S) + COMPREPLY=($(compgen -W 'name filename mtime width height + pixels size format' -- "$cur")) + return + ;; + --reload | --limit-height | --limit-width | --thumb-height | --thumb-width | \ + --thumb-redraw | --magick-timeout | -!(-*)[RHWEyJ]) + # expect integer value + COMPREPLY+=($(compgen -W '{0..9}')) + compopt -o nospace + return + ;; + --zoom) + # expect integer value or "max", "fill" + COMPREPLY=($(compgen -W 'max fill' -- "$cur")) + if [[ ! $cur || ! ${COMPREPLY-} ]]; then + COMPREPLY+=($(compgen -W '{0..9}')) + compopt -o nospace + fi + return + ;; + --alpha | -!(-*)a) + COMPREPLY=($(compgen -W '{0..255}' -- "$cur")) + return + ;; + --bg | -!(-*)b) + _filedir + COMPREPLY+=($(compgen -W 'trans' -- "$cur")) + return + ;; + --geometry | --max-dimension | --min-dimension | -!(-*)g) + # expect string like 640x480 + if [[ $cur && $cur != *x* ]]; then + COMPREPLY=(x) + fi + COMPREPLY+=($(compgen -W "{0..9}")) + compopt -o nospace + return + ;; + --customlist | --index-info | --info | --slideshow-delay | --thumb-title | \ + --title | -!(-*)[LD~^]) + # argument required but no completions available + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + # Some versions of feh just output "See 'man feh'" for --help :( + COMPREPLY=($(compgen -W '$(_parse_help "$1" --help)' -- "$cur")) + if [[ ${COMPREPLY-} ]]; then + [[ $COMPREPLY == *= ]] && compopt -o nospace + return + fi + fi + + # 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 + +# ex: filetype=sh diff --git a/completions/file b/completions/file new file mode 100644 index 0000000..21fbd16 --- /dev/null +++ b/completions/file @@ -0,0 +1,32 @@ +# file(1) completion -*- shell-script -*- + +_file() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --help | --version | --separator | -!(-*)[vF]) + return + ;; + --magic-file | --files-from | -!(-*)[mf]) + _filedir + return + ;; + --exclude | -!(-*)e) + COMPREPLY=($(compgen -W 'apptype ascii cdf compress elf encoding + soft tar text tokens troff' -- "$cur")) + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + return + fi + + _filedir +} && + complete -F _file file + +# ex: filetype=sh diff --git a/completions/file-roller b/completions/file-roller new file mode 100644 index 0000000..1d223fd --- /dev/null +++ b/completions/file-roller @@ -0,0 +1,42 @@ +# file-roller(1) completion -*- shell-script -*- + +_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|rar|?(g)tar|gem|lh[az]|lz[4h]|?(t)lrz|lzma|lzo|wim|swm|rpm|sit|zoo)' + + case $prev in + --help | --help-all | --help-gtk | --help-sm-client | -!(-*)'?') + return + ;; + --sm-client-state-file) + _filedir + return + ;; + --add-to | -!(-*)a) + _filedir_xspec unzip + _filedir "$exts" + return + ;; + --extract-to | --default-dir | -!(-*)e) + _filedir -d + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1" --help-all)' -- "$cur")) + [[ ${COMPREPLY-} == *= ]] && compopt -o nospace + return + fi + + _filedir_xspec unzip + _filedir "$exts" +} && + complete -F _file_roller file-roller + +# ex: filetype=sh diff --git a/completions/filefrag b/completions/filefrag new file mode 100644 index 0000000..d26e8c8 --- /dev/null +++ b/completions/filefrag @@ -0,0 +1,17 @@ +# filefrag(8) completion -*- shell-script -*- + +_filefrag() +{ + local cur prev words cword + _init_completion || return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1")' -- "$cur")) + return + fi + + _filedir +} && + complete -F _filefrag filefrag + +# ex: filetype=sh diff --git a/completions/filesnarf b/completions/filesnarf new file mode 100644 index 0000000..f959d80 --- /dev/null +++ b/completions/filesnarf @@ -0,0 +1,22 @@ +# filesnarf etc completion -*- shell-script -*- + +_snarf() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -i) + _available_interfaces -a + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1")' -- "$cur")) + fi + +} && + complete -F _snarf filesnarf mailsnarf msgsnarf + +# ex: filetype=sh diff --git a/completions/find b/completions/find new file mode 100644 index 0000000..64121ed --- /dev/null +++ b/completions/find @@ -0,0 +1,113 @@ +# bash completion for GNU find -*- shell-script -*- +# This makes heavy use of ksh style extended globs and contains Linux specific +# code for completing the parameter to the -fstype option. + +_find() +{ + local cur prev words cword + _init_completion || return + + local i + for i in ${!words[*]}; do + if [[ ${words[i]} == -@(exec|ok)?(dir) ]]; then + _command_offset $((i + 1)) + return + fi + done + + case $prev in + -maxdepth | -mindepth) + COMPREPLY=($(compgen -W '{0..9}' -- "$cur")) + return + ;; + -newer | -anewer | -cnewer | -fls | -fprint | -fprint0 | -fprintf | -name | -[il]name | \ + -ilname | -wholename | -[il]wholename | -samefile) + _filedir + return + ;; + -fstype) + _fstypes + [[ $OSTYPE == *bsd* ]] && + COMPREPLY+=($(compgen -W 'local rdonly' -- "$cur")) + return + ;; + -gid) + _gids + return + ;; + -group) + COMPREPLY=($(compgen -g -- "$cur" 2>/dev/null)) + return + ;; + -xtype | -type) + COMPREPLY=($(compgen -W 'b c d p f l s' -- "$cur")) + return + ;; + -uid) + _uids + return + ;; + -user) + COMPREPLY=($(compgen -u -- "$cur")) + return + ;; + -[acm]min | -[acm]time | -inum | -path | -ipath | -regex | -iregex | -links | -perm | \ + -size | -used | -printf | -context) + # do nothing, just wait for a parameter to be given + return + ;; + -regextype) + COMPREPLY=($(compgen -W 'emacs posix-awk posix-basic posix-egrep + posix-extended' -- "$cur")) + return + ;; + esac + + local i exprfound=false + # set exprfound to true if there is already an expression present + for i in "${words[@]}"; do + [[ $i == [-\(\),\!]* ]] && exprfound=true && break + done + + # handle case where first parameter is not a dash option + if ! $exprfound && [[ $cur != [-\(\),\!]* ]]; then + _filedir -d + return + fi + + # complete using basic options + COMPREPLY=($(compgen -W '-daystart -depth -follow -help + -ignore_readdir_race -maxdepth -mindepth -mindepth -mount + -noignore_readdir_race -noleaf -regextype -version -warn -nowarn -xdev + -amin -anewer -atime -cmin -cnewer -ctime -empty -executable -false + -fstype -gid -group -ilname -iname -inum -ipath -iregex -iwholename + -links -lname -mmin -mtime -name -newer -nogroup -nouser -path -perm + -readable -regex -samefile -size -true -type -uid -used -user + -wholename -writable -xtype -context -delete -exec -execdir -fls + -fprint -fprint0 -fprintf -ls -ok -okdir -print -print0 -printf -prune + -quit' -- "$cur")) + + if ((${#COMPREPLY[@]} != 0)); then + # this removes any options from the list of completions that have + # already been specified somewhere on the command line, as long as + # these options can only be used once (in a word, "options", in + # opposition to "tests" and "actions", as in the find(1) manpage). + local -A onlyonce=([-daystart]=1 [-depth]=1 [-follow]=1 [-help]=1 + [-ignore_readdir_race]=1 [-maxdepth]=1 [-mindepth]=1 [-mount]=1 + [-noignore_readdir_race]=1 [-noleaf]=1 [-nowarn]=1 [-regextype]=1 + [-version]=1 [-warn]=1 [-xdev]=1) + local j + for i in "${words[@]}"; do + [[ $i && -v onlyonce["$i"] ]] || continue + for j in "${!COMPREPLY[@]}"; do + [[ ${COMPREPLY[j]} == "$i" ]] && unset 'COMPREPLY[j]' + done + done + fi + + _filedir + +} && + complete -F _find find + +# ex: filetype=sh diff --git a/completions/find_member b/completions/find_member new file mode 100644 index 0000000..cf30c70 --- /dev/null +++ b/completions/find_member @@ -0,0 +1,25 @@ +# mailman find_member completion -*- shell-script -*- + +_find_member() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + -l | -x | --listname | --exclude) + _xfunc list_lists _mailman_lists + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '--listname --exclude --owners --help' \ + -- "$cur")) + fi + +} && + complete -F _find_member find_member + +# ex: filetype=sh diff --git a/completions/fio b/completions/fio new file mode 100644 index 0000000..f81a4da --- /dev/null +++ b/completions/fio @@ -0,0 +1,90 @@ +# fio(1) completion -*- shell-script -*- + +_fio() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + --help | --version) + return + ;; + --debug) + local prefix= + [[ $cur == *,* ]] && prefix="${cur%,*}," + COMPREPLY=($(compgen -W "process file io mem blktrace verify + random parse diskutil job mutex profile time net rate compress + steadystate helperthread" -- "${cur##*,}")) + ((${#COMPREPLY[@]} == 1)) && COMPREPLY=(${COMPREPLY/#/$prefix}) + return + ;; + --output-format) + COMPREPLY=($(compgen -W "terse json json+ normal" -- "$cur")) + return + ;; + --terse-version) + COMPREPLY=($(compgen -W "2 3" -- "$cur")) + return + ;; + --cmdhelp) + # TODO more commands? + COMPREPLY=($(compgen -W "all" -- "$cur")) + return + ;; + --enghelp) + # TODO print ioengine help, or list available ioengines + # TODO engine,help arg + return + ;; + --eta) + COMPREPLY=($(compgen -W "always never auto" -- "$cur")) + return + ;; + --daemonize) + _filedir pid + return + ;; + --client) + _known_hosts_real -- "$cur" + return + ;; + --remote-config) + _filedir job + return + ;; + --idle-prof) + COMPREPLY=($(compgen -W "system percpu calibrate" -- "$cur")) + return + ;; + --inflate-log) + _filedir log + return + ;; + --trigger-file) + _filedir + return + ;; + --trigger | --trigger-remote) + compopt -o filenames + COMPREPLY=($(compgen -c -- "$cur")) + return + ;; + --aux-path) + _filedir -d + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + [[ ${COMPREPLY-} == *= ]] && compopt -o nospace + return + fi + + _filedir job +} && + complete -F _fio fio + +# ex: filetype=sh diff --git a/completions/firefox b/completions/firefox new file mode 100644 index 0000000..4656f8d --- /dev/null +++ b/completions/firefox @@ -0,0 +1,46 @@ +# firefox completion -*- shell-script -*- + +_firefox() +{ + local cur prev words cword split + _init_completion -s || return + + [[ $cur == -MOZ_LOG*=* ]] && prev=${cur%%=*} cur=${cur#*=} + + case $prev in + --help | --version | --display | --UILocale | -MOZ_LOG | --new-window | --new-tab | \ + --private-window | --window-size | --search | --start-debugger-server | \ + --recording | --debugger-args | -[hvPa]) + return + ;; + --profile | --screenshot) + _filedir -d + return + ;; + -MOZ_LOG_FILE) + _filedir log + return + ;; + --recording-file) + _filedir + return + ;; + --debugger | -d) + COMPREPLY=($(compgen -c -- "$cur")) + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + [[ ${COMPREPLY-} == *= ]] && compopt -o nospace + return + fi + + _filedir "@(?([xs])htm?(l)|pdf|txt)" +} && + complete -F _firefox firefox mozilla-firefox iceweasel + +# ex: filetype=sh diff --git a/completions/flake8 b/completions/flake8 new file mode 100644 index 0000000..045c409 --- /dev/null +++ b/completions/flake8 @@ -0,0 +1,42 @@ +# flake8 completion -*- shell-script -*- + +_flake8() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + --help | --version | -!(-*)h) + return + ;; + --format) + COMPREPLY=($(compgen -W 'default pylint' -- "$cur")) + return + ;; + --jobs | -!(-*)j) + COMPREPLY=($(compgen -W "auto {1..$(_ncpus)}" -- "$cur")) + return + ;; + --output-file | --append-config | --config) + _filedir + return + ;; + --include-in-doctest | --exclude-from-doctest) + _filedir py + 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 0000000..d5be861 --- /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 b/completions/freeciv new file mode 100644 index 0000000..01af311 --- /dev/null +++ b/completions/freeciv @@ -0,0 +1,41 @@ +# freeciv client completions -*- shell-script -*- + +_freeciv() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --help | --version | --name | --port | -[hvnp]) + return + ;; + --file | --log | --music | --read | --Sound | --tiles | -[flmrSt]) + _filedir + return + ;; + --Announce | -A) + COMPREPLY=($(compgen -W 'IPv4 IPv6 none' -- "$cur")) + return + ;; + --debug | -d) + COMPREPLY=($(compgen -W '{0..3}' -- "$cur")) + return + ;; + --Meta | --server | -[Ms]) + _known_hosts_real -- "$cur" + return + ;; + --Plugin | -P) + COMPREPLY=($(compgen -W 'none esd sdl' -- "$cur")) + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + fi + +} && + complete -F _freeciv freeciv{,-{gtk{2,3},sdl,xaw}} civclient + +# ex: filetype=sh diff --git a/completions/freeciv-server b/completions/freeciv-server new file mode 100644 index 0000000..a34b5a2 --- /dev/null +++ b/completions/freeciv-server @@ -0,0 +1,22 @@ +# freeciv-server completion -*- shell-script -*- + +_civserver() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -f | -g | -l | -r | --file | --log | --gamelog | --read) + _filedir + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + fi + +} && + complete -F _civserver civserver freeciv-server + +# ex: filetype=sh diff --git a/completions/function b/completions/function new file mode 100644 index 0000000..6ae5271 --- /dev/null +++ b/completions/function @@ -0,0 +1,37 @@ +# bash shell function completion -*- shell-script -*- + +_function() +{ + local cur prev words cword + _init_completion || return + + if [[ $1 == @(declare|typeset) ]]; then + 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 > 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 == 1)); then + COMPREPLY=($(compgen -A function -- "$cur")) + else + COMPREPLY=("() $(type -- ${words[1]} | command sed -e 1,2d)") + fi +} && + complete -F _function function declare typeset + +# ex: filetype=sh diff --git a/completions/fusermount b/completions/fusermount new file mode 100644 index 0000000..7e48922 --- /dev/null +++ b/completions/fusermount @@ -0,0 +1,28 @@ +# fusermount completion -*- shell-script -*- + +_fusermount() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -*[hVo]) + return + ;; + -*u) + COMPREPLY=($(compgen -W "$(awk \ + '{ if ($3 ~ /^fuse(\.|$)/) print $2 }' /etc/mtab \ + 2>/dev/null)" -- "$cur")) + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1" -h)' -- "$cur")) + else + _filedir -d + fi +} && + complete -F _fusermount fusermount + +# ex: filetype=sh diff --git a/completions/gcc b/completions/gcc new file mode 100644 index 0000000..fa95274 --- /dev/null +++ b/completions/gcc @@ -0,0 +1,75 @@ +# gcc(1) completion -*- shell-script -*- + +_gcc() +{ + local cur prev prev2 words cword argument prefix prefix_length + _init_completion || return + + # Test that GCC is recent enough and if not fallback to + # parsing of --completion option. + if ! $1 --completion=" " 2>/dev/null; then + if [[ $cur == -* ]]; then + local cc=$($1 -print-prog-name=cc1 2>/dev/null) + [[ $cc ]] || return + COMPREPLY=($(compgen -W "$($cc --help 2>/dev/null | tr '\t' ' ' | + command sed -e '/^ *-/!d' -e 's/ *-\([^][ <>]*\).*/-\1/')" \ + -- "$cur")) + [[ ${COMPREPLY-} == *= ]] && compopt -o nospace + else + _filedir + fi + return + fi + + # extract also for situations like: -fsanitize=add + if ((cword > 2)); then + prev2="${COMP_WORDS[cword - 2]}" + fi + + # sample: -fsan + if [[ $cur == -* ]]; then + argument=$cur + prefix="" + # sample: -fsanitize= + elif [[ $cur == "=" && $prev == -* ]]; then + argument=$prev$cur + prefix=$prev$cur + # sample: -fsanitize=add + elif [[ $prev == "=" && $prev2 == -* ]]; then + argument=$prev2$prev$cur + prefix=$prev2$prev + # sample: --param lto- + elif [[ $prev == --param ]]; then + argument="$prev $cur" + prefix="$prev " + fi + + if [[ ! -v argument ]]; then + _filedir + else + # In situation like '-fsanitize=add' $cur is equal to last token. + # Thus we need to strip the beginning of suggested option. + prefix_length=$((${#prefix} + 1)) + local flags=$($1 --completion="$argument" | cut -c $prefix_length-) + [[ ${flags} == "=*" ]] && compopt -o nospace 2>/dev/null + COMPREPLY=($(compgen -W "$flags" -- "")) + fi +} && + complete -F _gcc gcc{,-5,-6,-7,-8} g++{,-5,-6,-7,-8} g77 g95 \ + gccgo{,-5,-6,-7,-8} gcj gfortran{,-5,-6,-7,-8} gpc && + { + 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: filetype=sh diff --git a/completions/gcl b/completions/gcl new file mode 100644 index 0000000..73a18b2 --- /dev/null +++ b/completions/gcl @@ -0,0 +1,21 @@ +# -*- shell-script -*- +# bash programmable completion for various Common Lisp implementations by +# Nikodemus Siivola + +_gcl() +{ + local cur prev words cword + _init_completion || return + + # completing an option (may or may not be separated by a space) + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '-eval -load -f -batch -dir -libdir -compile + -o-file -c-file -h-file -data-file -system-p' -- "$cur")) + else + _filedir + fi + +} && + complete -F _gcl -o default gcl + +# ex: filetype=sh diff --git a/completions/gdb b/completions/gdb new file mode 100644 index 0000000..f78f8a5 --- /dev/null +++ b/completions/gdb @@ -0,0 +1,47 @@ +# bash completion for gdb -*- shell-script -*- + +_gdb() +{ + 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 == 1)); then + local IFS + compopt -o filenames + if [[ $cur == */* ]]; then + # compgen -c works as expected if $cur contains any slashes. + IFS=$'\n' + COMPREPLY=($(PATH="$PATH:." compgen -d -c -- "$cur")) + else + # otherwise compgen -c contains Bash's built-in commands, + # functions and aliases. Thus we need to retrieve the program + # names manually. + IFS=":" + local path_array=($( + 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 \ + -printf "%f\\n" 2>/dev/null)' -- "$cur")) + fi + elif ((cword == 2)); then + COMPREPLY=($(compgen -W "$(command ps axo comm,pid | + awk '{if ($1 ~ /^'"${prev##*/}"'/) print $2}')" -- "$cur")) + compopt -o filenames + COMPREPLY+=($(compgen -f -X '!?(*/)core?(.?*)' -o plusdirs \ + -- "$cur")) + fi +} && + complete -F _gdb gdb + +# ex: filetype=sh diff --git a/completions/genaliases b/completions/genaliases new file mode 100644 index 0000000..5953b9e --- /dev/null +++ b/completions/genaliases @@ -0,0 +1,15 @@ +# mailman genaliases completion -*- shell-script -*- + +_genaliases() +{ + local cur prev words cword + _init_completion || return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '--quiet --help' -- "$cur")) + fi + +} && + complete -F _genaliases genaliases + +# ex: filetype=sh diff --git a/completions/gendiff b/completions/gendiff new file mode 100644 index 0000000..d37793f --- /dev/null +++ b/completions/gendiff @@ -0,0 +1,12 @@ +# gendiff(1) completion -*- shell-script -*- + +_gendiff() +{ + local cur prev words cword + _init_completion -o '@(diff|patch)' || return + + ((cword == 1)) && _filedir -d +} && + complete -F _gendiff gendiff + +# ex: filetype=sh diff --git a/completions/genisoimage b/completions/genisoimage new file mode 100644 index 0000000..dfa39c0 --- /dev/null +++ b/completions/genisoimage @@ -0,0 +1,38 @@ +# bash completion for mkisofs/genisoimage -*- shell-script -*- + +_mkisofs() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -o | -abstract | -biblio | -check-session | -copyright | -log-file | \ + -root-info | -prep-boot | -*-list) + _filedir + return + ;; + -*-charset) + COMPREPLY=($(compgen -W '$(mkisofs -input-charset \ + help 2>&1 | tail -n +3)' -- "$cur")) + return + ;; + -uid) + _uids + return + ;; + -gid) + _gids + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1" -help)' -- "$cur")) + else + _filedir + fi + +} && + complete -F _mkisofs mkisofs genisoimage + +# ex: filetype=sh diff --git a/completions/geoiplookup b/completions/geoiplookup new file mode 100644 index 0000000..c60be89 --- /dev/null +++ b/completions/geoiplookup @@ -0,0 +1,33 @@ +# geoiplookup(1) completion -*- shell-script -*- + +_geoiplookup() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -h | -'?' | -v) + return + ;; + -d) + _filedir -d + return + ;; + -f) + _filedir dat + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1" -h)' -- "$cur")) + return + fi + + local ipvx + [[ $1 == *6 ]] && ipvx=-6 || ipvx=-4 + _known_hosts_real $ipvx -- "$cur" +} && + complete -F _geoiplookup geoiplookup geoiplookup6 + +# ex: filetype=sh diff --git a/completions/getconf b/completions/getconf new file mode 100644 index 0000000..de1ad2d --- /dev/null +++ b/completions/getconf @@ -0,0 +1,32 @@ +# getconf(1) completion -*- shell-script -*- + +_getconf() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -a) + _filedir + return + ;; + -v) + COMPREPLY=($(compgen -W \ + '$("$1" -a 2>/dev/null | awk "{ print \$1 }")' -- \ + "${cur:-POSIX_V}")) + return + ;; + esac + + if [[ $prev == PATH_MAX ]]; then # TODO more path vars, better handling + _filedir + elif [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '-a -v' -- "$cur")) + else + COMPREPLY=($(compgen -W \ + '$("$1" -a 2>/dev/null | awk "{ print \$1 }")' -- "$cur")) + fi +} && + complete -F _getconf getconf + +# ex: filetype=sh diff --git a/completions/getent b/completions/getent new file mode 100644 index 0000000..4c54a24 --- /dev/null +++ b/completions/getent @@ -0,0 +1,77 @@ +# bash completion for getent -*- shell-script -*- + +_getent() +{ + local cur prev words cword split + _init_completion -s || return + + local i db + for ((i = 1; i < cword; i++)); do + case ${words[i]} in + --version | --usage | --help | -!(-*)[V?]) + return + ;; + --service | -!(-*)s) + ((i++)) + ;; + -*) ;; + + *) + # First non-option value is the db + db=${words[i]} + break + ;; + esac + done + + case ${db-} in + passwd) + COMPREPLY=($(compgen -u -- "$cur")) + return + ;; + group) + COMPREPLY=($(compgen -g -- "$cur")) + return + ;; + services) + COMPREPLY=($(compgen -s -- "$cur")) + return + ;; + hosts) + COMPREPLY=($(compgen -A hostname -- "$cur")) + return + ;; + protocols | networks | ahosts | ahostsv4 | ahostsv6 | rpc) + COMPREPLY=($(compgen -W "$($1 $db | + awk '{ print $1 }')" -- "$cur")) + return + ;; + aliases | shadow | gshadow) + COMPREPLY=($(compgen -W "$($1 $db | cut -d: -f1)" -- "$cur")) + return + ;; + ethers | netgroup) + return + ;; + esac + + case $prev in + -s | --service) + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + [[ ${COMPREPLY-} == *= ]] && compopt -o nospace + elif [[ ! -v db ]]; then + COMPREPLY=($(compgen -W 'passwd group hosts services protocols + networks ahosts ahostsv4 ahostsv6 aliases ethers netgroup rpc + shadow gshadow' -- "$cur")) + fi +} && + complete -F _getent getent + +# ex: filetype=sh diff --git a/completions/gkrellm b/completions/gkrellm new file mode 100644 index 0000000..c38c5ae --- /dev/null +++ b/completions/gkrellm @@ -0,0 +1,39 @@ +# gkrellm(1) completion -*- shell-script -*- + +_gkrellm() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -t | --theme) + _filedir -d + return + ;; + -p | --plugin) + _filedir so + return + ;; + -s | --server) + _known_hosts_real -- "$cur" + return + ;; + -l | --logfile) + _filedir + return + ;; + -g | --geometry | -c | --config | -P | --port | -d | --debug-level) + # Argument required but no completions available + return + ;; + -h | --help | -v | --version) + # All other options are noop with these + return + ;; + esac + + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) +} && + complete -F _gkrellm gkrellm gkrellm2 + +# ex: filetype=sh diff --git a/completions/gm b/completions/gm new file mode 100644 index 0000000..b86c9cc --- /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 == 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 new file mode 100644 index 0000000..5f4b963 --- /dev/null +++ b/completions/gnatmake @@ -0,0 +1,26 @@ +# Gnatmake completion -*- shell-script -*- +# by Ralf_Schroth@t-online.de (Ralf Schroth) + +_gnatmake() +{ + local cur prev words cword + _init_completion || return + + 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")) + else + # source file completion + _filedir '@(adb|ads)' + fi +} && + complete -F _gnatmake gnatmake + +# ex: filetype=sh diff --git a/completions/gnokii b/completions/gnokii new file mode 100644 index 0000000..039141a --- /dev/null +++ b/completions/gnokii @@ -0,0 +1,237 @@ +# 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 new file mode 100644 index 0000000..32d93fc --- /dev/null +++ b/completions/gnome-mplayer @@ -0,0 +1,38 @@ +# gnome-mplayer(1) completion -*- shell-script -*- + +_gnome_mplayer() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + -'?' | --help | --help-all | --help-gtk) + return + ;; + --showcontrols | --showsubtitles | --autostart) + COMPREPLY=($(compgen -w '0 1' -- "$cur")) + return + ;; + --subtitle) + _filedir '@(srt|sub|txt|utf|rar|mpsub|smi|js|ssa|ass)' + return + ;; + --tvdriver) + COMPREPLY=($(compgen -W 'v4l v4l2' -- "$cur")) + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1" --help-all)' -- "$cur")) + [[ ${COMPREPLY-} == *= ]] && compopt -o nospace + return + fi + + _filedir +} && + complete -F _gnome_mplayer gnome-mplayer + +# ex: filetype=sh diff --git a/completions/gnome-screenshot b/completions/gnome-screenshot new file mode 100644 index 0000000..b3594d2 --- /dev/null +++ b/completions/gnome-screenshot @@ -0,0 +1,31 @@ +# gnome-screenshot(1) completion -*- shell-script -*- + +_gnome_screenshot() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + --help | --help-* | --version | --delay | --display | -!(-*)[hd]) + return + ;; + --border-effect | -!(-*)e) + COMPREPLY=($(compgen -W 'shadow border vintage none' -- "$cur")) + return + ;; + --file | -!(-*)f) + _filedir '@(jp?(e)|pn)g' + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + [[ ${COMPREPLY-} == *= ]] && compopt -o nospace + fi +} && + complete -F _gnome_screenshot gnome-screenshot + +# ex: filetype=sh diff --git a/completions/gpasswd b/completions/gpasswd new file mode 100644 index 0000000..f1f2200 --- /dev/null +++ b/completions/gpasswd @@ -0,0 +1,25 @@ +# gpasswd(1) completion -*- shell-script -*- + +_gpasswd() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --add | --delete | --administrators | --members | -!(-*)[adAM]) + COMPREPLY=($(compgen -u -- "$cur")) + return + ;; + esac + + if [[ $cur == -* ]]; then + # TODO: only -A and -M can be combined + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + return + fi + + COMPREPLY=($(compgen -g -- "$cur")) +} && + complete -F _gpasswd gpasswd + +# ex: filetype=sh diff --git a/completions/gpg b/completions/gpg new file mode 100644 index 0000000..f0ca884 --- /dev/null +++ b/completions/gpg @@ -0,0 +1,38 @@ +# bash completion for gpg -*- shell-script -*- + +_gpg() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --sign | --clearsign | --decrypt-files | --load-extension | -!(-*)s) + _filedir + return + ;; + --export | --sign-key | --lsign-key | --nrsign-key | --nrlsign-key | --edit-key) + # return list of public keys + COMPREPLY=($(compgen -W "$($1 --list-keys 2>/dev/null | command sed -ne \ + 's@^pub.*/\([^ ]*\).*$@\1@p' -ne \ + 's@^.*\(<\([^>]*\)>\).*$@\2@p')" -- "$cur")) + return + ;; + --recipient | -!(-*)r) + 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 "$(command sed -ne \ + 's@^[ \t]*group[ \t][ \t]*\([^=]*\).*$@\1@p' \ + ~/.gnupg/gpg.conf)" -- "$cur")) + fi + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$($1 --dump-options)' -- "$cur")) + fi +} && + complete -F _gpg -o default gpg + +# ex: filetype=sh diff --git a/completions/gpg2 b/completions/gpg2 new file mode 100644 index 0000000..cfa4023 --- /dev/null +++ b/completions/gpg2 @@ -0,0 +1,42 @@ +# gpg2(1) completion -*- shell-script -*- + +_gpg2() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --homedir) + _filedir -d + return + ;; + --sign | --clearsign | --options | --decrypt | -!(-*)s) + _filedir + return + ;; + --export | --sign-key | --lsign-key | --nrsign-key | --nrlsign-key | --edit-key) + # return list of public keys + COMPREPLY=($(compgen -W "$($1 --list-keys 2>/dev/null | command sed -ne \ + 's@^pub.*/\([^ ]*\).*$@\1@p' -ne \ + 's@^.*\(<\([^>]*\)>\).*$@\2@p')" -- "$cur")) + return + ;; + --recipient | -!(-*)r) + 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 "$(command sed -ne \ + 's@^[ \t]*group[ \t][ \t]*\([^=]*\).*$@\1@p' \ + ~/.gnupg/gpg.conf)" -- "$cur")) + fi + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$($1 --dump-options)' -- "$cur")) + fi +} && + complete -F _gpg2 -o default gpg2 + +# ex: filetype=sh diff --git a/completions/gpgv b/completions/gpgv new file mode 100644 index 0000000..29315c9 --- /dev/null +++ b/completions/gpgv @@ -0,0 +1,46 @@ +# gpgv(1) completion -*- shell-script -*- + +_gpgv() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --help | --version | --weak-digest | --*-fd | -!(-*)[?h]*) + return + ;; + --keyring) + _filedir "@(gpg|kbx)" + return + ;; + --homedir) + _filedir -d + return + ;; + esac + + local args + _count_args "" "--@(weak-digest|*-fd|keyring|homedir)" + + if [[ $cur == -* && $args -eq 1 ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + return + fi + + if ((args > 1)); then + if [[ ${COMP_LINE,,} == *.@(asc|sig|sign)\ * ]]; then + # Detached signature, only complete one arbitrary file arg and - + if ((args == 2)); then + COMPREPLY=($(compgen -W '-' -- "$cur")) + _filedir + fi + else + _filedir gpg + fi + else + _filedir "@(asc|gpg|sig|sign)" + fi +} && + complete -F _gpgv gpgv gpgv2 + +# ex: filetype=sh diff --git a/completions/gphoto2 b/completions/gphoto2 new file mode 100644 index 0000000..cbf84c0 --- /dev/null +++ b/completions/gphoto2 @@ -0,0 +1,55 @@ +# bash completion for gphoto2(1) -*- shell-script -*- + +_gphoto2() +{ + local cur prev words cword split + _init_completion -s -n : || return + + case $prev in + --debug-logfile) + _filedir + return + ;; + --hook-script) + _filedir + return + ;; + --filename) + _filedir + return + ;; + -u | --upload-file) + _filedir + return + ;; + --port) + 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 "$($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 "$( + $1 --list-config 2>/dev/null + )" -- "$cur")) + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + [[ ${COMPREPLY-} == *= ]] && compopt -o nospace + fi + +} && + complete -F _gphoto2 gphoto2 + +# ex: filetype=sh diff --git a/completions/gprof b/completions/gprof new file mode 100644 index 0000000..5a4ab2d --- /dev/null +++ b/completions/gprof @@ -0,0 +1,56 @@ +# gprof(1) completion -*- shell-script -*- + +_gprof() +{ + local cur prev words cword split + _init_completion -s || return + + case $cur in + -A* | -C* | -J* | -p* | -P* | -q* | -Q* | -n* | -N* | -d*) + return + ;; + -S*) + cur=${cur:2} + _filedir + COMPREPLY=("${COMPREPLY[@]/#/-S}") + return + ;; + -O*) + cur=${cur:2} + COMPREPLY=($(compgen -P -O -W 'auto bsd 4.4bsd magic prof' \ + -- "$cur")) + return + ;; + esac + + case $prev in + -I | --directory-path) + _filedir -d + return + ;; + -R | --file-ordering | --external-symbol-table) + _filedir + return + ;; + -w | --width | -k | -m | --min-count | -h | --help | -e | -E | -f | -F) + return + ;; + --file-format) + COMPREPLY=($(compgen -W 'auto bsd 4.4bsd magic prof' -- "$cur")) + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1")' -- "$cur")) + [[ ${COMPREPLY-} == *= ]] && compopt -o nospace + return + fi + + _filedir +} && + complete -F _gprof gprof + +# ex: filetype=sh diff --git a/completions/groupadd b/completions/groupadd new file mode 100644 index 0000000..5f67f29 --- /dev/null +++ b/completions/groupadd @@ -0,0 +1,26 @@ +# groupadd(8) completion -*- shell-script -*- + +_groupadd() +{ + local cur prev words cword split + _init_completion -s || return + + # TODO: if -o/--non-unique is given, could complete on existing gids + # with -g/--gid + + case $prev in + --gid | --key | --password | -!(-*)[gKp]) + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + [[ ${COMPREPLY-} == *= ]] && compopt -o nospace + fi +} && + complete -F _groupadd groupadd + +# ex: filetype=sh diff --git a/completions/groupdel b/completions/groupdel new file mode 100644 index 0000000..4d8ca7f --- /dev/null +++ b/completions/groupdel @@ -0,0 +1,27 @@ +# groupdel(8) completion -*- shell-script -*- + +_groupdel() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -h | --help) + return + ;; + -R | --root) + _filedir -d + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + return + fi + + COMPREPLY=($(compgen -g -- "$cur")) +} && + complete -F _groupdel groupdel + +# ex: filetype=sh diff --git a/completions/groupmems b/completions/groupmems new file mode 100644 index 0000000..2e89a5a --- /dev/null +++ b/completions/groupmems @@ -0,0 +1,27 @@ +# groupmems(8) completion -*- shell-script -*- + +_groupmems() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -a | --add | -d | --delete) + COMPREPLY=($(compgen -u -- "$cur")) + return + ;; + -g | --group) + COMPREPLY=($(compgen -g -- "$cur")) + return + ;; + -R | --root) + _filedir -d + return + ;; + esac + + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) +} && + complete -F _groupmems groupmems + +# ex: filetype=sh diff --git a/completions/groupmod b/completions/groupmod new file mode 100644 index 0000000..5516d31 --- /dev/null +++ b/completions/groupmod @@ -0,0 +1,29 @@ +# groupmod(8) completion -*- shell-script -*- + +_groupmod() +{ + local cur prev words cword split + _init_completion -s || return + + # TODO: if -o/--non-unique is given, could complete on existing gids + # with -g/--gid + + case $prev in + --gid | --help | --new-name | --password | -!(-*)[ghnp]) + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + [[ ${COMPREPLY-} == *= ]] && compopt -o nospace + return + fi + + COMPREPLY=($(compgen -g -- "$cur")) +} && + complete -F _groupmod groupmod + +# ex: filetype=sh diff --git a/completions/growisofs b/completions/growisofs new file mode 100644 index 0000000..ee09fe6 --- /dev/null +++ b/completions/growisofs @@ -0,0 +1,39 @@ +# growisofs(1) completion -*- shell-script -*- + +_growisofs() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -version | -speed) + return + ;; + -Z | -M) + compopt -o nospace + _dvd_devices + return + ;; + /?(r)dev/*) + if [[ $cur == =* ]]; then + # e.g. /dev/dvd=foo.iso, /dev/dvdrw=/dev/zero + cur="${cur#=}" + _filedir + return + fi + ;; + esac + + if [[ $cur == -* ]]; then + # TODO: mkisofs options + COMPREPLY=($(compgen -W '-dvd-compat -overburn -speed= -Z -M' \ + -- "$cur")) + [[ ${COMPREPLY-} == *= ]] && compopt -o nospace + return + fi + + _filedir +} && + complete -F _growisofs growisofs + +# ex: filetype=sh diff --git a/completions/grpck b/completions/grpck new file mode 100644 index 0000000..0fadbed --- /dev/null +++ b/completions/grpck @@ -0,0 +1,25 @@ +# grpck(8) completion -*- shell-script -*- + +_grpck() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --root | -!(-*)R) + _filedir + return + ;; + esac + + if [[ $cur == -* ]]; then + local opts=$(_parse_help "$1") + COMPREPLY=($(compgen -W '${opts:-$(_parse_usage "$1")}' -- "$cur")) + return + fi + + _filedir +} && + complete -F _grpck grpck + +# ex: filetype=sh diff --git a/completions/gssdp-discover b/completions/gssdp-discover new file mode 100644 index 0000000..8454f52 --- /dev/null +++ b/completions/gssdp-discover @@ -0,0 +1,34 @@ +# bash completion for gssdp-discover -*- shell-script -*- + +_gssdp_discover() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + --help | --target | --timeout | --rescan-interval | -[htnr]) + return + ;; + --interface | -i) + _available_interfaces -a + return + ;; + --message-type | -m) + local types=$($1 --help 2>&1 | + command sed -ne 's/^.*--message-type=.*(\([^)]*\))$/\1/p') + COMPREPLY=($( + IFS+=, + compgen -W "$types" -- "$cur" + )) + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + [[ ${COMPREPLY-} == *= ]] && compopt -o nospace + fi +} && + complete -F _gssdp_discover gssdp-discover + +# ex: filetype=sh diff --git a/completions/gzip b/completions/gzip new file mode 100644 index 0000000..0144c3a --- /dev/null +++ b/completions/gzip @@ -0,0 +1,43 @@ +# bash completion for gzip -*- shell-script -*- + +_gzip() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --blocksize | --suffix | --help | --version | -!(-*)[bShV]) + return + ;; + --processes | -!(-*)p) + COMPREPLY=($(compgen -W "{1..$(_ncpus)}" -- "$cur")) + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1") {-1..-9}' -- "$cur")) + [[ ${COMPREPLY-} == *= ]] && compopt -o nospace + return + fi + + local IFS=$'\n' xspec="*.@(gz|t[ag]z)" + [[ ${1##*/} == pigz ]] && xspec="*.@([gz]z|t[ag]z)" + + if [[ $prev == --* ]]; then + [[ $prev == --@(decompress|list|test) ]] && xspec="!"$xspec + [[ $prev == --force ]] && xspec= + elif [[ $prev == -* ]]; then + [[ $prev == -*[dlt]* ]] && xspec="!"$xspec + [[ $prev == -*f* ]] && xspec= + fi + + _tilde "$cur" || return + + compopt -o filenames + COMPREPLY=($(compgen -f -X "$xspec" -- "$cur") + $(compgen -d -- "$cur")) +} && + complete -F _gzip gzip pigz + +# ex: filetype=sh diff --git a/completions/hcitool b/completions/hcitool new file mode 100644 index 0000000..58bf5a7 --- /dev/null +++ b/completions/hcitool @@ -0,0 +1,380 @@ +# bash completion for bluez utils -*- shell-script -*- + +_bluetooth_addresses() +{ + if [[ -n ${COMP_BLUETOOTH_SCAN:-} ]]; then + COMPREPLY+=($(compgen -W "$(hcitool scan | + awk '/^\t/{print $1}')" -- "$cur")) + fi +} + +_bluetooth_devices() +{ + COMPREPLY+=($(compgen -W "$(hcitool dev | + awk '/^\t/{print $1}')" -- "$cur")) +} + +_bluetooth_services() +{ + COMPREPLY=($(compgen -W 'DID SP DUN LAN FAX OPUSH FTP HS HF HFAG SAP NAP + GN PANU HCRP HID CIP A2SRC A2SNK AVRCT AVRTG UDIUE UDITE SYNCML' \ + -- "$cur")) +} + +_bluetooth_packet_types() +{ + COMPREPLY=($(compgen -W 'DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3' \ + -- "$cur")) +} + +_hcitool() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + -i) + _bluetooth_devices + return + ;; + --role) + COMPREPLY=($(compgen -W 'm s' -- "$cur")) + return + ;; + --pkt-type) + _bluetooth_packet_types + return + ;; + esac + + $split && return + + local arg + _get_first_arg + if [[ -z $arg ]]; then + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + else + COMPREPLY=($(compgen -W 'dev inq scan name info spinq epinq cmd + con cc dc sr cpt rssi lq tpl afh lst auth enc key clkoff + clock' -- "$cur")) + fi + else + local args + case $arg in + name | info | dc | rssi | lq | afh | auth | key | clkoff | lst) + _count_args + if ((args == 2)); then + _bluetooth_addresses + fi + ;; + cc) + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '--role --pkt-type' -- "$cur")) + else + _count_args + if ((args == 2)); then + _bluetooth_addresses + fi + fi + ;; + sr) + _count_args + if ((args == 2)); then + _bluetooth_addresses + else + COMPREPLY=($(compgen -W 'master slave' -- "$cur")) + fi + ;; + cpt) + _count_args + if ((args == 2)); then + _bluetooth_addresses + else + _bluetooth_packet_types + fi + ;; + tpl | enc | clock) + _count_args + if ((args == 2)); then + _bluetooth_addresses + else + COMPREPLY=($(compgen -W '0 1' -- "$cur")) + fi + ;; + esac + fi +} && + complete -F _hcitool hcitool + +_sdptool() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + --bdaddr) + _bluetooth_addresses + return + ;; + esac + + $split && return + + local arg + _get_first_arg + if [[ -z $arg ]]; then + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + else + COMPREPLY=($(compgen -W 'search browse records add del get + setattr setseq' -- "$cur")) + fi + else + case $arg in + search) + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '--bdaddr --tree --raw --xml' \ + -- "$cur")) + else + _bluetooth_services + fi + ;; + browse | records) + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '--tree --raw --xml' -- "$cur")) + else + _bluetooth_addresses + fi + ;; + add) + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '--handle --channel' -- "$cur")) + else + _bluetooth_services + fi + ;; + get) + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '--bdaddr --tree --raw --xml' \ + -- "$cur")) + fi + ;; + esac + fi +} && + complete -F _sdptool sdptool + +_l2ping() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -i) + _bluetooth_devices + return + ;; + -s | -c | -t | -d) + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1")' -- "$cur")) + else + _bluetooth_addresses + fi +} && + complete -F _l2ping l2ping + +_rfcomm() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -f | --config) + _filedir + return + ;; + -i) + _bluetooth_devices + _bluetooth_addresses + return + ;; + esac + + local arg + _get_first_arg + if [[ -z $arg ]]; then + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + else + COMPREPLY=($(compgen -W 'show connect listen watch bind + release' -- "$cur")) + fi + else + local args + _count_args + if ((args == 2)); then + _bluetooth_devices + else + case $arg in + connect | bind) + if ((args == 3)); then + _bluetooth_addresses + fi + ;; + esac + fi + fi +} && + complete -F _rfcomm rfcomm + +_ciptool() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -i) + _bluetooth_devices + _bluetooth_addresses + return + ;; + esac + + local arg + _get_first_arg + if [[ -z $arg ]]; then + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + else + COMPREPLY=($(compgen -W 'show search connect release loopback' \ + -- "$cur")) + fi + else + local args + case $arg in + connect | release | loopback) + _count_args + if ((args == 2)); then + _bluetooth_addresses + fi + ;; + esac + fi +} && + complete -F _ciptool ciptool + +_dfutool() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -d | --device) + _bluetooth_devices + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + else + local args + _count_args + case $args in + 1) + COMPREPLY=($(compgen -W 'verify modify upgrade archive' \ + -- "$cur")) + ;; + 2) + _filedir + ;; + esac + fi +} && + complete -F _dfutool dfutool + +_hciconfig() +{ + local cur prev words cword + _init_completion || return + + local arg + _get_first_arg + if [[ -z $arg ]]; then + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '--help --all' -- "$cur")) + else + COMPREPLY=($(compgen -W 'up down reset rstat auth noauth encrypt + noencrypt secmgr nosecmgr piscan noscan iscan pscan ptype name + class voice iac inqmode inqdata inqtype inqparams pageparms + pageto afhmode aclmtu scomtu putkey delkey commands features + version revision lm' -- "$cur")) + fi + else + local args + case $arg in + putkey | delkey) + _count_args + if ((args == 2)); then + _bluetooth_addresses + fi + ;; + lm) + _count_args + if ((args == 2)); then + COMPREPLY=($(compgen -W 'MASTER SLAVE NONE ACCEPT' \ + -- "$cur")) + fi + ;; + ptype) + _count_args + if ((args == 2)); then + _bluetooth_packet_types + fi + ;; + esac + fi +} && + complete -F _hciconfig hciconfig + +_hciattach() +{ + local cur prev words cword + _init_completion || return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '-n -p -t -b -s -l' -- "$cur")) + else + local args + _count_args + case $args in + 1) + COMPREPLY=($(printf '%s\n' /dev/tty*)) + COMPREPLY=($(compgen -W '${COMPREPLY[@]} + ${COMPREPLY[@]#/dev/}' -- "$cur")) + ;; + 2) + COMPREPLY=($(compgen -W 'any ericsson digi xircom csr bboxes + swave bcsp 0x0105 0x080a 0x0160 0x0002' -- "$cur")) + ;; + 3) + COMPREPLY=($(compgen -W '9600 19200 38400 57600 115200 230400 + 460800 921600' -- "$cur")) + ;; + 4) + COMPREPLY=($(compgen -W 'flow noflow' -- "$cur")) + ;; + 5) + _bluetooth_addresses + ;; + esac + fi +} && + complete -F _hciattach hciattach + +# ex: filetype=sh diff --git a/completions/hddtemp b/completions/hddtemp new file mode 100644 index 0000000..7b95f0e --- /dev/null +++ b/completions/hddtemp @@ -0,0 +1,38 @@ +# hddtemp(8) completion -*- shell-script -*- + +_hddtemp() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + --file | -!(-*)f) + _filedir db + return + ;; + --listen | -!(-*)l) + _ip_addresses + return + ;; + --unit | -!(-*)u) + COMPREPLY=($(compgen -W 'C F' -- "$cur")) + return + ;; + --port | --separator | --syslog | --version | --help | -!(-*)[psSvh?]) + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1") --help' -- "$cur")) + [[ ${COMPREPLY-} == *= ]] && compopt -o nospace + else + cur=${cur:=/dev/} + _filedir + fi +} && + complete -F _hddtemp hddtemp + +# ex: filetype=sh diff --git a/completions/hid2hci b/completions/hid2hci new file mode 100644 index 0000000..f33a495 --- /dev/null +++ b/completions/hid2hci @@ -0,0 +1,15 @@ +# hid2hci completion -*- shell-script -*- + +_hid2hci() +{ + local cur prev words cword + _init_completion || return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '--help --quiet -0 --tohci -1 --tohid' \ + -- "$cur")) + fi +} && + complete -F _hid2hci hid2hci + +# ex: filetype=sh diff --git a/completions/hostname b/completions/hostname new file mode 100644 index 0000000..ce1b32e --- /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 + --help | --version | -!(-*)[hV]) + return + ;; + --file | -!(-*)F) + _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 new file mode 100644 index 0000000..666838b --- /dev/null +++ b/completions/hping2 @@ -0,0 +1,35 @@ +# bash completion for hping2 -*- shell-script -*- + +_hping2() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --interface | -!(-*)I) + _available_interfaces + return + ;; + --spoof | -!(-*)a) + _known_hosts_real -- "$cur" + return + ;; + --tos | -!(-*)o) + COMPREPLY=($(compgen -W '02 04 08 10')) + return + ;; + --file | -!(-*)E) + _filedir + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + else + _known_hosts_real -- "$cur" + fi +} && + complete -F _hping2 hping hping2 hping3 + +# ex: filetype=sh diff --git a/completions/htop b/completions/htop new file mode 100644 index 0000000..b4916d5 --- /dev/null +++ b/completions/htop @@ -0,0 +1,33 @@ +# htop(1) completion -*- shell-script -*- + +_htop() +{ + local cur prev words cword split + _init_completion -s || return + + case "$prev" in + --sort-key | -!(-*)s) + COMPREPLY=($(compgen -W '$("$1" -s help)' -- "$cur")) + return + ;; + --user | -!(-*)u) + COMPREPLY=($(compgen -u -- "$cur")) + return + ;; + --delay | -!(-*)d) + # argument required but no completions available + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1" --help)' -- "$cur")) + [[ ${COMPREPLY-} == *= ]] && compopt -o nospace + return + fi +} && + complete -F _htop htop + +# ex: filetype=sh diff --git a/completions/htpasswd b/completions/htpasswd new file mode 100644 index 0000000..527684b --- /dev/null +++ b/completions/htpasswd @@ -0,0 +1,36 @@ +# htpasswd(1) completion -*- shell-script -*- + +_htpasswd() +{ + local cur prev words cword + _init_completion || return + + local i o=0 # $o is index of first non-option argument + for ((i = 1; i <= cword; i++)); do + case ${words[i]} in + -*n*) return ;; + -*) ;; + *) + o=$i + break + ;; + esac + done + + if ((o == 0 || o == cword)); then + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + return + fi + # Password file (first non-option argument) + _filedir + + elif ((o == cword - 1)); then + # Username (second non-option argument) + COMPREPLY=($(compgen -W \ + '$(cut -d: -f1 "${words[o]}" 2>/dev/null)' -- "$cur")) + fi +} && + complete -F _htpasswd htpasswd + +# ex: filetype=sh diff --git a/completions/hunspell b/completions/hunspell new file mode 100644 index 0000000..92b4fe8 --- /dev/null +++ b/completions/hunspell @@ -0,0 +1,43 @@ +# hunspell(1) completion -*- shell-script -*- + +_hunspell() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --help | --version | -vv | -[hPv]) + return + ;; + -d) + local IFS=$' \t\n' reset=$(shopt -p nullglob) + shopt -s nullglob + local -a dicts=(/usr/share/hunspell/*.dic + /usr/local/share/hunspell/*.dic) + dicts=("${dicts[@]##*/}") + dicts=("${dicts[@]%.dic}") + $reset + IFS=$'\n' + COMPREPLY=($(compgen -W '${dicts[@]}' -- "$cur")) + return + ;; + -i) + _xfunc iconv _iconv_charsets + return + ;; + -p) + _filedir + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + return + fi + + _filedir +} && + complete -F _hunspell hunspell + +# ex: filetype=sh diff --git a/completions/iconv b/completions/iconv new file mode 100644 index 0000000..81ae01b --- /dev/null +++ b/completions/iconv @@ -0,0 +1,38 @@ +# iconv(1) completion -*- shell-script -*- + +_iconv_charsets() +{ + COMPREPLY+=($(compgen -X ... -W '$(${1:-iconv} -l | \ + command sed -e "s@/*\$@@" -e "s/[,()]//g")' -- "$cur")) +} + +_iconv() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + --help | --usage | --version | --unicode-subst | --byte-subst | \ + --widechar-subst | -!(-*)[?V]) + return + ;; + --from-code | --to-code | -!(-*)[ft]) + _iconv_charsets $1 + return + ;; + --output | -!(-*)o) + _filedir + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + [[ ${COMPREPLY-} == *= ]] && compopt -o nospace + fi +} && + complete -F _iconv -o default iconv + +# ex: filetype=sh diff --git a/completions/id b/completions/id new file mode 100644 index 0000000..a07e51d --- /dev/null +++ b/completions/id @@ -0,0 +1,18 @@ +# id(1) completion -*- shell-script -*- + +_id() +{ + local cur prev words cword + _init_completion || return + + if [[ $cur == -* ]]; then + local opts=$(_parse_help "$1") + [[ $opts ]] || opts="-G -g -u" # POSIX fallback + COMPREPLY=($(compgen -W "$opts" -- "$cur")) + else + COMPREPLY=($(compgen -u "$cur")) + fi +} && + complete -F _id id + +# ex: filetype=sh diff --git a/completions/idn b/completions/idn new file mode 100644 index 0000000..8023f8f --- /dev/null +++ b/completions/idn @@ -0,0 +1,26 @@ +# idn(1) completion -*- shell-script -*- + +_idn() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + --help | --version | -!(-*)[hV]) + return + ;; + --profile | -!(-*)p) + COMPREPLY=($(compgen -W 'Nameprep iSCSI Nodeprep Resourceprep + trace SASLprep' -- "$cur")) + return + ;; + esac + + if ! $split && [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + [[ ${COMPREPLY-} == *= ]] && compopt -o nospace + fi +} && + complete -F _idn idn + +# ex: filetype=sh diff --git a/completions/ifstat b/completions/ifstat new file mode 100644 index 0000000..629786e --- /dev/null +++ b/completions/ifstat @@ -0,0 +1,68 @@ +# bash completion for ifstat(1) -*- shell-script -*- + +_ifstat() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + --help | --version | --scan | --interval | -!(-*)[hvV]) + return + ;; + -!(-*)i) + # TODO comma separated + _available_interfaces -a + return + ;; + -!(-*)d) + # iproute2: no completion (scan delay) + # traditional: parse driver + if ! { + "$1" --help 2>&1 || : + } | + command grep -q -- '-d.*--scan'; then + COMPREPLY=($(compgen -W '$("$1" -v | command \ + sed -e "s/[,.]//g" -ne "s/^.*drivers://p")' -- "$cur")) + fi + return + ;; + --noupdate | -!(-*)s) + # iproute2: pass through (skip history update) + # traditional: hostnames (snmp) + if ! { + "$1" --help 2>&1 || : + } | + command grep -q -- '-s.*--noupdate'; then + _known_hosts_real -- "$cur" + return + fi + ;; + -!(-*)t) + # iproute2: no completion (interval) + # traditional: pass through (add timestamp) + ! { + "$1" --help 2>&1 || : + } | + command grep -q -- '-t.*--interval' || return + ;; + --extended | -!(-*)x) + # iproute2: parse xstat types + COMPREPLY=($(compgen -W '$("$1" -x nonexistent-xstat 2>&1 | + awk "found { print \$1 } /supported xstats:/ { found=1 }")' \ + -- "$cur")) + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + local opts=$(_parse_help "$1") + COMPREPLY=($(compgen -W '${opts:-$(_parse_usage "$1")}' -- "$cur")) + [[ ${COMPREPLY-} == *= ]] && compopt -o nospace + return + fi +} && + complete -F _ifstat ifstat + +# ex: filetype=sh diff --git a/completions/iftop b/completions/iftop new file mode 100644 index 0000000..b73f4b6 --- /dev/null +++ b/completions/iftop @@ -0,0 +1,26 @@ +# iftop(8) completion -*- shell-script -*- + +_iftop() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -h | -f | -F | -m) + return + ;; + -i) + _available_interfaces -a + return + ;; + -c) + _filedir + return + ;; + esac + + COMPREPLY=($(compgen -W '$(_parse_help "$1" -h)' -- "$cur")) +} && + complete -F _iftop iftop + +# ex: filetype=sh diff --git a/completions/ifup b/completions/ifup new file mode 100644 index 0000000..5b35bfb --- /dev/null +++ b/completions/ifup @@ -0,0 +1,39 @@ +# Red Hat & Debian GNU/Linux if{up,down} completion -*- shell-script -*- + +_userland GNU || return 1 + +_ifupdown() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --help | --version | --allow | --exclude | --option | -!(-*)[hVXo]) + return + ;; + --interfaces | -!(-*)i) + _filedir + return + ;; + --state-dir) + _filedir -d + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + return + fi + + local args + _count_args "" "@(--allow|-i|--interfaces|--state-dir|-X|--exclude|-o)" + + if ((args == 1)); then + _configured_interfaces + COMPREPLY=($(compgen -W '${COMPREPLY[@]}' -- "$cur")) + fi +} && + complete -F _ifupdown ifup ifdown ifquery ifstatus + +# ex: filetype=sh diff --git a/completions/influx b/completions/influx new file mode 100644 index 0000000..e9362e7 --- /dev/null +++ b/completions/influx @@ -0,0 +1,35 @@ +# bash completion for influx(8) -*- shell-script -*- + +_influx() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -version | -port | -database | -password | -username | -execute | -pps) + return + ;; + -host) + _known_hosts_real -- "$cur" + return + ;; + -format | -precision | -consistency) + local args=$($1 --help 2>&1 | awk "\$1 == \"$prev\" { print \$2 }") + COMPREPLY=($( + IFS+="\"'|" + compgen -W "$args" -- "$cur" + )) + return + ;; + -import | -path) + _filedir + return + ;; + esac + + [[ $cur == -* ]] && + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) +} && + complete -F _influx influx + +# ex: filetype=sh diff --git a/completions/info b/completions/info new file mode 100644 index 0000000..f50f842 --- /dev/null +++ b/completions/info @@ -0,0 +1,74 @@ +# bash completion for info -*- shell-script -*- + +_info() +{ + local cur prev words cword split + _init_completion -s || return + + # default completion if parameter looks like a path + if [[ $cur == @(*/|[.~])* ]]; then + _filedir + return + fi + + case $prev in + --apropos | --index-search | --node | --help | --version | -!(-*)[knhv]) + return + ;; + -!(-*)d) + if [[ ${1##*/} == info ]]; then + _filedir -d + return + fi + ;; + --directory) + _filedir -d + return + ;; + --dribble | --file | --output | --restore | --raw-filename | --rcfile | -!(-*)[for]) + _filedir + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + [[ ${COMPREPLY-} == *= ]] && compopt -o nospace + return + fi + + local i infopath=/usr/share/info + + if [[ ${INFOPATH-} == *: ]]; then + infopath=${INFOPATH}${infopath} + elif [[ ${INFOPATH:+set} ]]; then + infopath=$INFOPATH + fi + + _expand || return + + infopath=$infopath: + if [[ -n $cur ]]; then + infopath="${infopath//://$cur* }" + else + infopath="${infopath//:// }" + fi + + # redirect stderr for when path doesn't exist + COMPREPLY=($(eval command ls "$infopath" 2>/dev/null)) + # weed out directory path names and paths to info pages + COMPREPLY=(${COMPREPLY[@]##*/?(:)}) + # weed out info dir file + for i in ${!COMPREPLY[*]}; do + [[ ${COMPREPLY[i]} == dir ]] && unset "COMPREPLY[i]" + done + # strip suffix from info pages + COMPREPLY=(${COMPREPLY[@]%.@(gz|bz2|xz|lzma)}) + COMPREPLY=($(compgen -W '${COMPREPLY[@]%.*}' -- "${cur//\\\\/}")) + +} && + complete -F _info info pinfo + +# ex: filetype=sh diff --git a/completions/inject b/completions/inject new file mode 100644 index 0000000..fad73a1 --- /dev/null +++ b/completions/inject @@ -0,0 +1,26 @@ +# mailman inject completion -*- shell-script -*- + +_inject() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + -l | --listname) + _xfunc list_lists _mailman_lists + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '--listname --queue --help' -- "$cur")) + else + _filedir + fi + +} && + complete -F _inject inject + +# ex: filetype=sh diff --git a/completions/inotifywait b/completions/inotifywait new file mode 100644 index 0000000..e5608fc --- /dev/null +++ b/completions/inotifywait @@ -0,0 +1,47 @@ +# bash completion for inotifywait(1) and inotifywatch(1) -*- shell-script -*- + +_inotifywait_events() +{ + # Expecting line with "Events:", followed by ones starting with one + # tab. Word following the tab is event name, others are line + # wrapped explanations. + COMPREPLY+=($(compgen -W "$($1 --help 2>/dev/null | + command sed -e '/^Events:/,/^[^'$'\t'']/!d' \ + -ne 's/^'$'\t''\([^ '$'\t'']\{1,\}\)[ '$'\t''].*/\1/p')" \ + -- "$cur")) +} + +_inotifywait() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --help | --exclude | --excludei | --format | --timefmt | --timeout | -!(-*)[ht]) + return + ;; + --fromfile | --outfile | -!(-*)o) + _filedir + return + ;; + --event | -!(-*)e) + _inotifywait_events "$1" + return + ;; + --ascending | --descending) + COMPREPLY=($(compgen -W 'total' -- "$cur")) + _inotifywait_events "$1" + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + return + fi + + _filedir +} && + complete -F _inotifywait inotifywait inotifywatch + +# ex: filetype=sh diff --git a/completions/insmod b/completions/insmod new file mode 100644 index 0000000..a59e753 --- /dev/null +++ b/completions/insmod @@ -0,0 +1,18 @@ +# Linux insmod(8) completion -*- shell-script -*- + +_insmod() +{ + local cur prev words cword + _init_completion || return + + # do filename completion for first argument + if ((cword == 1)); then + _filedir '@(?(k)o?(.[gx]z))' + else # do module parameter completion + COMPREPLY=($(compgen -W "$(PATH="$PATH:/sbin" modinfo \ + -p ${words[1]} 2>/dev/null | cut -d: -f1)" -- "$cur")) + fi +} && + complete -F _insmod insmod insmod.static + +# ex: filetype=sh diff --git a/completions/installpkg b/completions/installpkg new file mode 100644 index 0000000..7455eb1 --- /dev/null +++ b/completions/installpkg @@ -0,0 +1,33 @@ +# Slackware Linux installpkg completion -*- shell-script -*- + +_installpkg() +{ + local cur prev words cword + _init_completion || return + + case "$prev" in + --root) + _filedir -d + return + ;; + --priority) + COMPREPLY=($(compgen -W 'ADD REC OPT SKP' -- "$cur")) + return + ;; + --tagfile) + _filedir + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '--warn --md5sum --root --infobox --terse + --menu --ask --priority --tagfile' -- "$cur")) + return + fi + + _filedir 't[bglx]z' +} && + complete -F _installpkg installpkg + +# ex: filetype=sh diff --git a/completions/interdiff b/completions/interdiff new file mode 100644 index 0000000..9933d15 --- /dev/null +++ b/completions/interdiff @@ -0,0 +1,33 @@ +# interdiff(1) completion -*- shell-script -*- + +_interdiff() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + --unified | --strip-match | --drop-context | -!(-*)[Upd]) + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + [[ ${COMPREPLY-} == *= ]] && compopt -o nospace + return + fi + + local exts='@(?(d)patch|dif?(f))' word + for word in "${words[@]}"; do + if [[ $word == -@(z|-decompress) ]]; then + exts+='?(.@(gz|bz2))' + break + fi + done + _filedir "$exts" +} && + complete -F _interdiff interdiff + +# ex: filetype=sh diff --git a/completions/invoke-rc.d b/completions/invoke-rc.d new file mode 100644 index 0000000..4a5045a --- /dev/null +++ b/completions/invoke-rc.d @@ -0,0 +1,38 @@ +# invoke-rc.d(8) completion -*- shell-script -*- +# +# Copyright (C) 2004 Servilio Afre Puentes + +_invoke_rc_d() +{ + local cur prev words cword + _init_completion || return + + local sysvdir services options valid_options + + [[ -d /etc/rc.d/init.d ]] && sysvdir=/etc/rc.d/init.d || + sysvdir=/etc/init.d + + services=($(printf '%s ' $sysvdir/!(README*|*.sh|$_backup_glob))) + services=(${services[@]#$sysvdir/}) + options=(--help --quiet --force --try-anyway --disclose-deny --query + --no-fallback) + + if [[ $cword -eq 1 || $prev == --* ]]; then + valid_options=($( + tr " " "\n" <<<"${words[*]} ${options[*]}" | + 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 '`command sed -e "y/|/ /" \ + -ne "s/^.*Usage:[ ]*[^ ]*[ ]*{*\([^}\"]*\).*$/\1/p" \ + $sysvdir/$prev`' -- "$cur")) + else + COMPREPLY=() + fi + +} && + complete -F _invoke_rc_d invoke-rc.d + +# ex: filetype=sh diff --git a/completions/ip b/completions/ip new file mode 100644 index 0000000..12ad9aa --- /dev/null +++ b/completions/ip @@ -0,0 +1,378 @@ +# ip(8) completion -*- shell-script -*- + +_iproute2_etc() +{ + COMPREPLY+=($(compgen -W \ + "$(awk '!/#/ { print $2 }' /etc/iproute2/$1 2>/dev/null)" \ + -- "$cur")) +} + +_ip() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -V | -Version | -rc | -rcvbuf) + return + ;; + -f | -family) + COMPREPLY=($(compgen -W 'inet inet6 ipx dnet link' -- "$cur")) + return + ;; + -b | -batch) + _filedir + return + ;; + -force) + COMPREPLY=($(compgen -W '-batch' -- "$cur")) + return + ;; + esac + + local subcword cmd subcmd="" + for ((subcword = 1; subcword < ${#words[@]} - 1; subcword++)); do + [[ ${words[subcword]} == -b?(atch) ]] && return + [[ -v cmd ]] && subcmd=${words[subcword]} && break + [[ ${words[subcword]} != -* && \ + ${words[subcword - 1]} != -@(f?(amily)|rc?(vbuf)) ]] && + cmd=${words[subcword]} + done + + if [[ ! -v cmd ]]; then + case $cur in + -*) + local c="-Version -statistics -details -resolve -family + -oneline -timestamp -batch -rcvbuf" + ((cword == 1)) && c+=" -force" + COMPREPLY=($(compgen -W "$c" -- "$cur")) + ;; + *) + COMPREPLY=($(compgen -W "help $($1 help 2>&1 | command sed -e \ + '/OBJECT := /,/}/!d' -e \ + 's/.*{//' -e \ + 's/}.*//' -e \ + 's/|//g')" -- "$cur")) + ;; + esac + return + fi + + [[ $subcmd == help ]] && return + + case $cmd in + l | link) + case $subcmd in + add) + # TODO + ;; + delete) + case $((cword - subcword)) in + 1) + _available_interfaces + ;; + 2) + COMPREPLY=($(compgen -W 'type' -- "$cur")) + ;; + 3) + [[ $prev == type ]] && + COMPREPLY=($(compgen -W 'vlan veth vcan dummy + ifb macvlan can' -- "$cur")) + ;; + esac + ;; + set) + if ((cword - subcword == 1)); then + _available_interfaces + else + case $prev in + arp | dynamic | multicast | allmulticast | promisc | \ + trailers) + COMPREPLY=($(compgen -W 'on off' -- "$cur")) + ;; + txqueuelen | name | address | broadcast | mtu | netns | alias) ;; + + *) + local c="arp dynamic multicast allmulticast + promisc trailers txqueuelen name address + broadcast mtu netns alias" + [[ $prev != @(up|down) ]] && c+=" up down" + COMPREPLY=($(compgen -W "$c" -- "$cur")) + ;; + esac + fi + ;; + show) + if ((cword == subcword + 1)); then + _available_interfaces + COMPREPLY+=($(compgen -W 'dev group up' -- "$cur")) + elif [[ $prev == dev ]]; then + _available_interfaces + elif [[ $prev == group ]]; then + _iproute2_etc group + fi + ;; + *) + ((cword == subcword)) && + COMPREPLY=($(compgen -W 'help add delete set show' \ + -- "$cur")) + ;; + esac + ;; + + a | addr | address) + case $subcmd in + add | change | replace) + if [[ $prev == dev ]]; then + _available_interfaces + elif [[ $prev == scope ]]; then + _iproute2_etc rt_scopes + else + : # TODO + fi + ;; + del) + if [[ $prev == dev ]]; then + _available_interfaces + elif [[ $prev == scope ]]; then + _iproute2_etc rt_scopes + else + : # TODO + fi + ;; + show | flush) + if ((cword == subcword + 1)); then + _available_interfaces + COMPREPLY+=($(compgen -W 'dev scope to label dynamic + permanent tentative deprecated dadfailed temporary + primary secondary up' -- "$cur")) + elif [[ $prev == dev ]]; then + _available_interfaces + elif [[ $prev == scope ]]; then + _iproute2_etc rt_scopes + fi + ;; + *) + ((cword == subcword)) && + COMPREPLY=($(compgen -W 'help add change replace del + show flush' -- "$cur")) + ;; + esac + ;; + + addrlabel) + case $subcmd in + list | add | del | flush) + if [[ $prev == dev ]]; then + _available_interfaces + else + : # TODO + fi + ;; + *) + ((cword == subcword)) && + COMPREPLY=($(compgen -W 'help list add del flush' \ + -- "$cur")) + ;; + esac + ;; + + r | route) + case $subcmd in + list | flush) + if [[ $prev == proto ]]; then + _iproute2_etc rt_protos + else + : # TODO + fi + ;; + get) + # TODO + ;; + a | add | d | del | change | append | r | replace | monitor) + if [[ $prev == via ]]; then + COMPREPLY=($(compgen -W "$($1 r | command sed -ne \ + 's/.*via \([0-9.]*\).*/\1/p')" -- "$cur")) + elif [[ $prev == "$subcmd" ]]; then + COMPREPLY=($(compgen -W "table default \ + $($1 r | cut -d ' ' -f 1)" -- "$cur")) + elif [[ $prev == dev ]]; then + _available_interfaces -a + elif [[ $prev == table ]]; then + COMPREPLY=($(compgen -W 'local main default' -- "$cur")) + else + COMPREPLY=($(compgen -W 'via dev weight' -- "$cur")) + fi + ;; + *) + ((cword == subcword)) && + COMPREPLY=($(compgen -W 'help list flush get add del + change append replace monitor' -- "$cur")) + ;; + esac + ;; + + rule) + case $subcmd in + add | del | list | lst) + case $prev in + from | to | tos | dsfield | fwmark | uidrange | ipproto | sport | \ + dport | priority | protocol | suppress_prefixlength | \ + suppress_ifgroup | realms | nat | goto) ;; + + iif | oif) + _available_interfaces -a + ;; + table | lookup) + COMPREPLY=($(compgen -W 'local main default' -- "$cur")) + ;; + *) + COMPREPLY=($(compgen -W 'from to tos dsfield fwmark + uidrange ipproto sport dport priority table lookup + protocol suppress_prefixlength suppress_ifgroup realms + nat goto iif oif not' -- "$cur")) + ;; + esac + ;; + flush | save) + if [[ $prev == protocol ]]; then + : + else + COMPREPLY=($(compgen -W 'protocol' -- "$cur")) + fi + ;; + restore | show) ;; + *) + ((cword == subcword)) && + COMPREPLY=($(compgen -W 'help add del list flush save + restore show' -- "$cur")) + ;; + esac + ;; + + neigh) + case $subcmd in + add | del | change | replace) + # TODO + ;; + show | flush) + # TODO + ;; + *) + ((cword == subcword)) && + COMPREPLY=($(compgen -W 'help add del change replace + show flush' -- "$cur")) + ;; + esac + ;; + + ntable) + case $subcmd in + change) + # TODO + ;; + show) + # TODO + ;; + *) + ((cword == subcword)) && + COMPREPLY=($(compgen -W 'help change show' \ + -- "$cur")) + ;; + esac + ;; + + tunnel) + case $subcmd in + show) ;; + + add | change | del | prl | 6rd) + # TODO + ;; + *) + ((cword == subcword)) && + COMPREPLY=($(compgen -W 'help add change del show prl + 6rd' -- "$cur")) + ;; + esac + ;; + + maddr) + case $subcmd in + add | del) + # TODO + ;; + show) + if [[ $cword -eq $subcword+1 || $prev == dev ]]; then + _available_interfaces + [[ $prev != dev ]] && + COMPREPLY=($(compgen -W '${COMPREPLY[@]} dev' \ + -- "$cur")) + fi + ;; + *) + ((cword == subcword)) && + COMPREPLY=($(compgen -W 'help add del show' \ + -- "$cur")) + ;; + esac + ;; + + mroute) + case $subcmd in + show) + # TODO + ;; + *) + ((cword == subcword)) && + COMPREPLY=($(compgen -W 'help show' -- "$cur")) + ;; + esac + ;; + + monitor) + case $subcmd in + all) ;; + *) + ((cword == subcword)) && + COMPREPLY=($(compgen -W 'help all' -- "$cur")) + ;; + esac + ;; + + netns) + case $subcmd in + list | monitor) ;; + + add | identify | list-id) + # TODO + ;; + delete | exec | pids | set) + [[ $prev == "$subcmd" ]] && + COMPREPLY=($(compgen -W "$($1 netns list)" -- "$cur")) + ;; + *) + ((cword == subcword)) && + COMPREPLY=($(compgen -W 'help add delete exec + identify list list-id monitor pids set' -- "$cur")) + ;; + esac + ;; + + xfrm) + case $subcmd in + state | policy | monitor) + # TODO + ;; + *) + ((cword == subcword)) && + COMPREPLY=($(compgen -W 'state policy monitor' \ + -- "$cur")) + ;; + esac + ;; + esac +} && + complete -F _ip ip + +# ex: filetype=sh diff --git a/completions/ipcalc b/completions/ipcalc new file mode 100644 index 0000000..5603c26 --- /dev/null +++ b/completions/ipcalc @@ -0,0 +1,25 @@ +# ipcalc(1) completion -*- shell-script -*- + +_ipcalc() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --help | --version | --split | -[hs]) + return + ;; + esac + + # --split takes 3 args + local i + for i in {1..3}; do + [[ ${words[cword - i]} == -@(-split|s) ]] && return + done + + [[ $cur != -* ]] || + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) +} && + complete -F _ipcalc ipcalc + +# ex: filetype=sh diff --git a/completions/iperf b/completions/iperf new file mode 100644 index 0000000..6347fe0 --- /dev/null +++ b/completions/iperf @@ -0,0 +1,69 @@ +# iperf(1) completion -*- shell-script -*- + +_iperf() +{ + local cur prev words cword split + _init_completion -s -n : || return + + case $prev in + --help | --version | --interval | --len | --port | --window | --mss | --bandwidth | \ + --num | --time | --listenport | --parallel | --ttl | --linux-congestion | --omit | \ + --congestion | --bytes | --blockcount | --cport | --set-mss | --flowlabel | \ + --title | --tos | --affinity | -!(-*)[hvilpwMbntLPTZCkOSA]) + return + ;; + --format | -!(-*)f) + COMPREPLY=($(compgen -W 'k m g K M G' -- "$cur")) + return + ;; + --output | --fileinput | -!(-*)[oF]) + _filedir + return + ;; + --bind | -!(-*)B) + _available_interfaces -a + _ip_addresses -a + __ltrim_colon_completions "$cur" + return + ;; + --client | -!(-*)c) + _known_hosts_real -- "$cur" + return + ;; + --reportexclude | -!(-*)x) + COMPREPLY=($(compgen -W 'C D M S V' -- "$cur")) + return + ;; + --reportstyle | -!(-*)y) + COMPREPLY=($(compgen -W 'C' -- "$cur")) + return + ;; + --logfile) + _filedir log + return + ;; + esac + + $split && return + + # Filter mode specific options + local i filter=cat + for i in "${words[@]}"; do + case $i in + -s | --server) + filter='command sed -e /^Client.specific/,/^\(Server.specific.*\)\?$/d' + ;; + -c | --client) + filter='command sed -e /^Server.specific/,/^\(Client.specific.*\)\?$/d' + ;; + esac + done + [[ $filter != cat ]] && filter+=' -e /--client/d -e /--server/d' + + COMPREPLY=($(compgen -W \ + '$("$1" --help 2>&1 | $filter | _parse_help -)' -- "$cur")) + [[ ${COMPREPLY-} == *= ]] && compopt -o nospace +} && + complete -F _iperf iperf iperf3 + +# ex: filetype=sh diff --git a/completions/ipmitool b/completions/ipmitool new file mode 100644 index 0000000..920287d --- /dev/null +++ b/completions/ipmitool @@ -0,0 +1,199 @@ +# bash completion for ipmitool -*- shell-script -*- + +_ipmitool_singleline_help() +{ + COMPREPLY=($(compgen -W "$($1 $2 2>&1 | + command sed -ne 's/[,\r]//g' -e 's/^.*[Cc]ommands://p')" -- "$cur")) +} + +_ipmitool() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -*[hVpUekyPmbtBTl]) + return + ;; + -*d) + COMPREPLY=($(compgen -W "$( + command ls -d /dev/ipmi* /dev/ipmi/* /dev/ipmidev/* \ + 2>/dev/null | command sed -ne 's/^[^0-9]*\([0-9]\{1,\}\)/\1/p' + )" \ + -- "$cur")) + return + ;; + -*I) + COMPREPLY=($(compgen -W "$($1 -h 2>&1 | + command sed -e '/^Interfaces:/,/^[[:space:]]*$/!d' \ + -ne 's/^[[:space:]]\{1,\}\([^[:space:]]\{1,\}\).*/\1/p')" \ + -- "$cur")) + return + ;; + -*H) + _known_hosts_real -- "$cur" + return + ;; + -*[fSO]) + _filedir + return + ;; + -*C) + COMPREPLY=($(compgen -W '{0..14}' -- "$cur")) + return + ;; + -*L) + COMPREPLY=($(compgen -W 'CALLBACK USER OPERATOR ADMINISTRATOR' \ + -- "$cur")) + return + ;; + -*A) + COMPREPLY=($(compgen -W 'NONE PASSWORD MD2 MD5 OEM' -- "$cur")) + return + ;; + -*o) + COMPREPLY=($(compgen -W "$($1 -o list 2>&1 | + awk '/^[ \t]+/ { print $1 }') list" -- "$cur")) + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1" -h)' -- "$cur")) + return + fi + + # Find out command and subcommand + + local cmds=(raw i2c spd lan chassis power event mc sdr sensor fru gendev + sel pef sol tsol isol user channel session sunoem kontronoem picmg fwum + firewall shell exec set hpm ekanalyzer) + local i c cmd subcmd + for ((i = 1; i < ${#words[@]} - 1; i++)); do + [[ -v cmd ]] && subcmd=${words[i]} && break + for c in "${cmds[@]}"; do + [[ ${words[i]} == "$c" ]] && cmd=$c && break + done + done + + if [[ ! -v cmd ]]; then + COMPREPLY=($(compgen -W '${cmds[@]}' -- "$cur")) + return + fi + + # Command/subcommand completions + + case $cmd in + + shell) ;; + + \ + exec) + _filedir + ;; + + chassis | power | kontronoem | fwum) + _ipmitool_singleline_help $1 $cmd + ;; + + lan) + case $subcmd in + print | set) ;; + + alert) + [[ $prev == alert ]] && + COMPREPLY=($(compgen -W 'print set' -- "$cur")) + ;; + stats) + [[ $prev == stats ]] && + COMPREPLY=($(compgen -W 'print set' -- "$cur")) + ;; + *) + COMPREPLY=($(compgen -W 'print set alert stats' \ + -- "$cur")) + ;; + esac + ;; + + sdr) + case $subcmd in + get | info | type | list | entity) ;; + + elist) + COMPREPLY=($(compgen -W 'all full compact event mclog fru + generic' -- "$cur")) + ;; + dump) + _filedir + ;; + fill) + case $prev in + fill) + COMPREPLY=($(compgen -W 'sensors file' -- "$cur")) + ;; + file) + _filedir + ;; + esac + ;; + *) + COMPREPLY=($(compgen -W 'get info type list elist entity + dump fill' -- "$cur")) + ;; + esac + ;; + + sensor) + case $subcmd in + list | get | thresh) ;; + + *) + COMPREPLY=($(compgen -W 'list get thresh' -- "$cur")) + ;; + esac + ;; + + sel) + case $subcmd in + info | clear | list | elist | delete) ;; + + add | save | writeraw | readraw) + _filedir + ;; + time) + [[ $prev == time ]] && + COMPREPLY=($(compgen -W 'get set' -- "$cur")) + ;; + *) + COMPREPLY=($(compgen -W 'info clear list elist delete add + get save writeraw readraw time' -- "$cur")) + ;; + esac + ;; + + user) + case $subcmd in + summary | list | disable | enable | priv | test) ;; + + set) + [[ $prev == set ]] && + COMPREPLY=($(compgen -W 'name password' -- "$cur")) + ;; + *) + COMPREPLY=($(compgen -W 'summary list set disable enable + priv test' -- "$cur")) + ;; + esac + ;; + + set) + [[ $prev == set ]] && + COMPREPLY=($(compgen -W 'hostname username password privlvl + authtype localaddr targetaddr port csv verbose' -- "$cur")) + ;; + + esac +} && + complete -F _ipmitool ipmitool + +# ex: filetype=sh diff --git a/completions/ipsec b/completions/ipsec new file mode 100644 index 0000000..4bc8cdf --- /dev/null +++ b/completions/ipsec @@ -0,0 +1,102 @@ +# Linux ipsec(8) completion (for FreeS/WAN and strongSwan) -*- shell-script -*- + +# Complete ipsec.conf conn entries. +# +# Reads a file from stdin in the ipsec.conf(5) format. +_ipsec_connections() +{ + local keyword name + while read -r keyword name; do + if [[ $keyword == [#]* ]]; then continue; fi + [[ $keyword == conn && $name != '%default' ]] && COMPREPLY+=("$name") + done + COMPREPLY=($(compgen -W '${COMPREPLY[@]}' -- "$cur")) +} + +_ipsec_freeswan() +{ + local cur prev words cword + _init_completion || return + + if ((cword == 1)); then + COMPREPLY=($(compgen -W 'auto barf eroute klipsdebug look manual + pluto ranbits rsasigkey setup showdefaults showhostkey spi spigrp + tncfg whack' -- "$cur")) + return + fi + + case ${words[1]} in + auto) + COMPREPLY=($(compgen -W '--asynchronous --up --add --delete + --replace --down --route --unroute --ready --status + --rereadsecrets' -- "$cur")) + ;; + manual) + COMPREPLY=($(compgen -W '--up --down --route --unroute --union' \ + -- "$cur")) + ;; + ranbits) + COMPREPLY=($(compgen -W '--quick --continuous --bytes' -- "$cur")) + ;; + setup) + COMPREPLY=($(compgen -W '--start --stop --restart' -- "$cur")) + ;; + *) ;; + + esac +} + +_ipsec_strongswan() +{ + local cur prev words cword + _init_completion || return + + if ((cword == 1)); then + COMPREPLY=($(compgen -W 'down irdumm leases listaacerts listacerts + listalgs listall listcacerts listcainfos listcards listcerts + listcrls listgroups listocsp listocspcerts listpubkeys openac pki + pluto pool purgecerts purgecrls purgeike purgeocsp ready reload + rereadaacerts rereadacerts rereadall rereadcacerts rereadcrls + rereadgroups rereadocspcerts rereadsecrets restart route scdecrypt + scencrypt scepclient secrets start starter status statusall stop + stroke unroute uci up update version whack --confdir --copyright + --directory --help --version --versioncode' -- "$cur")) + return + fi + + case ${words[1]} in + down | route | status | statusall | unroute | up) + local confdir=$(ipsec --confdir) + _ipsec_connections <"$confdir/ipsec.conf" + ;; + list*) + COMPREPLY=($(compgen -W '--utc' -- "$cur")) + ;; + restart | start) + COMPREPLY=($(compgen -W '--attach-gdb --auto-update --debug + --debug-all --debug-more --nofork' -- "$cur")) + ;; + pki) + COMPREPLY=($(compgen -W '--gen --issue --keyid --print --pub + --req --self --signcrl --verify' -- "$cur")) + ;; + pool) ;; + + irdumm) + _filedir 'rb' + ;; + *) ;; + + esac +} + +case "$(ipsec --version 2>/dev/null)" in + *strongSwan*) + complete -F _ipsec_strongswan ipsec + ;; + *) + complete -F _ipsec_freeswan ipsec + ;; +esac + +# ex: filetype=sh diff --git a/completions/iptables b/completions/iptables new file mode 100644 index 0000000..ffb905b --- /dev/null +++ b/completions/iptables @@ -0,0 +1,51 @@ +# bash completion for iptables -*- shell-script -*- + +_iptables() +{ + local cur prev words cword split + _init_completion -s || return + + local table chain='s/^Chain \([^ ]\{1,\}\).*$/\1/p' + + [[ ${words[*]} =~ [[:space:]]-(t|-table=?)[[:space:]]*([^[:space:]]+) ]] && + table="-t ${BASH_REMATCH[2]}" + + case $prev in + -*[AIDRPFXLZ]) + COMPREPLY=($(compgen -W '`"$1" $table -nL 2>/dev/null | \ + command sed -ne "s/^Chain \([^ ]\{1,\}\).*$/\1/p"`' -- "$cur")) + ;; + -*t) + COMPREPLY=($(compgen -W 'nat filter mangle' -- "$cur")) + ;; + -j) + if [[ $table == "-t filter" || -z $table ]]; then + COMPREPLY=($(compgen -W 'ACCEPT DROP LOG ULOG REJECT + `"$1" $table -nL 2>/dev/null | 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 `"$1" $table -nL 2>/dev/null | \ + 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 + `"$1" $table -nL 2>/dev/null | command sed -ne "$chain" \ + -e "s/INPUT|OUTPUT|FORWARD|PREROUTING|POSTROUTING//"`' -- \ + "$cur")) + fi + ;; + *) + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$("$1" --help 2>&1 | + command sed -e "s/^\[\!\]//" | _parse_help -)' -- "$cur")) + [[ ${COMPREPLY-} == *= ]] && compopt -o nospace + fi + ;; + esac + +} && + complete -F _iptables iptables + +# ex: filetype=sh diff --git a/completions/ipv6calc b/completions/ipv6calc new file mode 100644 index 0000000..c452c15 --- /dev/null +++ b/completions/ipv6calc @@ -0,0 +1,38 @@ +# ipv6calc completion -*- shell-script -*- + +_ipv6calc() +{ + local cur prev words cword split + _init_completion -s || return + + case "$prev" in + --debug | -!(-*)d) + return + ;; + --in | --out | --action | -!(-*)[IOA]) + # With ipv6calc < 0.73.0, -m does nothing here, so use sed instead. + COMPREPLY=($(compgen -W "$($1 "$prev" -h 2>&1 | + command sed -ne 's/^[[:space:]]\{1,\}\([^[:space:]:]\{1,\}\)[[:space:]]*:.*/\1/p')" \ + -- "$cur")) + return + ;; + --db-geoip | --db-ip2location-ipv4 | --db-ip2location-ipv6) + _filedir + return + ;; + --printstart | --printend) + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$("$1" -h 2>&1 | + command sed -e "s/[][]//g" | _parse_help -)' -- "$cur")) + fi + +} && + complete -F _ipv6calc ipv6calc + +# ex: filetype=sh diff --git a/completions/iscsiadm b/completions/iscsiadm new file mode 100644 index 0000000..7786ddc --- /dev/null +++ b/completions/iscsiadm @@ -0,0 +1,66 @@ +# iscsiadm(1) completion -*- shell-script -*- + +_iscsiadm() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + --mode | -!(-*)m) + COMPREPLY=($(compgen -W 'discovery node session iface fw host' \ + -- "$cur")) + return + ;; + --op | -!(-*)o) + COMPREPLY=($(compgen -W 'new delete update show' -- "$cur")) + return + ;; + --type | -!(-*)t) + COMPREPLY=($(compgen -W 'sendtargets st slp isns fw' -- "$cur")) + return + ;; + --loginall | --logoutall | -!(-*)[LU]) + COMPREPLY=($(compgen -W 'all manual automatic' -- "$cur")) + return + ;; + esac + + $split && return + + local options + if ((cword > 1)); then + + case ${words[2]} in + discovery) + options='--help --version --debug --print --interface --type \ + --portal --login --op --name --value' + ;; + node) + options='--help --version --debug --print --loginall \ + --logoutall--show -T --portal --interface --login \ + --logout --rescan --stats --op --name --value' + ;; + session) + options='--help --version --debug --print --sid --logout \ + --rescan --stats' + ;; + iface) + options='--help --version --debug --print --interface --op \ + --name --value' + ;; + fw) + options='--login' + ;; + host) + options='--print -H' + ;; + esac + else + options='--mode' + fi + + COMPREPLY=($(compgen -W "$options" -- "$cur")) +} && + complete -F _iscsiadm iscsiadm + +# ex: filetype=sh diff --git a/completions/isort b/completions/isort new file mode 100644 index 0000000..2a84e25 --- /dev/null +++ b/completions/isort @@ -0,0 +1,41 @@ +# isort completion -*- shell-script -*- + +_isort() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --help | --add-import | --builtin | --future | --from-first | -ff | \ + --force-grid-wrap | -fgw | --indent | --lines | --lines-after-imports | -lai | \ + --lines-between-types | -lbt | --line-ending | -le | --no-lines-before | -nlb | \ + --dont-skip | -ns | --thirdparty | --project | --remove-import | --skip | \ + --skip-glob | -sg | --settings-path | -sp | --top | --virtual-env | --line-width | \ + --wrap-length | -wl | -[habfiloprstw]) + return + ;; + --jobs | -j) + COMPREPLY=($(compgen -W "{1..$(_ncpus)}" -- "$cur")) + return + ;; + --multi-line | -m) + COMPREPLY=($(compgen -W '{0..5}' -- "$cur")) + return + ;; + --section-default | -sd) + COMPREPLY=($(compgen -W 'FUTURE STDLIB THIRDPARTY FIRSTPARTY + LOCALFOLDER' -- "$cur")) + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + return + fi + + _filedir '@(py|pyi)' +} && + complete -F _isort isort + +# ex: filetype=sh diff --git a/completions/isql b/completions/isql new file mode 100644 index 0000000..4258c51 --- /dev/null +++ b/completions/isql @@ -0,0 +1,14 @@ +# isql completion -*- shell-script -*- +# by Victor Bogado da Silva Lins + +_isql() +{ + local cur prev words cword + _init_completion || return + + [[ -f $ODBCINI ]] && + COMPREPLY=($(command grep "\[$cur" "$ODBCINI" | tr -d \[\])) +} && + complete -F _isql isql + +# ex: filetype=sh diff --git a/completions/iwconfig b/completions/iwconfig new file mode 100644 index 0000000..aa8fbf3 --- /dev/null +++ b/completions/iwconfig @@ -0,0 +1,90 @@ +# iwconfig completion -*- shell-script -*- + +_iwconfig() +{ + local cur prev words cword + _init_completion || return + + case $prev in + mode) + COMPREPLY=($(compgen -W 'managed ad-hoc master repeater secondary + monitor' -- "$cur")) + return + ;; + essid) + COMPREPLY=($(compgen -W 'on off any' -- "$cur")) + if [[ -n ${COMP_IWLIST_SCAN:-} ]]; then + COMPREPLY+=($(compgen -W \ + "$(iwlist ${words[1]} scan | + awk -F'\"' '/ESSID/ {print $2}')" -- "$cur")) + fi + return + ;; + nwid) + COMPREPLY=($(compgen -W 'on off' -- "$cur")) + return + ;; + channel) + COMPREPLY=($(compgen -W "$(iwlist ${words[1]} channel | + awk '/^[ \t]*Channel/ {print $2}')" -- "$cur")) + return + ;; + + freq) + COMPREPLY=($(compgen -W "$(iwlist ${words[1]} channel | + awk '/^[ \t]*Channel/ {print $4"G"}')" -- "$cur")) + return + ;; + ap) + COMPREPLY=($(compgen -W 'on off any' -- "$cur")) + if [[ -n ${COMP_IWLIST_SCAN:-} ]]; then + COMPREPLY+=($(compgen -W \ + "$(iwlist ${words[1]} scan | + awk -F ': ' '/Address/ {print $2}')" -- "$cur")) + fi + return + ;; + rate) + COMPREPLY=($(compgen -W 'auto fixed' -- "$cur")) + COMPREPLY+=($(compgen -W \ + "$(iwlist ${words[1]} rate | + awk '/^[ \t]*[0-9]/ {print $1"M"}')" -- "$cur")) + return + ;; + rts | frag) + COMPREPLY=($(compgen -W 'auto fixed off' -- "$cur")) + return + ;; + key | enc) + COMPREPLY=($(compgen -W 'off on open restricted' -- "$cur")) + return + ;; + power) + COMPREPLY=($(compgen -W 'period timeout off on' -- "$cur")) + return + ;; + txpower) + COMPREPLY=($(compgen -W 'off on auto' -- "$cur")) + return + ;; + retry) + COMPREPLY=($(compgen -W 'limit lifetime' -- "$cur")) + return + ;; + esac + + if ((cword == 1)); then + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '--help --version' -- "$cur")) + else + _available_interfaces -w + fi + else + COMPREPLY=($(compgen -W 'essid nwid mode freq channel sens mode ap + nick rate rts frag enc key power txpower commit' -- "$cur")) + fi + +} && + complete -F _iwconfig iwconfig + +# ex: filetype=sh diff --git a/completions/iwlist b/completions/iwlist new file mode 100644 index 0000000..16aa39c --- /dev/null +++ b/completions/iwlist @@ -0,0 +1,22 @@ +# iwlist completion -*- shell-script -*- + +_iwlist() +{ + local cur prev words cword + _init_completion || return + + if ((cword == 1)); then + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '--help --version' -- "$cur")) + else + _available_interfaces -w + fi + else + COMPREPLY=($(compgen -W 'scan scanning freq frequency channel rate + bit bitrate key enc encryption power txpower retry ap accesspoint + peers event' -- "$cur")) + fi +} && + complete -F _iwlist iwlist + +# ex: filetype=sh diff --git a/completions/iwpriv b/completions/iwpriv new file mode 100644 index 0000000..4e38246 --- /dev/null +++ b/completions/iwpriv @@ -0,0 +1,31 @@ +# iwpriv completion -*- shell-script -*- + +_iwpriv() +{ + local cur prev words cword + _init_completion || return + + case $prev in + roam) + COMPREPLY=($(compgen -W 'on off' -- "$cur")) + return + ;; + port) + COMPREPLY=($(compgen -W 'ad-hoc managed' -- "$cur")) + return + ;; + esac + + if ((cword == 1)); then + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '--help --version' -- "$cur")) + else + _available_interfaces -w + fi + else + COMPREPLY=($(compgen -W '--all roam port' -- "$cur")) + fi +} && + complete -F _iwpriv iwpriv + +# ex: filetype=sh diff --git a/completions/iwspy b/completions/iwspy new file mode 100644 index 0000000..38b7868 --- /dev/null +++ b/completions/iwspy @@ -0,0 +1,20 @@ +# iwspy completion -*- shell-script -*- + +_iwspy() +{ + local cur prev words cword + _init_completion || return + + if ((cword == 1)); then + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '--help --version' -- "$cur")) + else + _available_interfaces -w + fi + else + COMPREPLY=($(compgen -W 'setthr getthr off' -- "$cur")) + fi +} && + complete -F _iwspy iwspy + +# ex: filetype=sh diff --git a/completions/jar b/completions/jar new file mode 100644 index 0000000..2289491 --- /dev/null +++ b/completions/jar @@ -0,0 +1,27 @@ +# jar(1) completion -*- shell-script -*- + +_jar() +{ + local cur prev words cword + _init_completion || return + + if ((cword == 1)); then + COMPREPLY=($(compgen -W 'c t x u' -- "$cur")) + return + fi + + case ${words[1]} in + *c*f) + _filedir + ;; + *f) + _filedir_xspec unzip + ;; + *) + _filedir + ;; + esac +} && + complete -F _jar jar + +# ex: filetype=sh diff --git a/completions/jarsigner b/completions/jarsigner new file mode 100644 index 0000000..1f26c9c --- /dev/null +++ b/completions/jarsigner @@ -0,0 +1,57 @@ +# jarsigner(1) completion -*- shell-script -*- + +_jarsigner() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -keystore) + COMPREPLY=($(compgen -W 'NONE' -- "$cur")) + _filedir '@(jks|ks|p12|pfx)' + return + ;; + -storepass | -keypass | -sigfile | -digestalg | -sigalg | -tsacert | -tsapolicyid | \ + -tsadigestalg | -altsigner | -altsignerpath | -providerName | -providerClass | \ + -providerArg) + return + ;; + -certchain | -tsa) + _filedir + return + ;; + -storetype) + COMPREPLY=($(compgen -W 'JKS PKCS11 PKCS12' -- "$cur")) + return + ;; + -signedjar) + _filedir '@(jar|apk)' + return + ;; + esac + + # Check if a jar was already given. + local i jar=false + for ((i = 1; i < ${#words[@]} - 1; i++)); do + if [[ ${words[i]} == *.@(jar|apk) && \ + ${words[i - 1]} != -signedjar ]]; then + jar=true + break + fi + done + + if ! $jar; then + if [[ $cur == -* ]]; then + # Documented as "should not be used": -internalsf, -sectionsonly + COMPREPLY=($(compgen -W '-keystore -storepass -storetype + -keypass -sigfile -signedjar -digestalg -sigalg -verify + -verbose -certs -tsa -tsacert -altsigner -altsignerpath + -protected -providerName -providerClass -providerArg' \ + -- "$cur")) + fi + _filedir '@(jar|apk)' + fi +} && + complete -F _jarsigner jarsigner + +# ex: filetype=sh diff --git a/completions/java b/completions/java new file mode 100644 index 0000000..d0f70ae --- /dev/null +++ b/completions/java @@ -0,0 +1,333 @@ +# bash completion for java, javac and javadoc -*- shell-script -*- + +# available path elements completion +_java_path() +{ + cur=${cur##*:} + _filedir '@(jar|zip)' +} + +# exact classpath determination +_java_find_classpath() +{ + local i + + # search first in current options + for ((i = 1; i < cword; i++)); do + if [[ ${words[i]} == -@(cp|classpath) ]]; then + classpath=${words[i + 1]} + break + fi + done + + # default to environment + [[ ! -v classpath ]] && classpath=${CLASSPATH-} + + # default to current directory + [[ -z $classpath ]] && classpath=. +} + +# exact sourcepath determination +_java_find_sourcepath() +{ + local i + + # search first in current options + for ((i = 1; i < cword; i++)); do + if [[ ${words[i]} == -sourcepath ]]; then + sourcepath=${words[i + 1]} + break + fi + done + + # default to classpath + if [[ ! -v sourcepath ]]; then + local classpath + _java_find_classpath + sourcepath=$classpath + fi +} + +# available classes completion +_java_classes() +{ + local classpath i + + # find which classpath to use + _java_find_classpath + + # convert package syntax to path syntax + cur=${cur//.//} + # parse each classpath element for classes + for i in ${classpath//:/ }; do + if [[ $i == *.@(jar|zip) && -r $i ]]; then + if type zipinfo &>/dev/null; then + COMPREPLY+=($(zipinfo -1 "$i" "$cur*" 2>/dev/null | + command grep '^[^$]*\.class$')) + elif type unzip &>/dev/null; then + # Last column, between entries consisting entirely of dashes + COMPREPLY+=($(unzip -lq "$i" "$cur*" 2>/dev/null | + awk '$NF ~ /^-+$/ { flag=!flag; next }; + flag && $NF ~ /^[^$]*\.class/ { print $NF }')) + elif type jar &>/dev/null; then + COMPREPLY+=($(jar tf "$i" "$cur" | + command grep '^[^$]*\.class$')) + fi + + elif [[ -d $i ]]; then + COMPREPLY+=( + $(compgen -d -- "$i/$cur" | command sed -e "s|^$i/\(.*\)|\1.|") + $(compgen -f -X '!*.class' -- "$i/$cur" | + command sed -e '/\$/d' -e "s|^$i/||") + ) + [[ ${COMPREPLY-} == *.class ]] || compopt -o nospace + + # FIXME: if we have foo.class and foo/, the completion + # returns "foo/"... how to give precedence to files + # over directories? + fi + done + + if ((${#COMPREPLY[@]} != 0)); then + # remove class extension + COMPREPLY=(${COMPREPLY[@]%.class}) + # convert path syntax to package syntax + COMPREPLY=(${COMPREPLY[@]//\//.}) + fi +} + +# available packages completion +_java_packages() +{ + local sourcepath i + + # find which sourcepath to use + _java_find_sourcepath + + # convert package syntax to path syntax + cur=${cur//.//} + # parse each sourcepath element for packages + for i in ${sourcepath//:/ }; do + if [[ -d $i ]]; then + COMPREPLY+=($(command ls -F -d $i/$cur* 2>/dev/null | + command sed -e 's|^'$i'/||')) + fi + done + if ((${#COMPREPLY[@]} != 0)); then + # keep only packages + COMPREPLY=($(tr " " "\n" <<<"${COMPREPLY[@]}" | command grep "/$")) + # remove packages extension + COMPREPLY=(${COMPREPLY[@]%/}) + # convert path syntax to package syntax + cur="${COMPREPLY[*]//\//.}" + fi +} + +# java completion +# +_java() +{ + local cur prev words cword + _init_completion -n : || return + + local i + + for ((i = 1; i < cword; i++)); do + case ${words[i]} in + -cp | -classpath) + ((i++)) # skip the classpath string. + ;; + -*) + # this is an option, not a class/jarfile name. + ;; + *) + # once we've seen a class, just do filename completion + _filedir + return + ;; + esac + done + + case $cur in + # standard option completions + -verbose:*) + COMPREPLY=($(compgen -W 'class gc jni' -- "${cur#*:}")) + return + ;; + -javaagent:*) + cur=${cur#*:} + _filedir '@(jar|zip)' + return + ;; + -agentpath:*) + cur=${cur#*:} + _filedir so + return + ;; + # various non-standard option completions + -splash:*) + cur=${cur#*:} + _filedir '@(gif|jp?(e)g|png)' + return + ;; + -Xbootclasspath*:*) + _java_path + return + ;; + -Xcheck:*) + COMPREPLY=($(compgen -W 'jni' -- "${cur#*:}")) + return + ;; + -Xgc:*) + COMPREPLY=($(compgen -W 'singlecon gencon singlepar genpar' \ + -- "${cur#*:}")) + return + ;; + -Xgcprio:*) + COMPREPLY=($(compgen -W 'throughput pausetime deterministic' \ + -- "${cur#*:}")) + return + ;; + -Xloggc:* | -Xverboselog:*) + cur=${cur#*:} + _filedir + return + ;; + -Xshare:*) + COMPREPLY=($(compgen -W 'auto off on' -- "${cur#*:}")) + return + ;; + -Xverbose:*) + COMPREPLY=($(compgen -W 'memory load jni cpuinfo codegen opt + gcpause gcreport' -- "${cur#*:}")) + return + ;; + -Xverify:*) + COMPREPLY=($(compgen -W 'all none remote' -- "${cur#*:}")) + return + ;; + # the rest that we have no completions for + -D* | -*:*) + return + ;; + esac + + case $prev in + -cp | -classpath) + _java_path + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1" -help)' -- "$cur")) + [[ $cur == -X* ]] && + COMPREPLY+=($(compgen -W '$(_parse_help "$1" -X)' -- "$cur")) + else + if [[ $prev == -jar ]]; then + # jar file completion + _filedir '[jw]ar' + else + # classes completion + _java_classes + fi + fi + + [[ ${COMPREPLY-} == -*[:=] ]] && compopt -o nospace + + __ltrim_colon_completions "$cur" +} && + complete -F _java java + +_javadoc() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -overview | -helpfile) + _filedir '?(x)htm?(l)' + return + ;; + -doclet | -exclude | -subpackages | -source | -locale | -encoding | -windowtitle | \ + -doctitle | -header | -footer | -top | -bottom | -group | -noqualifier | -tag | \ + -charset | -sourcetab | -docencoding) + return + ;; + -stylesheetfile) + _filedir css + return + ;; + -d | -link | -linkoffline) + _filedir -d + return + ;; + -classpath | -cp | -bootclasspath | -docletpath | -sourcepath | -extdirs | \ + -excludedocfilessubdir) + _java_path + return + ;; + esac + + # -linkoffline takes two arguments + if [[ $cword -gt 2 && ${words[cword - 2]} == -linkoffline ]]; then + _filedir -d + return + fi + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1" -help)' -- "$cur")) + else + # source files completion + _filedir java + # packages completion + _java_packages + fi +} && + complete -F _javadoc javadoc + +_javac() +{ + local cur prev words cword + _init_completion -n : || return + + case $prev in + -d) + _filedir -d + return + ;; + -cp | -classpath | -bootclasspath | -sourcepath | -extdirs) + _java_path + return + ;; + esac + + if [[ $cur == -+([a-zA-Z0-9-_]):* ]]; then + # Parse required options from -foo:{bar,quux,baz} + local helpopt=-help + [[ $cur == -X* ]] && helpopt=-X + # For some reason there may be -g:none AND -g:{lines,source,vars}; + # convert the none case to the curly brace format so it parses like + # the others. + local opts=$("$1" $helpopt 2>&1 | command sed -e 's/-g:none/-g:{none}/' -ne \ + "s/^[[:space:]]*${cur%%:*}:{\([^}]\{1,\}\)}.*/\1/p") + COMPREPLY=($(compgen -W "${opts//,/ }" -- "${cur#*:}")) + return + fi + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1" -help)' -- "$cur")) + [[ $cur == -X* ]] && + COMPREPLY+=($(compgen -W '$(_parse_help "$1" -X)' -- "$cur")) + else + # source files completion + _filedir java + fi + + [[ ${COMPREPLY-} == -*[:=] ]] && compopt -o nospace + + __ltrim_colon_completions "$cur" +} && + complete -F _javac javac + +# ex: filetype=sh diff --git a/completions/javaws b/completions/javaws new file mode 100644 index 0000000..f42a1e5 --- /dev/null +++ b/completions/javaws @@ -0,0 +1,34 @@ +# javaws(1) completion -*- shell-script -*- + +_javaws() +{ + local cur prev words cword + _init_completion -n = || return + + case $prev in + -help | -license | -about | -viewer | -arg | -param | -property | -update | -umask) + return + ;; + -basedir | -codebase) + _filedir -d + return + ;; + -uninstall | -import) + _filedir jnlp + return + ;; + esac + + if [[ $cur == *= ]]; then + return + elif [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W "$(_parse_help "$1" -help) " -- "$cur")) + [[ ${COMPREPLY-} == *= ]] && compopt -o nospace + return + fi + + _filedir jnlp +} && + complete -F _javaws javaws + +# ex: filetype=sh diff --git a/completions/jpegoptim b/completions/jpegoptim new file mode 100644 index 0000000..c366972 --- /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 + --help | --version | -!(-*)[hV]*) + return + ;; + --dest | -!(-*)d) + _filedir -d + return + ;; + --max | --threshold | -!(-*)[mT]) + COMPREPLY=($(compgen -W '{0..100}' -- "$cur")) + return + ;; + --size | -!(-*)S) + 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 new file mode 100644 index 0000000..a451eec --- /dev/null +++ b/completions/jps @@ -0,0 +1,25 @@ +# jps(1) completion -*- shell-script -*- + +_jps() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -J* | -help) + return + ;; + esac + + if [[ $cur == -* ]]; then + # Not using _parse_usage because output has [-help] which does not + # mean -h, -e, -l, -p... + COMPREPLY=($(compgen -W "-q -m -l -v -V -J -help" -- "$cur")) + [[ ${COMPREPLY-} == -J* ]] && compopt -o nospace + else + _known_hosts_real -- "$cur" + fi +} && + complete -F _jps jps + +# ex: filetype=sh diff --git a/completions/jq b/completions/jq new file mode 100644 index 0000000..2d99c39 --- /dev/null +++ b/completions/jq @@ -0,0 +1,54 @@ +# jq(1) completion -*- shell-script -*- + +_jq() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --help | --version | --arg | --argjson | --slurpfile | --argfile) + return + ;; + --indent) + COMPREPLY=($(compgen -W '{1..8}' -- "$cur")) + return + ;; + --from-file | --run-tests | -!(-*)f) + _filedir + return + ;; + -!(-*)L) + _filedir -d + return + ;; + esac + + ((cword > 2)) && + case ${words[cword - 2]} in + --arg | --argjson) + return + ;; + --slurpfile | --argfile) + _filedir json + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + return + fi + + local args + # TODO: DTRT with args taking 2 options + _count_args "" "@(--arg|--arg?(json|file)|--?(slurp|from-)file|--indent|--run-tests|-!(-*)[fL])" + + # 1st arg is filter + ((args == 1)) && return + # 2... are input files + _filedir json + +} && + complete -F _jq jq + +# ex: filetype=sh diff --git a/completions/jshint b/completions/jshint new file mode 100644 index 0000000..3622cec --- /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/json_xs b/completions/json_xs new file mode 100644 index 0000000..c93ba86 --- /dev/null +++ b/completions/json_xs @@ -0,0 +1,31 @@ +# json_xs completion -*- shell-script -*- + +_json_xs() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -*f) + COMPREPLY=($(compgen -W 'json cbor storable storable-file bencode + clzf eval yaml string none' -- "$cur")) + return + ;; + -*t) + COMPREPLY=($(compgen -W 'json json-utf-8 json-pretty + json-utf-16le json-utf-16be json-utf-32le json-utf-32be + cbor storable storable-file bencode clzf yaml dump dumper + string none' -- "$cur")) + return + ;; + -*e) + return + ;; + esac + + [[ $cur == -* ]] && + COMPREPLY=($(compgen -W '$(_parse_usage "$1") -f' -- "$cur")) +} && + complete -F _json_xs json_xs + +# ex: filetype=sh diff --git a/completions/jsonschema b/completions/jsonschema new file mode 100644 index 0000000..8a36ed3 --- /dev/null +++ b/completions/jsonschema @@ -0,0 +1,30 @@ +# bash completion for jsonschema -*- shell-script -*- + +_jsonschema() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --help | --error-format | --validator | -[hFV]) + return + ;; + --instance | -i) + _filedir json + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + return + fi + + local args + _count_args "" "-*" + ((args == 1)) || return + _filedir '@(json|schema)' +} && + complete -F _jsonschema jsonschema + +# ex: filetype=sh diff --git a/completions/k3b b/completions/k3b new file mode 100644 index 0000000..87d26cd --- /dev/null +++ b/completions/k3b @@ -0,0 +1,48 @@ +# bash completion for k3b -*- shell-script -*- + +_k3b() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --help* | --author | -v | --version | --license | --lang) + return + ;; + --datacd | --audiocd | --videocd | --mixedcd | --emovixcd | --videodvd) + _filedir + return + ;; + --copydvd | --formatdvd | --videodvdrip) + _dvd_devices + return + ;; + --copycd | --erasecd | --cddarip | --videocdrip) + _cd_devices + _dvd_devices + return + ;; + --cdimage | --image) + _filedir '@(cue|iso|toc)' + return + ;; + --dvdimage) + _filedir iso + return + ;; + --ao) + COMPREPLY=($(compgen -W 'alsa arts' -- "$cur")) + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W "$(_parse_help "$1")" -- "$cur")) + [[ ${COMPREPLY-} == *= ]] && compopt -o nospace + else + _filedir + fi +} && + complete -F _k3b k3b + +# ex: filetype=sh diff --git a/completions/kcov b/completions/kcov new file mode 100644 index 0000000..672967a --- /dev/null +++ b/completions/kcov @@ -0,0 +1,64 @@ +# kcov(1) completion -*- shell-script -*- + +_kcov() +{ + local cur prev words cword split + _init_completion -s -n : || return + + case "$prev" in + --pid | -p) + _pids + return + ;; + --sort-type | -s) + 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) + if [[ $cur == ?*,* ]]; then + prev="${cur%,*}" + cur="${cur##*,}" + COMPREPLY=($(compgen -W "{0..100}" -- "$cur")) + ((${#COMPREPLY[@]} == 1)) && + COMPREPLY=(${COMPREPLY/#/$prev,}) + else + COMPREPLY=($(compgen -W "{0..100}" -- "$cur")) + ((${#COMPREPLY[@]} == 1)) && COMPREPLY=(${COMPREPLY/%/,}) + compopt -o nospace + fi + return + ;; + --title | -t | --include-pattern | --exclude-pattern | --path-strip-level) + # argument required but no completions available + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1" --help)' -- "$cur")) + [[ ${COMPREPLY-} == *= ]] && compopt -o nospace + return + fi + + _filedir +} && + complete -F _kcov kcov + +# ex: filetype=sh diff --git a/completions/kill b/completions/kill new file mode 100644 index 0000000..25cddba --- /dev/null +++ b/completions/kill @@ -0,0 +1,29 @@ +# kill(1) completion -*- shell-script -*- + +_kill() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -s) + _signals + return + ;; + -l) + return + ;; + esac + + if [[ $cword -eq 1 && $cur == -* ]]; then + # return list of available signals + _signals - + COMPREPLY+=($(compgen -W "-s -l" -- "$cur")) + else + # return list of available PIDs + _pids + fi +} && + complete -F _kill kill + +# ex: filetype=sh diff --git a/completions/killall b/completions/killall new file mode 100644 index 0000000..c7c0b0f --- /dev/null +++ b/completions/killall @@ -0,0 +1,36 @@ +# killall(1) completion -*- shell-script -*- + +[[ $OSTYPE == *@(linux|freebsd|darwin)* ]] || return 1 + +_killall() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + --context | --older-than | --younger-than | --version | -!(-*)@([Zoy]|V*)) + return + ;; + --signal | -!(-*)s) + _signals + return + ;; + --user | -!(-*)u) + _allowed_users + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + ((cword == 1)) && _signals - + return + fi + + _pnames +} && + complete -F _killall killall + +# ex: filetype=sh diff --git a/completions/kldload b/completions/kldload new file mode 100644 index 0000000..f511158 --- /dev/null +++ b/completions/kldload @@ -0,0 +1,21 @@ +# FreeBSD kldload completion -*- shell-script -*- + +[[ $OSTYPE == *freebsd* ]] || return 1 + +_kldload() +{ + local cur prev words cword + _init_completion || return + + local moddir=/modules/ + [[ -d $moddir ]] || moddir=/boot/kernel/ + + compopt -o filenames + COMPREPLY=($(compgen -f "$moddir$cur")) + COMPREPLY=(${COMPREPLY[@]#$moddir}) + COMPREPLY=(${COMPREPLY[@]%.ko}) + +} && + complete -F _kldload kldload + +# ex: filetype=sh diff --git a/completions/kldunload b/completions/kldunload new file mode 100644 index 0000000..2e12282 --- /dev/null +++ b/completions/kldunload @@ -0,0 +1,15 @@ +# FreeBSD kldunload completion -*- shell-script -*- + +[[ $OSTYPE == *freebsd* ]] || return 1 + +_kldunload() +{ + local cur prev words cword + _init_completion || return + + COMPREPLY=($(compgen -W '$(kldstat)' -X 'kernel' -X '!*.ko' -- "$cur")) + COMPREPLY=(${COMPREPLY[@]%.ko}) +} && + complete -F _kldunload kldunload + +# ex: filetype=sh diff --git a/completions/koji b/completions/koji new file mode 100644 index 0000000..8efef9a --- /dev/null +++ b/completions/koji @@ -0,0 +1,245 @@ +# koji completion -*- shell-script -*- + +_koji_search() +{ + COMPREPLY+=($(compgen -W \ + '$("$1" -q search $2 "$cur*" 2>/dev/null)' -- "$cur")) +} + +_koji_build() +{ + _koji_search "$1" build +} + +_koji_package() +{ + _koji_search "$1" package +} + +_koji_user() +{ + _koji_search "$1" user +} + +_koji_tag() +{ + COMPREPLY+=($(compgen -W '$("$1" -q list-tags 2>/dev/null)' -- "$cur")) +} + +_koji_target() +{ + COMPREPLY+=($(compgen -W '$("$1" -q list-targets 2>/dev/null | + awk "{ print \$1 }")' -- "$cur")) +} + +_koji() +{ + local cur prev words cword split + _init_completion -s || return + + local commandix command + for ((commandix = 1; commandix < cword; commandix++)); do + if [[ ${words[commandix]} != -* ]]; then + command=${words[commandix]} + break + fi + done + + case $prev in + --help | --help-commands | -!(-*)h*) + return + ;; + --config | --keytab | -!(-*)[co]) + _filedir + return + ;; + --runas | --user | --editor | --by) + _koji_user "$1" + return + ;; + --authtype) + COMPREPLY=($(compgen -W 'noauth ssl password kerberos' -- "$cur")) + return + ;; + --topdir) + _filedir -d + return + ;; + --type) + case ${command-} in + latest-pkg | list-tagged) + COMPREPLY=($(compgen -W 'maven' -- "$cur")) + ;; + esac + return + ;; + --name) + case ${command-} in + list-targets) + _koji_target "$1" + ;; + esac + return + ;; + --owner) + _koji_user "$1" + return + ;; + --tag | --latestfrom) + _koji_tag "$1" + return + ;; + --package) + _koji_package "$1" + return + ;; + --build) + _koji_build "$1" + return + ;; + --build-target) + _koji_target "$1" + return + ;; + esac + + $split && return + + if [[ -v command ]]; then + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W \ + '$(_parse_help "$1" "$command --help")' -- "$cur")) + [[ ${COMPREPLY-} == *= ]] && compopt -o nospace + return + fi + + # How many'th non-option arg (1-based) for $command are we completing? + local i nth=1 + for ((i = commandix + 1; i < cword; i++)); do + [[ ${words[i]} == -* ]] || ((nth++)) + done + + case $command in + build | maven-build | win-build) + case $nth in + 1) + _koji_target "$1" + ;; + 2) + _filedir src.rpm + ;; + esac + ;; + cancel) + _koji_build "$1" + ;; + chain-build) + case $nth in + 1) + _koji_target "$1" + ;; + esac + ;; + download-build) + case $nth in + 1) + _koji_build "$1" + ;; + esac + ;; + import-comps) + case $nth in + 1) + _filedir xml + ;; + 2) + _koji_tag "$1" + ;; + esac + ;; + latest-by-tag) + _koji_package "$1" + ;; + latest-pkg | list-groups | list-tag-inheritance | show-groups) + case $nth in + 1) + _koji_tag "$1" + ;; + esac + ;; + list-tagged) + case $nth in + 1) + _koji_tag "$1" + ;; + 2) + _koji_package "$1" + ;; + esac + ;; + list-untagged) + case $nth in + 1) + _koji_package "$1" + ;; + esac + ;; + move-pkg) + case $nth in + 1 | 2) + _koji_tag "$1" + ;; + *) + _koji_package "$1" + ;; + esac + ;; + search) + case $nth in + 1) + COMPREPLY=($(compgen -W 'package build tag target + user host rpm' -- "$cur")) + ;; + esac + ;; + tag-pkg | untag-pkg) + case $nth in + 1) + _koji_tag "$1" + ;; + *) + _koji_package "$1" + ;; + esac + ;; + taginfo) + _koji_tag "$1" + ;; + wait-repo) + case $nth in + 1) + for ((i = commandix + 1; i < cword; i++)); do + if [[ ${words[i]} == --target ]]; then + _koji_target "$1" + return + fi + done + _koji_tag "$1" + ;; + esac + ;; + esac + return + fi + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + [[ ${COMPREPLY-} == *= ]] && compopt -o nospace + elif [[ ! -v command ]]; then + COMPREPLY=($(compgen -W '$("$1" --help-commands 2>/dev/null | \ + awk "/^( +|\t)/ { print \$1 }")' -- "$cur")) + fi +} && + complete -F _koji koji arm-koji ppc-koji s390-koji sparc-koji + +# ex: filetype=sh diff --git a/completions/ktutil b/completions/ktutil new file mode 100644 index 0000000..6030a47 --- /dev/null +++ b/completions/ktutil @@ -0,0 +1,120 @@ +# ktutil completion -*- shell-script -*- + +_heimdal_principals() +{ + COMPREPLY=($(compgen -W "$(kadmin -l dump 2>/dev/null | + awk '{print $1}')" -- "$cur")) +} + +_heimdal_realms() +{ + COMPREPLY=($(compgen -W "$(kadmin -l dump 2>/dev/null | + awk '{print $1}' | awk -F@ '{print $2}')" -- "$cur")) +} + +_heimdal_encodings() +{ + COMPREPLY=($(compgen -W 'des-cbc-mcrc des-cbc-md4 des-cbc-md5 + des3-cbc-sha1 arcfour-hmac-md5 aes128-cts-hmac-sha1-96 + aes256-cts-hmac-sha1-96' -- "$cur")) +} + +_ktutil() +{ + local cur prev words cword split + _init_completion -s || return + + local command commands i options + + case $prev in + -p | --principal) + _heimdal_principals + return + ;; + -e | --enctype) + _heimdal_encodings + return + ;; + -a | --admin-server) + _known_hosts_real -- "$cur" + return + ;; + -r | --realm) + _heimdal_realms + return + ;; + -s | -k | --srvtab | --keytab) + _filedir + return + ;; + esac + + $split && return + + commands='add change copy get list remove rename purge srvconvert + srv2keytab srvcreate key2srvtab' + + for ((i = 1; i < cword; i++)); do + case ${words[i]} in + -k | --keytab) + ((i++)) + ;; + -*) ;; + + *) + command=${words[i]} + break + ;; + esac + done + + if [[ $cur == -* ]]; then + case ${command-} in + add) + options='-p --principal -V -e --enctype -w --password -r + --random -s --no-salt -h --hex' + ;; + change) + options='-r --realm -a --admin-server -s --server-port' + ;; + get) + options='-p --principal -e --enctype -r --realm -a + --admin-server -s server --server-port' + ;; + list) + options='--keys --timestamp' + ;; + remove) + options='-p --principal -V --kvno -e --enctype' + ;; + purge) + options='--age' + ;; + srv2keytab | key2srvtab) + options='-s --srvtab' + ;; + *) + options='-k --keytab -v --verbose --version -v --help' + ;; + esac + COMPREPLY=($(compgen -W "$options" -- "$cur")) + else + case ${command-} in + copy) + _filedir + ;; + get) + _heimdal_principals + ;; + rename) + _heimdal_principals + ;; + *) + COMPREPLY=($(compgen -W "$commands" -- "$cur")) + ;; + esac + fi +} && + complete -F _ktutil ktutil + +# ex: filetype=sh diff --git a/completions/larch b/completions/larch new file mode 100644 index 0000000..7ed9ca2 --- /dev/null +++ b/completions/larch @@ -0,0 +1,39 @@ +# larch(1) completion -*- shell-script -*- +# by Alex Shinn + +_larch() +{ + local cur prev words cword + _init_completion || return + + if [[ $cword -eq 1 || $prev == -* ]]; then + COMPREPLY=($(compgen -W ' \ + my-id my-default-archive register-archive whereis-archive archives \ + init-tree tree-root tree-version set-tree-version inventory \ + tagging-method tree-lint missing-tags add delete \ + move explicit-default set-manifest manifest check-manifest mkpatch \ + dopatch patch-report empty-patch make-archive make-category \ + make-branch make-version categories branches versions revisions \ + cat-archive-log archive-cache-revision archive-cached-revisions \ + archive-uncache-revision category-readme branch-readme \ + version-readme make-log logs add-log log-ls cat-log \ + log-header-field changelog log-for-merge merge-points \ + new-on-branch import commit get get-patch lock-branch \ + lock-revision push-mirror build-config update-config replay-config \ + record-config show-config config-history update replay delta-patch \ + star-merge tag prepare-branch finish-branch join-branch \ + whats-missing what-changed file-diffs pristines lock-pristine \ + my-revision-library library-find library-add library-remove \ + library-archives library-categories library-branches \ + library-versions library-revisions library-log library-file \ + touched-files-prereqs patch-set-web update-distributions \ + distribution-name notify my-notifier mail-new-categories \ + mail-new-branches mail-new-versions mail-new-revisions \ + notify-library notify-browser push-new-revisions sendmail-mailx' \ + "$cur")) + fi + +} && + complete -F _larch -o default larch + +# ex: filetype=sh diff --git a/completions/lastlog b/completions/lastlog new file mode 100644 index 0000000..214a174 --- /dev/null +++ b/completions/lastlog @@ -0,0 +1,25 @@ +# lastlog(8) completion -*- shell-script -*- + +_lastlog() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + --before | --help | --time | -!(-*)@([bt]|h*)) + return + ;; + --user | -!(-*)u) + COMPREPLY=($(compgen -u -- "$cur")) + return + ;; + esac + + $split && return + + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + [[ ${COMPREPLY-} == *= ]] && compopt -o nospace +} && + complete -F _lastlog lastlog + +# ex: filetype=sh diff --git a/completions/ldapsearch b/completions/ldapsearch new file mode 100644 index 0000000..6dc415e --- /dev/null +++ b/completions/ldapsearch @@ -0,0 +1,231 @@ +# bash completion for openldap -*- shell-script -*- + +_ldap_uris() +{ + COMPREPLY=($(compgen -W 'ldap:// ldaps://' -- "$cur")) +} + +_ldap_protocols() +{ + COMPREPLY=($(compgen -W '2 3' -- "$cur")) +} + +_ldapsearch() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -*h) + _known_hosts_real -- "$cur" + return + ;; + -*H) + _ldap_uris + return + ;; + -*T) + _filedir -d + return + ;; + -*[fy]) + _filedir + return + ;; + -*s) + COMPREPLY=($(compgen -W 'base one sub children' -- "$cur")) + return + ;; + -*a) + COMPREPLY=($(compgen -W 'never always search find' -- "$cur")) + return + ;; + -*P) + _ldap_protocols + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1") -MM -ZZ' -- "$cur")) + fi +} && + complete -F _ldapsearch ldapsearch + +_ldapaddmodify() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -*h) + _known_hosts_real -- "$cur" + return + ;; + -*H) + _ldap_uris + return + ;; + -*[Sfy]) + _filedir + return + ;; + -*P) + _ldap_protocols + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1") -MM -ZZ' -- "$cur")) + fi +} && + complete -F _ldapaddmodify ldapadd ldapmodify + +_ldapdelete() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -*h) + _known_hosts_real -- "$cur" + return + ;; + -*H) + _ldap_uris + return + ;; + -*[fy]) + _filedir + return + ;; + -*P) + _ldap_protocols + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1") -MM -ZZ' -- "$cur")) + fi +} && + complete -F _ldapdelete ldapdelete + +_ldapcompare() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -*h) + _known_hosts_real -- "$cur" + return + ;; + -*H) + _ldap_uris + return + ;; + -*y) + _filedir + return + ;; + -*P) + _ldap_protocols + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1") -MM -ZZ' -- "$cur")) + fi +} && + complete -F _ldapcompare ldapcompare + +_ldapmodrdn() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -*h) + _known_hosts_real -- "$cur" + return + ;; + -*H) + _ldap_uris + return + ;; + -*[fy]) + _filedir + return + ;; + -*P) + _ldap_protocols + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1") -ZZ -MM' -- "$cur")) + fi +} && + complete -F _ldapmodrdn ldapmodrdn + +_ldapwhoami() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -*h) + _known_hosts_real -- "$cur" + return + ;; + -*H) + _ldap_uris + return + ;; + -*[fy]) + _filedir + return + ;; + -*P) + _ldap_protocols + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1") -MM -ZZ' -- "$cur")) + fi +} && + complete -F _ldapwhoami ldapwhoami + +_ldappasswd() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -*h) + _known_hosts_real -- "$cur" + return + ;; + -*H) + _ldap_uris + return + ;; + -*[tTy]) + _filedir + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1") -MM -ZZ' -- "$cur")) + fi +} && + complete -F _ldappasswd ldappasswd + +# ex: filetype=sh diff --git a/completions/ldapvi b/completions/ldapvi new file mode 100644 index 0000000..cb01ac8 --- /dev/null +++ b/completions/ldapvi @@ -0,0 +1,51 @@ +# bash completion for ldapvi -*- shell-script -*- + +_ldapvi() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --host | -!(-*)h) + _known_hosts_real -- "$cur" + return + ;; + --sasl-mech | -!(-*)Y) + COMPREPLY=($(compgen -W 'EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 + PLAIN ANONYMOUS' -- "$cur")) + return + ;; + --bind) + COMPREPLY=($(compgen -W 'simple sasl' -- "$cur")) + return + ;; + --bind-dialog) + COMPREPLY=($(compgen -W 'never auto always' -- "$cur")) + return + ;; + --scope) + COMPREPLY=($(compgen -W 'base one sub' -- "$cur")) + return + ;; + --deref) + COMPREPLY=($(compgen -W 'never searching finding always' \ + -- "$cur")) + return + ;; + --encoding) + COMPREPLY=($(compgen -W 'ASCII UTF-8 binary' -- "$cur")) + return + ;; + --tls) + COMPREPLY=($(compgen -W 'never allow try strict' -- "$cur")) + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + fi +} && + complete -F _ldapvi ldapvi + +# ex: filetype=sh diff --git a/completions/lftp b/completions/lftp new file mode 100644 index 0000000..72dedb4 --- /dev/null +++ b/completions/lftp @@ -0,0 +1,28 @@ +# lftp(1) completion -*- shell-script -*- + +_lftp() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -!(-*)f) + _filedir + return + ;; + --help | --version | -!(-*)[chveups]) + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + return + fi + + COMPREPLY=($(compgen -W '$("$1" -c "bookmark list" 2>/dev/null)' -- "$cur")) + _known_hosts_real -- "$cur" +} && + complete -F _lftp lftp + +# ex: filetype=sh diff --git a/completions/lftpget b/completions/lftpget new file mode 100644 index 0000000..d21622e --- /dev/null +++ b/completions/lftpget @@ -0,0 +1,14 @@ +# lftpget(1) completion -*- shell-script -*- + +_lftpget() +{ + local cur prev words cword + _init_completion || return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '-c -d -v' -- "$cur")) + fi +} && + complete -F _lftpget lftpget + +# ex: filetype=sh diff --git a/completions/lilo b/completions/lilo new file mode 100644 index 0000000..af8539a --- /dev/null +++ b/completions/lilo @@ -0,0 +1,66 @@ +# bash completion for lilo(8) -*- shell-script -*- + +_lilo_labels() +{ + COMPREPLY=($(compgen -W "$(awk -F= '$1 ~ /^[ \t]*label$/ {print $2}' \ + ${1:-/etc/lilo.conf} 2>/dev/null | command sed -e 's/\"//g')" \ + -- "$cur")) +} + +_lilo() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -C | -i | -m | -s | -S) + _filedir + return + ;; + -r) + _filedir -d + return + ;; + -I | -D | -R) + # label completion + local i conf + for i in "${!words[@]}"; do + if [[ ${words[i]} == -C ]]; then + conf=${words[i + 1]} + break + fi + done + _lilo_labels $conf + return + ;; + -A | -b | -M | -u | -U) + # device completion + cur=${cur:=/dev/} + _filedir + return + ;; + -T) + # topic completion + COMPREPLY=($(compgen -W 'help ChRul EBDA geom geom= table= + video' -- "$cur")) + return + ;; + -B) + _filedir bmp + return + ;; + -E) + _filedir '@(bmp|dat)' + return + ;; + esac + + if [[ $cur == -* ]]; then + # relevant options completion + COMPREPLY=($(compgen -W '-A -B -b -c -C -d -E -f -g -i -I -l -L -m -M + -p -P -q -r -R -s -S -t -T -u -U -v -V -w -x -z' -- "$cur")) + fi +} && + complete -F _lilo lilo + +# ex: filetype=sh diff --git a/completions/links b/completions/links new file mode 100644 index 0000000..e0c28e2 --- /dev/null +++ b/completions/links @@ -0,0 +1,100 @@ +# bash completion for links -*- shell-script -*- + +_links() +{ + local cur prev words cword + _init_completion -n : || return + + case $prev in + -html-t-text-color | -html-t-link-color) + COMPREPLY=($(compgen -W '{0..15}' -- "$cur")) + return + ;; + -http.fake-firefox | -html-[gt]-ignore-document-color) + COMPREPLY=($(compgen -W '0 1' -- "$cur")) + return + ;; + --help | -help | -mode | -display | -source | -dump | -width | -max-connections | \ + -max-connections-to-host | -retries | -receive-timeout | \ + -unrestartable-receive-timeout | -*-size | -*-proxy | \ + -append-text-to-dns-lookups | -ssl.client-cert-passwd | -http.fake-* | \ + -http.extra-header | -ftp.anonymous-passwd | -*-color | -*-gamma | \ + -bfu-aspect | -html-image-scale | -html-margin) + return + ;; + -lookup) + _known_hosts_real -- "$cur" + return + ;; + -driver) + local drivers=$("$1" -driver foo 2>&1 | + command sed -ne '$!d' -e '/^[a-z0-9, ]\{1,\}$/s/,/ /gp') + [[ $drivers ]] || drivers='x svgalib fb directfb pmshell atheos' + COMPREPLY=($(compgen -W "$drivers" -- "$cur")) + return + ;; + -codepage | -bookmarks-codepage | -http-assume-codepage) + _xfunc iconv _iconv_charsets + return + ;; + -download-dir) + _filedir -d + return + ;; + -bind-address) + _ip_addresses + return + ;; + -bind-address-ipv6) + _ip_addresses -6 + __ltrim_colon_completions "$cur" + return + ;; + -async-dns | -download-utime | -aggressive-cache | -only-proxies | \ + -http-bugs.* | -http.do-not-track | -ftp.use-* | -ftp.fast | -ftp.set-iptos | \ + -smb.allow-hyperlinks-to-smb | -save-url-history | -dither-letters | \ + -dither-images | -overwrite-instead-of-scroll | -html-*) + COMPREPLY=($(compgen -W '0 1' -- "$cur")) + return + ;; + -address-preference | -http.referer) + COMPREPLY=($(compgen -W '{0..4}' -- "$cur")) + return + ;; + -ssl-certificates | -display-optimize | -gamma-correction) + COMPREPLY=($(compgen -W '{0..2}' -- "$cur")) + return + ;; + -ssl.client-cert-key) + _filedir '@(key|pem)' + return + ;; + -ssl.client-cert-crt) + _filedir '@(c?(e)rt|cer|pem|der)' + return + ;; + -bookmarks-file) + _filedir html + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1" | + command grep -vF -- "->")' -- "$cur")) + return + fi + + local dir + for dir in .links .links2; do + if [[ -r ~/$dir/links.his ]]; then + COMPREPLY+=($(compgen -W '$(cat ~/$dir/links.his)' -- "$cur")) + __ltrim_colon_completions "$cur" + fi + done + _filedir '@(htm|html)' + +} && + complete -F _links links links2 + +# ex: filetype=sh diff --git a/completions/lintian b/completions/lintian new file mode 100644 index 0000000..9343832 --- /dev/null +++ b/completions/lintian @@ -0,0 +1,176 @@ +# bash completion for lintian(1) and lintian-info(1) -*- shell-script -*- + +_lintian_tags() +{ + local match search tags + + tags=$(awk '/^Tag/ { print $2 }' /usr/share/lintian/checks/*.desc) + if [[ $cur == *, ]]; then + search=${cur//,/ } + for item in $search; do + 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 + COMPREPLY+=($(compgen -P "${cur%,*}," -W "$tags" -- "${cur##*,}")) + else + COMPREPLY+=($(compgen -W "$tags" -- "$cur")) + fi +} + +_lintian_checks() +{ + local match search todisable checks + + checks=$(awk '/^(Check-Script|Abbrev)/ { print $2 }' \ + /usr/share/lintian/checks/*.desc) + if [[ $cur == *, ]]; then + search=${cur//,/ } + for item in $search; do + 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=$(command sed -e "s/\<$name\>//g" <<<$checks) + done + done + COMPREPLY+=($(compgen -W "$checks")) + elif [[ $cur == *,* ]]; then + COMPREPLY+=($(compgen -P "${cur%,*}," -W "$checks" -- "${cur##*,}")) + else + COMPREPLY+=($(compgen -W "$checks" -- "$cur")) + fi +} + +_lintian_infos() +{ + local match search infos + + infos=$(awk '/^Collector/ { print $2 }' \ + /usr/share/lintian/collection/*.desc) + if [[ $cur == *, ]]; then + search=${cur//,/ } + for item in $search; do + 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 + COMPREPLY+=($(compgen -P "${cur%,*}," -W "$infos" -- "${cur##*,}")) + else + COMPREPLY+=($(compgen -W "$infos" -- "$cur")) + fi +} + +_lintian() +{ + local cur prev words cword + _init_completion || return + + local lint_actions general_opts behaviour_opts configuration_opts + + lint_actions="--setup-lab --remove-lab --check --check-part --tags + --tags-from-file --ftp-master-rejects --dont-check-part --unpack + --remove" + general_opts="--help --version --print-version --verbose --debug --quiet" + behaviour_opts="--info --display-info --display-experimental --pedantic + --display-level --suppress-tags --suppress-tags-from-file --no-override + --show-overrides --color --unpack-info --md5sums --checksums + --allow-root --fail-on-warnings --keep-lab" + configuration_opts="--cfg --lab --archivedir --dist --area --section --arch + --root" + + if [[ $prev == -* ]]; then + case $prev in + -C | --check-part | -X | --dont-check-part) + _lintian_checks + ;; + -T | --tags | --suppress-tags) + _lintian_tags + ;; + --tags-from-file | --suppress-tags-from-file | --cfg | -p | \ + --packages-file) + _filedir + ;; + --lab | --archivedir | --dist | --root) + _filedir -d + ;; + --color) + COMPREPLY=($(compgen -W "never always auto html" -- "$cur")) + ;; + -U | --unpack-info) + _lintian_infos + ;; + --area | --section) + COMPREPLY=($(compgen -W "main contrib non-free" -- "$cur")) + ;; + --arch) ;; + + esac + fi + + case "$cur" in + --*) + COMPREPLY=($(compgen -W "$lint_actions $general_opts + $behaviour_opts $configuration_opts" -- "$cur")) + ;; + *,) + # If we're here, the user is trying to complete on + # --action tag,tag, + # Only few actions permit that, re-complete them now. + case "$prev" in + -C | --check-part | -X | --dont-check-part) + _lintian_checks + ;; + -T | --tags | --suppress-tags) + _lintian_tags + ;; + -U | --unpack-info) + _lintian_infos + ;; + esac + ;; + *) + # in Ubuntu, dbgsym packages end in .ddeb, lintian >= 2.57.0 groks + _filedir '@(?(u|d)deb|changes|dsc|buildinfo)' + ;; + esac + return 0 +} && + complete -F _lintian lintian + +_lintian_info() +{ + local cur prev words cword + _init_completion || return + + case "$prev" in + --help | --profile) + return + ;; + -t | --tags) + _lintian_tags + return + ;; + --include-dir) + _filedir -d + return + ;; + esac + + case "$cur" in + --*) + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + ;; + *) + _filedir + ;; + esac + return 0 +} && + complete -F _lintian_info lintian-info + +# ex: filetype=sh diff --git a/completions/lisp b/completions/lisp new file mode 100644 index 0000000..098567b --- /dev/null +++ b/completions/lisp @@ -0,0 +1,22 @@ +# -*- shell-script -*- +# bash programmable completion for various Common Lisp implementations by +# Nikodemus Siivola + +_lisp() +{ + local cur prev words cword + _init_completion || return + + # completing an option (may or may not be separated by a space) + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '-core -lib -batch -quit -edit -eval -init + -dynamic-space-size -hinit -noinit -nositeinit -load -slave' \ + -- "$cur")) + else + _filedir + fi + +} && + complete -F _lisp -o default lisp + +# ex: filetype=sh diff --git a/completions/list_admins b/completions/list_admins new file mode 100644 index 0000000..5708179 --- /dev/null +++ b/completions/list_admins @@ -0,0 +1,17 @@ +# mailman list_admins completion -*- shell-script -*- + +_list_admins() +{ + local cur prev words cword + _init_completion || return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '--all-vhost --all --help' -- "$cur")) + else + _xfunc list_lists _mailman_lists + fi + +} && + complete -F _list_admins list_admins + +# ex: filetype=sh diff --git a/completions/list_lists b/completions/list_lists new file mode 100644 index 0000000..c5b9ba7 --- /dev/null +++ b/completions/list_lists @@ -0,0 +1,21 @@ +# mailman list_lists completion -*- shell-script -*- + +_mailman_lists() +{ + COMPREPLY=($(compgen -W '$(list_lists -b 2>/dev/null)' -- "$cur")) +} + +_list_lists() +{ + local cur prev words cword + _init_completion || return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '--advertised --virtual-host-overview --bare + --help' -- "$cur")) + fi + +} && + complete -F _list_lists list_lists + +# ex: filetype=sh diff --git a/completions/list_members b/completions/list_members new file mode 100644 index 0000000..639344c --- /dev/null +++ b/completions/list_members @@ -0,0 +1,36 @@ +# mailman list_members completion -*- shell-script -*- + +_list_members() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + -o | --output) + _filedir + return + ;; + -d | --digest) + COMPREPLY=($(compgen -W 'mime plain' -- "$cur")) + return + ;; + -n | --nomail) + COMPREPLY=($(compgen -W 'byadmin byuser bybounce unknown' \ + -- "$cur")) + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '--output --regular --digest --nomail + --fullnames --preserve --help' -- "$cur")) + else + _xfunc list_lists _mailman_lists + fi + +} && + complete -F _list_members list_members + +# ex: filetype=sh diff --git a/completions/list_owners b/completions/list_owners new file mode 100644 index 0000000..445be0b --- /dev/null +++ b/completions/list_owners @@ -0,0 +1,18 @@ +# mailman list_owners completion -*- shell-script -*- + +_list_owners() +{ + local cur prev words cword + _init_completion || return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '--with-listnames --moderators --help' \ + -- "$cur")) + else + _xfunc list_lists _mailman_lists + fi + +} && + complete -F _list_owners list_owners + +# ex: filetype=sh diff --git a/completions/locale-gen b/completions/locale-gen new file mode 100644 index 0000000..4068201 --- /dev/null +++ b/completions/locale-gen @@ -0,0 +1,32 @@ +# locale-gen(8) completion -*- shell-script -*- + +_locale_gen() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + --help | -h) + return + ;; + --aliases) + _filedir alias + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + [[ ${COMPREPLY-} == *= ]] && compopt -o nospace + return + fi + + COMPREPLY=($(compgen -W \ + '$(awk "{ print \$1 }" /usr/share/i18n/SUPPORTED 2>/dev/null)' \ + -- "$cur")) +} && + complete -F _locale_gen locale-gen + +# ex: filetype=sh diff --git a/completions/lpq b/completions/lpq new file mode 100644 index 0000000..36729d2 --- /dev/null +++ b/completions/lpq @@ -0,0 +1,28 @@ +# lpq(1) completion -*- shell-script -*- + +_lpq() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -P) + COMPREPLY=($(compgen -W "$(lpstat -a 2>/dev/null | cut -d' ' -f1)" -- "$cur")) + return + ;; + -U) + COMPREPLY=($(compgen -u -- "$cur")) + return + ;; + esac + + if [[ $cur == - ]]; then + COMPREPLY=($(compgen -W '-E -P -U -a -h -l' -- "$cur")) + return + fi + + _filedir +} && + complete -F _lpq lpq + +# ex: filetype=sh diff --git a/completions/lpr b/completions/lpr new file mode 100644 index 0000000..554f053 --- /dev/null +++ b/completions/lpr @@ -0,0 +1,33 @@ +# lpr(1) completion -*- shell-script -*- + +_lpr() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -P) + COMPREPLY=($(compgen -W "$(lpstat -a 2>/dev/null | cut -d' ' -f1)" -- "$cur")) + return + ;; + -U) + COMPREPLY=($(compgen -u -- "$cur")) + 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 + ;; + esac + + if [[ $cur == - ]]; then + COMPREPLY=($(compgen -W '-E -H -C -J -T -P -U -h -l -m -o -p -q -r' -- "$cur")) + return + fi + + _filedir +} && + complete -F _lpr lpr + +# ex: filetype=sh diff --git a/completions/lrzip b/completions/lrzip new file mode 100644 index 0000000..eb2904c --- /dev/null +++ b/completions/lrzip @@ -0,0 +1,52 @@ +# lrzip(1) completion -*- shell-script -*- + +_lrzip() +{ + local cur prev words cword + _init_completion || return + + local xspec="*.lrz" + + case $prev in + -*@([wSm]|[Vh?]*)) + return + ;; + -*d) + xspec="!"$xspec + ;; + -*o) + _filedir + return + ;; + -*O) + _filedir -d + return + ;; + -*L) + COMPREPLY=($(compgen -W '{1..9}' -- "$cur")) + return + ;; + -*N) + COMPREPLY=($(compgen -W '{-20..19}' -- "$cur")) + return + ;; + -*p) + COMPREPLY=($(compgen -W "{1..$(_ncpus)}" -- "$cur")) + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + return + fi + + _tilde "$cur" || return + + local IFS=$'\n' + compopt -o filenames + COMPREPLY=($(compgen -f -X "$xspec" -- "$cur") $(compgen -d -- "$cur")) +} && + complete -F _lrzip lrzip + +# ex: filetype=sh diff --git a/completions/lsof b/completions/lsof new file mode 100644 index 0000000..eb1e967 --- /dev/null +++ b/completions/lsof @@ -0,0 +1,56 @@ +# lsof(8) completion -*- shell-script -*- + +_lsof() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -'?' | -h | +c | -c | -d | -F | -i | +r | -r | -s | -S | -T) + return + ;; + -A | -k | -m | +m | -o) + _filedir + return + ;; + +d | +D) + _filedir -d + return + ;; + -D) + COMPREPLY=($(compgen -W '? b i r u' -- "$cur")) + return + ;; + -f) + COMPREPLY=($(compgen -W 'c f g G n' -- "$cur")) + return + ;; + -g) + # TODO: handle ^foo exclusions, comma separated lists + _pgids + return + ;; + -p) + # TODO: handle ^foo exclusions, comma separated lists + _pids + return + ;; + -u) + # TODO: handle ^foo exclusions, comma separated lists + COMPREPLY=($(compgen -u -- "$cur")) + return + ;; + esac + + if [[ $cur == [-+]* ]]; then + COMPREPLY=($(compgen -W '-h -a -A -b -c +c -C +d -d +D -D +f -f -F -g + -i -k -l +L -L +m -m +M -M -n -N -o -O -p -P +r -r -R -s -S -T -t + -u -U -v -V +w -w -x -X -z -Z' -- "$cur")) + return + fi + + _filedir +} && + complete -F _lsof lsof + +# ex: filetype=sh diff --git a/completions/lspci b/completions/lspci new file mode 100644 index 0000000..d50783c --- /dev/null +++ b/completions/lspci @@ -0,0 +1,41 @@ +# lspci(8) completion -*- shell-script -*- + +_lspci() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -*[sDO]) + return + ;; + -*i) + _filedir ids + return + ;; + -*p) + _filedir pcimap + return + ;; + -*A) + COMPREPLY+=($(compgen -W '$($1 -A help | command grep -vF :)' \ + -- "$cur")) + return + ;; + -*H) + COMPREPLY+=($(compgen -W "1 2" -- "$cur")) + return + ;; + -*F) + _filedir + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + fi +} && + complete -F _lspci lspci + +# ex: filetype=sh diff --git a/completions/lsscsi b/completions/lsscsi new file mode 100644 index 0000000..bcbc430 --- /dev/null +++ b/completions/lsscsi @@ -0,0 +1,27 @@ +# lsscsi(8) completion -*- shell-script -*- + +_lsscsi() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + --help | --version | -!(-*)[hV]*) + return + ;; + --sysfsroot | -!(-*)y) + _filedir -d + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + [[ ${COMPREPLY-} == *= ]] && compopt -o nospace + fi +} && + complete -F _lsscsi lsscsi + +# ex: filetype=sh diff --git a/completions/lsusb b/completions/lsusb new file mode 100644 index 0000000..63cff54 --- /dev/null +++ b/completions/lsusb @@ -0,0 +1,20 @@ +# lsusb(8) completion -*- shell-script -*- + +_lsusb() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --help | --version | -!(-*)@([sD]|[hV]*)) + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + fi +} && + complete -F _lsusb lsusb + +# ex: filetype=sh diff --git a/completions/lua b/completions/lua new file mode 100644 index 0000000..3c4df90 --- /dev/null +++ b/completions/lua @@ -0,0 +1,23 @@ +# lua(1) completion -*- shell-script -*- + +_lua() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -e | -l | -v | -) + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W "$(_parse_help "$1")" -- "$cur")) + return + fi + + _filedir 'l@(ua|?(ua)c)' +} && + complete -F _lua lua + +# ex: filetype=sh diff --git a/completions/luac b/completions/luac new file mode 100644 index 0000000..c763deb --- /dev/null +++ b/completions/luac @@ -0,0 +1,27 @@ +# luac(1) completion -*- shell-script -*- + +_luac() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -v | -) + return + ;; + -o) + _filedir + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W "$(_parse_help "$1")" -- "$cur")) + return + fi + + _filedir lua +} && + complete -F _luac luac + +# ex: filetype=sh diff --git a/completions/luseradd b/completions/luseradd new file mode 100644 index 0000000..4d66385 --- /dev/null +++ b/completions/luseradd @@ -0,0 +1,40 @@ +# luseradd(1) and lusermod(1) completion -*- shell-script -*- + +_luseradd() +{ + local cur prev words cword split + _init_completion -s || return + + case $prev in + --help | --usage | --gecos | --uid | --login | --plainpassword | --password | \ + --commonname | --givenname | --surname | --roomnumber | --telephonenumber | \ + --homephone | -!(-*)@([culPp]|[?]*)) + return + ;; + --directory | --skeleton | -!(-*)[dk]) + _filedir -d + return + ;; + --shell | -!(-*)s) + _shells + return + ;; + --gid | -!(-*)g) + _gids + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + [[ ${COMPREPLY-} == *= ]] && compopt -o nospace + return + fi + + [[ ${1##*/} == luseradd ]] || COMPREPLY=($(compgen -u -- "$cur")) +} && + complete -F _luseradd luseradd lusermod + +# ex: filetype=sh diff --git a/completions/luserdel b/completions/luserdel new file mode 100644 index 0000000..e36bda9 --- /dev/null +++ b/completions/luserdel @@ -0,0 +1,23 @@ +# luserdel(1) completion -*- shell-script -*- + +_luserdel() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --help | --usage | -!(-*)[?]*) + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + return + fi + + COMPREPLY=($(compgen -u -- "$cur")) +} && + complete -F _luserdel luserdel + +# ex: filetype=sh diff --git a/completions/lvm b/completions/lvm new file mode 100644 index 0000000..e70ecc3 --- /dev/null +++ b/completions/lvm @@ -0,0 +1,861 @@ +# bash completion for lvm -*- shell-script -*- + +_lvm_filedir() +{ + cur=${cur:-/dev/} + _filedir +} + +_lvm_volumegroups() +{ + COMPREPLY=($(compgen -W "$(vgscan 2>/dev/null | + 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 | + command sed -n -e 's|^.*PV \(.*\) VG.*$|\1|p')" -- "$cur")) +} + +_lvm_logicalvolumes() +{ + COMPREPLY=($(compgen -W "$(lvscan 2>/dev/null | + 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]' + done + fi +} + +_lvm_units() +{ + COMPREPLY=($(compgen -W 'h s b k m g t H K M G T' -- "$cur")) +} + +_lvm_sizes() +{ + COMPREPLY=($(compgen -W 'k K m M g G t T' -- "$cur")) +} + +# @param $1 glob matching args known to take an argument +_lvm_count_args() +{ + args=0 + local offset=1 + if [[ ${words[0]} == lvm ]]; then + offset=2 + fi + local i prev=${words[offset - 1]} + for ((i = offset; i < cword; i++)); do + # shellcheck disable=SC2053 + if [[ ${words[i]} != -* && $prev != $1 ]]; then + ((args++)) + fi + prev=${words[i]} + done +} + +_lvmdiskscan() +{ + local cur prev words cword + _init_completion || return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) + fi +} && + complete -F _lvmdiskscan lvmdiskscan + +_pvscan() +{ + local cur prev words cword + _init_completion || return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) + fi +} && + complete -F _pvscan pvscan + +_pvs() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --options | --sort | -!(-*)[oO]) + 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 + ;; + --units) + _lvm_units + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) + else + _lvm_physicalvolumes_all + fi +} && + complete -F _pvs pvs + +_pvdisplay() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --units) + _lvm_units + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) + else + _lvm_physicalvolumes_all + fi +} && + complete -F _pvdisplay pvdisplay + +_pvchange() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --autobackup | --allocatable | -!(-*)[Ax]) + COMPREPLY=($(compgen -W 'y n' -- "$cur")) + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) + else + _lvm_physicalvolumes_all + fi +} && + complete -F _pvchange pvchange + +_pvcreate() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --restorefile) + _filedir + return + ;; + --metadatatype | -!(-*)M) + COMPREPLY=($(compgen -W '1 2' -- "$cur")) + return + ;; + --metadatacopies) + COMPREPLY=($(compgen -W '0 1 2' -- "$cur")) + return + ;; + --metadatasize | --setphysicalvolumesize) + _lvm_sizes + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) + else + _lvm_filedir + fi +} && + complete -F _pvcreate pvcreate + +_pvmove() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --autobackup | -!(-*)A) + COMPREPLY=($(compgen -W 'y n' -- "$cur")) + return + ;; + --name | -!(-*)n) + _lvm_logicalvolumes + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) + else + _lvm_physicalvolumes + fi +} && + complete -F _pvmove pvmove + +_pvremove() +{ + local cur prev words cword + _init_completion || return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) + else + _lvm_physicalvolumes_all + fi +} && + complete -F _pvremove pvremove + +_vgscan() +{ + local cur prev words cword + _init_completion || return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) + fi +} && + complete -F _vgscan vgscan + +_vgs() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --options | --sort | -!(-*)[oO]) + COMPREPLY=($(compgen -W 'vg_fmt vg_uuid vg_name vg_attr vg_size + vg_free vg_sysid vg_extent_size vg_extent_count vg_free_count + max_lv max_pv pv_count lv_count snap_count vg_seqno' \ + -- "$cur")) + return + ;; + --units) + _lvm_units + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) + else + _lvm_volumegroups + fi +} && + complete -F _vgs vgs + +_vgdisplay() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --units) + _lvm_units + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) + else + _lvm_volumegroups + fi +} && + complete -F _vgdisplay vgdisplay + +_vgchange() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --available | --autobackup | --resizeable | -!(-*)[aAx]) + COMPREPLY=($(compgen -W 'y n' -- "$cur")) + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) + else + _lvm_volumegroups + fi +} && + complete -F _vgchange vgchange + +_vgcreate() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --autobackup | -!(-*)A) + COMPREPLY=($(compgen -W 'y n' -- "$cur")) + return + ;; + --metadatatype | -!(-*)M) + COMPREPLY=($(compgen -W '1 2' -- "$cur")) + return + ;; + --physicalextentsize | -!(-*)s) + _lvm_sizes + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) + else + local args + _lvm_count_args '@(-A|--autobackup|-M|--metadatatype|-s|--physicalextentsize)' + if ((args == 0)); then + _lvm_volumegroups + else + _lvm_physicalvolumes_all + fi + fi +} && + complete -F _vgcreate vgcreate + +_vgremove() +{ + local cur prev words cword + _init_completion || return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) + else + _lvm_volumegroups + fi +} && + complete -F _vgremove vgremove + +_vgrename() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --autobackup | -!(-*)A) + COMPREPLY=($(compgen -W 'y n' -- "$cur")) + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) + else + _lvm_volumegroups + fi +} && + complete -F _vgrename vgrename + +_vgreduce() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --autobackup | -!(-*)A) + COMPREPLY=($(compgen -W 'y n' -- "$cur")) + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) + + else + local args + _lvm_count_args '@(-A|--autobackup)' + if ((args == 0)); then + _lvm_volumegroups + else + _lvm_physicalvolumes + fi + fi +} && + complete -F _vgreduce vgreduce + +_vgextend() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --autobackup | -!(-*)A) + COMPREPLY=($(compgen -W 'y n' -- "$cur")) + return + ;; + --size | -!(-*)L) + _lvm_sizes + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) + else + local args + _lvm_count_args '@(-A|--autobackup|-L|--size)' + if ((args == 0)); then + _lvm_volumegroups + else + _lvm_physicalvolumes_all + fi + fi +} && + complete -F _vgextend vgextend + +_vgport() +{ + local cur prev words cword + _init_completion || return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) + else + _lvm_volumegroups + fi +} && + complete -F _vgport vgimport vgexport + +_vgck() +{ + local cur prev words cword + _init_completion || return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) + else + _lvm_volumegroups + fi +} && + complete -F _vgck vgck + +_vgconvert() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --metadatatype | -!(-*)M) + COMPREPLY=($(compgen -W '1 2' -- "$cur")) + return + ;; + --metadatacopies) + COMPREPLY=($(compgen -W '0 1 2' -- "$cur")) + return + ;; + --metadatasize) + _lvm_sizes + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) + else + _lvm_volumegroups + fi +} && + complete -F _vgconvert vgconvert + +_vgcfgbackup() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --file | -!(-*)f) + _filedir + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) + else + _lvm_volumegroups + fi +} && + complete -F _vgcfgbackup vgcfgbackup + +_vgcfgrestore() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --file | -!(-*)f) + _filedir + return + ;; + --metadatatype | -!(-*)M) + COMPREPLY=($(compgen -W '1 2' -- "$cur")) + return + ;; + --name | -!(-*)n) + _lvm_volumegroups + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) + else + _lvm_volumegroups + fi +} && + complete -F _vgcfgrestore vgcfgrestore + +_vgmerge() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --autobackup | -!(-*)A) + COMPREPLY=($(compgen -W 'y n' -- "$cur")) + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) + else + _lvm_volumegroups + fi +} && + complete -F _vgmerge vgmerge + +_vgsplit() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --autobackup | -!(-*)A) + COMPREPLY=($(compgen -W 'y n' -- "$cur")) + return + ;; + --metadatatype | -!(-*)M) + COMPREPLY=($(compgen -W '1 2' -- "$cur")) + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) + else + local args + _lvm_count_args '@(-A|--autobackup|-M|--metadatatype)' + if ((args == 0 || args == 1)); then + _lvm_volumegroups + else + _lvm_physicalvolumes + fi + fi +} && + complete -F _vgsplit vgsplit + +_vgmknodes() +{ + local cur prev words cword + _init_completion || return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) + else + _lvm_volumegroups + fi +} && + complete -F _vgmknodes vgmknodes + +_lvscan() +{ + local cur prev words cword + _init_completion || return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) + fi +} && + complete -F _lvscan lvscan + +_lvs() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --options | --sort | -!(-*)[oO]) + 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 + ;; + --units) + _lvm_units + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) + else + _lvm_logicalvolumes + fi +} && + complete -F _lvs lvs + +_lvdisplay() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --units) + _lvm_units + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) + else + _lvm_logicalvolumes + fi +} && + complete -F _lvdisplay lvdisplay + +_lvchange() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --available | --autobackup | --contiguous | --persistent | -!(-*)[aACM]) + COMPREPLY=($(compgen -W 'y n' -- "$cur")) + return + ;; + --permission | -!(-*)p) + COMPREPLY=($(compgen -W 'r rw' -- "$cur")) + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) + else + _lvm_logicalvolumes + fi +} && + complete -F _lvchange lvchange + +_lvcreate() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --autobackup | --contiguous | --persistent | --zero | -!(-*)[ACMZ]) + COMPREPLY=($(compgen -W 'y n' -- "$cur")) + return + ;; + --size | -!(-*)L) + _lvm_sizes + return + ;; + --permission | -!(-*)p) + COMPREPLY=($(compgen -W 'r rw' -- "$cur")) + return + ;; + --name | -!(-*)n) + _lvm_logicalvolumes + return + ;; + esac + + if [[ $cur == -* ]]; then + 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)' + if ((args == 0)); then + _lvm_volumegroups + else + _lvm_physicalvolumes + fi + fi +} && + complete -F _lvcreate lvcreate + +_lvremove() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --autobackup | -!(-*)A) + COMPREPLY=($(compgen -W 'y n' -- "$cur")) + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) + else + _lvm_logicalvolumes + fi +} && + complete -F _lvremove lvremove + +_lvrename() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --autobackup | -!(-*)A) + COMPREPLY=($(compgen -W 'y n' -- "$cur")) + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) + else + _lvm_logicalvolumes + fi +} && + complete -F _lvrename lvrename + +_lvreduce() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --autobackup | -!(-*)A) + COMPREPLY=($(compgen -W 'y n' -- "$cur")) + return + ;; + --size | -!(-*)L) + _lvm_sizes + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) + else + _lvm_logicalvolumes + fi +} && + complete -F _lvreduce lvreduce + +_lvresize() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --autobackup | -!(-*)A) + COMPREPLY=($(compgen -W 'y n' -- "$cur")) + return + ;; + --size | -!(-*)L) + _lvm_sizes + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) + else + local args + _lvm_count_args '@(-A|--autobackup|-L|--size)' + if ((args == 0)); then + _lvm_logicalvolumes + else + _lvm_physicalvolumes + fi + fi +} && + complete -F _lvresize lvresize + +_lvextend() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --autobackup | -!(-*)A) + COMPREPLY=($(compgen -W 'y n' -- "$cur")) + return + ;; + --size | -!(-*)L) + _lvm_sizes + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) + else + local args + _lvm_count_args '@(-A|--autobackup|-L|--size)' + if ((args == 0)); then + _lvm_logicalvolumes + else + _lvm_physicalvolumes + fi + fi +} && + complete -F _lvextend lvextend + +_lvm() +{ + local cur prev words cword + _init_completion || return + + if ((cword == 1)); then + COMPREPLY=($(compgen -W 'dumpconfig help lvchange lvcreate lvdisplay + lvextend lvmchange lvmdiskscan lvmsadc lvmsar lvreduce lvremove + lvrename lvresize lvs lvscan pvchange pvcreate pvdata pvdisplay + pvmove pvremove pvresize pvs pvscan vgcfgbackup vgcfgrestore + vgchange vgck vgconvert vgcreate vgdisplay vgexport vgextend + vgimport vgmerge vgmknodes vgreduce vgremove vgrename vgs vgscan + vgsplit version' -- "$cur")) + else + 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: filetype=sh diff --git a/completions/lz4 b/completions/lz4 new file mode 100644 index 0000000..f297b5d --- /dev/null +++ b/completions/lz4 @@ -0,0 +1,52 @@ +# 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 -X '-*#*' -W \ + '$(_parse_help "$1" -h) -B{4..7} -i{1..9}' -- "$cur")) + return + fi + + local args word xspec="*.?(t)lz4" + _count_args + ((args > 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 + + _tilde "$cur" || 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 new file mode 100644 index 0000000..05f169c --- /dev/null +++ b/completions/lzip @@ -0,0 +1,47 @@ +# lzip(1) completion -*- shell-script -*- + +_lzip() +{ + local cur prev words cword split + _init_completion -s || return + + local decompress=false + + case $prev in + --help | --version | --member-size | --match-length | --dictionary-size | \ + --volume-size | --data-size | -!(-*)@([bmsSB]|[hV]*)) + return + ;; + --decompress-!(-*)d) + decompress=true + ;; + --threads-!(-*)n) + COMPREPLY=($(compgen -W "{1..$(_ncpus)}" -- "$cur")) + return + ;; + --output-!(-*)o) + _filedir + return + ;; + esac + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1") {-1..-9}' -- "$cur")) + [[ ${COMPREPLY-} == *= ]] && compopt -o nospace + return + fi + + if $decompress; then + _filedir lz + return + fi + + local IFS=$'\n' + compopt -o filenames + COMPREPLY=($(compgen -f -X "*.lz" -- "$cur") $(compgen -d -- "$cur")) +} && + complete -F _lzip clzip lzip pdlzip plzip + +# ex: filetype=sh diff --git a/completions/lzma b/completions/lzma new file mode 100644 index 0000000..34fba89 --- /dev/null +++ b/completions/lzma @@ -0,0 +1,34 @@ +# lzma(1) completion -*- shell-script -*- +# by Per Øyvind Karlsen + +_lzma() +{ + local cur prev words cword split + _init_completion -s || return + + $split && return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1") -{1..9}' -- "$cur")) + [[ ${COMPREPLY-} == *= ]] && compopt -o nospace + return + fi + + local IFS=$'\n' xspec="*.@(lzma|tlz)" + + if [[ $prev == --* ]]; then + [[ $prev == --@(decompress|list|test) ]] && xspec="!"$xspec + [[ $prev == --compress ]] && xspec= + elif [[ $prev == -* ]]; then + [[ $prev == -*[dt]* ]] && xspec="!"$xspec + [[ $prev == -*z* ]] && xspec= + fi + + _tilde "$cur" || return + + compopt -o filenames + COMPREPLY=($(compgen -f -X "$xspec" -- "$cur") $(compgen -d -- "$cur")) +} && + complete -F _lzma lzma + +# ex: filetype=sh diff --git a/completions/lzop b/completions/lzop new file mode 100644 index 0000000..2642742 --- /dev/null +++ b/completions/lzop @@ -0,0 +1,59 @@ +# lzop(1) completion -*- shell-script -*- + +_lzop() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --output | -!(-*)o) + _filedir + return + ;; + --path) + _filedir -d + return + ;; + --suffix | -!(-*)S) + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '-1 -2 -3 -4 -5 -6 -7 -8 -9 -P + --fast --best --decompress --extract --test --list --ls --info + --sysinfo --license --help --version --stdout --output --path + --force --no-checksum --no-name --name --no-mode --no-time --suffix + --keep --delete --crc32 --no-warn --ignore-warn --quiet --verbose + --no-stdin --filter --checksum --no-color --mono --color' \ + -- "$cur")) + return + fi + + local xspec="*.?(t)lzo" + case $prev in + --decompress | --uncompress | --extract | --list | --ls | --info | --test) + xspec="!"$xspec + ;; + --force) + xspec= + ;; + --*) ;; + + -*f*) + xspec= + ;; + -*[dltx]*) + xspec="!"$xspec + ;; + esac + + _tilde "$cur" || return + + local IFS=$'\n' + compopt -o filenames + COMPREPLY=($(compgen -f -X "$xspec" -- "$cur") $(compgen -d -- "$cur")) +} && + complete -F _lzop lzop + +# ex: filetype=sh diff --git a/completions/macof b/completions/macof new file mode 100644 index 0000000..ad29f58 --- /dev/null +++ b/completions/macof @@ -0,0 +1,22 @@ +# macof completion -*- shell-script -*- + +_macof() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -i) + _available_interfaces -a + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1")' -- "$cur")) + fi + +} && + complete -F _macof macof + +# ex: filetype=sh diff --git a/completions/mailmanctl b/completions/mailmanctl new file mode 100644 index 0000000..3bbc2f2 --- /dev/null +++ b/completions/mailmanctl @@ -0,0 +1,18 @@ +# mailmanctl completion -*- shell-script -*- + +_mailmanctl() +{ + local cur prev words cword + _init_completion || return + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '--no-restart --run-as-user + --stale-lock-cleanup --quiet --help' -- "$cur")) + else + COMPREPLY=($(compgen -W 'start stop restart reopen' -- "$cur")) + fi + +} && + complete -F _mailmanctl mailmanctl + +# ex: filetype=sh diff --git a/completions/make b/completions/make new file mode 100644 index 0000000..96517c2 --- /dev/null +++ b/completions/make @@ -0,0 +1,170 @@ +# bash completion for GNU make -*- shell-script -*- + +_make_target_extract_script() +{ + local mode="$1" + shift + + local prefix="$1" + local prefix_pat=$(command sed 's/[][\,.*^$(){}?+|/]/\\&/g' <<<"$prefix") + local basename=${prefix##*/} + local dirname_len=$((${#prefix} - ${#basename})) + + if [[ $mode == -d ]]; then + # display mode, only output current path component to the next slash + local output="\2" + else + # completion mode, output full path to the next slash + local output="\1\2" + fi + + cat <