Skip to content

Instantly share code, notes, and snippets.

@rshipp
Created April 8, 2015 02:18
Show Gist options
  • Save rshipp/fffd6ab4ff53a3410939 to your computer and use it in GitHub Desktop.
Save rshipp/fffd6ab4ff53a3410939 to your computer and use it in GitHub Desktop.
An interactive shell for Betty - https://github.com/pickhardt/betty
#!/bin/bash
# interactive betty shell
BETTYSH_PS1=${BETTYSH_PS1:-betty$ }
install_betty() {
echo "==> Installing betty..."
git clone https://github.com/pickhardt/betty ~/.betty || return $?
echo "==> Done."
}
betty_repl() {
while read -p "$BETTYSH_PS1" instructions; do
$betty $instructions
done
}
die() {
echo "==> Fatal error! Exiting."
exit 1
}
main() {
[[ -e ~/.betty ]] && export betty=~/.betty/main.rb || install_betty || die
betty_repl
}
main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment