From b68db8cdc1c41ddad3e492e07237d3fed8528206 Mon Sep 17 00:00:00 2001 From: Oleksandr Smirnov Date: Wed, 25 Jun 2025 00:05:39 +0300 Subject: [PATCH] todo: update config; refactor actions --- config/todo/actions/@ | 2 +- config/todo/actions/e | 3 +++ config/todo/actions/next | 3 +++ config/todo/actions/url | 9 +++++++-- config/todo/config | 4 +++- 5 files changed, 17 insertions(+), 4 deletions(-) create mode 100755 config/todo/actions/e create mode 100755 config/todo/actions/next diff --git a/config/todo/actions/@ b/config/todo/actions/@ index 79f767e..cdd2405 100755 --- a/config/todo/actions/@ +++ b/config/todo/actions/@ @@ -21,6 +21,6 @@ for context in $CONTEXTS ; do CONTEXT_LIST=$(_list "$TODO_FILE" "@$context\b" "$@" | sed 's/\ *@[a-zA-Z0-9._\-]*\ */ /g') if [[ -n "${CONTEXT_LIST}" ]]; then echo -e "--@${context}" - echo "${CONTEXT_LIST}" | eval $TODOTXT_FINAL_FILTER + echo "${CONTEXT_LIST}" | eval "$TODOTXT_FINAL_FILTER" fi done diff --git a/config/todo/actions/e b/config/todo/actions/e new file mode 100755 index 0000000..87b991f --- /dev/null +++ b/config/todo/actions/e @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +$EDITOR "$TODO_FILE" diff --git a/config/todo/actions/next b/config/todo/actions/next new file mode 100755 index 0000000..5f7a499 --- /dev/null +++ b/config/todo/actions/next @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +exec "$TODO_SH" @ next diff --git a/config/todo/actions/url b/config/todo/actions/url index 707a627..d27051c 100755 --- a/config/todo/actions/url +++ b/config/todo/actions/url @@ -8,8 +8,13 @@ if [[ $action == "usage" ]]; then fi item=$1 +if [[ $item == "" ]]; then + TODOTXT_VERBOSE=0 $TODO_FULL_SH ls @url + exit 0 +fi + if [[ ! "$item" =~ ^[0-9]+$ ]]; then - echo "$item: invalid item number" + echo "provided [task_number] is invalid: $item" exit 1 fi @@ -21,7 +26,7 @@ if [[ -z "$URL" ]]; then exit 1 fi -if [[ ! "#URL" =~ ^(?!https?:\/\/) ]]; then +if [[ ! "$URL" =~ ^(?!https?:\/\/) ]]; then URL="https://$URL" fi diff --git a/config/todo/config b/config/todo/config index c7e3a78..d99347c 100644 --- a/config/todo/config +++ b/config/todo/config @@ -2,11 +2,13 @@ # reference: /etc/todo/config export TODO_ACTIONS_DIR="$HOME/.dotfiles/config/todo/actions" +export TODOTXT_DEFAULT_ACTION="next" -export TODO_DIR=~/org/ +export TODO_DIR=~/org export TODO_FILE="$TODO_DIR/todo.txt" export DONE_FILE="$TODO_DIR/done.txt" export REPORT_FILE="$TODO_DIR/.report.txt" +export HABIT_FILE="$TODO_DIR/habits.txt" export PRI_A=$YELLOW export PRI_B=$PURPLE