getCommandAlternatives example


    public function verifyCommand(string $command, array $commands): bool
    {
        if (isset($commands[$command])) {
            return true;
        }

        $message = lang('CLI.commandNotFound', [$command]);

        if ($alternatives = $this->getCommandAlternatives($command$commands)) {
            if (count($alternatives) === 1) {
                $message .= "\n\n" . lang('CLI.altCommandSingular') . "\n ";
            } else {
                $message .= "\n\n" . lang('CLI.altCommandPlural') . "\n ";
            }

            $message .= implode("\n ", $alternatives);
        }

        CLI::error($message);
        CLI::newLine();

        
Home | Imprint | This part of the site doesn't use cookies.