Skip to content

Commit

Permalink
handle different option chars in rm
Browse files Browse the repository at this point in the history
some general improvements
  • Loading branch information
v4hn committed Jan 31, 2022
1 parent 82f85ae commit 41bd355
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions snotes
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,14 @@ changed|c)
file="changed:${select%${SNOTES_OPTION_CHAR}*}"
;;
remove|rm)
[ ! -e "${select% *}" ] && die "file '`pwd`/${select% *}' doesn't exists"
while [ "$rmselect" != "NO" -a "$rmselect" != "YES" ]; do
rmselect=`echo -e 'NO\nYES' | dmenu ${DMENU_ARGS} -i -p "Do you want to remove '${select% *}' note?"`
[ -z "$rmselect" ] && exit 0
real_file="${select%${SNOTES_OPTION_CHAR}*}"
[ ! -e "$real_file" ] && die "file '$SNOTES_DB/$real_file' does not exist"
rmselect=""
while [ "$rmselect" != "YES" ]; do
rmselect=`echo -e 'NO\nYES' | dmenu ${DMENU_ARGS} -i -p "Do you want to remove '$real_file'?"`
[ -z "$rmselect" -o "$rmselect" = "NO" ] && exit 0
done
[ "$rmselect" = "NO" ] && exit 0
file="remove:${select% *}"
file="remove:$real_file"
;;
*)
file="note:${select}"
Expand Down

0 comments on commit 41bd355

Please sign in to comment.