Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: ant 1.6.2 completion update
- X-seq: zsh-workers 20625
- From: Doug Kearns <dougkearns@xxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: PATCH: ant 1.6.2 completion update
- Date: Mon, 13 Dec 2004 22:25:21 +1100
- Mail-followup-to: zsh-workers@xxxxxxxxxx
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
Here's an update of ant completion for version 1.6.2
Regards,
Doug
Index: Completion/Unix/Command/_ant
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_ant,v
retrieving revision 1.8
diff -u -r1.8 _ant
--- Completion/Unix/Command/_ant 24 Aug 2004 20:52:23 -0000 1.8
+++ Completion/Unix/Command/_ant 13 Dec 2004 11:14:38 -0000
@@ -1,10 +1,10 @@
#compdef ant -value-,ANT_ARGS,-default-
-typeset -A opt_args
-local buildfile tmp state line curcontext="$curcontext" ret=1
-local c target='*:target:->target'
+# Apache Ant version 1.6.2
-c=( $ANT_HOME/lib/*.jar )
+typeset -A opt_args
+local curcontext="$curcontext" state line ret=1
+local buildfile cp tmp target='*:target:->target'
if [[ $service = *ANT_ARGS* ]]; then
compset -q
@@ -14,25 +14,41 @@
fi
_arguments -C \
- '-help[display usage information]' \
- '-projecthelp[print project help information]' \
- '-version[display version information]' \
+ '(- *)'{-h,-help}'[display usage information]' \
+ '(-p -projecthelp *)'{-p,-projecthelp}'[print project help information]' \
+ '(- *)-version[display version information]' \
'-diagnostics[display info useful to problem diagnosis]' \
'(-q -quiet)'{-q,-quiet}'[be extra quiet]' \
- '(-v -verbose)'{-v,-verbose}'[be more verbose]' \
- '-debug[print debugging information]' \
- '-emacs[produce logging information without adornments]' \
+ '(-v -verbose)'{-v,-verbose}'[be extra verbose]' \
+ '(-d -debug)'{-d,-debug}'[print debugging information]' \
+ '(-e -emacs)'{-e,-emacs}'[produce logging information without adornments]' \
+ '-lib[specify a path to search for jars and classes]:class path:->classpath' \
'(-l -logfile)'{-l,-logfile}'[use specified file for log]:logfile:_files' \
- '-logger[the class which is to perform logging]:classname:_java_class -cp ${(j.:.)c}' \
- '*-listener[add an instance of class as a project listener]:classname:_java_class -cp ${(j.:.)c}' \
+ '-logger[the class which is to perform logging]:class:->class' \
+ '*-listener[add an instance of class as a project listener]:class:->class' \
+ '-noinput[do not allow interactive input]' \
'(-f -file -buildfile -find)'{-f,-file,-buildfile}'[use specified build file]:build file:_files' \
'*-D[specify property with value to use]:property:->property' \
+ '(-k -keep-going)'{-keep-going,-k}'[execute all targets that do not depend on failed target(s)]' \
'-propertyfile[load properties from specified file]:property file:_files' \
- '-inputhandler[specify class which will handle input requests]:class:_java_class -cp ${(j.\:.)c}' \
- '(-f -file -buildfile)-find[search for build file towards the root of filesystem]:build file:(build.xml)' \
+ '-inputhandler[specify class which will handle input requests]:class:->class' \
+ '(-s -find -f -file -buildfile)'{-s,-find}'[search for build file towards the root of filesystem]:build file:(build.xml)' \
+ '-nice[specify a niceness value for the main thread]:niceness value (default 5):({1..10})' \
$target && ret=0
case $state in
+ class)
+ cp=( $ANT_HOME/lib/*.jar )
+ cp=${(j.:.)cp}
+ _java_class -classpath ${opt_args[-lib]:-${cp:-.}}
+ ;;
+ classpath)
+ compset -P '*:'
+ compset -S ':*'
+ _alternative \
+ "classpath:$state:_path_files -qS: -g '*.(jar|zip)(-.)'" \
+ "classpath:$state:_path_files -r': ' -/" && return
+ ;;
property)
if compset -P '*='; then
_default
@@ -48,8 +64,8 @@
# set statement needs to be eval'd. On Cygwin, need to kill \r's output
# from Java or parsing will fail.
eval set -A tmp "${$(_call_program targets "$words[1]" $buildxml -projecthelp |
- while read target desc
- do
+ while read target desc
+ do
# This loop reads ant -projecthelp output from versions 1.3 to 1.5
ln="${target}${desc:+:$desc}"
[[ $target = "" ]] && continue # skip blank lines
@@ -69,27 +85,27 @@
print -n "'${default_target}:(Default target) ' "
;;
(Searching:*|Main:targets:|Subtargets:|BUILD:SUCCESSFUL|Total:time:
- *)
+ *)
;;
(*)
# Return target and description
print -n "'$ln' "
;;
esac
- done
+ done
)//$'\015'}"
_describe 'target' tmp && ret=0
else
if [[ -n $opt_args[-find] ]]; then
- buildfile=( (../)#${opt_args[-find]:-build.xml}(N[-1]) )
+ buildfile=( (../)#${opt_args[-find]:-build.xml}(N[-1]) )
else
- buildfile=${(v)opt_args[(I)(-f|-file|-buildfile)]:-build.xml}
+ buildfile=${(v)opt_args[(I)(-f|-file|-buildfile)]:-build.xml}
fi
if [[ -f $buildfile ]]; then
- targets=( $(sed -n "s/ *<target[^>]* name=[\"']\([^\"']*\)[\"'].*/\1/p" < $buildfile) )
- _wanted targets expl target compadd -a targets && ret=0
+ targets=( ${${${(M)${(f)"$(<$buildfile)"}:#*<target[[:blank:]]*name=*}#*name=[\"\']}%%[\"\']*} )
+ _wanted targets expl target compadd -a targets && ret=0
else
- _message -e targets target
+ _message -e targets target
fi
fi
;;
Messages sorted by:
Reverse Date,
Date,
Thread,
Author