bat-extras/lib/dirs.sh

19 lines
576 B
Bash
Raw Normal View History

2021-03-25 02:35:56 +01:00
#!/usr/bin/env bash
# -----------------------------------------------------------------------------
# bat-extras | Copyright (C) 2021 eth-p | MIT License
#
# Repository: https://github.com/eth-p/bat-extras
# Issues: https://github.com/eth-p/bat-extras/issues
# -----------------------------------------------------------------------------
# Gets a configuration directory for a command-line program.
# Arguments:
# 1 -- The program name.
config_dir() {
if [[ -n "${XDG_CONFIG_HOME+x}" ]]; then
echo "${XDG_CONFIG_HOME}/$1"
else
echo "${HOME}/.config/$1"
fi
}