=====================================================================

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

zsh )
  memo program; quickly take notes!
   - memo/open
   - memo/remove
This commit is contained in:
2022-08-10 00:46:07 -06:00
parent 96992e9344
commit a740a66870
3 changed files with 83 additions and 0 deletions

32
zsh/memo/remove Executable file
View File

@ -0,0 +1,32 @@
#!/bin/zsh
_DEPENDENCIES+=()
_REQUIRED_ENV+=()
source ${0:a:h}/common.zsh
#####################################################################
OPEN_MEMO() {
local MEMO_NAME=$(LIST_MEMOS | __FZF 'select a memo to delete')
local MEMO_FILE="$MEMO__DIR/$MEMO_NAME.$MEMO__FILETYPE"
[ "$MEMO_NAME" ] && [ -f "$MEMO_FILE" ] || __ABORT
__STATUS "--- START OF MEMO ---------------------------------------------------"
cat "$MEMO_FILE"
__STATUS "--- END OF MEMO -----------------------------------------------------"
__WARNING
__WARNING 'memos are not backed up by default; deletion is permanent!'
__WARNING
__yN 'are you sure you want to delete this memo?' || __ABORT
__STATUS "deleting memo '$MEMO_FILE'"
rm "$MEMO_FILE" \
&& __SUCCESS "removed memo '$MEMO_NAME'" \
|| __FAIL 1 "failed to remove memo '$MEMO_NAME'" \
;
}
#####################################################################
OPEN_MEMO $@