diff --git a/bin/riesel b/bin/riesel new file mode 100755 index 0000000..3e3c150 --- /dev/null +++ b/bin/riesel @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +# Looks for the Rocket.toml and uses the database url in it to run diesel +# commands. + +while [ ! -f Rocket.toml ]; do + cd .. + + if [ "$PWD" == "/" ]; then + echo -e >&2 "\033[31;1merror:\033[0m unable to find a Rocket.toml" + exit 1 + fi +done + +url=$(cat Rocket.toml | grep url | cut -d '"' -f 2) + +diesel --database-url $url $@