mirror of
https://github.com/TheLocehiliosan/yadm
synced 2024-10-27 20:34:27 +00:00
Process config alt before any other.
This allows to version the configuration, using alt and to still be able to use those configuration values in esh template (using <% yamd config some-config %> )
This commit is contained in:
parent
f348e154c7
commit
bea6e5506a
8
yadm
8
yadm
@ -251,12 +251,20 @@ function record_score() {
|
|||||||
done
|
done
|
||||||
# if we don't find an existing index, create one by appending to the array
|
# if we don't find an existing index, create one by appending to the array
|
||||||
if [ "$index" -eq -1 ]; then
|
if [ "$index" -eq -1 ]; then
|
||||||
|
# The configuration must be the first alt of the list.
|
||||||
|
# This ensures that if any templates uses "yadm config some-confid", the config will be available.
|
||||||
|
if [ "$tgt" = "$YADM_DIR/.config/yadm/config" ]; then
|
||||||
|
alt_targets=("$tgt" "${alt_targets[@]}")
|
||||||
|
alt_scores=(0 "${alt_scores[@]}")
|
||||||
|
index=0
|
||||||
|
else
|
||||||
alt_targets+=("$tgt")
|
alt_targets+=("$tgt")
|
||||||
# set index to the last index (newly created one)
|
# set index to the last index (newly created one)
|
||||||
for index in "${!alt_targets[@]}"; do :; done
|
for index in "${!alt_targets[@]}"; do :; done
|
||||||
# and set its initial score to zero
|
# and set its initial score to zero
|
||||||
alt_scores[$index]=0
|
alt_scores[$index]=0
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# record nothing if a template command is registered for this file
|
# record nothing if a template command is registered for this file
|
||||||
[ "${alt_template_cmds[$index]+isset}" ] && return
|
[ "${alt_template_cmds[$index]+isset}" ] && return
|
||||||
|
Loading…
Reference in New Issue
Block a user