A list of assigned goals is available in the property.
ant.project.invoked-targets
If the default target is set, then this will be the called target. If one or more targets are specified on the command line, they are displayed separated by commas in the property. Note that the property is only set after execution moves to the target β if you try to read the property outside of any target, it will be canceled.
So, if the project has a default goal of "zero":
$ ant one two
and
$ ant
source share