blob: 36e34e8c489bde99e93f0b316b2416512dadcd66 [file] [log] [blame]
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<title>Input Task</title>
<link rel="stylesheet" type="text/css" href="../stylesheets/antmanual.css">
</head>
<body>
<h2><a name="input">Input</a></h2>
<h3>Description</h3>
<p>Allows user interaction during the build process by prompting for
input. To do so, it uses the configured
<a href="../inputhandler.html">InputHandler</a>.</p>
<p>The prompt can be set via the message attribute or as character
data nested into the element.</p>
<p>Optinonally a set of valid imput arguments can be defined via the
validargs attribute. Input task will no accept value that don't match
one of the predefined.</p>
<p>Optionally a property can be created from the value entered by the
user. This property can then be used during the following build
run. Input behaves according to <a href="property.html">property
task</a> which means that existing properties cannot be overriden.
Since Ant 1.6, <code>&lt;input&gt;</code> will not prompt for input if
a property should be set by the task that has already been set in the
project (and the task wouldn't have any effect).</p>
<h3>Parameters</h3>
<table border="1" cellpadding="2" cellspacing="0">
<tr>
<td valign="top"><b>Attribute</b></td>
<td valign="top"><b>Description</b></td>
<td align="center" valign="top"><b>Required</b></td>
</tr>
<tr>
<td valign="top">message</td>
<td valign="top">the Message which gets displayed to the user
during the build run.</td>
<td valign="top" align="center">No</td>
</tr>
<tr>
<td valign="top">validargs</td>
<td valign="top">comma separated String containing valid input
arguments. If set, input task will reject any input not defined
here. Validargs are compared case sensitive. If you want 'a' and
'A' to be accepted you will need to define both arguments within
validargs.</td>
<td valign="top" align="center">No</td>
</tr>
<tr>
<td valign="top">addproperty</td>
<td valign="top">the name of a property to be created from
input. Behaviour is equal to <a href="property.html">property
task</a> which means that existing properties cannot be
overriden.</td>
<td valign="top" align="center">No</td>
</tr>
<tr>
<td valign="top">defaultvalue</td>
<td valign="top">Defines the default value of the property to be
created from input. Property value will be set to default if no
input is received.</td>
<td valign="top" align="center">No</td>
</tr>
</table>
<h3>Examples</h3>
<pre> &lt;input/&gt;</pre>
<p>Will pause the build run until return key is pressed when using the
<a href="../inputhandler.html#defaulthandler">default
InputHandler</a>, the concrete behavior is defined by the InputHandler
implementation you use.</p>
<pre> &lt;input&gt;Press Return key to continue...&lt;/input&gt;</pre>
<p>Will display the message &quot;Press Return key to
continue...&quot; and pause the build run until return key is pressed
(again, the concrete behavior is implementation dependent).</p>
<pre> &lt;input
message=&quot;Press Return key to continue...&quot;
/&gt;</pre>
<p>Will display the message &quot;Press Return key to
continue...&quot; and pause the build run until return key is pressed
(see above).</p>
<pre>
&lt;input
message=&quot;All data is going to be deleted from DB continue (y/n)?&quot;
validargs=&quot;y,n&quot;
addproperty=&quot;do.delete&quot;
/&gt;
&lt;condition property=&quot;do.abort&quot;&gt;
&lt;equals arg1=&quot;n&quot; arg2=&quot;${do.delete}&quot;/&gt;
&lt;/condition&gt;
&lt;fail if=&quot;do.abort&quot;&gt;Build aborted by user.&lt;/fail&gt;
</pre>
<p>Will display the message &quot;All data is going to be deleted from
DB continue (y/n)?&quot; and require 'y' to continue build or 'n' to
exit build with following message &quot;Build aborted by
user.&quot;.</p>
<pre> &lt;input
message=&quot;Please enter db-username:&quot;
addproperty=&quot;db.user&quot;
/&gt;</pre>
<p>Will display the message &quot;Please enter db-username:&quot; and set the
property <code>db.user</code> to the value entered by the user.</p>
<pre> &lt;input
message=&quot;Please enter db-username:&quot;
addproperty=&quot;db.user&quot;
defaultvalue=&quot;Scott-Tiger&quot;
/&gt;</pre>
<p>Same as above, but will set <code>db.user</code> to the value
<i>Scott- Tiger</i> if the user enters no value (simply types
&lt;return&gt;).</p>
<hr>
<p align="center">Copyright &copy; 2001-2003 Apache Software Foundation. All rights
Reserved.</p>
</body>
</html>