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ä ] [ Ville Skyttä ]
* Activate hping2 completion also for hping and hping3. * Activate hping2 completion also for hping and hping3.
* Add badblocks, compgen, crontab, dumpe2fs, e2freefrag, e2label, ether-wake, * Add badblocks, compgen, crontab, dumpe2fs, e2freefrag, e2label, ether-wake,
filefrag, iftop, lrzip, POSIX sh, sysbench, tune2fs, xmodmap, and xrdb filefrag, growisofs, iftop, ip (Debian: #600617), lrzip, POSIX sh,
completions. sha{,224,256,384,512}sum, sysbench, tune2fs, xmodmap, and xrdb completions.
* Add *.gif (Alioth: #312512), *.3gpp, *.3gpp2, and *.awb to mplayer * Add *.gif (Alioth: #312512), *.m2t (Alioth: #312770), *.3gpp, *.3gpp2,
filename completions. *.awb, and *.iso (Alioth: #311420) to mplayer filename completions.
* Add "short" tarball extensions to unxz, unlzma etc completions. * Add "short" tarball extensions to unxz, unlzma etc completions.
* Improve /etc/init.d/*, ipmitool, jar, mencoder, mplayer, povray, sqlite3, * Improve /etc/init.d/*, ipmitool, jar, javadoc, man, mencoder, mkdir,
and general help parsing completions. mplayer, povray, rpmbuild, sqlite3, tar, wodim, and general help parsing
completions.
* Fix p4 and povray completions (Alioth: #312625). * Fix p4 and povray completions (Alioth: #312625).
* Add *.xsd, *.xsl, *.rng, and *.wsdl to xmllint filename completions. * Add *.xsd, *.xsl, *.rng, and *.wsdl to xmllint filename completions.
* Recognize rpm query mode based on the --file, --group, --package, and * 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. filename extension arguments in addition to exact case matches.
* IPv6 known hosts completion fixes (Alioth: #312695, RedHat: #630658). * IPv6 known hosts completion fixes (Alioth: #312695, RedHat: #630658).
* Fixes to completions for filenames containing tabs (RedHat: #629518). * 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 ] [ Freddy Vulto ]
* Added _tilde(), fix ~username completion (Alioth: #312613, Debian: #587095) * 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 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 '!*.texi*' makeinfo texi2html
complete -f -X '!*.@(?(la)tex|texi|dtx|ins|ltx)' tex latex slitex jadetex pdfjadetex pdftex pdflatex texi2dvi 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 '!*.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 '!*.@(avi|asf|wmv)' aviplay
complete -f -X '!*.@(rm?(j)|ra?(m)|smi?(l))' realplay complete -f -X '!*.@(rm?(j)|ra?(m)|smi?(l))' realplay
complete -f -X '!*.@(mpg|mpeg|avi|mov|qt)' xanim 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 # start of section containing compspecs that can be handled within bash
# user commands see only users # 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 # bg completes with stopped jobs
complete -A stopped -P '"%' -S '"' bg complete -A stopped -P '"%' -S '"' bg
@ -607,6 +608,16 @@ _quote_readline_by_ref()
} # _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 # This function performs file and directory completion. It's better than
# simply using 'compgen -f', because it honours spaces in filenames. # simply using 'compgen -f', because it honours spaces in filenames.
# @param $1 If `-d', complete only on directories. Otherwise filter/pick only # @param $1 If `-d', complete only on directories. Otherwise filter/pick only
@ -642,13 +653,8 @@ _filedir()
xspec=${1:+"!*.@($1|${1^^})"} || \ xspec=${1:+"!*.@($1|${1^^})"} || \
xspec=${1:+"!*.@($1|$(printf %s $1 | tr '[:lower:]' '[:upper:]'))"} xspec=${1:+"!*.@($1|$(printf %s $1 | tr '[:lower:]' '[:upper:]'))"}
toks=( ${toks[@]-} $( compgen -f -X "$xspec" -- $quoted) ) 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 fi
[ ${#toks[@]} -ne 0 ] && _compopt_o_filenames
COMPREPLY=( "${COMPREPLY[@]}" "${toks[@]}" ) COMPREPLY=( "${COMPREPLY[@]}" "${toks[@]}" )
} # _filedir() } # _filedir()
@ -712,6 +718,10 @@ _mac_addresses()
"s/.*[[:space:]]\($re\)[[:space:]].*/\1/p" -ne \ "s/.*[[:space:]]\($re\)[[:space:]].*/\1/p" -ne \
"s/.*[[:space:]]\($re\)[[:space:]]*$/\1/p" ) ) "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" ) ) COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) )
__ltrim_colon_completions "$cur" __ltrim_colon_completions "$cur"
} }
@ -779,6 +789,7 @@ _tilde() {
local result=0 local result=0
# Does $1 start with tilde (~) and doesn't contain slash (/)? # Does $1 start with tilde (~) and doesn't contain slash (/)?
if [[ ${1:0:1} == "~" && $1 == ${1//\/} ]]; then if [[ ${1:0:1} == "~" && $1 == ${1//\/} ]]; then
_compopt_o_filenames
# Try generate username completions # Try generate username completions
COMPREPLY=( $( compgen -P '~' -u "${1#\~}" ) ) COMPREPLY=( $( compgen -P '~' -u "${1#\~}" ) )
result=${#COMPREPLY[@]} result=${#COMPREPLY[@]}
@ -967,10 +978,10 @@ _installed_modules()
# The : must be added manually; it will only complete usernames initially. # The : must be added manually; it will only complete usernames initially.
# The legacy user.group format is not supported. # 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() _usergroup()
{ {
local IFS=$'\n'
if [[ $cur = *\\\\* || $cur = *:*:* ]]; then if [[ $cur = *\\\\* || $cur = *:*:* ]]; then
# Give up early on if something seems horribly wrong. # Give up early on if something seems horribly wrong.
return return
@ -981,20 +992,62 @@ _usergroup()
local prefix local prefix
prefix=${cur%%*([^:])} prefix=${cur%%*([^:])}
prefix=${prefix//\\} 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 elif [[ $cur = *:* ]]; then
# Completing group after 'user:gr<TAB>'. # Completing group after 'user:gr<TAB>'.
# Reply with a list of unprefixed groups since readline with split on : # Reply with a list of unprefixed groups since readline with split on :
# and only replace the 'gr' part # 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 else
# Completing a partial 'usernam<TAB>'. # Completing a partial 'usernam<TAB>'.
# #
# Don't suffix with a : because readline will escape it and add a # Don't suffix with a : because readline will escape it and add a
# slash. It's better to complete into 'chown username ' than 'chown # slash. It's better to complete into 'chown username ' than 'chown
# username\:'. # username\:'.
if [[ $1 == -u ]]; then
_allowed_users "$cur"
else
local IFS=$'\n'
COMPREPLY=( $( compgen -u -- "$cur" ) ) COMPREPLY=( $( compgen -u -- "$cur" ) )
fi 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
} }
# This function completes on valid shells # This function completes on valid shells
@ -1149,7 +1202,8 @@ _known_hosts()
# Helper function for completing _known_hosts. # Helper function for completing _known_hosts.
# This function performs host completion based on ssh's config and 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 # HOSTFILE (compgen -A hostname) are added, unless
# COMP_KNOWN_HOSTS_WITH_HOSTFILE is set to an empty value. # COMP_KNOWN_HOSTS_WITH_HOSTFILE is set to an empty value.
# Usage: _known_hosts_real [OPTIONS] CWORD # Usage: _known_hosts_real [OPTIONS] CWORD
@ -1294,12 +1348,14 @@ _known_hosts_real()
-S "$suffix" -W "$hosts" -- "$cur" ) ) -S "$suffix" -W "$hosts" -- "$cur" ) )
fi fi
# Add hosts reported by avahi-browse, if it's available. # Add hosts reported by avahi-browse, if desired and it's available.
# The original call to avahi-browse also had "-k", to avoid lookups into if [[ ${COMP_KNOWN_HOSTS_WITH_AVAHI:-} ]] && \
# avahi's services DB. We don't need the name of the service, and if it type avahi-browse &>/dev/null; then
# contains ";", it may mistify the result. But on Gentoo (at least), # The original call to avahi-browse also had "-k", to avoid lookups
# -k isn't available (even if mentioned in the manpage), so... # into avahi's services DB. We don't need the name of the service, and
if type avahi-browse >&/dev/null; then # 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[@]}" $( \ COMPREPLY=( "${COMPREPLY[@]}" $( \
compgen -P "$prefix$user" -S "$suffix" -W \ compgen -P "$prefix$user" -S "$suffix" -W \
"$( avahi-browse -cpr _workstation._tcp 2>/dev/null | \ "$( avahi-browse -cpr _workstation._tcp 2>/dev/null | \
@ -1335,10 +1391,7 @@ _cd()
return 0 return 0
fi fi
# Turn on -o filenames; see http://bugs.debian.org/272660#64 for _compopt_o_filenames
# info about the compgen hack (bash < 4)
compopt -o filenames 2>/dev/null || \
compgen -f /non-existing-dir/ >/dev/null
# Use standard dir completion if no CDPATH or parameter starts with /, # Use standard dir completion if no CDPATH or parameter starts with /,
# ./ or ../ # ./ or ../
@ -1435,6 +1488,7 @@ _command_offset()
_get_comp_words_by_ref cur _get_comp_words_by_ref cur
if [[ $COMP_CWORD -eq 0 ]]; then if [[ $COMP_CWORD -eq 0 ]]; then
_compopt_o_filenames
COMPREPLY=( $( compgen -c -- "$cur" ) ) COMPREPLY=( $( compgen -c -- "$cur" ) )
else else
cmd=${COMP_WORDS[0]} cmd=${COMP_WORDS[0]}
@ -1473,56 +1527,60 @@ _command_offset()
[ ${#COMPREPLY[@]} -eq 0 ] && _filedir [ ${#COMPREPLY[@]} -eq 0 ] && _filedir
} }
complete -F _command -o filenames nohup exec nice eval time ltrace then \ complete -F _command aoss command do else eval exec ltrace nice nohup padsp \
else do vsound command xargs tsocks aoss padsp then time tsocks vsound xargs
_root_command() _root_command()
{ {
local PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin local PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin
local root_command=$1
_command $1 $2 $3 _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() _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 case "$prev" in
*[Dd][Ii][Rr]*) --*[Dd][Ii][Rr]*)
_filedir -d _filedir -d
return 0
;; ;;
*[Ff][Ii][Ll][Ee]*) --*[Ff][Ii][Ll][Ee]*|--*[Pp][Aa][Tt][Hh]*)
_filedir _filedir
return 0
;; ;;
esac esac
return 0
fi $split && return 0
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W "$( $1 --help 2>&1 | \ COMPREPLY=( $( compgen -W "$( $1 --help 2>&1 | \
sed -ne 's/.*\(--[-A-Za-z0-9]\{1,\}\).*/\1/p' | sort -u )" \ sed -ne 's/.*\(--[-A-Za-z0-9]\{1,\}\).*/\1/p' | sort -u )" \
-- "$cur" ) ) -- "$cur" ) )
elif [[ "$1" == rmdir ]]; then elif [[ "$1" == @(mk|rm)dir ]]; then
_filedir -d _filedir -d
else else
_filedir _filedir
fi fi
} }
# makeinfo and texi2dvi are defined elsewhere. # makeinfo and texi2dvi are defined elsewhere.
for i in a2ps autoconf automake bc gprof ld nm objcopy objdump readelf strip \ for i in a2ps autoconf automake awk bash bc bison cat colordiff cp csplit \
bison colordiff diff patch enscript cp df dir du ln ls mkfifo mknod mv rm \ curl cut date df diff dir du enscript env expand fmt fold gperf gprof \
touch vdir awk gperf grep grub indent less m4 sed shar date \ grep grub head indent irb ld ldd less ln ls m4 md5sum mkdir mkfifo mknod \
tee who texindex cat csplit cut expand fmt fold head \ mv netstat nl nm objcopy objdump od paste patch pr ptx readelf rm rmdir \
md5sum nl od paste pr ptx sha1sum sort split tac tail tr unexpand \ sed seq sha{,1,224,256,384,512}sum shar sort split strip tac tail tee \
uniq wc ldd bash id irb mkdir rmdir wget curl; do texindex touch tr uname unexpand uniq units vdir wc wget who; 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
have $i && complete -F _longopt -o default $i have $i && complete -F _longopt -o default $i
done done
unset i unset i
@ -1575,6 +1633,7 @@ _filedir_xspec()
} }
)) ))
[ ${#toks[@]} -ne 0 ] && _compopt_o_filenames
COMPREPLY=( "${toks[@]}" ) COMPREPLY=( "${toks[@]}" )
} }
list=( $( sed -ne '/^# START exclude/,/^# FINISH exclude/p' "$BASH_COMPLETION" | \ 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 if [ ${#list[@]} -gt 0 ]; then
eval complete -r ${list[@]} eval complete -r ${list[@]}
# install new compspecs # install new compspecs
eval complete -F _filedir_xspec -o filenames "${list[@]}" eval complete -F _filedir_xspec "${list[@]}"
fi fi
unset list unset list

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -16,8 +16,8 @@ _dd()
;; ;;
conv=*) conv=*)
cur=${cur#*=} cur=${cur#*=}
COMPREPLY=( $( compgen -W 'ascii ebcdic ibm block unblock \ COMPREPLY=( $( compgen -W 'ascii ebcdic ibm block unblock lcase
lcase notrunc ucase swab noerror sync' -- "$cur" ) ) notrunc ucase swab noerror sync' -- "$cur" ) )
return 0 return 0
;; ;;
esac esac
@ -25,10 +25,10 @@ _dd()
_expand || return 0 _expand || return 0
COMPREPLY=( $( compgen -W '--help --version' -- "$cur" ) \ COMPREPLY=( $( compgen -W '--help --version' -- "$cur" ) \
$( compgen -W 'bs cbs conv count ibs if obs of seek skip'\ $( compgen -W 'bs cbs conv count ibs if obs of seek skip' \
-S '=' -- "$cur" ) ) -S '=' -- "$cur" ) )
} && } &&
complete -F _dd -o nospace -o filenames dd complete -F _dd -o nospace dd
# Local variables: # Local variables:
# mode: shell-script # 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 # Debian GNU dpkg-reconfigure(8) completion

View File

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

View File

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

View File

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

View File

@ -46,9 +46,9 @@ _gcc()
_filedir _filedir
fi 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 ] && \ [ $USERLAND = GNU -o $UNAME = Cygwin ] && \
[ -n "${have:-}" ] && complete -o filenames -F _gcc cc [ -n "${have:-}" ] && complete -F _gcc cc
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -36,8 +36,6 @@ _iconv()
fi fi
} && } &&
complete -F _iconv -o default iconv 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: # Local variables:
# mode: shell-script # 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' \ COMPREPLY=( $( compgen -W '-h -n -N -p -P -b -B -i -f -F -c -m' \
-- "$cur" ) ) -- "$cur" ) )
} && } &&
complete -F _iftop -o filenames iftop complete -F _iftop iftop
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script

View File

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

View File

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

View File

@ -203,7 +203,7 @@ _ipmitool()
} }
} && } &&
complete -F _ipmitool -o filenames ipmitool complete -F _ipmitool ipmitool
# Local variables: # Local variables:
# mode: shell-script # 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 return 0
} && } &&
complete -F _ipv6calc -o filenames ipv6calc complete -F _ipv6calc ipv6calc
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script

View File

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

View File

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

View File

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

View File

@ -11,13 +11,14 @@ _kldload()
[ -d $moddir ] || moddir=/boot/kernel/ [ -d $moddir ] || moddir=/boot/kernel/
_get_comp_words_by_ref cur _get_comp_words_by_ref cur
_compopt_o_filenames
COMPREPLY=( $( compgen -f "$moddir$cur" ) ) COMPREPLY=( $( compgen -f "$moddir$cur" ) )
COMPREPLY=( ${COMPREPLY[@]#$moddir} ) COMPREPLY=( ${COMPREPLY[@]#$moddir} )
COMPREPLY=( ${COMPREPLY[@]%.ko} ) COMPREPLY=( ${COMPREPLY[@]%.ko} )
return 0 return 0
} }
complete -F _kldload -o filenames kldload complete -F _kldload kldload
_kldunload() _kldunload()
{ {
@ -26,7 +27,7 @@ _kldunload()
COMPREPLY=( $( kldstat | \ COMPREPLY=( $( kldstat | \
sed -ne "s/^.*[ \t]\{1,\}\($cur[a-z_]\{1,\}\).ko$/\1/p" ) ) 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" ) ) '$( cut -f 1 -s ~/.lftp/bookmarks 2>/dev/null )' -- "$cur" ) )
_known_hosts_real "$cur" _known_hosts_real "$cur"
} && } &&
complete -F _lftp -o filenames lftp complete -F _lftp lftp
have lftpget && have lftpget &&
_lftpget() _lftpget()
{ {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -247,13 +247,13 @@ _mplayer()
-e "/^-\(Total\|.*\*\)\{0,1\}$/!p" )' -- "$cur" ) ) -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 esac
return 0 return 0
} }
complete -o filenames -F _mplayer mplayer mencoder gmplayer kplayer complete -F _mplayer mplayer mencoder gmplayer kplayer
} }
# Local variables: # Local variables:

View File

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

View File

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

View File

@ -31,6 +31,7 @@ _perl()
case $prev in case $prev in
-I|-x) -I|-x)
local IFS=$'\n' local IFS=$'\n'
_compopt_o_filenames
COMPREPLY=( $( compgen -d $optPrefix $optSuffix -- "$cur" ) ) COMPREPLY=( $( compgen -d $optPrefix $optSuffix -- "$cur" ) )
return 0 return 0
;; ;;
@ -47,9 +48,9 @@ _perl()
_filedir _filedir
fi 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: # Local variables:

View File

@ -29,7 +29,7 @@ _postfix()
COMPREPLY=( $( compgen -W 'check start stop abort flush reload status \ COMPREPLY=( $( compgen -W 'check start stop abort flush reload status \
set-permissions upgrade-configuration' -- "$cur" ) ) set-permissions upgrade-configuration' -- "$cur" ) )
} }
complete -F _postfix -o filenames postfix complete -F _postfix postfix
# postalias(1) and postmap(1) # postalias(1) and postmap(1)
# #
@ -51,12 +51,13 @@ _postmap()
esac esac
if [[ $cur == -* ]]; then 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" ) ) -- "$cur" ) )
return 0 return 0
fi fi
if [[ "$cur" == *:* ]]; then if [[ "$cur" == *:* ]]; then
_compopt_o_filenames
COMPREPLY=( $( compgen -f -- "${cur#*:}" ) ) COMPREPLY=( $( compgen -f -- "${cur#*:}" ) )
else else
len=${#cur} len=${#cur}
@ -68,12 +69,13 @@ _postmap()
fi fi
done done
if [[ $idx -eq 0 ]]; then if [[ $idx -eq 0 ]]; then
_compopt_o_filenames
COMPREPLY=( $( compgen -f -- "$cur" ) ) COMPREPLY=( $( compgen -f -- "$cur" ) )
fi fi
fi fi
return 0 return 0
} }
complete -F _postmap -o filenames postmap postalias complete -F _postmap postmap postalias
# postcat(1) # postcat(1)
# #
@ -116,7 +118,7 @@ _postcat()
return 0 return 0
fi fi
} }
complete -F _postcat -o filenames postcat complete -F _postcat postcat
# postconf(1) # postconf(1)
# #
@ -143,7 +145,7 @@ _postconf()
esac esac
if [[ $cur == -* ]]; then 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" ) ) -- "$cur" ) )
return 0 return 0
fi fi
@ -158,7 +160,7 @@ _postconf()
done done
return 0 return 0
} }
complete -F _postconf -o filenames postconf complete -F _postconf postconf
# postsuper(1) # postsuper(1)
# #
@ -219,7 +221,7 @@ _postsuper()
COMPREPLY=( $( compgen -W 'hold incoming active deferred' -- "$cur" ) ) COMPREPLY=( $( compgen -W 'hold incoming active deferred' -- "$cur" ) )
} }
complete -F _postsuper -o filenames postsuper complete -F _postsuper postsuper
} }
# Local variables: # Local variables:

View File

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

View File

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

View File

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

View File

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

View File

@ -32,7 +32,7 @@ _rcs()
# otherwise, default to directories # otherwise, default to directories
[[ ${#COMPREPLY[@]} -eq 0 && $1 == ci ]] && _filedir || _filedir -d [[ ${#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: # Local variables:
# mode: shell-script # mode: shell-script

View File

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

View File

@ -24,8 +24,6 @@ _rpm_installed_packages()
_rpm_groups() _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' local IFS=$'\n'
COMPREPLY=( $( compgen -W "$( rpm -qa $nodig $nosig --queryformat \ COMPREPLY=( $( compgen -W "$( rpm -qa $nodig $nosig --queryformat \
'%{group}\n' )" -- "$cur" ) ) '%{group}\n' )" -- "$cur" ) )
@ -101,6 +99,7 @@ _rpm()
return 0 return 0
;; ;;
--pipe) --pipe)
_compopt_o_filenames
COMPREPLY=( $( compgen -c -- "$cur" ) ) COMPREPLY=( $( compgen -c -- "$cur" ) )
return 0 return 0
;; ;;
@ -131,8 +130,7 @@ _rpm()
# complete on capabilities # complete on capabilities
local IFS=$'\n' local IFS=$'\n'
COMPREPLY=( $( compgen -W "$( rpm -qa $nodig $nosig \ COMPREPLY=( $( compgen -W "$( rpm -qa $nodig $nosig \
--queryformat='%{requirename}\n' )" \ --queryformat='%{requirename}\n' )" -- "$cur" ) )
-- "$cur" ) )
fi fi
return 0 return 0
;; ;;
@ -249,7 +247,7 @@ _rpm()
elif [[ ${COMP_WORDS[1]} == -b* ]]; then elif [[ ${COMP_WORDS[1]} == -b* ]]; then
_filedir spec _filedir spec
else else
_filedir '@(t?(ar.)@([gx]z|bz?(2))|tar.@(lzma|Z))' _filedir '@(t?(ar.)@([gx]z|bz?(2))|tar?(.@(lzma|Z)))'
fi fi
;; ;;
--rebuild|--recompile) --rebuild|--recompile)
@ -261,7 +259,7 @@ _rpm()
fi fi
;; ;;
--tarbuild) --tarbuild)
_filedir '@(t?(ar.)@([gx]z|bz?(2))|tar.@(lzma|Z))' _filedir '@(t?(ar.)@([gx]z|bz?(2))|tar?(.@(lzma|Z)))'
;; ;;
--resign|--addsign) --resign|--addsign)
_filedir '[rs]pm' _filedir '[rs]pm'
@ -279,7 +277,8 @@ _rpm()
;; ;;
--import|--dbpath|--root) --import|--dbpath|--root)
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--import --dbpath --root' -- "$cur" ) ) COMPREPLY=( $( compgen -W '--import --dbpath --root' \
-- "$cur" ) )
else else
_filedir _filedir
fi fi
@ -288,7 +287,7 @@ _rpm()
return 0 return 0
} }
complete -F _rpm -o filenames rpm rpmbuild complete -F _rpm rpm rpmbuild
} }
# Local variables: # Local variables:

View File

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

View File

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

View File

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

View File

@ -14,7 +14,8 @@ _useradd()
# with -u/--uid # with -u/--uid
case $prev in 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 return 0
;; ;;
-b|--base-dir|-d|--home|-k|--skel) -b|--base-dir|-d|--home|-k|--skel)
@ -64,7 +65,8 @@ _usermod()
# with -u/--uid # with -u/--uid
case $prev in 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 return 0
;; ;;
-g|--gid) -g|--gid)
@ -126,7 +128,8 @@ _chage()
_split_longopt && split=true _split_longopt && split=true
case $prev in 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 return 0
;; ;;
esac esac
@ -163,7 +166,7 @@ _passwd()
return 0 return 0
fi fi
COMPREPLY=( $( compgen -u -- "$cur" ) ) _allowed_users
} && } &&
complete -F _passwd passwd complete -F _passwd passwd
@ -229,7 +232,7 @@ _newusers()
_filedir _filedir
} && } &&
complete -F _newusers -o filenames newusers complete -F _newusers newusers
have pwck && have pwck &&
_pwck() _pwck()
@ -246,7 +249,7 @@ _pwck()
_filedir _filedir
} && } &&
complete -F _pwck -o filenames pwck complete -F _pwck pwck
have groupadd && have groupadd &&
_groupadd() _groupadd()
@ -316,9 +319,11 @@ _newgrp()
COMPREPLY=() COMPREPLY=()
if [[ "`_get_cword`" == "-" ]]; then if [[ "`_get_cword`" == "-" ]]; then
COMPREPLY=( - ) COMPREPLY=( - )
else
_allowed_groups
fi fi
} && } &&
complete -g -F _newgrp newgrp complete -F _newgrp newgrp
have gpasswd && have gpasswd &&
_gpasswd() _gpasswd()
@ -385,7 +390,7 @@ _grpck()
_filedir _filedir
} && } &&
complete -F _grpck -o filenames grpck complete -F _grpck grpck
have vipw || have vigr && have vipw || have vigr &&
_vipw() _vipw()

View File

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

View File

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

View File

@ -53,14 +53,14 @@ _strace()
case $prev in case $prev in
trace) trace)
COMPREPLY=( $( compgen -W "$syscalls file process \ COMPREPLY=( $( compgen -W "$syscalls file process
network signal ipc desc all none" -- "$cur") ) network signal ipc desc all none" -- "$cur") )
return 0 return 0
;; ;;
esac esac
else else
COMPREPLY=( $( compgen -S"=" -W 'trace abbrev \ COMPREPLY=( $( compgen -S"=" -W 'trace abbrev verbose raw
verbose raw signal read write' -- "$cur" ) ) signal read write' -- "$cur" ) )
fi fi
return 0 return 0
;; ;;
@ -73,11 +73,12 @@ _strace()
return 0 return 0
;; ;;
-S) -S)
COMPREPLY=( $( compgen -W 'time calls name nothing' -- "$cur" ) ) COMPREPLY=( $( compgen -W 'time calls name nothing' \
-- "$cur" ) )
return 0 return 0
;; ;;
-u) -u)
COMPREPLY=( $( compgen -u -- "$cur" ) ) _allowed_users
return 0 return 0
;; ;;
esac esac

View File

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

View File

@ -1,6 +1,6 @@
# bash completion for sysbench # 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 # reasons; assuming bash >= 4 we could instead not turn it on
# initially but only in the few cases where it's actually needed. # initially but only in the few cases where it's actually needed.

View File

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

View File

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

View File

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

View File

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

View File

@ -1,51 +1,84 @@
# bash completion for cdrecord/wodim # 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 && have cdrecord || have wodim &&
_cdrecord() _cdrecord()
{ {
local cur prev i generic_options track_options track_mode local cur prev i generic_options track_options track_mode
COMPREPLY=() COMPREPLY=()
_get_comp_words_by_ref cur prev _get_comp_words_by_ref -n = cur prev
# foo=bar style option # foo=bar style option
if [[ "$cur" == *=* ]]; then if [[ "$cur" == *=* ]]; then
prev=${cur/=*/} prev=${cur%%=*}
cur=${cur/*=/} cur=${cur#*=}
case $prev in case $prev in
textfile|cuefile) textfile|cuefile|msifile)
compopt +o nospace &>/dev/null
_filedir _filedir
return 0
;; ;;
blank) blank)
COMPREPLY=( $( compgen -W 'help all fast \ compopt +o nospace &>/dev/null
track unreserve trtail unclose session' \ COMPREPLY=( $( compgen -W 'help all fast track unreserve trtail
-- "$cur" ) ) unclose session' -- "$cur" ) )
return 0
;; ;;
driveropts) driveropts)
COMPREPLY=( $( compgen -W 'burnfree noburnfree\ if [[ $cur == *=* ]]; then
varirec= audiomaster forcespeed noforcespeed\ prev=${cur%%=*}
speedread nospeedread singlesession \ cur=${cur#*=}
nosinglesession hidecdr nohidecdr tattooinfo\ case $prev in
tattoofile=' -- "$cur" ) ) varirec)
return 0 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 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 fi
generic_options=(-version -v -V -d -silent -force -immed -dummy \ generic_options=( -version -v -V -d -silent -force -immed -dummy -clone \
-dao -raw -raw96r -raw96p -raw16 -multi -msinfo -toc \ -dao -sao -tao -raw -raw96r -raw96p -raw16 -multi -msinfo -toc -atip \
-atip -fix -nofix -waiti -load -lock -eject -format \ -fix -nofix -waiti -load -lock -eject -format -setdropts -checkdrive \
-setdropts -checkdrive -prcap -inq -scanbus -reset \ -prcap -inq -scanbus --devices -reset -abort -overburn -ignsize \
-abort -overburn -ignsize -useinfo -packet -noclose \ -useinfo -packet -noclose -text debug= kdebug= minbuf= msifile= \
-text debug= kdebug= kd= minbuf= speed= blank= fs= \ speed= blank= fs= ts= dev= gracetime= timeout= driver= driveropts= \
dev= gracetime= timeout= driver= driveropts= \ defpregap= pktsize= mcn= textfile= cuefile= )
defpregap= pktsize= mcn= textfile= cuefile=) track_options=( -audio -swab -data -mode2 -xa -xa1 -xa2 -xamix -cdi \
track_options=(-audio -swab -data -mode2 -xa -xa1 -xa2 -xamix -cdi \ -isosize -pad -nopad -shorttrack -noshorttrack -preemp -nopreemp \
-isosize -pad padsize= -nopad -shorttrack -noshorttrack\ -copy -nocopy -scms isrc= index= padsize= pregap= tsize= )
pregap= -preemp -nopreemp -copy -nocopy -scms tcsize= \
isrc= index=)
# look if previous was either a file or a track option # look if previous was either a file or a track option
track_mode=0 track_mode=0
if [ $COMP_CWORD -gt 1 ]; then if [ $COMP_CWORD -gt 1 ]; then
@ -71,9 +104,10 @@ _cdrecord()
COMPREPLY=( "${COMPREPLY[@]}" \ COMPREPLY=( "${COMPREPLY[@]}" \
$( compgen -W '${generic_options[@]}' -- "$cur" ) ) $( compgen -W '${generic_options[@]}' -- "$cur" ) )
fi 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: # Local variables:
# mode: shell-script # mode: shell-script

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -53,10 +53,11 @@ _xz()
_expand || return 0 _expand || return 0
local IFS=$'\n' local IFS=$'\n'
_compopt_o_filenames
COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \ COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \
$( compgen -d -- "$cur" ) ) $( compgen -d -- "$cur" ) )
} && } &&
complete -F _xz -o filenames xz complete -F _xz xz
# xzdec(1) completion # xzdec(1) completion
# #
@ -88,9 +89,9 @@ _xzdec()
$split && return 0 $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: # Local variables:
# mode: shell-script # mode: shell-script

View File

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

View File

@ -1,7 +1,7 @@
AC_PREREQ([2.59]) AC_PREREQ([2.59])
AC_INIT([bash-completion], [1.99]) 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(bashcompdir, $sysconfdir/bash_completion.d)
AC_SUBST(helpersdir, $sysconfdir/bash_completion.d/helpers) 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 AC_OUTPUT

View File

@ -19,7 +19,7 @@ Environment variables
*COMP_KNOWN_HOSTS_WITH_HOSTFILE*:: *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 hostnames from ssh's known_hosts_files with hostnames taken from the file
specified by the HOSTFILE shell variable (compgen -A hostname). If null, specified by the HOSTFILE shell variable (compgen -A hostname). If null,
known_hosts completion will omit hostnames from HOSTFILE. Omitting known_hosts completion will omit hostnames from HOSTFILE. Omitting
@ -27,6 +27,12 @@ Environment variables
local web development or ad-blocking. 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*:: *COMP_TAR_INTERNAL_PATHS*::
If set and not null *before* sourcing bash_completion, `tar` completion If set and not null *before* sourcing bash_completion, `tar` completion
will do correct path completion for tar file contents. If unset or null, 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 type it. Backticks aren't always available, without doing strange
key combinations. 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 case/esac vs if
--------------- ---------------

View File

@ -1,8 +1,14 @@
DEJATOOL = completion install unit DEJATOOL = completion install unit
AM_RUNTESTFLAGS = --outdir log AM_RUNTESTFLAGS = --outdir log --ignore $(PACKAGE).log
EXTRA_DIST = completion \ EXTRA_DIST = completion \
config \ config \
fixtures \ fixtures \
lib \ lib \
unit 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" set cmd "complete -p acroread"
send "$cmd\r" 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 { expect {
-re $expected { pass "$test" } -re $expected { pass "$test" }
-re /@ { fail "$test at prompt" } -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