Last active
September 23, 2015 02:22
-
-
Save sts10/8970781 to your computer and use it in GitHub Desktop.
Jot v 0.0.3 -- A note-taking script. Can be pasted into your .bash_profile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function jot { | |
MAP="/Users/samschlinkert/Documents/code/jot/path.txt" | |
JOT_ROUTE=$(<$MAP) | |
if [[ $1 == here ]] | |
then | |
NEW_PATH=$(pwd) | |
echo "$NEW_PATH/" > $MAP | |
echo "Now jotting in "$NEW_PATH | |
elif [[ $1 == where ]] | |
then | |
echo "You're jotting in "$JOT_ROUTE | |
echo "Do you want to go there? (y/n) " | |
read -p "" -n 1 -r | |
echo '' # move to a new line | |
if [[ $REPLY =~ ^[Yy]$ ]] | |
then | |
cd $JOT_ROUTE | |
fi | |
elif [[ $1 == help ]] | |
then | |
echo "jot here to place the jot." | |
echo "jot where to ask where you're currently jotting." | |
echo "jot <file name, no extension> to jot a new file." | |
elif [[ $1 == all ]] | |
then | |
mvim $JOT_ROUTE | |
else | |
INPUT=$* | |
NOTE_TITLE=${INPUT// /-} # replace all spaces with hyphens | |
touch $JOT_ROUTE"$NOTE_TITLE".mdown | |
mvim $JOT_ROUTE"$NOTE_TITLE".mdown | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment