Skip to content

Commit 5b80586

Browse files
committed
feat: migrate interact command to sprout
1 parent f27bd38 commit 5b80586

File tree

3 files changed

+28
-38
lines changed

3 files changed

+28
-38
lines changed

bin/leaf

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,29 @@ if (file_exists(dirname(__DIR__, 3) . "/autoload.php")) {
1010
$leafCli = json_decode(file_get_contents(dirname(__DIR__) . "/composer.json"));
1111
$currentVersion = $leafCli->version;
1212

13-
$app = new Symfony\Component\Console\Application("
13+
$app = sprout()->createApp([
14+
'name' => "
1415
<info> _ __ ___ _ ___
1516
| | ___ __ _ / _| / __| | |_ <comment>$currentVersion</comment>
1617
| |__/ -_) _` | _| | (__| |__ | |
1718
|____\___\__,_|_| \___|____|___|</info>
18-
");
19+
",
20+
'version' => ''
21+
]);
1922

20-
$app->add(new Leaf\Console\CreateCommand);
21-
$app->add(new Leaf\Console\UpdateCommand);
22-
$app->add(new Leaf\Console\TestCommand);
23-
$app->add(new Leaf\Console\TestSetupCommand);
24-
$app->add(new Leaf\Console\InstallCommand);
25-
$app->add(new Leaf\Console\UninstallCommand);
26-
$app->add(new Leaf\Console\ServeCommand);
27-
$app->add(new Leaf\Console\DeployCommand);
28-
$app->add(new Leaf\Console\InteractCommand);
29-
$app->add(new Leaf\Console\RunCommand);
30-
$app->add(new Leaf\Console\UICommand);
31-
$app->add(new Leaf\Console\ViewBuildCommand);
32-
$app->add(new Leaf\Console\ViewDevCommand);
33-
$app->add(new Leaf\Console\ViewInstallCommand);
23+
// $app->register(Leaf\Console\CreateCommand::class);
24+
// $app->register(Leaf\Console\UpdateCommand::class);
25+
// $app->register(Leaf\Console\TestCommand::class);
26+
// $app->register(Leaf\Console\TestSetupCommand::class);
27+
// $app->register(Leaf\Console\InstallCommand::class);
28+
// $app->register(Leaf\Console\UninstallCommand::class);
29+
// $app->register(Leaf\Console\ServeCommand::class);
30+
// $app->register(Leaf\Console\DeployCommand::class);
31+
$app->register(Leaf\Console\InteractCommand::class);
32+
// $app->register(Leaf\Console\RunCommand::class);
33+
// $app->register(Leaf\Console\UICommand::class);
34+
// $app->register(Leaf\Console\ViewBuildCommand::class);
35+
// $app->register(Leaf\Console\ViewDevCommand::class);
36+
// $app->register(Leaf\Console\ViewInstallCommand::class);
3437

3538
$app->run();

composer.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,8 @@
2323
"require": {
2424
"ext-json": "*",
2525
"leafs/fs": "^1.0",
26-
"psy/psysh": "*",
27-
"symfony/console": "^5.0|^6.0",
28-
"symfony/process": "^5.0|^6.0"
26+
"leafs/sprout": "dev-main",
27+
"psy/psysh": "*"
2928
},
3029
"bin": [
3130
"bin/leaf"

src/InteractCommand.php

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,44 +4,32 @@
44

55
namespace Leaf\Console;
66

7-
use Symfony\Component\Console\Command\Command;
8-
use Symfony\Component\Console\Input\InputInterface;
9-
use Symfony\Component\Console\Output\OutputInterface;
7+
use Leaf\Sprout\Command;
108
use Psy\Shell;
119

1210
class InteractCommand extends Command
1311
{
14-
protected static $defaultName = 'interact';
12+
protected $signature = 'interact';
13+
protected $description = 'Interact with your application';
1514

16-
protected function configure()
15+
protected function handle(): int
1716
{
18-
$this
19-
->setDescription('Interact with your application')
20-
->setHelp('Interact with your application');
21-
}
22-
23-
protected function execute(InputInterface $input, OutputInterface $output): int
24-
{
25-
$output->writeln('<info>Leaf interactive shell activated</info>');
17+
$this->writeln('<info>Leaf interactive shell activated</info>');
2618

2719
if (file_exists('vendor/autoload.php')) {
2820
require 'vendor/autoload.php';
2921
}
3022

31-
if (file_exists('Config/bootstrap.php')) {
32-
require 'Config/bootstrap.php';
33-
}
34-
3523
if (file_exists('index.php') && !file_exists('leaf')) {
3624
require 'index.php';
3725
}
3826

3927
if (!file_exists('vendor/autoload.php') && !file_exists('Config/bootstrap.php') && (file_exists('index.php') && file_exists('leaf'))) {
40-
$output->writeln('<info>Required files not found, starting shell running in retard mode...</info>');
28+
$this->writeln('<info>Required files not found, starting shell running in retard mode...</info>');
4129
}
4230

4331
$shell = new Shell();
4432

45-
return $output->write($shell->run()) ? 0 : 1;
33+
return $shell->run();
4634
}
4735
}

0 commit comments

Comments
 (0)