Skip to content

Commit c617af4

Browse files
committed
rename some dir. begin refactoring run logic
1 parent 6b60666 commit c617af4

19 files changed

+51
-57
lines changed

src/AbstractApplication.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010

1111
use Inhere\Console\Component\ErrorHandler;
1212
use Inhere\Console\Component\Style\Style;
13-
use Inhere\Console\Face\ApplicationInterface;
14-
use Inhere\Console\Face\ErrorHandlerInterface;
13+
use Inhere\Console\Contract\ApplicationInterface;
14+
use Inhere\Console\Contract\ErrorHandlerInterface;
1515
use Inhere\Console\IO\Input;
1616
use Inhere\Console\IO\InputInterface;
1717
use Inhere\Console\IO\Output;

src/AbstractCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88

99
namespace Inhere\Console;
1010

11-
use Inhere\Console\Face\BaseCommandInterface;
12-
use Inhere\Console\Face\CommandInterface;
11+
use Inhere\Console\Contract\BaseCommandInterface;
12+
use Inhere\Console\Contract\CommandInterface;
1313
use Inhere\Console\IO\Input;
1414
use Inhere\Console\IO\InputDefinition;
1515
use Inhere\Console\IO\Output;

src/Command.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
namespace Inhere\Console;
1010

11-
use Inhere\Console\Face\CommandInterface;
11+
use Inhere\Console\Contract\CommandInterface;
1212

1313
/**
1414
* Class Command

src/Component/ErrorHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
namespace Inhere\Console\Component;
1010

1111
use Inhere\Console\AbstractApplication;
12-
use Inhere\Console\Face\ErrorHandlerInterface;
12+
use Inhere\Console\Contract\ErrorHandlerInterface;
1313
use Toolkit\Cli\Highlighter;
1414

1515
/**

src/Component/Notify/CounterText.php renamed to src/Component/Progress/CounterText.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
<?php
22

3-
namespace Inhere\Console\Component\Notify;
3+
namespace Inhere\Console\Component\Progress;
44

55
use Inhere\Console\Component\NotifyMessage;
66
use Inhere\Console\Console;
7-
use Inhere\Library\Helpers\Cli;
7+
use Toolkit\Cli\Cli;
88

99
/**
1010
* Class CounterText
11-
* @package Inhere\Console\Component\Notify
11+
* @package Inhere\Console\Component\Progress
1212
*/
1313
class CounterText extends NotifyMessage
1414
{

src/Component/Notify/DynamicText.php renamed to src/Component/Progress/DynamicText.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
<?php
22

3-
namespace Inhere\Console\Component\Notify;
3+
namespace Inhere\Console\Component\Progress;
44

55
use Inhere\Console\Component\NotifyMessage;
6-
use Inhere\Console\Component\Style\Style;
6+
use Inhere\Console\Console;
77
use Toolkit\Cli\Cli;
88

99
/**
1010
* Class DynamicText
11-
* @package Inhere\Console\Component\Notify
11+
* @package Inhere\Console\Component\Progress
1212
*/
1313
class DynamicText extends NotifyMessage
1414
{
@@ -25,11 +25,11 @@ public static function gen(string $doneMsg, string $fixedMsg = ''): \Generator
2525
$template = Cli::isSupportColor() ? "\x0D\x1B[2K" : "\x0D";
2626

2727
if ($fixedMsg) {
28-
$template .= Style::instance()->render($fixedMsg);
28+
$template .= Console::style()->render($fixedMsg);
2929
}
3030

3131
$template .= '%s';
32-
$doneMsg = $doneMsg ? Style::instance()->render($doneMsg) : '';
32+
$doneMsg = $doneMsg ? Console::style()->render($doneMsg) : '';
3333

3434
while (true) {
3535
if ($finished) {

src/Component/Notify/Pending.php renamed to src/Component/Progress/Pending.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
* Time: 13:31
77
*/
88

9-
namespace Inhere\Console\Component\Notify;
9+
namespace Inhere\Console\Component\Progress;
1010

1111
use Inhere\Console\Component\NotifyMessage;
1212

1313
/**
1414
* Class Pending
15-
* @package Inhere\Console\Component\Notify
15+
* @package Inhere\Console\Component\Progress
1616
*/
1717
class Pending extends NotifyMessage
1818
{

src/Component/Notify/Spinner.php renamed to src/Component/Progress/Spinner.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
* Time: 13:32
77
*/
88

9-
namespace Inhere\Console\Component\Notify;
9+
namespace Inhere\Console\Component\Progress;
1010

1111
use Inhere\Console\Component\NotifyMessage;
1212

1313
/**
1414
* Class Spinner
15-
* @package Inhere\Console\Component\Notify
15+
* @package Inhere\Console\Component\Progress
1616
*/
1717
class Spinner extends NotifyMessage
1818
{

src/Console.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ public static function stderr($text, $nl = true, $quit = -200): void
199199
* print log to console
200200
* @param string $msg
201201
* @param array $data
202-
* @param string $type
202+
* @param string $level
203203
* @param array $opts
204204
* [
205205
* '_category' => 'application',
@@ -208,14 +208,13 @@ public static function stderr($text, $nl = true, $quit = -200): void
208208
* 'coId' => 12,
209209
* ]
210210
*/
211-
public static function log(string $msg, array $data = [], string $type = 'info', array $opts = []): void
211+
public static function log(string $msg, array $data = [], string $level = 'info', array $opts = []): void
212212
{
213-
if (isset(self::LOG_LEVEL2TAG[$type])) {
214-
$type = ColorTag::add(\strtoupper($type), self::LOG_LEVEL2TAG[$type]);
213+
if (isset(self::LOG_LEVEL2TAG[$level])) {
214+
$level = ColorTag::add(\strtoupper($level), self::LOG_LEVEL2TAG[$level]);
215215
}
216216

217217
$userOpts = [];
218-
219218
foreach ($opts as $n => $v) {
220219
if (\is_numeric($n) || \strpos($n, '_') === 0) {
221220
$userOpts[] = "[$v]";
@@ -229,7 +228,7 @@ public static function log(string $msg, array $data = [], string $type = 'info',
229228
self::write(\sprintf(
230229
'%s [%s]%s %s %s',
231230
\date('Y/m/d H:i:s'),
232-
$type,
231+
$level,
233232
$optString,
234233
\trim($msg),
235234
$data ? \PHP_EOL . \json_encode($data, \JSON_UNESCAPED_SLASHES | \JSON_PRETTY_PRINT) : ''

src/Face/ApplicationInterface.php renamed to src/Contract/ApplicationInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
* Time: 16:51
77
*/
88

9-
namespace Inhere\Console\Face;
9+
namespace Inhere\Console\Contract;
1010

1111
/**
1212
* Interface ApplicationInterface
13-
* @package Inhere\Console
13+
* @package Inhere\Console\Contract
1414
*/
1515
interface ApplicationInterface
1616
{

0 commit comments

Comments
 (0)