From 8e80937db089188ef6dea2469aa49952178b8379 Mon Sep 17 00:00:00 2001 From: ER Date: Sun, 13 Aug 2023 17:20:25 +0300 Subject: [PATCH] docs: better inline docs and prints --- build.sh | 11 ++++++++--- config/recipe.yml | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/build.sh b/build.sh index 587f1b3b67..cbb0292bb9 100644 --- a/build.sh +++ b/build.sh @@ -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 @@ -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 \ No newline at end of file diff --git a/config/recipe.yml b/config/recipe.yml index 62aa62ab76..53476a7cd3 100644 --- a/config/recipe.yml +++ b/config/recipe.yml @@ -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 \ No newline at end of file