#!/usr/bin/env fish # This can be used to generate the correct `CUSTOM_EMOJIS = …` config flag based on a directory. it supports sub-directories too. # Once generated and pasted, paste your emoji to $CUSTOM_PATH/public/assets/img/emoji/*.png # By default this is /var/lib/forgejo/custom/public/assets/img/emoji function help printf %s\n "just run forgejo_emotes.fish " end function generate_emoji # the fact that I have to do this roundabout way of passing around data is a testament to how # I don't fully understand fish yet. Piping didn't work. set prelist (string split -r -f 2 -m1 / $argv[1]/**) set midlist (string split -r -f 1 -m1 . $prelist) set emojilist (string join ', ' $midlist) echo "copy below here ↓" printf %s\n "[ui]" "CUSTOM_EMOJIS = $emojilist" echo "copy above here ↑" end switch $argv case set -ql $_flag_h help case set -ql $argv[1] generate_emoji $argv case '*' help end