def get_resolved_config(
    egrc_path,
    examples_dir,
    custom_dir,
    use_color,
    pager_cmd,
    squeeze,
    debug=True,
):
    """
    Create a Config namedtuple. Passed in values will override defaults.

    This function is responsible for producing a Config that is correct for the
    passed in arguments. In general, it prefers first command line options,
    then values from the egrc, and finally defaults.

    examples_dir and custom_dir when returned from this function are fully
    expanded.
    """
    # Call this with the passed in values, NOT the resolved values. We are
    # informing the caller only if values passed in at the command line are
    # invalid. If you pass a path to a nonexistent egrc, for example, it's
    # helpful to know. If you don't have an egrc, and thus one isn't found
    # later at the default location, we don't want to notify them.
    inform_if_paths_invalid(egrc_path, examples_dir, custom_dir)

    # Expand the paths so we can use them with impunity later.
    examples_dir = get_expanded_path(examples_dir)
    custom_dir = get_expanded_path(custom_dir)

    # The general rule is: caller-defined, egrc-defined, defaults. We'll try
    # and get all three then use get_priority to choose the right one.

    egrc_config = get_egrc_config(egrc_path)

    resolved_examples_dir = get_priority(
        examples_dir,
        egrc_config.examples_dir,
        DEFAULT_EXAMPLES_DIR
    )
    resolved_examples_dir = get_expanded_path(resolved_examples_dir)

    resolved_custom_dir = get_priority(
        custom_dir,
        egrc_config.custom_dir,
        DEFAULT_CUSTOM_DIR
    )
    resolved_custom_dir = get_expanded_path(resolved_custom_dir)

    resolved_use_color = get_priority(
        use_color,
        egrc_config.use_color,
        DEFAULT_USE_COLOR
    )

    resolved_pager_cmd = get_priority(
        pager_cmd,
        egrc_config.pager_cmd,
        DEFAULT_PAGER_CMD
    )

    # There is no command line option for this, so in this case we will use the
    # priority: egrc, environment, DEFAULT.
    environment_editor_cmd = get_editor_cmd_from_environment()
    resolved_editor_cmd = get_priority(
        egrc_config.editor_cmd,
        environment_editor_cmd,
        DEFAULT_EDITOR_CMD
    )

    color_config = None
    if resolved_use_color:
        default_color_config = get_default_color_config()
        color_config = merge_color_configs(
            egrc_config.color_config,
            default_color_config
        )

    resolved_squeeze = get_priority(
        squeeze,
        egrc_config.squeeze,
        DEFAULT_SQUEEZE
    )

    # Pass in None, as subs can't be specified at the command line.
    resolved_subs = get_priority(
        None,
        egrc_config.subs,
        get_default_subs()
    )

    result = Config(
        examples_dir=resolved_examples_dir,
        custom_dir=resolved_custom_dir,
        color_config=color_config,
        use_color=resolved_use_color,
        pager_cmd=resolved_pager_cmd,
        editor_cmd=resolved_editor_cmd,
        squeeze=resolved_squeeze,
        subs=resolved_subs,
    )

    return result

    Create a Config namedtuple. Passed in values will override defaults.

    This function is responsible for producing a Config that is correct for the
    passed in arguments. In general, it prefers first command line options,
    then values from the egrc, and finally defaults.

    examples_dir and custom_dir when returned from this function are fully
    expanded.
    
eg/config.py