I love this - and ran away with it a bit - here is a version that also allows editing in vim and making the notes distributable with git. Also lets you serve a pretty version with grip if you have it.
#!/bin/bash
note(){# start a new heading and append from stdoutif[!-z"$1"];then
clear
echo"">>"$HOME/notes/notes.md"echo"## $@">>"$HOME/notes/notes.md"cat"$HOME/notes/notes.md"cat - >>"$HOME/notes/notes.md"
clear
cat"$HOME/notes/notes.md"# append to file from stdoutelse
clear
cat"$HOME/notes/notes.md"cat - >>"$HOME/notes/notes.md"
clear
cat"$HOME/notes/notes.md"fi}
notes(){cur_dir=$(pwd)if[!-z"$1"];then# commit and push if args are exactly "push"if["$1"="push"];then
cd"$HOME/notes"
git add -A
git commit -m"update notes"
git push
cd$cur_dir# pull from github if args are exactly "pull"elif["$1"="pull"];then
cd"$HOME/notes"
git pull
cd$cur_dir# serve with grip if args are exactly "serve"elif["$1"="serve"];then
open "http://localhost:6419"
grip "$HOME/notes/notes.md"# open vim to search of the argselse
escaped=$(echo"$@" | sed s/\ /\\\\\ /g)echo$escaped
vim +/"$escaped""$HOME/notes/notes.md"fi# just open the noteselse
vim + "$HOME/notes/notes.md"fi}
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I love this - and ran away with it a bit - here is a version that also allows editing in vim and making the notes distributable with git. Also lets you serve a pretty version with grip if you have it.