_*: Install our deprecated completions too, try loading them secondarily

This commit is contained in:
Ville Skyttä 2014-02-08 15:33:10 +02:00
parent e4b17402bb
commit e201d1be7e
6 changed files with 163 additions and 147 deletions

View File

@ -1944,12 +1944,14 @@ complete -F _minimal ''
# set up dynamic completion loading # set up dynamic completion loading
_completion_loader() _completion_loader()
{ {
local compfile=./completions local compdir=./completions compfile
[[ $BASH_SOURCE == */* ]] && compfile="${BASH_SOURCE%/*}/completions" [[ $BASH_SOURCE == */* ]] && compdir="${BASH_SOURCE%/*}/completions"
compfile+="/${1##*/}"
for compfile in "${1##*/}" _"${1##*/}"; do
compfile="$compdir/$compfile"
# Avoid trying to source dirs; https://bugzilla.redhat.com/903540 # Avoid trying to source dirs; https://bugzilla.redhat.com/903540
[[ -f "$compfile" ]] && . "$compfile" &>/dev/null && return 124 [[ -f "$compfile" ]] && . "$compfile" &>/dev/null && return 124
done
# Need to define *something*, otherwise there will be no completion at all. # Need to define *something*, otherwise there will be no completion at all.
complete -F _minimal "$1" && return 124 complete -F _minimal "$1" && return 124

View File

@ -130,6 +130,7 @@ bashcomp_DATA = 2to3 \
hping2 \ hping2 \
htop \ htop \
htpasswd \ htpasswd \
_hwclock \
iconv \ iconv \
id \ id \
idn \ idn \
@ -141,6 +142,7 @@ bashcomp_DATA = 2to3 \
installpkg \ installpkg \
interdiff \ interdiff \
invoke-rc.d \ invoke-rc.d \
_ionice \
ip \ ip \
iperf \ iperf \
ipmitool \ ipmitool \
@ -210,8 +212,10 @@ bashcomp_DATA = 2to3 \
mkinitrd \ mkinitrd \
mktemp \ mktemp \
mmsitepass \ mmsitepass \
_mock \
modinfo \ modinfo \
modprobe \ modprobe \
_modules \
monodevelop \ monodevelop \
mount \ mount \
mount.linux \ mount.linux \
@ -234,6 +238,7 @@ bashcomp_DATA = 2to3 \
newusers \ newusers \
ngrep \ ngrep \
nmap \ nmap \
_nmcli \
nslookup \ nslookup \
ntpdate \ ntpdate \
openssl \ openssl \
@ -289,6 +294,7 @@ bashcomp_DATA = 2to3 \
remove_members \ remove_members \
removepkg \ removepkg \
renice \ renice \
_repomanage \
reportbug \ reportbug \
reptyr \ reptyr \
resolvconf \ resolvconf \
@ -303,6 +309,7 @@ bashcomp_DATA = 2to3 \
rpmcheck \ rpmcheck \
rrdtool \ rrdtool \
rsync \ rsync \
_rtcwake \
sbcl \ sbcl \
sbopkg \ sbopkg \
screen \ screen \
@ -329,6 +336,9 @@ bashcomp_DATA = 2to3 \
sudo \ sudo \
svcadm \ svcadm \
svk \ svk \
_svn \
_svnadmin \
_svnlook \
sync_members \ sync_members \
sysbench \ sysbench \
sysctl \ sysctl \
@ -340,6 +350,7 @@ bashcomp_DATA = 2to3 \
tracepath \ tracepath \
tshark \ tshark \
tune2fs \ tune2fs \
_udevadm \
umount \ umount \
umount.linux \ umount.linux \
unace \ unace \
@ -383,20 +394,11 @@ bashcomp_DATA = 2to3 \
xz \ xz \
xzdec \ xzdec \
ypmatch \ ypmatch \
_yum \
yum-arch \ yum-arch \
zopfli zopfli
EXTRA_DIST = $(bashcomp_DATA) \ EXTRA_DIST = $(bashcomp_DATA)
_hwclock \
_ionice \
_mock \
_modules \
_nmcli \
_rtcwake \
_subversion \
_udevadm \
_yum \
_yum-utils
CLEANFILES = \ CLEANFILES = \
7za \ 7za \

View File

@ -210,135 +210,4 @@ _svn()
} && } &&
complete -F _svn svn complete -F _svn svn
_svnadmin()
{
local cur prev words cword
_init_completion || return
local commands
commands='create deltify dump help ? hotcopy list-dblogs list-unused-dblogs
load lslocks lstxns recover rmlocks rmtxns setlog verify'
if [[ $cword -eq 1 ]] ; then
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--version' -- "$cur" ) )
else
COMPREPLY=( $( compgen -W "$commands" -- "$cur" ) )
fi
else
case $prev in
--config-dir)
_filedir -d
return 0
;;
--fs-type)
COMPREPLY=( $( compgen -W 'fsfs bdb' -- "$cur" ) )
return 0
;;
esac
local command=${words[1]}
if [[ "$cur" == -* ]]; then
# possible options for the command
local options
case $command in
create)
options='--bdb-txn-nosync --bdb-log-keep --config-dir
--fs-type'
;;
deltify)
options='--revision --quiet'
;;
dump)
options='--revision --incremental --quiet --deltas'
;;
hotcopy)
options='--clean-logs'
;;
load)
options='--ignore-uuid --force-uuid --parent-dir --quiet
--use-pre-commit-hook --use-post-commit-hook'
;;
rmtxns)
options='--quiet'
;;
setlog)
options='--revision --bypass-hooks'
;;
esac
options+=" --help"
COMPREPLY=( $( compgen -W "$options" -- "$cur" ) )
else
if [[ "$command" == @(help|[h?]) ]]; then
COMPREPLY=( $( compgen -W "$commands" -- "$cur" ) )
else
_filedir
fi
fi
fi
return 0
} &&
complete -F _svnadmin -o default svnadmin
_svnlook()
{
local cur prev words cword
_init_completion || return
local commands
commands='author cat changed date diff dirs-changed help ? h history info
lock log propget pget pg proplist plist pl tree uuid youngest'
if [[ $cword -eq 1 ]] ; then
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--version' -- "$cur" ) )
else
COMPREPLY=( $( compgen -W "$commands" -- "$cur" ) )
fi
else
local command=${words[1]}
if [[ "$cur" == -* ]]; then
# possible options for the command
local options
case $command in
author|cat|date|dirs-changed|info|log)
options='--revision --transaction'
;;
changed)
options='--revision --transaction --copy-info'
;;
diff)
options='--revision --transaction --no-diff-deleted
--no-diff-added --diff-copy-from'
;;
history)
options='--revision --show-ids'
;;
propget|proplist)
options='--revision --transaction --revprop'
;;
tree)
options='--revision --transaction --show-ids --full-paths'
;;
esac
options+=" --help"
COMPREPLY=( $( compgen -W "$options" -- "$cur" ) )
else
if [[ "$command" == @(help|[h?]) ]]; then
COMPREPLY=( $( compgen -W "$commands" -- "$cur" ) )
else
_filedir
fi
fi
fi
return 0
} &&
complete -F _svnlook -o default svnlook
# ex: ts=4 sw=4 et filetype=sh # ex: ts=4 sw=4 et filetype=sh

79
completions/_svnadmin Normal file
View File

@ -0,0 +1,79 @@
# svnadmin completion -*- shell-script -*-
# Use of this file is deprecated. Upstream completion is available in
# subversion >= 0.12.0, use that instead.
_svnadmin()
{
local cur prev words cword
_init_completion || return
local commands
commands='create deltify dump help ? hotcopy list-dblogs list-unused-dblogs
load lslocks lstxns recover rmlocks rmtxns setlog verify'
if [[ $cword -eq 1 ]] ; then
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--version' -- "$cur" ) )
else
COMPREPLY=( $( compgen -W "$commands" -- "$cur" ) )
fi
else
case $prev in
--config-dir)
_filedir -d
return 0
;;
--fs-type)
COMPREPLY=( $( compgen -W 'fsfs bdb' -- "$cur" ) )
return 0
;;
esac
local command=${words[1]}
if [[ "$cur" == -* ]]; then
# possible options for the command
local options
case $command in
create)
options='--bdb-txn-nosync --bdb-log-keep --config-dir
--fs-type'
;;
deltify)
options='--revision --quiet'
;;
dump)
options='--revision --incremental --quiet --deltas'
;;
hotcopy)
options='--clean-logs'
;;
load)
options='--ignore-uuid --force-uuid --parent-dir --quiet
--use-pre-commit-hook --use-post-commit-hook'
;;
rmtxns)
options='--quiet'
;;
setlog)
options='--revision --bypass-hooks'
;;
esac
options+=" --help"
COMPREPLY=( $( compgen -W "$options" -- "$cur" ) )
else
if [[ "$command" == @(help|[h?]) ]]; then
COMPREPLY=( $( compgen -W "$commands" -- "$cur" ) )
else
_filedir
fi
fi
fi
return 0
} &&
complete -F _svnadmin -o default svnadmin
# ex: ts=4 sw=4 et filetype=sh

64
completions/_svnlook Normal file
View File

@ -0,0 +1,64 @@
# svnlook completion -*- shell-script -*-
# Use of this file is deprecated. Upstream completion is available in
# subversion >= 0.12.0, use that instead.
_svnlook()
{
local cur prev words cword
_init_completion || return
local commands
commands='author cat changed date diff dirs-changed help ? h history info
lock log propget pget pg proplist plist pl tree uuid youngest'
if [[ $cword -eq 1 ]] ; then
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--version' -- "$cur" ) )
else
COMPREPLY=( $( compgen -W "$commands" -- "$cur" ) )
fi
else
local command=${words[1]}
if [[ "$cur" == -* ]]; then
# possible options for the command
local options
case $command in
author|cat|date|dirs-changed|info|log)
options='--revision --transaction'
;;
changed)
options='--revision --transaction --copy-info'
;;
diff)
options='--revision --transaction --no-diff-deleted
--no-diff-added --diff-copy-from'
;;
history)
options='--revision --show-ids'
;;
propget|proplist)
options='--revision --transaction --revprop'
;;
tree)
options='--revision --transaction --show-ids --full-paths'
;;
esac
options+=" --help"
COMPREPLY=( $( compgen -W "$options" -- "$cur" ) )
else
if [[ "$command" == @(help|[h?]) ]]; then
COMPREPLY=( $( compgen -W "$commands" -- "$cur" ) )
else
_filedir
fi
fi
fi
return 0
} &&
complete -F _svnlook -o default svnlook
# ex: ts=4 sw=4 et filetype=sh