Calling all Drupal developers!
Help us get this on the first page of Digg. DIGG NOW!
Help us get this on the first page of Digg. DIGG NOW!
drush_confirm($msg, $indent = 0)
contributions/drush/drush.inc, line 173
Ask the user a basic yes/no question.
$msg The question to ask
TRUE if the user entered 'y', FALSE if he entered 'n'
<?php
function drush_confirm($msg, $indent = 0) {
print str_repeat(' ', $indent) . (string)$msg . " (y/n): ";
if (DRUSH_AFFIRMATIVE) {
print "y\n";
return TRUE;
}
while ($line = trim(fgets(STDIN))) {
if ($line == 'y') {
return TRUE;
}
if ($line == 'n') {
return FALSE;
}
print str_repeat(' ', $indent) . (string)$msg . " (y/n): ";
}
}
?>