ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <bode...@apache.org>
Subject Prompt task
Date Thu, 30 Nov 2000 11:54:22 GMT
Hi,

I've been thinking about a prompt or ask like task, something like

<prompt alternatives="y,n" expect="y" default="y" property="abort">
JUnit not found. If you continue, you'll be unable to run tests.
Abort?</prompt>

which would produce

JUnit not found. If you continue, you'll be unable to run tests.
Abort? [Y/n]

and set the property abort to "true" if the user answered "y". 
One could set a property to the user input as well, this would be the
same as above without the expect attribute.

The biggest problem I see is how one would add a task like this if it
shouldn't read from System.in. If you are running Ant from within
Antidote for example I'd like to make Antidote pop up a dialog (or at
least provide an input stream to read from). 

This is a more general problem that needs to be addressed for other
tasks as well (reading passwords you don't want to leave in a file for
example).

My first idea would be to have a "DialogEngine" at the project
level. By default there was an engine that writes to System.out and
reads from System.in (logging system would not be appropriate as you
wouldn't want the prompt to end up in the log file instead the
console).

Each front end could provide an engine of its own, from my first
impression an interface like

public String askUser(String prompt, String[] alternatives, String default);

should suffice. 

Thoughts?

Stefan

Mime
View raw message