Skip to content

Commit 2e406be

Browse files
committed
update some for color
1 parent 977a446 commit 2e406be

File tree

3 files changed

+13
-271
lines changed

3 files changed

+13
-271
lines changed

src/Component/Style/ColorCode.php

Lines changed: 0 additions & 266 deletions
This file was deleted.

src/Component/Style/Style.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
namespace Inhere\Console\Component\Style;
1212

1313
use InvalidArgumentException;
14-
use Toolkit\Cli\Cli;
1514
use Toolkit\Cli\Color;
15+
use Toolkit\Cli\ColorCode;
1616
use Toolkit\Cli\ColorTag;
1717
use function array_key_exists;
1818
use function array_keys;
@@ -211,7 +211,7 @@ public function format(string $text)
211211
}
212212

213213
// if don't support output color text, clear color tag.
214-
if (!Cli::isSupportColor() || self::isNoColor()) {
214+
if (!Color::isShouldRenderColor()) {
215215
return self::stripColor($text);
216216
}
217217

@@ -228,7 +228,7 @@ public function format(string $text)
228228
$text = ColorTag::replaceColor($text, $key, $matches[2][$i], Color::STYLES[$key]);
229229
/** Custom style format @see ColorCode::fromString() */
230230
} elseif (strpos($key, '=')) {
231-
$text = ColorTag::replaceColor($text, $key, $matches[2][$i], (string)ColorCode::makeByString($key));
231+
$text = ColorTag::replaceColor($text, $key, $matches[2][$i], (string)ColorCode::fromString($key));
232232
}
233233
}
234234

src/ConsoleEvent.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@
99
*/
1010
final class ConsoleEvent
1111
{
12-
public const STOP = 1;
13-
public const GOON = 1;
12+
// event name list
13+
public const ON_BEFORE_RUN = 'app.beforeRun';
14+
15+
public const ON_AFTER_RUN = 'app.afterRun';
16+
17+
public const ON_RUN_ERROR = 'app.runError';
18+
19+
public const ON_STOP_RUN = 'app.stopRun';
20+
21+
public const ON_NOT_FOUND = 'app.notFound';
1422
}

0 commit comments

Comments
 (0)