I am using a script now, but I would like to hear if there is a ready-made method. Thanks a lot to sundar for the ForegroundColor trick.
I'm not sure if using Project.Log or going directly to Console.WriteLine () matters, do any NAnt ninjas want to train me?
Here is the script and the target using it:
<target name="input"> <script language="C#" prefix="password" > <code><![CDATA[ [Function("ask")] public string AskPassword(string prompt) { Project.Log(Level.Info, prompt); ConsoleColor oldColor = Console.ForegroundColor; Console.ForegroundColor = Console.BackgroundColor; try { return Console.ReadLine(); } finally { Console.ForegroundColor = oldColor; } } ]]></code> </script> <echo message="Password is ${password::ask('What is the password?')}"/> </target>
Don kirkby
source share