From 595fdea93c199a1867722d0bdbd5e4420e40b62f Mon Sep 17 00:00:00 2001 From: AgumasD Date: Tue, 24 Dec 2024 16:38:07 +0300 Subject: [PATCH 1/3] added some basic usage example on readme --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index 594cb9e4..2601c7d9 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,18 @@ For example, to add a todo item, you can do: ```shell todo.sh add "THING I NEED TO DO +project @context" ``` +### `replace` +Replaces task on line ITEM# with UPDATED TODO. + +```shell +todo.sh replace ITEM# "UPDATED TODO" +``` +### `report` +Adds the number of open tasks and done tasks to report.txt. + +```shell +todo.sh report +``` Read about all the possible commands in the [USAGE][USAGE] file. From 677e5ecf45b9e872fcc87841ae1165b6f3d9f609 Mon Sep 17 00:00:00 2001 From: AgumasD Date: Fri, 27 Dec 2024 11:48:48 +0300 Subject: [PATCH 2/3] Add a search Command --- todo.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/todo.sh b/todo.sh index 026739a5..ab7b426f 100755 --- a/todo.sh +++ b/todo.sh @@ -1089,6 +1089,13 @@ case $action in fi _addto "$TODO_FILE" "$input" ;; +"search") + shift + if [ -z "$1" ]; then + die "usage: $TODO_SH search [KEYWORD...]" + fi + grep -i "$@" "$TODO_FILE" + ;; "addm") if [[ -z "$2" && $TODOTXT_FORCE = 0 ]]; then From c70d3086e9026e8137d6b4fa06b8a6de32f593b6 Mon Sep 17 00:00:00 2001 From: AgumasD Date: Fri, 27 Dec 2024 12:08:02 +0300 Subject: [PATCH 3/3] Add a renameproj Command to todo.sh file --- todo.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/todo.sh b/todo.sh index ab7b426f..4d78ebc7 100755 --- a/todo.sh +++ b/todo.sh @@ -1105,6 +1105,18 @@ case $action in shift input=$* fi +"renameproj") + if [ -z "$2" ]; then + die "usage: $TODO_SH renameproj +oldproject +newproject" + fi + old_project=$1 + new_project=$2 + if ! grep -q "$old_project" "$TODO_FILE"; then + die "Project $old_project not found in $TODO_FILE" + fi + sed -i.bak "s/$old_project/$new_project/g" "$TODO_FILE" + echo "Renamed project $old_project to $new_project in $TODO_FILE" + ;; # Set Internal Field Seperator as newline so we can # loop across multiple lines