def make_parser(defaults=None):
    """
    :param defaults: Default option values
    """
    if defaults is None:
        defaults = DEFAULTS

    ctypes = API.list_types()
    ctypes_s = ", ".join(ctypes)
    type_help = "Select type of %s config files from " + \
        ctypes_s + " [Automatically detected by file ext]"

    mts = API.MERGE_STRATEGIES
    mts_s = ", ".join(mts)
    mt_help = "Select strategy to merge multiple configs from " + \
        mts_s + " [%(merge)s]" % defaults

    parser = argparse.ArgumentParser(usage=USAGE)
    parser.set_defaults(**defaults)

    parser.add_argument("inputs", type=str, nargs='*', help="Input files")
    parser.add_argument("--version", action="version",
                        version="%%(prog)s %s" % anyconfig.globals.VERSION)

    lpog = parser.add_argument_group("List specific options")
    lpog.add_argument("-L", "--list", action="store_true",
                      help="List supported config types")

    spog = parser.add_argument_group("Schema specific options")
    spog.add_argument("--validate", action="store_true",
                      help="Only validate input files and do not output. "
                           "You must specify schema file with -S/--schema "
                           "option.")
    spog.add_argument("--gen-schema", action="store_true",
                      help="Generate JSON schema for givne config file[s] "
                           "and output it instead of (merged) configuration.")

    gspog = parser.add_argument_group("Query/Get/set options")
    gspog.add_argument("-Q", "--query", help=_QUERY_HELP)
    gspog.add_argument("--get", help=_GET_HELP)
    gspog.add_argument("--set", help=_SET_HELP)

    parser.add_argument("-o", "--output", help="Output file path")
    parser.add_argument("-I", "--itype", choices=ctypes, metavar="ITYPE",
                        help=(type_help % "Input"))
    parser.add_argument("-O", "--otype", choices=ctypes, metavar="OTYPE",
                        help=(type_help % "Output"))
    parser.add_argument("-M", "--merge", choices=mts, metavar="MERGE",
                        help=mt_help)
    parser.add_argument("-A", "--args", help="Argument configs to override")
    parser.add_argument("--atype", choices=ctypes, metavar="ATYPE",
                        help=_ATYPE_HELP_FMT % ctypes_s)

    cpog = parser.add_argument_group("Common options")
    cpog.add_argument("-x", "--ignore-missing", action="store_true",
                      help="Ignore missing input files")
    cpog.add_argument("-T", "--template", action="store_true",
                      help="Enable template config support")
    cpog.add_argument("-E", "--env", action="store_true",
                      help="Load configuration defaults from "
                           "environment values")
    cpog.add_argument("-S", "--schema", help="Specify Schema file[s] path")
    cpog.add_argument("-e", "--extra-opts",
                      help="Extra options given to the API call, "
                           "--extra-options indent:2 (specify the "
                           "indent for pretty-printing of JSON outputs) "
                           "for example")
    cpog.add_argument("-v", "--verbose", action="count", dest="loglevel",
                      help="Verbose mode; -v or -vv (more verbose)")
    return parser
:param defaults: Default option values