diff --git a/config/vufind/ConsoleMenu.yaml b/config/vufind/ConsoleMenu.yaml index d9f21545e47..d5ffcb75347 100644 --- a/config/vufind/ConsoleMenu.yaml +++ b/config/vufind/ConsoleMenu.yaml @@ -2,8 +2,12 @@ main: label: Main Menu type: menu contents: - - label: Submenu 1 + - label: Import Options type: menu contents: - - label: Command - type: command \ No newline at end of file + - label: Import MARC + type: external-command + command: import-marc.sh + - label: Import XML + type: internal-command + command: import/import-xsl \ No newline at end of file diff --git a/module/VuFindConsole/src/VuFindConsole/Command/Menu/MenuCommand.php b/module/VuFindConsole/src/VuFindConsole/Command/Menu/MenuCommand.php index 3332c0cae8c..5d3f92cecb5 100644 --- a/module/VuFindConsole/src/VuFindConsole/Command/Menu/MenuCommand.php +++ b/module/VuFindConsole/src/VuFindConsole/Command/Menu/MenuCommand.php @@ -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. * @@ -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;