Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

feature request neofetch --config returns the location of the config file #2457

Open
iconoclasthero opened this issue Mar 22, 2024 · 2 comments

Comments

@iconoclasthero
Copy link

Description

$ neofetch --config with no path specified (i.e., it should be called as $ neofetch --config /path/to/config.conf) should list the currently-used config file.

I think that occurs here and I could probably add it in a pull request...

get_user_config() {
    # --config /path/to/config.conf
    if [[ -f "$config_file" ]]; then
        source "$config_file"
        err "Config: Sourced user config. (${config_file})"
        return

    elif [[ -f "${XDG_CONFIG_HOME}/neofetch/config.conf" ]]; then
        source "${XDG_CONFIG_HOME}/neofetch/config.conf"
        err "Config: Sourced user config.    (${XDG_CONFIG_HOME}/neofetch/config.conf)"

    elif [[ -f "${XDG_CONFIG_HOME}/neofetch/config" ]]; then
        source "${XDG_CONFIG_HOME}/neofetch/config"
        err "Config: Sourced user config.    (${XDG_CONFIG_HOME}/neofetch/config)"

    elif [[ -z "$no_config" ]]; then
        config_file="${XDG_CONFIG_HOME}/neofetch/config.conf"

        # The config file doesn't exist, create it.
        mkdir -p "${XDG_CONFIG_HOME}/neofetch/"
        printf '%s\n' "$config" > "$config_file"
    fi
}

Neofetch version

7.1.0

Config file

That's what I'm looking for!

@iconoclasthero
Copy link
Author

get_user_config() {
    # --config /path/to/config.conf
    if [[ -f "$config_file" ]]; then
        source "$config_file"
        err "Config: Sourced user config. (${config_file})"
        config_file_path="$config_file"
        return

    elif [[ -f "${XDG_CONFIG_HOME}/neofetch/config.conf" ]]; then
        source "${XDG_CONFIG_HOME}/neofetch/config.conf"
        err "Config: Sourced user config.    (${XDG_CONFIG_HOME}/neofetch/config.conf)"
        config_file_path="${XDG_CONFIG_HOME}/neofetch/config.conf"


    elif [[ -f "${XDG_CONFIG_HOME}/neofetch/config" ]]; then
        source "${XDG_CONFIG_HOME}/neofetch/config"
        err "Config: Sourced user config.    (${XDG_CONFIG_HOME}/neofetch/config)"
        config_file_path="${XDG_CONFIG_HOME}/neofetch/config"

    elif [[ -z "$no_config" ]]; then
        config_file="${XDG_CONFIG_HOME}/neofetch/config.conf"
        config_file_path="${XDG_CONFIG_HOME}/neofetch/config.conf"

        # The config file doesn't exist, create it.
        mkdir -p "${XDG_CONFIG_HOME}/neofetch/"
        printf '%s\n' "$config" > "$config_file"
    fi
}

and from the end of the case statement:

          # Other
            "--config")
                case $2 in
                    "none" | "off") ;;
                    "") get_user_config; printf '\nThe location of the config file is %s\n\n' "$config_f>
                    *)
                        config_file="$(get_full_path "$2")"
                        get_user_config
                    ;;
                esac

@iconoclasthero iconoclasthero changed the title neofetch --config returns the location of the config file feature request neofetch --config returns the location of the config file Mar 22, 2024
@thomastubby
Copy link

Per the "Getting Started" page, the default config path is $HOME/.config/neofetch/config.conf
Using the --config flag does not result in a persistent change to the config path as it it must be specified each time when using neofetch.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants