Created
July 7, 2021 22:17
-
-
Save Reyuu/9eb0202f6f91c0052f29a67b7e56e213 to your computer and use it in GitHub Desktop.
Creates package.json for Aseprite for GPL palettes extension.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Creates package.json for Aseprite. Put GPL palettes and this script in one folder in extensions folder. | |
# Example: | |
# extensions/imported-palettes | |
# extensions/imported-palettes/my_palette.gpl | |
# extensions/imported-palettes/generate_aseprite_package.sh | |
# | |
# then | |
# | |
# chmod +x generate_aseprite_package.sh | |
# ./generate_aseprite_package.sh | |
gpls=$(ls | grep .gpl) | |
gpls=($gpls) | |
last_gpl=${gpls[-1]} | |
cat > package.json << EOF | |
{ | |
"name": "imported-palettes", | |
"displayName": "Imported palettes", | |
"description": "Personal palettes", | |
"version": "1.0", | |
"publisher": "aseprite", | |
"categories": [ | |
"Palettes" | |
], | |
"contributes": { | |
"palettes": [ | |
EOF | |
for item in ${gpls[@]}; do | |
name=${item/.gpl/} | |
name=${name//-/ } | |
name=[I]${name^} | |
if [[ $last_gpl != $item ]] | |
then | |
echo "{ \"id\": \"$name\", \"path\": \"./$item\" }," >> package.json | |
fi | |
if [[ $last_gpl == $item ]] | |
then | |
echo "{ \"id\": \"$name\", \"path\": \"./$item\" }" >> package.json | |
fi | |
done | |
cat >> package.json << EOF | |
] | |
} | |
} | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment