Merge branch 'master' into sftp

This commit is contained in:
Sergey V 2010-11-06 23:58:29 +03:00
commit 89717b0add
122 changed files with 1249 additions and 742 deletions

22
CHANGES
View File

@ -9,13 +9,14 @@ bash-completion (2.x)
[ Ville Skyttä ]
* Activate hping2 completion also for hping and hping3.
* Add badblocks, compgen, crontab, dumpe2fs, e2freefrag, e2label, ether-wake,
filefrag, iftop, lrzip, POSIX sh, sysbench, tune2fs, xmodmap, and xrdb
completions.
* Add *.gif (Alioth: #312512), *.3gpp, *.3gpp2, and *.awb to mplayer
filename completions.
filefrag, growisofs, iftop, ip (Debian: #600617), lrzip, POSIX sh,
sha{,224,256,384,512}sum, sysbench, tune2fs, xmodmap, and xrdb completions.
* Add *.gif (Alioth: #312512), *.m2t (Alioth: #312770), *.3gpp, *.3gpp2,
*.awb, and *.iso (Alioth: #311420) to mplayer filename completions.
* Add "short" tarball extensions to unxz, unlzma etc completions.
* Improve /etc/init.d/*, ipmitool, jar, mencoder, mplayer, povray, sqlite3,
and general help parsing completions.
* Improve /etc/init.d/*, ipmitool, jar, javadoc, man, mencoder, mkdir,
mplayer, povray, rpmbuild, sqlite3, tar, wodim, and general help parsing
completions.
* Fix p4 and povray completions (Alioth: #312625).
* Add *.xsd, *.xsl, *.rng, and *.wsdl to xmllint filename completions.
* Recognize rpm query mode based on the --file, --group, --package, and
@ -26,6 +27,15 @@ bash-completion (2.x)
filename extension arguments in addition to exact case matches.
* IPv6 known hosts completion fixes (Alioth: #312695, RedHat: #630658).
* Fixes to completions for filenames containing tabs (RedHat: #629518).
* Add *.iso (Alioth: #311420), *.m2t and *.m2ts (Alioth: #312770) to
xine-based player filename completions.
* Add /etc/ethers to MAC address completion sources.
* Add *.gem to tar completions.
* Complete known hosts from avahi-browse only if $COMP_KNOWN_HOSTS_WITH_AVAHI
is non-empty (Alioth: #312691, RedHat: #630326).
* Improve relevance of many user/group completions, depending on context.
* Remove most "-o filenames" options to "complete", turn "-o filenames" on
dynamically when needed instead.
[ Freddy Vulto ]
* Added _tilde(), fix ~username completion (Alioth: #312613, Debian: #587095)

View File

@ -1,4 +1,4 @@
SUBDIRS = completions helpers test
SUBDIRS = completions test
sysconf_DATA = bash_completion

View File

@ -1,4 +0,0 @@
#!/bin/sh
autoreconf -i
rm -rf autom4te.cache/

View File

@ -92,7 +92,8 @@ complete -f -X '!*.@(?(e)ps|pdf)' ps2pdf ps2pdf12 ps2pdf13 ps2pdf14 ps2pdfwr
complete -f -X '!*.texi*' makeinfo texi2html
complete -f -X '!*.@(?(la)tex|texi|dtx|ins|ltx)' tex latex slitex jadetex pdfjadetex pdftex pdflatex texi2dvi
complete -f -X '!*.mp3' mpg123 mpg321 madplay
complete -f -X '!*@(.@(mp?(e)g|MP?(E)G|wma|avi|AVI|asf|vob|VOB|bin|dat|divx|DIVX|vcd|ps|pes|fli|flv|FLV|fxm|FXM|viv|rm|ram|yuv|mov|MOV|qt|QT|wmv|mp[234]|MP[234]|m4[pv]|M4[PV]|mkv|MKV|og[gmv]|OG[GMV]|t[ps]|T[PS]|wav|WAV|flac|FLAC|asx|ASX|mng|MNG|srt|m[eo]d|M[EO]D|s[3t]m|S[3T]M|it|IT|xm|XM)|+([0-9]).@(vdr|VDR))?(.part)' xine aaxine fbxine kaffeine dragon
complete -f -X '!*@(.@(mp?(e)g|MP?(E)G|wma|avi|AVI|asf|vob|VOB|bin|dat|divx|DIVX|vcd|ps|pes|fli|flv|FLV|fxm|FXM|viv|rm|ram|yuv|mov|MOV|qt|QT|wmv|mp[234]|MP[234]|m4[pv]|M4[PV]|mkv|MKV|og[gmv]|OG[GMV]|t[ps]|T[PS]|m2t?(s)|M2T?(S)|wav|WAV|flac|FLAC|asx|ASX|mng|MNG|srt|m[eo]d|M[EO]D|s[3t]m|S[3T]M|it|IT|xm|XM)|+([0-9]).@(vdr|VDR))?(.part)' xine aaxine fbxine
complete -f -X '!*@(.@(mp?(e)g|MP?(E)G|wma|avi|AVI|asf|vob|VOB|bin|dat|divx|DIVX|vcd|ps|pes|fli|flv|FLV|fxm|FXM|viv|rm|ram|yuv|mov|MOV|qt|QT|wmv|mp[234]|MP[234]|m4[pv]|M4[PV]|mkv|MKV|og[gmv]|OG[GMV]|t[ps]|T[PS]|m2t?(s)|M2T?(S)|wav|WAV|flac|FLAC|asx|ASX|mng|MNG|srt|m[eo]d|M[EO]D|s[3t]m|S[3T]M|it|IT|xm|XM|iso|ISO)|+([0-9]).@(vdr|VDR))?(.part)' kaffeine dragon
complete -f -X '!*.@(avi|asf|wmv)' aviplay
complete -f -X '!*.@(rm?(j)|ra?(m)|smi?(l))' realplay
complete -f -X '!*.@(mpg|mpeg|avi|mov|qt)' xanim
@ -126,7 +127,7 @@ complete -f -X '!*.lyx' lyx
# start of section containing compspecs that can be handled within bash
# user commands see only users
complete -u su passwd write chfn groups slay w sux
complete -u su write chfn groups slay w sux
# bg completes with stopped jobs
complete -A stopped -P '"%' -S '"' bg
@ -607,6 +608,16 @@ _quote_readline_by_ref()
} # _quote_readline_by_ref()
# This function turns on "-o filenames" behavior dynamically. It is present
# for bash < 4 reasons. See http://bugs.debian.org/272660#64 for info about
# the bash < 4 compgen hack.
_compopt_o_filenames()
{
compopt -o filenames 2>/dev/null || \
compgen -f /non-existing-dir/ >/dev/null
}
# This function performs file and directory completion. It's better than
# simply using 'compgen -f', because it honours spaces in filenames.
# @param $1 If `-d', complete only on directories. Otherwise filter/pick only
@ -642,13 +653,8 @@ _filedir()
xspec=${1:+"!*.@($1|${1^^})"} || \
xspec=${1:+"!*.@($1|$(printf %s $1 | tr '[:lower:]' '[:upper:]'))"}
toks=( ${toks[@]-} $( compgen -f -X "$xspec" -- $quoted) )
if [ ${#toks[@]} -ne 0 ]; then
# Turn on -o filenames; see http://bugs.debian.org/272660#64 for
# info about the compgen hack (bash < 4)
compopt -o filenames 2>/dev/null || \
compgen -f /non-existing-dir/ >/dev/null
fi
fi
[ ${#toks[@]} -ne 0 ] && _compopt_o_filenames
COMPREPLY=( "${COMPREPLY[@]}" "${toks[@]}" )
} # _filedir()
@ -712,6 +718,10 @@ _mac_addresses()
"s/.*[[:space:]]\($re\)[[:space:]].*/\1/p" -ne \
"s/.*[[:space:]]\($re\)[[:space:]]*$/\1/p" ) )
# /etc/ethers
COMPREPLY=( "${COMPREPLY[@]}" $( sed -ne \
"s/^[[:space:]]*\($re\)[[:space:]].*/\1/p" /etc/ethers 2>/dev/null ) )
COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) )
__ltrim_colon_completions "$cur"
}
@ -779,6 +789,7 @@ _tilde() {
local result=0
# Does $1 start with tilde (~) and doesn't contain slash (/)?
if [[ ${1:0:1} == "~" && $1 == ${1//\/} ]]; then
_compopt_o_filenames
# Try generate username completions
COMPREPLY=( $( compgen -P '~' -u "${1#\~}" ) )
result=${#COMPREPLY[@]}
@ -967,10 +978,10 @@ _installed_modules()
# The : must be added manually; it will only complete usernames initially.
# The legacy user.group format is not supported.
#
# It assumes compopt -o filenames; but doesn't touch it.
# @param $1 If -u, only return users/groups the user has access to in
# context of current completion.
_usergroup()
{
local IFS=$'\n'
if [[ $cur = *\\\\* || $cur = *:*:* ]]; then
# Give up early on if something seems horribly wrong.
return
@ -981,19 +992,61 @@ _usergroup()
local prefix
prefix=${cur%%*([^:])}
prefix=${prefix//\\}
COMPREPLY=( $( compgen -P "$prefix" -g -- "${cur#*[:]}" ) )
local mycur="${cur#*[:]}"
if [[ $1 == -u ]]; then
_allowed_groups "$mycur"
else
local IFS=$'\n'
COMPREPLY=( $( compgen -g -- "$mycur" ) )
fi
COMPREPLY=( $( compgen -P "$prefix" -W "${COMPREPLY[@]}" ) )
elif [[ $cur = *:* ]]; then
# Completing group after 'user:gr<TAB>'.
# Reply with a list of unprefixed groups since readline with split on :
# and only replace the 'gr' part
COMPREPLY=( $( compgen -g -- "${cur#*:}" ) )
local mycur="${cur#*:}"
if [[ $1 == -u ]]; then
_allowed_groups "$mycur"
else
local IFS=$'\n'
COMPREPLY=( $( compgen -g -- "$mycur" ) )
fi
else
# Completing a partial 'usernam<TAB>'.
#
# Don't suffix with a : because readline will escape it and add a
# slash. It's better to complete into 'chown username ' than 'chown
# username\:'.
COMPREPLY=( $( compgen -u -- "$cur" ) )
if [[ $1 == -u ]]; then
_allowed_users "$cur"
else
local IFS=$'\n'
COMPREPLY=( $( compgen -u -- "$cur" ) )
fi
fi
}
_allowed_users()
{
if _complete_as_root; then
local IFS=$'\n'
COMPREPLY=( $( compgen -u -- "${1:-$cur}" ) )
else
local IFS=$'\n '
COMPREPLY=( $( compgen -W \
"$( id -un 2>/dev/null || whoami 2>/dev/null )" -- "${1:-$cur}" ) )
fi
}
_allowed_groups()
{
if _complete_as_root; then
local IFS=$'\n'
COMPREPLY=( $( compgen -g -- "$1" ) )
else
local IFS=$'\n '
COMPREPLY=( $( compgen -W \
"$( id -Gn 2>/dev/null || groups 2>/dev/null )" -- "$1" ) )
fi
}
@ -1149,7 +1202,8 @@ _known_hosts()
# Helper function for completing _known_hosts.
# This function performs host completion based on ssh's config and known_hosts
# files, as well as hostnames reported by avahi-browse. Also hosts from
# files, as well as hostnames reported by avahi-browse if
# COMP_KNOWN_HOSTS_WITH_AVAHI is set to a non-empty value. Also hosts from
# HOSTFILE (compgen -A hostname) are added, unless
# COMP_KNOWN_HOSTS_WITH_HOSTFILE is set to an empty value.
# Usage: _known_hosts_real [OPTIONS] CWORD
@ -1294,12 +1348,14 @@ _known_hosts_real()
-S "$suffix" -W "$hosts" -- "$cur" ) )
fi
# Add hosts reported by avahi-browse, if it's available.
# The original call to avahi-browse also had "-k", to avoid lookups into
# avahi's services DB. We don't need the name of the service, and if it
# contains ";", it may mistify the result. But on Gentoo (at least),
# -k isn't available (even if mentioned in the manpage), so...
if type avahi-browse >&/dev/null; then
# Add hosts reported by avahi-browse, if desired and it's available.
if [[ ${COMP_KNOWN_HOSTS_WITH_AVAHI:-} ]] && \
type avahi-browse &>/dev/null; then
# The original call to avahi-browse also had "-k", to avoid lookups
# into avahi's services DB. We don't need the name of the service, and
# if it contains ";", it may mistify the result. But on Gentoo (at
# least), -k wasn't available (even if mentioned in the manpage) some
# time ago, so...
COMPREPLY=( "${COMPREPLY[@]}" $( \
compgen -P "$prefix$user" -S "$suffix" -W \
"$( avahi-browse -cpr _workstation._tcp 2>/dev/null | \
@ -1335,10 +1391,7 @@ _cd()
return 0
fi
# Turn on -o filenames; see http://bugs.debian.org/272660#64 for
# info about the compgen hack (bash < 4)
compopt -o filenames 2>/dev/null || \
compgen -f /non-existing-dir/ >/dev/null
_compopt_o_filenames
# Use standard dir completion if no CDPATH or parameter starts with /,
# ./ or ../
@ -1435,6 +1488,7 @@ _command_offset()
_get_comp_words_by_ref cur
if [[ $COMP_CWORD -eq 0 ]]; then
_compopt_o_filenames
COMPREPLY=( $( compgen -c -- "$cur" ) )
else
cmd=${COMP_WORDS[0]}
@ -1473,56 +1527,60 @@ _command_offset()
[ ${#COMPREPLY[@]} -eq 0 ] && _filedir
}
complete -F _command -o filenames nohup exec nice eval time ltrace then \
else do vsound command xargs tsocks aoss padsp
complete -F _command aoss command do else eval exec ltrace nice nohup padsp \
then time tsocks vsound xargs
_root_command()
{
local PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin
local root_command=$1
_command $1 $2 $3
}
complete -F _root_command -o filenames sudo fakeroot really gksudo gksu kdesudo
complete -F _root_command fakeroot gksu gksudo kdesudo really sudo
# Return true if the completion should be treated as running as root
_complete_as_root()
{
[[ $EUID -eq 0 || ${root_command:-} ]]
}
_longopt()
{
local cur prev
local cur prev split=false
_get_comp_words_by_ref -n = cur prev
_get_comp_words_by_ref cur prev
_split_longopt && split=true
if _split_longopt; then
case "$prev" in
*[Dd][Ii][Rr]*)
_filedir -d
;;
*[Ff][Ii][Ll][Ee]*)
_filedir
;;
esac
return 0
fi
case "$prev" in
--*[Dd][Ii][Rr]*)
_filedir -d
return 0
;;
--*[Ff][Ii][Ll][Ee]*|--*[Pp][Aa][Tt][Hh]*)
_filedir
return 0
;;
esac
$split && return 0
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W "$( $1 --help 2>&1 | \
sed -ne 's/.*\(--[-A-Za-z0-9]\{1,\}\).*/\1/p' | sort -u )" \
-- "$cur" ) )
elif [[ "$1" == rmdir ]]; then
elif [[ "$1" == @(mk|rm)dir ]]; then
_filedir -d
else
_filedir
fi
}
# makeinfo and texi2dvi are defined elsewhere.
for i in a2ps autoconf automake bc gprof ld nm objcopy objdump readelf strip \
bison colordiff diff patch enscript cp df dir du ln ls mkfifo mknod mv rm \
touch vdir awk gperf grep grub indent less m4 sed shar date \
tee who texindex cat csplit cut expand fmt fold head \
md5sum nl od paste pr ptx sha1sum sort split tac tail tr unexpand \
uniq wc ldd bash id irb mkdir rmdir wget curl; do
have $i && complete -F _longopt -o filenames $i
done
# These commands do not use filenames, so '-o filenames' is not needed.
for i in env netstat seq uname units; do
for i in a2ps autoconf automake awk bash bc bison cat colordiff cp csplit \
curl cut date df diff dir du enscript env expand fmt fold gperf gprof \
grep grub head indent irb ld ldd less ln ls m4 md5sum mkdir mkfifo mknod \
mv netstat nl nm objcopy objdump od paste patch pr ptx readelf rm rmdir \
sed seq sha{,1,224,256,384,512}sum shar sort split strip tac tail tee \
texindex touch tr uname unexpand uniq units vdir wc wget who; do
have $i && complete -F _longopt -o default $i
done
unset i
@ -1575,6 +1633,7 @@ _filedir_xspec()
}
))
[ ${#toks[@]} -ne 0 ] && _compopt_o_filenames
COMPREPLY=( "${toks[@]}" )
}
list=( $( sed -ne '/^# START exclude/,/^# FINISH exclude/p' "$BASH_COMPLETION" | \
@ -1596,7 +1655,7 @@ list=( $( sed -ne '/^# START exclude/,/^# FINISH exclude/p' "$BASH_COMPLETION" |
if [ ${#list[@]} -gt 0 ]; then
eval complete -r ${list[@]}
# install new compspecs
eval complete -F _filedir_xspec -o filenames "${list[@]}"
eval complete -F _filedir_xspec "${list[@]}"
fi
unset list

View File

@ -1,3 +1,4 @@
SUBDIRS = helpers
bashcomp_DATA = abook \
ant \
apache2ctl \
@ -35,6 +36,7 @@ bashcomp_DATA = abook \
dpkg \
dselect \
dsniff \
dvd+rw-tools \
e2fsprogs \
findutils \
freeciv \
@ -59,6 +61,7 @@ bashcomp_DATA = abook \
info \
iptables \
ipmitool \
iproute2 \
ipsec \
ipv6calc \
isql \

View File

@ -27,7 +27,8 @@ _mock()
_split_longopt && split=true
case $prev in
-h|--help|--copyin|--copyout|--arch|-D|--define|--with|--without|--uniqueext|--rpmbuild_timeout|--sources|--cwd)
-h|--help|--copyin|--copyout|--arch|-D|--define|--with|--without|\
--uniqueext|--rpmbuild_timeout|--sources|--cwd)
return 0
;;
-r|--root)
@ -62,20 +63,18 @@ _mock()
$split && return 0
if [[ "$cur" == -* ]] ; then
COMPREPLY=( $( compgen -W '--version --help --rebuild \
--buildsrpm --shell --chroot --clean --init \
--installdeps --install --update --orphanskill \
--copyin --copyout --root --offline --no-clean \
--cleanup-after --no-cleanup-after --arch --target \
--define --with --without --resultdir --uniqueext \
--configdir --rpmbuild_timeout --unpriv --cwd --spec \
--sources --verbose --quiet --trace --enable-plugin \
--disable-plugin --print-root-path' -- "$cur" ) )
COMPREPLY=( $( compgen -W '--version --help --rebuild --buildsrpm
--shell --chroot --clean --init --installdeps --install --update
--orphanskill --copyin --copyout --root --offline --no-clean
--cleanup-after --no-cleanup-after --arch --target --define --with
--without --resultdir --uniqueext --configdir --rpmbuild_timeout
--unpriv --cwd --spec --sources --verbose --quiet --trace
--enable-plugin --disable-plugin --print-root-path' -- "$cur" ) )
else
_filedir '@(?(no)src.r|s)pm'
fi
} &&
complete -F _mock -o filenames mock
complete -F _mock mock
# Local variables:
# mode: shell-script

View File

@ -30,22 +30,22 @@ _svn()
case $prev in
--config-dir)
_filedir -d
return 0;
return 0
;;
-F|--file|--targets)
_filedir
return 0;
return 0
;;
--encoding)
COMPREPLY=( $( compgen -W '$( iconv --list | \
sed -e "s@//@@;" )' -- "$cur" ) )
return 0;
return 0
;;
--editor-cmd|--diff-cmd|--diff3-cmd)
COMP_WORDS=(COMP_WORDS[0] $cur)
COMP_CWORD=1
_command
return 0;
return 0
;;
esac
@ -55,172 +55,125 @@ _svn()
# possible options for the command
case $command in
add)
options='--auto-props --no-auto-props \
--force --targets --no-ignore \
--non-recursive -N -q --quiet'
options='--auto-props --no-auto-props --force --targets
--no-ignore --non-recursive -N -q --quiet'
;;
blame|annotate|ann|praise)
options='-r --revisions --username \
--password --no-auth-cache \
--non-interactive -v \
--verbose --incremental --xml'
options='-r --revisions --username --password
--no-auth-cache --non-interactive -v --verbose
--incremental --xml'
;;
cat)
options='-r --revision --username \
--password --no-auth-cache \
--non-interactive'
options='-r --revision --username --password
--no-auth-cache --non-interactive'
;;
checkout|co)
options='-r --revision -q --quiet -N \
--non-recursive --username \
--password --no-auth-cache \
--non-interactive \
--ignore-externals'
options='-r --revision -q --quiet -N --non-recursive
--username --password --no-auth-cache
--non-interactive --ignore-externals'
;;
cleanup)
options='--diff3-cmd'
;;
commit|ci)
options='-m --message -F --file \
--encoding --force-log -q \
--quiet --non-recursive -N \
--targets --editor-cmd \
--username --password \
--no-auth-cache \
--non-interactive --no-unlock'
options='-m --message -F --file --encoding --force-log -q
--quiet --non-recursive -N --targets --editor-cmd
--username --password --no-auth-cache
--non-interactive --no-unlock'
;;
copy|cp)
options='-m --message -F --file \
--encoding --force-log -r \
--revision -q --quiet \
--editor-cmd -username \
--password --no-auth-cache \
--non-interactive'
options='-m --message -F --file --encoding --force-log -r
--revision -q --quiet --editor-cmd -username
--password --no-auth-cache --non-interactive'
;;
delete|del|remove|rm)
options='--force -m --message -F \
--file --encoding --force-log \
-q --quiet --targets \
--editor-cmd -username \
--password --no-auth-cache \
--non-interactive'
options='--force -m --message -F --file --encoding
--force-log -q --quiet --targets --editor-cmd
--username --password --no-auth-cache
--non-interactive'
;;
diff|di)
options='-r --revision -x --extensions \
--diff-cmd --no-diff-deleted \
-N --non-recursive --username \
--password --no-auth-cache \
--non-interactive --force \
--old --new --notice-ancestry'
options='-r --revision -x --extensions --diff-cmd
--no-diff-deleted -N --non-recursive --username
--password --no-auth-cache --non-interactive
--force --old --new --notice-ancestry'
;;
export)
options='-r --revision -q --quiet \
--username --password \
--no-auth-cache \
--non-interactive -N \
--non-recursive --force \
--native-eol --ignore-externals'
options='-r --revision -q --quiet --username --password
--no-auth-cache --non-interactive -N
--non-recursive --force --native-eol
--ignore-externals'
;;
import)
options='--auto-props --no-auto-props \
-m --message -F --file \
--encoding --force-log -q \
--quiet --non-recursive \
--no-ignore --editor-cmd \
--username --password \
--no-auth-cache \
--non-interactive'
options='--auto-props --no-auto-props -m --message -F
--file --encoding --force-log -q --quiet
--non-recursive --no-ignore --editor-cmd
--username --password --no-auth-cache
--non-interactive'
;;
info)
options='--username --password \
--no-auth-cache \
--non-interactive -r \
--revision --xml --targets \
-R --recursive --incremental'
options='--username --password --no-auth-cache
--non-interactive -r --revision --xml --targets
-R --recursive --incremental'
;;
list|ls)
options='-r --revision -v --verbose -R \
--recursive --username \
--password --no-auth-cache \
--non-interactive \
--incremental --xml'
options='-r --revision -v --verbose -R --recursive
--username --password --no-auth-cache
--non-interactive --incremental --xml'
;;
lock)
options='-m --message -F --file \
--encoding --force-log \
--targets --force --username \
--password --no-auth-cache \
--non-interactive'
options='-m --message -F --file --encoding --force-log
--targets --force --username --password
--no-auth-cache --non-interactive'
;;
log)
options='-r --revision -v --verbose \
--targets --username \
--password --no-auth-cache \
--non-interactive \
--stop-on-copy --incremental \
--xml -q --quiet --limit'
;;
options='-r --revision -v --verbose --targets --username
--password --no-auth-cache --non-interactive
--stop-on-copy --incremental --xml -q --quiet
--limit'
;;
merge)
options='-r --revision -N \
--non-recursive -q --quiet \
--force --dry-run --diff3-cmd \
--username --password \
--no-auth-cache \
--non-interactive \
--ignore-ancestry'
options='-r --revision -N --non-recursive -q --quiet
--force --dry-run --diff3-cmd --username
--password --no-auth-cache --non-interactive
--ignore-ancestry'
;;
mkdir)
options='-m --message -F --file \
--encoding --force-log -q \
--quiet --editor-cmd \
--username --password \
--no-auth-cache \
--non-interactive'
options='-m --message -F --file --encoding --force-log -q
--quiet --editor-cmd --username --password
--no-auth-cache --non-interactive'
;;
move|mv|rename|ren)
options='-m --message -F --file \
--encoding --force-log -r \
--revision -q --quiet \
--force --editor-cmd \
--username --password \
--no-auth-cache \
--non-interactive'
options='-m --message -F --file --encoding --force-log -r
--revision -q --quiet --force --editor-cmd
--username --password --no-auth-cache
--non-interactive'
;;
propdel|pdel|pd)
options='-q --quiet -R --recursive -r \
--revision --revprop \
--username --password \
--no-auth-cache \
--non-interactive'
options='-q --quiet -R --recursive -r --revision --revprop
--username --password --no-auth-cache
--non-interactive'
;;
propedit|pedit|pe)
options='-r --revision --revprop \
--encoding --editor-cmd \
--username --password \
--no-auth-cache \
--non-interactive --force'
options='-r --revision --revprop --encoding --editor-cmd
--username --password --no-auth-cache
--non-interactive --force'
;;
propget|pget|pg)
options='-R --recursive -r --revision \
--revprop --strict --username \
--password --no-auth-cache \
--non-interactive'
options='-R --recursive -r --revision --revprop --strict
--username --password --no-auth-cache
--non-interactive'
;;
proplist|plist|pl)
options='-v --verbose -R --recursive \
-r --revision --revprop -q \
--quiet --username --password \
--no-auth-cache \
--non-interactive'
options='-v --verbose -R --recursive -r --revision
--revprop -q --quiet --username --password
--no-auth-cache --non-interactive'
;;
propset|pset|ps)
options='-F --file -q --quiet \
--targets -R --recursive \
--revprop --encoding \
--username --password \
--no-auth-cache \
--non-interactive -r \
--revision --force'
options='-F --file -q --quiet --targets -R --recursive
--revprop --encoding --username --password
--no-auth-cache --non-interactive -r --revision
--force'
;;
resolved)
options='--targets -R --recursive -q --quiet'
@ -229,33 +182,24 @@ _svn()
options='--targets -R --recursive -q --quiet'
;;
status|stat|st)
options='-u --show-updates -v \
--verbose -N --non-recursive \
-q --quiet --username \
--password --no-auth-cache \
--non-interactive --no-ignore \
--ignore-externals \
--incremental --xml'
options='-u --show-updates -v --verbose -N --non-recursive
-q --quiet --username --password --no-auth-cache
--non-interactive --no-ignore --ignore-externals
--incremental --xml'
;;
switch|sw)
options='--relocate -r --revision -N \
--non-recursive -q --quiet \
--username --password \
--no-auth-cache \
--non-interactive --diff3-cmd'
options='--relocate -r --revision -N --non-recursive -q
--quiet --username --password --no-auth-cache
--non-interactive --diff3-cmd'
;;
unlock)
options='--targets --force --username \
--password --no-auth-cache \
--non-interactive'
options='--targets --force --username --password
--no-auth-cache --non-interactive'
;;
update|up)
options='-r --revision -N \
--non-recursive -q --quiet \
--username --password \
--no-auth-cache \
--non-interactive \
--diff3-cmd --ignore-externals'
options='-r --revision -N --non-recursive -q --quiet
--username --password --no-auth-cache
--non-interactive --diff3-cmd --ignore-externals'
;;
esac
options="$options --help -h --config-dir"
@ -272,150 +216,137 @@ _svn()
return 0
}
complete -F _svn -o filenames svn
complete -F _svn svn
_svnadmin()
{
local cur prev commands options mode
local cur prev commands options mode
COMPREPLY=()
_get_comp_words_by_ref cur prev
COMPREPLY=()
_get_comp_words_by_ref cur prev
commands='create deltify dump help ? hotcopy list-dblogs \
list-unused-dblogs load lslocks lstxns recover rmlocks \
rmtxns setlog verify'
commands='create deltify dump help ? hotcopy list-dblogs list-unused-dblogs
load lslocks lstxns recover rmlocks rmtxns setlog verify'
if [[ $COMP_CWORD -eq 1 ]] ; then
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--version' -- $cur ) )
else
COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
fi
if [[ $COMP_CWORD -eq 1 ]] ; then
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--version' -- $cur ) )
else
case $prev in
--config-dir)
_filedir -d
return 0;
;;
--fs-type)
COMPREPLY=( $( compgen -W 'fsfs bdb' -- $cur ) )
return 0;
;;
esac
command=${COMP_WORDS[1]}
if [[ "$cur" == -* ]]; then
# possible options for the command
case $command in
create)
options='--bdb-txn-nosync \
--bdb-log-keep --config-dir \
--fs-type'
;;
deltify)
options='-r --revision -q --quiet'
;;
dump)
options='-r --revision --incremental \
-q --quiet --deltas'
;;
hotcopy)
options='--clean-logs'
;;
load)
options='--ignore-uuid --force-uuid \
--parent-dir -q --quiet \
--use-pre-commit-hook \
--use-post-commit-hook'
;;
rmtxns)
options='-q --quiet'
;;
setlog)
options='-r --revision --bypass-hooks'
;;
esac
options="$options --help -h"
COMPREPLY=( $( compgen -W "$options" -- $cur ) )
else
if [[ "$command" == @(help|h|\?) ]]; then
COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
else
_filedir
fi
fi
COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
fi
else
case $prev in
--config-dir)
_filedir -d
return 0
;;
--fs-type)
COMPREPLY=( $( compgen -W 'fsfs bdb' -- $cur ) )
return 0
;;
esac
return 0
command=${COMP_WORDS[1]}
if [[ "$cur" == -* ]]; then
# possible options for the command
case $command in
create)
options='--bdb-txn-nosync --bdb-log-keep --config-dir
--fs-type'
;;
deltify)
options='-r --revision -q --quiet'
;;
dump)
options='-r --revision --incremental -q --quiet --deltas'
;;
hotcopy)
options='--clean-logs'
;;
load)
options='--ignore-uuid --force-uuid --parent-dir -q --quiet
--use-pre-commit-hook --use-post-commit-hook'
;;
rmtxns)
options='-q --quiet'
;;
setlog)
options='-r --revision --bypass-hooks'
;;
esac
options="$options --help -h"
COMPREPLY=( $( compgen -W "$options" -- $cur ) )
else
if [[ "$command" == @(help|h|\?) ]]; then
COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
else
_filedir
fi
fi
fi
return 0
}
complete -F _svnadmin -o default svnadmin
_svnlook()
{
local cur prev commands options mode
local cur prev commands options mode
COMPREPLY=()
_get_comp_words_by_ref cur
COMPREPLY=()
_get_comp_words_by_ref cur
commands='author cat changed date diff dirs-changed help ? h history \
info lock log propget pget pg proplist plist pl tree uuid \
youngest'
commands='author cat changed date diff dirs-changed help ? h history info
lock log propget pget pg proplist plist pl tree uuid youngest'
if [[ $COMP_CWORD -eq 1 ]] ; then
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--version' -- $cur ) )
else
COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
fi
if [[ $COMP_CWORD -eq 1 ]] ; then
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--version' -- $cur ) )
else
command=${COMP_WORDS[1]}
if [[ "$cur" == -* ]]; then
# possible options for the command
case $command in
author|cat|date|dirs-changed|info|log)
options='-r --revision -t \
--transaction'
;;
changed)
options='-r --revision -t \
--transaction --copy-info'
;;
diff)
options='-r --revision -t \
--transaction \
--no-diff-deleted \
--no-diff-added \
--diff-copy-from'
;;
history)
options='-r --revision --show-ids'
;;
propget|proplist)
options='-r --revision -t \
--transaction --revprop'
;;
tree)
options='-r --revision -t \
--transaction --show-ids \
--full-paths'
;;
esac
options="$options --help -h"
COMPREPLY=( $( compgen -W "$options" -- $cur ) )
else
if [[ "$command" == @(help|h|\?) ]]; then
COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
else
_filedir
fi
fi
COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
fi
else
command=${COMP_WORDS[1]}
return 0
if [[ "$cur" == -* ]]; then
# possible options for the command
case $command in
author|cat|date|dirs-changed|info|log)
options='-r --revision -t --transaction'
;;
changed)
options='-r --revision -t --transaction --copy-info'
;;
diff)
options='-r --revision -t --transaction --no-diff-deleted
--no-diff-added --diff-copy-from'
;;
history)
options='-r --revision --show-ids'
;;
propget|proplist)
options='-r --revision -t --transaction --revprop'
;;
tree)
options='-r --revision -t --transaction --show-ids
--full-paths'
;;
esac
options="$options --help -h"
COMPREPLY=( $( compgen -W "$options" -- $cur ) )
else
if [[ "$command" == @(help|h|\?) ]]; then
COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
else
_filedir
fi
fi
fi
return 0
}
complete -F _svnlook -o default svnlook
}

View File

@ -146,7 +146,7 @@ _yum()
fi
}
} &&
complete -F _yum -o filenames yum
complete -F _yum yum
# Local variables:
# mode: shell-script

View File

@ -20,7 +20,7 @@ _repomanage()
_filedir -d
fi
} &&
complete -F _repomanage -o filenames repomanage
complete -F _repomanage repomanage
# Local variables:
# mode: shell-script

View File

@ -26,13 +26,11 @@ _abook()
case $prev in
--informat)
[ ${BASH_VERSINFO[0]} -ge 4 ] && compopt +o filenames
COMPREPLY=( $( compgen -W "$(abook --formats | \
sed -n -e 's/^\t\([a-z]*\).*/\1/p' -e '/^$/q')" -- "$cur" ) )
return 0
;;
--outformat)
[ ${BASH_VERSINFO[0]} -ge 4 ] && compopt +o filenames
COMPREPLY=( $( compgen -W "$(abook --formats | \
sed -n -e '/^$/,$s/^\t\([a-z]*\).*/\1/p')" -- "$cur" ) )
return 0
@ -53,7 +51,7 @@ _abook()
;;
esac
} &&
complete -F _abook -o filenames abook
complete -F _abook abook
# Local variables:
# mode: shell-script

View File

@ -58,8 +58,7 @@ _ant()
fi
}
have complete-ant-cmd.pl && \
complete -C complete-ant-cmd.pl -F _ant -o filenames ant || \
complete -F _ant -o filenames ant
complete -C complete-ant-cmd.pl -F _ant ant || complete -F _ant ant
}
# Local variables:

View File

@ -71,7 +71,7 @@ _apt_get()
return 0
} &&
complete -F _apt_get -o filenames apt-get
complete -F _apt_get apt-get
# Debian apt-cache(8) completion.
#
@ -146,7 +146,7 @@ _apt_cache()
return 0
} &&
complete -F _apt_cache -o filenames apt-cache
complete -F _apt_cache apt-cache
# Local variables:
# mode: shell-script

View File

@ -55,7 +55,7 @@ _apt_build()
return 0
} &&
complete -F _apt_build -o filenames apt-build
complete -F _apt_build apt-build
# Local variables:
# mode: shell-script

View File

@ -84,7 +84,7 @@ _aspell()
fi
}
complete -F _aspell -o filenames aspell
complete -F _aspell aspell
}
# Local variables:

View File

@ -36,10 +36,11 @@ _bzip2()
_expand || return 0
_compopt_o_filenames
COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \
$( compgen -d -- "$cur" ) )
} &&
complete -F _bzip2 -o filenames bzip2 pbzip2
complete -F _bzip2 bzip2 pbzip2
# Local variables:
# mode: shell-script

View File

@ -10,7 +10,7 @@ _configure()
_split_longopt && split=true
case $prev in
--prefix|--exec-prefix|--*dir)
--*prefix|--*dir)
_filedir -d
;;
esac
@ -33,7 +33,7 @@ _configure()
-- "$cur" ) )
fi
}
complete -F _configure -o filenames configure
complete -F _configure configure
# Local variables:
# mode: shell-script

View File

@ -41,13 +41,13 @@ _chown()
_count_args :
if [[ $args == 1 ]]; then
_usergroup
_usergroup -u
else
_filedir
fi
fi
} &&
complete -F _chown -o filenames chown
complete -F _chown chown
# chgrp(1) completion
@ -84,15 +84,14 @@ _chgrp()
# first parameter on line or first since an option?
if [[ $COMP_CWORD -eq 1 && "$cur" != -* || "$prev" == -* ]]; then
local IFS=$'\n'
COMPREPLY=( $( compgen -g "$cur" 2>/dev/null ) )
_allowed_groups
else
_filedir || return 0
fi
return 0
} &&
complete -F _chgrp -o filenames chgrp
complete -F _chgrp chgrp
# id(1) completion
#

View File

@ -30,6 +30,7 @@ _cpio()
return 0
;;
--rsh-command)
_compopt_o_filenames
COMPREPLY=( $( compgen -c -- "$cur" ) )
return 0
;;
@ -90,7 +91,7 @@ _cpio()
esac
fi
}
complete -F _cpio -o filenames cpio
complete -F _cpio cpio
}
# Local variables:

View File

@ -9,7 +9,7 @@ _crontab()
case $prev in
-u)
COMPREPLY=( $( compgen -u -- "$cur" ) )
_allowed_users
return 0
;;
esac
@ -49,7 +49,7 @@ _crontab()
# do filenames only if we did not have -l, -r, or -e
[[ "${COMP_LINE}" == *\ -@(l|r|e)* ]] || _filedir
} &&
complete -F _crontab -o filenames crontab
complete -F _crontab crontab
# Local variables:
# mode: shell-script

View File

@ -10,7 +10,7 @@ _cancel()
COMPREPLY=( $( compgen -W "$( lpstat | cut -d' ' -f1 )" -- "$cur" ) )
} &&
complete -F _cancel -o filenames cancel
complete -F _cancel cancel
# Local variables:
# mode: shell-script

View File

@ -9,26 +9,26 @@ _dd()
_get_comp_words_by_ref -n = cur
case $cur in
if=*|of=*)
cur=${cur#*=}
_filedir
return 0
;;
conv=*)
cur=${cur#*=}
COMPREPLY=( $( compgen -W 'ascii ebcdic ibm block unblock \
lcase notrunc ucase swab noerror sync' -- "$cur" ) )
return 0
;;
if=*|of=*)
cur=${cur#*=}
_filedir
return 0
;;
conv=*)
cur=${cur#*=}
COMPREPLY=( $( compgen -W 'ascii ebcdic ibm block unblock lcase
notrunc ucase swab noerror sync' -- "$cur" ) )
return 0
;;
esac
_expand || return 0
COMPREPLY=( $( compgen -W '--help --version' -- "$cur" ) \
$( compgen -W 'bs cbs conv count ibs if obs of seek skip'\
-S '=' -- "$cur" ) )
$( compgen -W 'bs cbs conv count ibs if obs of seek skip' \
-S '=' -- "$cur" ) )
} &&
complete -F _dd -o nospace -o filenames dd
complete -F _dd -o nospace dd
# Local variables:
# mode: shell-script

View File

@ -92,7 +92,7 @@ _dpkg()
}
complete -F _dpkg -o filenames dpkg dpkg-deb
complete -F _dpkg dpkg dpkg-deb
}
# Debian GNU dpkg-reconfigure(8) completion

View File

@ -27,10 +27,9 @@ _dselect()
remove quit' -- "$cur" ) )
fi
return 0
} &&
complete -F _dselect -o filenames dselect
complete -F _dselect dselect
# Local variables:
# mode: shell-script

47
completions/dvd+rw-tools Normal file
View File

@ -0,0 +1,47 @@
# dvd+rw-tools completions
have growisofs &&
_growisofs()
{
COMPREPLY=()
local cur prev
_get_comp_words_by_ref cur prev
case $prev in
-version|-speed)
return 0
;;
-Z|-M)
compopt -o nospace &>/dev/null
_dvd_devices
return 0
;;
/?(r)dev/*)
if [[ $cur == =* ]] ; then
# e.g. /dev/dvd=foo.iso, /dev/dvdrw=/dev/zero
cur="${cur#=}"
_filedir
return 0
fi
;;
esac
if [[ "$cur" == -* ]]; then
# TODO: mkisofs options
COMPREPLY=( $( compgen -W '-dvd-compat -overburn -speed= -Z -M' \
-- "$cur" ) )
[[ ${COMPREPLY[@]} == *= ]] && compopt -o nospace &>/dev/null
return 0
fi
_filedir
} &&
complete -F _growisofs growisofs
# Local variables:
# mode: shell-script
# sh-basic-offset: 4
# sh-indent-comment: t
# indent-tabs-mode: nil
# End:
# ex: ts=4 sw=4 et filetype=sh

View File

@ -27,7 +27,7 @@ _badblocks()
cur=${cur:=/dev/}
_filedir
} &&
complete -F _badblocks -o filenames badblocks
complete -F _badblocks badblocks
have dumpe2fs &&
@ -55,7 +55,7 @@ _dumpe2fs()
cur=${cur:=/dev/}
_filedir
} &&
complete -F _dumpe2fs -o filenames dumpe2fs
complete -F _dumpe2fs dumpe2fs
have e2freefrag &&
@ -79,7 +79,7 @@ _e2freefrag()
cur=${cur:=/dev/}
_filedir
} &&
complete -F _e2freefrag -o filenames e2freefrag
complete -F _e2freefrag e2freefrag
have e2label &&
@ -94,7 +94,7 @@ _e2label()
_filedir
fi
} &&
complete -F _e2label -o filenames e2label
complete -F _e2label e2label
have filefrag &&
@ -111,7 +111,7 @@ _filefrag()
_filedir
} &&
complete -F _filefrag -o filenames filefrag
complete -F _filefrag filefrag
have tune2fs &&
@ -144,8 +144,9 @@ _tune2fs()
return 0
;;
-O)
local -a opts=(^dir_index ^filetype ^flex_bg ^has_journal
^large_file ^resize_inode ^sparse_super ^uninit_bg)
local -a opts=(^dir_index ^dir_nlink ^extent ^extra_isize ^filetype
^flex_bg ^has_journal ^huge_file ^large_file ^resize_inode
^sparse_super ^uninit_bg)
COMPREPLY=( $( compgen -W '${opts[@]} ${opts[@]#^}' -- "$cur" ) )
return 0
;;
@ -168,7 +169,7 @@ _tune2fs()
cur=${cur:=/dev/}
_filedir
} &&
complete -F _tune2fs -o filenames tune2fs
complete -F _tune2fs tune2fs
# Local variables:
# mode: shell-script

View File

@ -117,7 +117,7 @@ _find()
return 0
} &&
complete -F _find -o filenames find
complete -F _find find
# Local variables:
# mode: shell-script

View File

@ -25,7 +25,7 @@ _fusermount()
_filedir -d
fi
} &&
complete -F _fusermount -o filenames fusermount
complete -F _fusermount fusermount
# Local variables:
# mode: shell-script

View File

@ -46,9 +46,9 @@ _gcc()
_filedir
fi
} &&
complete -o filenames -F _gcc gcc g++ c++ g77 gcj gpc
complete -F _gcc gcc g++ c++ g77 gcj gpc
[ $USERLAND = GNU -o $UNAME = Cygwin ] && \
[ -n "${have:-}" ] && complete -o filenames -F _gcc cc
[ -n "${have:-}" ] && complete -F _gcc cc
# Local variables:
# mode: shell-script

View File

@ -10,6 +10,7 @@ _gdb()
if [ $COMP_CWORD -eq 1 ]; then
local IFS
_compopt_o_filenames
if [[ "$cur" == */* ]]; then
# compgen -c works as expected if $cur contains any slashes.
IFS=$'\n'

View File

@ -66,7 +66,7 @@ _mkisofs()
fi
} &&
complete -F _mkisofs -o filenames mkisofs genisoimage
complete -F _mkisofs mkisofs genisoimage
# Local variables:
# mode: shell-script

View File

@ -43,7 +43,7 @@ _gkrellm()
fi
} &&
complete -F _gkrellm -o filenames gkrellm gkrellm2
complete -F _gkrellm gkrellm gkrellm2
# Local variables:
# mode: shell-script

View File

@ -26,7 +26,7 @@ _gnatmake()
_filedir '@(adb|ads)'
fi
} &&
complete -F _gnatmake -o filenames gnatmake
complete -F _gnatmake gnatmake
# Local variables:
# mode: shell-script

View File

@ -40,10 +40,11 @@ _gzip()
_expand || return 0
_compopt_o_filenames
COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \
$( compgen -d -- "$cur" ) )
} &&
complete -F _gzip -o filenames gzip pigz
complete -F _gzip gzip pigz
# Local variables:
# mode: shell-script

View File

@ -36,8 +36,6 @@ _iconv()
fi
} &&
complete -F _iconv -o default iconv
# Intentionally not -o filenames here, -f/-t completions may contain slashes
# and -o filenames would break them.
# Local variables:
# mode: shell-script

View File

@ -24,7 +24,7 @@ _iftop()
COMPREPLY=( $( compgen -W '-h -n -N -p -P -b -B -i -f -F -c -m' \
-- "$cur" ) )
} &&
complete -F _iftop -o filenames iftop
complete -F _iftop iftop
# Local variables:
# mode: shell-script

View File

@ -189,7 +189,7 @@ _convert()
_filedir
fi
}
complete -F _convert -o filenames convert
complete -F _convert convert
_mogrify()
{
@ -245,7 +245,7 @@ _mogrify()
_filedir
fi
}
complete -F _mogrify -o filenames mogrify
complete -F _mogrify mogrify
_display()
{
@ -285,7 +285,7 @@ _display()
_filedir
fi
}
complete -F _display -o filenames display
complete -F _display display
_animate()
{
@ -319,7 +319,7 @@ _animate()
_filedir
fi
}
complete -F _animate -o filenames animate
complete -F _animate animate
_identify()
{
@ -344,7 +344,7 @@ _identify()
_filedir
fi
}
complete -F _identify -o filenames identify
complete -F _identify identify
_montage()
{
@ -382,7 +382,7 @@ _montage()
_filedir
fi
}
complete -F _montage -o filenames montage
complete -F _montage montage
_composite()
{
@ -417,7 +417,7 @@ _composite()
_filedir
fi
}
complete -F _composite -o filenames composite
complete -F _composite composite
_compare()
{
@ -444,7 +444,7 @@ _compare()
_filedir
fi
}
complete -F _compare -o filenames compare
complete -F _compare compare
_conjure()
{
@ -464,7 +464,7 @@ _conjure()
_filedir
fi
}
complete -F _conjure -o filenames conjure
complete -F _conjure conjure
_import()
{
@ -495,7 +495,7 @@ _import()
_filedir
fi
}
complete -F _import -o filenames import
complete -F _import import
_stream()
{
@ -520,7 +520,7 @@ _stream()
_filedir
fi
}
complete -F _stream -o filenames stream
complete -F _stream stream
}
# Local variables:

View File

@ -47,7 +47,7 @@ _info()
return 0
} &&
complete -F _info -o filenames info
complete -F _info info
# Local variables:
# mode: shell-script

View File

@ -203,7 +203,7 @@ _ipmitool()
}
} &&
complete -F _ipmitool -o filenames ipmitool
complete -F _ipmitool ipmitool
# Local variables:
# mode: shell-script

285
completions/iproute2 Normal file
View File

@ -0,0 +1,285 @@
# iproute2 tools completion
have ip &&
_ip()
{
COMPREPLY=()
local cur prev words cword
_get_comp_words_by_ref cur prev words cword
case $prev in
-V|-Version|-rc|-rcvbuf)
return 0
;;
-f|-family)
COMPREPLY=( $( compgen -W 'inet inet6 ipx dnet link' -- "$cur" ) )
return 0
;;
-b|-batch)
_filedir
return 0
;;
-force)
COMPREPLY=( $( compgen -W '-batch' -- "$cur" ) )
return 0
;;
esac
local subcword cmd subcmd
for (( subcword=1; subcword < ${#words[@]}-1; subcword++ )); do
[[ ${words[subcword]} == -b?(atch) ]] && return 0
[[ -n $cmd ]] && subcmd=${words[subcword]} && break
[[ ${words[subcword]} != -* && \
${words[subcword-1]} != -@(f?(amily)|rc?(vbuf)) ]] && \
cmd=${words[subcword]}
done
if [[ -z $cmd ]]; then
case $cur in
-*)
local c="-Version -statistics -details -resolve -family
-oneline -timestamp -batch -rcvbuf"
[[ $cword -eq 1 ]] && c="$c -force"
COMPREPLY=( $( compgen -W "$c" -- "$cur" ) )
return 0
;;
*)
COMPREPLY=( $( compgen -W "help $( ip help 2>&1 | \
sed -e '/OBJECT := /,/}/!d' \
-e 's/.*{//' -e 's/}.*//' -e 's/|//g' )" -- "$cur" ) )
return 0
;;
esac
fi
[[ $subcmd == help ]] && return 0
case $cmd in
link)
case $subcmd in
add)
# TODO
;;
delete)
case $(($cword-$subcword)) in
1)
_available_interfaces
;;
2)
COMPREPLY=( $( compgen -W 'type' -- "$cur" ) )
;;
3)
[[ $prev == type ]] && \
COMPREPLY=( $( compgen -W 'vlan veth vcan dummy
ifb macvlan can' -- "$cur" ) )
;;
esac
;;
set)
if [[ $cword-$subcword -eq 1 ]]; then
_available_interfaces
else
case $prev in
arp|dynamic|multicast|allmulticast|promisc|\
trailers)
COMPREPLY=( $( compgen -W 'on off' \
-- "$cur" ) )
;;
txqueuelen|name|address|broadcast|mtu|netns|alias)
;;
*)
local c="arp dynamic multicast allmulticast
promisc trailers txqueuelen name address
broadcast mtu netns alias"
[[ $prev != @(up|down) ]] && c="$c up down"
COMPREPLY=( $( compgen -W "$c" -- "$cur" ) )
;;
esac
fi
;;
show)
[[ $cword -eq $subcword+1 ]] && _available_interfaces
;;
*)
[[ $cword -eq $subcword ]] && \
COMPREPLY=( $( compgen -W 'help add delete set show' \
-- "$cur" ) )
;;
esac
;;
addr)
case $subcmd in
add|change|replace)
# TODO
;;
del)
# TODO
;;
show|flush)
# TODO
;;
*)
[[ $cword -eq $subcword ]] && \
COMPREPLY=( $( compgen -W 'help add change replace del
show flush' -- "$cur" ) )
;;
esac
;;
addrlabel)
case $subcmd in
list|add|del|flush)
# TODO
;;
*)
[[ $cword -eq $subcword ]] && \
COMPREPLY=( $( compgen -W 'help list add del flush' \
-- "$cur" ) )
;;
esac
;;
route)
case $subcmd in
list|flush)
# TODO
;;
get)
# TODO
;;
add|del|change|append|replace|monitor)
# TODO
;;
*)
[[ $cword -eq $subcword ]] && \
COMPREPLY=( $( compgen -W 'help list flush get add del
change append replace monitor' -- "$cur" ) )
;;
esac
;;
rule)
case $subcmd in
list|add|del|flush)
# TODO
;;
*)
[[ $cword -eq $subcword ]] && \
COMPREPLY=( $( compgen -W 'help list add del flush' \
-- "$cur" ) )
;;
esac
;;
neigh)
case $subcmd in
add|del|change|replace)
# TODO
;;
show|flush)
# TODO
;;
*)
[[ $cword -eq $subcword ]] && \
COMPREPLY=( $( compgen -W 'help add del change replace
show flush' -- "$cur" ) )
;;
esac
;;
ntable)
case $subcmd in
change)
# TODO
;;
show)
# TODO
;;
*)
[[ $cword -eq $subcword ]] && \
COMPREPLY=( $( compgen -W 'help change show' \
-- "$cur" ) )
;;
esac
;;
tunnel)
case $subcmd in
add|change|del|show|prl|6rd)
# TODO
;;
*)
[[ $cword -eq $subcword ]] && \
COMPREPLY=( $( compgen -W 'help add change del show prl
6rd' -- "$cur" ) )
;;
esac
;;
maddr)
case $subcmd in
add|del)
# TODO
;;
show)
if [[ $cword -eq $subcword+1 || $prev == dev ]]; then
_available_interfaces
[[ $prev != dev ]] && \
COMPREPLY=( $( compgen -W '${COMPREPLY[@]} dev' \
-- "$cur" ) )
fi
;;
*)
[[ $cword -eq $subcword ]] && \
COMPREPLY=( $( compgen -W 'help add del show' \
-- "$cur" ) )
;;
esac
;;
mroute)
case $subcmd in
show)
# TODO
;;
*)
[[ $cword -eq $subcword ]] && \
COMPREPLY=( $( compgen -W 'help show' -- "$cur" ) )
;;
esac
;;
monitor)
case $subcmd in
all) ;;
*)
[[ $cword -eq $subcword ]] && \
COMPREPLY=( $( compgen -W 'help all' -- "$cur" ) )
;;
esac
;;
xfrm)
case $subcmd in
state|policy|monitor)
# TODO
;;
*)
[[ $cword -eq $subcword ]] && \
COMPREPLY=( $( compgen -W 'state policy monitor' \
-- "$cur" ) )
;;
esac
;;
esac
} &&
complete -F _ip ip
# Local variables:
# mode: shell-script
# sh-basic-offset: 4
# sh-indent-comment: t
# indent-tabs-mode: nil
# End:
# ex: ts=4 sw=4 et filetype=sh

View File

@ -46,7 +46,7 @@ _ipv6calc()
return 0
} &&
complete -F _ipv6calc -o filenames ipv6calc
complete -F _ipv6calc ipv6calc
# Local variables:
# mode: shell-script

View File

@ -25,7 +25,7 @@ _jar()
;;
esac
} &&
complete -F _jar -o filenames jar
complete -F _jar jar
# Local variables:
# mode: shell-script

View File

@ -164,7 +164,7 @@ _java()
fi
fi
}
complete -F _java -o filenames java
complete -F _java java
}
have javadoc &&
@ -176,11 +176,16 @@ _javadoc()
_get_comp_words_by_ref cur prev
case $prev in
-overview|-helpfile|-stylesheetfile)
_filedir
-overview|-helpfile)
_filedir '?(x)htm?(l)'
return 0
;;
-d)
-stylesheetfile)
_filedir css
return 0
;;
-d|-link|-linkoffline)
# TODO: -linkoffline takes two arguments
_filedir -d
return 0
;;
@ -212,7 +217,7 @@ _javadoc()
_java_packages
fi
} &&
complete -F _javadoc -o filenames javadoc
complete -F _javadoc javadoc
have javac &&
_javac()
@ -244,7 +249,7 @@ _javac()
_filedir java
fi
} &&
complete -F _javac -o filenames javac
complete -F _javac javac
have pack200 &&
_pack200()
@ -413,7 +418,7 @@ _jarsigner()
_filedir jar
fi
} &&
complete -F _jarsigner -o filenames jarsigner
complete -F _jarsigner jarsigner
# Local variables:
# mode: shell-script

View File

@ -44,7 +44,7 @@ _k3b()
_filedir
fi
} &&
complete -F _k3b -o filenames k3b
complete -F _k3b k3b
# Local variables:
# mode: shell-script

View File

@ -11,13 +11,14 @@ _kldload()
[ -d $moddir ] || moddir=/boot/kernel/
_get_comp_words_by_ref cur
_compopt_o_filenames
COMPREPLY=( $( compgen -f "$moddir$cur" ) )
COMPREPLY=( ${COMPREPLY[@]#$moddir} )
COMPREPLY=( ${COMPREPLY[@]%.ko} )
return 0
}
complete -F _kldload -o filenames kldload
complete -F _kldload kldload
_kldunload()
{
@ -26,7 +27,7 @@ _kldunload()
COMPREPLY=( $( kldstat | \
sed -ne "s/^.*[ \t]\{1,\}\($cur[a-z_]\{1,\}\).ko$/\1/p" ) )
}
complete -F _kldunload -o filenames kldunload
complete -F _kldunload kldunload
}

View File

@ -28,7 +28,8 @@ _lftp()
'$( cut -f 1 -s ~/.lftp/bookmarks 2>/dev/null )' -- "$cur" ) )
_known_hosts_real "$cur"
} &&
complete -F _lftp -o filenames lftp
complete -F _lftp lftp
have lftpget &&
_lftpget()
{

View File

@ -32,7 +32,7 @@ _links()
return 0
} &&
complete -F _links -o filenames links
complete -F _links links
# Local variables:
# mode: shell-script

View File

@ -181,6 +181,6 @@ _lintian_info() {
return 0
}
complete -F _lintian -o filenames lintian
complete -F _lintian_info -o filenames lintian-info
complete -F _lintian lintian
complete -F _lintian_info lintian-info
}

View File

@ -49,10 +49,11 @@ _lrzip()
_expand || return 0
local IFS=$'\n'
_compopt_o_filenames
COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \
$( compgen -d -- "$cur" ) )
} &&
complete -F _lrzip -o filenames lrzip
complete -F _lrzip lrzip
# Local variables:
# mode: shell-script

View File

@ -31,10 +31,11 @@ _lzma()
_expand || return 0
_compopt_o_filenames
COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \
$( compgen -d -- "$cur" ) )
} &&
complete -F _lzma -o filenames lzma
complete -F _lzma lzma
# Local variables:
# mode: shell-script

View File

@ -54,10 +54,11 @@ _lzop()
_expand || return 0
local IFS=$'\n'
_compopt_o_filenames
COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \
$( compgen -d -- "$cur" ) )
} &&
complete -F _lzop -o filenames lzop
complete -F _lzop lzop
# Local variables:
# mode: shell-script

View File

@ -368,7 +368,7 @@ _config_list()
fi
} &&
complete -F _config_list -o filenames config_list
complete -F _config_list config_list
# Try to detect whether this is the mailman "arch" to avoid installing
# it for the coreutils/util-linux-ng one.
@ -416,7 +416,7 @@ _arch()
fi
} &&
complete -F _arch -o filenames arch
complete -F _arch arch
have cleanarch &&
_cleanarch()
@ -460,7 +460,7 @@ _inject()
fi
} &&
complete -F _inject -o filenames inject
complete -F _inject inject
have dumpdb &&
_dumpdb()
@ -478,7 +478,7 @@ _dumpdb()
fi
} &&
complete -F _dumpdb -o filenames dumpdb
complete -F _dumpdb dumpdb
have check_db &&
_check_db()

View File

@ -67,7 +67,7 @@ _make()
fi
} &&
complete -F _make -o filenames make gmake gnumake pmake
complete -F _make make gmake gnumake pmake
# Local variables:
# mode: shell-script

View File

@ -11,7 +11,7 @@ _man()
mansect="@([0-9lnp]|[0-9][px]|3pm)"
COMPREPLY=()
_get_comp_words_by_ref cur prev
_get_comp_words_by_ref -n : cur prev
if [[ "$prev" == -l ]]; then
_filedir $manext
@ -66,12 +66,10 @@ _man()
done
fi
__ltrim_colon_completions "$cur"
return 0
}
[ $USERLAND = GNU -o $UNAME = Darwin \
-o $UNAME = FreeBSD -o $UNAME = SunOS -o $UNAME = Cygwin \
-o $UNAME = OpenBSD ] && \
complete -F _man -o filenames man apropos whatis
} &&
complete -F _man man apropos whatis
# Local variables:
# mode: shell-script

View File

@ -36,7 +36,7 @@ _mc()
_filedir -d
fi
} &&
complete -F _mc -o filenames mc
complete -F _mc mc
# Local variables:
# mode: shell-script

View File

@ -73,7 +73,7 @@ _mcrypt()
fi
fi
} &&
complete -o filenames -F _mcrypt mcrypt mdecrypt
complete -F _mcrypt mcrypt mdecrypt
# Local variables:
# mode: shell-script

View File

@ -50,7 +50,7 @@ _insmod()
return 0
} &&
complete -F _insmod -o filenames insmod modprobe modinfo
complete -F _insmod insmod modprobe modinfo
# Local variables:
# mode: shell-script

View File

@ -50,6 +50,7 @@ _mdtool()
return 0
;;
"generate-makefiles")
_compopt_o_filenames
COMPREPLY=( $( compgen -o filenames -G"*.mds" -- "$cur" ) )
if [[ "$prev" == *mds ]]; then
COMPREPLY=( $( compgen -W '--simple-makefiles --s --d:' \
@ -74,7 +75,7 @@ _mdtool()
return 0
} &&
complete -F _mdtool -o filenames mdtool
complete -F _mdtool mdtool
# Local variables:
# mode: shell-script

View File

@ -247,13 +247,13 @@ _mplayer()
-e "/^-\(Total\|.*\*\)\{0,1\}$/!p" )' -- "$cur" ) )
;;
*)
_filedir '@(mp?(e)g|MP?(E)G|wm[av]|WM[AV]|avi|AVI|asf|ASF|vob|VOB|bin|BIN|dat|DAT|vcd|VCD|ps|PS|pes|PES|fl[iv]|FL[IV]|fxm|FXM|viv|VIV|rm?(j)|RM?(J)|ra?(m)|RA?(M)|yuv|YUV|mov|MOV|qt|QT|mp[234]|MP[234]|m4[av]|M4[AV]|og[gmavx]|OG[GMAVX]|w?(a)v|W?(A)V|dump|DUMP|mk[av]|MK[AV]|m4a|M4A|aac|AAC|m[24]v|M[24]V|dv|DV|rmvb|RMVB|mid|MID|t[ps]|T[PS]|3g[p2]|3gpp?(2)|mpc|MPC|flac|FLAC|vro|VRO|divx|DIVX|aif?(f)|AIF?(F)|m2ts|M2TS|vdr|VDR|xvid|XVID|ape|APE|gif|GIF|nut|NUT|bik|BIK|webm|WEBM|amr|AMR|awb|AWB)?(.part)'
_filedir '@(mp?(e)g|MP?(E)G|wm[av]|WM[AV]|avi|AVI|asf|ASF|vob|VOB|bin|BIN|dat|DAT|vcd|VCD|ps|PS|pes|PES|fl[iv]|FL[IV]|fxm|FXM|viv|VIV|rm?(j)|RM?(J)|ra?(m)|RA?(M)|yuv|YUV|mov|MOV|qt|QT|mp[234]|MP[234]|m4[av]|M4[AV]|og[gmavx]|OG[GMAVX]|w?(a)v|W?(A)V|dump|DUMP|mk[av]|MK[AV]|m4a|M4A|aac|AAC|m[24]v|M[24]V|dv|DV|rmvb|RMVB|mid|MID|t[ps]|T[PS]|3g[p2]|3gpp?(2)|mpc|MPC|flac|FLAC|vro|VRO|divx|DIVX|aif?(f)|AIF?(F)|m2t?(s)|M2T?(S)|vdr|VDR|xvid|XVID|ape|APE|gif|GIF|nut|NUT|bik|BIK|webm|WEBM|amr|AMR|awb|AWB|iso|ISO)?(.part)'
;;
esac
return 0
}
complete -o filenames -F _mplayer mplayer mencoder gmplayer kplayer
complete -F _mplayer mplayer mencoder gmplayer kplayer
}
# Local variables:

View File

@ -120,6 +120,7 @@ _muttfiledir()
# Match any file in $folder beginning with $cur
# (minus the leading '=' sign).
_compopt_o_filenames
COMPREPLY=( $( compgen -f -- "$folder/${cur:1}" ) )
COMPREPLY=( ${COMPREPLY[@]#$folder/} )
return 0
@ -170,7 +171,7 @@ _mutt()
;;
esac
} # _mutt()
complete -F _mutt -o default -o filenames mutt muttng
complete -F _mutt -o default mutt muttng
} # have mutt
# Local variables:

View File

@ -60,7 +60,7 @@ _mysqladmin()
kill password old-password ping processlist reload refresh shutdown \
status start-slave stop-slave variables version' -- "$cur" ) )
} &&
complete -F _mysqladmin -o filenames mysqladmin
complete -F _mysqladmin mysqladmin
# Local variables:
# mode: shell-script

View File

@ -31,6 +31,7 @@ _perl()
case $prev in
-I|-x)
local IFS=$'\n'
_compopt_o_filenames
COMPREPLY=( $( compgen -d $optPrefix $optSuffix -- "$cur" ) )
return 0
;;
@ -47,9 +48,9 @@ _perl()
_filedir
fi
}
complete -F _perl -o nospace -o filenames perl
complete -F _perl -o nospace perl
complete -C $BASH_COMPLETION_DIR/helpers/perldoc -o nospace -o default perldoc
complete -C ${BASH_SOURCE[0]%/*}/helpers/perldoc -o nospace -o default perldoc
}
# Local variables:

View File

@ -29,7 +29,7 @@ _postfix()
COMPREPLY=( $( compgen -W 'check start stop abort flush reload status \
set-permissions upgrade-configuration' -- "$cur" ) )
}
complete -F _postfix -o filenames postfix
complete -F _postfix postfix
# postalias(1) and postmap(1)
#
@ -51,13 +51,14 @@ _postmap()
esac
if [[ $cur == -* ]]; then
COMPREPLY=( $( compgen -W '-N -f -i -n -o -p -r -v -w -c -d -q'\
COMPREPLY=( $( compgen -W '-N -f -i -n -o -p -r -v -w -c -d -q' \
-- "$cur" ) )
return 0
fi
if [[ "$cur" == *:* ]]; then
COMPREPLY=( $( compgen -f -- "${cur#*:}" ) )
_compopt_o_filenames
COMPREPLY=( $( compgen -f -- "${cur#*:}" ) )
else
len=${#cur}
idx=0
@ -68,12 +69,13 @@ _postmap()
fi
done
if [[ $idx -eq 0 ]]; then
_compopt_o_filenames
COMPREPLY=( $( compgen -f -- "$cur" ) )
fi
fi
return 0
}
complete -F _postmap -o filenames postmap postalias
complete -F _postmap postmap postalias
# postcat(1)
#
@ -116,7 +118,7 @@ _postcat()
return 0
fi
}
complete -F _postcat -o filenames postcat
complete -F _postcat postcat
# postconf(1)
#
@ -143,7 +145,7 @@ _postconf()
esac
if [[ $cur == -* ]]; then
COMPREPLY=( $( compgen -W '-A -a -b -c -d -e -h -m -l -n -t -v'\
COMPREPLY=( $( compgen -W '-A -a -b -c -d -e -h -m -l -n -t -v' \
-- "$cur" ) )
return 0
fi
@ -158,7 +160,7 @@ _postconf()
done
return 0
}
complete -F _postconf -o filenames postconf
complete -F _postconf postconf
# postsuper(1)
#
@ -219,7 +221,7 @@ _postsuper()
COMPREPLY=( $( compgen -W 'hold incoming active deferred' -- "$cur" ) )
}
complete -F _postsuper -o filenames postsuper
complete -F _postsuper postsuper
}
# Local variables:

View File

@ -151,7 +151,7 @@ _psql()
_pg_databases
fi
}
complete -F _psql -o filenames psql
complete -F _psql psql
}
# Local variables:

View File

@ -54,7 +54,7 @@ _povray()
;;
esac
} &&
complete -F _povray -o filenames povray xpovray spovray
complete -F _povray povray xpovray spovray
# Local variables:
# mode: shell-script

View File

@ -43,11 +43,9 @@ _python()
-U -v -V -W -x -c" -- "$cur" ) )
fi
return 0
} &&
complete -F _python -o filenames python
complete -F _python python
# Local variables:
# mode: shell-script

View File

@ -96,7 +96,7 @@ _qemu()
return 0
;;
-runas)
COMPREPLY=( $( compgen -u -- "$cur" ) )
_allowed_users
return 0
;;
esac
@ -121,7 +121,7 @@ _qemu()
_filedir
fi
} &&
complete -F _qemu -o filenames qemu
complete -F _qemu qemu
# Local variables:
# mode: shell-script

View File

@ -32,7 +32,7 @@ _rcs()
# otherwise, default to directories
[[ ${#COMPREPLY[@]} -eq 0 && $1 == ci ]] && _filedir || _filedir -d
} &&
complete -F _rcs -o filenames ci co rlog rcs rcsdiff
complete -F _rcs ci co rlog rcs rcsdiff
# Local variables:
# mode: shell-script

View File

@ -84,7 +84,7 @@ _reportbug()
_filedir
return 0
} &&
complete -F _reportbug -o filenames reportbug
complete -F _reportbug reportbug
have querybts &&
_querybts()
@ -121,7 +121,7 @@ _querybts()
www.debian.org' -- "$cur" ) \
$( apt-cache pkgnames -- "$cur" 2> /dev/null) )
} &&
complete -F _querybts -o filenames querybts
complete -F _querybts querybts
# Local variables:
# mode: shell-script

View File

@ -24,8 +24,6 @@ _rpm_installed_packages()
_rpm_groups()
{
# TODO: shown completions are wrong but real ones work nevertheless
# http://lists.alioth.debian.org/pipermail/bash-completion-devel/2009-May/001486.html
local IFS=$'\n'
COMPREPLY=( $( compgen -W "$( rpm -qa $nodig $nosig --queryformat \
'%{group}\n' )" -- "$cur" ) )
@ -101,6 +99,7 @@ _rpm()
return 0
;;
--pipe)
_compopt_o_filenames
COMPREPLY=( $( compgen -c -- "$cur" ) )
return 0
;;
@ -118,9 +117,9 @@ _rpm()
_filedir
else
# complete on capabilities
local IFS=$'\n'
COMPREPLY=( $( compgen -W "$( rpm -qa $nodig $nosig \
--queryformat='%{providename}\n' )" -- "$cur" ) )
local IFS=$'\n'
COMPREPLY=( $( compgen -W "$( rpm -qa $nodig $nosig \
--queryformat='%{providename}\n' )" -- "$cur" ) )
fi
return 0
;;
@ -131,8 +130,7 @@ _rpm()
# complete on capabilities
local IFS=$'\n'
COMPREPLY=( $( compgen -W "$( rpm -qa $nodig $nosig \
--queryformat='%{requirename}\n' )" \
-- "$cur" ) )
--queryformat='%{requirename}\n' )" -- "$cur" ) )
fi
return 0
;;
@ -249,7 +247,7 @@ _rpm()
elif [[ ${COMP_WORDS[1]} == -b* ]]; then
_filedir spec
else
_filedir '@(t?(ar.)@([gx]z|bz?(2))|tar.@(lzma|Z))'
_filedir '@(t?(ar.)@([gx]z|bz?(2))|tar?(.@(lzma|Z)))'
fi
;;
--rebuild|--recompile)
@ -261,7 +259,7 @@ _rpm()
fi
;;
--tarbuild)
_filedir '@(t?(ar.)@([gx]z|bz?(2))|tar.@(lzma|Z))'
_filedir '@(t?(ar.)@([gx]z|bz?(2))|tar?(.@(lzma|Z)))'
;;
--resign|--addsign)
_filedir '[rs]pm'
@ -279,7 +277,8 @@ _rpm()
;;
--import|--dbpath|--root)
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--import --dbpath --root' -- "$cur" ) )
COMPREPLY=( $( compgen -W '--import --dbpath --root' \
-- "$cur" ) )
else
_filedir
fi
@ -288,7 +287,7 @@ _rpm()
return 0
}
complete -F _rpm -o filenames rpm rpmbuild
complete -F _rpm rpm rpmbuild
}
# Local variables:

View File

@ -11,16 +11,16 @@ _sbcl()
# completing an option (may or may not be separated by a space)
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--core --noinform --help --version \
--sysinit --userinit --eval --noprint --disable-debugger \
--end-runtime-options --end-toplevel-options ' -- "$cur" ) )
COMPREPLY=( $( compgen -W '--core --noinform --help --version
--sysinit --userinit --eval --noprint --disable-debugger
--end-runtime-options --end-toplevel-options ' -- "$cur" ) )
else
_filedir
_filedir
fi
return 0
} &&
complete -F _sbcl -o filenames sbcl sbcl-mt
complete -F _sbcl sbcl sbcl-mt
# Local variables:
# mode: shell-script

View File

@ -3,16 +3,9 @@
have screen &&
_screen_sessions()
{
local pattern
if [ -n "$1" ]; then
pattern=".*$1.*"
else
pattern=".*"
fi
COMPREPLY=( $( command screen -ls | sed -ne \
's|^['$'\t'']\{1,\}\('"$cur"'[0-9]\{1,\}\.[^'$'\t'']\{1,\}\)'"$pattern"'$|\1|p' ) )
COMPREPLY=( $( compgen -W "$( command screen -ls | sed -ne \
's|^\t\{1,\}\([0-9]\{1,\}\.[^\t]\{1,\}\).*'"$1"'.*$|\1|p' )" \
-- "$cur" ) )
} &&
_screen()
{
@ -36,11 +29,16 @@ _screen()
_screen_sessions 'Detached'
return 0
;;
-[dDx])
-[dD])
# list attached
_screen_sessions 'Attached'
return 0
;;
-x)
# list both
_screen_sessions
return 0
;;
-s)
_shells
return 0

View File

@ -30,7 +30,7 @@ _sh()
_filedir sh
} &&
complete -F _sh -o filenames sh
complete -F _sh sh
# Local variables:
# mode: shell-script

View File

@ -14,7 +14,8 @@ _useradd()
# with -u/--uid
case $prev in
-c|--comment|-h|--help|-e|--expiredate|-f|--inactive|-k|--key|-p|--password|-u|--uid|-Z|--selinux-user)
-c|--comment|-h|--help|-e|--expiredate|-f|--inactive|-k|--key|\
-p|--password|-u|--uid|-Z|--selinux-user)
return 0
;;
-b|--base-dir|-d|--home|-k|--skel)
@ -64,7 +65,8 @@ _usermod()
# with -u/--uid
case $prev in
-c|--comment|-d|--home|-e|--expiredate|-f|--inactive|-h|--help|-l|--login|-p|--password|-u|--uid|-Z|--selinux-user)
-c|--comment|-d|--home|-e|--expiredate|-f|--inactive|-h|--help|\
-l|--login|-p|--password|-u|--uid|-Z|--selinux-user)
return 0
;;
-g|--gid)
@ -126,7 +128,8 @@ _chage()
_split_longopt && split=true
case $prev in
-d|--lastday|-E|--expiredate|-h|--help|-I|--inactive|-m|--mindays|-M|--maxdays|-W|--warndays)
-d|--lastday|-E|--expiredate|-h|--help|-I|--inactive|-m|--mindays|\
-M|--maxdays|-W|--warndays)
return 0
;;
esac
@ -163,7 +166,7 @@ _passwd()
return 0
fi
COMPREPLY=( $( compgen -u -- "$cur" ) )
_allowed_users
} &&
complete -F _passwd passwd
@ -229,7 +232,7 @@ _newusers()
_filedir
} &&
complete -F _newusers -o filenames newusers
complete -F _newusers newusers
have pwck &&
_pwck()
@ -246,7 +249,7 @@ _pwck()
_filedir
} &&
complete -F _pwck -o filenames pwck
complete -F _pwck pwck
have groupadd &&
_groupadd()
@ -316,9 +319,11 @@ _newgrp()
COMPREPLY=()
if [[ "`_get_cword`" == "-" ]]; then
COMPREPLY=( - )
else
_allowed_groups
fi
} &&
complete -g -F _newgrp newgrp
complete -F _newgrp newgrp
have gpasswd &&
_gpasswd()
@ -385,7 +390,7 @@ _grpck()
_filedir
} &&
complete -F _grpck -o filenames grpck
complete -F _grpck grpck
have vipw || have vigr &&
_vipw()

View File

@ -28,7 +28,7 @@ _sqlite3()
_filedir $dbexts
} &&
complete -F _sqlite3 -o filenames sqlite3
complete -F _sqlite3 sqlite3
# Local variables:
# mode: shell-script

View File

@ -184,6 +184,7 @@ _ssh()
done
_known_hosts_real -a -F "$configfile" "$cur"
if [ $COMP_CWORD -ne 1 ]; then
_compopt_o_filenames
COMPREPLY=( "${COMPREPLY[@]}" $( compgen -c -- "$cur" ) )
fi
fi
@ -415,7 +416,7 @@ _ssh_copy_id()
return 0
}
complete -F _ssh_copy_id -o filenames ssh-copy-id
complete -F _ssh_copy_id ssh-copy-id
}
# Local variables:

View File

@ -30,56 +30,57 @@ _strace()
_get_comp_words_by_ref cur prev
case $prev in
-e)
if [[ "$cur" == *=* ]]; then
prev=${cur/=*/}
cur=${cur/*=/}
-e)
if [[ "$cur" == *=* ]]; then
prev=${cur/=*/}
cur=${cur/*=/}
# Import arch-specific syscalls -- not foolproof IMHO
#+ --David Paleino
arch=$(command uname -m)
syscalls=$(awk '/^#define __NR/ {print $2}' \
/usr/include/asm/unistd.h | sed -e \
's/__NR_//')
if [ -z "$syscalls" ]; then
if [[ "$arch" == *86 ]]; then
unistd=/usr/include/asm/unistd_32.h
else
unistd=/usr/include/asm/unistd_64.h
fi
# Import arch-specific syscalls -- not foolproof IMHO
#+ --David Paleino
arch=$(command uname -m)
syscalls=$(awk '/^#define __NR/ {print $2}' \
$unistd | sed -e 's/__NR_//')
fi
/usr/include/asm/unistd.h | sed -e \
's/__NR_//')
if [ -z "$syscalls" ]; then
if [[ "$arch" == *86 ]]; then
unistd=/usr/include/asm/unistd_32.h
else
unistd=/usr/include/asm/unistd_64.h
fi
syscalls=$(awk '/^#define __NR/ {print $2}' \
$unistd | sed -e 's/__NR_//')
fi
case $prev in
trace)
COMPREPLY=( $( compgen -W "$syscalls file process \
network signal ipc desc all none" -- "$cur") )
return 0
;;
esac
else
COMPREPLY=( $( compgen -S"=" -W 'trace abbrev \
verbose raw signal read write' -- "$cur" ) )
fi
return 0
;;
-o)
_filedir
return 0
;;
-p)
_pids
return 0
;;
-S)
COMPREPLY=( $( compgen -W 'time calls name nothing' -- "$cur" ) )
return 0
;;
-u)
COMPREPLY=( $( compgen -u -- "$cur" ) )
return 0
;;
case $prev in
trace)
COMPREPLY=( $( compgen -W "$syscalls file process
network signal ipc desc all none" -- "$cur") )
return 0
;;
esac
else
COMPREPLY=( $( compgen -S"=" -W 'trace abbrev verbose raw
signal read write' -- "$cur" ) )
fi
return 0
;;
-o)
_filedir
return 0
;;
-p)
_pids
return 0
;;
-S)
COMPREPLY=( $( compgen -W 'time calls name nothing' \
-- "$cur" ) )
return 0
;;
-u)
_allowed_users
return 0
;;
esac
if [[ "$cur" == -* ]]; then

View File

@ -214,7 +214,7 @@ _svk()
return 0
} &&
complete -F _svk -o filenames svk
complete -F _svk svk
# Local variables:
# mode: shell-script

View File

@ -1,6 +1,6 @@
# bash completion for sysbench
# We set -o nospace and turn it off in quite a few place for bash < 4
# We set -o nospace and turn it off in quite a few places for bash < 4
# reasons; assuming bash >= 4 we could instead not turn it on
# initially but only in the few cases where it's actually needed.

View File

@ -19,20 +19,20 @@ _tar()
return 0
;;
+([^IZzJjy])f)
ext='t@(ar?(.@(Z|gz|bz?(2)|lz?(ma)|xz))|gz|bz?(2)|lz?(ma)|xz)'
regex='t\(ar\(\.\(Z\|gz\|bz2\?\|lzma\|xz\)\)\?\|gz\|bz2\?\|lzma\|xz\)'
ext='@(@(tar|gem)?(.@(Z|[gx]z|bz?(2)|lzma))|t@([glx]z|bz?(2)))'
regex='\(\(tar\|gem\)\(\.\(Z\|[gx]z\|bz?(2)\|lzma\)\)\?\|t\([glx]z\|bz2\?\)\)'
;;
*[Zz]*f)
ext='t?(ar.)@(gz|Z)'
regex='t\(ar\.\)\?\(gz\|Z\)'
ext='@(t?(ar.)|gem.)@(gz|Z)'
regex='\(t\(ar\.\)\?\|gem\.\)\(gz\|Z\)'
;;
*[Ijy]*f)
ext='t?(ar.)bz?(2)'
regex='t\(ar\.\)\?bz2\?'
ext='@(t?(ar.)|gem.)bz?(2)'
regex='\(t\(ar\.\)\?\|gem\.\)bz2\?'
;;
*[J]*f)
ext='t?(ar.)@(lz?(ma)|xz)'
regex='t\(ar\.\)\?\(lzma\|xz\)\?'
ext='@(t?(ar.)|gem.)@(lz?(ma)|xz)'
regex='\(t\(ar\.\)\?\|gem\.\)\(lzma\|xz\)\?'
;;
*)
_filedir
@ -48,7 +48,8 @@ _tar()
# devise how to untar and list it
untar=t${COMP_WORDS[1]//[^Izjyf]/}
COMPREPLY=( $( compgen -W "$( printf '%s ' $( tar $untar $tar \
local IFS=$'\n'
COMPREPLY=( $( compgen -W "$( printf '%s\n' $( tar $untar $tar \
2>/dev/null ) )" -- "$cur" ) )
return 0
fi
@ -59,7 +60,7 @@ _tar()
return 0
}
[ -n "${COMP_TAR_INTERNAL_PATHS:-}" ] && complete -F _tar -o dirnames tar ||
complete -F _tar -o filenames tar
complete -F _tar tar
}
# Local variables:

View File

@ -18,7 +18,7 @@ _unace()
fi
fi
} &&
complete -F _unace -o filenames unace
complete -F _unace unace
# Local variables:
# mode: shell-script

View File

@ -21,7 +21,7 @@ _unrar()
fi
} &&
complete -F _unrar -o filenames unrar
complete -F _unrar unrar
# Local variables:
# mode: shell-script

View File

@ -17,7 +17,7 @@ _renice()
curopt=${COMP_WORDS[COMP_CWORD-$i]}
case "$curopt" in
-u)
COMPREPLY=( $( compgen -u -- "$cur" ) )
_allowed_users
;;
-g)
_pgids

View File

@ -1,51 +1,84 @@
# bash completion for cdrecord/wodim
# We set -o nospace and turn it off in several places for bash < 4
# reasons; assuming bash >= 4 we could instead not turn it on
# initially but only in the few cases where it's actually needed.
have cdrecord || have wodim &&
_cdrecord()
{
local cur prev i generic_options track_options track_mode
COMPREPLY=()
_get_comp_words_by_ref cur prev
_get_comp_words_by_ref -n = cur prev
# foo=bar style option
if [[ "$cur" == *=* ]]; then
prev=${cur/=*/}
cur=${cur/*=/}
prev=${cur%%=*}
cur=${cur#*=}
case $prev in
textfile|cuefile)
textfile|cuefile|msifile)
compopt +o nospace &>/dev/null
_filedir
return 0
;;
blank)
COMPREPLY=( $( compgen -W 'help all fast \
track unreserve trtail unclose session' \
-- "$cur" ) )
return 0
compopt +o nospace &>/dev/null
COMPREPLY=( $( compgen -W 'help all fast track unreserve trtail
unclose session' -- "$cur" ) )
;;
driveropts)
COMPREPLY=( $( compgen -W 'burnfree noburnfree\
varirec= audiomaster forcespeed noforcespeed\
speedread nospeedread singlesession \
nosinglesession hidecdr nohidecdr tattooinfo\
tattoofile=' -- "$cur" ) )
return 0
if [[ $cur == *=* ]]; then
prev=${cur%%=*}
cur=${cur#*=}
case $prev in
varirec)
compopt +o nospace &>/dev/null
COMPREPLY=( $( compgen -W "-2 -1 0 1 2" \
-- "$cur" ) )
;;
gigarec)
compopt +o nospace &>/dev/null
COMPREPLY=( $( compgen -W "0.6 0.7 0.8 1.0 1.2 1.3
1.4" -- "$cur" ) )
;;
tattoofile)
compopt +o nospace &>/dev/null
_filedir
;;
esac
else
COMPREPLY=( $( compgen -W 'burnfree noburnfree varirec=
gigarec= audiomaster forcespeed noforcespeed speedread
nospeedread singlesession nosinglesession hidecdr
nohidecdr tattooinfo tattoofile=' -- "$cur" ) )
[[ ${#COMPREPLY[@]} == 1 && ${COMPREPLY[0]} != *= ]] && \
compopt +o nospace &>/dev/null
fi
;;
driver)
compopt +o nospace &>/dev/null
COMPREPLY=( $( compgen -W "$( $1 driver=help 2>&1 | \
awk 'NR > 1 { print $1 }' ) help" -- "$cur" ) )
;;
minbuf)
compopt +o nospace &>/dev/null
COMPREPLY=( $( compgen -W "$( seq 25 95 2>/dev/null )" \
-- "$cur" ) )
;;
esac
return 0
fi
generic_options=(-version -v -V -d -silent -force -immed -dummy \
-dao -raw -raw96r -raw96p -raw16 -multi -msinfo -toc \
-atip -fix -nofix -waiti -load -lock -eject -format \
-setdropts -checkdrive -prcap -inq -scanbus -reset \
-abort -overburn -ignsize -useinfo -packet -noclose \
-text debug= kdebug= kd= minbuf= speed= blank= fs= \
dev= gracetime= timeout= driver= driveropts= \
defpregap= pktsize= mcn= textfile= cuefile=)
track_options=(-audio -swab -data -mode2 -xa -xa1 -xa2 -xamix -cdi \
-isosize -pad padsize= -nopad -shorttrack -noshorttrack\
pregap= -preemp -nopreemp -copy -nocopy -scms tcsize= \
isrc= index=)
generic_options=( -version -v -V -d -silent -force -immed -dummy -clone \
-dao -sao -tao -raw -raw96r -raw96p -raw16 -multi -msinfo -toc -atip \
-fix -nofix -waiti -load -lock -eject -format -setdropts -checkdrive \
-prcap -inq -scanbus --devices -reset -abort -overburn -ignsize \
-useinfo -packet -noclose -text debug= kdebug= minbuf= msifile= \
speed= blank= fs= ts= dev= gracetime= timeout= driver= driveropts= \
defpregap= pktsize= mcn= textfile= cuefile= )
track_options=( -audio -swab -data -mode2 -xa -xa1 -xa2 -xamix -cdi \
-isosize -pad -nopad -shorttrack -noshorttrack -preemp -nopreemp \
-copy -nocopy -scms isrc= index= padsize= pregap= tsize= )
# look if previous was either a file or a track option
track_mode=0
if [ $COMP_CWORD -gt 1 ]; then
@ -71,9 +104,10 @@ _cdrecord()
COMPREPLY=( "${COMPREPLY[@]}" \
$( compgen -W '${generic_options[@]}' -- "$cur" ) )
fi
[[ ${#COMPREPLY[@]} == 1 && ${COMPREPLY[0]} != *= ]] && \
compopt +o nospace &>/dev/null
} &&
complete -F _cdrecord -o filenames cdrecord wodim
complete -F _cdrecord -o nospace cdrecord wodim
# Local variables:
# mode: shell-script

View File

@ -25,7 +25,7 @@ _wtf()
COMPREPLY=( $( compgen -W "$( cut -f 1 -s $db ) -f" -- "${cur}" ) )
} &&
complete -F _wtf -o filenames wtf
complete -F _wtf wtf
# Local variables:
# mode: shell-script

View File

@ -44,7 +44,7 @@ _xmllint()
_filedir '@(*ml|htm|svg|xs[dl]|rng|wsdl)'
} &&
complete -F _xmllint -o filenames xmllint
complete -F _xmllint xmllint
# Local variables:
# mode: shell-script

View File

@ -28,7 +28,7 @@ _xmlwf()
_filedir '@(*ml|htm|svg)'
} &&
complete -F _xmlwf -o filenames xmlwf
complete -F _xmlwf xmlwf
# Local variables:
# mode: shell-script

View File

@ -19,7 +19,7 @@ _xmms()
fi
} &&
complete -F _xmms -o filenames xmms
complete -F _xmms xmms
# Local variables:
# mode: shell-script

View File

@ -21,7 +21,7 @@ _xmodmap()
_filedir
} &&
complete -F _xmodmap -o filenames xmodmap
complete -F _xmodmap xmodmap
# Local variables:
# mode: shell-script

View File

@ -26,7 +26,7 @@ _xrdb()
_filedir
} &&
complete -F _xrdb -o filenames xrdb
complete -F _xrdb xrdb
# Local variables:
# mode: shell-script

View File

@ -45,7 +45,7 @@ _xsltproc()
_filedir '@(xsl|xslt|xml)'
fi
} &&
complete -F _xsltproc -o filenames xsltproc
complete -F _xsltproc xsltproc
# Local variables:
# mode: shell-script

View File

@ -53,10 +53,11 @@ _xz()
_expand || return 0
local IFS=$'\n'
_compopt_o_filenames
COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \
$( compgen -d -- "$cur" ) )
} &&
complete -F _xz -o filenames xz
complete -F _xz xz
# xzdec(1) completion
#
@ -88,9 +89,9 @@ _xzdec()
$split && return 0
_filedir xz # no lzma support here as of xz 4.999.8beta
_filedir xz # no lzma support here as of xz 4.999.9beta
} &&
complete -F _xzdec -o filenames xzdec
complete -F _xzdec xzdec
# Local variables:
# mode: shell-script

View File

@ -13,7 +13,7 @@ _yum_arch()
_filedir -d
fi
} &&
complete -F _yum_arch -o filenames yum-arch
complete -F _yum_arch yum-arch
# Local variables:
# mode: shell-script

View File

@ -1,7 +1,7 @@
AC_PREREQ([2.59])
AC_INIT([bash-completion], [1.99])
AM_INIT_AUTOMAKE([foreign dejagnu dist-bzip2 -Wall -Werror])
AM_INIT_AUTOMAKE([foreign dejagnu dist-bzip2 no-dist-gzip -Wall -Werror])
AC_SUBST(bashcompdir, $sysconfdir/bash_completion.d)
AC_SUBST(helpersdir, $sysconfdir/bash_completion.d/helpers)
AC_CONFIG_FILES([Makefile completions/Makefile helpers/Makefile test/Makefile])
AC_CONFIG_FILES([Makefile completions/Makefile completions/helpers/Makefile test/Makefile])
AC_OUTPUT

View File

@ -19,7 +19,7 @@ Environment variables
*COMP_KNOWN_HOSTS_WITH_HOSTFILE*::
If set and not null (default), known_hosts completion will complement
If set and not null (default), known hosts completion will complement
hostnames from ssh's known_hosts_files with hostnames taken from the file
specified by the HOSTFILE shell variable (compgen -A hostname). If null,
known_hosts completion will omit hostnames from HOSTFILE. Omitting
@ -27,6 +27,12 @@ Environment variables
local web development or ad-blocking.
*COMP_KNOWN_HOSTS_WITH_AVAHI*::
If set and not null, known hosts completion will try to use `avahi-browse`
for additional completions. This may be a slow operation in some setups.
Default is unset.
*COMP_TAR_INTERNAL_PATHS*::
If set and not null *before* sourcing bash_completion, `tar` completion
will do correct path completion for tar file contents. If unset or null,

View File

@ -54,6 +54,18 @@ is preferable because anyone, with any keyboard layout, is able to
type it. Backticks aren't always available, without doing strange
key combinations.
-o filenames
------------
As a rule of thumb, do not use "complete -o filenames". Doing it makes
it take effect for all completions from the affected function, which
may break things if some completions from the function must not be
escaped as filenames. Instead, use the _compopt_o_filenames function
to turn on "-o filenames" behavior dynamically when returning
completions that need that kind of processing (e.g. file and command
names). The _filedir and _filedir_xspec helpers do this automatically
whenever they return some completions.
/////////////////////////////////////////
case/esac vs if
---------------

View File

@ -1,8 +1,14 @@
DEJATOOL = completion install unit
AM_RUNTESTFLAGS = --outdir log
AM_RUNTESTFLAGS = --outdir log --ignore $(PACKAGE).log
EXTRA_DIST = completion \
config \
fixtures \
lib \
unit
all:
$(mkdir_p) log tmp
distclean-local:
rm -rf log tmp

View File

@ -2,7 +2,7 @@ set test "Completion via _filedir_xspec() should be installed"
set cmd "complete -p acroread"
send "$cmd\r"
set expected "^$cmd\r\ncomplete -o filenames -F _filedir_xspec acroread\r\n/@$"
set expected "^$cmd\r\ncomplete -F _filedir_xspec acroread\r\n/@$"
expect {
-re $expected { pass "$test" }
-re /@ { fail "$test at prompt" }

View File

@ -0,0 +1 @@
assert_source_completions growisofs

Some files were not shown because too many files have changed in this diff Show More