Create args from function parameters.

def args(self):
        """Create args from function parameters."""
        params = self.parameters
        args = OrderedDict()

        # This will be overridden if the command explicitly defines an
        # arg named help.
        args['help'] = HelpArg(command=self)

        normalize_name = self.normalize_name
        get_arg_config = self.get_arg_config
        get_short_option = self.get_short_option_for_arg
        get_long_option = self.get_long_option_for_arg
        get_inverse_option = self.get_inverse_option_for_arg

        names = {normalize_name(name) for name in params}

        used_short_options = set()
        for param in params.values():
            annotation = get_arg_config(param)
            short_option = annotation.short_option
            if short_option:
                used_short_options.add(short_option)

        for name, param in params.items():
            name = normalize_name(name)

            skip = (
                name.startswith('_') or
                param.kind is param.VAR_KEYWORD or
                param.kind is param.KEYWORD_ONLY)
            if skip:
                continue

            annotation = get_arg_config(param)
            container = annotation.container
            type = annotation.type
            choices = annotation.choices
            help = annotation.help
            inverse_help = annotation.inverse_help
            short_option = annotation.short_option
            long_option = annotation.long_option
            inverse_option = annotation.inverse_option
            action = annotation.action
            nargs = annotation.nargs

            default = param.default

            if default is not param.empty:
                if not short_option:
                    short_option = get_short_option(name, names, used_short_options)
                    used_short_options.add(short_option)
                if not long_option:
                    long_option = get_long_option(name)
                if not inverse_option:
                    # NOTE: The DISABLE marker evaluates as True
                    inverse_option = get_inverse_option(long_option)

            args[name] = Arg(
                command=self,
                parameter=param,
                name=name,
                container=container,
                type=type,
                default=default,
                choices=choices,
                help=help,
                inverse_help=inverse_help,
                short_option=short_option,
                long_option=long_option,
                inverse_option=inverse_option,
                action=action,
                nargs=nargs,
            )

        option_map = OrderedDict()
        for arg in args.values():
            for option in arg.options:
                option_map.setdefault(option, [])
                option_map[option].append(arg)

        for option, option_args in option_map.items():
            if len(option_args) > 1:
                names = ', '.join(a.parameter.name for a in option_args)
                message = (
                    'Option {option} of command {self.name} maps to multiple parameters: {names}')
                message = message.format_map(locals())
                raise CommandError(message)

        return args