public static function confirm($message, $default = false)
{
while (true) {
static::stdout($message . ' (yes|no) [' . ($default ? 'yes' : 'no') . ']:');
$input = trim(static::stdin());
if (empty($input)) {
return $default;
}
if (!strcasecmp($input, 'y') || !strcasecmp($input, 'yes')) {
return true;
}
if (!strcasecmp($input, 'n') || !strcasecmp($input, 'no')) {
return false;
}
}
}