1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,19 @@ |
0 |
+_ant_does_target_list_need_generating () { |
|
1 |
+ if [ ! -f .ant_targets ]; then return 0; |
|
2 |
+ else |
|
3 |
+ accurate=$(stat -f%m .ant_targets) |
|
4 |
+ changed=$(stat -f%m build.xml) |
|
5 |
+ return $(expr $accurate '>=' $changed) |
|
6 |
+ fi |
|
7 |
+} |
|
8 |
+ |
|
9 |
+_ant () { |
|
10 |
+ if [ -f build.xml ]; then |
|
11 |
+ if _ant_does_target_list_need_generating; then |
|
12 |
+ sed -n '/<target/s/<target.*name="\([^"]*\).*$/\1/p' build.xml > .ant_targets |
|
13 |
+ fi |
|
14 |
+ compadd `cat .ant_targets` |
|
15 |
+ fi |
|
16 |
+} |
|
17 |
+ |
|
18 |
+compdef _ant ant |