dotfiles/bin/riesel

18 lines
367 B
Plaintext
Raw Normal View History

2020-01-15 11:41:11 +01:00
#!/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 $@