-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathShellCommand.php
More file actions
64 lines (57 loc) · 1.58 KB
/
Copy pathShellCommand.php
File metadata and controls
64 lines (57 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
/**
* Arikaim
*
* @link http://www.arikaim.com
* @copyright Copyright (c) Intersoft <info@arikaim.com>
* @license http://www.arikaim.com/license
*
*/
namespace Arikaim\Core\Console;
use Symfony\Component\Console\Question\Question;
use Symfony\Component\Console\Input\StringInput;
use Symfony\Component\Console\Output\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Arikaim\Core\Console\ConsoleCommand;
/**
* Console shell
*/
class ShellCommand extends ConsoleCommand
{
/**
* Config command
*
* @return void
*/
protected function configure(): void
{
$this->setName('shell');
$this->setDefault(true);
}
/**
* Command code
*
* @param InputInterface $input
* @param OutputInterface $output
* @return void
*/
protected function executeCommand($input, $output)
{
$app = $this->getApplication();
$this->style->section($app->getName());
$helper = $this->getHelper('question');
$question = new Question('arikaim > ');
$app->setAutoExit(false);
while(true) {
$command = \trim($helper->ask($input, $output, $question));
if ($command == 'exit') {
$this->style->newLine();
exit();
}
if (empty($command) == false) {
$commandInput = new StringInput($command);
$app->run($commandInput,$output);
}
}
}
}