public function command_args(CommandInterface $cmd, $cmdSignature)
    {
        $args = [];
        $arguments = $cmd->getArguments();

        // for command that does not define an argument, we just complete the argument by file paths.
        if ($arguments === []) {
            return ['*:default:_files'];
        }

        $idx = 0;
        foreach ($arguments as $a) {
            $comp = '';

            if ($a->multiple) {
                $comp .= '*:' . $a->name;
            } else {
                $comp .= ':' . $a->name;
            }

            if ($a->validValues || $a->suggestions) {
                if ($a->validValues) {
                    if (is_callable($a->validValues)) {
                        $comp .= ':{' . implode(' ', [
                                $this->meta_command_name(),
                                Util::qq($a->name),
                                $cmdSignature,
                                'arg',
                                $idx,
                                'valid-values',
                            ]) . '}';
                    } elseif ($values = $a->getValidValues()) {
                        $comp .= ':(' . implode(' ', Util::array_qq($values)) . ')';
                    }
                } elseif ($a->suggestions) {
                    if (is_callable($a->suggestions)) {
                        $comp .= ':{' . implode(' ', [
                                $this->meta_command_name(),
                                Util::qq($a->name),
                                $cmdSignature,
                                'arg',
                                $idx,
                                'suggestions',
                            ]) . '}';
                    } elseif ($values = $a->getSuggestions()) {
                        $comp .= ':(' . implode(' ', Util::array_qq($values)) . ')';
                    }
                }
            } elseif (in_array($a->isa, ['file', 'path', 'dir'], true)) {
                switch ($a->isa) {
                    case 'file':
                        $comp .= ':_files';
                        break;
                    case 'path':
                        $comp .= ':_path_files';
                        break;
                    case 'dir':
                        $comp .= ':_directories';
                        break;
                }
                if ($a->glob) {
                    $comp .= " -g \"{$a->glob}\"";
                }
            }
            $args[] = Util::q($comp);
            $idx++;
        }

        return empty($args) ? null : $args;
    }