Skip to content

Commit

Permalink
Add more skeleton.
Browse files Browse the repository at this point in the history
  • Loading branch information
demiankatz committed Dec 19, 2024
1 parent 71a4d98 commit 4abdb97
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 4 deletions.
10 changes: 7 additions & 3 deletions config/vufind/ConsoleMenu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@ main:
label: Main Menu
type: menu
contents:
- label: Submenu 1
- label: Import Options
type: menu
contents:
- label: Command
type: command
- label: Import MARC
type: external-command
command: import-marc.sh
- label: Import XML
type: internal-command
command: import/import-xsl
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,36 @@ protected function displaySubmenu(InputInterface $input, OutputInterface $output
}
}

/**
* Run an external (non-Symfony) command.
*
* @param InputInterface $input Input object
* @param OutputInterface $output Output object
* @param array $config Configuration of command to run
*
* @return int
*/
protected function runExternalCommand(InputInterface $input, OutputInterface $output, array $config): int
{
$output->writeLn("Not implemented yet.");
return 0;
}

/**
* Run an internal (Symfony) command.
*
* @param InputInterface $input Input object
* @param OutputInterface $output Output object
* @param array $config Configuration of command to run
*
* @return int
*/
protected function runInternalCommand(InputInterface $input, OutputInterface $output, array $config): int
{
$output->writeLn("Not implemented yet.");
return 0;
}

/**
* Display a menu or prompt for the provided configuration.
*
Expand All @@ -137,7 +167,10 @@ protected function displayOptions(InputInterface $input, OutputInterface $output
switch ($type) {
case 'menu':
return $this->displaySubmenu($input, $output, $config['contents'] ?? []);
case 'command':
case 'external-command':
return $this->runExternalCommand($input, $output, $config);
case 'internal-command':
return $this->runInternalCommand($input, $output, $config);
default:
$output->writeln("Unknown menu type '$type' with label '$label'");
return 1;
Expand Down

0 comments on commit 4abdb97

Please sign in to comment.