8use Symfony\Component\Console\Input\InputInterface;
9use Symfony\Component\Console\Input\InputOption;
19 protected $agent_finder =
null;
23 $this->addOption(
"plugin",
null, InputOption::VALUE_REQUIRED,
"Name of the plugin to run the command for.");
24 $this->addOption(
"no-plugins",
null, InputOption::VALUE_NONE,
"Ignore all plugins when running the command.");
25 $this->addOption(
"skip",
null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY,
"Skip plugin with the supplied <plugin-name> when running the command.");
30 if (!$this->agent_finder) {
31 throw new \LogicException(
32 "\$this->agent_finder needs to intialized with an AgentFinder."
36 if ($input->hasOption(
"no-plugins") && $input->getOption(
"no-plugins")) {
38 return $this->agent_finder->getCoreAgents();
41 if ($input->hasOption(
"plugin")) {
42 $plugin_name = $input->getOption(
"plugin");
44 return $this->agent_finder->getPluginAgent($plugin_name);
48 $agents = $this->agent_finder->getAgents();
49 if ($input->hasOption(
"skip")) {
50 foreach (($input->getOption(
"skip") ?? []) as $plugin_name) {
51 $agents = $agents->withRemovedAgent(strtolower($plugin_name));
An exception for terminatinating execution or to throw for unit testing.
A agent is some component that performs part of the setup process.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
trait HasAgent
Add this to an Command that has an agent.
getRelevantAgent(InputInterface $input)
configureCommandForPlugins()