Skip to content

Instantly share code, notes, and snippets.

@kalmanolah
Created December 20, 2013 22:18
Show Gist options
  • Save kalmanolah/8062546 to your computer and use it in GitHub Desktop.
Save kalmanolah/8062546 to your computer and use it in GitHub Desktop.
The alias He-Man would use to work with PostgreSQL. Comes with autocompletion.
#!/bin/bash
# What if He-Man used Postgres?
_he_man_autocomplete() {
COMPREPLY=("the Power of postGRESQL...")
return 0
}
By() {
if [[ $EUID -ne 0 ]]; then
echo ":-(" 1>&2
return 0
fi
if [[ $@ == "the Power of postGRESQL..." ]]; then
echo "I have the Power!!"
psql -U postgres
fi
}
complete -F _he_man_autocomplete By
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment