Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 4809d5b

Browse files
committed
Add modified-only command
1 parent 436111b commit 4809d5b

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

tasklite-core/app/Main.hs

+6-1
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ data Command
116116
| ListOld
117117
| ListOpen
118118
| ListModified
119+
| ListModifiedOnly
119120
| ListDone
120121
| ListObsolete
121122
| ListDeletable
@@ -465,7 +466,10 @@ commandParser conf =
465466
"List all open tasks by priority desc")
466467

467468
<> command "modified" (toParserInfo (pure ListModified)
468-
"List all modified tasks by modified_utc desc")
469+
"List all tasks by modified_utc desc")
470+
471+
<> command "modified-only" (toParserInfo (pure ListModifiedOnly)
472+
"List all modified tasks by modified_utc desc")
469473

470474
-- All tasks due to no later than
471475
-- <> command "yesterday"
@@ -858,6 +862,7 @@ executeCLiCommand conf now connection cmd =
858862
ListOld -> listOldTasks conf now connection
859863
ListOpen -> openTasks conf now connection
860864
ListModified -> modifiedTasks conf now connection
865+
ListModifiedOnly -> modifiedOnlyTasks conf now connection
861866
ListOverdue -> overdueTasks conf now connection
862867
ListRepeating -> listRepeating conf now connection
863868
ListRecurring -> listRecurring conf now connection

tasklite-core/source/Lib.hs

+10-2
Original file line numberDiff line numberDiff line change
@@ -1571,8 +1571,17 @@ openTasks conf now connection = do
15711571
\order by `priority` desc"
15721572
pure $ formatTasks conf now tasks
15731573

1574+
15741575
modifiedTasks :: Config -> DateTime -> Connection -> IO (Doc AnsiStyle)
1575-
modifiedTasks conf now connection =
1576+
modifiedTasks conf now connection = do
1577+
tasks <- query_ connection $ Query
1578+
"select * from `tasks_view` \
1579+
\order by `modified_utc` desc"
1580+
pure $ formatTasks conf now tasks
1581+
1582+
1583+
modifiedOnlyTasks :: Config -> DateTime -> Connection -> IO (Doc AnsiStyle)
1584+
modifiedOnlyTasks conf now connection =
15761585
let
15771586
filterModified =
15781587
P.filter (\task ->
@@ -1588,7 +1597,6 @@ modifiedTasks conf now connection =
15881597
"select * from `tasks_view` \
15891598
\order by `modified_utc` desc"
15901599
pure $ formatTasks conf now $ filterModified tasks
1591-
15921600

15931601

15941602
overdueTasks :: Config -> DateTime -> Connection -> IO (Doc AnsiStyle)

0 commit comments

Comments
 (0)