mirror of https://git.envs.net/envs/burrow.git
correct config load scope
This commit is contained in:
parent
0302ce41ed
commit
7fe062ff0d
52
burrow
52
burrow
|
@ -1,9 +1,9 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
shopt -s extglob
|
shopt -s extglob
|
||||||
configfiles="$HOME/.config/burrow $HOME/.burrow"
|
configfiles="$HOME/.config/burrow/config $HOME/.config/burrow $HOME/.burrow"
|
||||||
editor=${EDITOR:-vi}
|
editor=${EDITOR:-vi}
|
||||||
location_gopher="${location_gopher}"
|
location_gopher="$HOME/gopher"
|
||||||
location_recipebox="${location_gopher}/recipebox"
|
location_recipebox="${location_gopher}/recipebox"
|
||||||
location_phlog="${location_gopher}/phlog"
|
location_phlog="${location_gopher}/phlog"
|
||||||
custom_editor=""
|
custom_editor=""
|
||||||
|
@ -13,31 +13,6 @@ verbose=0
|
||||||
recipe=0
|
recipe=0
|
||||||
phlog=0
|
phlog=0
|
||||||
|
|
||||||
function read_config() {
|
|
||||||
for configfile in $configfiles
|
|
||||||
do
|
|
||||||
if [[ -f $configfile ]]
|
|
||||||
then
|
|
||||||
while IFS='= ' read lhs rhs
|
|
||||||
do
|
|
||||||
if [[ $lhs != *( )#* ]]
|
|
||||||
then
|
|
||||||
case $lhs in
|
|
||||||
"location_gopher"|"location_recipebox"|"location_phlog"|"git_commit"|"git_push"|"custom_editor")
|
|
||||||
declare $lhs=$rhs
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
done < "$configfile"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [[ $custom_editor ]]
|
|
||||||
then
|
|
||||||
editor=$custom_editor
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
function show_help() {
|
function show_help() {
|
||||||
cat > /dev/stdout << END
|
cat > /dev/stdout << END
|
||||||
${0} [-h] [phlog|-p] [recipe|-r]
|
${0} [-h] [phlog|-p] [recipe|-r]
|
||||||
|
@ -216,6 +191,29 @@ function main() {
|
||||||
set -x
|
set -x
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
for configfile in $configfiles
|
||||||
|
do
|
||||||
|
if [[ -f $configfile ]]
|
||||||
|
then
|
||||||
|
while IFS='= ' read lhs rhs
|
||||||
|
do
|
||||||
|
if [[ $lhs != *( )#* ]]
|
||||||
|
then
|
||||||
|
case $lhs in
|
||||||
|
"location_gopher"|"location_recipebox"|"location_phlog"|"git_commit"|"git_push"|"custom_editor")
|
||||||
|
declare $lhs=$rhs
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
done < "$configfile"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ $custom_editor ]]
|
||||||
|
then
|
||||||
|
editor=$custom_editor
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ ${recipe} -gt 0 ]]
|
if [[ ${recipe} -gt 0 ]]
|
||||||
then
|
then
|
||||||
recipe_new
|
recipe_new
|
||||||
|
|
Loading…
Reference in New Issue