In answer to the question by "alfish"
I think the ultimate answer to this "old" question is to use PHP to control stdin.
function ask_user_name() {
print("Please input your name: ");
$handle = fopen ("php://stdin","r");
$line = fgets($handle);
drush_print("Your name is $line");
}
Basically there was no need to establish an interface mechanism in drush since it already exists in php... but Drush does provide four commands anyway.
- drush_choice
- drush_choice_multiple
- drush_confirm
- drush_prompt
So in using drush_prompt you would do something like this.
function ask_user_name() {
$result = drush_prompt("Please input your name",NULL,TRUE);
drush_print("Your name is $result");
}
I hope this helps.