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
1 changed files with 13 additions and 5 deletions
18
yadm
18
yadm
|
@ -251,11 +251,19 @@ function record_score() {
|
|||
done
|
||||
# if we don't find an existing index, create one by appending to the array
|
||||
if [ "$index" -eq -1 ]; then
|
||||
alt_targets+=("$tgt")
|
||||
# set index to the last index (newly created one)
|
||||
for index in "${!alt_targets[@]}"; do :; done
|
||||
# and set its initial score to zero
|
||||
alt_scores[$index]=0
|
||||
# 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")
|
||||
# set index to the last index (newly created one)
|
||||
for index in "${!alt_targets[@]}"; do :; done
|
||||
# and set its initial score to zero
|
||||
alt_scores[$index]=0
|
||||
fi
|
||||
fi
|
||||
|
||||
# record nothing if a template command is registered for this file
|
||||
|
|
Loading…
Reference in a new issue