public function add(Command $command)
    {
        $name = $command->getName();

        $this->commands[$name] = $command;

        if ($shortName = $command->getShortName()) {
            $this->shortNameIndex[$shortName] = $name;
        }

        foreach ($command->getAliases() as $alias) {
            $this->aliasIndex[$alias] = $name;
        }

        ksort($this->aliasIndex);
    }