all repos — dotfiles @ 048f69747b918284ff7856135fec4dc59c4a0cdd

linux dotfiles

bin/scripts/note

#!/bin/sh

remind_path=$HOME/.config/note
dmenu_cmd="dmenu $DMENU_ARGS -l 20 -h 20"
#dmenu_cmd="dmenu $DMENU_ARGS -l 20"
[ -e $remind_path ] || touch $remind_path

if [ $# -eq 0 ]; then
    output=$(cat $remind_path | $dmenu_cmd)
    [ $? -ne 0 ] && exit;
fi

case $output in
    add) echo -n "" | $dmenu_cmd -p "add note " >> $remind_path;;
    *) ans=$(echo -e "no\nyes" | $dmenu_cmd -p "Delete?")
       if [ $ans = "yes" ]; then
           sed -i "/$output/d" $remind_path
       else
           exit 0
       fi;;
esac