feat: validate Title for new note & task

This commit is contained in:
Ayo Ayco 2025-06-23 20:35:29 +02:00
parent 36c7057eb1
commit f5f4414254
2 changed files with 12 additions and 0 deletions

View file

@ -28,6 +28,12 @@ function editFile() {
function createNote() { function createNote() {
{ {
read -p "Create new note: " title read -p "Create new note: " title
if [ "$title" = "" ]; then
echo "Title cannot be empty."
exit;
fi;
file_name=$title.md file_name=$title.md
full_path="${notes_dir}/${file_name}" full_path="${notes_dir}/${file_name}"

View file

@ -29,6 +29,12 @@ function editFile() {
function createTask() { function createTask() {
{ {
read -p "Create new task: " title read -p "Create new task: " title
if [ "$title" = "" ]; then
echo "Title cannot be empty."
exit;
fi;
file_name=$title.md file_name=$title.md
full_path="${tasks_dir}/${file_name}" full_path="${tasks_dir}/${file_name}"