Resending, forgot to add the list...
From: Craig Beck
Sent: Wednesday, April 16, 2008 2:54 PM
To: '[EMAIL PROTECTED]'
Subject: RE: [NAnt-users] Console input ...
Don't think there's anything that does this in NAnt, but writing this as
a custom task is really easy:
[TaskName("input")]
public class Input : Task
{
[TaskAttribute("prompt")]
public string Prompt { get; set; }
[TaskAttribute("property")]
public string Property { get; set; }
protected override void ExecuteTask()
{
Console.Write(Prompt + ": ");
Properties[Property] = Console.ReadLine();
Log(Level.Info, "user provided: {0}", Properties[Property]);
}
}
Script usage:
<target name="prompt">
<loadtasks assembly="CustomTasks.dll"/>
<input prompt="Enter something" property="foo"/>
</target>
Output:
C:\ >nant prompt
C:\ > NAnt.exe prompt
NAnt 0.85 (Build 0.85.2478.0; release; 10/14/2006)
Copyright (C) 2001-2006 Gerry Shaw
http://nant.sourceforge.net
Buildfile: file:///C:/test.build
Target framework: Microsoft .NET Framework 2.0
Target(s) specified: prompt
[loadtasks] Scanning assembly "CustomTasks" for extensions.
prompt:
Enter something: FooBar!!
[input] user provided: FooBar!!
BUILD SUCCEEDED
Works like a charm.
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Ken
Parrish
Sent: Wednesday, April 16, 2008 2:23 PM
To: nant-users@lists.sourceforge.net
Subject: [NAnt-users] Console input ...
Is there any way to capture a property via the command line in Nant? I
have some targets / tasks that are very sensitive (e.g. affect
production assets) and would like to either force a confirmation or
capture authentication information from the user of the script.
Thanks,
Ken Parrish
Gomez, Inc.
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
NAnt-users mailing list
NAnt-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users