@@ -1550,13 +1550,13 @@ formatTaskLine conf now taskUlidWidth task =
1550
1550
annotate (dateStyle conf) (pretty taskDate) :
1551
1551
(pretty $ case FullTask. review_utc task >>= parseUtc of
1552
1552
Nothing -> " " :: Text
1553
- Just date_ -> if date_ < now then " 🔎" else " " ) :
1554
- (if dueIn mempty { durationHours = 24 } && isOpen
1555
- then " ⚠️️ "
1556
- else " " ) <>
1557
- (if dueIn mempty && isOpen
1558
- then annotate (color Red ) (reflow body)
1559
- else grayOutIfDone (reflow body)) :
1553
+ Just date_ -> if date_ < now then " 🔎 " else " " )
1554
+ <> (if dueIn mempty { durationHours = 24 } && isOpen
1555
+ then " ⚠️️ "
1556
+ else " " ) <>
1557
+ (if dueIn mempty && isOpen
1558
+ then annotate (color Red ) (reflow body)
1559
+ else grayOutIfDone (reflow body)) :
1560
1560
annotate (dueStyle conf) (pretty dueUtcMaybe) :
1561
1561
annotate (closedStyle conf) (pretty closedUtcMaybe) :
1562
1562
hsep (tags <&> (formatTag conf)) :
@@ -1622,7 +1622,7 @@ headTasks conf now connection = do
1622
1622
\where closed_utc is null \
1623
1623
\order by priority desc, due_utc asc, ulid desc \
1624
1624
\limit " <> show (headCount conf)
1625
- pure $ formatTasks conf now tasks
1625
+ formatTasksColor conf now tasks
1626
1626
1627
1627
1628
1628
newTasks :: Config -> DateTime -> Connection -> IO (Doc AnsiStyle )
@@ -1631,7 +1631,7 @@ newTasks conf now connection = do
1631
1631
" select * from `tasks_view` \
1632
1632
\where closed_utc is null \
1633
1633
\order by `ulid` desc limit " <> show (headCount conf)
1634
- pure $ formatTasks conf now tasks
1634
+ formatTasksColor conf now tasks
1635
1635
1636
1636
1637
1637
listOldTasks :: Config -> DateTime -> Connection -> IO (Doc AnsiStyle )
@@ -1640,7 +1640,7 @@ listOldTasks conf now connection = do
1640
1640
" select * from `tasks_view` \
1641
1641
\where closed_utc is null \
1642
1642
\order by `ulid` asc limit " <> show (headCount conf)
1643
- pure $ formatTasks conf now tasks
1643
+ formatTasksColor conf now tasks
1644
1644
1645
1645
1646
1646
openTasks :: Config -> DateTime -> Connection -> IO (Doc AnsiStyle )
@@ -1649,7 +1649,7 @@ openTasks conf now connection = do
1649
1649
" select * from `tasks_view` \
1650
1650
\where closed_utc is null \
1651
1651
\order by priority desc, due_utc asc, ulid desc"
1652
- pure $ formatTasks conf now tasks
1652
+ formatTasksColor conf now tasks
1653
1653
1654
1654
1655
1655
modifiedTasks
@@ -1680,7 +1680,7 @@ modifiedTasks conf now connection listModifiedFlag = do
1680
1680
AllItems -> tasks
1681
1681
ModifiedItemsOnly -> filterModified tasks
1682
1682
1683
- pure $ formatTasks conf now filteredTasks
1683
+ formatTasksColor conf now filteredTasks
1684
1684
1685
1685
1686
1686
overdueTasks :: Config -> DateTime -> Connection -> IO (Doc AnsiStyle )
@@ -1689,7 +1689,7 @@ overdueTasks conf now connection = do
1689
1689
" select * from `tasks_view` \
1690
1690
\where closed_utc is null and due_utc < datetime('now') \
1691
1691
\order by priority desc, due_utc asc, ulid desc"
1692
- pure $ formatTasks conf now tasks
1692
+ formatTasksColor conf now tasks
1693
1693
1694
1694
1695
1695
doneTasks :: Config -> DateTime -> Connection -> IO (Doc AnsiStyle )
@@ -1698,7 +1698,7 @@ doneTasks conf now connection = do
1698
1698
" select * from tasks_view \
1699
1699
\where closed_utc is not null and state is 'Done' \
1700
1700
\order by closed_utc desc limit " <> show (headCount conf)
1701
- pure $ formatTasks conf now tasks
1701
+ formatTasksColor conf now tasks
1702
1702
1703
1703
1704
1704
obsoleteTasks :: Config -> DateTime -> Connection -> IO (Doc AnsiStyle )
@@ -1707,7 +1707,7 @@ obsoleteTasks conf now connection = do
1707
1707
" select * from tasks_view \
1708
1708
\where closed_utc is not null and state is 'Obsolete' \
1709
1709
\order by ulid desc limit " <> show (headCount conf)
1710
- pure $ formatTasks conf now tasks
1710
+ formatTasksColor conf now tasks
1711
1711
1712
1712
1713
1713
deletableTasks :: Config -> DateTime -> Connection -> IO (Doc AnsiStyle )
@@ -1716,7 +1716,7 @@ deletableTasks conf now connection = do
1716
1716
" select * from tasks_view \
1717
1717
\where closed_utc is not null and state is 'Deletable' \
1718
1718
\order by ulid desc limit " <> show (headCount conf)
1719
- pure $ formatTasks conf now tasks
1719
+ formatTasksColor conf now tasks
1720
1720
1721
1721
1722
1722
listRepeating :: Config -> DateTime -> Connection -> IO (Doc AnsiStyle )
@@ -1726,7 +1726,7 @@ listRepeating conf now connection = do
1726
1726
\where repetition_duration is not null \
1727
1727
\order by repetition_duration desc"
1728
1728
1729
- pure $ formatTasks conf now tasks
1729
+ formatTasksColor conf now tasks
1730
1730
1731
1731
1732
1732
listRecurring :: Config -> DateTime -> Connection -> IO (Doc AnsiStyle )
@@ -1736,7 +1736,7 @@ listRecurring conf now connection = do
1736
1736
\where recurrence_duration is not null \
1737
1737
\order by recurrence_duration desc"
1738
1738
1739
- pure $ formatTasks conf now tasks
1739
+ formatTasksColor conf now tasks
1740
1740
1741
1741
1742
1742
listReady :: Config -> DateTime -> Connection -> IO (Doc AnsiStyle )
@@ -1749,7 +1749,7 @@ listReady conf now connection = do
1749
1749
\order by priority desc, due_utc asc, ulid desc \
1750
1750
\limit " <> show (headCount conf)
1751
1751
1752
- pure $ formatTasks conf now tasks
1752
+ formatTasksColor conf now tasks
1753
1753
1754
1754
1755
1755
listWaiting :: Config -> DateTime -> Connection -> IO (Doc AnsiStyle )
@@ -1760,15 +1760,14 @@ listWaiting conf now connection = do
1760
1760
\and waiting_utc is not null \
1761
1761
\and (review_utc > datetime('now') or review_utc is null) \
1762
1762
\order by waiting_utc desc"
1763
-
1764
- pure $ formatTasks conf now tasks
1763
+ formatTasksColor conf now tasks
1765
1764
1766
1765
1767
1766
listAll :: Config -> DateTime -> Connection -> IO (Doc AnsiStyle )
1768
1767
listAll conf now connection = do
1769
1768
tasks <- query_ connection
1770
1769
" select * from tasks_view order by ulid asc"
1771
- pure $ formatTasks conf now tasks
1770
+ formatTasksColor conf now tasks
1772
1771
1773
1772
1774
1773
listNoTag :: Config -> DateTime -> Connection -> IO (Doc AnsiStyle )
@@ -1777,7 +1776,7 @@ listNoTag conf now connection = do
1777
1776
" select * from tasks_view \
1778
1777
\where closed_utc is null and tags is null \
1779
1778
\order by priority desc, due_utc asc, ulid desc"
1780
- pure $ formatTasks conf now tasks
1779
+ formatTasksColor conf now tasks
1781
1780
1782
1781
1783
1782
getWithTag :: Connection -> Maybe DerivedState -> [Text ] -> IO [FullTask ]
@@ -1817,14 +1816,14 @@ getWithTag connection stateMaybe tags = do
1817
1816
listWithTag :: Config -> DateTime -> Connection -> [Text ] -> IO (Doc AnsiStyle )
1818
1817
listWithTag conf now connection tags = do
1819
1818
tasks <- getWithTag connection Nothing tags
1820
- pure $ formatTasks conf now tasks
1819
+ formatTasksColor conf now tasks
1821
1820
1822
1821
1823
1822
queryTasks :: Config -> DateTime -> Connection -> Text -> IO (Doc AnsiStyle )
1824
1823
queryTasks conf now connection sqlQuery = do
1825
1824
tasks <- query_ connection $ Query $
1826
1825
" select * from `tasks_view` where " <> sqlQuery
1827
- pure $ formatTasks conf now tasks
1826
+ formatTasksColor conf now tasks
1828
1827
1829
1828
1830
1829
runSql :: Config -> Text -> IO (Doc AnsiStyle )
@@ -1954,7 +1953,7 @@ runFilter conf now connection exps = do
1954
1953
then
1955
1954
dieWithError $ vsep (fmap ppInvalidFilter errors)
1956
1955
else
1957
- pure $ formatTasks conf now tasks
1956
+ formatTasksColor conf now tasks
1958
1957
1959
1958
_ -> dieWithError filterHelp
1960
1959
@@ -2010,6 +2009,12 @@ formatTasks conf now tasks =
2010
2009
line
2011
2010
2012
2011
2012
+ formatTasksColor :: Config -> DateTime -> [FullTask ] -> IO (Doc AnsiStyle )
2013
+ formatTasksColor conf now tasks = do
2014
+ confNorm <- applyColorMode conf
2015
+ pure $ formatTasks confNorm now tasks
2016
+
2017
+
2013
2018
getProgressBar :: Integer -> Double -> Doc AnsiStyle
2014
2019
getProgressBar maxWidthInChars progress =
2015
2020
let
0 commit comments