todo: update config; refactor actions

This commit is contained in:
Oleksandr Smirnov 2025-06-25 00:05:39 +03:00
parent d5d6748eb3
commit b68db8cdc1
No known key found for this signature in database
5 changed files with 17 additions and 4 deletions

View file

@ -21,6 +21,6 @@ for context in $CONTEXTS ; do
CONTEXT_LIST=$(_list "$TODO_FILE" "@$context\b" "$@" | sed 's/\ *@[a-zA-Z0-9._\-]*\ */ /g') CONTEXT_LIST=$(_list "$TODO_FILE" "@$context\b" "$@" | sed 's/\ *@[a-zA-Z0-9._\-]*\ */ /g')
if [[ -n "${CONTEXT_LIST}" ]]; then if [[ -n "${CONTEXT_LIST}" ]]; then
echo -e "--@${context}" echo -e "--@${context}"
echo "${CONTEXT_LIST}" | eval $TODOTXT_FINAL_FILTER echo "${CONTEXT_LIST}" | eval "$TODOTXT_FINAL_FILTER"
fi fi
done done

3
config/todo/actions/e Executable file
View file

@ -0,0 +1,3 @@
#!/usr/bin/env bash
$EDITOR "$TODO_FILE"

3
config/todo/actions/next Executable file
View file

@ -0,0 +1,3 @@
#!/usr/bin/env bash
exec "$TODO_SH" @ next

View file

@ -8,8 +8,13 @@ if [[ $action == "usage" ]]; then
fi fi
item=$1 item=$1
if [[ $item == "" ]]; then
TODOTXT_VERBOSE=0 $TODO_FULL_SH ls @url
exit 0
fi
if [[ ! "$item" =~ ^[0-9]+$ ]]; then if [[ ! "$item" =~ ^[0-9]+$ ]]; then
echo "$item: invalid item number" echo "provided [task_number] is invalid: $item"
exit 1 exit 1
fi fi
@ -21,7 +26,7 @@ if [[ -z "$URL" ]]; then
exit 1 exit 1
fi fi
if [[ ! "#URL" =~ ^(?!https?:\/\/) ]]; then if [[ ! "$URL" =~ ^(?!https?:\/\/) ]]; then
URL="https://$URL" URL="https://$URL"
fi fi

View file

@ -2,11 +2,13 @@
# reference: /etc/todo/config # reference: /etc/todo/config
export TODO_ACTIONS_DIR="$HOME/.dotfiles/config/todo/actions" 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 TODO_FILE="$TODO_DIR/todo.txt"
export DONE_FILE="$TODO_DIR/done.txt" export DONE_FILE="$TODO_DIR/done.txt"
export REPORT_FILE="$TODO_DIR/.report.txt" export REPORT_FILE="$TODO_DIR/.report.txt"
export HABIT_FILE="$TODO_DIR/habits.txt"
export PRI_A=$YELLOW export PRI_A=$YELLOW
export PRI_B=$PURPLE export PRI_B=$PURPLE