#!/bin/zsh DEPENDENCIES+=() REQUIRED_ENV+=() use office/memo CHECK_ENVIRONMENT ##################################################################### OPEN_MEMO() { local MEMO_NAME=$(MEMO__LIST_ALL | FZF_TAIL '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" } ##################################################################### OPEN_MEMO $@