Skip to content

Instantly share code, notes, and snippets.

@warmwaffles
Last active August 29, 2015 14:20
Show Gist options
  • Save warmwaffles/d3ac4ae8ce8a7aabdb02 to your computer and use it in GitHub Desktop.
Save warmwaffles/d3ac4ae8ce8a7aabdb02 to your computer and use it in GitHub Desktop.
#!/bin/bash
#
set -eo pipefail
[[ "$TRACE" ]] && set -x
usage() {
echo "Usage: notes [help|edit|ls|show] <name>"
echo "Show any notes / cheat notes you have"
}
edit() {
file="$HOME/.notes/$1.md"
mkdir -p $(dirname "$file")
$EDITOR $file
}
show() {
more ~/.notes/$1.md
}
list() {
tree -C ~/.notes/$1
}
cmd="$1"
case $cmd in
help)
usage
;;
edit)
edit $2
;;
ls)
list $2
;;
show)
show $2
;;
*)
show $cmd
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment