private function findNearestCommand($commandName, array $commands)
    {
        $distances = [];
        foreach (array_keys($commands) as $command) {
            $distances[$command] = levenshtein($commandName, $command);
        }

        $distances = array_filter(array_unique($distances), function ($distance) {
            return $distance <= 3;
        });

        if (empty($distances)) {
            return false;
        }

        return array_search(min($distances), $distances);
    }