summaryrefslogtreecommitdiff
path: root/plugins/ant/_ant
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/ant/_ant')
-rw-r--r--plugins/ant/_ant22
1 files changed, 22 insertions, 0 deletions
diff --git a/plugins/ant/_ant b/plugins/ant/_ant
new file mode 100644
index 000000000..24a8e3667
--- /dev/null
+++ b/plugins/ant/_ant
@@ -0,0 +1,22 @@
+#compdef ant
+
+_ant_does_target_list_need_generating () {
+ [[ ! -f .ant_targets ]] && return 0
+ [[ build.xml -nt .ant_targets ]] && return 0
+ return 1
+}
+
+_ant () {
+ if [[ ! -f build.xml ]]; then
+ return
+ fi
+
+ if ! _ant_does_target_list_need_generating; then
+ return
+ fi
+
+ ant -p | awk -F " " 'NR > 5 { print lastTarget } { lastTarget = $1 }' >| .ant_targets
+ compadd -- "$(cat .ant_targets)"
+}
+
+_ant "$@"