#!/bin/zsh use office/memo ##################################################################### MAIN() { local MEMO_NAME=$(MEMO__LIST_ALL | FZF_USER_INPUT 'select/create a memo') [ ! "$MEMO_NAME" ] && ABORT MEMO_FILE="$MEMO__DIR/$MEMO_NAME.$MEMO__FILETYPE" [ ! -f $MEMO_FILE ] && { STATUS "creating memo '$MEMO_NAME'" echo "# $MEMO_NAME" > "$MEMO_FILE" \ && SUCCESS "created memo '$MEMO_NAME'" \ || FAIL 1 "failed to create '$MEMO_FILE'" \ ; } DATESTRING="## $(date '+%A, %B %-d, %Y')" grep -q "$DATESTRING" "$MEMO_FILE" || echo "$DATESTRING" >> "$MEMO_FILE" EDIT "$MEMO_FILE" }