scwrypts/zsh/memo/open
yage 6333a2f6b8 v2.5.0
=====================================================================

--- New Scripts --------------------------

zsh )
  vundle-vim helpers
   - vim/vundle/edit-build-actions
   - vim/vundle/install
   - vim/vundle/rebuild

  quick install-from-source scripts
   - git/package/install
   - git/package/build    (install --only-build)
   - git/package/download (install --only-pull)
   - git/package/update   (install --update)

  config sym-linker (for source-controlled .configs)
   - config/update    (symlinks + terminfo)
   - config/symlinks  (set all symlinks from settings)
   - config/settings  (edit settings which aren't scwrypts env variables)
   - config/terminfo  (load all terminfo from settings)

--- Changes ------------------------------

- helper comments are now inserted in all env files
- removed underscore prefix for standard AWS environment variables
- added "opening" and "finished editing" comments to __EDIT util
- added __USAGE to format $USAGE variable to std:err
- added __ERROR_CHECK to exit if any __ERROR(s) were called
2022-08-16 18:26:55 -06:00

31 lines
746 B
Bash
Executable File

#!/bin/zsh
_DEPENDENCIES+=()
_REQUIRED_ENV+=()
source ${0:a:h}/common.zsh
#####################################################################
OPEN_MEMO() {
local MEMO_NAME=$(LIST_MEMOS | __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 $@