Skip to content

Commit 4421ecc

Browse files
committed
feat query.sh: list extension apis
1 parent 8297871 commit 4421ecc

1 file changed

Lines changed: 41 additions & 0 deletions

File tree

scripts/commands/extensions/query.sh

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,47 @@ Command() {
3636
"\x1b[31;1m Utilizes extension scripts, which can be a safety risk. Extensions with installation scripts can cause conflicts and break other extensions. Learn more at \033[0;2mblueprint.zip/docs/?page=documentation/scripts\x1b[0;31;1m.\033[0m"
3737
fi
3838

39+
# Extension APIs
40+
echo -e "\n\x1b[1mExtension APIs:\033[0m"
41+
42+
local extension_apis
43+
for config_category in $conf__; do
44+
# $config_category is conf_info, conf_admin, etc. here
45+
config_category_="${config_category}_" # Contents of $config_category
46+
47+
if [[ ${config_category} != "conf_info" ]]; then
48+
for config_item in ${!config_category_}; do
49+
# $config_item is conf_info_name, conf_info_identifier, etc. here
50+
config_item_clean="${config_item//conf_/}" # Removed "conf_" from variable content
51+
config_item_="${config_item}_" # conf_requests_routers_ for example
52+
53+
if [[ ${!config_item_} != "" ]]; then
54+
local has_suboption=false
55+
# If extension api has suboptions, go through them
56+
for config_suboption in ${!config_item_}; do
57+
if [[ ${!config_suboption} != "" ]]; then
58+
has_suboption=true
59+
fi
60+
done
61+
if $has_suboption; then
62+
extension_apis+="${config_item_clean} "
63+
fi
64+
else
65+
PRINT DEBUG "${config_item_clean} :: ${!config_item}"
66+
67+
if [[ "${!config_item}" != "" ]]; then
68+
extension_apis+="${config_item_clean} "
69+
fi
70+
fi
71+
done
72+
fi
73+
done
74+
extension_apis=${extension_apis// /, }
75+
# shellcheck disable=SC2001
76+
extension_apis="$(echo "$extension_apis" | sed 's/,\([^,]*\)$/ \1/')"
77+
78+
echo -e "$extension_apis"
79+
3980
rm -R ".blueprint/tmp/$n"
4081
mkdir -p .blueprint/tmp
4182

0 commit comments

Comments
 (0)