public function addArgument($name, array $params = [])
    {
        if ($name instanceof ConsoleInputArgument) {
            $arg = $name;
            $index = count($this->_args);
        } else {
            $defaults = [
                'name' => $name,
                'help' => '',
                'index' => count($this->_args),
                'required' => false,
                'choices' => []
            ];
            $options = $params + $defaults;
            $index = $options['index'];
            unset($options['index']);
            $arg = new ConsoleInputArgument($options);
        }
        foreach ($this->_args as $k => $a) {
            if ($a->isEqualTo($arg)) {
                return $this;
            }
            if (!empty($options['required']) && !$a->isRequired()) {
                throw new LogicException('A required argument cannot follow an optional one');
            }
        }
        $this->_args[$index] = $arg;
        ksort($this->_args);

        return $this;
    }