feat: validate Title for new note & task
This commit is contained in:
parent
36c7057eb1
commit
f5f4414254
2 changed files with 12 additions and 0 deletions
6
notes.sh
6
notes.sh
|
@ -28,6 +28,12 @@ function editFile() {
|
|||
function createNote() {
|
||||
{
|
||||
read -p "Create new note: " title
|
||||
|
||||
if [ "$title" = "" ]; then
|
||||
echo "Title cannot be empty."
|
||||
exit;
|
||||
fi;
|
||||
|
||||
file_name=$title.md
|
||||
full_path="${notes_dir}/${file_name}"
|
||||
|
||||
|
|
6
tasks.sh
6
tasks.sh
|
@ -29,6 +29,12 @@ function editFile() {
|
|||
function createTask() {
|
||||
{
|
||||
read -p "Create new task: " title
|
||||
|
||||
if [ "$title" = "" ]; then
|
||||
echo "Title cannot be empty."
|
||||
exit;
|
||||
fi;
|
||||
|
||||
file_name=$title.md
|
||||
full_path="${tasks_dir}/${file_name}"
|
||||
|
||||
|
|
Loading…
Reference in a new issue