arbtt
arbtt copied to clipboard
Allow interpolating variables like $date and expressions like (year $date) in strings
Original report by utapyngo (Bitbucket: utapyngo, GitHub: utapyngo).
It would be great if arbtt could produce statistics by day, week, month, and year, using rules like these:
#!haskell
tag $date,
tag (year $date),
tag (month $date), -- should be more elaborate expression to show "January 2014"
tag (week $date), -- same as above, should look like "Week 10 of 2014"
Original comment by Maciek Żuk (Bitbucket: [Maciek Żuk](https://bitbucket.org/Maciek Żuk), ).
i made change myself which suited my needs, maybe it will help:
#!diff
--- Categorize.hs 2014-09-08 21:47:00.000000000 +0200
+++ Categorize.hs 2014-11-07 12:31:17.000000000 +0100
@@ -523,6 +523,8 @@
return p
getVar "desktop" ctx = do
return $ cDesktop (tlData (cNow ctx))
+getVar "date" ctx = do
+ return (T.pack (formatTime defaultTimeLocale (iso8601DateFormat Nothing) (tlTime (cNow ctx))))
getVar v ctx = error $ "Unknown variable " ++ v
getNumVar :: String -> CtxFun Integer