allow passing blueprint file names into install because ivy wanted me to make a pr for this

This commit is contained in:
0x7d8 2024-06-16 23:04:49 +02:00
parent ed9ecf5744
commit 25527bbb17
No known key found for this signature in database

View file

@ -357,8 +357,11 @@ if [[ ( $2 == "-i" ) || ( $2 == "-install" ) || ( $2 == "-add" ) ]]; then VCMD="
else else
dev=false dev=false
n="$3" n="$3"
FILE="${n}.blueprint" FILE="${n}"
if [[ ( $FILE == *".blueprint.blueprint" ) && ( $n == *".blueprint" ) ]]; then PRINT FATAL "Argument one must not end with '.blueprint'.";exit 2; fi
if [[ $n == *"."* ]] && [[ $n != *".blueprint" ]]; then PRINT FATAL "Extension filenames must end with '.blueprint'.";exit 2;fi
if [[ ! -f "$FILE" ]]; then FILE="${n}.blueprint";fi
if [[ ! -f "$FILE" ]]; then PRINT FATAL "$FILE could not be found or detected.";exit 2;fi if [[ ! -f "$FILE" ]]; then PRINT FATAL "$FILE could not be found or detected.";exit 2;fi
ZIP="${n}.zip" ZIP="${n}.zip"
@ -1440,13 +1443,12 @@ if [[ ( $2 == "-r" ) || ( $2 == "-remove" ) ]]; then VCMD="y"
if [[ $(( $# - 2 )) != 1 ]]; then PRINT FATAL "Expected 1 argument but got $(( $# - 2 )).";exit 2;fi if [[ $(( $# - 2 )) != 1 ]]; then PRINT FATAL "Expected 1 argument but got $(( $# - 2 )).";exit 2;fi
# Check if the extension is installed. # Check if the extension is installed.
if [[ $FILE == *".blueprint" ]]; then FILE="${FILE::-10}"; fi
if [[ $(cat ".blueprint/extensions/blueprint/private/db/installed_extensions") != *"$3,"* ]]; then if [[ $(cat ".blueprint/extensions/blueprint/private/db/installed_extensions") != *"$3,"* ]]; then
PRINT FATAL "'$3' is not installed or detected." PRINT FATAL "'$3' is not installed or detected."
exit 2 exit 2
fi fi
if [[ ( $FILE == *".blueprint" ) ]]; then PRINT FATAL "Argument one must not end with '.blueprint'.";exit 2; fi
if [[ -f ".blueprint/extensions/$3/private/.store/conf.yml" ]]; then if [[ -f ".blueprint/extensions/$3/private/.store/conf.yml" ]]; then
eval "$(parse_yaml ".blueprint/extensions/$3/private/.store/conf.yml" conf_)" eval "$(parse_yaml ".blueprint/extensions/$3/private/.store/conf.yml" conf_)"
# Add aliases for config values to make working with them easier. # Add aliases for config values to make working with them easier.