arbtt 0.10.0.2 → 0.10.1
raw patch · 4 files changed
+38/−37 lines, 4 filesdep ~aesondep ~containersdep ~exceptions
Dependency ranges changed: aeson, containers, exceptions, strict, tasty
Files
- README.md +3/−2
- arbtt.cabal +12/−12
- src/Stats.hs +22/−22
- src/stats-main.hs +1/−1
README.md view
@@ -47,9 +47,10 @@ </dict> </plist> ```- and place it in `~/LaunchAgents/com.foo.arbtt.plist`.- (You can replace "foo" with anything, such as your username)+ and place it in `~/Library/LaunchAgents/com.foo.arbtt.plist`.+ You can replace "foo" with anything, such as your username, in both file name and content. This will ensure `arbtt-capture` is started whenever you log in.+ To start the service without needing a new login, you can run `launchctl load ~/Library/LaunchAgents/com.foo.arbtt.plist`. If you want to record samples at a different rate than one per minute, you will have to pass the `--sample-rate` parameter to arbtt-capture.
arbtt.cabal view
@@ -1,5 +1,5 @@ name: arbtt-version: 0.10.0.2+version: 0.10.1 license: GPL-2 license-file: LICENSE category: Desktop@@ -42,7 +42,7 @@ build-depends: base >= 4.7 && < 5, filepath, directory, transformers, utf8-string, strict, containers,- aeson >= 0.10 && < 1.3,+ aeson >= 0.10 && < 1.5, binary >= 0.5, bytestring, deepseq @@ -100,12 +100,12 @@ build-depends: base >= 4.7 && < 5, parsec == 3.*,- containers == 0.5.*,+ containers >= 0.5 && < 0.7, pcre-light, binary >= 0.5, deepseq, bytestring, utf8-string, strict, transformers, directory, filepath,- aeson >= 0.10 && < 1.3,+ aeson >= 0.10 && < 1.5, array == 0.4.* || == 0.5.*, terminal-progress-bar >= 0.2 && < 0.3, bytestring-progress,@@ -147,8 +147,8 @@ build-depends: base >= 4.7 && < 5, parsec == 3.*,- containers == 0.5.*,- aeson >= 0.10 && < 1.3,+ containers >= 0.5 && < 0.7,+ aeson >= 0.10 && < 1.5, array == 0.4.* || == 0.5.*, binary >= 0.5, deepseq, bytestring, utf8-string, strict,@@ -184,11 +184,11 @@ build-depends: base >= 4.7 && < 5, parsec == 3.*,- containers == 0.5.*,+ containers >= 0.5 && < 0.7, binary >= 0.5,- aeson >= 0.10 && < 1.3,+ aeson >= 0.10 && < 1.5, conduit >= 1.2 && < 1.4,- exceptions == 0.8.*,+ exceptions >= 0.8, attoparsec == 0.13.*, deepseq, bytestring, utf8-string, strict, transformers, directory, filepath@@ -236,7 +236,7 @@ hs-source-dirs: src build-depends: base >= 4.7 && < 5,- containers == 0.5.*,+ containers >= 0.5 && < 0.7, binary >= 0.5, deepseq, bytestring, utf8-string, directory, filepath@@ -281,7 +281,7 @@ TimeLog Build-depends: base >= 4.7 && < 5- , tasty >= 0.7 && < 1.1+ , tasty >= 0.7 && < 1.2 , tasty-golden >= 2.2.0.2 && < 2.4 , tasty-hunit >= 0.2 && < 0.11 , process-extras >= 0.2 && < 0.8@@ -291,7 +291,7 @@ , utf8-string , directory , parsec == 3.*- , containers == 0.5.*+ , containers >= 0.5 && < 0.7 , pcre-light , transformers , mtl
src/Stats.hs view
@@ -214,8 +214,8 @@ ((\(y,_,_) -> y) . toGregorian . localDay) show -processReport :: ReportOptions -> Report -> LeftFold (Bool :!: TimeLogEntry (Ctx, ActivityData)) ReportResults-processReport opts GeneralInfos =+processReport :: TimeZone -> ReportOptions -> Report -> LeftFold (Bool :!: TimeLogEntry (Ctx, ActivityData)) ReportResults+processReport tz opts GeneralInfos = pure (\n firstDate lastDate ttr tts -> let timeDiff = diffUTCTime lastDate firstDate fractionRec = realToFrac ttr / (realToFrac timeDiff) :: Double@@ -237,7 +237,7 @@ onAll calcTotalTime <*> onSelected calcTotalTime -processReport opts TotalTime =+processReport tz opts TotalTime = onSelected $ pure (\totalTimeSel sums -> ListOfTimePercValues "Total time per tag" .@@ -257,27 +257,27 @@ calcTotalTime <*> calcSums -processReport opts (Category cat) = pure (\c -> processCategoryReport opts c cat) <*>+processReport tz opts (Category cat) = pure (\c -> processCategoryReport opts c cat) <*> prepareCalculations -processReport opts EachCategory = +processReport tz opts EachCategory = pure (\c cats -> MultipleReportResults $ map (processCategoryReport opts c) cats) <*> prepareCalculations <*> onSelected calcCategories -processReport opts (IntervalCategory cat) =- processIntervalReport opts ("Intervals for category " ++ show cat) (extractCat cat) +processReport tz opts (IntervalCategory cat) =+ processIntervalReport tz opts ("Intervals for category " ++ show cat) (extractCat cat) where extractCat :: Category -> ActivityData -> Maybe String extractCat cat = fmap (unpack . activityName) . listToMaybe . filter ( (==Just cat) . activityCategory ) -processReport opts (IntervalTag tag) =- processIntervalReport opts ("Intervals for category " ++ show tag) (extractTag tag) +processReport tz opts (IntervalTag tag) =+ processIntervalReport tz opts ("Intervals for category " ++ show tag) (extractTag tag) where extractTag :: Activity -> ActivityData -> Maybe String extractTag tag = fmap show . listToMaybe . filter ( (==tag) ) -processReport opts DumpSamples =+processReport tz opts DumpSamples = DumpResult <$> onSelected (mapElems toList $ fmap $ \(cd,ad) -> (tlData (cNow cd), cTimeZone cd, filterActivity (roActivityFilter opts) ad) )@@ -327,8 +327,8 @@ tlRateTimediff :: TimeLogEntry a -> NominalDiffTime tlRateTimediff tle = fromIntegral (tlRate tle) / 1000 -processIntervalReport :: ReportOptions -> String -> (ActivityData -> Maybe String) -> LeftFold (Bool :!: TimeLogEntry (Ctx, ActivityData)) ReportResults-processIntervalReport opts title extr = runOnIntervals go1 go2+processIntervalReport :: TimeZone -> ReportOptions -> String -> (ActivityData -> Maybe String) -> LeftFold (Bool :!: TimeLogEntry (Ctx, ActivityData)) ReportResults+processIntervalReport tz opts title extr = runOnIntervals go1 go2 where go1 :: LeftFold (TimeLogEntry (Ctx, ActivityData)) [Interval] go1 = go3 `mapElems` fmap (extr . snd) @@ -342,8 +342,8 @@ case tlData fe of Just str -> Just ( str- , showUtcTime (tlTime fe)- , showUtcTime (tlRateTimediff le `addUTCTime` tlTime le)+ , showAsLocalTime tz (tlTime fe)+ , showAsLocalTime tz (tlRateTimediff le `addUTCTime` tlTime le) , showTimeDiff opts $ tlTime le `diffUTCTime` tlTime fe + tlRateTimediff le )@@ -362,12 +362,12 @@ {--intervalReportToTable :: String -> (ActivityData -> Maybe String) -> ReportResults-intervalReportToTable title extr = ListOfIntervals title $+intervalReportToTable :: TimeZone -> String -> (ActivityData -> Maybe String) -> ReportResults+intervalReportToTable tz title extr = ListOfIntervals title $ map (\tles -> let str = fromJust (tlData (head tles))- firstE = showUtcTime (tlTime (head tles))- lastE = showUtcTime (tlTime (last tles))+ firstE = showAsLocalTime tz (tlTime (head tles))+ lastE = showAsLocalTime tz (tlTime (last tles)) timeLength = showTimeDiff $ tlTime (last tles) `diffUTCTime` tlTime (head tles) + fromIntegral (tlRate (last tles))/1000@@ -377,8 +377,8 @@ fmap (groupBy ((==) `on` tlData) . (fmap.fmap) (extr . snd)) $ tags--} - +-}+ renderReport :: ReportOptions -> ReportResults -> IO () renderReport opts (DumpResult samples) = dumpActivity samples@@ -477,8 +477,8 @@ mins = (s `div` 60) `mod` 60 secs = s `mod` 60 -showUtcTime :: UTCTime -> String-showUtcTime = formatTime defaultTimeLocale "%x %X"+showAsLocalTime :: TimeZone -> UTCTime -> String+showAsLocalTime tz = formatTime defaultTimeLocale "%x %X" . utcToZonedTime tz underline :: String -> String underline str = unlines
src/stats-main.hs view
@@ -214,7 +214,7 @@ let repeater = foldr (.) id $ map (processRepeater tz) (optRepeater flags) let opts = optReportOptions flags- let fold = filterPredicate filters `adjoin` repeater (processReport opts rep)+ let fold = filterPredicate filters `adjoin` repeater (processReport tz opts rep) let result = runLeftFold fold allTags -- Force the results a bit, to ensure the progress bar to be shown before the title