packages feed

hledger-ui 1.20.4 → 1.21

raw patch · 11 files changed

+136/−108 lines, 11 filesdep ~hledgerdep ~hledger-lib

Dependency ranges changed: hledger, hledger-lib

Files

CHANGES.md view
@@ -1,6 +1,21 @@ User-visible changes in hledger-ui. See also the hledger changelog. +# 1.21 2021-03-10++- Register screen: also show transactions below the depth limit, as in+  1.19, keeping the register balance in agreement with the balance+  shown on the accounts screen. This regressed in 1.20. (#1468)++- Transaction screen: all decimal places are now shown. On the+  accounts screen and register screen we round amounts according to+  commodity display styles, but when you drill down to a transaction+  you probably want to see the unrounded amounts. (Like print, #cf+  931.)++- New flags `--man` and `--info` open the man page or info manual.+  (See hledger changelog)+ # 1.20.4 2021-01-29  - ui: register: show all txns in/under an account at the depth limit (#1468).
Hledger/UI/AccountsScreen.hs view
@@ -175,7 +175,7 @@           <+> toggles           <+> str (" account " ++ if ishistorical then "balances" else "changes")           <+> borderPeriodStr (if ishistorical then "at end of" else "in") (period_ ropts)-          <+> borderQueryStr (unwords . map (quoteIfNeeded . T.unpack) $ querystring_ ropts)+          <+> borderQueryStr (T.unpack . T.unwords . map textQuoteIfNeeded $ querystring_ ropts)           <+> borderDepthStr mdepth           <+> str (" ("++curidx++"/"++totidx++")")           <+> (if ignore_assertions_ $ inputopts_ copts
Hledger/UI/Main.hs view
@@ -59,6 +59,8 @@    case True of     _ | "help"            `inRawOpts` rawopts -> putStr (showModeUsage uimode)+    _ | "info"            `inRawOpts` rawopts -> runInfoForTopic "hledger-ui" Nothing+    _ | "man"             `inRawOpts` rawopts -> runManForTopic  "hledger-ui" Nothing     _ | "version"         `inRawOpts` rawopts -> putStrLn prognameandversion     _ | "binary-filename" `inRawOpts` rawopts -> putStrLn (binaryfilename progname)     _                                         -> withJournalDo copts' (runBrickUi opts)@@ -141,8 +143,8 @@         where           acct = headDef (error' $ "--register "++apat++" did not match any account")  -- PARTIAL:                  . filterAccts $ journalAccountNames j-          filterAccts = case toRegexCI apat of-              Right re -> filter (regexMatch re . T.unpack)+          filterAccts = case toRegexCI $ T.pack apat of+              Right re -> filter (regexMatchText re)               Left  _  -> const []           -- Initialising the accounts screen is awkward, requiring           -- another temporary UIState value..
Hledger/UI/RegisterScreen.hs view
@@ -14,7 +14,6 @@ import Control.Monad import Control.Monad.IO.Class (liftIO) import Data.List-import Data.List.Split (splitOn) #if !(MIN_VERSION_base(4,11,0)) import Data.Monoid ((<>)) #endif@@ -89,7 +88,7 @@             ,Not generatedTransactionTag           ] -    (_label,items) = accountTransactionsReport rspec' j q thisacctq+    items = accountTransactionsReport rspec' j q thisacctq     items' = (if empty_ ropts then id else filter (not . mixedAmountLooksZero . fifth6)) $  -- without --empty, exclude no-change txns              reverse  -- most recent last              items@@ -98,17 +97,17 @@     displayitems = map displayitem items'       where         displayitem (t, _, _issplit, otheracctsstr, change, bal) =-          RegisterScreenItem{rsItemDate          = showDate $ transactionRegisterDate q thisacctq t+          RegisterScreenItem{rsItemDate          = T.unpack . showDate $ transactionRegisterDate q thisacctq t                             ,rsItemStatus        = tstatus t                             ,rsItemDescription   = T.unpack $ tdescription t-                            ,rsItemOtherAccounts = case splitOn ", " otheracctsstr of-                                                     [s] -> s-                                                     ss  -> intercalate ", " ss+                            ,rsItemOtherAccounts = T.unpack otheracctsstr                                                      -- _   -> "<split>"  -- should do this if accounts field width < 30-                            ,rsItemChangeAmount  = showMixedOneLine showAmountWithoutPrice Nothing (Just 32) False change-                            ,rsItemBalanceAmount = showMixedOneLine showAmountWithoutPrice Nothing (Just 32) False bal+                            ,rsItemChangeAmount  = showamt change+                            ,rsItemBalanceAmount = showamt bal                             ,rsItemTransaction   = t                             }+            where showamt = (\wb -> (wbUnpack wb, wbWidth wb))+                          . showMixedAmountB oneLine{displayMaxWidth=Just 32}     -- blank items are added to allow more control of scroll position; we won't allow movement over these.     -- XXX Ugly. Changing to 0 helps when debugging.     blankitems = replicate 100  -- "100 ought to be enough for anyone"@@ -213,7 +212,7 @@           <+> togglefilters           <+> str " transactions"           -- <+> str (if ishistorical then " historical total" else " period total")-          <+> borderQueryStr (unwords . map (quoteIfNeeded . T.unpack) $ querystring_ ropts)+          <+> borderQueryStr (T.unpack . T.unwords . map textQuoteIfNeeded $ querystring_ ropts)           -- <+> str " and subs"           <+> borderPeriodStr "in" (period_ ropts)           <+> str " ("
Hledger/UI/TransactionScreen.hs view
@@ -60,7 +60,7 @@ tsDraw :: UIState -> [Widget Name] tsDraw UIState{aopts=UIOpts{cliopts_=copts@CliOpts{reportspec_=rspec@ReportSpec{rsOpts=ropts}}}               ,ajournal=j-              ,aScreen=TransactionScreen{tsTransaction=(i,t)+              ,aScreen=TransactionScreen{tsTransaction=(i,t')                                         ,tsTransactions=nts                                         ,tsAccount=acct                                         }@@ -71,6 +71,8 @@     -- Minibuffer e -> [minibuffer e, maincontent]     _          -> [maincontent]   where+    -- as with print, show amounts with all of their decimal places+    t = transactionMapPostingAmounts amountSetFullPrecision t'     maincontent = Widget Greedy Greedy $ do       let         prices = journalPriceOracle (infer_value_ ropts) j@@ -78,15 +80,11 @@         periodlast =           fromMaybe (error' "TransactionScreen: expected a non-empty journal") $  -- PARTIAL: shouldn't happen           reportPeriodOrJournalLastDay rspec j-        mreportlast = reportPeriodLastDay rspec-        multiperiod = interval_ ropts /= NoInterval -      render $ defaultLayout toplabel bottomlabel $ str $-        showTransactionOneLineAmounts $-        (if valuationTypeIsCost ropts then transactionToCost (journalCommodityStyles j) else id) $-        (if valuationTypeIsDefaultValue ropts then (\t -> transactionApplyValuation prices styles periodlast mreportlast (rsToday rspec) multiperiod t (AtDefault Nothing)) else id) $+      render . defaultLayout toplabel bottomlabel . str+        . T.unpack . showTransactionOneLineAmounts+        $ transactionApplyCostValuation prices styles periodlast (rsToday rspec) (cost_ ropts) (value_ ropts) t         -- (if real_ ropts then filterTransactionPostings (Real True) else id) -- filter postings by --real-        t       where         toplabel =           str "Transaction "@@ -212,7 +210,7 @@   let     q = filterQuery (not . queryIsDepth) $ rsQuery rspec     thisacctq = Acct $ accountNameToAccountRegex acct -- includes subs-    items = reverse $ snd $ accountTransactionsReport rspec j q thisacctq+    items = reverse $ accountTransactionsReport rspec j q thisacctq     ts = map first6 items     numberedts = zip [1..] ts     -- select the best current transaction from the new list
Hledger/UI/UIState.hs view
@@ -113,7 +113,10 @@ -- | Toggle between showing the primary amounts or costs. toggleCost :: UIState -> UIState toggleCost ui@UIState{aopts=uopts@UIOpts{cliopts_=copts@CliOpts{reportspec_=rspec@ReportSpec{rsOpts=ropts}}}} =-  ui{aopts=uopts{cliopts_=copts{reportspec_=rspec{rsOpts=ropts{value_ = valuationToggleCost $ value_ ropts}}}}}+    ui{aopts=uopts{cliopts_=copts{reportspec_=rspec{rsOpts=ropts{cost_ = toggle $ cost_ ropts}}}}}+  where+    toggle Cost   = NoCost+    toggle NoCost = Cost  -- | Toggle between showing primary amounts or default valuation. toggleValue :: UIState -> UIState@@ -121,15 +124,10 @@   ui{aopts=uopts{cliopts_=copts{reportspec_=rspec{rsOpts=ropts{     value_ = plog "toggling value mode to" $ valuationToggleValue $ value_ ropts}}}}} --- | Basic toggling of -B/cost, for hledger-ui.-valuationToggleCost :: Maybe ValuationType -> Maybe ValuationType-valuationToggleCost (Just (AtCost _)) = Nothing-valuationToggleCost _                 = Just $ AtCost Nothing- -- | Basic toggling of -V, for hledger-ui. valuationToggleValue :: Maybe ValuationType -> Maybe ValuationType-valuationToggleValue (Just (AtDefault _)) = Nothing-valuationToggleValue _                    = Just $ AtDefault Nothing+valuationToggleValue (Just (AtEnd _)) = Nothing+valuationToggleValue _                = Just $ AtEnd Nothing  -- | Set hierarchic account tree mode. setTree :: UIState -> UIState@@ -308,7 +306,7 @@ showMinibuffer ui = setMode (Minibuffer e) ui   where     e = applyEdit gotoEOL $ editor MinibufferEditor (Just 1) oldq-    oldq = unwords . map (quoteIfNeeded . T.unpack)+    oldq = T.unpack . T.unwords . map textQuoteIfNeeded          . querystring_ . rsOpts . reportspec_ . cliopts_ $ aopts ui  -- | Close the minibuffer, discarding any edit in progress.
Hledger/UI/UIUtils.hs view
@@ -35,16 +35,15 @@ import Brick.Widgets.List (List, listSelectedL, listNameL, listItemHeightL) import Control.Monad.IO.Class import Data.List-import Data.Maybe #if !(MIN_VERSION_base(4,11,0)) import Data.Monoid #endif+import qualified Data.Text as T import Graphics.Vty   (Event(..),Key(..),Modifier(..),Vty(..),Color,Attr,currentAttr,refresh   -- ,Output(displayBounds,mkDisplayContext),DisplayContext(..)   ) import Lens.Micro.Platform-import System.Environment  import Hledger hiding (Color) import Hledger.Cli (CliOpts)@@ -165,12 +164,11 @@ -- May invoke $PAGER, less, man or info, which is likely to fail on MS Windows, TODO. helpHandle :: UIState -> BrickEvent Name AppEvent -> EventM Name (Next UIState) helpHandle ui ev = do-  pagerprog <- liftIO $ fromMaybe "less" <$> lookupEnv "PAGER"   case ev of     VtyEvent e | e `elem` closeHelpEvents -> continue $ setMode Normal ui-    VtyEvent (EvKey (KChar 'p') []) -> suspendAndResume $ runPagerForTopic pagerprog "hledger-ui" >> return ui'-    VtyEvent (EvKey (KChar 'm') []) -> suspendAndResume $ runManForTopic             "hledger-ui" >> return ui'-    VtyEvent (EvKey (KChar 'i') []) -> suspendAndResume $ runInfoForTopic            "hledger-ui" >> return ui'+    VtyEvent (EvKey (KChar 'p') []) -> suspendAndResume $ runPagerForTopic "hledger-ui" Nothing >> return ui'+    VtyEvent (EvKey (KChar 'm') []) -> suspendAndResume $ runManForTopic   "hledger-ui" Nothing >> return ui'+    VtyEvent (EvKey (KChar 'i') []) -> suspendAndResume $ runInfoForTopic  "hledger-ui" Nothing >> return ui'     _ -> continue ui   where     ui' = setMode Normal ui@@ -192,7 +190,7 @@  borderPeriodStr :: String -> Period -> Widget Name borderPeriodStr _           PeriodAll = str ""-borderPeriodStr preposition p         = str (" "++preposition++" ") <+> withAttr ("border" <> "query") (str $ showPeriod p)+borderPeriodStr preposition p         = str (" "++preposition++" ") <+> withAttr ("border" <> "query") (str . T.unpack $ showPeriod p)  borderKeysStr :: [(String,String)] -> Widget Name borderKeysStr = borderKeysStr' . map (\(a,b) -> (a, str b))
hledger-ui.1 view
@@ -1,11 +1,13 @@ -.TH "HLEDGER-UI" "1" "December 2020" "hledger-ui-1.20.4 " "hledger User Manuals"+.TH "HLEDGER-UI" "1" "December 2020" "hledger-ui-1.21 " "hledger User Manuals"    .SH NAME .PP-A terminal interface (TUI) for the hledger accounting tool.+hledger-ui is a terminal interface (TUI) for the hledger accounting+tool.+This manual is for hledger-ui 1.21. .SH SYNOPSIS .PP \f[C]hledger-ui [OPTIONS] [QUERYARGS]\f[R]@@ -153,8 +155,9 @@ \f[B]\f[CB]--value\f[B]\f[R] convert amounts to cost or market value, more flexibly than -B/-V/-X .TP-\f[B]\f[CB]--infer-value\f[B]\f[R]-with -V/-X/--value, also infer market prices from transactions+\f[B]\f[CB]--infer-market-prices\f[B]\f[R]+use transaction prices (recorded with \[at] or \[at]\[at]) as additional+market prices, as if they were P directives .TP \f[B]\f[CB]--auto\f[B]\f[R] apply automated posting rules to modify transactions.@@ -181,10 +184,16 @@ hledger help options: .TP \f[B]\f[CB]-h --help\f[B]\f[R]-show general usage (or after COMMAND, command usage)+show general or COMMAND help .TP+\f[B]\f[CB]--man\f[B]\f[R]+show general or COMMAND user manual with man+.TP+\f[B]\f[CB]--info\f[B]\f[R]+show general or COMMAND user manual with info+.TP \f[B]\f[CB]--version\f[B]\f[R]-show version+show general or ADDONCMD version .TP \f[B]\f[CB]--debug[=N]\f[B]\f[R] show debug output (levels 1-9, default: 1)@@ -505,5 +514,3 @@  .SH SEE ALSO hledger(1), hledger\-ui(1), hledger\-web(1), ledger(1)--hledger_journal(5), hledger_csv(5), hledger_timeclock(5), hledger_timedot(5)
hledger-ui.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: e38b4cf2e33e7075fb10addabdfa2af47686be042e965677b9dd26abcfbac53c+-- hash: d46e4712160e17959b23d613872b2441b0138dcb5a455b7403dcef42e41b695c  name:           hledger-ui-version:        1.20.4+version:        1.21 synopsis:       Curses-style terminal interface for the hledger accounting system description:    A simple curses-style terminal user interface for the hledger accounting system.                 It can be a more convenient way to browse your accounts than the CLI.@@ -64,7 +64,7 @@   hs-source-dirs:       ./.   ghc-options: -Wall -fno-warn-unused-do-bind -fno-warn-name-shadowing -fno-warn-missing-signatures -fno-warn-type-defaults -fno-warn-orphans-  cpp-options: -DVERSION="1.20.4"+  cpp-options: -DVERSION="1.21"   build-depends:       ansi-terminal >=0.9     , async@@ -78,8 +78,8 @@     , extra >=1.6.3     , filepath     , fsnotify >=0.2.1.2 && <0.4-    , hledger >=1.20.4 && <1.21-    , hledger-lib >=1.20.4 && <1.21+    , hledger >=1.21 && <1.22+    , hledger-lib >=1.21 && <1.22     , megaparsec >=7.0.0 && <9.1     , microlens >=0.4     , microlens-platform >=0.2.3.1
hledger-ui.info view
@@ -7,7 +7,8 @@ hledger-ui(1) ************* -A terminal interface (TUI) for the hledger accounting tool.+hledger-ui is a terminal interface (TUI) for the hledger accounting+tool. This manual is for hledger-ui 1.21.     `hledger-ui [OPTIONS] [QUERYARGS]' `hledger ui -- [OPTIONS] [QUERYARGS]'@@ -167,8 +168,9 @@      convert amounts to cost or market value, more flexibly than      -B/-V/-X -`--infer-value'-     with -V/-X/-value, also infer market prices from transactions+`--infer-market-prices'+     use transaction prices (recorded with @ or @@) as additional market+     prices, as if they were P directives  `--auto'      apply automated posting rules to modify transactions.@@ -193,10 +195,16 @@    hledger help options:  `-h --help'-     show general usage (or after COMMAND, command usage)+     show general or COMMAND help +`--man'+     show general or COMMAND user manual with man++`--info'+     show general or COMMAND user manual with info+ `--version'-     show version+     show general or ADDONCMD version  `--debug[=N]'      show debug output (levels 1-9, default: 1)@@ -519,25 +527,25 @@  Tag Table: Node: Top82-Node: OPTIONS1425-Ref: #options1522-Node: KEYS5583-Ref: #keys5678-Node: SCREENS9974-Ref: #screens10079-Node: Accounts screen10169-Ref: #accounts-screen10297-Node: Register screen12501-Ref: #register-screen12656-Node: Transaction screen14651-Ref: #transaction-screen14809-Node: Error screen15676-Ref: #error-screen15798-Node: ENVIRONMENT16040-Ref: #environment16154-Node: FILES16959-Ref: #files17058-Node: BUGS17271-Ref: #bugs17348+Node: OPTIONS1475+Ref: #options1572+Node: KEYS5805+Ref: #keys5900+Node: SCREENS10196+Ref: #screens10301+Node: Accounts screen10391+Ref: #accounts-screen10519+Node: Register screen12723+Ref: #register-screen12878+Node: Transaction screen14873+Ref: #transaction-screen15031+Node: Error screen15898+Ref: #error-screen16020+Node: ENVIRONMENT16262+Ref: #environment16376+Node: FILES17181+Ref: #files17280+Node: BUGS17493+Ref: #bugs17570  End Tag Table
hledger-ui.txt view
@@ -4,40 +4,41 @@   NAME-       A terminal interface (TUI) for the hledger accounting tool.+       hledger-ui  is  a  terminal  interface (TUI) for the hledger accounting+       tool.  This manual is for hledger-ui 1.21.  SYNOPSIS        hledger-ui [OPTIONS] [QUERYARGS]        hledger ui -- [OPTIONS] [QUERYARGS]  DESCRIPTION-       hledger  is  a  reliable,  cross-platform  set of programs for tracking-       money, time, or any other commodity, using double-entry accounting  and-       a  simple,  editable  file  format.  hledger is inspired by and largely+       hledger is a reliable, cross-platform  set  of  programs  for  tracking+       money,  time, or any other commodity, using double-entry accounting and+       a simple, editable file format.  hledger is  inspired  by  and  largely        compatible with ledger(1). -       hledger-ui is hledger's  terminal  interface,  providing  an  efficient-       full-window  text  UI  for  viewing accounts and transactions, and some-       limited data entry capability.  It is easier  than  hledger's  command--       line  interface, and sometimes quicker and more convenient than the web+       hledger-ui  is  hledger's  terminal  interface,  providing an efficient+       full-window text UI for viewing accounts  and  transactions,  and  some+       limited  data  entry  capability.  It is easier than hledger's command-+       line interface, and sometimes quicker and more convenient than the  web        interface. -       Like hledger, it reads data from one or more files in hledger  journal,-       timeclock,  timedot,  or CSV format specified with -f, or $LEDGER_FILE,-       or       $HOME/.hledger.journal       (on       windows,        perhaps-       C:/Users/USER/.hledger.journal).   For  more about this see hledger(1),+       Like  hledger, it reads data from one or more files in hledger journal,+       timeclock, timedot, or CSV format specified with -f,  or  $LEDGER_FILE,+       or        $HOME/.hledger.journal       (on       windows,       perhaps+       C:/Users/USER/.hledger.journal).  For more about this  see  hledger(1),        hledger_journal(5) etc. -       Unlike hledger,  hledger-ui  hides  all  future-dated  transactions  by-       default.   They can be revealed, along with any rule-generated periodic-       transactions, by pressing the F key (or starting  with  --forecast)  to+       Unlike  hledger,  hledger-ui  hides  all  future-dated  transactions by+       default.  They can be revealed, along with any rule-generated  periodic+       transactions,  by  pressing  the F key (or starting with --forecast) to        enable "forecast mode".  OPTIONS-       Note:  if  invoking hledger-ui as a hledger subcommand, write -- before+       Note: if invoking hledger-ui as a hledger subcommand, write  --  before        options as shown above. -       Any QUERYARGS are interpreted as a hledger search query  which  filters+       Any  QUERYARGS  are interpreted as a hledger search query which filters        the data.         --watch@@ -50,7 +51,7 @@               start in the (first) matched account's register screen         --change-              show  period balances (changes) at startup instead of historical+              show period balances (changes) at startup instead of  historical               balances         -l --flat@@ -66,7 +67,7 @@               $LEDGER_FILE or $HOME/.hledger.journal)         --rules-file=RULESFILE-              Conversion   rules  file  to  use  when  reading  CSV  (default:+              Conversion  rules  file  to  use  when  reading  CSV   (default:               FILE.rules)         --separator=CHAR@@ -85,7 +86,7 @@               assignments)         -s --strict-              do  extra  error  checking  (check  that all posted accounts are+              do extra error checking (check  that  all  posted  accounts  are               declared)         hledger reporting options:@@ -112,11 +113,11 @@               multiperiod/multicolumn report by year         -p --period=PERIODEXP-              set start date, end date, and/or reporting interval all at  once+              set  start date, end date, and/or reporting interval all at once               using period expressions syntax         --date2-              match  the  secondary  date  instead (see command help for other+              match the secondary date instead (see  command  help  for  other               effects)         -U --unmarked@@ -135,25 +136,26 @@               hide/aggregate accounts or postings more than NUM levels deep         -E --empty-              show items with zero amount, normally hidden (and vice-versa  in+              show  items with zero amount, normally hidden (and vice-versa in               hledger-ui/hledger-web)         -B --cost               convert amounts to their cost/selling amount at transaction time         -V --market-              convert amounts to their market value in default valuation  com-+              convert  amounts to their market value in default valuation com-               modities         -X --exchange=COMM               convert amounts to their market value in commodity COMM         --value-              convert  amounts  to  cost  or  market value, more flexibly than+              convert amounts to cost or  market  value,  more  flexibly  than               -B/-V/-X -       --infer-value-              with -V/-X/--value, also infer market prices from transactions+       --infer-market-prices+              use  transaction  prices  (recorded  with @ or @@) as additional+              market prices, as if they were P directives         --auto apply automated posting rules to modify transactions. @@ -177,10 +179,14 @@        hledger help options:         -h --help-              show general usage (or after COMMAND, command usage)+              show general or COMMAND help +       --man  show general or COMMAND user manual with man++       --info show general or COMMAND user manual with info+        --version-              show version+              show general or ADDONCMD version         --debug[=N]               show debug output (levels 1-9, default: 1)@@ -455,9 +461,6 @@ SEE ALSO        hledger(1), hledger-ui(1), hledger-web(1), ledger(1) -       hledger_journal(5), hledger_csv(5), hledger_timeclock(5), hledger_time--       dot(5)  --hledger-ui-1.20.4                December 2020                   HLEDGER-UI(1)+hledger-ui-1.21                  December 2020                   HLEDGER-UI(1)