ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Wannheden, Knut" <knut.wannhe...@paranor.ch>
Subject RE: 'default' option for Input task
Date Fri, 28 Jun 2002 12:15:42 GMT
take a look at the patch which was just sent to ant-dev (subject: "[PATCH]
Input Task allows default values") by a user.  This patches the <input> task
to  allow a default value to be specified.  In your case:

<property environment="env"/>
<input message="What hostname should I use? [${env.HOSTNAME}]"
       defaultvalue="${env.HOSTNAME}" addproperty="input.hostname"/>

I guess it could even be taken a step further where the default value was
added by the task to the message.  Because in this case you supply the
default value as an attribute _and_ within the message.

Hopefully this patch will be accepted, which would make life much easier for
you ;-)

--
knut

> -----Original Message-----
> From: Ric Searle [mailto:ric@dialogue.co.uk]
> Sent: Freitag, 28. Juni 2002 14:06
> To: ant-user@jakarta.apache.org
> Subject: 'default' option for Input task
> 
> 
> Hi,
> 
> I'd like some help achieving what I believe should be a very 
> simple task 
> in Ant (1.5).
> 
> I want the build script to ask the user for a 'hostname' 
> parameter, and 
> I'd like the default answer to be whatever the system's HOSTNAME 
> environment variable is set to.  I think I'm nearly there 
> with the code 
> below, but the <equals> condition doesn't behave as I'd expect.  The 
> finalHostName property is never set to env.HOSTNAME.
> 
> 		
>          <property environment="env"/>
> 
>          <input message="What hostname should I use? 
> [${env.HOSTNAME}]" 
> addproperty="input.hostname"/>
>          <condition property="finalHostName" value="${env.HOSTNAME}">
>              <equals arg1="${input.hostname}" arg2="" trim="yes"/>
>          </condition>
> 
>          <!-- This will be ignored (hopefully) if a custom 
> hostname has 
> been entered -->
>          <property name="finalHostname" value="${input.hostname}"/>
> 
>          <echo message="Hostname is set to: ${finalHostname}"/>
> 
> Any help would be greatly appreciated.  I would like to see a 
> 'default' 
> option added to the Input task - does anyone else think that 
> this is a 
> sensible suggestion?
> 
> Regards,
> 
> 
>    Ric Searle
>    Web Application Developer
>    --
>    Dialogue Communications Ltd
> 
>    http://www.dialogue.co.uk
>    +44 (0) 114 221 0307
> 
> The Workstation, 15 Paternoster Row, Sheffield, S1 2BX, 
> United Kingdom.
> 
> Dialogue Communications (Estd. 1994) is a world leader in the 
> development
> and implementation of mobile data and internet messaging solutions.
> The company's technology bridges the gap between the fixed and mobile
> worlds - delivering carrier class platforms to both service 
> providers and
> enterprise customers around the globe.
> 
> 
> --
> To unsubscribe, e-mail:   
<mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message