-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Hi.
Thank you for NConsoler 2.0.
I am using Windows 7 Ultimate x64 SP1.
I'd like to request the ability to specify a required parameter to the target
function that should be entered on the command line so that the input is hidden.
This is specifically and especially useful when entering in a password on the
command line.
For example,
[Action]
public static void DoWork(
[Required(Description="username")]
string username,
[Required(Description="password", Secret=true, Prompt="Enter password",
Masked=false)]
string password)
{
//implementation
}
And then on the console, the prompt for the password would appear as follows,
where the entered password is not displayed:
>CommandLine.exe rami
Enter password:
Notice that an additional feature (but lower priority IMHO) would be to
actually mask the input. I explicitly set this to false because I don't want
others to know how many characters my password is, for example. I'm not
exactly sure if it would be useful for other things though. Maybe the Prompt
attribute parameter could be optional, so that it will display "Enter password"
if the Description parameter is specified as "password" for example. But it is
there to support entering in multiple passwords on the command line for example.
If users want to actually specify the password in an unattended scenario, I
would also imagine the ability to pass the password to the command line
application. In my experience, I've been able to pipe a password to a command
line application before, but haven't tried piping multiple parameters for
example. In this case, it may be best to support hidden inputs by explicitly
using the OptionalAttribute with an optional "Required=true" attribute
parameter for example, instead of the RequiredAttribute, or support both
scenarios, but that may be a little too complex, and so may be left for a
future version.
Thank you very much.
Original issue reported on code.google.com by rami.abughazaleh@gmail.com on 10 Jul 2012 at 1:15