19 declare(strict_types=1);
    63         $this->agent_finder = $agent_finder;
    64         $this->config_reader = $config_reader;
    71         $this->setDescription(
"Achieve a named objective from an agent.");
    74             InputArgument::OPTIONAL,
    75             "Objective to be execute from an agent. Format: \$AGENT::\$OBJECTIVE"    77         $this->addArgument(
"config", InputArgument::OPTIONAL, 
"Configuration file for the installation");
    81             InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY,
    82             "Define fields in the configuration file that should be overwritten, e.g. \"a.b.c=foo\"",
    85         $this->addOption(
"yes", 
"y", InputOption::VALUE_NONE, 
"Confirm every message of the objective.");
    86         $this->addOption(
"list", null, InputOption::VALUE_NONE, 
"Lists all achievable objectives");
    89     protected function execute(InputInterface $input, OutputInterface $output): 
int    92         $io->printLicenseMessage();
   108                 $input->getOption(
"list") !== null
   109                 && is_bool($input->getOption(
"list"))
   110                 && $input->getOption(
"list")
   114                 $input->getArgument(
"objective") === 
""   115                 || $input->getArgument(
"objective") === null
   121         $io->
title(
"Listing available objectives");
   123         $agentCollection = $this->agent_finder->getAgents();
   124         foreach ($agentCollection->getNamedObjectives(null) as $cmd => $objectiveCollection) {
   126             $output->writeln($objectiveCollection->getDescription());
   128         $output->writeln(
"");
   134         $objective_name = $input->getArgument(
'objective');
   136         $io->
title(
"Achieve objective: $objective_name");
   139         if ($input->getArgument(
"config")) {
   143         $namedObjectives = $agent->getNamedObjectives($config);
   145         if (isset($namedObjectives[$objective_name])) {
   146             $objective = $namedObjectives[$objective_name];
   149                 "There is no named objective '$objective_name'"   153         if ($this->preconditions !== []) {
   155                 $objective->create(),
   156                 ...$this->preconditions
   159             $objective = $objective->create();
   165         if ($config !== null) {
   170             $this->achieveObjective($objective, $environment, $io);
   171             $io->
success(
"Achieved objective '$objective_name'. Thanks and have fun!");
 Read a json-formatted config from a file and overwrite some fields. 
 
Wrapper around symfonies input and output facilities to provide just the functionality required for t...
 
executeListNamedObjectives(IOWrapper $io, OutputInterface $output)
 
__construct(AgentFinder $agent_finder, ConfigReader $config_reader, array $preconditions, Refinery $refinery)
 
A wrapper around an objective that adds some preconditions. 
 
addAgentConfigsToEnvironment(Agent $agent, Config $config, Environment $environment)
 
execute(InputInterface $input, OutputInterface $output)
 
getRelevantAgent(InputInterface $input)
 
executeAchieveObjective(IOWrapper $io, InputInterface $input)
 
readAgentConfig(Agent $agent, InputInterface $input, string $use_config_field=null)
 
shouldListNamedObjectives(InputInterface $input)
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
const RESOURCE_ADMIN_INTERACTION
 
trait HasAgent
Add this to an Command that has an agent. 
 
getRequestedConfirmation()
 
Signals that a necessary confirmation from the admin is missing. 
 
trait HasConfigReader
Add this to an Command that has an config reader.