Optional file parameter

Is it possible to set a command to use a certain parameter when a file is specified?

For example:

when ant runs it looks for either the build.xml file in the current directory, or uses the file speficied by the -f option.

In DOpus it's possible to get a file if selected using {o!}, but is it possible to exclude the -f if no file was found?

so that either:
ant -f mybuild.xml build
ant build

is run, depending on whether a file is selected?

If not, can this be added to the todo list, as quite a few tools work in this way.