diff options
author | Ben Sima <ben@bsima.me> | 2022-11-14 20:00:01 -0500 |
---|---|---|
committer | Ben Sima <ben@bsima.me> | 2022-11-14 20:00:01 -0500 |
commit | 7e8bd015036906eb456447ca3a9a545bd991fb6d (patch) | |
tree | 2505f1b9f1ec3ecd90dff6c05766b5dee5c1c2c0 /hledger-overview.hs | |
parent | 59d7ad2042294b9f8965bfd21c6f379eebfbee16 (diff) |
hledger updates
Diffstat (limited to 'hledger-overview.hs')
-rwxr-xr-x | hledger-overview.hs | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/hledger-overview.hs b/hledger-overview.hs index bdb807b..0c4bad7 100755 --- a/hledger-overview.hs +++ b/hledger-overview.hs @@ -51,6 +51,7 @@ janj = Just . AtNow . Just main = do let banner txt = Process.callProcess "figlet" ["-f", "small", txt ] + -- cur :: a -> Tagged a (cur, value_) <- getArgs >>= \case @@ -83,7 +84,9 @@ main = do let thisMonth = bal "^ex:me:want ^ex:..:need date:thismonth" sec "metrics" - row " in-ex" (Limit 0 $ bal "^in ^ex:me:want ^ex:..:need" / monthsSinceBeginning t) $ Just "keep this negative to make progress" + let balCategorize = bal "^ex:us:to-categorize" + row " attn" (Target 0 balCategorize) $ Just $ "todo: count number of to-categorize" + -- row " in-ex" (Limit 0 $ bal "^in ^ex:me:want ^ex:..:need" / monthsSinceBeginning t) $ Just "keep this negative to make progress" row " li:as" (Percent_ $ 100 * (- bal "^li") / bal "^as") Nothing -- let lastyear = 2020 -- row " in:net" (- getTotal j t (defreportopts {value_ = value_, period_ = YearPeriod 2020}) "^in:me") Nothing @@ -121,12 +124,14 @@ main = do row " nnext" (levelup 0.2) $ Just $ nextLevel 0.2 row " nnnext" (levelup 0.3) $ Just $ nextLevel 0.3 let satbal = getTotal j t (defreportopts {value_ = janj "sat"}) "^as cur:'BTC|sat|sats'" - row "real sats" satbal Nothing + row "real sats" (Target 450000000 satbal) Nothing --- | <type> <expected> <actual> +-- | TODO: extend this to 'Tagged', not just 'Quantity'. data Metric - = Target Quantity Quantity - | Limit Quantity Quantity + = Target { expected :: Quantity, actual :: Quantity } + -- ^ actual should not be less than expected + | Limit { expected :: Quantity, actual :: Quantity } + -- ^ actual should not be more than expected -- | Tag displayable things so I can change how things print, e.g. add a percent -- sign, or some coloring, etc. @@ -186,6 +191,9 @@ instance Display Quantity where go (x : y : z : xs) = x : y : z : ',' : go xs go xs = xs +instance Display Int where + display d = chunk $ T.pack $ show d + sec :: String -> IO () sec label = putStrLn $ "\n=== " <> label <> " ===" |