Skip to content

Instantly share code, notes, and snippets.

@ForeverZer0
Last active February 2, 2024 23:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ForeverZer0/f75bc52f5eb0c07f00d66728dfc8e511 to your computer and use it in GitHub Desktop.
Save ForeverZer0/f75bc52f5eb0c07f00d66728dfc8e511 to your computer and use it in GitHub Desktop.
Simple helper to download RimWorld mods via the terminal from SteamWorkshop.
#!/usr/bin/env bash
# Downloads a RimWorld mod from a SteamWorkshop URL
#
# Usage: rimmod URL [URL2 [URL3]]]
# Example: rimmod https://steamcommunity.com/sharedfiles/filedetails/?id=2009463077
#
# Requires steamcmd to be installed and in $PATH
# Mods will be installed in the Steam folder. (i.e. ~/.steam/SteamApps/workshop/content/294100/)
function rimmod() {
app_id=294100
if [[ $# -eq 0 ]]; then
echo "Expected one or more SteamWorkshop URL(s)"
exit 1
fi
cmds="steamcmd +login anonymous"
for arg in "$@"; do
mod_id=$(echo "$arg" | grep -oP 'id=\K([0-9]+)')
if [ -z "$mod_id" ]; then
echo "Failed to parse $arg"
exit 1
fi
cmds="$cmds +workshop_download_item $app_id $mod_id"
done
eval "$cmds +quit"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment