-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support start an interactive shell for run application
- Loading branch information
Showing
8 changed files
with
160 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php declare(strict_types=1); | ||
/** | ||
* Created by PhpStorm. | ||
* User: Inhere | ||
* Date: 2018/1/30 0030 | ||
* Time: 23:41 | ||
*/ | ||
|
||
namespace Inhere\Console\IO\Input; | ||
|
||
use Inhere\Console\IO\Input; | ||
use Toolkit\Cli\Flags; | ||
use Toolkit\Cli\Util\LineParser; | ||
|
||
/** | ||
* Class StringInput | ||
* | ||
* @package Inhere\Console\IO\Input | ||
*/ | ||
class StringInput extends Input | ||
{ | ||
/** | ||
* Input constructor. | ||
* | ||
* @param string $line | ||
* @param bool $parsing | ||
*/ | ||
public function __construct(string $line, bool $parsing = true) | ||
{ | ||
parent::__construct([], false); | ||
|
||
if ($parsing && $line) { | ||
$flags = LineParser::parseIt($line); | ||
|
||
$this->doParse($flags); | ||
} | ||
} | ||
|
||
/** | ||
* @param array $args | ||
*/ | ||
protected function doParse(array $args): void | ||
{ | ||
[ | ||
$this->args, | ||
$this->sOpts, | ||
$this->lOpts | ||
] = Flags::parseArray($args); | ||
|
||
// find command name | ||
$this->command = $this->findCommandName(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters