public function command($nameOrCommand, $callable = null)
    {
        if ($nameOrCommand instanceof Command) {
            $command = $nameOrCommand;
        } else {
            if (!is_callable($callable)) {
                throw new \InvalidArgumentException('$callable must be a valid callable with the command\'s code');
            }

            $command = new Command($nameOrCommand);
            $command->setCode($callable);
        }

        $this['console']->add($command);

        return $command;
    }