diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index b23a42c..39664b6 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -16,7 +16,7 @@ jobs: strategy: fail-fast: true matrix: - php: [8.1] # 7.2,7.4,8.0, + php: [8.1, 8.2] # 7.2,7.4,8.0, os: [ubuntu-latest, macOS-latest] # windows-latest, # include: # will not testing on php 7.2 # - os: 'ubuntu-latest' diff --git a/app/Console/Command/ToolCommand.php b/app/Console/Command/ToolCommand.php index 43743f9..7547512 100644 --- a/app/Console/Command/ToolCommand.php +++ b/app/Console/Command/ToolCommand.php @@ -13,12 +13,16 @@ use Inhere\Console\IO\Input; use Inhere\Console\IO\Output; use Inhere\Kite\Console\SubCmd\OpenCmd; +use Inhere\Kite\Console\SubCmd\ToolCmd\BatchCommand; +use Inhere\Kite\Console\SubCmd\ToolCmd\CatCommand; +use Inhere\Kite\Console\SubCmd\ToolCmd\ExprCommand; +use Inhere\Kite\Console\SubCmd\ToolCmd\FindCommand; use Inhere\Kite\Console\SubCmd\ToolCmd\HashCommand; use Inhere\Kite\Console\SubCmd\ToolCmd\HashHmacCommand; -use Inhere\Kite\Console\SubCmd\ToolCmd\InstallCommand; -use Inhere\Kite\Console\SubCmd\ToolCmd\ListToolCommand; +use Inhere\Kite\Console\SubCmd\ToolCmd\Json5Command; use Inhere\Kite\Console\SubCmd\ToolCmd\LnCommand; -use Inhere\Kite\Console\SubCmd\ToolCmd\UpdateCommand; +use Inhere\Kite\Console\SubCmd\ToolCmd\MarkdownCommand; +use Inhere\Kite\Console\SubCmd\ToolCmd\SearchCommand; /** * Class ToolCommand @@ -38,9 +42,13 @@ protected function subCommands(): array LnCommand::class, HashHmacCommand::class, HashCommand::class, - InstallCommand::class, - UpdateCommand::class, - ListToolCommand::class, + Json5Command::class, + ExprCommand::class, + MarkdownCommand::class, + BatchCommand::class, + CatCommand::class, + FindCommand::class, + SearchCommand::class, ]; } diff --git a/app/Console/Command/BatchCommand.php b/app/Console/SubCmd/ToolCmd/BatchCommand.php similarity index 97% rename from app/Console/Command/BatchCommand.php rename to app/Console/SubCmd/ToolCmd/BatchCommand.php index 05bd091..ec76cf9 100644 --- a/app/Console/Command/BatchCommand.php +++ b/app/Console/SubCmd/ToolCmd/BatchCommand.php @@ -7,7 +7,7 @@ * @license MIT */ -namespace Inhere\Kite\Console\Command; +namespace Inhere\Kite\Console\SubCmd\ToolCmd; use Inhere\Console\Command; use Inhere\Console\IO\Input; diff --git a/app/Console/Command/CatCommand.php b/app/Console/SubCmd/ToolCmd/CatCommand.php similarity index 97% rename from app/Console/Command/CatCommand.php rename to app/Console/SubCmd/ToolCmd/CatCommand.php index 95e67be..8df7214 100644 --- a/app/Console/Command/CatCommand.php +++ b/app/Console/SubCmd/ToolCmd/CatCommand.php @@ -7,7 +7,7 @@ * @license MIT */ -namespace Inhere\Kite\Console\Command; +namespace Inhere\Kite\Console\SubCmd\ToolCmd; use Inhere\Console\Command; use Inhere\Console\IO\Input; diff --git a/app/Console/Command/ExprCommand.php b/app/Console/SubCmd/ToolCmd/ExprCommand.php similarity index 99% rename from app/Console/Command/ExprCommand.php rename to app/Console/SubCmd/ToolCmd/ExprCommand.php index f734d2c..9741ba0 100644 --- a/app/Console/Command/ExprCommand.php +++ b/app/Console/SubCmd/ToolCmd/ExprCommand.php @@ -7,7 +7,7 @@ * @license MIT */ -namespace Inhere\Kite\Console\Command; +namespace Inhere\Kite\Console\SubCmd\ToolCmd; use Inhere\Console\Command; use Inhere\Console\Component\Interact\IShell; diff --git a/app/Console/Command/FindCommand.php b/app/Console/SubCmd/ToolCmd/FindCommand.php similarity index 99% rename from app/Console/Command/FindCommand.php rename to app/Console/SubCmd/ToolCmd/FindCommand.php index e669514..8804f65 100644 --- a/app/Console/Command/FindCommand.php +++ b/app/Console/SubCmd/ToolCmd/FindCommand.php @@ -7,7 +7,7 @@ * @license MIT */ -namespace Inhere\Kite\Console\Command; +namespace Inhere\Kite\Console\SubCmd\ToolCmd; use Inhere\Console\Command; use Inhere\Console\IO\Input; diff --git a/app/Console/SubCmd/ToolCmd/FindExeCommand.php b/app/Console/SubCmd/ToolCmd/FindExeCommand.php new file mode 100644 index 0000000..9f5ce9e --- /dev/null +++ b/app/Console/SubCmd/ToolCmd/FindExeCommand.php @@ -0,0 +1,55 @@ +flags->addArgByRule('keywords', 'string;The keywords for search;true'); + // $this->flags->addOpt('show', 's', 'show the tool info', 'bool'); + // $this->flags->addOpt('list', 'l', 'list all can be installed tools', 'bool'); + } + + protected function execute(Input $input, Output $output) + { + $fs = $this->flags; + + $words = $fs->getArg('keywords'); + $paths = Sys::getEnvPaths(); + $output->aList($paths, "ENV PATH"); + + $result = []; + foreach ($paths as $path) { + $matches = glob($path. "/*$words*"); + if ($matches) { + /** @noinspection SlowArrayOperationsInLoopInspection */ + $result = array_merge($result, $matches); + } + } + + $output->aList($result, 'RESULT'); + $output->info('TODO'); + } +} diff --git a/app/Console/Command/Json5Command.php b/app/Console/SubCmd/ToolCmd/Json5Command.php similarity index 97% rename from app/Console/Command/Json5Command.php rename to app/Console/SubCmd/ToolCmd/Json5Command.php index bee1241..b18f86c 100644 --- a/app/Console/Command/Json5Command.php +++ b/app/Console/SubCmd/ToolCmd/Json5Command.php @@ -7,7 +7,7 @@ * @license MIT */ -namespace Inhere\Kite\Console\Command; +namespace Inhere\Kite\Console\SubCmd\ToolCmd; use ColinODell\Json5\Json5Decoder; use Inhere\Console\Command; diff --git a/app/Console/Command/MarkdownCommand.php b/app/Console/SubCmd/ToolCmd/MarkdownCommand.php similarity index 96% rename from app/Console/Command/MarkdownCommand.php rename to app/Console/SubCmd/ToolCmd/MarkdownCommand.php index b569c04..ba216ca 100644 --- a/app/Console/Command/MarkdownCommand.php +++ b/app/Console/SubCmd/ToolCmd/MarkdownCommand.php @@ -7,7 +7,7 @@ * @license MIT */ -namespace Inhere\Kite\Console\Command; +namespace Inhere\Kite\Console\SubCmd\ToolCmd; use Inhere\Console\Command; use Inhere\Console\IO\Input; diff --git a/app/Console/Command/SearchCommand.php b/app/Console/SubCmd/ToolCmd/SearchCommand.php similarity index 98% rename from app/Console/Command/SearchCommand.php rename to app/Console/SubCmd/ToolCmd/SearchCommand.php index 4f5da20..f5fc5b8 100644 --- a/app/Console/Command/SearchCommand.php +++ b/app/Console/SubCmd/ToolCmd/SearchCommand.php @@ -1,6 +1,6 @@ flags->addArgByRule('name', 'show the tool detail info by name'); + // $this->flags->addOpt('show', 's', 'show the tool info', 'bool'); + // $this->flags->addOpt('list', 'l', 'list all can be installed tools', 'bool'); + } + + protected function execute(Input $input, Output $output) + { + + $output->info('TODO'); + } +} diff --git a/app/Http/Controller.php b/app/Http/Controller.php index c3c2b5f..0b29c2b 100644 --- a/app/Http/Controller.php +++ b/app/Http/Controller.php @@ -18,7 +18,7 @@ abstract class Controller */ protected function render(string $viewPath, array $vars = []): void { - Kite::webApp()->getRenderer()->render($viewPath, $vars); + Kite::webApp()->getRenderer()->display($viewPath, $vars); } /** diff --git a/config/config.php b/config/config.php index 241c635..4a62344 100644 --- a/config/config.php +++ b/config/config.php @@ -34,7 +34,7 @@ '*' ], // gitlab api config - 'baseUrl' => '', + 'baseApi' => '', ], 'github' => [ // remote @@ -48,7 +48,7 @@ '*' ], // github api config - // 'baseUrl' => '', + // 'baseApi' => '', ], 'osEnv' => [ // env settings