mirror of
https://github.com/friendica/friendica
synced 2025-05-12 03:04:10 +02:00
Use DICE for Console
- Use Friendica\Core\Console as Controller for DI-library - Refactor every console command to use DICE (when possible) - Adjusting tests
This commit is contained in:
parent
b8a336cc0d
commit
a60eb9e33d
20 changed files with 400 additions and 166 deletions
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Friendica\Console;
|
||||
|
||||
use Friendica\BaseObject;
|
||||
use Friendica\Core\Config\Configuration;
|
||||
|
||||
/**
|
||||
* Tired of chasing typos and finding them after a commit.
|
||||
|
@ -14,6 +14,11 @@ class Typo extends \Asika\SimpleConsole\Console
|
|||
{
|
||||
protected $helpOptions = ['h', 'help', '?'];
|
||||
|
||||
/**
|
||||
* @var Configuration
|
||||
*/
|
||||
private $config;
|
||||
|
||||
protected function getHelp()
|
||||
{
|
||||
$help = <<<HELP
|
||||
|
@ -31,6 +36,13 @@ HELP;
|
|||
return $help;
|
||||
}
|
||||
|
||||
public function __construct(Configuration $config, array $argv = null)
|
||||
{
|
||||
parent::__construct($argv);
|
||||
|
||||
$this->config = $config;
|
||||
}
|
||||
|
||||
protected function doExecute()
|
||||
{
|
||||
if ($this->getOption('v')) {
|
||||
|
@ -43,7 +55,7 @@ HELP;
|
|||
throw new \Asika\SimpleConsole\CommandArgsException('Too many arguments');
|
||||
}
|
||||
|
||||
$php_path = BaseObject::getApp()->getConfig()->get('config', 'php_path', 'php');
|
||||
$php_path = $this->config->get('config', 'php_path', 'php');
|
||||
|
||||
if ($this->getOption('v')) {
|
||||
$this->out('Directory: src');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue