X-Git-Url: http://www.git.stargrave.org/?p=t.git;a=blobdiff_plain;f=t;h=a1fcfc5ecf353914de6403b5f34dd897180a60c1;hp=3c23a9eb3d8f8761a4efe6e71420e9f593f9acdc;hb=HEAD;hpb=f2f4aa29ee5822d48fe9086d0d13f26a0c7f7ddf diff --git a/t b/t index 3c23a9e..1695e88 100755 --- a/t +++ b/t @@ -1,7 +1,7 @@ #!/usr/bin/env zsh # t -- simple notes manager -# Copyright (C) 2013-2022 Sergey Matveev -# Current version is written on zsh. Previous was on POSIX shell. +# Copyright (C) 2013-2024 Sergey Matveev +# Current version is written on Z shell. Previous was on POSIX shell. # # Usage: # * t -- just briefly print all notes: their number and stripped first @@ -25,8 +25,7 @@ # $ t # [0] some earlier default namespace note (1) -set -e -setopt NULL_GLOB +setopt ERR_EXIT NULL_GLOB NOTES_DIR=$HOME/.t/$N NOTES_DIR=${NOTES_DIR%/} @@ -51,14 +50,15 @@ get_note() { [[ ${#line} -le 70 ]] || print -n "... " lines=$(wc -l < $note) printf "(%d)\n" $lines - ctr=$(( ctr + 1 )) + (( ctr = ctr + 1 )) } exit } case $1 in (a) - note=$NOTES_DIR/$(date "+%Y%m%d-%H%M%S") + zmodload -F zsh/datetime b:strftime + note=$NOTES_DIR/$(strftime %Y%m%d-%H%M%S) [[ $# -gt 1 ]] && print -- ${@[2,-1]} > $note || $EDITOR $note ;; (d) get_note $2 ; rm -f $NOTE ;;