Skip to content

Commit

Permalink
TEST: Revert "ENH: Allow concatenation of multiple priorities [-range…
Browse files Browse the repository at this point in the history
…s] for listpri"

This reverts commit ca444e4.
  • Loading branch information
inkarkat committed Sep 21, 2024
1 parent 447096c commit ef49e58
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 23 deletions.
20 changes: 0 additions & 20 deletions tests/t1250-listpri.sh
Original file line number Diff line number Diff line change
Expand Up @@ -96,26 +96,6 @@ TODO: 0 of 5 tasks shown
--
TODO: 1 of 5 tasks shown
EOF
test_todo_session 'listpri filtering concatenation of priorities and -ranges' <<EOF
>>> todo.sh -p listpri CX
3 (C) notice the sunflowers
2 (X) clean the house from A-Z
4 (X) listen to music
--
TODO: 3 of 5 tasks shown
>>> todo.sh -p listpri ABR-Y
1 (B) smell the uppercase Roses +flowers @outside
2 (X) clean the house from A-Z
4 (X) listen to music
--
TODO: 3 of 5 tasks shown
>>> todo.sh -p listpri A-
2 (X) clean the house from A-Z
--
TODO: 1 of 5 tasks shown
EOF

cat > todo.txt <<EOF
(B) ccc xxx this line should be third.
Expand Down
6 changes: 3 additions & 3 deletions todo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ actionsHelp()
listpri [PRIORITIES] [TERM...]
lsp [PRIORITIES] [TERM...]
Displays all tasks prioritized PRIORITIES.
PRIORITIES can be a [concatenation of] single (A) or range (A-C).
PRIORITIES can be a single one (A) or a range (A-C).
If no PRIORITIES specified, lists all prioritized tasks.
If TERM specified, lists only prioritized tasks that contain TERM(s).
Hides all tasks that contain TERM(s) preceded by a minus sign
Expand Down Expand Up @@ -1346,8 +1346,8 @@ case $action in
"listpri" | "lsp" )
shift ## was "listpri", new $1 is priority to list or first TERM

pri=$(printf "%s\n" "$1" | grep '^\([A-Za-z]\|[A-Za-z]-[A-Za-z]\|[A-Z][A-Z-]*[A-Z]\)$') && shift || pri="A-Z"
post_filter_command="${post_filter_command:-}${post_filter_command:+ | }grep '^ *[0-9]\+ ([${pri^^}]) '"
pri=$(printf "%s\n" "$1" | tr '[:lower:]' '[:upper:]' | grep -e '^[A-Z]$' -e '^[A-Z]-[A-Z]$') && shift || pri="A-Z"
post_filter_command="${post_filter_command:-}${post_filter_command:+ | }grep '^ *[0-9]\+ ([${pri}]) '"
_list "$TODO_FILE" "$@"
;;

Expand Down

0 comments on commit ef49e58

Please sign in to comment.