public static function find($commandName, CommandCollection $commands)
    {
        $threshold = 1e3;
        $distancesByName = array();

        // Include aliases in the search
        $actualNames = $commands->getNames(true);

        foreach ($actualNames as $actualName) {
            // Get Levenshtein distance between the input and each command name
            $distance = levenshtein($commandName, $actualName);

            $isSimilar = $distance <= (strlen($commandName) / 3);
            $isSubString = false !== strpos($actualName, $commandName);

            if ($isSimilar || $isSubString) {
                $distancesByName[$actualName] = $distance;
            }
        }

        // Only keep results with a distance below the threshold
        $distancesByName = array_filter($distancesByName, function ($distance) use ($threshold) {
            return $distance < 2 * $threshold;
        });

        // Display results with shortest distance first
        asort($distancesByName);

        $suggestedNames = array_keys($distancesByName);

        return self::filterDuplicates($suggestedNames, $commands);
    }