Skip to content
This repository has been archived by the owner on Nov 20, 2023. It is now read-only.

Commit

Permalink
docs: better inline docs and prints
Browse files Browse the repository at this point in the history
  • Loading branch information
xynydev committed Aug 13, 2023
1 parent 290075c commit 8e80937
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 8 additions & 3 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ MODULE_DIRECTORY="/tmp/modules"
# https://mikefarah.gitbook.io/yq/usage/tips-and-tricks#yq-in-a-bash-loop
get_yaml_array() {
# creates array $1 with content at key $2 from $3
readarray "$1" < <(echo "$3" | yq -o=j -I=0 "$2" )
readarray "$1" < <(echo "$3" | yq -o=j -I=0 "$2")
}
export -f get_yaml_array # this makes the function available to all modules

Expand All @@ -30,14 +30,19 @@ readarray MODULES < <(yq -o=j -I=0 '.modules[]' "$RECIPE_FILE" )
for MODULE in "${MODULES[@]}"; do
TYPE=$(echo "$MODULE" | yq '.type')
if [[ "$TYPE" != "null" ]]; then
echo "Launching module of type: $TYPE"
# If type is found, that means that the module config
# has been declared inline, and thus is safe to pass to the module
echo "=== Launching module of type: $TYPE ==="
bash "$MODULE_DIRECTORY/$TYPE/$TYPE.sh" "$MODULE"
else
# If the type is not found, that means that the module config
# is in a separate file, and has to be read from it
FILE=$(echo "$MODULE" | yq '.from-file')
MODULE_CONFIG=$(yq -o=j -I=0 '.' "$CONFIG_DIRECTORY/$FILE")

TYPE=$(echo "$MODULE_CONFIG" | yq '.type')
echo "Launching module of type: $TYPE"
echo "=== Launching module of type: $TYPE ==="
bash "$MODULE_DIRECTORY/$TYPE/$TYPE.sh" "$MODULE_CONFIG"
fi
echo "======"
done
2 changes: 1 addition & 1 deletion config/recipe.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ modules:
- ./autorun.sh post

- type: yafti # no need for an enable-disable key, inclusion implicitly enables
# config: yafti.yml # if not specified, would use a default config
# config: yafti.yml # if not specified, would use a default config TODO
custom-flatpaks:
- Celluloid: io.github.celluloid_player.Celluloid
- Krita: org.kde.krita

0 comments on commit 8e80937

Please sign in to comment.