yage
a740a66870
===================================================================== --- New Scripts -------------------------- zsh ) memo program; quickly take notes! - memo/open - memo/remove
33 lines
923 B
Bash
Executable File
33 lines
923 B
Bash
Executable File
#!/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 $@
|