Add extends interface.

This commit is contained in:
Llewellyn van der Merwe 2024-06-05 15:49:59 +02:00
parent ed1cd4fffa
commit edc01a5372
Signed by: Llewellyn
GPG Key ID: A9201372263741E7

View File

@ -3,7 +3,7 @@
# Program name
PROGRAM_NAME="OctoPower"
PROGRAM_CODE="octopower"
PROGRAM_VERSION="1.0.0"
PROGRAM_VERSION="1.0.1"
PROGRAM_V="1.0"
PROGRAM_URL="https://git.vdm.dev/octoleo/${PROGRAM_CODE}"
@ -265,7 +265,9 @@ function loadChildrenPowers() {
local has_error
local children_loaded
# some local vars
local guids
local extends
local extends_interfaces
local implements
local use_selection
local load_selection
@ -302,6 +304,7 @@ function loadChildrenPowers() {
power_data="${VDM_POWER_DATA}"
# get th values if set
setValueFromJson 'VDM_POWER_EXTENDS' '.extends' "${power_data}"
setValueFromJson 'VDM_POWER_EXTENDS_INTERFACES' '.extendsinterfaces' "${power_data}"
setValueFromJson 'VDM_POWER_IMPLEMENTS' '.implements' "${power_data}"
setValueFromJson 'VDM_POWER_USE_SELECTION' '.use_selection' "${power_data}"
setValueFromJson 'VDM_POWER_LOAD_SELECTION' '.load_selection' "${power_data}"
@ -313,12 +316,20 @@ function loadChildrenPowers() {
# check if we have VDM_POWER_EXTENDS
# we must add these locally to avoid collusion
extends="${VDM_POWER_EXTENDS:-0}"
extends_interfaces="${VDM_POWER_EXTENDS_INTERFACES:-null}"
implements="${VDM_POWER_IMPLEMENTS:-null}"
use_selection="${VDM_POWER_USE_SELECTION:-null}"
load_selection="${VDM_POWER_LOAD_SELECTION:-null}"
if [ "${extends}" != "0" ]; then
loadPower "${extends}"
fi
# Process the JSON array in extends_interfaces if it's not empty or null
if [ "${extends_interfaces}" != "null" ]; then
guids=$(echo "${extends_interfaces}" | jq -r '.[]')
for guid in $guids; do
loadPower "$guid"
done
fi
# Process the JSON array in implements if it's not empty or null
if [ "${implements}" != "null" ]; then
guids=$(echo "${implements}" | jq -r '.[]')