Skip to content
This repository was archived by the owner on Jan 23, 2019. It is now read-only.

Commit 454feaf

Browse files
committed
console tool class update
1 parent 45c5f0f commit 454feaf

File tree

4 files changed

+293
-143
lines changed

4 files changed

+293
-143
lines changed

src/console/Color.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,16 +81,16 @@ public function __construct($fg = '', $bg = '', array $options = [])
8181
protected function addDefaultStyles()
8282
{
8383
$this->addStyle('default', [
84-
'fgColor' => 'default'
84+
'fgColor' => 'default', 'options' => ['underscore']
8585
])
8686
->addStyle('faintly', [ // 不明显的 浅灰色的
87-
'fgColor' => 'default'
87+
'fgColor' => 'default', 'options' => ['italic']
8888
])
8989
->addStyle('bold', [
9090
'options' => ['bold']
9191
])
9292
->addStyle('notice', [
93-
'options' => ['bold']
93+
'options' => ['bold'], 'options' => ['underscore']
9494
])
9595
->addStyle('primary', [
9696
'fgColor' => 'blue', //'options' => ['bold']

src/console/Input.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,15 @@ public function __construct($parseArgv = true, $fixServer = false, $fillToGlobal
5050
}
5151

5252
/**
53+
* 读取输入信息
54+
* @param string $text 若不为空,则先输出文本消息
55+
* @param bool $nl true 会添加换行符 false 原样输出,不添加换行符
5356
* @return string
5457
*/
55-
public function read()
58+
public function read($message = null, $nl = false)
5659
{
60+
fwrite(STDOUT, $message . ($nl ? "\n" : ''));
61+
5762
return trim(fgets($this->inputStream));
5863
}
5964

0 commit comments

Comments
 (0)