forked from deblan/t411-console
chdir
This commit is contained in:
parent
f3ad057823
commit
e033e67907
6
console
6
console
|
@ -6,4 +6,8 @@ require_once __DIR__ . '/vendor/autoload.php';
|
|||
use Console\Application;
|
||||
|
||||
$app = new Application();
|
||||
$app->run();
|
||||
|
||||
$app
|
||||
->chdir(__DIR__)
|
||||
->loadCommands()
|
||||
->run();
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue