Skip to content
This repository has been archived by the owner on Nov 14, 2024. It is now read-only.

Commit

Permalink
Introduces CLI main class; Renames InitCommand
Browse files Browse the repository at this point in the history
  • Loading branch information
jedrzejchalubek committed Jan 4, 2017
1 parent 043db72 commit 24d6698
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 4 deletions.
70 changes: 70 additions & 0 deletions src/Gin/Foundation/Console/CLI.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?php

namespace Tonik\Gin\Foundation\Console;

use Symfony\Component\Console\Application;

class CLI
{
/**
* Console application instance.
*
* @var \Symfony\Component\Console\Application
*/
protected $app;

/**
* List of commands to register.
*
* @var array
*/
protected $commands = [
'Tonik\Gin\Foundation\Console\Command\ShakeCommand'
];

/**
* Console application banner.
*
* @var string
*/
private $banner = '
___ __ / __
| / \ |\ | | |__/ / / _` | |\ |
| \__/ | \| | | \ / \__| | | \|
/
';

/**
* Construct CLI.
*/
function __construct()
{
$this->app = new Application($this->banner);

$this->bootstrap();
}

/**
* Boodstraps CLI.
*
* @return void
*/
protected function bootstrap()
{
$this->addCommands($this->commands);

$this->app->run();
}

/**
* Registers commands within console application.
*
* @param array $commands
*/
protected function addCommands(array $commands)
{
foreach ($commands as $command) {
$this->app->add(new $command);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Tonik\Gin\Foundation\Console;
namespace Tonik\Gin\Foundation\Console\Command;

use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Exception\RuntimeException;
Expand All @@ -9,7 +9,7 @@
use Symfony\Component\Console\Question\ChoiceQuestion;
use Symfony\Component\Console\Question\Question;

class InitCommand extends Command
class ShakeCommand extends Command
{
/**
* List of theme details entries.
Expand Down Expand Up @@ -55,8 +55,8 @@ class InitCommand extends Command
*/
protected function configure()
{
$this->setName('theme:init')
->setDescription('Initializes starter theme.');
$this->setName('tonik:shake')
->setDescription('Starts setup wizard guide, which initializes starter theme.');
}

/**
Expand Down

0 comments on commit 24d6698

Please sign in to comment.