def apply2parser(cmd_proxy, parser):
    """
    Apply a CmdProxy's arguments and options
    to a parser of argparse.
    :type cmd_proxy: callable or CmdProxy
    :type parser: cmdtree.parser.AParser
    :rtype: cmdtree.parser.AParser
    """
    if isinstance(cmd_proxy, CmdProxy):
        parser_proxy = cmd_proxy.meta.parser
        _apply2parser(
            parser_proxy.arguments,
            parser_proxy.options,
            parser,
        )
    return parser
Apply a CmdProxy's arguments and options
    to a parser of argparse.
    :type cmd_proxy: callable or CmdProxy
    :type parser: cmdtree.parser.AParser
    :rtype: cmdtree.parser.AParser