|
|
@ -128,13 +128,13 @@ class Controller extends \yii\base\Controller |
|
|
|
* |
|
|
|
* |
|
|
|
* Example: |
|
|
|
* Example: |
|
|
|
* ~~~ |
|
|
|
* ~~~ |
|
|
|
* $this->formatString('This will be red and underlined.', Console::FG_RED, Console::UNDERLINE); |
|
|
|
* $this->ansiFormat('This will be red and underlined.', Console::FG_RED, Console::UNDERLINE); |
|
|
|
* ~~~ |
|
|
|
* ~~~ |
|
|
|
* |
|
|
|
* |
|
|
|
* @param string $string the string to be formatted |
|
|
|
* @param string $string the string to be formatted |
|
|
|
* @return string |
|
|
|
* @return string |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public function formatString($string) |
|
|
|
public function ansiFormat($string) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if ($this->ansi === true || $this->ansi === null && Console::streamSupportsAnsiColors(STDOUT)) { |
|
|
|
if ($this->ansi === true || $this->ansi === null && Console::streamSupportsAnsiColors(STDOUT)) { |
|
|
|
$args = func_get_args(); |
|
|
|
$args = func_get_args(); |
|
|
@ -202,9 +202,9 @@ class Controller extends \yii\base\Controller |
|
|
|
public function input($prompt = null) |
|
|
|
public function input($prompt = null) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (isset($prompt)) { |
|
|
|
if (isset($prompt)) { |
|
|
|
static::stdout($prompt); |
|
|
|
$this->stdout($prompt); |
|
|
|
} |
|
|
|
} |
|
|
|
return static::stdin(); |
|
|
|
return Console::stdin(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -217,7 +217,7 @@ class Controller extends \yii\base\Controller |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public function output($text = null) |
|
|
|
public function output($text = null) |
|
|
|
{ |
|
|
|
{ |
|
|
|
return static::stdout($text . PHP_EOL); |
|
|
|
return $this->stdout($text . PHP_EOL); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -230,7 +230,7 @@ class Controller extends \yii\base\Controller |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public function error($text = null) |
|
|
|
public function error($text = null) |
|
|
|
{ |
|
|
|
{ |
|
|
|
return static::stderr($text . PHP_EOL); |
|
|
|
return $this->stderr($text . PHP_EOL); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -276,7 +276,7 @@ class Controller extends \yii\base\Controller |
|
|
|
* |
|
|
|
* |
|
|
|
* @return string An option character the user chose |
|
|
|
* @return string An option character the user chose |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public static function select($prompt, $options = array()) |
|
|
|
public function select($prompt, $options = array()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
return Console::select($prompt, $options); |
|
|
|
return Console::select($prompt, $options); |
|
|
|
} |
|
|
|
} |
|
|
|