packages feed

hledger-iadd 1.3.16 → 1.3.17

raw patch · 4 files changed

+32/−15 lines, 4 filesdep ~brickdep ~hledger-libPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: brick, hledger-lib

API changes (from Hackage documentation)

Files

ChangeLog.md view
@@ -1,4 +1,10 @@-# NEXT RELEASE+# 1.3.17  [2022-03-15]++  - dependencies: Support brick 0.68+  - dependencies: Allow hledger-lib 1.25+  - dependencies: Allow megaparsec 9.2++# 1.3.16  [2021-09-22]    - dependencies: Support (and require) hledger-lib-1.23   - dependencies: Allow megaparsec 9.1
hledger-iadd.cabal view
@@ -1,5 +1,5 @@ name:                hledger-iadd-version:             1.3.16+version:             1.3.17 synopsis:            A terminal UI as drop-in replacement for hledger add description:         This is a terminal UI as drop-in replacement for hledger add.                      .@@ -60,7 +60,7 @@                      , Data.Time.Ext   default-language:    Haskell2010   build-depends:       base >= 4.12 && < 5-                     , hledger-lib >= 1.23 && < 1.24+                     , hledger-lib >= 1.23 && < 1.26                      , brick >= 0.27                      , vty >= 5.4                      , text@@ -70,7 +70,7 @@                      , transformers >= 0.3                      , time >= 1.5                      , vector-                     , megaparsec >= 7.0 && <9.2+                     , megaparsec >= 7.0 && <9.3                      , containers                      , optparse-applicative                      , directory@@ -86,7 +86,7 @@   default-language:    Haskell2010   build-depends:       base >= 4.12 && < 5                      , hledger-iadd-                     , hledger-lib >= 1.23 && < 1.24+                     , hledger-lib >= 1.23 && < 1.26                      , brick >= 0.27                      , vty >= 5.4                      , text@@ -100,7 +100,7 @@                      , xdg-basedir                      , unordered-containers                      , free >= 4.12.4-                     , megaparsec >= 7.0 && <9.2+                     , megaparsec >= 7.0 && <9.3   ghc-options:         -threaded -Wall -fdefer-typed-holes -fno-warn-name-shadowing  test-suite spec@@ -114,7 +114,7 @@   default-language:   Haskell2010   build-depends:      base >= 4.12 && < 5                     , hledger-iadd-                    , hledger-lib >= 1.23 && < 1.24+                    , hledger-lib >= 1.23 && < 1.26                     , text                     , transformers >= 0.3                     , time >= 1.5@@ -122,7 +122,7 @@                     , hspec                     , QuickCheck                     , free >= 4.12.4-                    , megaparsec >= 7.0 && <9.2+                    , megaparsec >= 7.0 && <9.3                     , text-zipper >= 0.10   build-tool-depends: hspec-discover:hspec-discover ==2.*   ghc-options:        -threaded -Wall -fdefer-typed-holes -fno-warn-name-shadowing
src/Brick/Widgets/HelpMessage.hs view
@@ -11,7 +11,6 @@        ) where  import Brick-import Brick.Markup import Brick.Widgets.Border import Graphics.Vty import Data.Text (Text)@@ -84,12 +83,12 @@ resetHelpWidget = vScrollToBeginning . scroller  key :: Text -> Text -> Widget n-key k h =  markup (("  " <> k) @? (helpAttr <> "key"))-       <+> padLeft Max (markup (h @? (helpAttr <> "description")))+key k h =  withAttr (helpAttr <> "key") (txt ("  " <> k))+       <+> padLeft Max (withAttr (helpAttr <> "description") (txt h))  helpAttr :: AttrName helpAttr = "help"  section :: Title -> [(Text, Text)] -> Widget n-section title keys =  markup ((title <> ":") @? (helpAttr <> "title"))+section title keys =  withAttr (helpAttr <> "title") (txt (title <> ":"))                   <=> vBox (map (uncurry key) keys)
src/Model.hs view
@@ -126,13 +126,25 @@ suggest journal _ (AmountQuestion account trans _) = return $ fmap (T.pack . HL.showMixedAmount) $   case findLastSimilar journal trans of     Nothing+      -- no similar transaction, first posting => nothing to suggest       | null (HL.tpostings trans)-        -> Nothing  -- Don't suggest an amount for first account+        -> Nothing+      -- no similar transaction, so just try to balance the new one       | otherwise         -> Just $ negativeAmountSum trans-    Just  last-      | transactionBalanced trans || (trans `isSubsetTransaction` last)+    Just last+      -- current transaction already balanced => see we have a posting with the+      -- current account in the reference transaction+      | transactionBalanced trans         -> HL.pamount <$> findPostingByAcc account last+      -- transaction not balanced, but we're following the reference+      -- transaction. => Try to find a matching posting for the current account.+      -- Otherwise, just balance the current transaction.+      | trans `isSubsetTransaction` last+        -> (HL.pamount <$> findPostingByAcc account last)+           <|> Just (negativeAmountSum trans)+      -- we're not balanced and the reference transaction doesn't match anymore+      -- => Just balance the current transaction.       | otherwise         -> Just $ negativeAmountSum trans suggest _ _ (FinalQuestion _ _) = return $ Just "y"