toyotacorolla

vroom
git clone https://git.davidvoz.net/toyotacorolla.git
Log | Files | Refs

note (647B)


      1 #!/bin/sh
      2 # this is a modified version of swindlesmccoop's note program
      3 #
      4 # $ note [enter message here]
      5 # this will have the message automatically added
      6 #
      7 # $ note -p 
      8 # will print out the notes 
      9 #
     10 # $ note
     11 # takes you to a nvim edit to add your note
     12 
     13 NOTES_FILE=$HOME/misc/notes
     14 
     15 if [ "$*" = "-p" ]; then
     16 	cat "$NOTES_FILE"
     17 	exit 0
     18 fi
     19 
     20 if [ "$#" -ge 1 ]; then
     21 	echo "[$(date)]" >> "$NOTES_FILE"
     22 	echo "$*" >> "$NOTES_FILE"
     23 	echo "" >> "$NOTES_FILE"
     24 	exit 0
     25 fi
     26 
     27 nvim +startinsert /tmp/note_temp
     28 
     29 if [ -s /tmp/note_temp ]; then
     30 	echo "[$(date)]" >> "$NOTES_FILE"
     31 	cat /tmp/note_temp >> "$NOTES_FILE"
     32 	echo "" >> "$NOTES_FILE"
     33 	rm /tmp/note_temp
     34 fi