feat(notes): new subcommand archive"

This commit is contained in:
Ayo Ayco 2025-06-23 20:10:47 +02:00
parent d219cee89a
commit 1c907840d1

View file

@ -112,6 +112,36 @@ elif [ "$1" = "remove" ] || [ "$1" = "rm" ]; then
} }
done done
fi 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) ## CREATE a note (default)
else else
createNote createNote