summarylogtreecommitdiffstats
path: root/flags.sh
blob: fdaff68e54e3c5b01c1a22e6118a2eb79951b4c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/bin/bash

FLAGS_FILE="${XDG_CONFIG_HOME:-"${HOME}/.config"}/@NAME@-flags.conf"

[ -f "${FLAGS_FILE}" ] || exec '@EXEC@' "$@"

mapfile -t FLAGS_LINES < "${FLAGS_FILE}"
declare -a FLAGS

for line in "${FLAGS_LINES[@]}"; do
    [[ "${line}" =~ ^[[:space:]]*#.* ]] && continue
    FLAGS+=("${line}")
done

exec '@EXEC@' "${FLAGS[@]}" "$@"