Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save EoD/8f620ac41729ca2ffa95eda1297f9838 to your computer and use it in GitHub Desktop.
Save EoD/8f620ac41729ca2ffa95eda1297f9838 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -eEu
# Generate luacheckrc from BizHawk homepage
# Format is roughly
# </li></ul><div class="p"><b>movie.getrerecordcount</b><br />
# But there are some sentences as well, so make sure that no whitespace ("\S") is there and that there is a dot "\."
lua_functions="$(curl https://tasvideos.org/Bizhawk/LuaFunctions | grep -o "<div class=\"p\"><b>\S\+\.\S\+</b>" | sed 's,.*<b>\(.*\)</b>,\1,')"
echo "read_globals = {"
for object in $(awk -F. '{ print $1 }' <<< "${lua_functions}" | sort | uniq); do
echo " ${object} = {"
echo " fields = {"
grep "${object}" <<< "${lua_functions}" | awk -F. '{ print $2 }' | sort | uniq | while IFS= read -r field
do
echo " ${field} = {},"
done
echo " },"
echo " },"
done
echo "}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment