summaryrefslogtreecommitdiff
path: root/completions
diff options
context:
space:
mode:
authorDavid Paleino <dapal@debian.org>2012-01-08 00:19:18 +0100
committerDavid Paleino <dapal@debian.org>2012-01-08 00:19:18 +0100
commitc3d398fcc6e400be546c28eb1fc25abfa5816eac (patch)
tree3266a00f1037eb5522f1f8bf1a73e443ab2c26c4 /completions
parent2c8171c38d87ddef31c92a76547d3fdf773a1337 (diff)
downloadbash-completion-c3d398fcc6e400be546c28eb1fc25abfa5816eac.tar.gz
Imported Upstream version 1.99upstream/1.99
Diffstat (limited to 'completions')
-rw-r--r--completions/Makefile.am47
-rw-r--r--completions/Makefile.in47
-rw-r--r--completions/_mock2
-rw-r--r--completions/_modules6
-rw-r--r--completions/_yum2
-rw-r--r--completions/ant2
-rw-r--r--completions/apt-build2
-rw-r--r--completions/apt-cache4
-rw-r--r--completions/apt-get4
-rw-r--r--completions/avctrl20
-rw-r--r--completions/cardctl2
-rw-r--r--completions/ccache26
-rw-r--r--completions/cfrun2
-rw-r--r--completions/chkconfig8
-rw-r--r--completions/cksfv2
-rw-r--r--completions/configure2
-rw-r--r--completions/cowsay3
-rw-r--r--completions/cpio2
-rw-r--r--completions/cppcheck18
-rw-r--r--completions/cryptsetup2
-rw-r--r--completions/curl16
-rw-r--r--completions/cvs25
-rw-r--r--completions/desktop-file-validate23
-rw-r--r--completions/dict19
-rw-r--r--completions/dmesg13
-rw-r--r--completions/dnsspoof26
-rw-r--r--completions/dpkg22
-rw-r--r--completions/e2label2
-rw-r--r--completions/export60
-rw-r--r--completions/fbgs4
-rw-r--r--completions/fbi17
-rw-r--r--completions/feh14
-rw-r--r--completions/function6
-rw-r--r--completions/gcc16
-rw-r--r--completions/gdb4
-rw-r--r--completions/gpg2
-rw-r--r--completions/gpg22
-rw-r--r--completions/hcitool34
-rw-r--r--completions/htop32
-rw-r--r--completions/id18
-rw-r--r--completions/ifup2
-rw-r--r--completions/info10
-rw-r--r--completions/invoke-rc.d6
-rw-r--r--completions/iperf63
-rw-r--r--completions/ipmitool14
-rw-r--r--completions/ipsec4
-rw-r--r--completions/iptables4
-rw-r--r--completions/isql2
-rw-r--r--completions/iwconfig6
-rw-r--r--completions/iwlist2
-rw-r--r--completions/iwpriv2
-rw-r--r--completions/iwspy2
-rw-r--r--completions/java10
-rw-r--r--completions/kcov14
-rw-r--r--completions/killall19
-rw-r--r--completions/kldload2
-rw-r--r--completions/koji234
-rw-r--r--completions/links2
-rw-r--r--completions/lintian7
-rw-r--r--completions/lrzip9
-rw-r--r--completions/lvm14
-rw-r--r--completions/lzip44
-rw-r--r--completions/make8
-rw-r--r--completions/man4
-rw-r--r--completions/minicom7
-rw-r--r--completions/mount115
-rw-r--r--completions/mount.linux224
-rw-r--r--completions/mplayer4
-rw-r--r--completions/mtx2
-rw-r--r--completions/mutt25
-rw-r--r--completions/mysql2
-rw-r--r--completions/nethogs25
-rw-r--r--completions/openssl8
-rw-r--r--completions/p46
-rw-r--r--completions/perl12
-rw-r--r--completions/pgrep22
-rw-r--r--completions/pidof19
-rw-r--r--completions/plague-client14
-rw-r--r--completions/povray2
-rw-r--r--completions/psql2
-rw-r--r--completions/puppet2
-rw-r--r--completions/qdbus2
-rw-r--r--completions/rcs2
-rw-r--r--completions/removepkg12
-rw-r--r--completions/ri12
-rw-r--r--completions/route4
-rw-r--r--completions/rpcdebug2
-rw-r--r--completions/rpm8
-rw-r--r--completions/rpm2tgz6
-rw-r--r--completions/rrdtool2
-rw-r--r--completions/rsync2
-rw-r--r--completions/sbopkg26
-rw-r--r--completions/service34
-rw-r--r--completions/sitecopy2
-rw-r--r--completions/slackpkg48
-rw-r--r--completions/slapt-get20
-rw-r--r--completions/slapt-src20
-rw-r--r--completions/smbclient4
-rw-r--r--completions/sqlite34
-rw-r--r--completions/ssh32
-rw-r--r--completions/strace2
-rw-r--r--completions/tar2
-rw-r--r--completions/udevadm76
-rw-r--r--completions/umount21
-rw-r--r--completions/umount.linux140
-rw-r--r--completions/unace4
-rw-r--r--completions/unrar4
-rw-r--r--completions/update-alternatives2
-rw-r--r--completions/update-rc.d4
-rw-r--r--completions/upgradepkg18
-rw-r--r--completions/valgrind104
-rw-r--r--completions/wine20
-rw-r--r--completions/wodim6
-rw-r--r--completions/wtf10
-rw-r--r--completions/xgamma17
-rw-r--r--completions/xhost2
-rw-r--r--completions/xrandr48
117 files changed, 1699 insertions, 556 deletions
diff --git a/completions/Makefile.am b/completions/Makefile.am
index 21201925..ba3cfb03 100644
--- a/completions/Makefile.am
+++ b/completions/Makefile.am
@@ -20,6 +20,7 @@ bashcomp_DATA = a2x \
autoreconf \
autorpm \
autoscan \
+ avctrl \
badblocks \
bk \
brctl \
@@ -28,6 +29,7 @@ bashcomp_DATA = a2x \
cal \
cancel \
cardctl \
+ ccache \
cfagent \
cfrun \
chage \
@@ -53,14 +55,16 @@ bashcomp_DATA = a2x \
cpio \
cppcheck \
crontab \
- curl \
cryptsetup \
+ curl \
cvs \
cvsps \
dd \
+ desktop-file-validate \
dhclient \
dict \
dmesg \
+ dnsspoof \
dot \
dpkg \
dpkg-source \
@@ -112,8 +116,10 @@ bashcomp_DATA = a2x \
hddtemp \
hid2hci \
hping2 \
+ htop \
htpasswd \
iconv \
+ id \
idn \
iftop \
ifup \
@@ -124,9 +130,10 @@ bashcomp_DATA = a2x \
invoke-rc.d \
ionice \
ip \
- iptables \
+ iperf \
ipmitool \
ipsec \
+ iptables \
ipv6calc \
iscsiadm \
isql \
@@ -145,6 +152,7 @@ bashcomp_DATA = a2x \
killall \
kldload \
kldunload \
+ koji \
ktutil \
larch \
lastlog \
@@ -166,6 +174,7 @@ bashcomp_DATA = a2x \
lrzip \
lsof \
lvm \
+ lzip \
lzma \
lzop \
macof \
@@ -186,6 +195,7 @@ bashcomp_DATA = a2x \
mmsitepass \
monodevelop \
mount \
+ mount.linux \
mplayer \
msynctool \
mtx \
@@ -197,6 +207,7 @@ bashcomp_DATA = a2x \
mysql \
mysqladmin \
ncftp \
+ nethogs \
newgrp \
newlist \
newusers \
@@ -209,11 +220,13 @@ bashcomp_DATA = a2x \
passwd \
perl \
pgrep \
+ pidof \
pine \
ping \
pkg-config \
pkg_delete \
pkgtool \
+ plague-client \
pm-hibernate \
pm-is-supported \
pm-powersave \
@@ -243,8 +256,8 @@ bashcomp_DATA = a2x \
remove_members \
removepkg \
renice \
- reptyr \
reportbug \
+ reptyr \
resolvconf \
rfkill \
ri \
@@ -261,7 +274,6 @@ bashcomp_DATA = a2x \
sbcl \
sbopkg \
screen \
- service \
sh \
sitecopy \
slackpkg \
@@ -287,6 +299,9 @@ bashcomp_DATA = a2x \
tcpnice \
tracepath \
tune2fs \
+ udevadm \
+ umount \
+ umount.linux \
unace \
unpack200 \
unrar \
@@ -298,11 +313,13 @@ bashcomp_DATA = a2x \
useradd \
userdel \
usermod \
+ valgrind \
vipw \
vncviewer \
vpnc \
watch \
webmitm \
+ wine \
withlist \
wodim \
wol \
@@ -333,6 +350,7 @@ CLEANFILES = \
alternatives \
animate \
apropos \
+ arm-koji \
asciidoc.py \
autoheader \
automake-1.11 \
@@ -424,7 +442,6 @@ CLEANFILES = \
pccardctl \
perldoc \
phing \
- pidof \
pigz \
pinfo \
ping6 \
@@ -435,6 +452,7 @@ CLEANFILES = \
pm-suspend-hybrid \
pmake \
postalias \
+ ppc-koji \
puppetca \
puppetd \
puppetdoc \
@@ -464,6 +482,7 @@ CLEANFILES = \
rpm2txz \
rpmbuild \
rpmbuild-md5 \
+ s390-koji \
sbcl-mt \
scp \
sdptool \
@@ -476,12 +495,12 @@ CLEANFILES = \
smbpasswd \
smbtar \
smbtree \
+ sparc-koji \
spovray \
stream \
tightvncviewer \
tracepath6 \
typeset \
- umount \
vgcfgbackup \
vgcfgrestore \
vgchange \
@@ -624,9 +643,9 @@ symlinks:
rm -f $(targetdir)/$$file && \
$(LN_S) java $(targetdir)/$$file ; \
done
- for file in pkill ; do \
+ for file in arm-koji ppc-koji s390-koji sparc-koji ; do \
rm -f $(targetdir)/$$file && \
- $(LN_S) killall $(targetdir)/$$file ; \
+ $(LN_S) koji $(targetdir)/$$file ; \
done
for file in ldapadd ldapmodify ldapdelete ldapcompare ldapmodrdn \
ldapwhoami ldappasswd ; do \
@@ -658,10 +677,6 @@ symlinks:
rm -f $(targetdir)/$$file && \
$(LN_S) mcrypt $(targetdir)/$$file ; \
done
- for file in umount ; do \
- rm -f $(targetdir)/$$file && \
- $(LN_S) mount $(targetdir)/$$file ; \
- done
for file in mplayer2 mencoder gmplayer kplayer ; do \
rm -f $(targetdir)/$$file && \
$(LN_S) mplayer $(targetdir)/$$file ; \
@@ -682,10 +697,6 @@ symlinks:
rm -f $(targetdir)/$$file && \
$(LN_S) perl $(targetdir)/$$file ; \
done
- for file in pidof ; do \
- rm -f $(targetdir)/$$file && \
- $(LN_S) pgrep $(targetdir)/$$file ; \
- done
for file in alpine ; do \
rm -f $(targetdir)/$$file && \
$(LN_S) pine $(targetdir)/$$file ; \
@@ -698,6 +709,10 @@ symlinks:
rm -f $(targetdir)/$$file && \
$(LN_S) pkg_delete $(targetdir)/$$file ; \
done
+ for file in pkill ; do \
+ rm -f $(targetdir)/$$file && \
+ $(LN_S) pgrep $(targetdir)/$$file ; \
+ done
for file in pm-suspend pm-suspend-hybrid ; do \
rm -f $(targetdir)/$$file && \
$(LN_S) pm-hibernate $(targetdir)/$$file ; \
diff --git a/completions/Makefile.in b/completions/Makefile.in
index 16d05310..b7e1bd1f 100644
--- a/completions/Makefile.in
+++ b/completions/Makefile.in
@@ -163,6 +163,7 @@ bashcomp_DATA = a2x \
autoreconf \
autorpm \
autoscan \
+ avctrl \
badblocks \
bk \
brctl \
@@ -171,6 +172,7 @@ bashcomp_DATA = a2x \
cal \
cancel \
cardctl \
+ ccache \
cfagent \
cfrun \
chage \
@@ -196,14 +198,16 @@ bashcomp_DATA = a2x \
cpio \
cppcheck \
crontab \
- curl \
cryptsetup \
+ curl \
cvs \
cvsps \
dd \
+ desktop-file-validate \
dhclient \
dict \
dmesg \
+ dnsspoof \
dot \
dpkg \
dpkg-source \
@@ -255,8 +259,10 @@ bashcomp_DATA = a2x \
hddtemp \
hid2hci \
hping2 \
+ htop \
htpasswd \
iconv \
+ id \
idn \
iftop \
ifup \
@@ -267,9 +273,10 @@ bashcomp_DATA = a2x \
invoke-rc.d \
ionice \
ip \
- iptables \
+ iperf \
ipmitool \
ipsec \
+ iptables \
ipv6calc \
iscsiadm \
isql \
@@ -288,6 +295,7 @@ bashcomp_DATA = a2x \
killall \
kldload \
kldunload \
+ koji \
ktutil \
larch \
lastlog \
@@ -309,6 +317,7 @@ bashcomp_DATA = a2x \
lrzip \
lsof \
lvm \
+ lzip \
lzma \
lzop \
macof \
@@ -329,6 +338,7 @@ bashcomp_DATA = a2x \
mmsitepass \
monodevelop \
mount \
+ mount.linux \
mplayer \
msynctool \
mtx \
@@ -340,6 +350,7 @@ bashcomp_DATA = a2x \
mysql \
mysqladmin \
ncftp \
+ nethogs \
newgrp \
newlist \
newusers \
@@ -352,11 +363,13 @@ bashcomp_DATA = a2x \
passwd \
perl \
pgrep \
+ pidof \
pine \
ping \
pkg-config \
pkg_delete \
pkgtool \
+ plague-client \
pm-hibernate \
pm-is-supported \
pm-powersave \
@@ -386,8 +399,8 @@ bashcomp_DATA = a2x \
remove_members \
removepkg \
renice \
- reptyr \
reportbug \
+ reptyr \
resolvconf \
rfkill \
ri \
@@ -404,7 +417,6 @@ bashcomp_DATA = a2x \
sbcl \
sbopkg \
screen \
- service \
sh \
sitecopy \
slackpkg \
@@ -430,6 +442,9 @@ bashcomp_DATA = a2x \
tcpnice \
tracepath \
tune2fs \
+ udevadm \
+ umount \
+ umount.linux \
unace \
unpack200 \
unrar \
@@ -441,11 +456,13 @@ bashcomp_DATA = a2x \
useradd \
userdel \
usermod \
+ valgrind \
vipw \
vncviewer \
vpnc \
watch \
webmitm \
+ wine \
withlist \
wodim \
wol \
@@ -476,6 +493,7 @@ CLEANFILES = \
alternatives \
animate \
apropos \
+ arm-koji \
asciidoc.py \
autoheader \
automake-1.11 \
@@ -567,7 +585,6 @@ CLEANFILES = \
pccardctl \
perldoc \
phing \
- pidof \
pigz \
pinfo \
ping6 \
@@ -578,6 +595,7 @@ CLEANFILES = \
pm-suspend-hybrid \
pmake \
postalias \
+ ppc-koji \
puppetca \
puppetd \
puppetdoc \
@@ -607,6 +625,7 @@ CLEANFILES = \
rpm2txz \
rpmbuild \
rpmbuild-md5 \
+ s390-koji \
sbcl-mt \
scp \
sdptool \
@@ -619,12 +638,12 @@ CLEANFILES = \
smbpasswd \
smbtar \
smbtree \
+ sparc-koji \
spovray \
stream \
tightvncviewer \
tracepath6 \
typeset \
- umount \
vgcfgbackup \
vgcfgrestore \
vgchange \
@@ -971,9 +990,9 @@ symlinks:
rm -f $(targetdir)/$$file && \
$(LN_S) java $(targetdir)/$$file ; \
done
- for file in pkill ; do \
+ for file in arm-koji ppc-koji s390-koji sparc-koji ; do \
rm -f $(targetdir)/$$file && \
- $(LN_S) killall $(targetdir)/$$file ; \
+ $(LN_S) koji $(targetdir)/$$file ; \
done
for file in ldapadd ldapmodify ldapdelete ldapcompare ldapmodrdn \
ldapwhoami ldappasswd ; do \
@@ -1005,10 +1024,6 @@ symlinks:
rm -f $(targetdir)/$$file && \
$(LN_S) mcrypt $(targetdir)/$$file ; \
done
- for file in umount ; do \
- rm -f $(targetdir)/$$file && \
- $(LN_S) mount $(targetdir)/$$file ; \
- done
for file in mplayer2 mencoder gmplayer kplayer ; do \
rm -f $(targetdir)/$$file && \
$(LN_S) mplayer $(targetdir)/$$file ; \
@@ -1029,10 +1044,6 @@ symlinks:
rm -f $(targetdir)/$$file && \
$(LN_S) perl $(targetdir)/$$file ; \
done
- for file in pidof ; do \
- rm -f $(targetdir)/$$file && \
- $(LN_S) pgrep $(targetdir)/$$file ; \
- done
for file in alpine ; do \
rm -f $(targetdir)/$$file && \
$(LN_S) pine $(targetdir)/$$file ; \
@@ -1045,6 +1056,10 @@ symlinks:
rm -f $(targetdir)/$$file && \
$(LN_S) pkg_delete $(targetdir)/$$file ; \
done
+ for file in pkill ; do \
+ rm -f $(targetdir)/$$file && \
+ $(LN_S) pgrep $(targetdir)/$$file ; \
+ done
for file in pm-suspend pm-suspend-hybrid ; do \
rm -f $(targetdir)/$$file && \
$(LN_S) pm-hibernate $(targetdir)/$$file ; \
diff --git a/completions/_mock b/completions/_mock
index cb7d6571..020b39b4 100644
--- a/completions/_mock
+++ b/completions/_mock
@@ -12,7 +12,7 @@ _mock()
local cfgdir=/etc/mock count=0 i
for i in "${words[@]}" ; do
- [ $count -eq $cword ] && break
+ [[ $count -eq $cword ]] && break
if [[ "$i" == --configdir ]] ; then
cfgdir="${words[((count+1))]}"
elif [[ "$i" == --configdir=* ]] ; then
diff --git a/completions/_modules b/completions/_modules
index 6f337a90..b5a1d94a 100644
--- a/completions/_modules
+++ b/completions/_modules
@@ -49,7 +49,7 @@ _module ()
local cur prev words cword
_init_completion || return
- if [ $cword -eq 1 ] ; then
+ if [[ $cword -eq 1 ]]; then
# First parameter on line -- we expect it to be a mode selection
local options
@@ -58,7 +58,7 @@ _module ()
COMPREPLY=( $(compgen -W "$options" -- "$cur") )
- elif [ $cword -eq 2 ] ; then
+ elif [[ $cword -eq 2 ]]; then
case $prev in
add|display|help|load|show|whatis)
COMPREPLY=( $(_module_avail "$cur") )
@@ -70,7 +70,7 @@ _module ()
COMPREPLY=( $(_module_path "$cur") )
;;
esac
- elif [ $cword -eq 3 ] ; then
+ elif [[ $cword -eq 3 ]]; then
case ${words[1]} in
swap|switch)
COMPREPLY=( $(_module_avail "$cur") )
diff --git a/completions/_yum b/completions/_yum
index c2d37948..9860c540 100644
--- a/completions/_yum
+++ b/completions/_yum
@@ -45,7 +45,7 @@ _yum()
fi
done
- if [ -n "$special" ]; then
+ if [[ -n $special ]]; then
# TODO: install|update|upgrade should not match *src.rpm
if [[ "$cur" == @(*/|[.~])* && \
"$special" == @(deplist|install|update|upgrade) ]]; then
diff --git a/completions/ant b/completions/ant
index 96ef8172..dd3606dc 100644
--- a/completions/ant
+++ b/completions/ant
@@ -45,7 +45,7 @@ _ant()
break
fi
done
- [ ! -f $buildfile ] && return 0
+ [[ ! -f $buildfile ]] && return 0
# parse buildfile for targets
local line targets
diff --git a/completions/apt-build b/completions/apt-build
index aa78b230..8e593131 100644
--- a/completions/apt-build
+++ b/completions/apt-build
@@ -12,7 +12,7 @@ _apt_build()
fi
done
- if [ -n "$special" ]; then
+ if [[ -n $special ]]; then
case $special in
install|source|info)
COMPREPLY=( $( apt-cache pkgnames "$cur" 2> /dev/null ) )
diff --git a/completions/apt-cache b/completions/apt-cache
index 00b41478..3e2ca0db 100644
--- a/completions/apt-cache
+++ b/completions/apt-cache
@@ -6,7 +6,7 @@ _apt_cache()
_init_completion || return
local special i
- if [ "$cur" != show ]; then
+ if [[ $cur != show ]]; then
for (( i=0; i < ${#words[@]}-1; i++ )); do
if [[ ${words[i]} == @(add|depends|dotty|madison|policy|rdepends|show?(pkg|src|)) ]]; then
special=${words[i]}
@@ -15,7 +15,7 @@ _apt_cache()
fi
- if [ -n "$special" ]; then
+ if [[ -n $special ]]; then
case $special in
add)
_filedir
diff --git a/completions/apt-get b/completions/apt-get
index 447305a4..a6c902e1 100644
--- a/completions/apt-get
+++ b/completions/apt-get
@@ -12,10 +12,10 @@ _apt_get()
fi
done
- if [ -n "$special" ]; then
+ if [[ -n $special ]]; then
case $special in
remove|autoremove|purge)
- if [ -f /etc/debian_version ]; then
+ if [[ -f /etc/debian_version ]]; then
# Debian system
COMPREPLY=( $( \
_xfunc dpkg _comp_dpkg_installed_packages $cur ) )
diff --git a/completions/avctrl b/completions/avctrl
new file mode 100644
index 00000000..bac38cd6
--- /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 -eq 1 ]]; then
+ COMPREPLY=( $( compgen -W 'discover switch' -- "$cur" ) )
+ fi
+ fi
+} &&
+complete -F _avctrl avctrl
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/cardctl b/completions/cardctl
index 0532d6ef..90837269 100644
--- a/completions/cardctl
+++ b/completions/cardctl
@@ -5,7 +5,7 @@ _cardctl()
local cur prev words cword
_init_completion || return
- if [ $cword -eq 1 ]; then
+ if [[ $cword -eq 1 ]]; then
COMPREPLY=( $( compgen -W 'status config ident suspend \
resume reset eject insert scheme' -- "$cur" ) )
fi
diff --git a/completions/ccache b/completions/ccache
new file mode 100644
index 00000000..63f5a1c6
--- /dev/null
+++ b/completions/ccache
@@ -0,0 +1,26 @@
+# ccache(1) completion -*- shell-script -*-
+
+_ccache()
+{
+ local cur prev words cword split
+ _init_completion -s || return
+
+ if [[ $COMP_CWORD -eq 1 && ${COMP_WORDS[COMP_CWORD]} != -* ]]; then
+ _command_offset 1
+ return
+ fi
+
+ case $prev in
+ -h|--help|-V|--version|-F|--max-files|-M|--max-size)
+ return
+ ;;
+ esac
+
+ $split && return
+
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
+ [[ $COMPREPLY == *= ]] && compopt -o nospace
+} &&
+complete -F _ccache ccache
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/cfrun b/completions/cfrun
index 288bcf43..0be44132 100644
--- a/completions/cfrun
+++ b/completions/cfrun
@@ -31,7 +31,7 @@ _cfrun()
break
fi
done
- [ ! -f $hostfile ] && return 0
+ [[ ! -f $hostfile ]] && return 0
COMPREPLY=( $(compgen -W "$( command grep -v \
-E '(=|^$|^#)' $hostfile )" -- "$cur" ) )
diff --git a/completions/chkconfig b/completions/chkconfig
index 31a575e3..b1dd925e 100644
--- a/completions/chkconfig
+++ b/completions/chkconfig
@@ -8,6 +8,7 @@ _chkconfig()
case $prev in
--level=[1-6]|[1-6]|--list|--add|--del|--override)
_services
+ _xinetd_services
return 0
;;
--level)
@@ -19,12 +20,15 @@ _chkconfig()
$split && return 0
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--list --add --del --override --level' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '--list --add --del --override --level' \
+ -- "$cur" ) )
else
if [[ $cword -eq 2 || $cword -eq 4 ]]; then
- COMPREPLY=( $( compgen -W 'on off reset resetpriorities' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W 'on off reset resetpriorities' \
+ -- "$cur" ) )
else
_services
+ _xinetd_services
fi
fi
} &&
diff --git a/completions/cksfv b/completions/cksfv
index d21bcf39..eabe3730 100644
--- a/completions/cksfv
+++ b/completions/cksfv
@@ -5,7 +5,7 @@ _cksfv()
local cur prev words cword
_init_completion || return
- if [ $cword -eq 1 ]; then
+ if [[ $cword -eq 1 ]]; then
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
return 0
fi
diff --git a/completions/configure b/completions/configure
index 8e28d451..2337c497 100644
--- a/completions/configure
+++ b/completions/configure
@@ -26,7 +26,7 @@ _configure()
# --option=SETTING will include 'SETTING' as a contextual hint
[[ "$cur" != -* ]] && return 0
- if [ -n "$COMP_CONFIGURE_HINTS" ]; then
+ if [[ -n $COMP_CONFIGURE_HINTS ]]; then
COMPREPLY=( $( compgen -W "$( $1 --help 2>&1 | \
awk '/^ --[A-Za-z]/ { print $1; \
if ($2 ~ /--[A-Za-z]/) print $2 }' | sed -e 's/[[,].*//g' )" \
diff --git a/completions/cowsay b/completions/cowsay
index 47c2e52c..8e96b91e 100644
--- a/completions/cowsay
+++ b/completions/cowsay
@@ -7,7 +7,8 @@ _cowsay()
case $prev in
-f)
- COMPREPLY=( $( compgen -W '$( cowsay -l | tail -n +2)' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W \
+ '$( cowsay -l 2>/dev/null | tail -n +2 )' -- "$cur" ) )
return 0
;;
esac
diff --git a/completions/cpio b/completions/cpio
index ebbe5c57..45824007 100644
--- a/completions/cpio
+++ b/completions/cpio
@@ -33,7 +33,7 @@ _cpio()
$split && return 0
- if [ $cword -eq 1 ]; then
+ if [[ $cword -eq 1 ]]; then
COMPREPLY=( $( compgen -W '-o --create -i --extract -p --pass-through \
-? --help --license --usage --version' -- "$cur" ) )
else
diff --git a/completions/cppcheck b/completions/cppcheck
index 5dd30931..d3c7a422 100644
--- a/completions/cppcheck
+++ b/completions/cppcheck
@@ -7,16 +7,24 @@ _cppcheck()
case $prev in
--append|--exitcode-suppressions|--file-list|--rule-file|\
- --suppressions-list|-i)
+ --suppressions-list|--includes-file|-i)
_filedir
return
;;
- -D|--rule|--suppress|--template)
+ -D|-U|--rule|--suppress|--template|--max-configs)
return
;;
--enable)
+ # split comma-separated list
+ split=false
+ if [[ "$cur" == ?*,* ]]; then
+ prev="${cur%,*}"
+ cur="${cur##*,}"
+ split=true
+ fi
COMPREPLY=( $( compgen -W 'all style performance portability
information unusedFunction missingInclude' -- "$cur" ) )
+ $split && COMPREPLY=( ${COMPREPLY[@]/#/"$prev,"} )
return
;;
--error-exitcode)
@@ -28,11 +36,11 @@ _cppcheck()
return
;;
-j)
- COMPREPLY=( $( compgen -W '{2..16}' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W "{2..$(_ncpus)}" -- "$cur" ) )
return
;;
--std)
- COMPREPLY=( $( compgen -W 'c99 posix' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W 'c99 c++11 posix' -- "$cur" ) )
return
;;
--platform)
@@ -52,7 +60,7 @@ _cppcheck()
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
[[ $COMPREPLY == *= ]] && compopt -o nospace
else
- _filedir @(cpp|cxx|cc|c++|c|tpp|txx)
+ _filedir @(cpp|cxx|cc|c++|c|h|hpp|hxx|h++|tpp|txx)
fi
} &&
complete -F _cppcheck cppcheck
diff --git a/completions/cryptsetup b/completions/cryptsetup
index 2bbdc952..fb390214 100644
--- a/completions/cryptsetup
+++ b/completions/cryptsetup
@@ -28,7 +28,7 @@ _cryptsetup()
local arg
_get_first_arg
- if [ -z $arg ]; then
+ if [[ -z $arg ]]; then
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
[[ $COMPREPLY == *= ]] && compopt -o nospace
diff --git a/completions/curl b/completions/curl
index f0fc6acf..6b56aa57 100644
--- a/completions/curl
+++ b/completions/curl
@@ -6,18 +6,20 @@ _curl()
_init_completion || return
case $prev in
- --ciphers|--connect-timeout|-C|--continue-at|--form|--form-string|\
+ --ciphers|--connect-timeout|-C|--continue-at|-F|--form|--form-string|\
--ftp-account|--ftp-alternative-to-user|-P|--ftp-port|-H|--header|-h|\
--help|--hostpubmd5|--keepalive-time|--krb|--limit-rate|--local-port|\
--mail-from|--mail-rcpt|--max-filesize|--max-redirs|-m|--max-time|\
--pass|--proto|--proto-redir|--proxy-user|--proxy1.0|-Q|--quote|-r|\
--range|-X|--request|--retry|--retry-delay|--retry-max-time|\
--socks5-gssapi-service|-t|--telnet-option|--tftp-blksize|-z|\
- --time-cond|--url|-u|--user|-A|--user-agent|-V|--version|-w|--write-out)
+ --time-cond|--url|-u|--user|-A|--user-agent|-V|--version|-w|\
+ --write-out|--resolve|--tlsuser|--tlspassword)
return
;;
-K|--config|-b|--cookie|-c|--cookie-jar|-D|--dump-header|--egd-file|\
- --key|--libcurl|-o|--output|--random-file|-T|--upload-file)
+ --key|--libcurl|-o|--output|--random-file|-T|--upload-file|--trace|\
+ --trace-ascii|--netrc-file)
_filedir
return
;;
@@ -45,6 +47,10 @@ _curl()
fi
return
;;
+ --delegation)
+ COMPREPLY=( $( compgen -W 'none policy always' -- "$cur" ) )
+ return
+ ;;
--engine)
COMPREPLY=( $( compgen -W 'list' -- "$cur" ) )
return
@@ -74,6 +80,10 @@ _curl()
_filedir
return
;;
+ --tlsauthtype)
+ COMPREPLY=( $( compgen -W 'SRP' -- "$cur" ) )
+ return
+ ;;
esac
if [[ $cur == -* ]]; then
diff --git a/completions/cvs b/completions/cvs
index bafe1901..4613742a 100644
--- a/completions/cvs
+++ b/completions/cvs
@@ -13,7 +13,7 @@ _cvs_entries()
_cvs_modules()
{
- if [ -n "$prefix" ]; then
+ if [[ -n $prefix ]]; then
COMPREPLY=( $( command ls -d ${cvsroot}/${prefix}/!(CVSROOT) ) )
else
COMPREPLY=( $( command ls -d ${cvsroot}/!(CVSROOT) ) )
@@ -39,9 +39,8 @@ _cvs_roots()
{
local -a cvsroots
cvsroots=( $CVSROOT )
- [ -r ~/.cvspass ] && \
- cvsroots+=( $( awk '{ print $2 }' ~/.cvspass ) )
- [ -r CVS/Root ] && mapfile -tO ${#cvsroots[@]} cvsroots < CVS/Root
+ [[ -r ~/.cvspass ]] && cvsroots+=( $( awk '{ print $2 }' ~/.cvspass ) )
+ [[ -r CVS/Root ]] && mapfile -tO ${#cvsroots[@]} cvsroots < CVS/Root
COMPREPLY=( $( compgen -W '${cvsroots[@]}' -- "$cur" ) )
__ltrim_colon_completions "$cur"
}
@@ -56,12 +55,12 @@ _cvs()
count=0
for i in "${words[@]}"; do
- [ $count -eq $cword ] && break
+ [[ $count -eq $cword ]] && break
# Last parameter was the CVSROOT, now go back to mode selection
if [[ "${words[((count))]}" == "$cvsroot" && "$mode" == cvsroot ]]; then
mode=""
fi
- if [ -z "$mode" ]; then
+ if [[ -z $mode ]]; then
case $i in
-H|--help)
COMPREPLY=( $( compgen -W "$( _cvs_commands )" -- "$cur" ) )
@@ -152,7 +151,7 @@ _cvs()
if [[ "$cur" != -* ]]; then
_cvs_entries
- [ -z "$cur" ] && files=( !(CVS) ) || \
+ [[ -z $cur ]] && files=( !(CVS) ) || \
files=( $( command ls -d ${cur}* 2>/dev/null ) )
local f
for i in ${!files[@]}; do
@@ -221,7 +220,7 @@ _cvs()
esac
if [[ "$cur" != -* ]]; then
- [ -z "$cvsroot" ] && cvsroot=$CVSROOT
+ [[ -z $cvsroot ]] && cvsroot=$CVSROOT
COMPREPLY=( $( cvs -d "$cvsroot" co -c 2> /dev/null | \
awk '{print $1}' ) )
COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) )
@@ -244,7 +243,7 @@ _cvs()
# 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
+ 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
@@ -298,7 +297,7 @@ _cvs()
esac
if [[ "$cur" != -* ]]; then
- [ -z "$cvsroot" ] && cvsroot=$CVSROOT
+ [[ -z $cvsroot ]] && cvsroot=$CVSROOT
COMPREPLY=( $( cvs -d "$cvsroot" co -c | awk '{print $1}' ) )
COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) )
else
@@ -318,9 +317,9 @@ _cvs()
if [[ "$cur" != -* ]]; then
# starts with same algorithm as checkout
- [ -z "$cvsroot" ] && cvsroot=$CVSROOT
+ [[ -z $cvsroot ]] && cvsroot=$CVSROOT
local prefix=${cur%/*}
- if [ -r ${cvsroot}/${prefix} ]; then
+ if [[ -r ${cvsroot}/${prefix} ]]; then
_cvs_modules
COMPREPLY=( ${COMPREPLY[@]#$cvsroot} )
COMPREPLY=( ${COMPREPLY[@]#\/} )
@@ -337,7 +336,7 @@ _cvs()
_cvs_entries
# find out what files are missing
for i in "${entries[@]}"; do
- [ ! -r "$i" ] && miss+=( $i )
+ [[ ! -r $i ]] && miss+=( $i )
done
COMPREPLY=( $( compgen -W '${miss[@]:-}' -- "$cur" ) )
else
diff --git a/completions/desktop-file-validate b/completions/desktop-file-validate
new file mode 100644
index 00000000..faae6c37
--- /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: ts=4 sw=4 et filetype=sh
diff --git a/completions/dict b/completions/dict
index a31816d3..a2ecd9b1 100644
--- a/completions/dict
+++ b/completions/dict
@@ -17,17 +17,17 @@ _dict()
case ${words[i]} in
-h|--host)
host=${words[i+1]}
- [ -n "$host" ] && host="-h $host"
+ [[ -n $host ]] && host="-h $host"
i=$((++i))
;;
-p|--port)
port=${words[i+1]}
- [ -n "$port" ] && port="-p $port"
+ [[ -n $port ]] && port="-p $port"
i=$((++i))
;;
-d|--database)
db=${words[i+1]}
- [ -n "$db" ] && host="-d $db"
+ [[ -n $db ]] && host="-d $db"
i=$((++i))
;;
*)
@@ -54,8 +54,17 @@ _dict()
esac
local dictfile=/usr/share/dict/words
- [ -r $dictfile ] && \
- COMPREPLY=( $( compgen -W '$( cat $dictfile )' -- "$cur" ) )
+ 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
diff --git a/completions/dmesg b/completions/dmesg
index 5fb28e45..7d73bf3a 100644
--- a/completions/dmesg
+++ b/completions/dmesg
@@ -8,17 +8,24 @@ _dmesg()
_init_completion || return
case $prev in
- -s|-M|-N)
+ -h|--help|-V|--version|-s|--buffer-size|-M|-N)
return
;;
- -n)
+ -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
if [[ $cur == -* ]]; then
- COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) )
+ local opts=$( _parse_help "$1" )
+ [[ $opts ]] || opts=$( _parse_usage "$1" )
+ COMPREPLY=( $( compgen -W "$opts" -- "$cur" ) )
return
fi
} &&
diff --git a/completions/dnsspoof b/completions/dnsspoof
new file mode 100644
index 00000000..39bc47eb
--- /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)
+ _interfaces
+ return 0
+ ;;
+ -f)
+ _filedir
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) )
+ fi
+
+} &&
+complete -F _dnsspoof dnsspoof
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/dpkg b/completions/dpkg
index 247171c5..b1b34e17 100644
--- a/completions/dpkg
+++ b/completions/dpkg
@@ -10,6 +10,22 @@ _comp_dpkg_installed_packages()
{
command grep -A 1 "Package: $1" /var/lib/dpkg/status | \
command grep -B 1 -Ee "ok installed|half-installed|unpacked| \
+ half-configured" \
+ -Ee "^Essential: yes" | \
+ command grep "Package: $1" | cut -d\ -f2
+}
+}
+
+_have grep-status && {
+_comp_dpkg_purgeable_packages()
+{
+ grep-status -P -e "^$1" -a -FStatus 'install ok installed' -o -FStatus 'deinstall ok config-files' -n -s Package
+}
+} || {
+_comp_dpkg_purgeable_packages()
+{
+ command grep -A 1 "Package: $1" /var/lib/dpkg/status | \
+ command grep -B 1 -Ee "ok installed|half-installed|unpacked| \
half-configured|config-files" \
-Ee "^Essential: yes" | \
command grep "Package: $1" | cut -d\ -f2
@@ -54,10 +70,14 @@ _dpkg()
_filedir
return 0
;;
- -r|-L|-P|--remove|--purge|--listfiles)
+ -r|--remove)
COMPREPLY=( $( _comp_dpkg_installed_packages "$cur" ) )
return 0
;;
+ -L|-P|--listfiles|--purge)
+ COMPREPLY=( $( _comp_dpkg_purgeable_packages "$cur" ) )
+ return 0
+ ;;
esac
$split && return
diff --git a/completions/e2label b/completions/e2label
index 86008d9f..94bcc1c8 100644
--- a/completions/e2label
+++ b/completions/e2label
@@ -5,7 +5,7 @@ _e2label()
local cur prev words cword
_init_completion || return
- if [ $cword -eq 1 ]; then
+ if [[ $cword -eq 1 ]]; then
cur=${cur:=/dev/}
_filedir
fi
diff --git a/completions/export b/completions/export
index 557c52cb..42273a9e 100644
--- a/completions/export
+++ b/completions/export
@@ -3,23 +3,59 @@
_export()
{
local cur prev words cword
- _init_completion || return
+ _init_completion -n = || return
- case ${words[@]} in
- *=\$*)
- COMPREPLY=( $( compgen -v -P '$' -- "${cur#*=\$}" ) )
+ 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
+
+ [[ $cur == *=\$* ]] && { cur=${cur#*=}; _variables; } && return
+
+ 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
;;
- *[^=])
- COMPREPLY=( $( compgen -v -S '=' -- "$cur" ) )
+ *=*)
+ cur=${cur#*=}
+ _filedir
;;
- *=)
- COMPREPLY=( "$( eval echo -n \"$`echo ${cur%=}`\" |
- ( echo -n \'
- sed -e 's/'\''/'\''\\\'\'''\''/g'
- echo -n \' ) )" )
+ *)
+ 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 -o default -o nospace export
+complete -F _export export
# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/fbgs b/completions/fbgs
index 672de7cd..93dbe392 100644
--- a/completions/fbgs
+++ b/completions/fbgs
@@ -28,8 +28,8 @@ _fbgs()
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $(compgen -W '-l -xl -xxl -a --fitwidth -d -m -t -g -f -p \
- -h -c' -- "$cur") )
+ COMPREPLY=( $( compgen -W '-l -xl -xxl -a --fitwidth -d -m -t -g -f -p
+ -h -c' -- "$cur" ) )
[[ $COMPREPLY ]] && return
fi
diff --git a/completions/fbi b/completions/fbi
index f8f7a825..9516247b 100644
--- a/completions/fbi
+++ b/completions/fbi
@@ -11,12 +11,12 @@ _fbi()
return
;;
-r|--resolution)
- COMPREPLY+=( $(compgen -W '{1..5}') )
+ COMPREPLY+=( $( compgen -W '{1..5}' ) )
return
;;
-f|--font)
local IFS=$'\n'
- COMPREPLY=( $( compgen -W '$( fc-list 2>/dev/null )' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( fc-list 2> /dev/null )' -- "$cur" ) )
return
;;
-m|--mode)
@@ -36,13 +36,12 @@ _fbi()
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $(compgen -W '--help --version --store --list --text \
- --autozoom --autoup --noautoup --autodown --noautodown --fitwidth \
- --nofitwidth --verbose --noverbose --random --norandom --comments \
- --nocomments --edit --noedit --backup --nobackup --preserve \
- --nopreserve --readahead --noreadahead --cachemem --blend --vt \
- --scroll --timeout --once --noonce --resolution --gamma --font \
- --device --mode' -- "$cur") )
+ COMPREPLY=( $( 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
diff --git a/completions/feh b/completions/feh
index e39b5c31..0f34f94b 100644
--- a/completions/feh
+++ b/completions/feh
@@ -25,12 +25,12 @@ _feh()
-e|--font|-M|--menu-font|-@|--title-font)
# expect string like "dejavu.ttf/12"
if [[ "$cur" == */* ]]; then # expect integer value
- COMPREPLY=( $(compgen -P "$cur" -W '{0..9}') )
+ 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"
+ # 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
@@ -46,7 +46,7 @@ _feh()
-T|--theme)
local conf_path=~/.config/feh/themes
local theme_name theme_opts
- [ -r "$conf_path" ] || return
+ [[ -r $conf_path ]] || return
while read theme_name theme_opts; do
if [[ "$theme_name" == '#'* || "$theme_name" == "" ]]; then
continue
@@ -63,15 +63,15 @@ _feh()
-R|--reload|-H|--limit-height|-W|--limit-width|-E|--thumb-height|\
-y|--thumb-width|-J|--thumb-redraw)
# expect integer value
- COMPREPLY+=( $(compgen -W '{0..9}') )
+ COMPREPLY+=( $( compgen -W '{0..9}' ) )
compopt -o nospace
return
;;
--zoom)
# expect integer value or "max", "fill"
- COMPREPLY=( $(compgen -W 'max fill' -- "$cur") )
+ COMPREPLY=( $( compgen -W 'max fill' -- "$cur" ) )
if [[ ! $cur || ! $COMPREPLY ]]; then
- COMPREPLY+=( $(compgen -W '{0..9}') )
+ COMPREPLY+=( $( compgen -W '{0..9}' ) )
compopt -o nospace
fi
return
@@ -95,7 +95,7 @@ _feh()
if [[ $cur && "$cur" != *x* ]]; then
COMPREPLY=( x )
fi
- COMPREPLY+=( $(compgen -W "{0..9}") )
+ COMPREPLY+=( $( compgen -W "{0..9}" ) )
compopt -o nospace
return
;;
diff --git a/completions/function b/completions/function
index 6156e63d..e8e4d751 100644
--- a/completions/function
+++ b/completions/function
@@ -6,12 +6,12 @@ _function()
_init_completion || return
if [[ $1 == @(declare|typeset) ]]; then
- if [ "$prev" = -f ]; then
+ if [[ $prev == -f ]]; then
COMPREPLY=( $( compgen -A function -- "$cur" ) )
elif [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-a -f -F -i -r -x -p' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) )
fi
- elif [ $cword -eq 1 ]; then
+ elif [[ $cword -eq 1 ]]; then
COMPREPLY=( $( compgen -A function -- "$cur" ) )
else
COMPREPLY=( "() $( type -- ${words[1]} | sed -e 1,2d )" )
diff --git a/completions/gcc b/completions/gcc
index bafb81b7..c86fd7e6 100644
--- a/completions/gcc
+++ b/completions/gcc
@@ -38,17 +38,17 @@ _gcc()
# sink stderr:
# for C/C++/ObjectiveC it's useless
# for FORTRAN/Java it's an error
- COMPREPLY=( $( compgen -W "$( $cc --help 2>/dev/null | \
- tr '\t' ' ' | \
- sed -e '/^ *-/!d' -e 's/ *-\([^ ]*\).*/-\1/' | \
- sort -u )" -- "$cur" ) )
+ COMPREPLY=( $( compgen -W "$( $cc --help 2>/dev/null | tr '\t' ' ' |\
+ sed -e '/^ *-/!d' -e 's/ *-\([^][ <>]*\).*/-\1/' )" -- "$cur" ) )
+ [[ $COMPREPLY == *= ]] && compopt -o nospace
else
_filedir
fi
} &&
-complete -F _gcc gcc g++ c++ g77 gcj gpc
-
-[[ $OSTYPE == *cygwin* ]] || _userland GNU && _have gcc && \
- complete -F _gcc cc || :
+complete -F _gcc gcc g++ g77 gcj gpc &&
+{
+ cc --version 2>/dev/null | grep -q GCC && complete -F _gcc cc || :
+ c++ --version 2>/dev/null | grep -q GCC && complete -F _gcc c++ || :
+}
# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/gdb b/completions/gdb
index c24407b5..125d0b15 100644
--- a/completions/gdb
+++ b/completions/gdb
@@ -5,7 +5,7 @@ _gdb()
local cur prev words cword
_init_completion || return
- if [ $cword -eq 1 ]; then
+ if [[ $cword -eq 1 ]]; then
local IFS
compopt -o filenames
if [[ "$cur" == */* ]]; then
@@ -24,7 +24,7 @@ _gdb()
-mindepth 1 -maxdepth 1 -not -type d -executable \
-printf "%f\\n" 2>/dev/null)' -- "$cur" ) )
fi
- elif [ $cword -eq 2 ]; then
+ elif [[ $cword -eq 2 ]]; then
COMPREPLY=( $( compgen -W "$( command ps axo comm,pid | \
awk '{if ($1 ~ /^'"${prev##*/}"'/) print $2}' )" -- "$cur" ) )
compopt -o filenames
diff --git a/completions/gpg b/completions/gpg
index 763086bc..f7efad3a 100644
--- a/completions/gpg
+++ b/completions/gpg
@@ -20,7 +20,7 @@ _gpg()
-r|--recipient)
COMPREPLY=( $( compgen -W "$( gpg --list-keys 2>/dev/null | \
sed -ne 's@^.*<\([^>]*\)>.*$@\1@p')" -- "$cur" ))
- if [ -e ~/.gnupg/gpg.conf ]; then
+ if [[ -e ~/.gnupg/gpg.conf ]]; then
COMPREPLY+=( $( compgen -W "$( sed -ne \
's@^[ \t]*group[ \t][ \t]*\([^=]*\).*$@\1@p' \
~/.gnupg/gpg.conf )" -- "$cur") )
diff --git a/completions/gpg2 b/completions/gpg2
index 03d2c5b8..85e9f38c 100644
--- a/completions/gpg2
+++ b/completions/gpg2
@@ -24,7 +24,7 @@ _gpg2()
-r|--recipient)
COMPREPLY=( $( compgen -W "$( gpg2 --list-keys 2>/dev/null | \
sed -ne 's@^.*<\([^>]*\)>.*$@\1@p')" -- "$cur" ))
- if [ -e ~/.gnupg/gpg.conf ]; then
+ if [[ -e ~/.gnupg/gpg.conf ]]; then
COMPREPLY+=( $( compgen -W "$( sed -ne \
's@^[ \t]*group[ \t][ \t]*\([^=]*\).*$@\1@p' \
~/.gnupg/gpg.conf)" -- "$cur"))
diff --git a/completions/hcitool b/completions/hcitool
index 417a0c99..0a743e48 100644
--- a/completions/hcitool
+++ b/completions/hcitool
@@ -2,7 +2,7 @@
_bluetooth_adresses()
{
- if [ -n "${COMP_BLUETOOTH_SCAN:-}" ]; then
+ if [[ -n ${COMP_BLUETOOTH_SCAN:-} ]]; then
COMPREPLY+=( $( compgen -W "$( hcitool scan | \
awk '/^\t/{print $1}' )" -- "$cur" ) )
fi
@@ -51,7 +51,7 @@ _hcitool()
local arg
_get_first_arg
- if [ -z $arg ]; then
+ if [[ -z $arg ]]; then
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
else
@@ -63,7 +63,7 @@ _hcitool()
case $arg in
name|info|dc|rssi|lq|afh|auth|key|clkoff|lst)
_count_args
- if [ $args -eq 2 ]; then
+ if [[ $args -eq 2 ]]; then
_bluetooth_adresses
fi
;;
@@ -72,14 +72,14 @@ _hcitool()
COMPREPLY=( $( compgen -W '--role --pkt-type' -- "$cur" ) )
else
_count_args
- if [ $args -eq 2 ]; then
+ if [[ $args -eq 2 ]]; then
_bluetooth_adresses
fi
fi
;;
sr)
_count_args
- if [ $args -eq 2 ]; then
+ if [[ $args -eq 2 ]]; then
_bluetooth_adresses
else
COMPREPLY=( $( compgen -W 'master slave' -- "$cur" ) )
@@ -87,7 +87,7 @@ _hcitool()
;;
cpt)
_count_args
- if [ $args -eq 2 ]; then
+ if [[ $args -eq 2 ]]; then
_bluetooth_adresses
else
_bluetooth_packet_types
@@ -95,7 +95,7 @@ _hcitool()
;;
tpl|enc|clock)
_count_args
- if [ $args -eq 2 ]; then
+ if [[ $args -eq 2 ]]; then
_bluetooth_adresses
else
COMPREPLY=( $( compgen -W '0 1' -- "$cur" ) )
@@ -122,7 +122,7 @@ _sdptool()
local arg
_get_first_arg
- if [ -z $arg ]; then
+ if [[ -z $arg ]]; then
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
else
@@ -206,7 +206,7 @@ _rfcomm()
local arg
_get_first_arg
- if [ -z $arg ]; then
+ if [[ -z $arg ]]; then
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
else
@@ -215,12 +215,12 @@ _rfcomm()
fi
else
_count_args
- if [ $args -eq 2 ]; then
+ if [[ $args -eq 2 ]]; then
_bluetooth_devices
else
case $arg in
connect|bind)
- if [ $args -eq 3 ]; then
+ if [[ $args -eq 3 ]]; then
_bluetooth_adresses
fi
;;
@@ -245,7 +245,7 @@ _ciptool()
local arg
_get_first_arg
- if [ -z $arg ]; then
+ if [[ -z $arg ]]; then
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
else
@@ -256,7 +256,7 @@ _ciptool()
case $arg in
connect|release|loopback)
_count_args
- if [ $args -eq 2 ]; then
+ if [[ $args -eq 2 ]]; then
_bluetooth_adresses
fi
;;
@@ -302,7 +302,7 @@ _hciconfig()
local arg
_get_first_arg
- if [ -z $arg ]; then
+ if [[ -z $arg ]]; then
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--help --all' -- "$cur" ) )
else
@@ -318,20 +318,20 @@ _hciconfig()
case $arg in
putkey|delkey)
_count_args
- if [ $args -eq 2 ]; then
+ if [[ $args -eq 2 ]]; then
_bluetooth_adresses
fi
;;
lm)
_count_args
- if [ $args -eq 2 ]; then
+ if [[ $args -eq 2 ]]; then
COMPREPLY=( $( compgen -W 'MASTER \
SLAVE NONE ACCEPT' -- "$cur" ) )
fi
;;
ptype)
_count_args
- if [ $args -eq 2 ]; then
+ if [[ $args -eq 2 ]]; then
_bluetooth_packet_types
fi
;;
diff --git a/completions/htop b/completions/htop
new file mode 100644
index 00000000..7735f9b5
--- /dev/null
+++ b/completions/htop
@@ -0,0 +1,32 @@
+# htop(1) completion -*- shell-script -*-
+
+_htop()
+{
+ local cur prev words cword split
+ _init_completion -s || return
+
+ case "$prev" in
+ -s|--sort-key)
+ COMPREPLY=( $( compgen -W '$( "$1" -s help )' -- "$cur" ) )
+ return
+ ;;
+ -u|--user)
+ COMPREPLY=( $( compgen -u -- "$cur" ) )
+ return
+ ;;
+ -d|--delay)
+ # 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: ts=4 sw=4 et filetype=sh
diff --git a/completions/id b/completions/id
new file mode 100644
index 00000000..c985c9eb
--- /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: ts=4 sw=4 et filetype=sh
diff --git a/completions/ifup b/completions/ifup
index fee87d6b..fcd34994 100644
--- a/completions/ifup
+++ b/completions/ifup
@@ -7,7 +7,7 @@ _ifupdown()
local cur prev words cword
_init_completion || return
- if [ $cword -eq 1 ]; then
+ if [[ $cword -eq 1 ]]; then
_configured_interfaces
COMPREPLY=( $(compgen -W '${COMPREPLY[@]}' -- "$cur") )
fi
diff --git a/completions/info b/completions/info
index aa16be69..36550449 100644
--- a/completions/info
+++ b/completions/info
@@ -43,14 +43,14 @@ _info()
local i infopath=/usr/share/info
- if [ "${INFOPATH: -1:1}" == ':' ]; then
+ if [[ $INFOPATH == *: ]]; then
infopath=${INFOPATH}${infopath}
- elif [ ${INFOPATH:+set} ]; then
+ elif [[ ${INFOPATH:+set} ]]; then
infopath=$INFOPATH
fi
infopath=$infopath:
- if [ -n "$cur" ]; then
+ if [[ -n $cur ]]; then
infopath="${infopath//://$cur* }"
else
infopath="${infopath//:// }"
@@ -62,9 +62,7 @@ _info()
COMPREPLY=( ${COMPREPLY[@]##*/?(:)} )
# weed out info dir file
for (( i=0 ; i < ${#COMPREPLY[@]} ; ++i )); do
- if [ "${COMPREPLY[$i]}" == 'dir' ]; then
- unset COMPREPLY[$i]
- fi
+ [[ ${COMPREPLY[$i]} == dir ]] && unset COMPREPLY[$i]
done
# strip suffix from info pages
COMPREPLY=( ${COMPREPLY[@]%.@(gz|bz2|xz|lzma)} )
diff --git a/completions/invoke-rc.d b/completions/invoke-rc.d
index fd2c1db0..d4e0d245 100644
--- a/completions/invoke-rc.d
+++ b/completions/invoke-rc.d
@@ -9,8 +9,8 @@ _invoke_rc_d()
local sysvdir services options valid_options
- [ -d /etc/rc.d/init.d ] && sysvdir=/etc/rc.d/init.d \
- || sysvdir=/etc/init.d
+ [[ -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/} )
@@ -24,7 +24,7 @@ _invoke_rc_d()
| sort | uniq -u \
) )
COMPREPLY=( $( compgen -W '${valid_options[@]} ${services[@]}' -- "$cur" ) )
- elif [ -x $sysvdir/$prev ]; then
+ elif [[ -x $sysvdir/$prev ]]; then
COMPREPLY=( $( compgen -W '`sed -e "y/|/ /" \
-ne "s/^.*Usage:[ ]*[^ ]*[ ]*{*\([^}\"]*\).*$/\1/p" \
$sysvdir/$prev`' -- "$cur" ) )
diff --git a/completions/iperf b/completions/iperf
new file mode 100644
index 00000000..721825e2
--- /dev/null
+++ b/completions/iperf
@@ -0,0 +1,63 @@
+# iperf(1) completion -*- shell-script -*-
+
+_iperf()
+{
+ local cur prev words cword split
+ _init_completion -s || return
+
+ case $prev in
+ -h|--help|-v|--version|-i|--interval|-l|--len|-p|--port|-w|--window|\
+ -M|--mss|-b|--bandwidth|-n|--num|-t|--time|-L|--listenport|-P|\
+ --parallel|-T|--ttl|-Z|--linux-congestion)
+ return
+ ;;
+ -f|--format)
+ COMPREPLY=( $( compgen -W 'k m K M' -- "$cur" ) )
+ return
+ ;;
+ -o|--output|-F|--fileinput)
+ _filedir
+ return
+ ;;
+ -B|--bind)
+ _available_interfaces -a
+ _ip_addresses
+ return
+ ;;
+ -c|--client)
+ _known_hosts_real "$cur"
+ return
+ ;;
+ -x|--reportexclude)
+ COMPREPLY=( $( compgen -W 'C D M S V' -- "$cur" ) )
+ return
+ ;;
+ -y|--reportstyle)
+ COMPREPLY=( $( compgen -W 'C' -- "$cur" ) )
+ return
+ ;;
+ esac
+
+ $split && return
+
+ # Filter mode specific options
+ local i filter=cat
+ for i in ${words[@]}; do
+ case $i in
+ -s|--server)
+ filter='sed -e /^Client.specific/,/^$/d'
+ ;;
+ -c|--client)
+ filter='sed -e /^Server.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
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/ipmitool b/completions/ipmitool
index 81a6466f..281d9eac 100644
--- a/completions/ipmitool
+++ b/completions/ipmitool
@@ -71,11 +71,11 @@ _ipmitool()
for (( i=1; i < ${#words[@]}-1; i++ )); do
[[ -n $cmd ]] && subcmd=${words[i]} && break
for c in ${cmds[@]}; do
- [ ${words[i]} = $c ] && cmd=$c && break
+ [[ ${words[i]} == $c ]] && cmd=$c && break
done
done
- if [ -z "$cmd" ]; then
+ if [[ -z $cmd ]]; then
COMPREPLY=( $( compgen -W '${cmds[@]}' -- "$cur" ) )
return 0
fi
@@ -100,11 +100,11 @@ _ipmitool()
print|set)
;;
alert)
- [ "$prev" = alert ] && \
+ [[ $prev == alert ]] && \
COMPREPLY=( $( compgen -W 'print set' -- "$cur" ) )
;;
stats)
- [ "$prev" = stats ] && \
+ [[ $prev == stats ]] && \
COMPREPLY=( $( compgen -W 'print set' -- "$cur" ) )
;;
*)
@@ -161,7 +161,7 @@ _ipmitool()
_filedir
;;
time)
- [ "$prev" = time ] && \
+ [[ $prev == time ]] && \
COMPREPLY=( $( compgen -W 'get set' -- "$cur" ) )
;;
*)
@@ -176,7 +176,7 @@ _ipmitool()
summary|list|disable|enable|priv|test)
;;
set)
- [ "$prev" = set ] && \
+ [[ $prev == set ]] && \
COMPREPLY=( $( compgen -W 'name password' -- "$cur" ) )
;;
*)
@@ -187,7 +187,7 @@ _ipmitool()
;;
set)
- [ "$prev" = set ] && \
+ [[ $prev == set ]] && \
COMPREPLY=( $( compgen -W 'hostname username password privlvl
authtype localaddr targetaddr port csv verbose' \
-- "$cur" ) )
diff --git a/completions/ipsec b/completions/ipsec
index 1a081028..a586a786 100644
--- a/completions/ipsec
+++ b/completions/ipsec
@@ -18,7 +18,7 @@ _ipsec_freeswan()
local cur prev words cword
_init_completion || return
- if [ $cword -eq 1 ]; then
+ if [[ $cword -eq 1 ]]; then
COMPREPLY=( $( compgen -W 'auto barf eroute klipsdebug look manual \
pluto ranbits rsasigkey setup showdefaults showhostkey spi spigrp \
tncfg whack' -- "$cur" ) )
@@ -55,7 +55,7 @@ _ipsec_strongswan()
local cur prev words cword
_init_completion || return
- if [ $cword -eq 1 ]; then
+ if [[ $cword -eq 1 ]]; then
COMPREPLY=( $( compgen -W 'down irdumm leases listaacerts listacerts \
listalgs listall listcacerts listcainfos listcards listcerts \
listcrls listgroups listocsp listocspcerts listpubkeys openac pki
diff --git a/completions/iptables b/completions/iptables
index b9314f23..5c4e0736 100644
--- a/completions/iptables
+++ b/completions/iptables
@@ -29,12 +29,12 @@ _iptables()
`iptables $table -nL | sed -ne "$chain" \
-e "s/INPUT|OUTPUT|FORWARD|PREROUTING|POSTROUTING//"`' -- \
"$cur" ) )
- elif [ "$table" = "-t nat" ]; then
+ elif [[ $table == "-t nat" ]]; then
COMPREPLY=( $( compgen -W 'ACCEPT DROP LOG ULOG REJECT \
MIRROR SNAT DNAT MASQUERADE `iptables $table -nL | \
sed -ne "$chain" -e "s/OUTPUT|PREROUTING|POSTROUTING//"`' \
-- "$cur" ) )
- elif [ "$table" = "-t mangle" ]; then
+ elif [[ $table == "-t mangle" ]]; then
COMPREPLY=( $( compgen -W 'ACCEPT DROP LOG ULOG REJECT \
MARK TOS `iptables $table -nL | sed -ne "$chain" \
-e "s/INPUT|OUTPUT|FORWARD|PREROUTING|POSTROUTING//"`' -- \
diff --git a/completions/isql b/completions/isql
index 695654f3..43cd6dd3 100644
--- a/completions/isql
+++ b/completions/isql
@@ -6,7 +6,7 @@ _isql()
local cur prev words cword
_init_completion || return
- [ -f "$ODBCINI" ] \
+ [[ -f $ODBCINI ]] \
&& COMPREPLY=( $( command grep \\["$cur" "$ODBCINI" | tr -d \\[\\] ) )
} &&
complete -F _isql isql
diff --git a/completions/iwconfig b/completions/iwconfig
index 81dda723..899f1493 100644
--- a/completions/iwconfig
+++ b/completions/iwconfig
@@ -13,7 +13,7 @@ _iwconfig()
;;
essid)
COMPREPLY=( $( compgen -W 'on off any' -- "$cur" ) )
- if [ -n "${COMP_IWLIST_SCAN:-}" ]; then
+ if [[ -n ${COMP_IWLIST_SCAN:-} ]]; then
COMPREPLY+=( $( compgen -W \
"$( iwlist ${words[1]} scan | \
awk -F'\"' '/ESSID/ {print $2}' )" -- "$cur" ) )
@@ -37,7 +37,7 @@ _iwconfig()
;;
ap)
COMPREPLY=( $( compgen -W 'on off any' -- "$cur" ) )
- if [ -n "${COMP_IWLIST_SCAN:-}" ]; then
+ if [[ -n ${COMP_IWLIST_SCAN:-} ]]; then
COMPREPLY+=( $( compgen -W \
"$( iwlist ${words[1]} scan | \
awk -F ': ' '/Address/ {print $2}' )" -- "$cur" ) )
@@ -73,7 +73,7 @@ _iwconfig()
;;
esac
- if [ $cword -eq 1 ]; then
+ if [[ $cword -eq 1 ]]; then
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--help --version' -- "$cur" ) )
else
diff --git a/completions/iwlist b/completions/iwlist
index 39bfa0f1..7819b04d 100644
--- a/completions/iwlist
+++ b/completions/iwlist
@@ -5,7 +5,7 @@ _iwlist()
local cur prev words cword
_init_completion || return
- if [ $cword -eq 1 ]; then
+ if [[ $cword -eq 1 ]]; then
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--help --version' -- "$cur" ) )
else
diff --git a/completions/iwpriv b/completions/iwpriv
index b0d45043..05952c5e 100644
--- a/completions/iwpriv
+++ b/completions/iwpriv
@@ -16,7 +16,7 @@ _iwpriv()
;;
esac
- if [ $cword -eq 1 ]; then
+ if [[ $cword -eq 1 ]]; then
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--help --version' -- "$cur" ) )
else
diff --git a/completions/iwspy b/completions/iwspy
index 4bffc76e..b59b0693 100644
--- a/completions/iwspy
+++ b/completions/iwspy
@@ -5,7 +5,7 @@ _iwspy()
local cur prev words cword
_init_completion || return
- if [ $cword -eq 1 ]; then
+ if [[ $cword -eq 1 ]]; then
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--help --version' -- "$cur" ) )
else
diff --git a/completions/java b/completions/java
index e02f7369..c302d1e5 100644
--- a/completions/java
+++ b/completions/java
@@ -21,10 +21,10 @@ _java_find_classpath()
done
# default to environment
- [ -z "$classpath" ] && classpath=$CLASSPATH
+ [[ -z $classpath ]] && classpath=$CLASSPATH
# default to current directory
- [ -z "$classpath" ] && classpath=.
+ [[ -z $classpath ]] && classpath=.
}
# exact sourcepath determination
@@ -41,7 +41,7 @@ _java_find_sourcepath()
done
# default to classpath
- if [ -z "$sourcepath" ]; then
+ if [[ -z $sourcepath ]]; then
local classpath
_java_find_classpath
sourcepath=$classpath
@@ -69,7 +69,7 @@ _java_classes()
command grep '^[^$]*\.class$' ) )
fi
- elif [ -d $i ]; then
+ elif [[ -d $i ]]; then
COMPREPLY+=(
$( compgen -d -- "$i/$cur" | sed -e "s|^$i/\(.*\)|\1.|" )
$( compgen -f -X '!*.class' -- "$i/$cur" | \
@@ -101,7 +101,7 @@ _java_packages()
cur=${cur//.//}
# parse each sourcepath element for packages
for i in ${sourcepath//:/ }; do
- if [ -d $i ]; then
+ if [[ -d $i ]]; then
COMPREPLY+=( $( command ls -F -d $i/$cur* 2>/dev/null | \
sed -e 's|^'$i'/||' ) )
fi
diff --git a/completions/kcov b/completions/kcov
index e0f37fdb..ebbd803c 100644
--- a/completions/kcov
+++ b/completions/kcov
@@ -1,4 +1,4 @@
-# kcov completion -*- shell-script -*-
+# kcov(1) completion -*- shell-script -*-
_kcov()
{
@@ -8,29 +8,29 @@ _kcov()
case "$prev" in
--pid|-p)
_pids
- return 0
+ return
;;
--sort-type|-s)
COMPREPLY=( $( compgen -W 'filename percentage' -- "$cur" ) )
- return 0
+ return
;;
--include-path|--exclude-path)
_filedir
- return 0
+ return
;;
--limits|-l|--title|-t|--include-pattern|--exclude-pattern|\
--path-strip-level)
# argument required but no completions available
- return 0
+ return
;;
esac
- $split && return 0
+ $split && return
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '$( _parse_help "$1" --help )' -- "$cur" ) )
[[ $COMPREPLY == *= ]] && compopt -o nospace
- return 0
+ return
fi
_filedir
diff --git a/completions/killall b/completions/killall
index d2f6dd47..ed502f97 100644
--- a/completions/killall
+++ b/completions/killall
@@ -1,4 +1,6 @@
-# killall(1) and pkill(1) completion -*- shell-script -*-
+# killall(1) completion -*- shell-script -*-
+
+[[ $OSTYPE == *@(linux|freebsd|darwin)* ]] || return 1
_killall()
{
@@ -10,7 +12,7 @@ _killall()
return
;;
-s|--signal)
- [[ $1 == *killall ]] && _signals
+ _signals
return
;;
-u|--user)
@@ -21,15 +23,14 @@ _killall()
$split && return
- if [[ $cword -eq 1 && "$cur" == -* ]]; then
- _signals -
- else
- _pnames
+ if [[ $cur == -* ]]; then
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
+ [[ $cword -eq 1 ]] && _signals -
+ return
fi
- return 0
+ _pnames
} &&
-complete -F _killall pkill
-[[ $OSTYPE == *@(linux|freebsd|darwin)* ]] && complete -F _killall killall || :
+complete -F _killall killall
# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/kldload b/completions/kldload
index 26ab0e19..f362db69 100644
--- a/completions/kldload
+++ b/completions/kldload
@@ -8,7 +8,7 @@ _kldload()
_init_completion || return
local moddir=/modules/
- [ -d $moddir ] || moddir=/boot/kernel/
+ [[ -d $moddir ]] || moddir=/boot/kernel/
compopt -o filenames
COMPREPLY=( $( compgen -f "$moddir$cur" ) )
diff --git a/completions/koji b/completions/koji
new file mode 100644
index 00000000..f4bdeacf
--- /dev/null
+++ b/completions/koji
@@ -0,0 +1,234 @@
+# 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
+ -h|--help|--help-commands)
+ return
+ ;;
+ -c|--config|--keytab|-o)
+ _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 [[ $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|wait-repo)
+ 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"
+ ;;
+ esac
+ return
+ fi
+
+ if [[ $cur == -* ]]; then
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
+ [[ $COMPREPLY == *= ]] && compopt -o nospace
+ elif [[ ! $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: ts=4 sw=4 et filetype=sh
diff --git a/completions/links b/completions/links
index a212fa5a..5adc7de3 100644
--- a/completions/links
+++ b/completions/links
@@ -18,7 +18,7 @@ _links()
-source -version -help' -- "$cur" ) )
;;
*)
- if [ -r ~/.links/links.his ]; then
+ if [[ -r ~/.links/links.his ]]; then
COMPREPLY=( $( compgen -W '$( < ~/.links/links.his )' \
-- "$cur" ) )
fi
diff --git a/completions/lintian b/completions/lintian
index 65121151..8e470758 100644
--- a/completions/lintian
+++ b/completions/lintian
@@ -10,7 +10,7 @@ _lintian_tags()
for item in $search; do
match=$(grep -nE "^Tag: $item$" /usr/share/lintian/checks/*.desc \
| cut -d: -f1 )
- tags=$( echo $tags | sed -e "s/\<$item\>//g" )
+ tags=$( sed -e "s/\<$item\>//g" <<<$tags )
done
COMPREPLY+=( $(compgen -W "$tags") )
elif [[ "$cur" == *,* ]]; then
@@ -35,7 +35,7 @@ _lintian_checks()
todisable=$(grep -e ^Check-Script -e ^Abbrev $match | \
cut -d\ -f2 )
for name in $todisable; do
- checks=$( echo $checks | sed -e "s/\<$name\>//g" )
+ checks=$( sed -e "s/\<$name\>//g" <<<$checks )
done
done
COMPREPLY+=( $(compgen -W "$checks") )
@@ -58,7 +58,7 @@ _lintian_infos()
for item in $search; do
match=$( grep -nE "^Collector: $item$" \
/usr/share/lintian/collection/*.desc | cut -d: -f1 )
- infos=$( echo $infos | sed -e "s/\<$item\>//g" )
+ infos=$( sed -e "s/\<$item\>//g" <<<$infos )
done
COMPREPLY+=( $(compgen -W "$infos") )
elif [[ "$cur" == *,* ]]; then
@@ -133,7 +133,6 @@ _lintian()
# If we're here, the user is trying to complete on
# --action tag,tag,<TAB>
# Only few actions permit that, re-complete them now.
- echo $prev
case "$prev" in
-C|--check-part|-X|--dont-check-part)
_lintian_checks
diff --git a/completions/lrzip b/completions/lrzip
index 1569dab4..d4106fb2 100644
--- a/completions/lrzip
+++ b/completions/lrzip
@@ -26,19 +26,12 @@ _lrzip()
COMPREPLY=( $( compgen -W '{1..9}' -- "$cur" ) )
return 0
;;
- -T)
- COMPREPLY=( $( compgen -W '{1..10}' -- "$cur" ) )
- return 0
- ;;
-N)
COMPREPLY=( $( compgen -W '{-20..19}' -- "$cur" ) )
return 0
;;
-p)
- local var=NPROCESSORS_ONLN
- [[ $OSTYPE == *linux* ]] && var=_$var
- local n=$( getconf $var 2>/dev/null )
- COMPREPLY=( $( compgen -W "{1..${n:-1}}" -- "$cur" ) )
+ COMPREPLY=( $( compgen -W "{1..$(_ncpus)}" -- "$cur" ) )
return 0
;;
esac
diff --git a/completions/lvm b/completions/lvm
index 7b353114..b657e0bd 100644
--- a/completions/lvm
+++ b/completions/lvm
@@ -314,7 +314,7 @@ _vgcreate()
--verbose --version' -- "$cur" ) )
else
_args
- if [ $args -eq 0 ]; then
+ if [[ $args -eq 0 ]]; then
_volumegroups
else
_physicalvolumes
@@ -373,7 +373,7 @@ _vgreduce()
else
_args
- if [ $args -eq 0 ]; then
+ if [[ $args -eq 0 ]]; then
_volumegroups
else
_physicalvolumes
@@ -402,7 +402,7 @@ _vgextend()
COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) )
else
_args
- if [ $args -eq 0 ]; then
+ if [[ $args -eq 0 ]]; then
_volumegroups
else
_physicalvolumes
@@ -686,7 +686,7 @@ _lvcreate()
COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) )
else
_args
- if [ $args -eq 0 ]; then
+ if [[ $args -eq 0 ]]; then
_volumegroups
else
_physicalvolumes
@@ -779,7 +779,7 @@ _lvresize()
COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) )
else
_args
- if [ $args -eq 0 ]; then
+ if [[ $args -eq 0 ]]; then
_logicalvolumes
else
_physicalvolumes
@@ -808,7 +808,7 @@ _lvextend()
COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) )
else
_args
- if [ $args -eq 0 ]; then
+ if [[ $args -eq 0 ]]; then
_logicalvolumes
else
_physicalvolumes
@@ -822,7 +822,7 @@ _lvm()
local cur prev words cword
_init_completion || return
- if [ $cword -eq 1 ]; then
+ if [[ $cword -eq 1 ]]; then
COMPREPLY=( $( compgen -W 'dumpconfig help lvchange \
lvcreate lvdisplay lvextend lvmchange \
lvmdiskscan lvmsadc lvmsar lvreduce \
diff --git a/completions/lzip b/completions/lzip
new file mode 100644
index 00000000..9df55382
--- /dev/null
+++ b/completions/lzip
@@ -0,0 +1,44 @@
+# lzip(1) completion -*- shell-script -*-
+
+_lzip()
+{
+ local cur prev words cword split
+ _init_completion -s || return
+
+ local decompress=false
+
+ case $prev in
+ -h|--help|-V|--version|-b|--member-size|-m|--match-length|\
+ -s|--dictionary-size|-S|--volume-size)
+ return
+ ;;
+ -d|--decompress)
+ decompress=true
+ ;;
+ -o|--output)
+ _filedir
+ return
+ ;;
+ esac
+
+ $split && return
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" ) {-1..-9}' \
+ -- "$cur" ) )
+ 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 lzip
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/make b/completions/make
index d56e1962..399c4b00 100644
--- a/completions/make
+++ b/completions/make
@@ -24,6 +24,10 @@ _make()
--eval|-D|-V|-x)
return 0
;;
+ --jobs|-j)
+ COMPREPLY=( $( compgen -W "{1..$(( $(_ncpus)*2 ))}" -- "$cur" ) )
+ return 0
+ ;;
esac
$split && return 0
@@ -54,8 +58,8 @@ _make()
fi
done
- [ -n "$makef" ] && makef="-f ${makef}"
- [ -n "$makef_dir" ] && makef_dir="-C ${makef_dir}"
+ [[ -n $makef ]] && makef="-f ${makef}"
+ [[ -n $makef_dir ]] && makef_dir="-C ${makef_dir}"
COMPREPLY=( $( compgen -W "$( make -qp $makef $makef_dir 2>/dev/null | \
awk -F':' '/^[a-zA-Z0-9][^$#\/\t=]*:([^=]|$)/ \
diff --git a/completions/man b/completions/man
index 5c134d33..a9de57c4 100644
--- a/completions/man
+++ b/completions/man
@@ -63,7 +63,7 @@ _man()
manpath=$MANPATH
fi
- if [ -z "$manpath" ]; then
+ if [[ -z $manpath ]]; then
COMPREPLY=( $( compgen -c -- "$cur" ) )
return 0
fi
@@ -72,7 +72,7 @@ _man()
[[ "$prev" == $mansect ]] && sect=$prev || sect='*'
manpath=$manpath:
- if [ -n "$cur" ]; then
+ if [[ -n $cur ]]; then
manpath="${manpath//://*man$sect/$cur* } ${manpath//://*cat$sect/$cur* }"
else
manpath="${manpath//://*man$sect/ } ${manpath//://*cat$sect/ }"
diff --git a/completions/minicom b/completions/minicom
index 6bac50ba..cad90926 100644
--- a/completions/minicom
+++ b/completions/minicom
@@ -29,11 +29,10 @@ _minicom()
return 0
else
local confdir
- [ -n "$( command ls /etc/minirc.* 2>/dev/null)" ] \
- && confdir=/etc
- [ -n "$( command ls /etc/minicom/minirc.* 2>/dev/null)" ] \
+ [[ -n $( command ls /etc/minirc.* 2>/dev/null ) ]] && confdir=/etc
+ [[ -n $( command ls /etc/minicom/minirc.* 2>/dev/null ) ]] \
&& confdir=/etc/minicom
- if [ -n "$confdir" ]; then
+ if [[ -n $confdir ]]; then
COMPREPLY=( $( compgen -W '$( printf "%s\n" $confdir/minirc.* | \
sed -e "s|$confdir/minirc.||")' -- "$cur" ) )
return 0
diff --git a/completions/mount b/completions/mount
index 48bc7b03..ffe6629a 100644
--- a/completions/mount
+++ b/completions/mount
@@ -1,79 +1,16 @@
# mount(8) completion -*- shell-script -*-
+
+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.
#
-
-# Just like COMPREPLY=(`compgen -W "${COMPREPLY[*]}" -- "$cur"`), only better!
-#
-# This will correctly escape special characters in COMPREPLY.
-_reply_compgen_array()
-{
- # Create the argument for compgen -W by escaping twice.
- #
- # One round of escape is because we want to reply with escaped arguments. A
- # second round is required because compgen -W will helpfully expand it's
- # argument.
- local i wlist
- for i in ${!COMPREPLY[*]}; do
- local q=$(quote "$(printf %q "${COMPREPLY[$i]}")")
- wlist+=$q$'\n'
- done
-
- # We also have to add another round of escaping to $cur.
- local ecur="$cur"
- ecur="${ecur//\\/\\\\}"
- ecur="${ecur//\'/\'}"
-
- # Actually generate completions.
- local oldifs=$IFS
- IFS=$'\n' eval 'COMPREPLY=(`compgen -W "$wlist" -- "${ecur}"`)'
- IFS=$oldifs
-}
-
-# Unescape strings in the linux fstab(5) format (with octal escapes).
-__linux_fstab_unescape() {
- eval $1="'${!1//\'/\047}'"
- eval $1="'${!1/%\\/\\\\}'"
- eval "$1=$'${!1}'"
-}
-
-# Complete linux fstab entries.
-#
-# Reads a file from stdin in the linux fstab(5) format; as used by /etc/fstab
-# and /proc/mounts.
-_linux_fstab()
-{
- COMPREPLY=()
-
- # Read and unescape values into COMPREPLY
- local fs_spec fs_file fs_other
- local oldifs="$IFS"
- while read -r fs_spec fs_file fs_other; do
- if [[ $fs_spec = [#]* ]]; then continue; fi
- if [[ $1 == -L ]]; then
- local fs_label=${fs_spec/#LABEL=}
- if [[ $fs_label != "$fs_spec" ]]; then
- __linux_fstab_unescape fs_label
- IFS=$'\0'
- COMPREPLY+=("$fs_label")
- IFS=$oldifs
- fi
- else
- __linux_fstab_unescape fs_spec
- __linux_fstab_unescape fs_file
- IFS=$'\0'
- [[ $fs_spec = */* ]] && COMPREPLY+=("$fs_spec")
- [[ $fs_file = */* ]] && COMPREPLY+=("$fs_file")
- IFS=$oldifs
- fi
- done
-
- _reply_compgen_array
-}
-
_mount()
{
local cur prev words cword
@@ -92,7 +29,7 @@ _mount()
if [[ "$cur" == *:* ]]; then
for sm in "$(type -P showmount)" {,/usr}/{,s}bin/showmount; do
- [ -x "$sm" ] || continue
+ [[ -x $sm ]] || continue
COMPREPLY=( $( compgen -W "$( "$sm" -e ${cur%%:*} | \
awk 'NR>1 {print $1}' )" -- "${cur#*:}" ) )
return 0
@@ -102,53 +39,23 @@ _mount()
if [[ "$cur" == //* ]]; then
host=${cur#//}
host=${host%%/*}
- if [ -n "$host" ]; then
+ if [[ -n $host ]]; then
COMPREPLY=( $( compgen -P "//$host" -W \
"$( smbclient -d 0 -NL $host 2>/dev/null |
sed -ne '/^['"$'\t '"']*Sharename/,/^$/p' |
sed -ne '3,$s|^[^A-Za-z]*\([^'"$'\t '"']*\).*$|/\1|p' )" \
-- "${cur#//$host}" ) )
fi
- elif [ -r /etc/vfstab ]; then
+ elif [[ -r /etc/vfstab ]]; then
# Solaris
COMPREPLY=( $( compgen -W "$( awk '! /^[ \t]*#/ {if ($3 ~ /\//) print $3}' /etc/vfstab )" -- "$cur" ) )
- elif [ ! -e /etc/fstab ]; then
+ elif [[ ! -e /etc/fstab ]]; then
# probably Cygwin
COMPREPLY=( $( compgen -W "$( mount | awk '! /^[ \t]*#/ {if ($3 ~ /\//) print $3}' )" -- "$cur" ) )
else
- # probably Linux
- if [ "$prev" = -L ]; then
- _linux_fstab -L < /etc/fstab
- elif [ "$prev" = -U ]; then
- COMPREPLY=( $( compgen -W '$(sed -ne "s/^[[:space:]]*UUID=\([^[:space:]]*\).*/\1/p" /etc/fstab )' -- "$cur" ) )
- else
- _linux_fstab < /etc/fstab
- fi
+ COMPREPLY=( $( compgen -W "$( awk '! /^[ \t]*#/ {if ($3 ~ /\//) print $3}' /etc/fstab )" -- "$cur" ) )
fi
-
- return 0
} &&
complete -F _mount -o default -o dirnames mount
-# umount(8) completion. This relies on the mount point being the third
-# space-delimited field in the output of mount(8)
-#
-_umount()
-{
- local cur prev words cword
- _init_completion || return
-
- if [[ $OSTYPE == *linux* && -r /proc/mounts ]]; then
- # Linux /proc/mounts is properly quoted. This is important when
- # unmounting usb devices with pretty names.
- _linux_fstab < /proc/mounts
- else
- local IFS=$'\n'
- COMPREPLY=( $( compgen -W '$( mount | cut -d" " -f 3 )' -- "$cur" ) )
- fi
-
- return 0
-} &&
-complete -F _umount -o dirnames umount
-
# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/mount.linux b/completions/mount.linux
new file mode 100644
index 00000000..91594449
--- /dev/null
+++ b/completions/mount.linux
@@ -0,0 +1,224 @@
+# mount(8) completion -*- shell-script -*-
+
+_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<fstype>
+ if [[ "$cur" == ?*,* ]]; then
+ prev="${cur%,*}"
+ cur="${cur##*,}"
+ split=true
+ fi
+ COMPREPLY=( $(compgen -W 'auto 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
+ ;;
+ --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<fstype> 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 async {,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
+ sync {,no}user users' -- "$cur") )
+ case "$fstype" in
+ adfs|auto)
+ COMPREPLY+=( $(compgen -W 'uid= gid= {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= 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 ro rw {,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=' \
+ -- "$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 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") )
+ ;;&
+ jfs|auto)
+ COMPREPLY+=( $(compgen -W 'iocharset= resize= {,no}integrity
+ errors= {,no,usr,grp}quota' -- "$cur") )
+ ;;&
+ ntfs-3g)
+ COMPREPLY+=( $(compgen -W '{u,g}id= {u,f,d}mask= usermapping=
+ permissions inherit ro locale= force {,no}recover
+ ignore_case remove_hiberfile {,no,rel}atime 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 inode64
+ {,no}largeio logbufs= logbsize= logdev= rtdev= mtpt= noalign
+ noatime 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 0
+ done
+ fi
+
+ if [[ "$cur" == //* ]]; then
+ host=${cur#//}
+ host=${host%%/*}
+ if [[ -n $host ]]; then
+ COMPREPLY=( $( compgen -P "//$host" -W \
+ "$( smbclient -d 0 -NL $host 2>/dev/null |
+ sed -ne '/^['"$'\t '"']*Sharename/,/^$/p' |
+ sed -ne '3,$s|^[^A-Za-z]*\([^'"$'\t '"']*\).*$|/\1|p' )" \
+ -- "${cur#//$host}" ) )
+ fi
+ fi
+
+ _filedir
+} &&
+complete -F _mount mount
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/mplayer b/completions/mplayer
index cd39d309..be852a5a 100644
--- a/completions/mplayer
+++ b/completions/mplayer
@@ -30,7 +30,7 @@ _mplayer()
return 0
;;
-font|-subfont)
- if [ "$prev" = -font ]; then
+ if [[ $prev == -font ]]; then
_filedir '@(desc|ttf)'
else
_filedir ttf
@@ -67,7 +67,7 @@ _mplayer()
# if you don't have installed mplayer in /usr you
# may want to set the MPLAYER_SKINS_DIR global variable
local -a dirs
- if [ -n "$MPLAYER_SKINS_DIR" ]; then
+ if [[ -n $MPLAYER_SKINS_DIR ]]; then
dirs=($MPLAYER_SKINS_DIR)
else
dirs=(/usr/share/mplayer/skins /usr/local/share/mplayer/skins)
diff --git a/completions/mtx b/completions/mtx
index 0dae92ae..0cb63251 100644
--- a/completions/mtx
+++ b/completions/mtx
@@ -20,7 +20,7 @@ _mtx()
drives=${drives//:Full}
drives=${drives//:Empty}
- if [ $cword -gt 1 ]; then
+ if [[ $cword -gt 1 ]]; then
case $prev in
load)
COMPREPLY=( $( compgen -W "$tapes" -- "$cur" ) )
diff --git a/completions/mutt b/completions/mutt
index 70699a15..acab9c86 100644
--- a/completions/mutt
+++ b/completions/mutt
@@ -21,23 +21,23 @@ _muttrc()
{
# Search COMP_WORDS for '-F muttrc' or '-Fmuttrc' argument
set -- "${words[@]}"
- while [ $# -gt 0 ]; do
- if [ "${1:0:2}" = -F ]; then
- if [ ${#1} -gt 2 ]; then
+ while [[ $# -gt 0 ]]; do
+ if [[ $1 == -F* ]]; then
+ if [[ ${#1} -gt 2 ]]; then
muttrc="$(dequote "${1:2}")"
else
shift
- [ "$1" ] && muttrc="$(dequote "$1")"
+ [[ $1 ]] && muttrc="$(dequote "$1")"
fi
break
fi
shift
done
- if [ -z "$muttrc" ]; then
- if [ -f ~/.${muttcmd}rc ]; then
+ if [[ -z $muttrc ]]; then
+ if [[ -f ~/.${muttcmd}rc ]]; then
muttrc="~/.${muttcmd}rc"
- elif [ -f ~/.${muttcmd}/${muttcmd}rc ]; then
+ elif [[ -f ~/.${muttcmd}/${muttcmd}rc ]]; then
muttrc="~/.${muttcmd}/${muttcmd}rc"
fi
fi
@@ -57,11 +57,10 @@ _muttconffiles()
sofar=" $1 "
shift
while [[ "$1" ]]; do
- newconffiles=( $(sed -n 's|^source[[:space:]]\{1,\}\([^[:space:]]\{1,\}\).*$|\1|p' $(eval echo $1) ) )
+ newconffiles=( $(sed -n 's|^source[[:space:]]\{1,\}\([^[:space:]]\{1,\}\).*$|\1|p' $(eval printf %s $1) ) )
for file in "${newconffiles[@]}"; do
__expand_tilde_by_ref file
- [[ ! -f "$file" || "${sofar/ ${file} / }" != "$sofar" ]] &&
- continue
+ [[ ! -f "$file" || $sofar == *\ $file\ * ]] && continue
sofar+=" $file"
sofar=" $(eval _muttconffiles \"$sofar\" $file) "
done
@@ -78,7 +77,7 @@ _muttaliases()
local -a conffiles aliases
muttrc=$(_muttrc)
- [ -z "$muttrc" ] && return 0
+ [[ -z $muttrc ]] && return 0
conffiles=( $(eval _muttconffiles $muttrc $muttrc) )
aliases=( $( sed -n 's|^alias[[:space:]]\{1,\}\([^[:space:]]\{1,\}\).*$|\1|p' \
@@ -126,10 +125,10 @@ _muttfiledir()
COMPREPLY=( $( compgen -f -- "$folder/${cur:1}" ) )
COMPREPLY=( ${COMPREPLY[@]#$folder/} )
return 0
- elif [ "$cur" == !* ]; then
+ elif [[ $cur == !* ]]; then
spoolfile="$( $muttcmd -F "$muttrc" -Q spoolfile 2>/dev/null | \
sed -e 's|^spoolfile=\"\(.*\)\"$|\1|' )"
- [ ! -z "$spoolfile" ] && eval cur="${cur/^!/$spoolfile}"
+ [[ ! -z $spoolfile ]] && eval cur="${cur/^!/$spoolfile}"
fi
_filedir
diff --git a/completions/mysql b/completions/mysql
index effd313c..c41c1667 100644
--- a/completions/mysql
+++ b/completions/mysql
@@ -20,7 +20,7 @@ _mysql()
return 0
;;
--default-character-set)
- [ -d /usr/share/mysql/charsets ] && \
+ [[ -d /usr/share/mysql/charsets ]] && \
COMPREPLY=( $( compgen -W "$(command ls /usr/share/mysql/charsets|sed -e '/^\(README\|Index\.xml\)$/d' -e 's/.xml$//') utf8" -- "$cur" ) )
return 0
;;
diff --git a/completions/nethogs b/completions/nethogs
new file mode 100644
index 00000000..937edf1f
--- /dev/null
+++ b/completions/nethogs
@@ -0,0 +1,25 @@
+# bash completion for nethogs(8) -*- shell-script -*-
+
+_nethogs()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ case "$prev" in
+ -d)
+ # expect integer value
+ COMPREPLY+=( $( compgen -W '{0..9}' ) )
+ compopt -o nospace
+ return
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '$( _parse_usage "$1" -h )' -- "$cur" ) )
+ return
+ fi
+
+ _available_interfaces -a
+} && complete -F _nethogs nethogs
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/openssl b/completions/openssl
index 68a13c2a..b63d215d 100644
--- a/completions/openssl
+++ b/completions/openssl
@@ -13,14 +13,14 @@ _openssl_sections()
done
# if no config given, check some usual default locations
- if [ -z "$config" ]; then
+ if [[ -z $config ]]; then
for f in /etc/ssl/openssl.cnf /etc/pki/tls/openssl.cnf \
/usr/share/ssl/openssl.cnf; do
- [ -f $f ] && config=$f && break
+ [[ -f $f ]] && config=$f && break
done
fi
- [ ! -f "$config" ] && return 0
+ [[ ! -f $config ]] && return 0
COMPREPLY=( $( compgen -W "$( awk '/\[.*\]/ {print $2}' $config )" \
-- "$cur" ) )
@@ -48,7 +48,7 @@ _openssl()
rc2-40-cbc rc2-64-cbc rc2-cbc rc2-cfb rc2-ecb rc2-ofb rc4 \
rc4-40'
- if [ $cword -eq 1 ]; then
+ if [[ $cword -eq 1 ]]; then
COMPREPLY=( $( compgen -W "$commands" -- "$cur" ) )
else
command=${words[1]}
diff --git a/completions/p4 b/completions/p4
index 59d1bcd9..d0d984b2 100644
--- a/completions/p4
+++ b/completions/p4
@@ -14,9 +14,9 @@ _p4()
uresource uxbinary xbinary xltext xtempobj xtext \
text binary resource"
- if [ $cword -eq 1 ]; then
+ if [[ $cword -eq 1 ]]; then
COMPREPLY=( $( compgen -W "$p4commands" -- "$cur" ) )
- elif [ $cword -eq 2 ]; then
+ elif [[ $cword -eq 2 ]]; then
case $prev in
help)
COMPREPLY=( $( compgen -W "simple commands \
@@ -29,7 +29,7 @@ _p4()
*)
;;
esac
- elif [ $cword -gt 2 ]; then
+ elif [[ $cword -gt 2 ]]; then
case $prev in
-t)
case ${words[$cword-2]} in
diff --git a/completions/perl b/completions/perl
index a67c7699..8b296377 100644
--- a/completions/perl
+++ b/completions/perl
@@ -99,16 +99,22 @@ _perldoc()
local perl="${1%doc}"
[[ $perl == $1 ]] || ! type $perl &>/dev/null && perl=
- # complete builtin perl functions
case $prev in
+ -h|-V|-n|-o|-M|-w|-L)
+ return 0
+ ;;
+ -d)
+ _filedir
+ return 0
+ ;;
-f)
_perlfunctions $perl
- return 0
+ return 0
;;
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-h -v -t -u -m -l -F -X -f -q' -- "$cur" ))
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" -h )' -- "$cur" ) )
else
# return available modules (unless it is clearly a file)
if [[ "$cur" != @(*/|[.~])* ]]; then
diff --git a/completions/pgrep b/completions/pgrep
index 9e66fb95..0a1c862f 100644
--- a/completions/pgrep
+++ b/completions/pgrep
@@ -1,4 +1,4 @@
-# pgrep(1) completion -*- shell-script -*-
+# pgrep(1) and pkill(1) completion -*- shell-script -*-
_pgrep()
{
@@ -6,13 +6,21 @@ _pgrep()
_init_completion || return
case $prev in
- -d|-g|-s|-t)
+ -c|-d|-g|-J|-M|-N|-s|-t|-T|-z)
+ return
+ ;;
+ -F)
+ _filedir
return
;;
-G)
_gids
return
;;
+ -j)
+ COMPREPLY=( $( compgen -W 'any none' -- "$cur" ) )
+ return
+ ;;
-P)
_pids
return
@@ -24,15 +32,15 @@ _pgrep()
esac
if [[ $cur == -* ]]; then
- COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( "$1" --usage 2>&1 |
+ sed -e "s/\[-signal\]//" -e "s/\[-SIGNAL\]//" |
+ _parse_usage - )' -- "$cur" ) )
+ [[ $cword -eq 1 && $1 == *pkill ]] && _signals -
return
fi
_pnames
} &&
-complete -F _pgrep pgrep
-
-# Linux pidof(8) completion.
-[[ $OSTYPE == *linux* ]] && complete -F _pgrep pidof
+complete -F _pgrep pgrep pkill
# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/pidof b/completions/pidof
new file mode 100644
index 00000000..12ac9a79
--- /dev/null
+++ b/completions/pidof
@@ -0,0 +1,19 @@
+# pidof(8) completion -*- shell-script -*-
+
+_pidof()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ case $prev in
+ -o)
+ _pids
+ return
+ ;;
+ esac
+
+ _pnames
+} &&
+complete -F _pidof pidof
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/plague-client b/completions/plague-client
new file mode 100644
index 00000000..b5385467
--- /dev/null
+++ b/completions/plague-client
@@ -0,0 +1,14 @@
+# bash completion for plague-client -*- shell-script -*-
+
+_plague_client()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ [[ $cword -eq 1 ]] && \
+ COMPREPLY=( $( compgen -W 'build detail finish help is_paused kill list
+ list_builders pause requeue unpause update_builders' -- "$cur" ) )
+} &&
+complete -F _plague_client plague-client
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/povray b/completions/povray
index e5ef9df6..fa2f9812 100644
--- a/completions/povray
+++ b/completions/povray
@@ -40,7 +40,7 @@ _povray()
*.ini\[|*.ini\[*[^]]) # sections in .ini files
cur="${povcur#*\[}"
pfx="${povcur%\["$cur"}" # prefix == filename
- [ -r "$pfx" ] || return 0
+ [[ -r $pfx ]] || return 0
COMPREPLY=( $(sed -e 's/^[[:space:]]*\[\('"$cur"'[^]]*\]\).*$/\1/' \
-e 't' -e 'd' -- "$pfx") )
# to prevent [bar] expand to nothing. can be done more easily?
diff --git a/completions/psql b/completions/psql
index 7e4276bc..186177a3 100644
--- a/completions/psql
+++ b/completions/psql
@@ -13,7 +13,7 @@ _pg_users()
# -w was introduced in 8.4, https://launchpad.net/bugs/164772
COMPREPLY=( $( compgen -W "$( psql -Atqwc 'select usename from pg_user' \
template1 2>/dev/null )" -- "$cur" ) )
- [ ${#COMPREPLY[@]} -eq 0 ] && COMPREPLY=( $( compgen -u -- "$cur" ) )
+ [[ ${#COMPREPLY[@]} -eq 0 ]] && COMPREPLY=( $( compgen -u -- "$cur" ) )
}
# createdb(1) completion
diff --git a/completions/puppet b/completions/puppet
index 776c8492..66a81b3b 100644
--- a/completions/puppet
+++ b/completions/puppet
@@ -2,7 +2,7 @@
_puppet_logdest()
{
- if [ -z "$cur" ]; then
+ if [[ -z $cur ]]; then
COMPREPLY=( $( compgen -W 'syslog console /' -- "$cur" ) )
else
COMPREPLY=( $( compgen -W 'syslog console' -- "$cur" ) )
diff --git a/completions/qdbus b/completions/qdbus
index 5ed6bf89..a098fbc9 100644
--- a/completions/qdbus
+++ b/completions/qdbus
@@ -5,7 +5,7 @@ _qdbus()
local cur prev words cword
_init_completion || return
- [ -n "$cur" ] && unset words[${#words[@]}-1]
+ [[ -n $cur ]] && unset words[${#words[@]}-1]
COMPREPLY=( $( compgen -W '$( command ${words[@]} 2>/dev/null | \
sed s/\(.*\)// )' -- "$cur" ) )
} &&
diff --git a/completions/rcs b/completions/rcs
index a8eac85b..67c1c9d8 100644
--- a/completions/rcs
+++ b/completions/rcs
@@ -11,7 +11,7 @@ _rcs()
dir=${cur%/*}
# deal with relative directory
- [ "$file" = "$dir" ] && dir=.
+ [[ $file == $dir ]] && dir=.
COMPREPLY=( $( compgen -f "$dir/RCS/$file" ) )
diff --git a/completions/removepkg b/completions/removepkg
index 5b3d8273..287952cb 100644
--- a/completions/removepkg
+++ b/completions/removepkg
@@ -5,13 +5,17 @@ _removepkg()
local cur prev words cword
_init_completion || return
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-copy -keep -preserve -warn' \
- -- "$cur" ) )
- return 0
+ COMPREPLY=( $( compgen -W '-copy -keep -preserve -warn' -- "$cur" ) )
+ return
+ fi
+
+ if [[ "$cur" == */* ]]; then
+ _filedir
+ return
fi
local root=${ROOT:-/}
- COMPREPLY=( $( cd "$root/var/log/packages" 2> /dev/null || return 1 ; \
+ COMPREPLY=( $( cd "$root/var/log/packages" 2> /dev/null || return 1; \
compgen -f -- "$cur" ) )
} &&
complete -F _removepkg removepkg
diff --git a/completions/ri b/completions/ri
index 70756325..43f6408a 100644
--- a/completions/ri
+++ b/completions/ri
@@ -5,10 +5,10 @@ ri_get_methods()
{
local regex
- if [ "$ri_version" = integrated ]; then
- if [ -z "$separator" ]; then
+ if [[ $ri_version == integrated ]]; then
+ if [[ -z $separator ]]; then
regex="(Instance|Class)"
- elif [ "$separator" = "#" ]; then
+ elif [[ $separator == "#" ]]; then
regex=Instance
else
regex=Class
@@ -45,7 +45,7 @@ _ri()
# -W0 is required here to stop warnings from older versions of ri
# from being captured when used with Ruby 1.8.1 and later
ri_version="$(ruby -W0 $ri_path -v 2>&1)" || ri_version=integrated
- [ "$ri_version" != "${ri_version%200*}" ] && ri_version=integrated
+ [[ $ri_version != ${ri_version%200*} ]] && ri_version=integrated
# need to also split on commas
IFS=$', \n\t'
@@ -60,11 +60,11 @@ _ri()
return 0
fi
- if [ "$ri_version" = integrated ]; then
+ if [[ $ri_version == integrated ]]; then
# integrated ri from Ruby 1.9
classes=( $( ri -c 2>/dev/null | ruby -ne 'if /^\s*$/..$stdin.eof then \
if /, [A-Z]+/ then print; end; end' 2>/dev/null ) )
- elif [ "$ri_version" = "ri 1.8a" ]; then
+ elif [[ $ri_version == "ri 1.8a" ]]; then
classes=( $( ruby -W0 $ri_path | \
ruby -ne 'if /^'"'"'ri'"'"' has/..$stdin.eof then \
if /^ .*[A-Z]/ then print; end; end' ))
diff --git a/completions/route b/completions/route
index 14fc2599..40d4f490 100644
--- a/completions/route
+++ b/completions/route
@@ -7,7 +7,7 @@ _route()
local cur prev words cword
_init_completion || return
- if [ "$prev" = dev ]; then
+ if [[ $prev == dev ]]; then
_available_interfaces
return 0
fi
@@ -18,7 +18,7 @@ _route()
dyn reinstate dev default gw; do
found=false
for (( i=1; i < ${#words[@]}-1; i++ )); do
- [ "${words[i]}" = "$opt" ] && found=true && break
+ [[ ${words[i]} == $opt ]] && found=true && break
done
$found || COMPREPLY[${#COMPREPLY[@]}]="$opt"
done
diff --git a/completions/rpcdebug b/completions/rpcdebug
index 6d4acf52..3501af13 100644
--- a/completions/rpcdebug
+++ b/completions/rpcdebug
@@ -11,7 +11,7 @@ _rpcdebug_flags()
fi
done
- if [ -n "$module" ]; then
+ if [[ -n $module ]]; then
COMPREPLY=( $( compgen -W "$( rpcdebug -vh 2>&1 | \
sed -ne 's/^'$module'[[:space:]]\{1,\}//p' )" -- "$cur" ) )
fi
diff --git a/completions/rpm b/completions/rpm
index c7e67705..b7b59e0e 100644
--- a/completions/rpm
+++ b/completions/rpm
@@ -48,12 +48,12 @@ _rpm()
local cur prev words cword split
_init_completion -s || return
- if [ $cword -eq 1 ]; then
+ if [[ $cword -eq 1 ]]; then
# first parameter on line
case $cur in
--*)
COMPREPLY=( $( compgen -W '--help --version --initdb \
- --checksig --resign --addsign --rebuilddb --showrc \
+ --checksig --addsign --delsign --rebuilddb --showrc \
--setperms --setugids --eval --install --upgrade --query \
--freshen --erase --verify --querytags --import' \
-- "$cur" ) )
@@ -67,7 +67,7 @@ _rpm()
fi
case $prev in
- --dbpath|--excludepath|--prefix|--relocate|--root)
+ --dbpath|--excludepath|--prefix|--relocate|--root|-r)
_filedir -d
return 0
;;
@@ -214,7 +214,7 @@ _rpm()
_rpm_installed_packages $1
fi
;;
- --resign|--addsign)
+ --resign|--addsign|--delsign)
_filedir '[rs]pm'
;;
--setperms|--setgids)
diff --git a/completions/rpm2tgz b/completions/rpm2tgz
index 0b4510c7..34e54a5a 100644
--- a/completions/rpm2tgz
+++ b/completions/rpm2tgz
@@ -7,10 +7,10 @@ _rpm2tgz()
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-s -S -n -r -d -c' -- "$cur" ) )
- return 0
+ return
fi
- COMPREPLY=( $(compgen -f -X "!*.rpm" -- "$cur") )
-} && complete -F _rpm2tgz -o plusdirs rpm2tgz rpm2txz rpm2targz
+ _filedir "rpm"
+} && complete -F _rpm2tgz rpm2tgz rpm2txz rpm2targz
# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/rrdtool b/completions/rrdtool
index 9280d8f5..8170c9fe 100644
--- a/completions/rrdtool
+++ b/completions/rrdtool
@@ -5,7 +5,7 @@ _rrdtool ()
local cur prev words cword
_init_completion || return
- if [ ${#words[@]} -eq 2 ]; then
+ if [[ ${#words[@]} -eq 2 ]]; then
COMPREPLY=( $( compgen -W 'create update updatev graph dump restore \
last lastupdate first info fetch tune resize xport' -- "$cur" ) )
else
diff --git a/completions/rsync b/completions/rsync
index e8b75b1a..e3f0f10e 100644
--- a/completions/rsync
+++ b/completions/rsync
@@ -74,7 +74,7 @@ _rsync()
break
fi
done
- [ "$shell" = ssh ] && _xfunc ssh _scp_remote_files
+ [[ $shell == ssh ]] && _xfunc ssh _scp_remote_files
;;
*)
_known_hosts_real -c -a "$cur"
diff --git a/completions/sbopkg b/completions/sbopkg
index 647355b0..0c812faa 100644
--- a/completions/sbopkg
+++ b/completions/sbopkg
@@ -6,33 +6,33 @@ _sbopkg()
_init_completion || return
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-b -c -d -e -f -g -h -i -k -l \
- -o -P -p -q -R -r -s -u -V -v' -- "$cur" ) )
- return 0
+ COMPREPLY=( $( compgen -W '-b -c -d -e -f -g -h -i -k -l -o
+ -P -p -q -R -r -s -u -V -v' -- "$cur" ) )
+ return
fi
case "$prev" in
-e)
COMPREPLY=( $( compgen -W 'ask continue stop' -- "$cur" ) )
- return 0
+ return
;;
-f)
_filedir
- return 0
+ return
;;
-d)
_filedir -d
- return 0
+ return
;;
-V)
COMPREPLY=( $( compgen -W "? \
- $(sbopkg -V ? 2>&1 | cut -s -f1)" -- "$cur" ) )
- return 0
+ $( sbopkg -V ? 2>&1 | cut -s -f1 )" -- "$cur" ) )
+ return
;;
-i|-b)
;;
*)
- return 0
+ return
;;
esac
@@ -45,8 +45,8 @@ _sbopkg()
fi
done
- if [ ! -r "$config" ]; then
- return 0
+ if [[ ! -r "$config" ]]; then
+ return
fi
. $config
@@ -63,8 +63,8 @@ _sbopkg()
esac
done
- if [ ! -r "$REPO_ROOT/$REPO_NAME/$REPO_BRANCH/SLACKBUILDS.TXT" ]; then
- return 0
+ if [[ ! -r $REPO_ROOT/$REPO_NAME/$REPO_BRANCH/SLACKBUILDS.TXT ]]; then
+ return
fi
COMPREPLY=( $( sed -ne "/^SLACKBUILD NAME: $cur/{s/^SLACKBUILD NAME: //;p}"\
$REPO_ROOT/$REPO_NAME/$REPO_BRANCH/SLACKBUILDS.TXT )
diff --git a/completions/service b/completions/service
deleted file mode 100644
index f008770e..00000000
--- a/completions/service
+++ /dev/null
@@ -1,34 +0,0 @@
-# service(8) and /etc/init.d/* completion -*- shell-script -*-
-
-# This completes on a list of all available service scripts for the
-# 'service' command and/or the SysV init.d directory, followed by
-# that script's available commands
-
-_service()
-{
- local cur prev words cword
- _init_completion || return
-
- # don't complete past 2nd token
- [ $cword -gt 2 ] && return 0
-
- if [[ $cword -eq 1 && $prev == ?(*/)service ]]; then
- _services
- else
- local sysvdir
- [ -d /etc/rc.d/init.d ] && \
- sysvdir=/etc/rc.d/init.d || sysvdir=/etc/init.d
- COMPREPLY=( $( compgen -W '`sed -e "y/|/ /" \
- -ne "s/^.*\(U\|msg_u\)sage.*{\(.*\)}.*$/\2/p" \
- $sysvdir/${prev##*/} 2>/dev/null` start stop' -- "$cur" ) )
- fi
-
- return 0
-} &&
-complete -F _service service
-for svc in /etc/init.d/!($_backup_glob) /etc/rc.d/init.d/!($_backup_glob); do
- [ -x "$svc" ] && complete -F _service $svc
-done
-unset svc
-
-# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/sitecopy b/completions/sitecopy
index 1f18514a..12480e97 100644
--- a/completions/sitecopy
+++ b/completions/sitecopy
@@ -40,7 +40,7 @@ _sitecopy()
;;
esac
- if [ -r ~/.sitecopyrc ]; then
+ if [[ -r ~/.sitecopyrc ]]; then
COMPREPLY=( $( compgen -W "$($1 -v | \
command sed -n '/^Site:/s/Site: //p')" -- "$cur" ) )
fi
diff --git a/completions/slackpkg b/completions/slackpkg
index 1d5759cb..b4223e71 100644
--- a/completions/slackpkg
+++ b/completions/slackpkg
@@ -17,34 +17,34 @@ _slackpkg()
-delall|-checkmd5|-checkgpg|-checksize|-postinst|-onoff|-download_all|\
-dialog|-batch|-only_new_dotnew|-use_includes|-spinning)
COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) )
- return 0
+ return
;;
-default_answer)
COMPREPLY=( $( compgen -W 'yes no' -- "$cur" ) )
- return 0
+ return
;;
-dialog_maxargs|-mirror)
# argument required but no completions available
- return 0
+ return
;;
esac
- $split && return 0
+ $split && return
if [[ "$cur" == -* ]]; then
compopt -o nospace
- COMPREPLY=( $( compgen -W '-delall= -checkmd5= -checkgpg= \
- -checksize= -postinst= -onoff= -download_all= -dialog= \
- -dialog_maxargs= -batch= -only_new_dotnew= -use_includes= \
+ COMPREPLY=( $( compgen -W '-delall= -checkmd5= -checkgpg=
+ -checksize= -postinst= -onoff= -download_all= -dialog=
+ -dialog_maxargs= -batch= -only_new_dotnew= -use_includes=
-spinning= -default_answer= -mirror=' -- "$cur" ) )
- return 0
+ return
fi
local confdir="/etc/slackpkg"
local config="$confdir/slackpkg.conf"
- if [ ! -r "$config" ]; then
- return 0
+ if [[ ! -r "$config" ]]; then
+ return
fi
. "$config"
@@ -59,47 +59,47 @@ _slackpkg()
case "$action" in
generate-template|search|file-search)
# argument required but no completions available
- return 0
+ return
;;
install-template|remove-template)
- if [ -e "$confdir/templates" ]; then
+ if [[ -e $confdir/templates ]]; then
COMPREPLY=( $( cd "$confdir/templates"; \
compgen -f -X "!*.template" -- "$cur" ) )
COMPREPLY=( ${COMPREPLY[@]%.template} )
fi
- return 0
+ return
;;
remove)
_filedir
- COMPREPLY+=( $( compgen -W 'a ap d e f k kde kdei l n t tcl x \
+ COMPREPLY+=( $( compgen -W 'a ap d e f k kde kdei l n t tcl x
xap y' -- "$cur" ) )
COMPREPLY+=( $( cd /var/log/packages; compgen -f -- "$cur" ) )
- return 0
+ return
;;
install|reinstall|upgrade|blacklist|download)
_filedir
- COMPREPLY+=( $( compgen -W 'a ap d e f k kde kdei l n t tcl x \
+ COMPREPLY+=( $( compgen -W 'a ap d e f k kde kdei l n t tcl x
xap y' -- "$cur" ) )
- COMPREPLY+=( $( cut -f 6 -d\ ${WORKDIR}/pkglist 2> /dev/null | \
+ COMPREPLY+=( $( cut -f 6 -d\ "${WORKDIR}/pkglist" 2> /dev/null | \
grep "^$cur" ) )
- return 0
+ return
;;
info)
- COMPREPLY+=( $( cut -f 6 -d\ ${WORKDIR}/pkglist 2> /dev/null | \
+ COMPREPLY=( $( cut -f 6 -d\ "${WORKDIR}/pkglist" 2> /dev/null | \
grep "^$cur" ) )
- return 0
+ return
;;
update)
# we should complete the same as the next `list` + "gpg"
COMPREPLY=( $( compgen -W 'gpg' -- "$cur" ) )
;&
*)
- COMPREPLY+=( $( compgen -W 'install reinstall upgrade remove \
- blacklist download update install-new upgrade-all \
- clean-system new-config check-updates help generate-template \
+ COMPREPLY+=( $( compgen -W 'install reinstall upgrade remove
+ blacklist download update install-new upgrade-all
+ clean-system new-config check-updates help generate-template
install-template remove-template search file-search info' -- \
"$cur" ) )
- return 0
+ return
;;
esac
diff --git a/completions/slapt-get b/completions/slapt-get
index 99b50384..02f007ec 100644
--- a/completions/slapt-get
+++ b/completions/slapt-get
@@ -8,18 +8,18 @@ _slapt_get()
case "$prev" in
--config|-c)
_filedir
- return 0
+ return
;;
--retry|--search)
# argument required but no completions available
- return 0
+ return
;;
esac
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '$( _parse_help "$1" --help )' -- "$cur" ) )
[[ $COMPREPLY == *= ]] && compopt -o nospace
- [[ $COMPREPLY ]] && return 0
+ [[ $COMPREPLY ]] && return
fi
local i t
@@ -48,7 +48,7 @@ _slapt_get()
break
fi
done
- if [ ! -r "$config" ]; then
+ if [[ ! -r "$config" ]]; then
return
fi
@@ -59,21 +59,21 @@ _slapt_get()
local name=${cur%%-*}
COMPREPLY=( $( slapt-get -c $config --search "^$name" 2>/dev/null |\
sed -ne "/^$cur/{s/ .*$//;p}" ) )
- return 0
+ return
;;
avl) # --install|-i|
COMPREPLY=( $( slapt-get -c $config --available 2>/dev/null | \
- sed -ne "/^$cur/{s/ .*$//;p}") )
- return 0
+ sed -ne "/^$cur/{s/ .*$//;p}" ) )
+ return
;;
ins) # --remove|--filelist
COMPREPLY=( $( cd /var/log/packages; compgen -f -- "$cur" ) )
- return 0
+ return
;;
set) # --install-set
- COMPREPLY=( $( compgen -W 'a ap d e f k kde kdei l n t tcl x \
+ COMPREPLY=( $( compgen -W 'a ap d e f k kde kdei l n t tcl x
xap y' -- "$cur" ) )
- return 0
+ return
;;
esac
} && complete -F _slapt_get slapt-get
diff --git a/completions/slapt-src b/completions/slapt-src
index 976ef65e..6234eaa8 100644
--- a/completions/slapt-src
+++ b/completions/slapt-src
@@ -8,18 +8,18 @@ _slapt_src()
case "$prev" in
--config|-c)
_filedir
- return 0
+ return
;;
--search|-s|--postprocess|-p)
# argument required but no completions available
- return 0
+ return
;;
esac
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '$( _parse_help "$1" --help )' -- "$cur" ) )
[[ $COMPREPLY == *= ]] && compopt -o nospace
- [[ $COMPREPLY ]] && return 0
+ [[ $COMPREPLY ]] && return
fi
local i t
@@ -30,8 +30,8 @@ _slapt_src()
break
fi
done
- if [ "$t" != "all" ]; then
- return 0
+ if [[ $t != all ]]; then
+ return
fi
local config="/etc/slapt-get/slapt-srcrc" # default config location
@@ -42,18 +42,18 @@ _slapt_src()
break
fi
done
- if [ ! -r "$config" ]; then
- return 0
+ if [[ ! -r "$config" ]]; then
+ return
fi
if [[ "$cur" == *:* ]]; then
local name=${cur%:*}
local version=${cur##*:}
- COMPREPLY=( $( slapt-src --config $config --search "^$name" 2> \
+ COMPREPLY=( $( slapt-src --config "$config" --search "^$name" 2> \
/dev/null | sed -ne "/^$cur/{s/^$name:\([^ ]*\) .*$/\1/;p}" ) )
else
- COMPREPLY=( $( slapt-src --config $config --search "^$cur" 2>/dev/null \
- | sed -ne "/^$cur/{s/ .*$//;p}" ) )
+ COMPREPLY=( $( slapt-src --config "$config" --search "^$cur" 2> \
+ /dev/null | sed -ne "/^$cur/{s/ .*$//;p}" ) )
fi
} && complete -F _slapt_src slapt-src
diff --git a/completions/smbclient b/completions/smbclient
index ceda7bbf..b7371907 100644
--- a/completions/smbclient
+++ b/completions/smbclient
@@ -7,14 +7,14 @@ _samba_resolve_order()
_samba_domains()
{
- if [ -n "${COMP_SAMBA_SCAN:-}" ]; then
+ if [[ -n ${COMP_SAMBA_SCAN:-} ]]; then
COMPREPLY=( $( compgen -W '$( smbtree -N -D )' -- "$cur" ) )
fi
}
_samba_hosts()
{
- if [ -n "${COMP_SAMBA_SCAN:-}" ]; then
+ if [[ -n ${COMP_SAMBA_SCAN:-} ]]; then
COMPREPLY=( $( compgen -W "$( smbtree -N -S | \
sed -ne 's/^[[:space:]]*\\\\*\([^[:space:]]*\).*/\1/p' \
)" -- $cur ) )
diff --git a/completions/sqlite3 b/completions/sqlite3
index 1207823d..e97c2e9e 100644
--- a/completions/sqlite3
+++ b/completions/sqlite3
@@ -18,9 +18,7 @@ _sqlite3()
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-help -init -echo -header -noheader -bail
- -interactive -batch -column -csv -html -line -list -separator
- -nullvalue -version' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" -help )' -- "$cur" ) )
return 0
fi
diff --git a/completions/ssh b/completions/ssh
index e30b9153..a18ba494 100644
--- a/completions/ssh
+++ b/completions/ssh
@@ -157,20 +157,20 @@ _ssh()
else
# Search COMP_WORDS for '-F configfile' or '-Fconfigfile' argument
set -- "${words[@]}"
- while [ $# -gt 0 ]; do
- if [ "${1:0:2}" = -F ]; then
- if [ ${#1} -gt 2 ]; then
+ while [[ $# -gt 0 ]]; do
+ if [[ $1 == -F* ]]; then
+ if [[ ${#1} -gt 2 ]]; then
configfile="$(dequote "${1:2}")"
else
shift
- [ "$1" ] && configfile="$(dequote "$1")"
+ [[ $1 ]] && configfile="$(dequote "$1")"
fi
break
fi
shift
done
_known_hosts_real -a -F "$configfile" "$cur"
- if [ $cword -ne 1 ]; then
+ if [[ $cword -ne 1 ]]; then
compopt -o filenames
COMPREPLY+=( $( compgen -c -- "$cur" ) )
fi
@@ -220,13 +220,13 @@ _sftp()
else
# Search COMP_WORDS for '-F configfile' argument
set -- "${words[@]}"
- while [ $# -gt 0 ]; do
- if [ "${1:0:2}" = -F ]; then
- if [ ${#1} -gt 2 ]; then
+ while [[ $# -gt 0 ]]; do
+ if [[ $1 == -F* ]]; then
+ if [[ ${#1} -gt 2 ]]; then
configfile="$(dequote "${1:2}")"
else
shift
- [ "$1" ] && configfile="$(dequote "$1")"
+ [[ $1 ]] && configfile="$(dequote "$1")"
fi
break
fi
@@ -258,12 +258,12 @@ _scp_remote_files()
path=$( sed -e 's/\\\\\\\('$_scp_path_esc'\)/\\\1/g' <<<"$path" )
# default to home dir of specified user on remote host
- if [ -z "$path" ]; then
+ if [[ -z $path ]]; then
path=$(ssh -o 'Batchmode yes' $userhost pwd 2>/dev/null)
fi
local files
- if [ "$1" = -d ] ; then
+ if [[ $1 == -d ]]; then
# escape problematic characters; remove non-dirs
files=$( ssh -o 'Batchmode yes' $userhost \
command ls -aF1d "$path*" 2>/dev/null | \
@@ -288,7 +288,7 @@ _scp_local_files()
local IFS=$'\n'
local dirsonly=false
- if [ "$1" = -d ]; then
+ if [[ $1 == -d ]]; then
dirsonly=true
shift
fi
@@ -350,13 +350,13 @@ _scp()
else
# Search COMP_WORDS for '-F configfile' or '-Fconfigfile' argument
set -- "${words[@]}"
- while [ $# -gt 0 ]; do
- if [ "${1:0:2}" = -F ]; then
- if [ ${#1} -gt 2 ]; then
+ while [[ $# -gt 0 ]]; do
+ if [[ $1 == -F* ]]; then
+ if [[ ${#1} -gt 2 ]]; then
configfile="$(dequote "${1:2}")"
else
shift
- [ "$1" ] && configfile="$(dequote "$1")"
+ [[ $1 ]] && configfile="$(dequote "$1")"
fi
break
fi
diff --git a/completions/strace b/completions/strace
index 0ac4163a..9d28a54e 100644
--- a/completions/strace
+++ b/completions/strace
@@ -21,7 +21,7 @@ _strace()
break
done
- if [ $offset -gt 0 ]; then
+ if [[ $offset -gt 0 ]]; then
_command_offset $offset
else
diff --git a/completions/tar b/completions/tar
index 9d1c56a4..45f3ff36 100644
--- a/completions/tar
+++ b/completions/tar
@@ -7,7 +7,7 @@ _tar()
local ext regex tar untar
- if [ $cword -eq 1 ]; then
+ if [[ $cword -eq 1 ]]; then
COMPREPLY=( $( compgen -W 'c t x u r d A' -- "$cur" ) )
return 0
fi
diff --git a/completions/udevadm b/completions/udevadm
new file mode 100644
index 00000000..e8db7142
--- /dev/null
+++ b/completions/udevadm
@@ -0,0 +1,76 @@
+# udevadm(8) completion -*- shell-script -*-
+
+_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 [[ -z $udevcmd ]]; then
+ case $cur in
+ -*)
+ COMPREPLY=( $( compgen -W '--help --version --debug' -- \
+ "$cur" ) )
+ ;;
+ *)
+ COMPREPLY=( $( compgen -W "$( "$1" --help 2>/dev/null |
+ awk '/^[[:space:]]+/ { 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: ts=4 sw=4 et filetype=sh
diff --git a/completions/umount b/completions/umount
new file mode 100644
index 00000000..6c15182b
--- /dev/null
+++ b/completions/umount
@@ -0,0 +1,21 @@
+# umount(8) completion -*- shell-script -*-
+
+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: ts=4 sw=4 et filetype=sh
diff --git a/completions/umount.linux b/completions/umount.linux
new file mode 100644
index 00000000..97231807
--- /dev/null
+++ b/completions/umount.linux
@@ -0,0 +1,140 @@
+# umount(8) completion -*- shell-script -*-
+
+# Just like COMPREPLY=(`compgen -W "${COMPREPLY[*]}" -- "$cur"`), only better!
+#
+# This will correctly escape special characters in COMPREPLY.
+_reply_compgen_array()
+{
+ # Create the argument for compgen -W by escaping twice.
+ #
+ # One round of escape is because we want to reply with escaped arguments. A
+ # second round is required because compgen -W will helpfully expand it's
+ # argument.
+ local i wlist
+ for i in ${!COMPREPLY[*]}; do
+ local q=$(quote "$(printf %q "${COMPREPLY[$i]}")")
+ wlist+=$q$'\n'
+ done
+
+ # We also have to add another round of escaping to $cur.
+ local ecur="$cur"
+ ecur="${ecur//\\/\\\\}"
+ ecur="${ecur//\'/\'}"
+
+ # Actually generate completions.
+ local oldifs=$IFS
+ IFS=$'\n' eval 'COMPREPLY=(`compgen -W "$wlist" -- "${ecur}"`)'
+ IFS=$oldifs
+}
+
+# Unescape strings in the linux fstab(5) format (with octal escapes).
+__linux_fstab_unescape() {
+ eval $1="'${!1//\'/\047}'"
+ eval $1="'${!1/%\\/\\\\}'"
+ eval "$1=$'${!1}'"
+}
+
+# Complete linux fstab entries.
+#
+# Reads a file from stdin in the linux fstab(5) format; as used by /etc/fstab
+# and /proc/mounts.
+_linux_fstab()
+{
+ COMPREPLY=()
+
+ # Read and unescape values into COMPREPLY
+ local fs_spec fs_file fs_other
+ local oldifs="$IFS"
+ while read -r fs_spec fs_file fs_other; do
+ if [[ $fs_spec = [#]* ]]; then continue; fi
+ if [[ $1 == -L ]]; then
+ local fs_label=${fs_spec/#LABEL=}
+ if [[ $fs_label != "$fs_spec" ]]; then
+ __linux_fstab_unescape fs_label
+ IFS=$'\0'
+ COMPREPLY+=("$fs_label")
+ IFS=$oldifs
+ fi
+ else
+ __linux_fstab_unescape fs_spec
+ __linux_fstab_unescape fs_file
+ IFS=$'\0'
+ [[ $fs_spec = */* ]] && COMPREPLY+=("$fs_spec")
+ [[ $fs_file = */* ]] && COMPREPLY+=("$fs_file")
+ IFS=$oldifs
+ fi
+ done
+
+ # 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 n=${#COMPREPLY[@]}
+ for (( i=0; i < $n; i++ )); 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<fstype>
+ 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 < /proc/mounts
+ else
+ local IFS=$'\n'
+ COMPREPLY=( $( compgen -W '$( mount | cut -d" " -f 3 )' -- "$cur" ) )
+ fi
+} &&
+complete -F _umount -o dirnames umount
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/unace b/completions/unace
index 4ce5e370..369417ce 100644
--- a/completions/unace
+++ b/completions/unace
@@ -5,10 +5,10 @@ _unace()
local cur prev words cword
_init_completion || return
- if [[ "$cur" == -* ]] ; then
+ if [[ $cur == -* ]]; then
COMPREPLY=( $( compgen -W '-c -c- -f -f- -o -o- -p -y -y-' -- "$cur" ) )
else
- if [ $cword -eq 1 ]; then
+ if [[ $cword -eq 1 ]]; then
COMPREPLY=( $( compgen -W 'e l t v x' -- "$cur" ) )
else
_filedir ace
diff --git a/completions/unrar b/completions/unrar
index d99e62fe..67a316ff 100644
--- a/completions/unrar
+++ b/completions/unrar
@@ -5,12 +5,12 @@ _unrar()
local cur prev words cword
_init_completion || return
- if [[ "$cur" == -* ]] ; then
+ if [[ $cur == -* ]]; then
COMPREPLY=( $( compgen -W '-ad -ap -av- -c- -cfg- -cl -cu \
-dh -ep -f -idp -ierr -inul -kb -o+ -o- -ow -p -p- -r -ta \
-tb -tn -to -u -v -ver -vp -x -x@ -y' -- "$cur" ) )
else
- if [ $cword -eq 1 ]; then
+ if [[ $cword -eq 1 ]]; then
COMPREPLY=( $( compgen -W 'e l lb lt p t v vb vt x' -- "$cur" ) )
else
_filedir rar
diff --git a/completions/update-alternatives b/completions/update-alternatives
index 523e1de5..051b1142 100644
--- a/completions/update-alternatives
+++ b/completions/update-alternatives
@@ -5,7 +5,7 @@ _installed_alternatives()
local admindir
# find the admin dir
for i in alternatives dpkg/alternatives rpm/alternatives; do
- [ -d /var/lib/$i ] && admindir=/var/lib/$i && break
+ [[ -d /var/lib/$i ]] && admindir=/var/lib/$i && break
done
for (( i=1; i < cword; i++ )); do
if [[ "${words[i]}" == --admindir ]]; then
diff --git a/completions/update-rc.d b/completions/update-rc.d
index b1d21e86..3dbad2e5 100644
--- a/completions/update-rc.d
+++ b/completions/update-rc.d
@@ -9,8 +9,8 @@ _update_rc_d()
local sysvdir services options valid_options
- [ -d /etc/rc.d/init.d ] && sysvdir=/etc/rc.d/init.d \
- || sysvdir=/etc/init.d
+ [[ -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/} )
diff --git a/completions/upgradepkg b/completions/upgradepkg
index 06dbe571..f9fa23ab 100644
--- a/completions/upgradepkg
+++ b/completions/upgradepkg
@@ -6,9 +6,21 @@ _upgradepkg()
_init_completion || return
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--dry-run --install-new --reinstall \
- --verbose' -- "$cur") )
- return 0
+ COMPREPLY=( $( compgen -W '--dry-run --install-new --reinstall
+ --verbose' -- "$cur" ) )
+ return
+ fi
+
+ if [[ "$cur" == ?*%* ]]; then
+ prev="${cur%%?(\\)%*}"
+ cur="${cur#*%}"
+ local nofiles IFS=$'\n'
+ compopt -o filenames
+ COMPREPLY=( $( compgen -P "$prev%" -f -X "!*.@(t[bgxl]z)" -- "$cur" ) )
+ [[ $COMPREPLY ]] || nofiles=1
+ COMPREPLY+=( $( compgen -P "$prev%" -S '/' -d -- "$cur" ) )
+ [[ $nofiles ]] && compopt -o nospace
+ return
fi
_filedir "t[bglx]z"
diff --git a/completions/valgrind b/completions/valgrind
new file mode 100644
index 00000000..1930c21b
--- /dev/null
+++ b/completions/valgrind
@@ -0,0 +1,104 @@
+# valgrind(1) completion -*- shell-script -*-
+
+_valgrind()
+{
+ local cur prev words cword split
+ _init_completion -s || return
+
+ local i
+ # Note: intentionally using COMP_WORDS and COMP_CWORD instead of
+ # words and cword here due to splitting on = causing index differences
+ # (_command_offset assumes the former).
+ for (( i=1; i <= COMP_CWORD; i++ )); do
+ if [[ ${COMP_WORDS[i]} != @([-=])* && ${COMP_WORDS[i-1]} != = ]]; then
+ _command_offset $i
+ return
+ fi
+ done
+
+ local tool
+ for (( i=1; i < ${#words[@]}; i++ )); do
+ if [[ ${words[i]} == --tool=?* ]]; then
+ tool=${words[i]}
+ break
+ fi
+ done
+
+ case $prev in
+ -h|--help|--help-debug|--version)
+ return
+ ;;
+ --tool)
+ # Tools seem to be named e.g. like memcheck-amd64-linux from which
+ # we want to grab memcheck.
+ COMPREPLY=( $( compgen -W '$(
+ for f in /usr{,/local}/lib{,64}/valgrind/*; do
+ [[ $f != *.so && -x $f ]] &&
+ sed -ne "s/^.*\/\(.*\)-\([^-]*\)-\([^-]*\)/\1/p" <<<$f
+ done )' -- "$cur" ) )
+ return
+ ;;
+ --sim-hints)
+ COMPREPLY=( $( compgen -W 'lax-ioctls enable-outer' -- "$cur" ) )
+ return
+ ;;
+ --kernel-variant)
+ COMPREPLY=( $( compgen -W 'bproc' -- "$cur" ) )
+ return
+ ;;
+ # callgrind:
+ --callgrind-out-file)
+ _filedir
+ return
+ ;;
+ # exp-dhat:
+ --sort-by)
+ COMPREPLY=( $( compgen -W 'max-bytes-live tot-bytes-allocd
+ max-blocks-live' -- "$cur" ) )
+ return
+ ;;
+ # massif:
+ --time-unit)
+ COMPREPLY=( $( compgen -W 'i ms B' -- "$cur" ) )
+ return
+ ;;
+ # generic cases parsed from --help output
+ --+([-A-Za-z0-9_]))
+ local value=$( $1 --help-debug $tool 2>/dev/null | \
+ sed -ne "s|^[$' \t']*$prev=\([^$' \t']\{1,\}\).*|\1|p" )
+ case $value in
+ \<file*\>)
+ _filedir
+ return
+ ;;
+ \<command\>)
+ COMPREPLY=( $( compgen -c -- "$cur" ) )
+ return
+ ;;
+ \<+([0-9])..+([0-9])\>)
+ COMPREPLY=( $( compgen -W "{${value:1:((${#value}-2))}}" \
+ -- "$cur" ) )
+ return
+ ;;
+ # "yes", "yes|no", etc (but not "string", "STR",
+ # "hint1,hint2,...")
+ yes|+([-a-z0-9])\|+([-a-z0-9\|]))
+ COMPREPLY=( $( IFS='|' compgen -W '$value' -- "$cur" ) )
+ return
+ ;;
+ esac
+ ;;
+ esac
+
+ $split && return
+
+ if [[ $cur == -* ]]; then
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" "--help $tool" )' \
+ -- "$cur" ) )
+ [[ $COMPREPLY == *= ]] && compopt -o nospace
+ return
+ fi
+} &&
+complete -F _valgrind valgrind
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/wine b/completions/wine
new file mode 100644
index 00000000..c02c97f0
--- /dev/null
+++ b/completions/wine
@@ -0,0 +1,20 @@
+# bash completion for wine(1) -*- shell-script -*-
+
+_wine()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ if [[ $cword -eq 1 ]]; then
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--help --version' -- "$cur" ) )
+ [[ $COMPREPLY ]] && return
+ fi
+ _filedir '[eE][xX][eE]?(.[sS][oO])|[cC][oO][mM]|[sS][cC][rR]'
+ else
+ _filedir
+ fi
+} &&
+complete -F _wine wine
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/wodim b/completions/wodim
index 3bc304d1..b6ce2aa6 100644
--- a/completions/wodim
+++ b/completions/wodim
@@ -67,8 +67,8 @@ _cdrecord()
-copy -nocopy -scms isrc= index= padsize= pregap= tsize= )
# look if previous was either a file or a track option
track_mode=0
- if [ $cword -gt 1 ]; then
- if [ -f "$prev" ]; then
+ if [[ $cword -gt 1 ]]; then
+ if [[ -f $prev ]]; then
track_mode=1
else
for (( i=0; i < ${#track_options[@]}; i++ )); do
@@ -85,7 +85,7 @@ _cdrecord()
# track options are always available
COMPREPLY+=( $( compgen -W '${track_options[@]}' -- "$cur" ) )
# general options are no more available after file or track option
- if [ $track_mode -eq 0 ]; then
+ if [[ $track_mode -eq 0 ]]; then
COMPREPLY+=( $( compgen -W '${generic_options[@]}' -- "$cur" ) )
fi
[[ $COMPREPLY == *= ]] && compopt -o nospace
diff --git a/completions/wtf b/completions/wtf
index b176d09b..cc8352f4 100644
--- a/completions/wtf
+++ b/completions/wtf
@@ -6,19 +6,19 @@ _wtf()
local cur prev words cword
_init_completion || return
- [ "$prev" = -f ] && _filedir && return 0
- [[ "$cur" == -* ]] && COMPREPLY=( -f ) && return 0
+ [[ $prev == -f ]] && _filedir && return 0
+ [[ $cur == -* ]] && COMPREPLY=( -f ) && return 0
local db
set -- "${words[@]}"
- while [ $# -gt 0 ]; do
- if [ "$1" = -f ]; then
+ while [[ $# -gt 0 ]]; do
+ if [[ $1 == -f ]]; then
shift ; db=$1 ; break
fi
shift
done
- [ -z $db ] && db=${ACRONYMDB:-/usr/share/misc/acronyms*}
+ [[ -z $db ]] && db=${ACRONYMDB:-/usr/share/misc/acronyms*}
COMPREPLY=( $( compgen -W "$( cut -f 1 -s $db ) -f" -- "${cur^^}" ) )
} &&
diff --git a/completions/xgamma b/completions/xgamma
index 4c434cfe..c5b8a76b 100644
--- a/completions/xgamma
+++ b/completions/xgamma
@@ -7,9 +7,9 @@ _xgamma()
case "$prev" in
-screen)
- local screens=$(xrandr --query 2>/dev/null | \
- sed -n '/^Screen /s|^Screen \{1,\}\(.*\):.*$|\1|p' 2>/dev/null)
- COMPREPLY=( $(compgen -W "$screens" -- "$cur"))
+ local screens=$( xrandr --query 2>/dev/null | sed -n \
+ '/^Screen /s|^Screen \{1,\}\(.*\):.*$|\1|p' 2>/dev/null )
+ COMPREPLY=( $( compgen -W "$screens" -- "$cur" ) )
return
;;
-gamma|-rgamma|-ggamma|-bgamma)
@@ -17,7 +17,7 @@ _xgamma()
if [[ $cur && "$cur" != *.* ]]; then
COMPREPLY=( . )
fi
- COMPREPLY+=( $(compgen -W "{0..9}") )
+ COMPREPLY+=( $( compgen -W "{0..9}" ) )
compopt -o nospace
return
;;
@@ -26,14 +26,15 @@ _xgamma()
if [[ "$cur" == :* && "$cur" != :*.* ]]; then
# FIXME: where to get local display numbers?
local display=${cur#:}
- COMPREPLY=( $(compgen -W "${display:-0}.") )
+ COMPREPLY=( $( compgen -W "${display:-0}." ) )
compopt -o nospace
elif [[ "$cur" == :*.* ]]; then
# local screen numbers
- local t screens=$(xrandr --query 2>/dev/null | sed -n \
- -e '/^Screen /s|^Screen \{1,\}\(.*\):.*$|\1|p' 2>/dev/null)
+ local t screens=$( xrandr --query 2>/dev/null | sed -ne \
+ '/^Screen /s|^Screen \{1,\}\(.*\):.*$|\1|p' 2>/dev/null )
t="${cur#:}"
- COMPREPLY=( $(compgen -P "${t%.*}." -W "$screens" -- "${cur##*.}"))
+ COMPREPLY=( $( compgen -P "${t%.*}." -W "$screens" -- \
+ "${cur##*.}" ) )
elif [[ "$cur" != *:* ]]; then
# complete hostnames
_known_hosts_real -c "$cur"
diff --git a/completions/xhost b/completions/xhost
index 397ca9ce..22839e4f 100644
--- a/completions/xhost
+++ b/completions/xhost
@@ -10,8 +10,6 @@ _xhost ()
-*) _known_hosts_real -p- "${cur:1}" ;;
*) _known_hosts_real "$cur" ;;
esac
-
- return 0
} &&
complete -F _xhost xhost
diff --git a/completions/xrandr b/completions/xrandr
index 36164298..332be812 100644
--- a/completions/xrandr
+++ b/completions/xrandr
@@ -7,52 +7,50 @@ _xrandr()
local output modes
- case $prev in
+ case "$prev" in
--output|--left-of|--right-of|--above|--below|--same-as)
- local outputs=$(xrandr|awk '/connected/ {print $1}')
- COMPREPLY=( $(compgen -W "$outputs" -- "$cur"))
- return 0
+ local outputs=$( xrandr | awk '/connected/ {print $1}' )
+ COMPREPLY=( $( compgen -W "$outputs" -- "$cur" ) )
+ return
;;
--mode)
for(( i = 1; i < cword; i++ )); do
- if [[ "${words[i]}" == "--output" ]]; then
+ if [[ "${words[i]}" == --output ]]; then
output=${words[i+1]}
break
fi
done
- modes=$(xrandr|sed -e "1,/$output/ d" \
- -e "/connected/,$ d"|awk '{print $1}')
- COMPREPLY=( $( compgen -W "$modes" -- "$cur"))
- return 0
+ modes=$( xrandr | sed -e "1,/$output/ d" \
+ -e "/connected/,$ d" | awk '{print $1}' )
+ COMPREPLY=( $( compgen -W "$modes" -- "$cur" ) )
+ return
;;
-o|--orientation)
COMPREPLY=( $( compgen -W 'normal inverted left right 0 1 2 3' -- \
"$cur" ) )
- return 0
+ return
;;
--reflect)
- COMPREPLY=( $( compgen -W 'normal x y xy' -- \
- "$cur" ) )
- return 0
+ COMPREPLY=( $( compgen -W 'normal x y xy' -- "$cur" ) )
+ return
;;
--rotate)
- COMPREPLY=( $( compgen -W 'normal inverted left right' -- \
- "$cur" ) )
- return 0
+ COMPREPLY=( $( compgen -W 'normal inverted left right' -- "$cur" ) )
+ return
;;
esac
case $cur in
*)
- COMPREPLY=( $(compgen -W '-display -help --orientation --query \
- --size --rate --version -x -y --screen --verbose --dryrun \
- --q1 --q12 --nograb --prop --properties --fb --fbmm --dpi \
- --output --auto --mode --preferred --pos --rate --refresh \
- --reflect --rotate --left-of --right-of --above --below \
- --same-as --set --scale --transform --off --crtc --panning \
- --gamma --brightness --primary --noprimary --newmode --rmmode \
- --addmode --delmode' -- "$cur") )
- return 0
+ COMPREPLY=( $( compgen -W '-display -help --orientation --query
+ --size --rate --version -x -y --screen --verbose --dryrun
+ --q1 --q12 --nograb --prop --properties --fb --fbmm --dpi
+ --output --auto --mode --preferred --pos --rate --refresh
+ --reflect --rotate --left-of --right-of --above --below
+ --same-as --set --scale --transform --off --crtc --panning
+ --gamma --brightness --primary --noprimary --newmode --rmmode
+ --addmode --delmode' -- "$cur" ) )
+ return
;;
esac
} &&