Browse Source

better code for prompt

tags/2.0.0-beta
Alexander Makarov 13 years ago
parent
commit
434d31ddb4
  1. 6
      framework/console/Command.php

6
framework/console/Command.php

@ -325,15 +325,13 @@ abstract class Command extends \yii\base\Component
} else { } else {
echo $message; echo $message;
$input = fgets(STDIN); $input = fgets(STDIN);
if($input !== false) {
$input = trim($input);
}
} }
if($input === false) { if($input === false) {
return false; return false;
} }
else { else {
return empty($input) ? $default : $input; $input = trim($input);
return $input==='' ? $default : $input;
} }
} }

Loading…
Cancel
Save