This commit is contained in:
Simon Vieille 2015-02-15 15:23:29 +01:00
parent f3ad057823
commit e033e67907
2 changed files with 16 additions and 10 deletions

View file

@ -6,4 +6,8 @@ require_once __DIR__ . '/vendor/autoload.php';
use Console\Application;
$app = new Application();
$app->run();
$app
->chdir(__DIR__)
->loadCommands()
->run();

View file

@ -11,21 +11,21 @@ class Application extends BaseApplication
'src/Console/Command' => 'Console\\Command',
);
public function __construct($name = 'UNKNOWN', $version = 'UNKNOWN')
{
parent::__construct($name, $version);
$this->loadCommands();
}
public function addCommandsPath($path, $namespace)
{
$this->commandsPaths[$path] = trim($namespace, '/');
$this->commandsPaths[$path] = trim($namespace, '\\');
return $this;
}
protected function loadCommands()
public function chdir($directory)
{
chdir($directory);
return $this;
}
public function loadCommands()
{
$finder = new Finder();
@ -39,5 +39,7 @@ class Application extends BaseApplication
));
}
}
return $this;
}
}