v2.4.0
===================================================================== --- New Scripts -------------------------- zsh ) memo program; quickly take notes! - memo/open - memo/remove
This commit is contained in:
32
zsh/memo/remove
Executable file
32
zsh/memo/remove
Executable 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 $@
|
Reference in New Issue
Block a user