Skip to content

Instantly share code, notes, and snippets.

@rshipp
Created April 8, 2015 02:18
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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