public function addCommandOption(CommandOption $commandOption)
    {
        $longName = $commandOption->getLongName();
        $shortName = $commandOption->getShortName();
        $longAliases = $commandOption->getLongAliases();
        $shortAliases = $commandOption->getShortAliases();

        if ($this->hasOption($longName) || $this->hasCommandOption($longName)) {
            throw CannotAddOptionException::existsAlready($longName);
        }

        foreach ($longAliases as $shortAlias) {
            if ($this->hasOption($shortAlias) || $this->hasCommandOption($shortAlias)) {
                throw CannotAddOptionException::existsAlready($shortAlias);
            }
        }

        if ($shortName && ($this->hasOption($shortName) || $this->hasCommandOption($shortName))) {
            throw CannotAddOptionException::existsAlready($shortName);
        }

        foreach ($shortAliases as $shortAlias) {
            if ($this->hasOption($shortAlias) || $this->hasCommandOption($shortAlias)) {
                throw CannotAddOptionException::existsAlready($shortAlias);
            }
        }

        $this->commandOptions[$longName] = $commandOption;

        if ($shortName) {
            $this->commandOptionsByShortName[$shortName] = $commandOption;
        }

        foreach ($longAliases as $longAlias) {
            $this->commandOptions[$longAlias] = $commandOption;
        }

        foreach ($shortAliases as $shortAlias) {
            $this->commandOptionsByShortName[$shortAlias] = $commandOption;
        }

        return $this;
    }