dotfiles/bin/riesel

18 lines
367 B
Bash
Executable File

#!/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 $@