function RecipeInfoCommand::execute
Same name in this branch
- 11.x core/lib/Drupal/Core/Recipe/RecipeInfoCommand.php \Drupal\Core\Recipe\RecipeInfoCommand::execute()
Same name and namespace in other branches
- main core/lib/Drupal/Core/Recipe/RecipeInfoCommand.php \Drupal\Core\Recipe\RecipeInfoCommand::execute()
- main core/lib/Drupal/Core/Recipe/Command/RecipeInfoCommand.php \Drupal\Core\Recipe\Command\RecipeInfoCommand::execute()
File
-
core/
lib/ Drupal/ Core/ Recipe/ Command/ RecipeInfoCommand.php, line 38
Class
- RecipeInfoCommand
- Shows information about a particular recipe.
Namespace
Drupal\Core\Recipe\CommandCode
protected function execute(InputInterface $input, OutputInterface $output) : int {
$io = new SymfonyStyle($input, $output);
$recipe_path = $input->getArgument('path');
if (!is_string($recipe_path) || !is_dir($recipe_path)) {
$io->error(sprintf('The supplied path %s is not a directory', $recipe_path));
return Command::FAILURE;
}
$recipe = Recipe::createFromDirectory($recipe_path);
$io->section('Description');
$io->text($recipe->description);
$io->section('Inputs');
$descriptions = $recipe->input
->describeAll();
if ($descriptions) {
// Passing NULL as the callable to array_map() makes it act like a Python
// zip() operation.
// @see https://docs.python.org/3.8/library/functions.html#zip
$rows = array_map(NULL, array_keys($descriptions), $descriptions);
$io->table([
'Name',
'Description',
], $rows);
}
else {
$io->writeln("This recipe does not accept any input.");
}
return Command::SUCCESS;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.