serverctl/src/ConsoleApplication.php

48 lines
1.3 KiB
PHP

<?php
namespace NoccyLabs\Serverctl;
use NoccyLabs\Serverctl\Container\ContainerManager;
use NoccyLabs\Serverctl\Registry\ServiceRegistry;
use Symfony\Component\Console\Application;
class ConsoleApplication extends Application
{
private ServiceRegistry $serviceRegistry;
private ContainerManager $containerManager;
public function __construct()
{
parent::__construct("Development server utility", "0.1.0");
$this->serviceRegistry = new ServiceRegistry(
paths: [
__DIR__."/../registry",
dirname(realpath($GLOBALS['argv'][0]))."/registry",
"/usr/share/serverctl/registry",
getenv("HOME")."/.share/serverctl/registry"
]
);
$this->containerManager = new ContainerManager(
dataPath: null
);
$this->add(new Commands\StartCommand());
$this->add(new Commands\StopCommand());
$this->add(new Commands\ExecCommand());
$this->add(new Commands\FindCommand());
$this->add(new Commands\StatusCommand());
}
public function getServiceRegistry(): ServiceRegistry
{
return $this->serviceRegistry;
}
public function getContainerManager(): ContainerManager
{
return $this->containerManager;
}
}