#!/usr/bin/env php [options]\n"); exit(1); } $command = strtolower(trim($argv[1])); $arguments = array_slice($argv, 2); $availableCommands = [ "get-icon" => \ofc\Commands\GetIconCommand::class, 'make:action' => \ofc\Commands\MakeActionCommand::class, // TODO: additional commands go below // "swap-library" => \ofc\Commands\LibrarySwap::class, ]; if (!isset($availableCommands[$command])) { fwrite(STDERR, "Error: Unknown command '$command'\n"); exit(1); } // If the user requested help if (in_array('--help', $arguments)) { echo $availableCommands[$command]::getHelp().PHP_EOL.PHP_EOL; exit(0); } $availableCommands[$command]::run($arguments);