zsh: ned: progress

This commit is contained in:
PowerUser64 2022-01-20 03:18:04 -08:00
parent 696bda73c7
commit 635b495e0a

View file

@ -2,20 +2,32 @@
# NEd: Note Editor (and your best friend!) # NEd: Note Editor (and your best friend!)
# Ned can edit and create notes in a folder you tell him to! # Ned can edit and create notes in a folder you tell him to!
NOTES_DIR="$HOME/Documents/college/2y/2q/" # shellcheck disable=SC2068
# set default value for $NOTES_DIR
${NOTES_DIR:="$HOME/Documents/college/2y/2q/"}
[ -d "$NOTES_DIR"/misc ] && mkdir "$NOTES_DIR/misc" [ -d "$NOTES_DIR"/misc ] && mkdir "$NOTES_DIR/misc"
# Create misc note if blank # Create misc note if no input
if [ -z "$1" ]; then if [ -z "$1" ]; then
"$EDITOR" "$NOTES_DIR/unsorted/$(date)" "$EDITOR" "$NOTES_DIR/unsorted/$(date)"
zsh zsh
fi fi
new() {
if [ -z "$1" ]; then
"$EDITOR" "$NOTES_DIR/unsorted/$(date)"
zsh
fi
"$EDITOR" "$NOTES_DIR/$2"*"/notes/$3"
}
# Parse arguments # Parse arguments
case "$1" in case "$1" in
# create and edit new note # create and edit new note
'new'|'n') "$EDITOR" "$NOTES_DIR"/*"$2"*/notes/"$3";; 'new'|'n') new $@;;
# edit ned # edit ned
'e') "$EDITOR" "$(realpath "$0")";; 'e') "$EDITOR" "$(realpath "$0")";;
*) echo "no such option";; *) echo "no such option";;