-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
+ alises
- Loading branch information
Showing
9 changed files
with
168 additions
and
48 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?php | ||
|
||
namespace hiqdev\hidev\components; | ||
|
||
use Yii; | ||
use hiqdev\hidev\controllers\DefaultController; | ||
|
||
/** | ||
* The Request. | ||
* Redefined for aliases. | ||
*/ | ||
class Request extends \yii\console\Request | ||
{ | ||
/** | ||
* @var name of script called, like $0 in sh/perl | ||
*/ | ||
protected $_self; | ||
|
||
protected $_args; | ||
|
||
/** | ||
* Returns the command line arguments. | ||
* @return array the command line arguments. It does not include the entry script name. | ||
*/ | ||
public function getParams() | ||
{ | ||
if (!isset($this->_args)) { | ||
if (isset($_SERVER['argv'])) { | ||
$args = $_SERVER['argv']; | ||
$this->_self = array_shift($args); | ||
$command = $args[0]; | ||
$alias = Yii::$app->config->aliases->get($command); | ||
if ($alias) { | ||
array_shift($args); | ||
$args = array_merge($alias, $args); | ||
} | ||
$action = $args[0]; | ||
if (Yii::$app->config->hasItem($action)) { | ||
array_shift($args); | ||
array_unshift($args, 'default/run', $action); | ||
} elseif (DefaultController::hasAction($action)) { | ||
array_shift($args); | ||
array_unshift($args, "default/$action"); | ||
} | ||
$this->_args = $args; | ||
} else { | ||
$this->_args = []; | ||
} | ||
$this->setParams($this->_args); | ||
} | ||
|
||
return $this->_args; | ||
} | ||
|
||
} |
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,26 @@ | ||
<?php | ||
|
||
/* | ||
* Highy Integrated Development. | ||
* | ||
* @link https://hiqdev.com/hidev | ||
* @package hidev | ||
* @license BSD 3-clause | ||
* @copyright Copyright (c) 2015 HiQDev | ||
*/ | ||
|
||
namespace hiqdev\hidev\goals; | ||
|
||
use Yii; | ||
use hiqdev\hidev\helpers\Helper; | ||
|
||
class Aliases extends \hiqdev\collection\Object | ||
{ | ||
public $name; | ||
|
||
public function getItem($name) | ||
{ | ||
return Helper::csplit(parent::getItem($name),' '); | ||
} | ||
|
||
} |
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,25 @@ | ||
<?php | ||
|
||
/* | ||
* Highy Integrated Development. | ||
* | ||
* @link https://hiqdev.com/hidev | ||
* @package hidev | ||
* @license BSD 3-clause | ||
* @copyright Copyright (c) 2015 HiQDev | ||
*/ | ||
|
||
namespace hiqdev\hidev\goals; | ||
|
||
use Yii; | ||
|
||
/** | ||
* Goal for Git | ||
*/ | ||
class Git extends Base | ||
{ | ||
public function init() | ||
{ | ||
$this->setDeps('.gitignore'); | ||
} | ||
} |
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