Split ant completion to contrib/ant.
This commit is contained in:
parent
a7237df1a5
commit
d8d5445edb
1
CHANGES
1
CHANGES
@ -45,6 +45,7 @@ bash-completion (1.x)
|
||||
* Add make --old/new-file, --assume-old/new, --what-if value completions.
|
||||
* Add smartctl -n/--nocheck completion, add more other value completions.
|
||||
* Fix leaking $prev from mkinitrd completion.
|
||||
* Split ant completion to contrib/ant.
|
||||
|
||||
[ Todd Zullinger ]
|
||||
* Make yum complete on filenames after install, deplist, update and upgrade
|
||||
|
@ -2,7 +2,8 @@
|
||||
sysconf_DATA = bash_completion
|
||||
|
||||
bashcompdir = $(sysconfdir)/bash_completion.d
|
||||
bashcomp_DATA = contrib/apache2ctl \
|
||||
bashcomp_DATA = contrib/ant \
|
||||
contrib/apache2ctl \
|
||||
contrib/bitkeeper \
|
||||
contrib/bittorrent \
|
||||
contrib/brctl \
|
||||
|
@ -3409,59 +3409,6 @@ _root_command()
|
||||
}
|
||||
complete -F _root_command $filenames sudo fakeroot really gksudo gksu kdesudo
|
||||
|
||||
# ant(1) completion
|
||||
#
|
||||
have ant && {
|
||||
_ant()
|
||||
{
|
||||
local cur prev buildfile i
|
||||
|
||||
COMPREPLY=()
|
||||
cur=`_get_cword`
|
||||
prev=${COMP_WORDS[COMP_CWORD-1]}
|
||||
|
||||
case "$prev" in
|
||||
-buildfile|-f)
|
||||
_filedir 'xml'
|
||||
return 0
|
||||
;;
|
||||
-logfile)
|
||||
_filedir
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
|
||||
if [[ "$cur" == -* ]]; then
|
||||
# relevant options completion
|
||||
COMPREPLY=( $( compgen -W '-help -projecthelp -version -quiet \
|
||||
-verbose -debug -emacs -logfile -logger \
|
||||
-listener -buildfile -f -D -find' -- $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]}" == -buildfile ]]; then
|
||||
buildfile=${COMP_WORDS[i+1]}
|
||||
break
|
||||
fi
|
||||
done
|
||||
[ ! -f $buildfile ] && return 0
|
||||
|
||||
# parse buildfile for targets
|
||||
COMPREPLY=( $( awk -F'"' '/<target name="/ {print $2}' \
|
||||
$buildfile | grep "^$cur" )
|
||||
$( awk -F"'" "/<target name='/ "'{print $2}' \
|
||||
$buildfile | grep "^$cur" )
|
||||
$( awk -F'"' '/<target [^n]/ {if ($1 ~ /name=/) { print $2 } else if ($3 ~ /name=/) {print $4} else if ($5 ~ /name=/) {print $6}}' \
|
||||
$buildfile | grep "^$cur" ) )
|
||||
fi
|
||||
}
|
||||
have complete-ant-cmd.pl && \
|
||||
complete -C complete-ant-cmd.pl -F _ant $filenames ant || \
|
||||
complete -F _ant $filenames ant
|
||||
}
|
||||
|
||||
have nslookup &&
|
||||
_nslookup()
|
||||
{
|
||||
|
55
contrib/ant
Normal file
55
contrib/ant
Normal file
@ -0,0 +1,55 @@
|
||||
# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
|
||||
# ex: ts=8 sw=8 noet filetype=sh
|
||||
#
|
||||
# bash completion for ant
|
||||
|
||||
have ant && {
|
||||
_ant()
|
||||
{
|
||||
local cur prev buildfile i
|
||||
|
||||
COMPREPLY=()
|
||||
cur=`_get_cword`
|
||||
prev=${COMP_WORDS[COMP_CWORD-1]}
|
||||
|
||||
case "$prev" in
|
||||
-buildfile|-f)
|
||||
_filedir 'xml'
|
||||
return 0
|
||||
;;
|
||||
-logfile)
|
||||
_filedir
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
|
||||
if [[ "$cur" == -* ]]; then
|
||||
# relevant options completion
|
||||
COMPREPLY=( $( compgen -W '-help -projecthelp -version -quiet \
|
||||
-verbose -debug -emacs -logfile -logger \
|
||||
-listener -buildfile -f -D -find' -- $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]}" == -buildfile ]]; then
|
||||
buildfile=${COMP_WORDS[i+1]}
|
||||
break
|
||||
fi
|
||||
done
|
||||
[ ! -f $buildfile ] && return 0
|
||||
|
||||
# parse buildfile for targets
|
||||
COMPREPLY=( $( awk -F'"' '/<target name="/ {print $2}' \
|
||||
$buildfile | grep "^$cur" )
|
||||
$( awk -F"'" "/<target name='/ "'{print $2}' \
|
||||
$buildfile | grep "^$cur" )
|
||||
$( awk -F'"' '/<target [^n]/ {if ($1 ~ /name=/) { print $2 } else if ($3 ~ /name=/) {print $4} else if ($5 ~ /name=/) {print $6}}' \
|
||||
$buildfile | grep "^$cur" ) )
|
||||
fi
|
||||
}
|
||||
have complete-ant-cmd.pl && \
|
||||
complete -C complete-ant-cmd.pl -F _ant $filenames ant || \
|
||||
complete -F _ant $filenames ant
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user