[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 0b970c7477253d2ca3938fef4875e625882ba367
Ville Skyttä
ville.skytta at iki.fi
Mon Oct 19 18:24:37 UTC 2009
The following commit has been merged in the master branch:
commit 0b970c7477253d2ca3938fef4875e625882ba367
Author: Ville Skyttä <ville.skytta at iki.fi>
Date: Mon Oct 19 21:24:25 2009 +0300
Indentation fixes.
diff --git a/bash_completion.sh b/bash_completion.sh
index 915960b..fad34c6 100644
--- a/bash_completion.sh
+++ b/bash_completion.sh
@@ -4,9 +4,9 @@
# Check for recent enough version of bash.
bash=${BASH_VERSION%.*}; bmajor=${bash%.*}; bminor=${bash#*.}
if [ $bmajor -eq 2 -a $bminor '>' 04 ] || [ $bmajor -gt 2 ]; then
- if [ -r /etc/bash_completion ]; then
- # Source completion code.
- . /etc/bash_completion
- fi
+ if [ -r /etc/bash_completion ]; then
+ # Source completion code.
+ . /etc/bash_completion
+ fi
fi
unset bash bminor bmajor
diff --git a/contrib/_subversion b/contrib/_subversion
index 0168ecd..66a101c 100644
--- a/contrib/_subversion
+++ b/contrib/_subversion
@@ -4,420 +4,417 @@ have svn &&
{
_svn()
{
- local cur prev commands options command
+ local cur prev commands options command
- COMPREPLY=()
- cur=`_get_cword`
+ COMPREPLY=()
+ cur=`_get_cword`
- commands='add blame praise annotate ann cat checkout co cleanup commit \
- ci copy cp delete del remove rm diff di export help ? h import \
- info list ls lock log merge mkdir move mv rename ren \
- propdel pdel pd propedit pedit pe propget pget pg \
- proplist plist pl propset pset ps resolved revert \
- status stat st switch sw unlock update up'
+ commands='add blame praise annotate ann cat checkout co cleanup commit \
+ ci copy cp delete del remove rm diff di export help ? h import \
+ info list ls lock log merge mkdir move mv rename ren \
+ propdel pdel pd propedit pedit pe propget pget pg \
+ proplist plist pl propset pset ps resolved revert \
+ status stat st switch sw unlock update up'
- if [[ $COMP_CWORD -eq 1 ]] ; then
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--version' -- $cur ) )
- else
- COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
- fi
- else
+ if [[ $COMP_CWORD -eq 1 ]] ; then
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--version' -- $cur ) )
+ else
+ COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
+ fi
+ else
- prev=${COMP_WORDS[COMP_CWORD-1]}
- case $prev in
- --config-dir)
- _filedir -d
- return 0;
- ;;
- -@(F|-file|-targets))
- _filedir
- return 0;
- ;;
- --encoding)
- COMPREPLY=( $( compgen -W \
- '$( iconv --list | sed -e "s@//@@;" )' \
- -- "$cur" ) )
- return 0;
- ;;
- --@(editor|diff|diff3)-cmd)
- COMP_WORDS=(COMP_WORDS[0] $cur)
- COMP_CWORD=1
- _command
- return 0;
- ;;
- esac
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+ case $prev in
+ --config-dir)
+ _filedir -d
+ return 0;
+ ;;
+ -@(F|-file|-targets))
+ _filedir
+ return 0;
+ ;;
+ --encoding)
+ COMPREPLY=( $( compgen -W '$( iconv --list | \
+ sed -e "s@//@@;" )' -- "$cur" ) )
+ return 0;
+ ;;
+ --@(editor|diff|diff3)-cmd)
+ COMP_WORDS=(COMP_WORDS[0] $cur)
+ COMP_CWORD=1
+ _command
+ return 0;
+ ;;
+ esac
- command=${COMP_WORDS[1]}
+ command=${COMP_WORDS[1]}
- if [[ "$cur" == -* ]]; then
- # possible options for the command
- case $command in
- add)
- options='--auto-props --no-auto-props \
- --force --targets --no-ignore \
- --non-recursive -N -q --quiet'
- ;;
- @(blame|annotate|ann|praise))
- options='-r --revisions --username \
- --password --no-auth-cache \
- --non-interactive -v \
- --verbose --incremental --xml'
- ;;
- cat)
- options='-r --revision --username \
- --password --no-auth-cache \
- --non-interactive'
- ;;
- @(checkout|co))
- options='-r --revision -q --quiet -N \
- --non-recursive --username \
- --password --no-auth-cache \
- --non-interactive \
- --ignore-externals'
- ;;
- cleanup)
- options='--diff3-cmd'
- ;;
- @(commit|ci))
- options='-m --message -F --file \
- --encoding --force-log -q \
- --quiet --non-recursive -N \
- --targets --editor-cmd \
- --username --password \
- --no-auth-cache \
- --non-interactive --no-unlock'
- ;;
- @(copy|cp))
- options='-m --message -F --file \
- --encoding --force-log -r \
- --revision -q --quiet \
- --editor-cmd -username \
- --password --no-auth-cache \
- --non-interactive'
- ;;
- @(delete|del|remove|rm))
- options='--force -m --message -F \
- --file --encoding --force-log \
- -q --quiet --targets \
- --editor-cmd -username \
- --password --no-auth-cache \
- --non-interactive'
- ;;
- @(diff|di))
- options='-r --revision -x --extensions \
- --diff-cmd --no-diff-deleted \
- -N --non-recursive --username \
- --password --no-auth-cache \
- --non-interactive --force \
- --old --new --notice-ancestry'
- ;;
- export)
- options='-r --revision -q --quiet \
- --username --password \
- --no-auth-cache \
- --non-interactive -N \
- --non-recursive --force \
- --native-eol --ignore-externals'
- ;;
- import)
- options='--auto-props --no-auto-props \
- -m --message -F --file \
- --encoding --force-log -q \
- --quiet --non-recursive \
- --no-ignore --editor-cmd \
- --username --password \
- --no-auth-cache \
- --non-interactive'
- ;;
- info)
- options='--username --password \
- --no-auth-cache \
- --non-interactive -r \
- --revision --xml --targets \
- -R --recursive --incremental'
- ;;
- @(list|ls))
- options='-r --revision -v --verbose -R \
- --recursive --username \
- --password --no-auth-cache \
- --non-interactive \
- --incremental --xml'
- ;;
- lock)
- options='-m --message -F --file \
- --encoding --force-log \
- --targets --force --username \
- --password --no-auth-cache \
- --non-interactive'
- ;;
- log)
- options='-r --revision -v --verbose \
- --targets --username \
- --password --no-auth-cache \
- --non-interactive \
- --stop-on-copy --incremental \
- --xml -q --quiet --limit'
- ;;
- merge)
- options='-r --revision -N \
- --non-recursive -q --quiet \
- --force --dry-run --diff3-cmd \
- --username --password \
- --no-auth-cache \
- --non-interactive \
- --ignore-ancestry'
- ;;
- mkdir)
- options='-m --message -F --file \
- --encoding --force-log -q \
- --quiet --editor-cmd \
- --username --password \
- --no-auth-cache \
- --non-interactive'
- ;;
- @(move|mv|rename|ren))
- options='-m --message -F --file \
- --encoding --force-log -r \
- --revision -q --quiet \
- --force --editor-cmd \
- --username --password \
- --no-auth-cache \
- --non-interactive'
- ;;
- @(propdel|pdel|pd))
- options='-q --quiet -R --recursive -r \
- --revision --revprop \
- --username --password \
- --no-auth-cache \
- --non-interactive'
- ;;
- @(propedit|pedit|pe))
- options='-r --revision --revprop \
- --encoding --editor-cmd \
- --username --password \
- --no-auth-cache \
- --non-interactive --force'
- ;;
- @(propget|pget|pg))
- options='-R --recursive -r --revision \
- --revprop --strict --username \
- --password --no-auth-cache \
- --non-interactive'
- ;;
- @(proplist|plist|pl))
- options='-v --verbose -R --recursive \
- -r --revision --revprop -q \
- --quiet --username --password \
- --no-auth-cache \
- --non-interactive'
- ;;
- @(propset|pset|ps))
- options='-F --file -q --quiet \
- --targets -R --recursive \
- --revprop --encoding \
- --username --password \
- --no-auth-cache \
- --non-interactive -r \
- --revision --force'
- ;;
- resolved)
- options='--targets -R --recursive -q \
- --quiet'
- ;;
- revert)
- options='--targets -R --recursive -q \
- --quiet'
- ;;
- @(status|stat|st))
- options='-u --show-updates -v \
- --verbose -N --non-recursive \
- -q --quiet --username \
- --password --no-auth-cache \
- --non-interactive --no-ignore \
- --ignore-externals \
- --incremental --xml'
- ;;
- @(switch|sw))
- options='--relocate -r --revision -N \
- --non-recursive -q --quiet \
- --username --password \
- --no-auth-cache \
- --non-interactive --diff3-cmd'
- ;;
- unlock)
- options='--targets --force --username \
- --password --no-auth-cache \
- --non-interactive'
- ;;
- @(update|up))
- options='-r --revision -N \
- --non-recursive -q --quiet \
- --username --password \
- --no-auth-cache \
- --non-interactive \
- --diff3-cmd --ignore-externals'
- ;;
- esac
- options="$options --help -h --config-dir"
+ if [[ "$cur" == -* ]]; then
+ # possible options for the command
+ case $command in
+ add)
+ options='--auto-props --no-auto-props \
+ --force --targets --no-ignore \
+ --non-recursive -N -q --quiet'
+ ;;
+ @(blame|annotate|ann|praise))
+ options='-r --revisions --username \
+ --password --no-auth-cache \
+ --non-interactive -v \
+ --verbose --incremental --xml'
+ ;;
+ cat)
+ options='-r --revision --username \
+ --password --no-auth-cache \
+ --non-interactive'
+ ;;
+ @(checkout|co))
+ options='-r --revision -q --quiet -N \
+ --non-recursive --username \
+ --password --no-auth-cache \
+ --non-interactive \
+ --ignore-externals'
+ ;;
+ cleanup)
+ options='--diff3-cmd'
+ ;;
+ @(commit|ci))
+ options='-m --message -F --file \
+ --encoding --force-log -q \
+ --quiet --non-recursive -N \
+ --targets --editor-cmd \
+ --username --password \
+ --no-auth-cache \
+ --non-interactive --no-unlock'
+ ;;
+ @(copy|cp))
+ options='-m --message -F --file \
+ --encoding --force-log -r \
+ --revision -q --quiet \
+ --editor-cmd -username \
+ --password --no-auth-cache \
+ --non-interactive'
+ ;;
+ @(delete|del|remove|rm))
+ options='--force -m --message -F \
+ --file --encoding --force-log \
+ -q --quiet --targets \
+ --editor-cmd -username \
+ --password --no-auth-cache \
+ --non-interactive'
+ ;;
+ @(diff|di))
+ options='-r --revision -x --extensions \
+ --diff-cmd --no-diff-deleted \
+ -N --non-recursive --username \
+ --password --no-auth-cache \
+ --non-interactive --force \
+ --old --new --notice-ancestry'
+ ;;
+ export)
+ options='-r --revision -q --quiet \
+ --username --password \
+ --no-auth-cache \
+ --non-interactive -N \
+ --non-recursive --force \
+ --native-eol --ignore-externals'
+ ;;
+ import)
+ options='--auto-props --no-auto-props \
+ -m --message -F --file \
+ --encoding --force-log -q \
+ --quiet --non-recursive \
+ --no-ignore --editor-cmd \
+ --username --password \
+ --no-auth-cache \
+ --non-interactive'
+ ;;
+ info)
+ options='--username --password \
+ --no-auth-cache \
+ --non-interactive -r \
+ --revision --xml --targets \
+ -R --recursive --incremental'
+ ;;
+ @(list|ls))
+ options='-r --revision -v --verbose -R \
+ --recursive --username \
+ --password --no-auth-cache \
+ --non-interactive \
+ --incremental --xml'
+ ;;
+ lock)
+ options='-m --message -F --file \
+ --encoding --force-log \
+ --targets --force --username \
+ --password --no-auth-cache \
+ --non-interactive'
+ ;;
+ log)
+ options='-r --revision -v --verbose \
+ --targets --username \
+ --password --no-auth-cache \
+ --non-interactive \
+ --stop-on-copy --incremental \
+ --xml -q --quiet --limit'
+ ;;
+ merge)
+ options='-r --revision -N \
+ --non-recursive -q --quiet \
+ --force --dry-run --diff3-cmd \
+ --username --password \
+ --no-auth-cache \
+ --non-interactive \
+ --ignore-ancestry'
+ ;;
+ mkdir)
+ options='-m --message -F --file \
+ --encoding --force-log -q \
+ --quiet --editor-cmd \
+ --username --password \
+ --no-auth-cache \
+ --non-interactive'
+ ;;
+ @(move|mv|rename|ren))
+ options='-m --message -F --file \
+ --encoding --force-log -r \
+ --revision -q --quiet \
+ --force --editor-cmd \
+ --username --password \
+ --no-auth-cache \
+ --non-interactive'
+ ;;
+ @(propdel|pdel|pd))
+ options='-q --quiet -R --recursive -r \
+ --revision --revprop \
+ --username --password \
+ --no-auth-cache \
+ --non-interactive'
+ ;;
+ @(propedit|pedit|pe))
+ options='-r --revision --revprop \
+ --encoding --editor-cmd \
+ --username --password \
+ --no-auth-cache \
+ --non-interactive --force'
+ ;;
+ @(propget|pget|pg))
+ options='-R --recursive -r --revision \
+ --revprop --strict --username \
+ --password --no-auth-cache \
+ --non-interactive'
+ ;;
+ @(proplist|plist|pl))
+ options='-v --verbose -R --recursive \
+ -r --revision --revprop -q \
+ --quiet --username --password \
+ --no-auth-cache \
+ --non-interactive'
+ ;;
+ @(propset|pset|ps))
+ options='-F --file -q --quiet \
+ --targets -R --recursive \
+ --revprop --encoding \
+ --username --password \
+ --no-auth-cache \
+ --non-interactive -r \
+ --revision --force'
+ ;;
+ resolved)
+ options='--targets -R --recursive -q --quiet'
+ ;;
+ revert)
+ options='--targets -R --recursive -q --quiet'
+ ;;
+ @(status|stat|st))
+ options='-u --show-updates -v \
+ --verbose -N --non-recursive \
+ -q --quiet --username \
+ --password --no-auth-cache \
+ --non-interactive --no-ignore \
+ --ignore-externals \
+ --incremental --xml'
+ ;;
+ @(switch|sw))
+ options='--relocate -r --revision -N \
+ --non-recursive -q --quiet \
+ --username --password \
+ --no-auth-cache \
+ --non-interactive --diff3-cmd'
+ ;;
+ unlock)
+ options='--targets --force --username \
+ --password --no-auth-cache \
+ --non-interactive'
+ ;;
+ @(update|up))
+ options='-r --revision -N \
+ --non-recursive -q --quiet \
+ --username --password \
+ --no-auth-cache \
+ --non-interactive \
+ --diff3-cmd --ignore-externals'
+ ;;
+ esac
+ options="$options --help -h --config-dir"
- COMPREPLY=( $( compgen -W "$options" -- $cur ) )
- else
- if [[ "$command" == @(help|h|\?) ]]; then
- COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
- else
- _filedir
- fi
- fi
- fi
+ COMPREPLY=( $( compgen -W "$options" -- $cur ) )
+ else
+ if [[ "$command" == @(help|h|\?) ]]; then
+ COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
+ else
+ _filedir
+ fi
+ fi
+ fi
- return 0
+ return 0
}
complete -F _svn $filenames svn
_svnadmin()
{
- local cur prev commands options mode
+ local cur prev commands options mode
- COMPREPLY=()
- cur=`_get_cword`
+ COMPREPLY=()
+ cur=`_get_cword`
- commands='create deltify dump help ? hotcopy list-dblogs \
- list-unused-dblogs load lslocks lstxns recover rmlocks \
- rmtxns setlog verify'
+ commands='create deltify dump help ? hotcopy list-dblogs \
+ list-unused-dblogs load lslocks lstxns recover rmlocks \
+ rmtxns setlog verify'
- if [[ $COMP_CWORD -eq 1 ]] ; then
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--version' -- $cur ) )
- else
- COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
- fi
- else
- prev=${COMP_WORDS[COMP_CWORD-1]}
- case $prev in
- --config-dir)
- _filedir -d
- return 0;
- ;;
- --fs-type)
- COMPREPLY=( $( compgen -W 'fsfs bdb' -- $cur ) )
- return 0;
- ;;
- esac
+ if [[ $COMP_CWORD -eq 1 ]] ; then
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--version' -- $cur ) )
+ else
+ COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
+ fi
+ else
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+ case $prev in
+ --config-dir)
+ _filedir -d
+ return 0;
+ ;;
+ --fs-type)
+ COMPREPLY=( $( compgen -W 'fsfs bdb' -- $cur ) )
+ return 0;
+ ;;
+ esac
- command=${COMP_WORDS[1]}
+ command=${COMP_WORDS[1]}
- if [[ "$cur" == -* ]]; then
- # possible options for the command
- case $command in
- create)
- options='--bdb-txn-nosync \
- --bdb-log-keep --config-dir \
- --fs-type'
- ;;
- deltify)
- options='-r --revision -q --quiet'
- ;;
- dump)
- options='-r --revision --incremental \
- -q --quiet --deltas'
- ;;
- hotcopy)
- options='--clean-logs'
- ;;
- load)
- options='--ignore-uuid --force-uuid \
- --parent-dir -q --quiet \
- --use-pre-commit-hook \
- --use-post-commit-hook'
- ;;
- rmtxns)
- options='-q --quiet'
- ;;
- setlog)
- options='-r --revision --bypass-hooks'
- ;;
- esac
+ if [[ "$cur" == -* ]]; then
+ # possible options for the command
+ case $command in
+ create)
+ options='--bdb-txn-nosync \
+ --bdb-log-keep --config-dir \
+ --fs-type'
+ ;;
+ deltify)
+ options='-r --revision -q --quiet'
+ ;;
+ dump)
+ options='-r --revision --incremental \
+ -q --quiet --deltas'
+ ;;
+ hotcopy)
+ options='--clean-logs'
+ ;;
+ load)
+ options='--ignore-uuid --force-uuid \
+ --parent-dir -q --quiet \
+ --use-pre-commit-hook \
+ --use-post-commit-hook'
+ ;;
+ rmtxns)
+ options='-q --quiet'
+ ;;
+ setlog)
+ options='-r --revision --bypass-hooks'
+ ;;
+ esac
- options="$options --help -h"
- COMPREPLY=( $( compgen -W "$options" -- $cur ) )
- else
- if [[ "$command" == @(help|h|\?) ]]; then
- COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
- else
- _filedir
- fi
- fi
- fi
+ options="$options --help -h"
+ COMPREPLY=( $( compgen -W "$options" -- $cur ) )
+ else
+ if [[ "$command" == @(help|h|\?) ]]; then
+ COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
+ else
+ _filedir
+ fi
+ fi
+ fi
- return 0
+ return 0
}
complete -F _svnadmin $default svnadmin
_svnlook()
{
- local cur prev commands options mode
+ local cur prev commands options mode
- COMPREPLY=()
- cur=`_get_cword`
+ COMPREPLY=()
+ cur=`_get_cword`
- commands='author cat changed date diff dirs-changed help ? h history \
- info lock log propget pget pg proplist plist pl tree uuid \
- youngest'
+ commands='author cat changed date diff dirs-changed help ? h history \
+ info lock log propget pget pg proplist plist pl tree uuid \
+ youngest'
- if [[ $COMP_CWORD -eq 1 ]] ; then
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--version' -- $cur ) )
- else
- COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
- fi
- else
- command=${COMP_WORDS[1]}
+ if [[ $COMP_CWORD -eq 1 ]] ; then
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--version' -- $cur ) )
+ else
+ COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
+ fi
+ else
+ command=${COMP_WORDS[1]}
- if [[ "$cur" == -* ]]; then
- # possible options for the command
- case $command in
- @(author|cat|date|dirs-changed|info|log))
- options='-r --revision -t \
- --transaction'
- ;;
- changed)
- options='-r --revision -t \
- --transaction --copy-info'
- ;;
- diff)
- options='-r --revision -t \
- --transaction \
- --no-diff-deleted \
- --no-diff-added \
- --diff-copy-from'
- ;;
- history)
- options='-r --revision --show-ids'
- ;;
- prop@(get|list))
- options='-r --revision -t \
- --transaction --revprop'
- ;;
- tree)
- options='-r --revision -t \
- --transaction --show-ids \
- --full-paths'
- ;;
- esac
+ if [[ "$cur" == -* ]]; then
+ # possible options for the command
+ case $command in
+ @(author|cat|date|dirs-changed|info|log))
+ options='-r --revision -t \
+ --transaction'
+ ;;
+ changed)
+ options='-r --revision -t \
+ --transaction --copy-info'
+ ;;
+ diff)
+ options='-r --revision -t \
+ --transaction \
+ --no-diff-deleted \
+ --no-diff-added \
+ --diff-copy-from'
+ ;;
+ history)
+ options='-r --revision --show-ids'
+ ;;
+ prop@(get|list))
+ options='-r --revision -t \
+ --transaction --revprop'
+ ;;
+ tree)
+ options='-r --revision -t \
+ --transaction --show-ids \
+ --full-paths'
+ ;;
+ esac
- options="$options --help -h"
- COMPREPLY=( $( compgen -W "$options" -- $cur ) )
- else
- if [[ "$command" == @(help|h|\?) ]]; then
- COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
- else
- _filedir
- fi
- fi
- fi
+ options="$options --help -h"
+ COMPREPLY=( $( compgen -W "$options" -- $cur ) )
+ else
+ if [[ "$command" == @(help|h|\?) ]]; then
+ COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
+ else
+ _filedir
+ fi
+ fi
+ fi
- return 0
+ return 0
}
complete -F _svnlook $default svnlook
}
diff --git a/contrib/_yum b/contrib/_yum
index c997937..d61bc4b 100644
--- a/contrib/_yum
+++ b/contrib/_yum
@@ -7,12 +7,12 @@ _yum_list()
# Try to strip in between headings like "Available Packages"
# This will obviously only work for English :P
COMPREPLY=( $( yum -d 0 -C list $1 "$cur*" 2>/dev/null | \
- sed -ne '/^\(Available\|Installed\|Updated\) /d' \
- -e 's/[[:space:]].*//p' ) )
+ sed -ne '/^\(Available\|Installed\|Updated\) /d' \
+ -e 's/[[:space:]].*//p' ) )
else
- # Drop first line (e.g. "Updated Packages")
- COMPREPLY=( $( yum -d 0 -C list $1 "$cur*" 2>/dev/null | \
- sed -ne 1d -e 's/[[:space:]].*//p' ) )
+ # Drop first line (e.g. "Updated Packages")
+ COMPREPLY=( $( yum -d 0 -C list $1 "$cur*" 2>/dev/null | \
+ sed -ne 1d -e 's/[[:space:]].*//p' ) )
fi
}
@@ -20,15 +20,15 @@ _yum_repolist()
{
# -d 0 causes repolist to output nothing as of yum 3.2.22:
# http://yum.baseurl.org/ticket/83
- # Drop first ("repo id repo name") and last ("repolist: ...") rows
+ # Drop first ("repo id repo name") and last ("repolist: ...") rows
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()
{
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()
@@ -40,91 +40,91 @@ _yum()
prev=${COMP_WORDS[COMP_CWORD-1]}
for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
- if [[ ${COMP_WORDS[i]} == @(install|update|upgrade|remove|erase|deplist|info) ]]; then
- special=${COMP_WORDS[i]}
- fi
+ if [[ ${COMP_WORDS[i]} == @(install|update|upgrade|remove|erase|deplist|info) ]]; then
+ special=${COMP_WORDS[i]}
+ fi
done
if [ -n "$special" ]; then
- # TODO: install|update|upgrade should not match *src.rpm
- if [[ "$cur" == */* && "$special" == @(deplist|install|update|upgrade) ]]; then
- _filedir rpm
- return 0
- fi
- case $special in
- install)
- _yum_list available
- return 0
- ;;
- deplist|info)
- _yum_list all
- return 0
- ;;
- upgrade|update)
- _yum_list updates
- return 0
- ;;
- remove|erase)
- # _rpm_installed_packages is not arch-qualified
- _yum_list installed
- return 0
- ;;
- esac
+ # TODO: install|update|upgrade should not match *src.rpm
+ if [[ "$cur" == */* && "$special" == @(deplist|install|update|upgrade) ]]; then
+ _filedir rpm
+ return 0
+ fi
+ case $special in
+ install)
+ _yum_list available
+ return 0
+ ;;
+ deplist|info)
+ _yum_list all
+ return 0
+ ;;
+ upgrade|update)
+ _yum_list updates
+ return 0
+ ;;
+ remove|erase)
+ # _rpm_installed_packages is not arch-qualified
+ _yum_list installed
+ return 0
+ ;;
+ esac
fi
_split_longopt && split=true
case $prev in
- list)
- COMPREPLY=( $( compgen -W 'all available updates \
- installed extras obsoletes recent' -- $cur ) )
- ;;
- clean)
- COMPREPLY=( $( compgen -W 'packages headers metadata \
- cache dbcache all' -- $cur ) )
- ;;
- repolist)
- COMPREPLY=( $( compgen -W 'all enabled disabled' -- $cur ) )
- ;;
- localinstall|localupdate)
- # TODO: should not match *src.rpm
- _filedir rpm
- ;;
- -d|-e)
- COMPREPLY=( $( compgen -W '0 1 2 3 4 5 6 7 8 9 10' -- $cur ) )
- ;;
- -c)
- _filedir
- ;;
- --installroot)
- _filedir -d
- ;;
- --enablerepo)
- COMPREPLY=( $( compgen -W '$( _yum_repolist disabled )' -- $cur ) )
- ;;
- --disablerepo)
- COMPREPLY=( $( compgen -W '$( _yum_repolist enabled )' -- $cur ) )
- ;;
- --disableexcludes)
- COMPREPLY=( $( compgen -W '$( _yum_repolist all ) all main' \
+ list)
+ COMPREPLY=( $( compgen -W 'all available updates \
+ installed extras obsoletes recent' -- $cur ) )
+ ;;
+ clean)
+ COMPREPLY=( $( compgen -W 'packages headers metadata \
+ cache dbcache all' -- $cur ) )
+ ;;
+ repolist)
+ COMPREPLY=( $( compgen -W 'all enabled disabled' -- $cur ) )
+ ;;
+ localinstall|localupdate)
+ # TODO: should not match *src.rpm
+ _filedir rpm
+ ;;
+ -d|-e)
+ COMPREPLY=( $( compgen -W '0 1 2 3 4 5 6 7 8 9 10' -- $cur ) )
+ ;;
+ -c)
+ _filedir
+ ;;
+ --installroot)
+ _filedir -d
+ ;;
+ --enablerepo)
+ COMPREPLY=( $( compgen -W '$( _yum_repolist disabled )' -- $cur ) )
+ ;;
+ --disablerepo)
+ COMPREPLY=( $( compgen -W '$( _yum_repolist enabled )' -- $cur ) )
+ ;;
+ --disableexcludes)
+ COMPREPLY=( $( compgen -W '$( _yum_repolist all ) all main' \
-- $cur ) )
- ;;
- --enableplugin|--disableplugin)
- COMPREPLY=( $( compgen -W '$( _yum_plugins )' -- $cur ))
- ;;
- --color)
- COMPREPLY=( $( compgen -W 'always auto never' -- $cur ))
- ;;
- -R|-x|--exclude)
- # argument required but no completions available
- return 0
- ;;
- -h|--help|--version)
- # no other options useful with these
- return 0
- ;;
- *)
- COMPREPLY=( $( compgen -W 'install update check-update upgrade \
+ ;;
+ --enableplugin|--disableplugin)
+ COMPREPLY=( $( compgen -W '$( _yum_plugins )' -- $cur ))
+ ;;
+ --color)
+ COMPREPLY=( $( compgen -W 'always auto never' -- $cur ))
+ ;;
+ -R|-x|--exclude)
+ # argument required but no completions available
+ return 0
+ ;;
+ -h|--help|--version)
+ # no other options useful with these
+ return 0
+ ;;
+ *)
+ COMPREPLY=( $( compgen -W 'install update check-update upgrade \
remove erase list info provides whatprovides clean makecache \
groupinstall groupupdate grouplist groupremove groupinfo \
search shell resolvedep localinstall localupdate deplist \
@@ -140,7 +140,7 @@ _yum()
--enablerepo --disablerepo --exclude --disableexcludes --obsoletes \
--noplugins --nogpgcheck --disableplugin --enableplugin \
--skip-broken --color' -- $cur ) )
- return 0
+ return 0
fi
}
} &&
diff --git a/contrib/ant b/contrib/ant
index 58423f7..de3e157 100644
--- a/contrib/ant
+++ b/contrib/ant
@@ -1,64 +1,63 @@
# bash completion for ant
-have ant && {
+have ant &&
+{
_ant()
{
- local cur prev buildfile i
+ local cur prev buildfile i
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
- case "$prev" in
- -buildfile|-file|-f)
- _filedir 'xml'
- return 0
- ;;
- -logfile|-l)
- _filedir
- return 0
- ;;
- -propertyfile)
- _filedir properties
- return 0
- ;;
- -nice)
- COMPREPLY=( $( compgen -W '1 2 3 4 5 6 7 8 9 10' \
- -- "$cur" ) )
- return 0
- ;;
- -lib|-logger|-listener|-D|-inputhandler|-main)
- return 0
- ;;
- esac
+ case "$prev" in
+ -buildfile|-file|-f)
+ _filedir 'xml'
+ return 0
+ ;;
+ -logfile|-l)
+ _filedir
+ return 0
+ ;;
+ -propertyfile)
+ _filedir properties
+ return 0
+ ;;
+ -nice)
+ COMPREPLY=( $( compgen -W '1 2 3 4 5 6 7 8 9 10' -- "$cur" ) )
+ return 0
+ ;;
+ -lib|-logger|-listener|-D|-inputhandler|-main)
+ return 0
+ ;;
+ esac
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-help -h -projecthelp -p -version \
- -diagnostics -quiet -q -verbose -v -debug -d -emacs -e \
- -lib -logfile -l -logger -listener -noinput -buildfile \
- -file -f -D -keep-going -k -propertyfile -inputhandler \
- -find -s -nice -nouserlib -noclasspath -autoproxy \
- -main' -- "$cur" ) )
- else
- # available targets completion
- # find which buildfile to use
- buildfile=build.xml
- for (( i=1; i < COMP_CWORD; i++ )); do
- if [[ "${COMP_WORDS[i]}" == -@(?(build)file|f) ]]; then
- buildfile=${COMP_WORDS[i+1]}
- break
- fi
- done
- [ ! -f $buildfile ] && return 0
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-help -h -projecthelp -p -version \
+ -diagnostics -quiet -q -verbose -v -debug -d -emacs -e \
+ -lib -logfile -l -logger -listener -noinput -buildfile \
+ -file -f -D -keep-going -k -propertyfile -inputhandler \
+ -find -s -nice -nouserlib -noclasspath -autoproxy \
+ -main' -- "$cur" ) )
+ else
+ # available targets completion
+ # find which buildfile to use
+ buildfile=build.xml
+ for (( i=1; i < COMP_CWORD; i++ )); do
+ if [[ "${COMP_WORDS[i]}" == -@(?(build)file|f) ]]; then
+ buildfile=${COMP_WORDS[i+1]}
+ break
+ fi
+ done
+ [ ! -f $buildfile ] && return 0
- # parse buildfile for targets
- # some versions of sed complain if there's no trailing linefeed,
- # hence the 2>/dev/null
- COMPREPLY=( $( compgen -W "$( cat $buildfile | \
- tr "'\t\n>" "\" \n" | \
- sed -ne 's/.*<target .*name="\([^"]*\).*/\1/p' \
- 2>/dev/null )" -- "$cur" ) )
- fi
+ # parse buildfile for targets
+ # some versions of sed complain if there's no trailing linefeed,
+ # hence the 2>/dev/null
+ COMPREPLY=( $( compgen -W "$( cat $buildfile | tr "'\t\n>" "\" \n" | \
+ sed -ne 's/.*<target .*name="\([^"]*\).*/\1/p' 2>/dev/null )" \
+ -- "$cur" ) )
+ fi
}
have complete-ant-cmd.pl && \
complete -C complete-ant-cmd.pl -F _ant $filenames ant || \
diff --git a/contrib/bitkeeper b/contrib/bitkeeper
index 737837e..3e1641a 100644
--- a/contrib/bitkeeper
+++ b/contrib/bitkeeper
@@ -2,17 +2,17 @@
have bk &&
_bk() {
- local BKCMDS
+ local BKCMDS
- COMPREPLY=()
- cur=`_get_cword`
+ COMPREPLY=()
+ 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" ) )
- _filedir
+ COMPREPLY=( $( compgen -W "$BKCMDS" -- "$cur" ) )
+ _filedir
- return 0
+ return 0
} &&
complete -F _bk bk
diff --git a/contrib/modules b/contrib/modules
index 1f99534..f057411 100644
--- a/contrib/modules
+++ b/contrib/modules
@@ -20,41 +20,42 @@ have module || [ -f /etc/profile.d/modules.sh ] && {
_module_list ()
{
- local modules="$( echo $LOADEDMODULES | sed 's/:/ /g' | sort )"
- compgen -W "$modules" -- $1
+ local modules="$( echo $LOADEDMODULES | sed 's/:/ /g' | sort )"
+ compgen -W "$modules" -- $1
}
_module_path ()
{
- local modules="$( echo $MODULEPATH | sed 's/:/ /g' | sort )"
- compgen -W "$modules" -- $1
+ local modules="$( echo $MODULEPATH | sed 's/:/ /g' | sort )"
+ compgen -W "$modules" -- $1
}
_module_avail ()
{
- local modules="$( \
- module avail 2>&1 | \
- egrep -v '^(-|$)' | \
- xargs printf '%s\n' | sort )"
+ local modules="$( \
+ module avail 2>&1 | \
+ egrep -v '^(-|$)' | \
+ xargs printf '%s\n' | sort )"
- compgen -W "$modules" -- $1
+ compgen -W "$modules" -- $1
}
# A completion function for the module alias
-_module () {
- local cur prev options
+_module ()
+{
+ local cur prev options
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
- if [ $COMP_CWORD -eq 1 ] ; then
- # First parameter on line -- we expect it to be a mode selection
+ if [ $COMP_CWORD -eq 1 ] ; then
+ # First parameter on line -- we expect it to be a mode selection
- options="$( module help 2>&1 | egrep '^[[:space:]]*\+' | \
- awk '{print $2}' | sed -e 's/|/ /g' | sort )"
+ options="$( module help 2>&1 | egrep '^[[:space:]]*\+' | \
+ awk '{print $2}' | sed -e 's/|/ /g' | sort )"
- COMPREPLY=( $(compgen -W "$options" -- "$cur") )
+ COMPREPLY=( $(compgen -W "$options" -- "$cur") )
elif [ $COMP_CWORD -eq 2 ] ; then
case "$prev" in
@@ -74,8 +75,8 @@ _module () {
COMPREPLY=( $(_module_avail "$cur") )
;;
esac
- fi
- return 0
+ fi
+ return 0
}
complete -F _module $default module
}
diff --git a/contrib/perl b/contrib/perl
index 77fac47..981d5bc 100644
--- a/contrib/perl
+++ b/contrib/perl
@@ -41,8 +41,8 @@ _perl()
esac
if [[ "$cur" == -* ]]; then
- 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" ) )
+ 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" ) )
else
_filedir
fi
diff --git a/contrib/ssh b/contrib/ssh
index 0215ffd..112f1ae 100644
--- a/contrib/ssh
+++ b/contrib/ssh
@@ -1,108 +1,108 @@
# ssh(1) completion
-have ssh && {
+have ssh &&
+{
_ssh_options() {
- COMPREPLY=( $( compgen -W 'AddressFamily BatchMode BindAddress \
- ChallengeResponseAuthentication CheckHostIP Cipher Ciphers \
- ClearAllForwardings Compression CompressionLevel \
- ConnectionAttempts ConnectTimeout ControlMaster ControlPath \
- DynamicForward EscapeChar ExitOnForwardFailure ForwardAgent \
- ForwardX11 ForwardX11Trusted GatewayPorts GlobalKnownHostsFile \
- GSSAPIAuthentication GSSAPIDelegateCredentials HashKnownHosts \
- Host HostbasedAuthentication HostKeyAlgorithms HostKeyAlias \
- HostName IdentityFile IdentitiesOnly KbdInteractiveDevices \
- LocalCommand LocalForward LogLevel MACs \
- NoHostAuthenticationForLocalhost NumberOfPasswordPrompts \
- PasswordAuthentication PermitLocalCommand Port \
- PreferredAuthentications Protocol ProxyCommand \
- PubkeyAuthentication RekeyLimit RemoteForward \
- RhostsRSAAuthentication RSAAuthentication SendEnv \
- ServerAliveInterval ServerAliveCountMax SmartcardDevice \
- StrictHostKeyChecking TCPKeepAlive Tunnel TunnelDevice \
- UsePrivilegedPort User UserKnownHostsFile VerifyHostKeyDNS \
- VisualHostKey XAuthLocation' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W 'AddressFamily BatchMode BindAddress \
+ ChallengeResponseAuthentication CheckHostIP Cipher Ciphers \
+ ClearAllForwardings Compression CompressionLevel \
+ ConnectionAttempts ConnectTimeout ControlMaster ControlPath \
+ DynamicForward EscapeChar ExitOnForwardFailure ForwardAgent \
+ ForwardX11 ForwardX11Trusted GatewayPorts GlobalKnownHostsFile \
+ GSSAPIAuthentication GSSAPIDelegateCredentials HashKnownHosts \
+ Host HostbasedAuthentication HostKeyAlgorithms HostKeyAlias \
+ HostName IdentityFile IdentitiesOnly KbdInteractiveDevices \
+ LocalCommand LocalForward LogLevel MACs \
+ NoHostAuthenticationForLocalhost NumberOfPasswordPrompts \
+ PasswordAuthentication PermitLocalCommand Port \
+ PreferredAuthentications Protocol ProxyCommand \
+ PubkeyAuthentication RekeyLimit RemoteForward \
+ RhostsRSAAuthentication RSAAuthentication SendEnv \
+ ServerAliveInterval ServerAliveCountMax SmartcardDevice \
+ StrictHostKeyChecking TCPKeepAlive Tunnel TunnelDevice \
+ UsePrivilegedPort User UserKnownHostsFile VerifyHostKeyDNS \
+ VisualHostKey XAuthLocation' -- "$cur" ) )
}
_ssh()
{
- local cur prev configfile
- local -a config
+ local cur prev configfile
+ local -a config
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
- case "$prev" in
- -@(F|i|S))
- _filedir
- return 0
- ;;
- -c)
- COMPREPLY=( $( compgen -W '3des-cbc aes128-cbc \
- aes192-cbc aes256-cbc aes128-ctr aes192-ctr \
- aes256-ctr arcfour128 arcfour256 arcfour \
- blowfish-cbc cast128-cbc' -- "$cur" ) )
- return 0
- ;;
- -c)
- COMPREPLY=( $( compgen -W 'hmac-md5 hmac-sha1 \
- umac-64 at openssh.com hmac-ripemd160 \
- hmac-sha1-96 hmac-md5-96' -- "$cur" ) )
- return 0
- ;;
- -l)
- COMPREPLY=( $( compgen -u -- "$cur" ) )
- return 0
- ;;
- -o)
- _ssh_options
- return 0
- ;;
- -w)
- _available_interfaces
- return 0
- ;;
- -b)
- COMPREPLY=( $( compgen -W "$(/sbin/ifconfig | \
- awk '/adr:/ {print $2}' | \
- awk -F: '{print $2}' )" -- "$cur" ) )
- return 0
- ;;
- esac
+ case "$prev" in
+ -@(F|i|S))
+ _filedir
+ return 0
+ ;;
+ -c)
+ COMPREPLY=( $( compgen -W '3des-cbc aes128-cbc \
+ aes192-cbc aes256-cbc aes128-ctr aes192-ctr \
+ aes256-ctr arcfour128 arcfour256 arcfour \
+ blowfish-cbc cast128-cbc' -- "$cur" ) )
+ return 0
+ ;;
+ -c)
+ COMPREPLY=( $( compgen -W 'hmac-md5 hmac-sha1 \
+ umac-64 at openssh.com hmac-ripemd160 \
+ hmac-sha1-96 hmac-md5-96' -- "$cur" ) )
+ return 0
+ ;;
+ -l)
+ COMPREPLY=( $( compgen -u -- "$cur" ) )
+ return 0
+ ;;
+ -o)
+ _ssh_options
+ return 0
+ ;;
+ -w)
+ _available_interfaces
+ return 0
+ ;;
+ -b)
+ COMPREPLY=( $( compgen -W "$(/sbin/ifconfig | \
+ awk '/adr:/ {print $2}' | awk -F: '{print $2}' )" -- "$cur" ) )
+ return 0
+ ;;
+ esac
- if [[ "$cur" == -F* ]]; then
- cur=${cur#-F}
- _filedir
- # Prefix completions with '-F'
- COMPREPLY=( "${COMPREPLY[@]/#/-F}" )
- cur=-F$cur # Restore cur
- elif [[ "$cur" == -* ]]; then
- 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 \
- -i -L -l -m -O -o -p -R -S -w' -- "$cur" ) )
- else
- # Search COMP_WORDS for '-F configfile' or '-Fconfigfile' argument
- set -- "${COMP_WORDS[@]}"
- while [ $# -gt 0 ]; do
- if [ "${1:0:2}" = -F ]; then
- if [ ${#1} -gt 2 ]; then
- configfile="$(dequote "${1:2}")"
- else
- shift
- [ "$1" ] && configfile="$(dequote "$1")"
- fi
- break
- fi
- shift
- done
- _known_hosts_real -a -F "$configfile" "$cur"
- if [ $COMP_CWORD -ne 1 ]; then
- COMPREPLY=( "${COMPREPLY[@]}" $( compgen -c -- "$cur" ) )
- fi
- fi
+ if [[ "$cur" == -F* ]]; then
+ cur=${cur#-F}
+ _filedir
+ # Prefix completions with '-F'
+ COMPREPLY=( "${COMPREPLY[@]/#/-F}" )
+ cur=-F$cur # Restore cur
+ elif [[ "$cur" == -* ]]; then
+ 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 \
+ -i -L -l -m -O -o -p -R -S -w' -- "$cur" ) )
+ else
+ # Search COMP_WORDS for '-F configfile' or '-Fconfigfile' argument
+ set -- "${COMP_WORDS[@]}"
+ while [ $# -gt 0 ]; do
+ if [ "${1:0:2}" = -F ]; then
+ if [ ${#1} -gt 2 ]; then
+ configfile="$(dequote "${1:2}")"
+ else
+ shift
+ [ "$1" ] && configfile="$(dequote "$1")"
+ fi
+ break
+ fi
+ shift
+ done
+ _known_hosts_real -a -F "$configfile" "$cur"
+ if [ $COMP_CWORD -ne 1 ]; then
+ COMPREPLY=( "${COMPREPLY[@]}" $( compgen -c -- "$cur" ) )
+ fi
+ fi
- return 0
+ return 0
}
shopt -u hostcomplete && complete -F _ssh ssh slogin autossh
@@ -110,51 +110,51 @@ shopt -u hostcomplete && complete -F _ssh ssh slogin autossh
#
_sftp()
{
- local cur prev configfile
+ local cur prev configfile
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
- case "$prev" in
- -@(b|F|P))
- _filedir
- return 0
- ;;
- -o)
- _ssh_options
- return 0
- ;;
- esac
+ case "$prev" in
+ -@(b|F|P))
+ _filedir
+ return 0
+ ;;
+ -o)
+ _ssh_options
+ return 0
+ ;;
+ esac
- if [[ "$cur" == -F* ]]; then
- cur=${cur#-F}
- _filedir
- # Prefix completions with '-F'
- COMPREPLY=( "${COMPREPLY[@]/#/-F}" )
- cur=-F$cur # Restore cur
- elif [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-1 -C -v -B -b -F -o -P -R -S -s' \
- -- "$cur" ) )
- else
- # Search COMP_WORDS for '-F configfile' argument
- set -- "${COMP_WORDS[@]}"
- while [ $# -gt 0 ]; do
- if [ "${1:0:2}" = -F ]; then
- if [ ${#1} -gt 2 ]; then
- configfile="$(dequote "${1:2}")"
- else
- shift
- [ "$1" ] && configfile="$(dequote "$1")"
- fi
- break
- fi
- shift
- done
- _known_hosts_real -a -F "$configfile" "$cur"
- fi
+ if [[ "$cur" == -F* ]]; then
+ cur=${cur#-F}
+ _filedir
+ # Prefix completions with '-F'
+ COMPREPLY=( "${COMPREPLY[@]/#/-F}" )
+ cur=-F$cur # Restore cur
+ elif [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-1 -C -v -B -b -F -o -P -R -S -s' \
+ -- "$cur" ) )
+ else
+ # Search COMP_WORDS for '-F configfile' argument
+ set -- "${COMP_WORDS[@]}"
+ while [ $# -gt 0 ]; do
+ if [ "${1:0:2}" = -F ]; then
+ if [ ${#1} -gt 2 ]; then
+ configfile="$(dequote "${1:2}")"
+ else
+ shift
+ [ "$1" ] && configfile="$(dequote "$1")"
+ fi
+ break
+ fi
+ shift
+ done
+ _known_hosts_real -a -F "$configfile" "$cur"
+ fi
- return 0
+ return 0
}
shopt -u hostcomplete && complete -F _sftp sftp
@@ -163,89 +163,90 @@ shopt -u hostcomplete && complete -F _sftp sftp
#
_scp()
{
- local configfile cur userhost path prefix
+ local configfile cur userhost path prefix
- COMPREPLY=()
- cur=`_get_cword ":"`
+ COMPREPLY=()
+ cur=`_get_cword ":"`
- _expand || return 0
+ _expand || return 0
- if [[ "$cur" == *:* ]]; then
- local IFS=$'\t\n'
- # remove backslash escape from :
- cur=${cur/\\:/:}
- userhost=${cur%%?(\\):*}
- path=${cur#*:}
- # unescape spaces
- path=${path//\\\\\\\\ / }
- if [ -z "$path" ]; then
- # default to home dir of specified user on remote host
- path=$(ssh -o 'Batchmode yes' $userhost pwd 2>/dev/null)
- fi
- # escape spaces; remove executables, aliases, pipes and sockets;
- # add space at end of file names
- COMPREPLY=( $( ssh -o 'Batchmode yes' $userhost \
+ if [[ "$cur" == *:* ]]; then
+ local IFS=$'\t\n'
+ # remove backslash escape from :
+ cur=${cur/\\:/:}
+ userhost=${cur%%?(\\):*}
+ path=${cur#*:}
+ # unescape spaces
+ path=${path//\\\\\\\\ / }
+ if [ -z "$path" ]; then
+ # default to home dir of specified user on remote host
+ path=$(ssh -o 'Batchmode yes' $userhost pwd 2>/dev/null)
+ fi
+ # escape spaces; remove executables, aliases, pipes and sockets;
+ # add space at end of file names
+ COMPREPLY=( $( ssh -o 'Batchmode yes' $userhost \
command ls -aF1d "$path*" 2>/dev/null | \
sed -e "s/[][(){}<>\",:;^&\!$=?\`|\\ ']/\\\\\\\\\\\\&/g" \
-e 's/[*@|=]$//g' -e 's/[^\/]$/& /g' ) )
- return 0
- fi
+ return 0
+ fi
- if [[ "$cur" = -F* ]]; then
- cur=${cur#-F}
- prefix=-F
- else
- # Search COMP_WORDS for '-F configfile' or '-Fconfigfile' argument
- set -- "${COMP_WORDS[@]}"
- while [ $# -gt 0 ]; do
- if [ "${1:0:2}" = -F ]; then
- if [ ${#1} -gt 2 ]; then
- configfile="$(dequote "${1:2}")"
- else
- shift
- [ "$1" ] && configfile="$(dequote "$1")"
- fi
- break
- fi
- shift
- done
+ if [[ "$cur" = -F* ]]; then
+ cur=${cur#-F}
+ prefix=-F
+ else
+ # Search COMP_WORDS for '-F configfile' or '-Fconfigfile' argument
+ set -- "${COMP_WORDS[@]}"
+ while [ $# -gt 0 ]; do
+ if [ "${1:0:2}" = -F ]; then
+ if [ ${#1} -gt 2 ]; then
+ configfile="$(dequote "${1:2}")"
+ else
+ shift
+ [ "$1" ] && configfile="$(dequote "$1")"
+ fi
+ break
+ fi
+ shift
+ done
- [[ "$cur" == */* ]] || _known_hosts_real -c -a -F "$configfile" "$cur"
- fi
- # This approach is used instead of _filedir to get a space appended
- # after local file/dir completions, and $nospace retained for others.
- local IFS=$'\t\n'
- COMPREPLY=( "${COMPREPLY[@]}" $( command ls -aF1d $cur* 2>/dev/null | sed \
+ [[ "$cur" == */* ]] || _known_hosts_real -c -a -F "$configfile" "$cur"
+ fi
+ # This approach is used instead of _filedir to get a space appended
+ # after local file/dir completions, and $nospace retained for others.
+ local IFS=$'\t\n'
+ COMPREPLY=( "${COMPREPLY[@]}" $( command ls -aF1d $cur* 2>/dev/null | sed \
-e "s/[][(){}<>\",:;^&\!$=?\`|\\ ']/\\\\&/g" \
-e 's/[*@|=]$//g' -e 's/[^\/]$/& /g' -e "s/^/$prefix/") )
- return 0
+ return 0
}
complete -F _scp $nospace scp sshfs
# ssh-copy-id(1) completion
#
-_ssh_copy_id() {
- local cur prev
+_ssh_copy_id()
+{
+ local cur prev
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
- case "$prev" in
- -i)
- _filedir
- return 0
- ;;
- esac
+ case "$prev" in
+ -i)
+ _filedir
+ return 0
+ ;;
+ esac
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-i' -- "$cur" ) )
- else
- _known_hosts_real -a "$cur"
- fi
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-i' -- "$cur" ) )
+ else
+ _known_hosts_real -a "$cur"
+ fi
- return 0
+ return 0
}
complete -F _ssh_copy_id $filenames ssh-copy-id
}
--
bash-completion
More information about the Bash-completion-commits
mailing list