From e6e81ec81a5462b5c31adbdb448940b9b092eec4 Mon Sep 17 00:00:00 2001 From: Ayo Date: Sun, 26 Oct 2025 16:38:15 +0100 Subject: [PATCH] chore: remove bkup tasks script --- tasks.sh.bkup | 126 -------------------------------------------------- 1 file changed, 126 deletions(-) delete mode 100755 tasks.sh.bkup diff --git a/tasks.sh.bkup b/tasks.sh.bkup deleted file mode 100755 index b209173..0000000 --- a/tasks.sh.bkup +++ /dev/null @@ -1,126 +0,0 @@ -#! /usr/bin/bash - -## tasks management - -# Load config -. ${HOME}/ayo.conf -. ${scripts_dir}/functions.sh - -# TODO: write log for echoes with >>> - -command=$1 - -getopts "t" typora; #check if -t flag is given - -function editFile() { - notesSync - - edit_file="${tasks_dir}/$1" - # Open in editor - if [ "$typora" = "t" ]; then - typora "$edit_file" - else - vim "$edit_file" - fi - - notesSync -} - -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}" - - # IF Not Exists: create file & echo date - if ! test -f "$full_path"; then - install -Dv /dev/null "$full_path" - # TODO: update to correct heading from old entries - heading="# $title" - echo $heading > "$full_path" - date_heading=$(date +'%b %d, %Y, %a %r') - echo $date_heading >> "$full_path" - fi - editFile "$full_path" - - } || { - echo ">>> New note failed" - } -} - - -## LIST tasks in directory -if [ "$1" = "list" ] || [ "$1" = "l" ]; then - files=( $tasks_dir/*.md ) - index=0 - notesSync - for file in "${files[@]##*/}"; do - ((index++)) - echo "$index) $file" - done - -## OPEN a note from a list -elif [ "$1" = "open" ] || [ "$1" = "o" ]; then - files=( $tasks_dir/*.md ) - PS3="Open file #: " - echo "Please select a file to OPEN." - notesSync - select file in "${files[@]##*/}"; do - { - editFile "$file" - break - } || - { - echo "bad choice" - break - } - done - -## MARK AS DONE a note from a list -elif [ "$1" = "done" ] || [ "$1" = "d" ]; then - files=( $tasks_dir/*.md ) - PS3="Mark as Done, file #: " - echo "Mark a task as DONE ($(ls ${notes_dir}/tasks/done | wc -l))." - notesSync - select file in "${files[@]##*/}"; do - { - mv "${tasks_dir}/${file}" "${tasks_dir}/done" - notesSync - break - } || - { - echo "bad choice" - break - } - done - - -## REMOVE a note from a list -elif [ "$1" = "remove" ] || [ "$1" = "rm" ]; then - files=( $tasks_dir/*.md ) - PS3="Remove file #: " - echo "Please select a file to REMOVE." - notesSync - select file in "${files[@]##*/}"; do - { - echo "Removing $file" - rm "${tasks_dir}/${file}" - notesSync - break - } || - { - echo "bad choice" - break - } - done - -## CREATE a note (default) -else - createTask -fi