Indentation fixes.

This commit is contained in:
Ville Skyttä 2009-10-19 21:24:25 +03:00
parent e63121c2ff
commit 0b970c7477
8 changed files with 750 additions and 752 deletions

View File

@ -4,9 +4,9 @@
# Check for recent enough version of bash. # Check for recent enough version of bash.
bash=${BASH_VERSION%.*}; bmajor=${bash%.*}; bminor=${bash#*.} bash=${BASH_VERSION%.*}; bmajor=${bash%.*}; bminor=${bash#*.}
if [ $bmajor -eq 2 -a $bminor '>' 04 ] || [ $bmajor -gt 2 ]; then if [ $bmajor -eq 2 -a $bminor '>' 04 ] || [ $bmajor -gt 2 ]; then
if [ -r /etc/bash_completion ]; then if [ -r /etc/bash_completion ]; then
# Source completion code. # Source completion code.
. /etc/bash_completion . /etc/bash_completion
fi fi
fi fi
unset bash bminor bmajor unset bash bminor bmajor

View File

@ -4,420 +4,417 @@ have svn &&
{ {
_svn() _svn()
{ {
local cur prev commands options command local cur prev commands options command
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
commands='add blame praise annotate ann cat checkout co cleanup commit \ commands='add blame praise annotate ann cat checkout co cleanup commit \
ci copy cp delete del remove rm diff di export help ? h import \ ci copy cp delete del remove rm diff di export help ? h import \
info list ls lock log merge mkdir move mv rename ren \ info list ls lock log merge mkdir move mv rename ren \
propdel pdel pd propedit pedit pe propget pget pg \ propdel pdel pd propedit pedit pe propget pget pg \
proplist plist pl propset pset ps resolved revert \ proplist plist pl propset pset ps resolved revert \
status stat st switch sw unlock update up' status stat st switch sw unlock update up'
if [[ $COMP_CWORD -eq 1 ]] ; then if [[ $COMP_CWORD -eq 1 ]] ; then
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--version' -- $cur ) ) COMPREPLY=( $( compgen -W '--version' -- $cur ) )
else else
COMPREPLY=( $( compgen -W "$commands" -- $cur ) ) COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
fi fi
else else
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
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 \ COMPREPLY=( $( compgen -W '$( iconv --list | \
'$( iconv --list | sed -e "s@//@@;" )' \ sed -e "s@//@@;" )' -- "$cur" ) )
-- "$cur" ) ) return 0;
return 0; ;;
;; --@(editor|diff|diff3)-cmd)
--@(editor|diff|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
command=${COMP_WORDS[1]} command=${COMP_WORDS[1]}
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
# 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 --no-ignore \ --force --targets --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 --no-auth-cache \ --password --no-auth-cache \
--non-interactive -v \ --non-interactive -v \
--verbose --incremental --xml' --verbose --incremental --xml'
;; ;;
cat) cat)
options='-r --revision --username \ options='-r --revision --username \
--password --no-auth-cache \ --password --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 --username \ --non-recursive --username \
--password --no-auth-cache \ --password --no-auth-cache \
--non-interactive \ --non-interactive \
--ignore-externals' --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 \ --quiet --non-recursive -N \
--targets --editor-cmd \ --targets --editor-cmd \
--username --password \ --username --password \
--no-auth-cache \ --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 \ --revision -q --quiet \
--editor-cmd -username \ --editor-cmd -username \
--password --no-auth-cache \ --password --no-auth-cache \
--non-interactive' --non-interactive'
;; ;;
@(delete|del|remove|rm)) @(delete|del|remove|rm))
options='--force -m --message -F \ options='--force -m --message -F \
--file --encoding --force-log \ --file --encoding --force-log \
-q --quiet --targets \ -q --quiet --targets \
--editor-cmd -username \ --editor-cmd -username \
--password --no-auth-cache \ --password --no-auth-cache \
--non-interactive' --non-interactive'
;; ;;
@(diff|di)) @(diff|di))
options='-r --revision -x --extensions \ options='-r --revision -x --extensions \
--diff-cmd --no-diff-deleted \ --diff-cmd --no-diff-deleted \
-N --non-recursive --username \ -N --non-recursive --username \
--password --no-auth-cache \ --password --no-auth-cache \
--non-interactive --force \ --non-interactive --force \
--old --new --notice-ancestry' --old --new --notice-ancestry'
;; ;;
export) export)
options='-r --revision -q --quiet \ options='-r --revision -q --quiet \
--username --password \ --username --password \
--no-auth-cache \ --no-auth-cache \
--non-interactive -N \ --non-interactive -N \
--non-recursive --force \ --non-recursive --force \
--native-eol --ignore-externals' --native-eol --ignore-externals'
;; ;;
import) import)
options='--auto-props --no-auto-props \ options='--auto-props --no-auto-props \
-m --message -F --file \ -m --message -F --file \
--encoding --force-log -q \ --encoding --force-log -q \
--quiet --non-recursive \ --quiet --non-recursive \
--no-ignore --editor-cmd \ --no-ignore --editor-cmd \
--username --password \ --username --password \
--no-auth-cache \ --no-auth-cache \
--non-interactive' --non-interactive'
;; ;;
info) info)
options='--username --password \ options='--username --password \
--no-auth-cache \ --no-auth-cache \
--non-interactive -r \ --non-interactive -r \
--revision --xml --targets \ --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 --username \ --recursive --username \
--password --no-auth-cache \ --password --no-auth-cache \
--non-interactive \ --non-interactive \
--incremental --xml' --incremental --xml'
;; ;;
lock) lock)
options='-m --message -F --file \ options='-m --message -F --file \
--encoding --force-log \ --encoding --force-log \
--targets --force --username \ --targets --force --username \
--password --no-auth-cache \ --password --no-auth-cache \
--non-interactive' --non-interactive'
;; ;;
log) log)
options='-r --revision -v --verbose \ options='-r --revision -v --verbose \
--targets --username \ --targets --username \
--password --no-auth-cache \ --password --no-auth-cache \
--non-interactive \ --non-interactive \
--stop-on-copy --incremental \ --stop-on-copy --incremental \
--xml -q --quiet --limit' --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 \ --force --dry-run --diff3-cmd \
--username --password \ --username --password \
--no-auth-cache \ --no-auth-cache \
--non-interactive \ --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 \ --quiet --editor-cmd \
--username --password \ --username --password \
--no-auth-cache \ --no-auth-cache \
--non-interactive' --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 \ --revision -q --quiet \
--force --editor-cmd \ --force --editor-cmd \
--username --password \ --username --password \
--no-auth-cache \ --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 \ --username --password \
--no-auth-cache \ --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 \ --username --password \
--no-auth-cache \ --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 --username \ --revprop --strict --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 --revprop -q \ -r --revision --revprop -q \
--quiet --username --password \ --quiet --username --password \
--no-auth-cache \ --no-auth-cache \
--non-interactive' --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 \ --revprop --encoding \
--username --password \ --username --password \
--no-auth-cache \ --no-auth-cache \
--non-interactive -r \ --non-interactive -r \
--revision --force' --revision --force'
;; ;;
resolved) resolved)
options='--targets -R --recursive -q \ options='--targets -R --recursive -q --quiet'
--quiet' ;;
;; revert)
revert) options='--targets -R --recursive -q --quiet'
options='--targets -R --recursive -q \ ;;
--quiet' @(status|stat|st))
;; options='-u --show-updates -v \
@(status|stat|st)) --verbose -N --non-recursive \
options='-u --show-updates -v \ -q --quiet --username \
--verbose -N --non-recursive \ --password --no-auth-cache \
-q --quiet --username \ --non-interactive --no-ignore \
--password --no-auth-cache \ --ignore-externals \
--non-interactive --no-ignore \ --incremental --xml'
--ignore-externals \ ;;
--incremental --xml' @(switch|sw))
;; options='--relocate -r --revision -N \
@(switch|sw)) --non-recursive -q --quiet \
options='--relocate -r --revision -N \ --username --password \
--non-recursive -q --quiet \ --no-auth-cache \
--username --password \ --non-interactive --diff3-cmd'
--no-auth-cache \ ;;
--non-interactive --diff3-cmd' unlock)
;; options='--targets --force --username \
unlock) --password --no-auth-cache \
options='--targets --force --username \ --non-interactive'
--password --no-auth-cache \ ;;
--non-interactive' @(update|up))
;; options='-r --revision -N \
@(update|up)) --non-recursive -q --quiet \
options='-r --revision -N \ --username --password \
--non-recursive -q --quiet \ --no-auth-cache \
--username --password \ --non-interactive \
--no-auth-cache \ --diff3-cmd --ignore-externals'
--non-interactive \ ;;
--diff3-cmd --ignore-externals' esac
;; options="$options --help -h --config-dir"
esac
options="$options --help -h --config-dir"
COMPREPLY=( $( compgen -W "$options" -- $cur ) ) COMPREPLY=( $( compgen -W "$options" -- $cur ) )
else else
if [[ "$command" == @(help|h|\?) ]]; then if [[ "$command" == @(help|h|\?) ]]; then
COMPREPLY=( $( compgen -W "$commands" -- $cur ) ) COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
else else
_filedir _filedir
fi fi
fi fi
fi fi
return 0 return 0
} }
complete -F _svn $filenames svn complete -F _svn $filenames svn
_svnadmin() _svnadmin()
{ {
local cur prev commands options mode local cur prev commands options mode
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
commands='create deltify dump help ? hotcopy list-dblogs \ commands='create deltify dump help ? hotcopy list-dblogs \
list-unused-dblogs load lslocks lstxns recover rmlocks \ list-unused-dblogs 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
COMPREPLY=( $( compgen -W '--version' -- $cur ) ) COMPREPLY=( $( compgen -W '--version' -- $cur ) )
else else
COMPREPLY=( $( compgen -W "$commands" -- $cur ) ) COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
fi fi
else else
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
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
command=${COMP_WORDS[1]} command=${COMP_WORDS[1]}
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
# 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-pre-commit-hook \
--use-post-commit-hook' --use-post-commit-hook'
;; ;;
rmtxns) rmtxns)
options='-q --quiet' options='-q --quiet'
;; ;;
setlog) setlog)
options='-r --revision --bypass-hooks' options='-r --revision --bypass-hooks'
;; ;;
esac esac
options="$options --help -h" options="$options --help -h"
COMPREPLY=( $( compgen -W "$options" -- $cur ) ) COMPREPLY=( $( compgen -W "$options" -- $cur ) )
else else
if [[ "$command" == @(help|h|\?) ]]; then if [[ "$command" == @(help|h|\?) ]]; then
COMPREPLY=( $( compgen -W "$commands" -- $cur ) ) COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
else else
_filedir _filedir
fi fi
fi fi
fi fi
return 0 return 0
} }
complete -F _svnadmin $default svnadmin complete -F _svnadmin $default svnadmin
_svnlook() _svnlook()
{ {
local cur prev commands options mode local cur prev commands options mode
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
commands='author cat changed date diff dirs-changed help ? h history \ commands='author cat changed date diff dirs-changed help ? h history \
info lock log propget pget pg proplist plist pl tree uuid \ info 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
COMPREPLY=( $( compgen -W '--version' -- $cur ) ) COMPREPLY=( $( compgen -W '--version' -- $cur ) )
else else
COMPREPLY=( $( compgen -W "$commands" -- $cur ) ) COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
fi fi
else else
command=${COMP_WORDS[1]} command=${COMP_WORDS[1]}
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
# 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 \ --transaction \
--no-diff-deleted \ --no-diff-deleted \
--no-diff-added \ --no-diff-added \
--diff-copy-from' --diff-copy-from'
;; ;;
history) history)
options='-r --revision --show-ids' options='-r --revision --show-ids'
;; ;;
prop@(get|list)) prop@(get|list))
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
options="$options --help -h" options="$options --help -h"
COMPREPLY=( $( compgen -W "$options" -- $cur ) ) COMPREPLY=( $( compgen -W "$options" -- $cur ) )
else else
if [[ "$command" == @(help|h|\?) ]]; then if [[ "$command" == @(help|h|\?) ]]; then
COMPREPLY=( $( compgen -W "$commands" -- $cur ) ) COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
else else
_filedir _filedir
fi fi
fi fi
fi fi
return 0 return 0
} }
complete -F _svnlook $default svnlook complete -F _svnlook $default svnlook
} }

View File

@ -7,12 +7,12 @@ _yum_list()
# Try to strip in between headings like "Available Packages" # Try to strip in between headings like "Available Packages"
# This will obviously only work for English :P # This will obviously only work for English :P
COMPREPLY=( $( yum -d 0 -C list $1 "$cur*" 2>/dev/null | \ COMPREPLY=( $( yum -d 0 -C list $1 "$cur*" 2>/dev/null | \
sed -ne '/^\(Available\|Installed\|Updated\) /d' \ sed -ne '/^\(Available\|Installed\|Updated\) /d' \
-e 's/[[:space:]].*//p' ) ) -e 's/[[:space:]].*//p' ) )
else else
# Drop first line (e.g. "Updated Packages") # Drop first line (e.g. "Updated Packages")
COMPREPLY=( $( yum -d 0 -C list $1 "$cur*" 2>/dev/null | \ COMPREPLY=( $( yum -d 0 -C list $1 "$cur*" 2>/dev/null | \
sed -ne 1d -e 's/[[:space:]].*//p' ) ) sed -ne 1d -e 's/[[:space:]].*//p' ) )
fi fi
} }
@ -20,15 +20,15 @@ _yum_repolist()
{ {
# -d 0 causes repolist to output nothing as of yum 3.2.22: # -d 0 causes repolist to output nothing as of yum 3.2.22:
# http://yum.baseurl.org/ticket/83 # http://yum.baseurl.org/ticket/83
# Drop first ("repo id repo name") and last ("repolist: ...") rows # Drop first ("repo id repo name") and last ("repolist: ...") rows
yum --noplugins -C repolist $1 2>/dev/null | \ yum --noplugins -C repolist $1 2>/dev/null | \
sed -ne '/^repo\(\s\+id\|list:\)/d' -e 's/[[:space:]].*//p' sed -ne '/^repo\(\s\+id\|list:\)/d' -e 's/[[:space:]].*//p'
} }
_yum_plugins() _yum_plugins()
{ {
command ls /usr/lib/yum-plugins/*.py{,c,o} 2>/dev/null \ command ls /usr/lib/yum-plugins/*.py{,c,o} 2>/dev/null \
| sed -ne 's|.*/\([^./]*\)\.py[co]\?$|\1|p' | sort -u | sed -ne 's|.*/\([^./]*\)\.py[co]\?$|\1|p' | sort -u
} }
_yum() _yum()
@ -40,91 +40,91 @@ _yum()
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
if [[ ${COMP_WORDS[i]} == @(install|update|upgrade|remove|erase|deplist|info) ]]; then if [[ ${COMP_WORDS[i]} == @(install|update|upgrade|remove|erase|deplist|info) ]]; then
special=${COMP_WORDS[i]} special=${COMP_WORDS[i]}
fi fi
done done
if [ -n "$special" ]; then if [ -n "$special" ]; then
# TODO: install|update|upgrade should not match *src.rpm # TODO: install|update|upgrade should not match *src.rpm
if [[ "$cur" == */* && "$special" == @(deplist|install|update|upgrade) ]]; then if [[ "$cur" == */* && "$special" == @(deplist|install|update|upgrade) ]]; then
_filedir rpm _filedir rpm
return 0 return 0
fi fi
case $special in case $special in
install) install)
_yum_list available _yum_list available
return 0 return 0
;; ;;
deplist|info) deplist|info)
_yum_list all _yum_list all
return 0 return 0
;; ;;
upgrade|update) upgrade|update)
_yum_list updates _yum_list updates
return 0 return 0
;; ;;
remove|erase) remove|erase)
# _rpm_installed_packages is not arch-qualified # _rpm_installed_packages is not arch-qualified
_yum_list installed _yum_list installed
return 0 return 0
;; ;;
esac esac
fi fi
_split_longopt && split=true _split_longopt && split=true
case $prev in case $prev in
list) list)
COMPREPLY=( $( compgen -W 'all available updates \ COMPREPLY=( $( compgen -W 'all available updates \
installed extras obsoletes recent' -- $cur ) ) installed extras obsoletes recent' -- $cur ) )
;; ;;
clean) clean)
COMPREPLY=( $( compgen -W 'packages headers metadata \ COMPREPLY=( $( compgen -W 'packages headers metadata \
cache dbcache all' -- $cur ) ) cache dbcache all' -- $cur ) )
;; ;;
repolist) repolist)
COMPREPLY=( $( compgen -W 'all enabled disabled' -- $cur ) ) COMPREPLY=( $( compgen -W 'all enabled disabled' -- $cur ) )
;; ;;
localinstall|localupdate) localinstall|localupdate)
# TODO: should not match *src.rpm # TODO: should not match *src.rpm
_filedir rpm _filedir rpm
;; ;;
-d|-e) -d|-e)
COMPREPLY=( $( compgen -W '0 1 2 3 4 5 6 7 8 9 10' -- $cur ) ) COMPREPLY=( $( compgen -W '0 1 2 3 4 5 6 7 8 9 10' -- $cur ) )
;; ;;
-c) -c)
_filedir _filedir
;; ;;
--installroot) --installroot)
_filedir -d _filedir -d
;; ;;
--enablerepo) --enablerepo)
COMPREPLY=( $( compgen -W '$( _yum_repolist disabled )' -- $cur ) ) COMPREPLY=( $( compgen -W '$( _yum_repolist disabled )' -- $cur ) )
;; ;;
--disablerepo) --disablerepo)
COMPREPLY=( $( compgen -W '$( _yum_repolist enabled )' -- $cur ) ) COMPREPLY=( $( compgen -W '$( _yum_repolist enabled )' -- $cur ) )
;; ;;
--disableexcludes) --disableexcludes)
COMPREPLY=( $( compgen -W '$( _yum_repolist all ) all main' \ COMPREPLY=( $( compgen -W '$( _yum_repolist all ) all main' \
-- $cur ) ) -- $cur ) )
;; ;;
--enableplugin|--disableplugin) --enableplugin|--disableplugin)
COMPREPLY=( $( compgen -W '$( _yum_plugins )' -- $cur )) COMPREPLY=( $( compgen -W '$( _yum_plugins )' -- $cur ))
;; ;;
--color) --color)
COMPREPLY=( $( compgen -W 'always auto never' -- $cur )) COMPREPLY=( $( compgen -W 'always auto never' -- $cur ))
;; ;;
-R|-x|--exclude) -R|-x|--exclude)
# argument required but no completions available # argument required but no completions available
return 0 return 0
;; ;;
-h|--help|--version) -h|--help|--version)
# no other options useful with these # no other options useful with these
return 0 return 0
;; ;;
*) *)
COMPREPLY=( $( compgen -W 'install update check-update upgrade \ COMPREPLY=( $( compgen -W 'install update check-update upgrade \
remove erase list info provides whatprovides clean makecache \ remove erase list info provides whatprovides clean makecache \
groupinstall groupupdate grouplist groupremove groupinfo \ groupinstall groupupdate grouplist groupremove groupinfo \
search shell resolvedep localinstall localupdate deplist \ search shell resolvedep localinstall localupdate deplist \
@ -140,7 +140,7 @@ _yum()
--enablerepo --disablerepo --exclude --disableexcludes --obsoletes \ --enablerepo --disablerepo --exclude --disableexcludes --obsoletes \
--noplugins --nogpgcheck --disableplugin --enableplugin \ --noplugins --nogpgcheck --disableplugin --enableplugin \
--skip-broken --color' -- $cur ) ) --skip-broken --color' -- $cur ) )
return 0 return 0
fi fi
} }
} && } &&

View File

@ -1,64 +1,63 @@
# bash completion for ant # bash completion for ant
have ant && { have ant &&
{
_ant() _ant()
{ {
local cur prev buildfile i local cur prev buildfile i
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
case "$prev" in case "$prev" in
-buildfile|-file|-f) -buildfile|-file|-f)
_filedir 'xml' _filedir 'xml'
return 0 return 0
;; ;;
-logfile|-l) -logfile|-l)
_filedir _filedir
return 0 return 0
;; ;;
-propertyfile) -propertyfile)
_filedir properties _filedir properties
return 0 return 0
;; ;;
-nice) -nice)
COMPREPLY=( $( compgen -W '1 2 3 4 5 6 7 8 9 10' \ COMPREPLY=( $( compgen -W '1 2 3 4 5 6 7 8 9 10' -- "$cur" ) )
-- "$cur" ) ) return 0
return 0 ;;
;; -lib|-logger|-listener|-D|-inputhandler|-main)
-lib|-logger|-listener|-D|-inputhandler|-main) return 0
return 0 ;;
;; esac
esac
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-help -h -projecthelp -p -version \ COMPREPLY=( $( compgen -W '-help -h -projecthelp -p -version \
-diagnostics -quiet -q -verbose -v -debug -d -emacs -e \ -diagnostics -quiet -q -verbose -v -debug -d -emacs -e \
-lib -logfile -l -logger -listener -noinput -buildfile \ -lib -logfile -l -logger -listener -noinput -buildfile \
-file -f -D -keep-going -k -propertyfile -inputhandler \ -file -f -D -keep-going -k -propertyfile -inputhandler \
-find -s -nice -nouserlib -noclasspath -autoproxy \ -find -s -nice -nouserlib -noclasspath -autoproxy \
-main' -- "$cur" ) ) -main' -- "$cur" ) )
else else
# available targets completion # available targets completion
# find which buildfile to use # find which buildfile to use
buildfile=build.xml buildfile=build.xml
for (( i=1; i < COMP_CWORD; i++ )); do for (( i=1; i < COMP_CWORD; i++ )); do
if [[ "${COMP_WORDS[i]}" == -@(?(build)file|f) ]]; then if [[ "${COMP_WORDS[i]}" == -@(?(build)file|f) ]]; then
buildfile=${COMP_WORDS[i+1]} buildfile=${COMP_WORDS[i+1]}
break break
fi fi
done done
[ ! -f $buildfile ] && return 0 [ ! -f $buildfile ] && return 0
# parse buildfile for targets # parse buildfile for targets
# some versions of sed complain if there's no trailing linefeed, # some versions of sed complain if there's no trailing linefeed,
# hence the 2>/dev/null # hence the 2>/dev/null
COMPREPLY=( $( compgen -W "$( cat $buildfile | \ COMPREPLY=( $( compgen -W "$( cat $buildfile | tr "'\t\n>" "\" \n" | \
tr "'\t\n>" "\" \n" | \ sed -ne 's/.*<target .*name="\([^"]*\).*/\1/p' 2>/dev/null )" \
sed -ne 's/.*<target .*name="\([^"]*\).*/\1/p' \ -- "$cur" ) )
2>/dev/null )" -- "$cur" ) ) fi
fi
} }
have complete-ant-cmd.pl && \ have complete-ant-cmd.pl && \
complete -C complete-ant-cmd.pl -F _ant $filenames ant || \ complete -C complete-ant-cmd.pl -F _ant $filenames ant || \

View File

@ -2,17 +2,17 @@
have bk && have bk &&
_bk() { _bk() {
local BKCMDS local BKCMDS
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
BKCMDS="$( bk help topics | grep '^ bk' | cut -d ' ' -f 4 | xargs echo )" BKCMDS="$( bk help topics | grep '^ bk' | cut -d ' ' -f 4 | xargs echo )"
COMPREPLY=( $( compgen -W "$BKCMDS" -- "$cur" ) ) COMPREPLY=( $( compgen -W "$BKCMDS" -- "$cur" ) )
_filedir _filedir
return 0 return 0
} && } &&
complete -F _bk bk complete -F _bk bk

View File

@ -20,41 +20,42 @@ have module || [ -f /etc/profile.d/modules.sh ] && {
_module_list () _module_list ()
{ {
local modules="$( echo $LOADEDMODULES | sed 's/:/ /g' | sort )" local modules="$( echo $LOADEDMODULES | sed 's/:/ /g' | sort )"
compgen -W "$modules" -- $1 compgen -W "$modules" -- $1
} }
_module_path () _module_path ()
{ {
local modules="$( echo $MODULEPATH | sed 's/:/ /g' | sort )" local modules="$( echo $MODULEPATH | sed 's/:/ /g' | sort )"
compgen -W "$modules" -- $1 compgen -W "$modules" -- $1
} }
_module_avail () _module_avail ()
{ {
local modules="$( \ local modules="$( \
module avail 2>&1 | \ module avail 2>&1 | \
egrep -v '^(-|$)' | \ egrep -v '^(-|$)' | \
xargs printf '%s\n' | sort )" xargs printf '%s\n' | sort )"
compgen -W "$modules" -- $1 compgen -W "$modules" -- $1
} }
# A completion function for the module alias # A completion function for the module alias
_module () { _module ()
local cur prev options {
local cur prev options
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
if [ $COMP_CWORD -eq 1 ] ; then if [ $COMP_CWORD -eq 1 ] ; then
# First parameter on line -- we expect it to be a mode selection # First parameter on line -- we expect it to be a mode selection
options="$( module help 2>&1 | egrep '^[[:space:]]*\+' | \ options="$( module help 2>&1 | egrep '^[[:space:]]*\+' | \
awk '{print $2}' | sed -e 's/|/ /g' | sort )" awk '{print $2}' | sed -e 's/|/ /g' | sort )"
COMPREPLY=( $(compgen -W "$options" -- "$cur") ) COMPREPLY=( $(compgen -W "$options" -- "$cur") )
elif [ $COMP_CWORD -eq 2 ] ; then elif [ $COMP_CWORD -eq 2 ] ; then
case "$prev" in case "$prev" in
@ -74,8 +75,8 @@ _module () {
COMPREPLY=( $(_module_avail "$cur") ) COMPREPLY=( $(_module_avail "$cur") )
;; ;;
esac esac
fi fi
return 0 return 0
} }
complete -F _module $default module complete -F _module $default module
} }

View File

@ -41,8 +41,8 @@ _perl()
esac esac
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-C -s -T -u -U -W -X -h -v -V -c -w -d \ COMPREPLY=( $( compgen -W '-C -s -T -u -U -W -X -h -v -V -c -w -d \
-D -p -n -a -F -l -0 -I -m -M -P -S -x -i -e ' -- "$cur" ) ) -D -p -n -a -F -l -0 -I -m -M -P -S -x -i -e ' -- "$cur" ) )
else else
_filedir _filedir
fi fi

View File

@ -1,108 +1,108 @@
# ssh(1) completion # ssh(1) completion
have ssh && { have ssh &&
{
_ssh_options() { _ssh_options() {
COMPREPLY=( $( compgen -W 'AddressFamily BatchMode BindAddress \ COMPREPLY=( $( compgen -W 'AddressFamily BatchMode BindAddress \
ChallengeResponseAuthentication CheckHostIP Cipher Ciphers \ ChallengeResponseAuthentication CheckHostIP Cipher Ciphers \
ClearAllForwardings Compression CompressionLevel \ ClearAllForwardings Compression CompressionLevel \
ConnectionAttempts ConnectTimeout ControlMaster ControlPath \ ConnectionAttempts ConnectTimeout ControlMaster ControlPath \
DynamicForward EscapeChar ExitOnForwardFailure ForwardAgent \ DynamicForward EscapeChar ExitOnForwardFailure ForwardAgent \
ForwardX11 ForwardX11Trusted GatewayPorts GlobalKnownHostsFile \ ForwardX11 ForwardX11Trusted GatewayPorts GlobalKnownHostsFile \
GSSAPIAuthentication GSSAPIDelegateCredentials HashKnownHosts \ GSSAPIAuthentication GSSAPIDelegateCredentials HashKnownHosts \
Host HostbasedAuthentication HostKeyAlgorithms HostKeyAlias \ Host HostbasedAuthentication HostKeyAlgorithms HostKeyAlias \
HostName IdentityFile IdentitiesOnly KbdInteractiveDevices \ HostName IdentityFile IdentitiesOnly KbdInteractiveDevices \
LocalCommand LocalForward LogLevel MACs \ LocalCommand LocalForward LogLevel MACs \
NoHostAuthenticationForLocalhost NumberOfPasswordPrompts \ NoHostAuthenticationForLocalhost NumberOfPasswordPrompts \
PasswordAuthentication PermitLocalCommand Port \ PasswordAuthentication PermitLocalCommand Port \
PreferredAuthentications Protocol ProxyCommand \ PreferredAuthentications Protocol ProxyCommand \
PubkeyAuthentication RekeyLimit RemoteForward \ PubkeyAuthentication RekeyLimit RemoteForward \
RhostsRSAAuthentication RSAAuthentication SendEnv \ RhostsRSAAuthentication RSAAuthentication SendEnv \
ServerAliveInterval ServerAliveCountMax SmartcardDevice \ ServerAliveInterval ServerAliveCountMax SmartcardDevice \
StrictHostKeyChecking TCPKeepAlive Tunnel TunnelDevice \ StrictHostKeyChecking TCPKeepAlive Tunnel TunnelDevice \
UsePrivilegedPort User UserKnownHostsFile VerifyHostKeyDNS \ UsePrivilegedPort User UserKnownHostsFile VerifyHostKeyDNS \
VisualHostKey XAuthLocation' -- "$cur" ) ) VisualHostKey XAuthLocation' -- "$cur" ) )
} }
_ssh() _ssh()
{ {
local cur prev configfile local cur prev configfile
local -a config local -a config
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
case "$prev" in case "$prev" in
-@(F|i|S)) -@(F|i|S))
_filedir _filedir
return 0 return 0
;; ;;
-c) -c)
COMPREPLY=( $( compgen -W '3des-cbc aes128-cbc \ COMPREPLY=( $( compgen -W '3des-cbc aes128-cbc \
aes192-cbc aes256-cbc aes128-ctr aes192-ctr \ aes192-cbc aes256-cbc aes128-ctr aes192-ctr \
aes256-ctr arcfour128 arcfour256 arcfour \ aes256-ctr arcfour128 arcfour256 arcfour \
blowfish-cbc cast128-cbc' -- "$cur" ) ) blowfish-cbc cast128-cbc' -- "$cur" ) )
return 0 return 0
;; ;;
-c) -c)
COMPREPLY=( $( compgen -W 'hmac-md5 hmac-sha1 \ COMPREPLY=( $( compgen -W 'hmac-md5 hmac-sha1 \
umac-64@openssh.com hmac-ripemd160 \ umac-64@openssh.com hmac-ripemd160 \
hmac-sha1-96 hmac-md5-96' -- "$cur" ) ) hmac-sha1-96 hmac-md5-96' -- "$cur" ) )
return 0 return 0
;; ;;
-l) -l)
COMPREPLY=( $( compgen -u -- "$cur" ) ) COMPREPLY=( $( compgen -u -- "$cur" ) )
return 0 return 0
;; ;;
-o) -o)
_ssh_options _ssh_options
return 0 return 0
;; ;;
-w) -w)
_available_interfaces _available_interfaces
return 0 return 0
;; ;;
-b) -b)
COMPREPLY=( $( compgen -W "$(/sbin/ifconfig | \ COMPREPLY=( $( compgen -W "$(/sbin/ifconfig | \
awk '/adr:/ {print $2}' | \ awk '/adr:/ {print $2}' | awk -F: '{print $2}' )" -- "$cur" ) )
awk -F: '{print $2}' )" -- "$cur" ) ) return 0
return 0 ;;
;; esac
esac
if [[ "$cur" == -F* ]]; then if [[ "$cur" == -F* ]]; then
cur=${cur#-F} cur=${cur#-F}
_filedir _filedir
# Prefix completions with '-F' # Prefix completions with '-F'
COMPREPLY=( "${COMPREPLY[@]/#/-F}" ) COMPREPLY=( "${COMPREPLY[@]/#/-F}" )
cur=-F$cur # Restore cur cur=-F$cur # Restore cur
elif [[ "$cur" == -* ]]; then elif [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-1 -2 -4 -6 -A -a -C -f -g -K -k -M \ COMPREPLY=( $( compgen -W '-1 -2 -4 -6 -A -a -C -f -g -K -k -M \
-N -n -q -s -T -t -V -v -X -v -Y -y -b -b -c -D -e -F \ -N -n -q -s -T -t -V -v -X -v -Y -y -b -b -c -D -e -F \
-i -L -l -m -O -o -p -R -S -w' -- "$cur" ) ) -i -L -l -m -O -o -p -R -S -w' -- "$cur" ) )
else else
# Search COMP_WORDS for '-F configfile' or '-Fconfigfile' argument # Search COMP_WORDS for '-F configfile' or '-Fconfigfile' argument
set -- "${COMP_WORDS[@]}" set -- "${COMP_WORDS[@]}"
while [ $# -gt 0 ]; do while [ $# -gt 0 ]; do
if [ "${1:0:2}" = -F ]; then if [ "${1:0:2}" = -F ]; then
if [ ${#1} -gt 2 ]; then if [ ${#1} -gt 2 ]; then
configfile="$(dequote "${1:2}")" configfile="$(dequote "${1:2}")"
else else
shift shift
[ "$1" ] && configfile="$(dequote "$1")" [ "$1" ] && configfile="$(dequote "$1")"
fi fi
break break
fi fi
shift shift
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
COMPREPLY=( "${COMPREPLY[@]}" $( compgen -c -- "$cur" ) ) COMPREPLY=( "${COMPREPLY[@]}" $( compgen -c -- "$cur" ) )
fi fi
fi fi
return 0 return 0
} }
shopt -u hostcomplete && complete -F _ssh ssh slogin autossh shopt -u hostcomplete && complete -F _ssh ssh slogin autossh
@ -110,51 +110,51 @@ shopt -u hostcomplete && complete -F _ssh ssh slogin autossh
# #
_sftp() _sftp()
{ {
local cur prev configfile local cur prev configfile
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
case "$prev" in case "$prev" in
-@(b|F|P)) -@(b|F|P))
_filedir _filedir
return 0 return 0
;; ;;
-o) -o)
_ssh_options _ssh_options
return 0 return 0
;; ;;
esac esac
if [[ "$cur" == -F* ]]; then if [[ "$cur" == -F* ]]; then
cur=${cur#-F} cur=${cur#-F}
_filedir _filedir
# Prefix completions with '-F' # Prefix completions with '-F'
COMPREPLY=( "${COMPREPLY[@]/#/-F}" ) COMPREPLY=( "${COMPREPLY[@]/#/-F}" )
cur=-F$cur # Restore cur cur=-F$cur # Restore cur
elif [[ "$cur" == -* ]]; then elif [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-1 -C -v -B -b -F -o -P -R -S -s' \ COMPREPLY=( $( compgen -W '-1 -C -v -B -b -F -o -P -R -S -s' \
-- "$cur" ) ) -- "$cur" ) )
else else
# Search COMP_WORDS for '-F configfile' argument # Search COMP_WORDS for '-F configfile' argument
set -- "${COMP_WORDS[@]}" set -- "${COMP_WORDS[@]}"
while [ $# -gt 0 ]; do while [ $# -gt 0 ]; do
if [ "${1:0:2}" = -F ]; then if [ "${1:0:2}" = -F ]; then
if [ ${#1} -gt 2 ]; then if [ ${#1} -gt 2 ]; then
configfile="$(dequote "${1:2}")" configfile="$(dequote "${1:2}")"
else else
shift shift
[ "$1" ] && configfile="$(dequote "$1")" [ "$1" ] && configfile="$(dequote "$1")"
fi fi
break break
fi fi
shift shift
done done
_known_hosts_real -a -F "$configfile" "$cur" _known_hosts_real -a -F "$configfile" "$cur"
fi fi
return 0 return 0
} }
shopt -u hostcomplete && complete -F _sftp sftp shopt -u hostcomplete && complete -F _sftp sftp
@ -163,89 +163,90 @@ shopt -u hostcomplete && complete -F _sftp sftp
# #
_scp() _scp()
{ {
local configfile cur userhost path prefix local configfile cur userhost path prefix
COMPREPLY=() COMPREPLY=()
cur=`_get_cword ":"` cur=`_get_cword ":"`
_expand || return 0 _expand || return 0
if [[ "$cur" == *:* ]]; then if [[ "$cur" == *:* ]]; then
local IFS=$'\t\n' local IFS=$'\t\n'
# remove backslash escape from : # remove backslash escape from :
cur=${cur/\\:/:} cur=${cur/\\:/:}
userhost=${cur%%?(\\):*} userhost=${cur%%?(\\):*}
path=${cur#*:} path=${cur#*:}
# unescape spaces # unescape spaces
path=${path//\\\\\\\\ / } path=${path//\\\\\\\\ / }
if [ -z "$path" ]; then if [ -z "$path" ]; then
# default to home dir of specified user on remote host # default to home dir of specified user on remote host
path=$(ssh -o 'Batchmode yes' $userhost pwd 2>/dev/null) path=$(ssh -o 'Batchmode yes' $userhost pwd 2>/dev/null)
fi fi
# escape spaces; remove executables, aliases, pipes and sockets; # escape spaces; remove executables, aliases, pipes and sockets;
# add space at end of file names # add space at end of file names
COMPREPLY=( $( ssh -o 'Batchmode yes' $userhost \ COMPREPLY=( $( ssh -o 'Batchmode yes' $userhost \
command ls -aF1d "$path*" 2>/dev/null | \ command ls -aF1d "$path*" 2>/dev/null | \
sed -e "s/[][(){}<>\",:;^&\!$=?\`|\\ ']/\\\\\\\\\\\\&/g" \ sed -e "s/[][(){}<>\",:;^&\!$=?\`|\\ ']/\\\\\\\\\\\\&/g" \
-e 's/[*@|=]$//g' -e 's/[^\/]$/& /g' ) ) -e 's/[*@|=]$//g' -e 's/[^\/]$/& /g' ) )
return 0 return 0
fi fi
if [[ "$cur" = -F* ]]; then if [[ "$cur" = -F* ]]; then
cur=${cur#-F} cur=${cur#-F}
prefix=-F prefix=-F
else else
# Search COMP_WORDS for '-F configfile' or '-Fconfigfile' argument # Search COMP_WORDS for '-F configfile' or '-Fconfigfile' argument
set -- "${COMP_WORDS[@]}" set -- "${COMP_WORDS[@]}"
while [ $# -gt 0 ]; do while [ $# -gt 0 ]; do
if [ "${1:0:2}" = -F ]; then if [ "${1:0:2}" = -F ]; then
if [ ${#1} -gt 2 ]; then if [ ${#1} -gt 2 ]; then
configfile="$(dequote "${1:2}")" configfile="$(dequote "${1:2}")"
else else
shift shift
[ "$1" ] && configfile="$(dequote "$1")" [ "$1" ] && configfile="$(dequote "$1")"
fi fi
break break
fi fi
shift shift
done done
[[ "$cur" == */* ]] || _known_hosts_real -c -a -F "$configfile" "$cur" [[ "$cur" == */* ]] || _known_hosts_real -c -a -F "$configfile" "$cur"
fi fi
# This approach is used instead of _filedir to get a space appended # This approach is used instead of _filedir to get a space appended
# after local file/dir completions, and $nospace retained for others. # after local file/dir completions, and $nospace retained for others.
local IFS=$'\t\n' local IFS=$'\t\n'
COMPREPLY=( "${COMPREPLY[@]}" $( command ls -aF1d $cur* 2>/dev/null | sed \ COMPREPLY=( "${COMPREPLY[@]}" $( command ls -aF1d $cur* 2>/dev/null | sed \
-e "s/[][(){}<>\",:;^&\!$=?\`|\\ ']/\\\\&/g" \ -e "s/[][(){}<>\",:;^&\!$=?\`|\\ ']/\\\\&/g" \
-e 's/[*@|=]$//g' -e 's/[^\/]$/& /g' -e "s/^/$prefix/") ) -e 's/[*@|=]$//g' -e 's/[^\/]$/& /g' -e "s/^/$prefix/") )
return 0 return 0
} }
complete -F _scp $nospace scp sshfs complete -F _scp $nospace scp sshfs
# ssh-copy-id(1) completion # ssh-copy-id(1) completion
# #
_ssh_copy_id() { _ssh_copy_id()
local cur prev {
local cur prev
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
case "$prev" in case "$prev" in
-i) -i)
_filedir _filedir
return 0 return 0
;; ;;
esac esac
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-i' -- "$cur" ) ) COMPREPLY=( $( compgen -W '-i' -- "$cur" ) )
else else
_known_hosts_real -a "$cur" _known_hosts_real -a "$cur"
fi fi
return 0 return 0
} }
complete -F _ssh_copy_id $filenames ssh-copy-id complete -F _ssh_copy_id $filenames ssh-copy-id
} }