From 1c907840d143af70da269f9fc7a3647fca74f8d7 Mon Sep 17 00:00:00 2001 From: Ayo Date: Mon, 23 Jun 2025 20:10:47 +0200 Subject: [PATCH] feat(notes): new subcommand archive" --- notes.sh | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/notes.sh b/notes.sh index 86edb52..6bf6d66 100755 --- a/notes.sh +++ b/notes.sh @@ -112,6 +112,36 @@ elif [ "$1" = "remove" ] || [ "$1" = "rm" ]; then } done fi + +## ARCHIVE a note from a list +elif [ "$1" = "archive" ] || [ "$1" = "a" ]; then + files=( $notes_dir/*.md ) + notesSync + + if ! [ "$2" = "" ]; then + index=($2-1) + archive_file=${files[$index]} + echo "Archiving $archive_file" + mv "$archive_file" "${notes_dir}/archive/" + notesSync + else + PS3="Archive file #: " + echo "Please select a file to ARCHIVE." + select file in "${files[@]##*/}"; do + { + echo "Archiving $file" + mv "${notes_dir}/${file}" "${notes_dir}/archive/" + notesSync + break + } || + { + echo "bad choice" + break + } + done + fi + + ## CREATE a note (default) else createNote