Created
September 30, 2022 22:04
-
-
Save ecliptik/03e720341efa786e4e53e6b1f9ca2651 to your computer and use it in GitHub Desktop.
Genreate emoji pack for Pleroma
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/sh | |
#Run within a directory containing emoji to add to Pleroma | |
#Directoutput to `pack.json` | |
#Get files | |
files=$(ls *.png) | |
numfiles=$(echo ${files} | sed -e "s/ /\n/g" | wc -l | sed -e "s/ //g") | |
#Prepend JSON header | |
cat << _EOF | |
{ | |
"files": { | |
_EOF | |
#Loop through and create emoji list | |
count=${numfiles} | |
for file in ${files}; do | |
emoji=$(echo ${file} | awk -F. '{print $1}') | |
#don't add a , if last element | |
if [ ${count} -gt 1 ] | |
then | |
echo " ${emoji}: ${file}," | |
else | |
echo " ${emoji}: ${file}" | |
fi | |
let count-- | |
done | |
#Append JSON footer | |
cat << _EOF | |
}, | |
"pack": {}, | |
"files_count": ${numfiles} | |
} | |
_EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment