hledger-ui 1.11.1 → 1.12
raw patch · 14 files changed
+575/−427 lines, 14 filesdep ~basedep ~hledgerdep ~hledger-lib
Dependency ranges changed: base, hledger, hledger-lib, megaparsec
Files
- CHANGES +53/−1
- Hledger/UI/AccountsScreen.hs +24/−24
- Hledger/UI/ErrorScreen.hs +21/−9
- Hledger/UI/Main.hs +12/−8
- Hledger/UI/RegisterScreen.hs +18/−22
- Hledger/UI/Theme.hs +42/−48
- Hledger/UI/TransactionScreen.hs +4/−5
- Hledger/UI/UIOptions.hs +22/−10
- Hledger/UI/UIState.hs +16/−7
- Hledger/UI/UIUtils.hs +126/−117
- hledger-ui.1 +48/−21
- hledger-ui.cabal +12/−11
- hledger-ui.info +51/−35
- hledger-ui.txt +126/−109
CHANGES view
@@ -1,4 +1,56 @@-User-visible changes in hledger-ui. See also hledger, hledger-lib.+User-visible changes in hledger-ui.+See also the hledger changelog.+++# 1.12 (2018/12/02)++* fix "Any" build error with GHC < 8.4++* error screen: always show error position properly (#904) (Mykola Orliuk)++* accounts screen: show correct balances when there's only periodic transactions++* drop the --status-toggles flag++* periodic transactions and transaction modifiers are always enabled.+ Rule-based transactions and postings are always generated+ (--forecast and --auto are always on).+ Experimental.++* escape key resets to flat mode.+ Flat mode is the default at startup. Probably it should reset to tree+ mode if --tree was used at startup.++* tree mode tweaks: add --tree/-T/-F flags, make flat mode the default, + toggle tree mode with T, ensure a visible effect on register screen++* hide future txns by default, add --future flag, toggle with F.+ You may have transactions dated later than today, perhaps piped from+ print --forecast or recorded in the journal, which you don't want to+ see except when forecasting.++ By default, we now hide future transactions, showing "today's balance".+ This can be toggled with the F key, which is easier than setting a+ date query. --present and --future flags have been added to set the+ initial mode.++ (Experimental. Interactions with date queries have not been explored.)++* quick help tweaks; try to show most useful info first++* reorganise help dialog, fit content into 80x25 again++* styling tweaks; cyan/blue -> white/yellow++* less noisy styling in horizontal borders (#838)++* register screen: positive amounts: green -> black+ The green/red scheme helped distinguish the changes column from the+ black/red balance column, but the default green is hard to read on+ the pale background in some terminals. Also the changes column is+ non-bold now.++* use hledger 1.12 # 1.11.1 (2018/10/06)
Hledger/UI/AccountsScreen.hs view
@@ -14,16 +14,15 @@ import Brick import Brick.Widgets.List import Brick.Widgets.Edit-import Brick.Widgets.Border (borderAttr) import Control.Monad import Control.Monad.IO.Class (liftIO) import Data.List import Data.Maybe #if !(MIN_VERSION_base(4,11,0))-import Data.Monoid+import Data.Monoid ((<>)) #endif import qualified Data.Text as T-import Data.Time.Calendar (Day)+import Data.Time.Calendar (Day, addDays) import qualified Data.Vector as V import Graphics.Vty (Event(..),Key(..),Modifier(..)) import Lens.Micro.Platform@@ -80,13 +79,19 @@ as = map asItemAccountName displayitems uopts' = uopts{cliopts_=copts{reportopts_=ropts'}}- ropts' = ropts{accountlistmode_=if flat_ ropts then ALFlat else ALTree}+ ropts' = ropts{accountlistmode_=if tree_ ropts then ALTree else ALFlat} - q = queryFromOpts d ropts+ -- Add a date:-tomorrow to the query to exclude future txns, by default.+ -- XXX this necessitates special handling in multiBalanceReport, at least+ pfq | presentorfuture_ uopts == PFFuture = Any+ | otherwise = Date $ DateSpan Nothing (Just $ addDays 1 d)+ q = And [queryFromOpts d ropts, pfq]+ -- run the report (items,_total) = report ropts' q j where+ -- XXX in historical mode, --forecast throws off the starting balances report | balancetype_ ropts == HistoricalBalance = balanceReportFromMultiBalanceReport | otherwise = balanceReport -- still using the old balanceReport for change reports as it@@ -97,7 +102,7 @@ displayitem (fullacct, shortacct, indent, bal) = AccountsScreenItem{asItemIndentLevel = indent ,asItemAccountName = fullacct- ,asItemDisplayAccountName = replaceHiddenAccountsNameWith "All" $ if flat_ ropts' then fullacct else shortacct+ ,asItemDisplayAccountName = replaceHiddenAccountsNameWith "All" $ if tree_ ropts' then shortacct else fullacct ,asItemRenderedAmounts = map showAmountWithoutPrice amts -- like showMixedAmountOneLineWithoutPrice } where@@ -116,7 +121,7 @@ asInit _ _ _ = error "init function called with wrong screen type, should not happen" asDraw :: UIState -> [Widget Name]-asDraw UIState{aopts=UIOpts{cliopts_=copts@CliOpts{reportopts_=ropts}}+asDraw UIState{aopts=uopts@UIOpts{cliopts_=copts@CliOpts{reportopts_=ropts}} ,ajournal=j ,aScreen=s@AccountsScreen{} ,aMode=mode@@ -167,8 +172,8 @@ ishistorical = balancetype_ ropts == HistoricalBalance toplabel =- files- -- <+> withAttr (borderAttr <> "query") (str (if flat_ ropts then " flat" else ""))+ withAttr ("border" <> "filename") files+ -- <+> withAttr ("border" <> "query") (str (if flat_ ropts then " flat" else "")) <+> nonzero <+> str (if ishistorical then " accounts" else " account changes") -- <+> str (if ishistorical then " balances" else " changes")@@ -182,12 +187,12 @@ <+> total <+> str ")" <+> (if ignore_assertions_ $ inputopts_ copts- then withAttr (borderAttr <> "query") (str " ignoring balance assertions")+ then withAttr ("border" <> "query") (str " ignoring balance assertions") else str "") where files = case journalFilePaths j of [] -> str ""- f:_ -> withAttr ("border" <> "bold") $ str $ takeFileName f+ f:_ -> str $ takeFileName f -- [f,_:[]] -> (withAttr ("border" <> "bold") $ str $ takeFileName f) <+> str " (& 1 included file)" -- f:fs -> (withAttr ("border" <> "bold") $ str $ takeFileName f) <+> str (" (& " ++ show (length fs) ++ " included files)") querystr = query_ ropts@@ -198,9 +203,9 @@ ,if real_ ropts then ["real"] else [] ] of [] -> str ""- fs -> str " from " <+> withAttr (borderAttr <> "query") (str $ intercalate ", " fs) <+> str " txns"+ fs -> str " from " <+> withAttr ("border" <> "query") (str $ intercalate ", " fs) <+> str " txns" nonzero | empty_ ropts = str ""- | otherwise = withAttr (borderAttr <> "query") (str " nonzero")+ | otherwise = withAttr ("border" <> "query") (str " nonzero") cur = str (case _asList s ^. listSelectedL of Nothing -> "-" Just i -> show (i + 1))@@ -211,19 +216,13 @@ Minibuffer ed -> minibuffer ed _ -> quickhelp where- selectedstr = withAttr (borderAttr <> "query") . str quickhelp = borderKeysStr' [ ("?", str "help")- ,("right", str "register")- ,("H"- ,if ishistorical- then selectedstr "historical" <+> str "/period"- else str "historical/" <+> selectedstr "period")- ,("F"- ,if flat_ ropts- then str "tree/" <+> selectedstr "flat"- else selectedstr "tree" <+> str "/flat")+-- ,("RIGHT", str "register") ,("-+", str "depth")+ ,("T", renderToggle (tree_ ropts) "flat" "tree")+ ,("H", renderToggle (not ishistorical) "end-bals" "changes")+ ,("F", renderToggle (presentorfuture_ uopts == PFFuture) "present" "future") --,("/", "filter") --,("DEL", "unfilter") --,("ESC", "cancel/top")@@ -332,12 +331,13 @@ -- display mode/query toggles VtyEvent (EvKey (KChar 'H') []) -> asCenterAndContinue $ regenerateScreens j d $ toggleHistorical ui- VtyEvent (EvKey (KChar 'F') []) -> asCenterAndContinue $ regenerateScreens j d $ toggleFlat ui+ VtyEvent (EvKey (KChar 'T') []) -> asCenterAndContinue $ regenerateScreens j d $ toggleTree ui VtyEvent (EvKey (KChar 'Z') []) -> asCenterAndContinue $ regenerateScreens j d $ toggleEmpty ui VtyEvent (EvKey (KChar 'R') []) -> asCenterAndContinue $ regenerateScreens j d $ toggleReal ui VtyEvent (EvKey (KChar 'U') []) -> asCenterAndContinue $ regenerateScreens j d $ toggleUnmarked ui VtyEvent (EvKey (KChar 'P') []) -> asCenterAndContinue $ regenerateScreens j d $ togglePending ui VtyEvent (EvKey (KChar 'C') []) -> asCenterAndContinue $ regenerateScreens j d $ toggleCleared ui+ VtyEvent (EvKey (KChar 'F') []) -> asCenterAndContinue $ regenerateScreens j d $ toggleFuture ui VtyEvent (EvKey (KDown) [MShift]) -> continue $ regenerateScreens j d $ shrinkReportPeriod d ui VtyEvent (EvKey (KUp) [MShift]) -> continue $ regenerateScreens j d $ growReportPeriod d ui
Hledger/UI/ErrorScreen.hs view
@@ -12,7 +12,7 @@ where import Brick--- import Brick.Widgets.Border (borderAttr)+-- import Brick.Widgets.Border ("border") import Control.Monad import Control.Monad.IO.Class (liftIO) #if !(MIN_VERSION_base(4,11,0))@@ -57,7 +57,7 @@ where toplabel = withAttr ("border" <> "bold") (str "Oops. Please fix this problem then press g to reload")- -- <+> (if ignore_assertions_ copts then withAttr (borderAttr <> "query") (str " ignoring") else str " not ignoring")+ -- <+> (if ignore_assertions_ copts then withAttr ("border" <> "query") (str " ignoring") else str " not ignoring") bottomlabel = case mode of -- Minibuffer ed -> minibuffer ed@@ -110,15 +110,27 @@ -- | Parse the file name, line and column number from a hledger parse error message, if possible. -- Temporary, we should keep the original parse error location. XXX+-- Keep in sync with 'Hledger.Data.Transaction.showGenericSourcePos' hledgerparseerrorpositionp :: ParsecT Void String t (String, Int, Int) hledgerparseerrorpositionp = do- anyChar `manyTill` char '"'- f <- anyChar `manyTill` (oneOf ['"','\n'])- string " (line "- l <- read <$> some digitChar- string ", column "- c <- read <$> some digitChar- return (f, l, c)+ anySingle `manyTill` char '"'+ f <- anySingle `manyTill` (oneOf ['"','\n'])+ choice [+ do+ string " (line "+ l <- read <$> some digitChar+ string ", column "+ c <- read <$> some digitChar+ return (f, l, c),+ do+ string " (lines "+ l <- read <$> some digitChar+ char '-'+ some digitChar+ char ')'+ return (f, l, 1)+ ]+ -- Unconditionally reload the journal, regenerating the current screen -- and all previous screens in the history.
Hledger/UI/Main.hs view
@@ -71,19 +71,21 @@ | otherwise = withJournalDoUICommand opts runBrickUi -- TODO fix nasty duplication of withJournalDo+-- | hledger-ui's version of withJournalDo. Enables --auto and --forecast. withJournalDoUICommand :: UIOpts -> (UIOpts -> Journal -> IO ()) -> IO ()-withJournalDoUICommand uopts@UIOpts{cliopts_=copts} cmd = do- journalpath <- journalFilePathFromOpts copts- ej <- readJournalFiles (inputopts_ copts) journalpath+withJournalDoUICommand uopts@UIOpts{cliopts_=copts@CliOpts{inputopts_=iopts,reportopts_=ropts}} cmd = do+ let copts' = copts{inputopts_=iopts{auto_=True}, reportopts_=ropts{forecast_=True}}+ journalpath <- journalFilePathFromOpts copts'+ ej <- readJournalFiles (inputopts_ copts') journalpath let fn = cmd uopts- . pivotByOpts copts- . anonymiseByOpts copts- <=< journalApplyValue (reportopts_ copts)- <=< journalAddForecast copts+ . pivotByOpts copts'+ . anonymiseByOpts copts'+ <=< journalApplyValue (reportopts_ copts')+ <=< journalAddForecast copts' either error' fn ej runBrickUi :: UIOpts -> Journal -> IO ()-runBrickUi uopts@UIOpts{cliopts_=copts@CliOpts{reportopts_=ropts}} j = do+runBrickUi uopts@UIOpts{cliopts_=copts@CliOpts{inputopts_=_iopts,reportopts_=ropts}} j = do d <- getCurrentDay let@@ -168,6 +170,8 @@ , appDraw = \ui -> sDraw (aScreen ui) ui } + -- print (length (show ui)) >> exitSuccess -- show any debug output to this point & quit+ if not (watch_ uopts') then void $ defaultMain brickapp ui
Hledger/UI/RegisterScreen.hs view
@@ -16,7 +16,7 @@ import Data.List import Data.List.Split (splitOn) #if !(MIN_VERSION_base(4,11,0))-import Data.Monoid+import Data.Monoid ((<>)) #endif import Data.Maybe import qualified Data.Text as T@@ -26,7 +26,6 @@ import Brick import Brick.Widgets.List import Brick.Widgets.Edit-import Brick.Widgets.Border (borderAttr) import Lens.Micro.Platform import Safe import System.Console.ANSI@@ -59,17 +58,19 @@ rsSetAccount _ _ scr = scr rsInit :: Day -> Bool -> UIState -> UIState-rsInit d reset ui@UIState{aopts=UIOpts{cliopts_=CliOpts{reportopts_=ropts}}, ajournal=j, aScreen=s@RegisterScreen{..}} =+rsInit d reset ui@UIState{aopts=uopts@UIOpts{cliopts_=CliOpts{reportopts_=ropts}}, ajournal=j, aScreen=s@RegisterScreen{..}} = ui{aScreen=s{rsList=newitems'}} where -- gather arguments and queries -- XXX temp- inclusive = not (flat_ ropts) || rsForceInclusive+ inclusive = tree_ ropts || rsForceInclusive thisacctq = Acct $ (if inclusive then accountNameToAccountRegex else accountNameToAccountOnlyRegex) rsAccount ropts' = ropts{ depth_=Nothing }- q = queryFromOpts d ropts'+ pfq | presentorfuture_ uopts == PFFuture = Any+ | otherwise = Date $ DateSpan Nothing (Just $ addDays 1 d)+ q = And [queryFromOpts d ropts', pfq] -- reportq = filterQuery (not . queryIsDepth) q (_label,items) = accountTransactionsReport ropts' j q thisacctq@@ -131,7 +132,7 @@ rsInit _ _ _ = error "init function called with wrong screen type, should not happen" rsDraw :: UIState -> [Widget Name]-rsDraw UIState{aopts=UIOpts{cliopts_=copts@CliOpts{reportopts_=ropts}}+rsDraw UIState{aopts=uopts@UIOpts{cliopts_=copts@CliOpts{reportopts_=ropts}} ,aScreen=RegisterScreen{..} ,aMode=mode } =@@ -186,11 +187,11 @@ where ishistorical = balancetype_ ropts == HistoricalBalance- inclusive = not (flat_ ropts) || rsForceInclusive+ -- inclusive = tree_ ropts || rsForceInclusive toplabel = withAttr ("border" <> "bold") (str $ T.unpack $ replaceHiddenAccountsNameWith "All" rsAccount)--- <+> withAttr (borderAttr <> "query") (str $ if inclusive then "" else " exclusive")+-- <+> withAttr ("border" <> "query") (str $ if inclusive then "" else " exclusive") <+> togglefilters <+> str " transactions" -- <+> str (if ishistorical then " historical total" else " period total")@@ -202,7 +203,7 @@ <+> str "/" <+> total <+> str ")"- <+> (if ignore_assertions_ $ inputopts_ copts then withAttr (borderAttr <> "query") (str " ignoring balance assertions") else str "")+ <+> (if ignore_assertions_ $ inputopts_ copts then withAttr ("border" <> "query") (str " ignoring balance assertions") else str "") where togglefilters = case concat [@@ -211,7 +212,7 @@ ,if empty_ ropts then [] else ["nonzero"] ] of [] -> str ""- fs -> withAttr (borderAttr <> "query") (str $ " " ++ intercalate ", " fs)+ fs -> withAttr ("border" <> "query") (str $ " " ++ intercalate ", " fs) cur = str $ case rsList ^. listSelectedL of Nothing -> "-" Just i -> show (i + 1)@@ -224,19 +225,13 @@ Minibuffer ed -> minibuffer ed _ -> quickhelp where- selectedstr = withAttr (borderAttr <> "query") . str quickhelp = borderKeysStr' [ ("?", str "help")- ,("left", str "back")- ,("right", str "transaction")- ,("H"- ,if ishistorical- then selectedstr "historical" <+> str "/period"- else str "historical/" <+> selectedstr "period")- ,("F"- ,if inclusive- then selectedstr "inclusive" <+> str "/exclusive"- else str "inclusive/" <+> selectedstr "exclusive")+ ,("LEFT", str "back")+-- ,("RIGHT", str "transaction")+ ,("T", renderToggle (tree_ ropts) "flat(-subs)" "tree(+subs)") -- rsForceInclusive may override, but use tree_ to ensure a visible toggle effect+ ,("H", renderToggle (not ishistorical) "historical" "period")+ ,("F", renderToggle (presentorfuture_ uopts == PFFuture) "present" "future") -- ,("a", "add") -- ,("g", "reload") -- ,("q", "quit")@@ -323,12 +318,13 @@ -- display mode/query toggles VtyEvent (EvKey (KChar 'H') []) -> rsCenterAndContinue $ regenerateScreens j d $ toggleHistorical ui- VtyEvent (EvKey (KChar 'F') []) -> rsCenterAndContinue $ regenerateScreens j d $ toggleFlat ui+ VtyEvent (EvKey (KChar 'T') []) -> rsCenterAndContinue $ regenerateScreens j d $ toggleTree ui VtyEvent (EvKey (KChar 'Z') []) -> rsCenterAndContinue $ regenerateScreens j d $ toggleEmpty ui VtyEvent (EvKey (KChar 'R') []) -> rsCenterAndContinue $ regenerateScreens j d $ toggleReal ui VtyEvent (EvKey (KChar 'U') []) -> rsCenterAndContinue $ regenerateScreens j d $ toggleUnmarked ui VtyEvent (EvKey (KChar 'P') []) -> rsCenterAndContinue $ regenerateScreens j d $ togglePending ui VtyEvent (EvKey (KChar 'C') []) -> rsCenterAndContinue $ regenerateScreens j d $ toggleCleared ui+ VtyEvent (EvKey (KChar 'F') []) -> rsCenterAndContinue $ regenerateScreens j d $ toggleFuture ui VtyEvent (EvKey (KChar '/') []) -> continue $ regenerateScreens j d $ showMinibuffer ui VtyEvent (EvKey (KDown) [MShift]) -> continue $ regenerateScreens j d $ shrinkReportPeriod d ui
Hledger/UI/Theme.hs view
@@ -7,16 +7,16 @@ -- http://hackage.haskell.org/package/brick-0.1/docs/Brick-Widgets-Core.html#g:5 -- http://hackage.haskell.org/package/brick-0.1/docs/Brick-Widgets-Border.html --{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE CPP #-}+{-# LANGUAGE OverloadedStrings #-} module Hledger.UI.Theme ( defaultTheme ,getTheme ,themes ,themeNames- ) where+)+where import qualified Data.Map as M import Data.Maybe@@ -25,8 +25,6 @@ #endif import Graphics.Vty import Brick-import Brick.Widgets.Border-import Brick.Widgets.List defaultTheme :: AttrMap defaultTheme = fromMaybe (snd $ head themesList) $ getTheme "white"@@ -64,53 +62,50 @@ themeNames = map fst themesList (&) = withStyle+active = fg brightWhite & bold+selectbg = yellow+select = black `on` selectbg themesList :: [(String, AttrMap)] themesList = [- ("default", attrMap- (black `on` white & bold) [ -- default style for this theme- ("error", currentAttr `withForeColor` red),- (borderAttr , white `on` black & dim),- (borderAttr <> "bold", white `on` black & bold),- (borderAttr <> "query", cyan `on` black & bold),- (borderAttr <> "depth", yellow `on` black & bold),- (borderAttr <> "keys", white `on` black & bold),- (borderAttr <> "minibuffer", white `on` black & bold),- -- ("normal" , black `on` white),- ("list" , black `on` white), -- regular list items- ("list" <> "selected" , white `on` blue & bold), -- selected list items- -- ("list" <> "selected" , black `on` brightYellow),- -- ("list" <> "accounts" , white `on` brightGreen),- ("list" <> "amount" <> "increase", currentAttr `withForeColor` green),- ("list" <> "amount" <> "decrease", currentAttr `withForeColor` red),- ("list" <> "balance" <> "positive", currentAttr `withForeColor` black),- ("list" <> "balance" <> "negative", currentAttr `withForeColor` red),- ("list" <> "amount" <> "increase" <> "selected", brightGreen `on` blue & bold),- ("list" <> "amount" <> "decrease" <> "selected", brightRed `on` blue & bold),- ("list" <> "balance" <> "positive" <> "selected", white `on` blue & bold),- ("list" <> "balance" <> "negative" <> "selected", brightRed `on` blue & bold)- ]),+ ("default", attrMap (black `on` white) [+ ("border" , white `on` black & dim)+ ,("border" <> "bold" , currentAttr & bold)+ ,("border" <> "depth" , active)+ ,("border" <> "filename" , currentAttr)+ ,("border" <> "key" , active) + ,("border" <> "minibuffer" , white `on` black & bold)+ ,("border" <> "query" , active)+ ,("border" <> "selected" , active)+ ,("error" , fg red)+ ,("help" , white `on` black & dim)+ ,("help" <> "heading" , fg yellow)+ ,("help" <> "key" , active)+ -- ,("list" , black `on` white)+ -- ,("list" <> "amount" , currentAttr)+ ,("list" <> "amount" <> "decrease" , fg red)+ -- ,("list" <> "amount" <> "increase" , fg green)+ ,("list" <> "amount" <> "decrease" <> "selected" , red `on` selectbg & bold)+ -- ,("list" <> "amount" <> "increase" <> "selected" , green `on` selectbg & bold)+ ,("list" <> "balance" , currentAttr & bold)+ ,("list" <> "balance" <> "negative" , fg red)+ ,("list" <> "balance" <> "positive" , fg black)+ ,("list" <> "balance" <> "negative" <> "selected" , red `on` selectbg & bold)+ ,("list" <> "balance" <> "positive" <> "selected" , select & bold)+ ,("list" <> "selected" , select)+ -- ,("list" <> "accounts" , white `on` brightGreen)+ -- ,("list" <> "selected" , black `on` brightYellow)+ ]) - ("terminal", attrMap- defAttr [ -- use the current terminal's default style- (borderAttr , white `on` black),- -- ("normal" , defAttr),- (listAttr , defAttr),- (listSelectedAttr , defAttr & reverseVideo & bold)- -- ("status" , defAttr & reverseVideo)- ]),+ ,("greenterm", attrMap (green `on` black) [+ ("list" <> "selected" , black `on` green)+ ]) - ("greenterm", attrMap- (green `on` black) [- -- (listAttr , green `on` black),- (listSelectedAttr , black `on` green & bold)- ])- -- ("colorful", attrMap- -- defAttr [- -- (listAttr , defAttr & reverseVideo),- -- (listSelectedAttr , defAttr `withForeColor` white `withBackColor` red)- -- -- ("status" , defAttr `withForeColor` black `withBackColor` green)- -- ])+ ,("terminal", attrMap defAttr [+ ("border" , white `on` black),+ ("list" , defAttr),+ ("list" <> "selected" , defAttr & reverseVideo)+ ]) ] @@ -120,4 +115,3 @@ -- greenattr = defAttr `withForeColor` green -- reverseredattr = defAttr & reverseVideo `withForeColor` red -- reversegreenattr= defAttr & reverseVideo `withForeColor` green-
Hledger/UI/TransactionScreen.hs view
@@ -20,7 +20,6 @@ import Graphics.Vty (Event(..),Key(..)) import Brick import Brick.Widgets.List (listMoveTo)-import Brick.Widgets.Border (borderAttr) import Hledger import Hledger.Cli hiding (progname,prognameandversion)@@ -77,7 +76,7 @@ <+> togglefilters <+> borderQueryStr (query_ ropts) <+> str (" in "++T.unpack (replaceHiddenAccountsNameWith "All" acct)++")")- <+> (if ignore_assertions_ $ inputopts_ copts then withAttr (borderAttr <> "query") (str " ignoring balance assertions") else str "")+ <+> (if ignore_assertions_ $ inputopts_ copts then withAttr ("border" <> "query") (str " ignoring balance assertions") else str "") where togglefilters = case concat [@@ -86,7 +85,7 @@ ,if empty_ ropts then [] else ["nonzero"] ] of [] -> str ""- fs -> withAttr (borderAttr <> "query") (str $ " " ++ intercalate ", " fs)+ fs -> withAttr ("border" <> "query") (str $ " " ++ intercalate ", " fs) bottomlabel = case mode of -- Minibuffer ed -> minibuffer ed@@ -94,8 +93,8 @@ where quickhelp = borderKeysStr [ ("?", "help")- ,("left", "back")- ,("up/down", "prev/next")+ ,("LEFT", "back")+ ,("UP/DOWN", "prev/next") --,("ESC", "cancel/top") -- ,("a", "add") ,("E", "editor")
Hledger/UI/UIOptions.hs view
@@ -1,11 +1,14 @@ {-# LANGUAGE CPP #-}+{-# LANGUAGE DeriveDataTypeable #-} {-| -} module Hledger.UI.UIOptions where+import Data.Data (Data) import Data.Default+import Data.Typeable (Typeable) import Data.List (intercalate) import System.Environment @@ -33,19 +36,13 @@ -- "show balance change accumulated across periods (in multicolumn reports)" -- ,flagNone ["historical","H"] (\opts -> setboolopt "historical" opts) -- "show historical ending balance in each period (includes postings before report start date)\n "- ,flagNone ["flat"] (\opts -> setboolopt "flat" opts) "show full account names, unindented"+ ,flagNone ["flat","F"] (\opts -> setboolopt "flat" opts) "show accounts as a list (default)"+ ,flagNone ["tree","T"] (\opts -> setboolopt "tree" opts) "show accounts as a tree"+-- ,flagNone ["present"] (\opts -> setboolopt "present" opts) "exclude transactions dated later than today (default)"+ ,flagNone ["future"] (\opts -> setboolopt "future" opts) "show transactions dated later than today (normally hidden)" -- ,flagReq ["drop"] (\s opts -> Right $ setopt "drop" s opts) "N" "with --flat, omit this many leading account name components" -- ,flagReq ["format"] (\s opts -> Right $ setopt "format" s opts) "FORMATSTR" "use this custom line format" -- ,flagNone ["no-elide"] (\opts -> setboolopt "no-elide" opts) "don't compress empty parent accounts on one line"- ,flagReq ["status-toggles"] (\s opts -> Right $ setopt "status-toggles" s opts) "N"- (intercalate "\n"- ["choose how status toggles work:"- ," 1 UPC toggles X/all"- ," 2 UPC cycles X/not-X/all"- ," 3 UPC toggles each X"--- ," 4 upc sets X, UPC sets not-X"--- ," 5 upc toggles X, UPC toggles not-X"- ]) ] --uimode :: Mode [([Char], [Char])]@@ -66,6 +63,7 @@ data UIOpts = UIOpts { watch_ :: Bool ,change_ :: Bool+ ,presentorfuture_ :: PresentOrFutureOpt ,cliopts_ :: CliOpts } deriving (Show) @@ -73,6 +71,7 @@ def def def+ def -- instance Default CliOpts where def = defcliopts @@ -82,8 +81,21 @@ return defuiopts { watch_ = boolopt "watch" rawopts ,change_ = boolopt "change" rawopts+ ,presentorfuture_ = presentorfutureopt rawopts ,cliopts_ = cliopts }++-- | Should transactions dated later than today be included ? +-- Like flat/tree mode, there are three states, and the meaning of default can vary by command.+data PresentOrFutureOpt = PFDefault | PFPresent | PFFuture deriving (Eq, Show, Data, Typeable)+instance Default PresentOrFutureOpt where def = PFDefault++presentorfutureopt :: RawOpts -> PresentOrFutureOpt+presentorfutureopt rawopts =+ case reverse $ filter (`elem` ["present","future"]) $ map fst rawopts of+ ("present":_) -> PFPresent+ ("future":_) -> PFFuture+ _ -> PFDefault checkUIOpts :: UIOpts -> UIOpts checkUIOpts opts =
Hledger/UI/UIState.hs view
@@ -108,13 +108,14 @@ where toggleEmpty ropts = ropts{empty_=not $ empty_ ropts} --- | Toggle between flat and tree mode. If in the third "default" mode, go to flat mode.-toggleFlat :: UIState -> UIState-toggleFlat ui@UIState{aopts=uopts@UIOpts{cliopts_=copts@CliOpts{reportopts_=ropts}}} =- ui{aopts=uopts{cliopts_=copts{reportopts_=toggleFlatMode ropts}}}+-- | Toggle between flat and tree mode. If current mode is unspecified/default, assume it's flat.+toggleTree :: UIState -> UIState+toggleTree ui@UIState{aopts=uopts@UIOpts{cliopts_=copts@CliOpts{reportopts_=ropts}}} =+ ui{aopts=uopts{cliopts_=copts{reportopts_=toggleTreeMode ropts}}} where- toggleFlatMode ropts@ReportOpts{accountlistmode_=ALFlat} = ropts{accountlistmode_=ALTree}- toggleFlatMode ropts = ropts{accountlistmode_=ALFlat}+ toggleTreeMode ropts+ | accountlistmode_ ropts == ALTree = ropts{accountlistmode_=ALFlat}+ | otherwise = ropts{accountlistmode_=ALTree} -- | Toggle between historical balances and period balances. toggleHistorical :: UIState -> UIState@@ -124,6 +125,14 @@ b | balancetype_ ropts == HistoricalBalance = PeriodChange | otherwise = HistoricalBalance +-- | Toggle between including and excluding transactions dated later than today.+toggleFuture :: UIState -> UIState+toggleFuture ui@UIState{aopts=uopts@UIOpts{presentorfuture_=pf}} =+ ui{aopts=uopts{presentorfuture_=pf'}}+ where+ pf' | pf == PFFuture = PFPresent+ | otherwise = PFFuture+ -- | Toggle between showing all and showing only real (non-virtual) items. toggleReal :: UIState -> UIState toggleReal ui@UIState{aopts=uopts@UIOpts{cliopts_=copts@CliOpts{reportopts_=ropts}}} =@@ -183,7 +192,7 @@ resetFilter :: UIState -> UIState resetFilter ui@UIState{aopts=uopts@UIOpts{cliopts_=copts@CliOpts{reportopts_=ropts}}} = ui{aopts=uopts{cliopts_=copts{reportopts_=ropts{- accountlistmode_=ALTree+ accountlistmode_=ALFlat ,empty_=True ,statuses_=[] ,real_=False
Hledger/UI/UIUtils.hs view
@@ -1,16 +1,32 @@-{-# LANGUAGE CPP #-} {- | Rendering & misc. helpers. -} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE CPP #-} -module Hledger.UI.UIUtils+module Hledger.UI.UIUtils (+ borderDepthStr+ ,borderKeysStr+ ,borderKeysStr'+ ,borderPeriodStr+ ,borderQueryStr+ ,defaultLayout+ ,helpDialog+ ,helpHandle+ ,minibuffer+ ,moveDownEvents+ ,moveLeftEvents+ ,moveRightEvents+ ,moveUpEvents+ ,normaliseMovementKeys+ ,renderToggle+ ,replaceHiddenAccountsNameWith+ ,scrollSelectionToMiddle+) where import Brick import Brick.Widgets.Border import Brick.Widgets.Border.Style--- import Brick.Widgets.Center import Brick.Widgets.Dialog import Brick.Widgets.Edit import Brick.Widgets.List@@ -25,7 +41,7 @@ import System.Environment import Hledger hiding (Color)-import Hledger.Cli (CliOpts(rawopts_))+import Hledger.Cli (CliOpts) import Hledger.Cli.DocFiles import Hledger.UI.UITypes import Hledger.UI.UIState@@ -33,77 +49,72 @@ -- ui +-- | Wrap a widget in the default hledger-ui screen layout.+defaultLayout :: Widget Name -> Widget Name -> Widget Name -> Widget Name+defaultLayout toplabel bottomlabel =+ topBottomBorderWithLabels (str " "<+>toplabel<+>str " ") (str " "<+>bottomlabel<+>str " ") .+ margin 1 0 Nothing+ -- topBottomBorderWithLabel2 label .+ -- padLeftRight 1 -- XXX should reduce inner widget's width by 2, but doesn't+ -- "the layout adjusts... if you use the core combinators"+ -- | Draw the help dialog, called when help mode is active. helpDialog :: CliOpts -> Widget Name-helpDialog copts =+helpDialog _copts = Widget Fixed Fixed $ do c <- getContext render $+ withDefAttr "help" $ renderDialog (dialog (Just "Help (?/LEFT/ESC to close)") Nothing (c^.availWidthL)) $ -- (Just (0,[("ok",())]))- padTopBottom 1 $ padLeftRight 1 $+ padAll 1 $ vBox [ hBox [- padLeftRight 1 $+ padRight (Pad 1) $ vBox [- str "NAVIGATION"- ,renderKey ("UP/DOWN/PGUP/PGDN/HOME/END", "")- ,str " move selection"- ,renderKey ("RIGHT", "more detail")- ,renderKey ("LEFT", "previous screen")- ,str " (or vi/emacs movement keys)"- ,renderKey ("ESC", "cancel / reset to top")+ withAttr ("help" <> "heading") $ str "Navigation"+ ,renderKey ("UP/DOWN/PUP/PDN/HOME/END/emacs/vi keys", "")+ ,str " move selection"+ ,renderKey ("RIGHT", "show account txns, txn detail")+ ,renderKey ("LEFT ", "go back")+ ,renderKey ("ESC ", "cancel or reset") ,str " "- ,str "MISC"- ,renderKey ("?", "toggle help")- ,renderKey ("a", "add transaction (hledger add)")- ,renderKey ("A", "add transaction (hledger-iadd)")- ,renderKey ("E", "open editor")- ,renderKey ("I", "toggle balance assertions")- ,renderKey ("CTRL-l", "redraw & recenter")- ,renderKey ("g", "reload data")- ,renderKey ("q", "quit")+ ,withAttr ("help" <> "heading") $ str "Report period"+ ,renderKey ("S-DOWN /S-UP ", "shrink/grow period")+ ,renderKey ("S-RIGHT/S-LEFT", "next/previous period")+ ,renderKey ("t ", "set period to today") ,str " "- ,str "MANUAL"- ,str "choose format:"- ,renderKey ("p", "pager")- ,renderKey ("m", "man")- ,renderKey ("i", "info")+ ,withAttr ("help" <> "heading") $ str "Accounts screen"+ ,renderKey ("-+0123456789 ", "set depth limit")+ ,renderKey ("T ", "toggle tree/flat mode")+ ,renderKey ("H ", "historical end balance/period change")+ ,str " "+ ,withAttr ("help" <> "heading") $ str "Register screen"+ ,renderKey ("T ", "toggle subaccount txns\n(and accounts screen tree/flat mode)")+ ,renderKey ("H ", "show historical total/period total")+ ,str " " ]- ,padLeftRight 1 $+ ,padLeft (Pad 1) $ padRight (Pad 0) $ vBox [- str "FILTERING"- ,renderKey ("SHIFT-DOWN/UP", "shrink/grow report period")- ,renderKey ("SHIFT-RIGHT/LEFT", "next/previous report period")- ,renderKey ("t", "set report period to today")- ,str " "- ,renderKey ("/", "set a filter query")- ,renderKey ("U", - ["toggle unmarked/all"- ,"cycle unmarked/not unmarked/all"- ,"toggle unmarked filter"- ] !! (statusstyle-1))- ,renderKey ("P",- ["toggle pending/all"- ,"cycle pending/not pending/all"- ,"toggle pending filter"- ] !! (statusstyle-1))- ,renderKey ("C",- ["toggle cleared/all"- ,"cycle cleared/not cleared/all"- ,"toggle cleared filter"- ] !! (statusstyle-1))- ,renderKey ("R", "toggle real/all")- ,renderKey ("Z", "toggle nonzero/all")- ,renderKey ("DEL/BS", "remove filters")+ withAttr ("help" <> "heading") $ str "Filtering"+ ,renderKey ("/ ", "set a filter query")+ ,renderKey ("UPC ", "show unmarked/pending/cleared") + ,renderKey ("F ", "show future/present txns")+ ,renderKey ("R ", "show real/all postings")+ ,renderKey ("Z ", "show nonzero/all amounts")+ ,renderKey ("DEL ", "remove filters") ,str " "- ,str "accounts screen:"- ,renderKey ("-+0123456789", "set depth limit")- ,renderKey ("H", "toggle period balance (shows change) or\nhistorical balance (includes older postings)")- ,renderKey ("F", "toggle tree (amounts include subaccounts) or\nflat mode (amounts exclude subaccounts\nexcept when account is depth-clipped)")+ ,withAttr ("help" <> "heading") $ str "Help"+ ,renderKey ("? ", "toggle this help")+ ,renderKey ("pmi ", "(with this help open)\nshow manual in pager/man/info") ,str " "- ,str "register screen:"- ,renderKey ("H", "toggle period or historical total")- ,renderKey ("F", "toggle subaccount transaction inclusion\n(and tree/flat mode)")+ ,withAttr ("help" <> "heading") $ str "Other"+ ,renderKey ("a ", "add transaction (hledger add)")+ ,renderKey ("A ", "add transaction (hledger-iadd)")+ ,renderKey ("E ", "open editor")+ ,renderKey ("I ", "toggle balance assertions")+ ,renderKey ("C-l ", "redraw & recenter")+ ,renderKey ("g ", "reload data")+ ,renderKey ("q ", "quit") ] ] -- ,vBox [@@ -121,8 +132,7 @@ -- ] ] where- renderKey (key,desc) = withAttr (borderAttr <> "keys") (str key) <+> str " " <+> str desc- statusstyle = min 3 $ fromMaybe 1 $ maybeintopt "status-toggles" $ rawopts_ copts + renderKey (key,desc) = withAttr ("help" <> "key") (str key) <+> str " " <+> str desc -- | Event handler used when help mode is active. -- May invoke $PAGER, less, man or info, which is likely to fail on MS Windows, TODO.@@ -141,7 +151,7 @@ -- | Draw the minibuffer. minibuffer :: Editor String Name -> Widget Name minibuffer ed =- forceAttr (borderAttr <> "minibuffer") $+ forceAttr ("border" <> "minibuffer") $ hBox $ #if MIN_VERSION_brick(0,19,0) [txt "filter: ", renderEditor (str . unlines) True ed]@@ -149,26 +159,17 @@ [txt "filter: ", renderEditor True ed] #endif --- | Wrap a widget in the default hledger-ui screen layout.-defaultLayout :: Widget Name -> Widget Name -> Widget Name -> Widget Name-defaultLayout toplabel bottomlabel =- topBottomBorderWithLabels (str " "<+>toplabel<+>str " ") (str " "<+>bottomlabel<+>str " ") .- margin 1 0 Nothing- -- topBottomBorderWithLabel2 label .- -- padLeftRight 1 -- XXX should reduce inner widget's width by 2, but doesn't- -- "the layout adjusts... if you use the core combinators"- borderQueryStr :: String -> Widget Name borderQueryStr "" = str ""-borderQueryStr qry = str " matching " <+> withAttr (borderAttr <> "query") (str qry)+borderQueryStr qry = str " matching " <+> withAttr ("border" <> "query") (str qry) borderDepthStr :: Maybe Int -> Widget Name borderDepthStr Nothing = str ""-borderDepthStr (Just d) = str " to " <+> withAttr (borderAttr <> "query") (str $ "depth "++show d)+borderDepthStr (Just d) = str " to " <+> withAttr ("border" <> "query") (str $ "depth "++show d) borderPeriodStr :: String -> Period -> Widget Name borderPeriodStr _ PeriodAll = str ""-borderPeriodStr preposition p = str (" "++preposition++" ") <+> withAttr (borderAttr <> "query") (str $ showPeriod p)+borderPeriodStr preposition p = str (" "++preposition++" ") <+> withAttr ("border" <> "query") (str $ showPeriod p) borderKeysStr :: [(String,String)] -> Widget Name borderKeysStr = borderKeysStr' . map (\(a,b) -> (a, str b))@@ -177,11 +178,19 @@ borderKeysStr' keydescs = hBox $ intersperse sep $- [withAttr (borderAttr <> "keys") (str keys) <+> str ":" <+> desc | (keys, desc) <- keydescs]+ [withAttr ("border" <> "key") (str keys) <+> str ":" <+> desc | (keys, desc) <- keydescs] where -- sep = str " | " sep = str " " +-- | Render the two states of a toggle, highlighting the active one. +renderToggle :: Bool -> String -> String -> Widget Name+renderToggle isright l r =+ let bold = withAttr ("border" <> "selected") in+ if isright+ then str (l++"/") <+> bold (str r) + else bold (str l) <+> str ("/"++r)+ -- temporary shenanigans: -- | Convert the special account name "*" (from balance report with depth limit 0) to something clearer.@@ -194,49 +203,49 @@ -- generic -topBottomBorderWithLabel :: Widget Name -> Widget Name -> Widget Name-topBottomBorderWithLabel label = \wrapped ->- Widget Greedy Greedy $ do- c <- getContext- let (_w,h) = (c^.availWidthL, c^.availHeightL)- h' = h - 2- wrapped' = vLimit (h') wrapped- debugmsg =- ""- -- " debug: "++show (_w,h')- render $- hBorderWithLabel (label <+> str debugmsg)- <=>- wrapped'- <=>- hBorder+--topBottomBorderWithLabel :: Widget Name -> Widget Name -> Widget Name+--topBottomBorderWithLabel label = \wrapped ->+-- Widget Greedy Greedy $ do+-- c <- getContext+-- let (_w,h) = (c^.availWidthL, c^.availHeightL)+-- h' = h - 2+-- wrapped' = vLimit (h') wrapped+-- debugmsg =+-- ""+-- -- " debug: "++show (_w,h')+-- render $+-- hBorderWithLabel (label <+> str debugmsg)+-- <=>+-- wrapped'+-- <=>+-- hBorder topBottomBorderWithLabels :: Widget Name -> Widget Name -> Widget Name -> Widget Name-topBottomBorderWithLabels toplabel bottomlabel = \wrapped ->+topBottomBorderWithLabels toplabel bottomlabel body = Widget Greedy Greedy $ do c <- getContext let (_w,h) = (c^.availWidthL, c^.availHeightL) h' = h - 2- wrapped' = vLimit (h') wrapped+ body' = vLimit (h') body debugmsg = "" -- " debug: "++show (_w,h') render $- hBorderWithLabel (toplabel <+> str debugmsg)+ hBorderWithLabel (withAttr "border" $ toplabel <+> str debugmsg) <=>- wrapped'+ body' <=>- hBorderWithLabel bottomlabel+ hBorderWithLabel (withAttr "border" bottomlabel) --- XXX should be equivalent to the above, but isn't (page down goes offscreen)-_topBottomBorderWithLabel2 :: Widget Name -> Widget Name -> Widget Name-_topBottomBorderWithLabel2 label = \wrapped ->- let debugmsg = ""- in hBorderWithLabel (label <+> str debugmsg)- <=>- wrapped- <=>- hBorder+---- XXX should be equivalent to the above, but isn't (page down goes offscreen)+--_topBottomBorderWithLabel2 :: Widget Name -> Widget Name -> Widget Name+--_topBottomBorderWithLabel2 label = \wrapped ->+-- let debugmsg = ""+-- in hBorderWithLabel (label <+> str debugmsg)+-- <=>+-- wrapped+-- <=>+-- hBorder -- XXX superseded by pad, in theory -- | Wrap a widget in a margin with the given horizontal and vertical@@ -264,19 +273,19 @@ -- applyN n border withBorderAttr :: Attr -> Widget Name -> Widget Name-withBorderAttr attr = updateAttrMap (applyAttrMappings [(borderAttr, attr)])+withBorderAttr attr = updateAttrMap (applyAttrMappings [("border", attr)]) --- | Like brick's continue, but first run some action to modify brick's state.--- This action does not affect the app state, but might eg adjust a widget's scroll position.-continueWith :: EventM n () -> ui -> EventM n (Next ui)-continueWith brickaction ui = brickaction >> continue ui+---- | Like brick's continue, but first run some action to modify brick's state.+---- This action does not affect the app state, but might eg adjust a widget's scroll position.+--continueWith :: EventM n () -> ui -> EventM n (Next ui)+--continueWith brickaction ui = brickaction >> continue ui --- | Scroll a list's viewport so that the selected item is centered in the--- middle of the display area.-scrollToTop :: List Name e -> EventM Name ()-scrollToTop list = do- let vpname = list^.listNameL- setTop (viewportScroll vpname) 0 +---- | Scroll a list's viewport so that the selected item is at the top+---- of the display area.+--scrollToTop :: List Name e -> EventM Name ()+--scrollToTop list = do+-- let vpname = list^.listNameL+-- setTop (viewportScroll vpname) 0 -- | Scroll a list's viewport so that the selected item is centered in the -- middle of the display area.
hledger-ui.1 view
@@ -1,5 +1,5 @@ -.TH "hledger\-ui" "1" "September 2018" "hledger\-ui 1.11.1" "hledger User Manuals"+.TH "hledger\-ui" "1" "December 2018" "hledger\-ui 1.12" "hledger User Manuals" @@ -26,6 +26,13 @@ It is easier than hledger's command\-line interface, and sometimes quicker and more convenient than the web interface. .PP+Note hledger\-ui has some different defaults: \- it generates+rule\-based transactions and postings by default (\[en]forecast and+\[en]auto are always on).+\- it hides transactions dated in the future by default (change this+with \[en]future or the F key).+Experimental.+.PP Like hledger, it reads data from one or more files in hledger journal, timeclock, timedot, or CSV format specified with \f[C]\-f\f[], or \f[C]$LEDGER_FILE\f[], or \f[C]$HOME/.hledger.journal\f[] (on windows,@@ -59,10 +66,20 @@ .RS .RE .TP-.B \f[C]\-\-flat\f[]-show full account names, unindented+.B \f[C]\-F\ \-\-flat\f[]+show accounts as a list (default) .RS .RE+.TP+.B \f[C]\-T\ \-\-tree\f[]+show accounts as a tree+.RS+.RE+.TP+.B \f[C]\-\-future\f[]+show transactions dated later than today (normally hidden)+.RS+.RE .PP hledger input options: .TP@@ -270,6 +287,14 @@ \f[C]BACKSPACE\f[] or \f[C]DELETE\f[] removes all filters, showing all transactions. .PP+As mentioned above, hledger\-ui shows auto\-generated periodic+transactions, and hides future transactions (auto\-generated or not) by+default.+\f[C]F\f[] toggles showing and hiding these future transactions.+This is similar to using a query like \f[C]date:\-tomorrow\f[], but more+convenient.+(experimental)+.PP \f[C]ESCAPE\f[] removes all filters and jumps back to the top screen. Or, it cancels a minibuffer edit or help dialog in progress. .PP@@ -314,21 +339,21 @@ if you specify a query on the command line, it shows just the matched accounts and the balances from matched transactions. .PP-Account names are normally indented to show the hierarchy (tree mode).-To see less detail, set a depth limit by pressing a number key,-\f[C]1\f[] to \f[C]9\f[].+Account names are shown as a flat list by default.+Press \f[C]T\f[] to toggle tree mode.+In flat mode, account balances are exclusive of subaccounts, except+where subaccounts are hidden by a depth limit (see below).+In tree mode, all account balances are inclusive of subaccounts.+.PP+To see less detail, press a number key, \f[C]1\f[] to \f[C]9\f[], to set+a depth limit.+Or use \f[C]\-\f[] to decrease and \f[C]+\f[]/\f[C]=\f[] to increase the+depth limit. \f[C]0\f[] shows even less detail, collapsing all accounts to a single total.-\f[C]\-\f[] and \f[C]+\f[] (or \f[C]=\f[]) decrease and increase the-depth limit. To remove the depth limit, set it higher than the maximum account depth, or press \f[C]ESCAPE\f[]. .PP-\f[C]F\f[] toggles flat mode, in which accounts are shown as a flat-list, with their full names.-In this mode, account balances exclude subaccounts, except for accounts-at the depth limit (as with hledger's balance command).-.PP \f[C]H\f[] toggles between showing historical balances or period balances. Historical balances (the default) are ending balances at the end of the@@ -380,14 +405,16 @@ the running historical balance you would see on a bank register for the current account. .PP-If the accounts screen was in tree mode, the register screen will-include transactions from both the current account and its subaccounts.-If the accounts screen was in flat mode, and a non\-depth\-clipped-account was selected, the register screen will exclude transactions from-subaccounts.-In other words, the register always shows the transactions responsible-for the period balance shown on the accounts screen.-As on the accounts screen, this can be toggled with \f[C]F\f[].+Transactions affecting this account's subaccounts will be included in+the register if the accounts screen is in tree mode, or if it's in flat+mode but this account has subaccounts which are not shown due to a depth+limit.+In other words, the register always shows the transactions contributing+to the balance shown on the accounts screen.+.PD 0+.P+.PD+Tree mode/flat mode can be toggled with \f[C]T\f[] here also. .PP \f[C]U\f[] toggles filtering by unmarked status, showing or hiding unmarked transactions.
hledger-ui.cabal view
@@ -1,11 +1,13 @@--- This file has been generated from package.yaml by hpack version 0.28.2.+cabal-version: 1.12++-- This file has been generated from package.yaml by hpack version 0.31.0. -- -- see: https://github.com/sol/hpack ----- hash: cf989a0be297a9338409ac4ccab5f308f53c6db6411dbfded3c21c41a02cce89+-- hash: 1abfa4ed0acf79d9240fa75603c4070b640238aa22fa2895a8e3d6155c33a481 name: hledger-ui-version: 1.11.1+version: 1.12 synopsis: Curses-style user interface for the hledger accounting tool description: This is hledger's curses-style interface. It is simpler and more convenient for browsing data than the command-line interface,@@ -27,13 +29,12 @@ license-file: LICENSE tested-with: GHC==7.10.3, GHC==8.0.2, GHC==8.2.2, GHC==8.4.3 build-type: Simple-cabal-version: >= 1.10 extra-source-files: CHANGES+ README hledger-ui.1- hledger-ui.info hledger-ui.txt- README+ hledger-ui.info source-repository head type: git@@ -63,11 +64,11 @@ 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.11.1"+ cpp-options: -DVERSION="1.12" build-depends: ansi-terminal >=0.6.2.3 , async- , base >=4.8 && <4.12+ , base >=4.8 && <4.13 , base-compat-batteries >=0.10.1 && <0.11 , cmdargs >=0.8 , containers@@ -75,9 +76,9 @@ , directory , filepath , fsnotify >=0.2.1.2 && <0.4- , hledger >=1.11.1 && <1.12- , hledger-lib >=1.11.1 && <1.12- , megaparsec >=6.4.1 && <7+ , hledger >=1.12 && <1.13+ , hledger-lib >=1.12 && <1.13+ , megaparsec >=7.0.0 && <8 , microlens >=0.4 , microlens-platform >=0.2.3.1 , pretty-show >=1.6.4
hledger-ui.info view
@@ -3,8 +3,8 @@ File: hledger-ui.info, Node: Top, Next: OPTIONS, Up: (dir) -hledger-ui(1) hledger-ui 1.11.1-*******************************+hledger-ui(1) hledger-ui 1.12+***************************** hledger-ui is hledger's curses-style interface, providing an efficient full-window text UI for viewing accounts and transactions, and some@@ -12,6 +12,11 @@ interface, and sometimes quicker and more convenient than the web interface. + Note hledger-ui has some different defaults: - it generates+rule-based transactions and postings by default (-forecast and -auto are+always on). - it hides transactions dated in the future by default+(change this with -future or the F key). Experimental.+ 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@@ -48,10 +53,16 @@ show period balances (changes) at startup instead of historical balances-'--flat'+'-F --flat' - show full account names, unindented+ show accounts as a list (default)+'-T --tree' + show accounts as a tree+'--future'++ show transactions dated later than today (normally hidden)+ hledger input options: '-f FILE --file=FILE'@@ -201,6 +212,12 @@ below). 'BACKSPACE' or 'DELETE' removes all filters, showing all transactions. + As mentioned above, hledger-ui shows auto-generated periodic+transactions, and hides future transactions (auto-generated or not) by+default. 'F' toggles showing and hiding these future transactions.+This is similar to using a query like 'date:-tomorrow', but more+convenient. (experimental)+ 'ESCAPE' removes all filters and jumps back to the top screen. Or, it cancels a minibuffer edit or help dialog in progress. @@ -257,17 +274,17 @@ subaccounts). if you specify a query on the command line, it shows just the matched accounts and the balances from matched transactions. - Account names are normally indented to show the hierarchy (tree-mode). To see less detail, set a depth limit by pressing a number key,-'1' to '9'. '0' shows even less detail, collapsing all accounts to a-single total. '-' and '+' (or '=') decrease and increase the depth-limit. To remove the depth limit, set it higher than the maximum-account depth, or press 'ESCAPE'.+ Account names are shown as a flat list by default. Press 'T' to+toggle tree mode. In flat mode, account balances are exclusive of+subaccounts, except where subaccounts are hidden by a depth limit (see+below). In tree mode, all account balances are inclusive of+subaccounts. - 'F' toggles flat mode, in which accounts are shown as a flat list,-with their full names. In this mode, account balances exclude-subaccounts, except for accounts at the depth limit (as with hledger's-balance command).+ To see less detail, press a number key, '1' to '9', to set a depth+limit. Or use '-' to decrease and '+'/'=' to increase the depth limit.+'0' shows even less detail, collapsing all accounts to a single total.+To remove the depth limit, set it higher than the maximum account depth,+or press 'ESCAPE'. 'H' toggles between showing historical balances or period balances. Historical balances (the default) are ending balances at the end of the@@ -318,13 +335,12 @@ not disturbed by a filter query, it will be the running historical balance you would see on a bank register for the current account. - If the accounts screen was in tree mode, the register screen will-include transactions from both the current account and its subaccounts.-If the accounts screen was in flat mode, and a non-depth-clipped account-was selected, the register screen will exclude transactions from-subaccounts. In other words, the register always shows the transactions-responsible for the period balance shown on the accounts screen. As on-the accounts screen, this can be toggled with 'F'.+ Transactions affecting this account's subaccounts will be included in+the register if the accounts screen is in tree mode, or if it's in flat+mode but this account has subaccounts which are not shown due to a depth+limit. In other words, the register always shows the transactions+contributing to the balance shown on the accounts screen.+Tree mode/flat mode can be toggled with 'T' here also. 'U' toggles filtering by unmarked status, showing or hiding unmarked transactions. Similarly, 'P' toggles pending transactions, and 'C'@@ -380,19 +396,19 @@ Tag Table: Node: Top71-Node: OPTIONS827-Ref: #options924-Node: KEYS4224-Ref: #keys4319-Node: SCREENS7278-Ref: #screens7363-Node: Accounts screen7453-Ref: #accounts-screen7581-Node: Register screen9811-Ref: #register-screen9966-Node: Transaction screen12040-Ref: #transaction-screen12198-Node: Error screen13068-Ref: #error-screen13190+Node: OPTIONS1084+Ref: #options1181+Node: KEYS4600+Ref: #keys4695+Node: SCREENS7951+Ref: #screens8036+Node: Accounts screen8126+Ref: #accounts-screen8254+Node: Register screen10470+Ref: #register-screen10625+Node: Transaction screen12622+Ref: #transaction-screen12780+Node: Error screen13650+Ref: #error-screen13772 End Tag Table
hledger-ui.txt view
@@ -22,17 +22,22 @@ mand-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),+ Note hledger-ui has some different defaults: - it generates rule-based+ transactions and postings by default (-forecast and -auto are always+ on). - it hides transactions dated in the future by default (change+ this with -future or the F key). Experimental.++ 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. 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@@ -45,11 +50,18 @@ 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 - --flat show full account names, unindented+ -F --flat+ show accounts as a list (default) + -T --tree+ show accounts as a tree++ --future+ show transactions dated later than today (normally hidden)+ hledger input options: -f FILE --file=FILE@@ -57,7 +69,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@@ -98,11 +110,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 (overrides the flags above) --date2- match the secondary date instead (see command help for other+ match the secondary date instead (see command help for other effects) -U --unmarked@@ -121,21 +133,21 @@ 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 at transaction time (using the+ convert amounts to their cost at transaction time (using the transaction price, if any) -V --value- convert amounts to their market value on the report end date+ convert amounts to their market value on the report end date (using the most recent applicable market price, if any) --auto apply automated posting rules to modify transactions. --forecast- apply periodic transaction rules to generate future transac-+ apply periodic transaction rules to generate future transac- tions, to 6 months from now or report end date. When a reporting option appears more than once in the command line, the@@ -155,64 +167,70 @@ show debug output (levels 1-9, default: 1) A @FILE argument will be expanded to the contents of FILE, which should- contain one command line option/argument per line. (To prevent this,+ contain one command line option/argument per line. (To prevent this, insert a -- argument before.) KEYS- ? shows a help dialog listing all keys. (Some of these also appear in+ ? shows a help dialog listing all keys. (Some of these also appear in the quick help at the bottom of each screen.) Press ? again (or ESCAPE, or LEFT) to close it. The following keys work on most screens: The cursor keys navigate: right (or enter) goes deeper, left returns to- the previous screen, up/down/page up/page down/home/end move up and- down through lists. Vi-style (h/j/k/l) and Emacs-style+ the previous screen, up/down/page up/page down/home/end move up and+ down through lists. Vi-style (h/j/k/l) and Emacs-style (CTRL-p/CTRL-n/CTRL-f/CTRL-b) movement keys are also supported. A tip:- movement speed is limited by your keyboard repeat rate, to move faster- you may want to adjust it. (If you're on a mac, the Karabiner app is+ movement speed is limited by your keyboard repeat rate, to move faster+ you may want to adjust it. (If you're on a mac, the Karabiner app is one way to do that.) - With shift pressed, the cursor keys adjust the report period, limiting- the transactions to be shown (by default, all are shown).- shift-down/up steps downward and upward through these standard report+ With shift pressed, the cursor keys adjust the report period, limiting+ the transactions to be shown (by default, all are shown).+ shift-down/up steps downward and upward through these standard report period durations: year, quarter, month, week, day. Then,- shift-left/right moves to the previous/next period. t sets the report- period to today. With the --watch option, when viewing a "current"- period (the current day, week, month, quarter, or year), the period- will move automatically to track the current date. To set a non-stan-+ shift-left/right moves to the previous/next period. t sets the report+ period to today. With the --watch option, when viewing a "current"+ period (the current day, week, month, quarter, or year), the period+ will move automatically to track the current date. To set a non-stan- dard period, you can use / and a date: query. - / lets you set a general filter query limiting the data shown, using- the same query terms as in hledger and hledger-web. While editing the- query, you can use CTRL-a/e/d/k, BS, cursor keys; press ENTER to set+ / lets you set a general filter query limiting the data shown, using+ the same query terms as in hledger and hledger-web. While editing the+ query, you can use CTRL-a/e/d/k, BS, cursor keys; press ENTER to set it, or ESCAPEto cancel. There are also keys for quickly adjusting some- common filters like account depth and transaction status (see below).+ common filters like account depth and transaction status (see below). BACKSPACE or DELETE removes all filters, showing all transactions. - ESCAPE removes all filters and jumps back to the top screen. Or, it+ As mentioned above, hledger-ui shows auto-generated periodic transac-+ tions, and hides future transactions (auto-generated or not) by+ default. F toggles showing and hiding these future transactions. This+ is similar to using a query like date:-tomorrow, but more convenient.+ (experimental)++ ESCAPE removes all filters and jumps back to the top screen. Or, it cancels a minibuffer edit or help dialog in progress. CTRL-l redraws the screen and centers the selection if possible (selec-- tions near the top won't be centered, since we don't scroll above the+ tions near the top won't be centered, since we don't scroll above the top). - g reloads from the data file(s) and updates the current screen and any- previous screens. (With large files, this could cause a noticeable+ g reloads from the data file(s) and updates the current screen and any+ previous screens. (With large files, this could cause a noticeable pause.) - I toggles balance assertion checking. Disabling balance assertions+ I toggles balance assertion checking. Disabling balance assertions temporarily can be useful for troubleshooting. - a runs command-line hledger's add command, and reloads the updated+ a runs command-line hledger's add command, and reloads the updated file. This allows some basic data entry. - A is like a, but runs the hledger-iadd tool, which provides a- curses-style interface. This key will be available if hledger-iadd is+ A is like a, but runs the hledger-iadd tool, which provides a+ curses-style interface. This key will be available if hledger-iadd is installed in $PATH. - E runs $HLEDGER_UI_EDITOR, or $EDITOR, or a default (emac-+ E runs $HLEDGER_UI_EDITOR, or $EDITOR, or a default (emac- sclient -a "" -nw) on the journal file. With some editors (emacs, vi),- the cursor will be positioned at the current transaction when invoked- from the register and transaction screens, and at the error location+ the cursor will be positioned at the current transaction when invoked+ from the register and transaction screens, and at the error location (if possible) when invoked from the error screen. q quits the application.@@ -221,44 +239,44 @@ SCREENS Accounts screen- This is normally the first screen displayed. It lists accounts and- their balances, like hledger's balance command. By default, it shows- all accounts and their latest ending balances (including the balances- of subaccounts). if you specify a query on the command line, it shows+ This is normally the first screen displayed. It lists accounts and+ their balances, like hledger's balance command. By default, it shows+ all accounts and their latest ending balances (including the balances+ of subaccounts). if you specify a query on the command line, it shows just the matched accounts and the balances from matched transactions. - Account names are normally indented to show the hierarchy (tree mode).- To see less detail, set a depth limit by pressing a number key, 1 to 9.- 0 shows even less detail, collapsing all accounts to a single total. -- and + (or =) decrease and increase the depth limit. To remove the+ Account names are shown as a flat list by default. Press T to toggle+ tree mode. In flat mode, account balances are exclusive of subac-+ counts, except where subaccounts are hidden by a depth limit (see+ below). In tree mode, all account balances are inclusive of subac-+ counts.++ To see less detail, press a number key, 1 to 9, to set a depth limit.+ Or use - to decrease and +/= to increase the depth limit. 0 shows even+ less detail, collapsing all accounts to a single total. To remove the depth limit, set it higher than the maximum account depth, or press ESCAPE. - F toggles flat mode, in which accounts are shown as a flat list, with- their full names. In this mode, account balances exclude subaccounts,- except for accounts at the depth limit (as with hledger's balance com-- mand).- H toggles between showing historical balances or period balances. His-- torical balances (the default) are ending balances at the end of the- report period, taking into account all transactions before that date- (filtered by the filter query if any), including transactions before- the start of the report period. In other words, historical balances- are what you would see on a bank statement for that account (unless- disturbed by a filter query). Period balances ignore transactions+ torical balances (the default) are ending balances at the end of the+ report period, taking into account all transactions before that date+ (filtered by the filter query if any), including transactions before+ the start of the report period. In other words, historical balances+ are what you would see on a bank statement for that account (unless+ disturbed by a filter query). Period balances ignore transactions before the report start date, so they show the change in balance during the report period. They are more useful eg when viewing a time log. U toggles filtering by unmarked status, including or excluding unmarked postings in the balances. Similarly, P toggles pending postings, and C- toggles cleared postings. (By default, balances include all postings;- if you activate one or two status filters, only those postings are+ toggles cleared postings. (By default, balances include all postings;+ if you activate one or two status filters, only those postings are included; and if you activate all three, the filter is removed.) R toggles real mode, in which virtual postings are ignored. - Z toggles nonzero mode, in which only accounts with nonzero balances- are shown (hledger-ui shows zero items by default, unlike command-line+ Z toggles nonzero mode, in which only accounts with nonzero balances+ are shown (hledger-ui shows zero items by default, unlike command-line hledger). Press right or enter to view an account's transactions register.@@ -267,65 +285,64 @@ This screen shows the transactions affecting a particular account, like a check register. Each line represents one transaction and shows: - o the other account(s) involved, in abbreviated form. (If there are- both real and virtual postings, it shows only the accounts affected+ o the other account(s) involved, in abbreviated form. (If there are+ both real and virtual postings, it shows only the accounts affected by real postings.) - o the overall change to the current account's balance; positive for an+ o the overall change to the current account's balance; positive for an inflow to this account, negative for an outflow. o the running historical total or period total for the current account,- after the transaction. This can be toggled with H. Similar to the- accounts screen, the historical total is affected by transactions- (filtered by the filter query) before the report start date, while+ after the transaction. This can be toggled with H. Similar to the+ accounts screen, the historical total is affected by transactions+ (filtered by the filter query) before the report start date, while the period total is not. If the historical total is not disturbed by- a filter query, it will be the running historical balance you would+ a filter query, it will be the running historical balance you would see on a bank register for the current account. - If the accounts screen was in tree mode, the register screen will- include transactions from both the current account and its subaccounts.- If the accounts screen was in flat mode, and a non-depth-clipped- account was selected, the register screen will exclude transactions- from subaccounts. In other words, the register always shows the trans-- actions responsible for the period balance shown on the accounts- screen. As on the accounts screen, this can be toggled with F.+ Transactions affecting this account's subaccounts will be included in+ the register if the accounts screen is in tree mode, or if it's in flat+ mode but this account has subaccounts which are not shown due to a+ depth limit. In other words, the register always shows the transac-+ tions contributing to the balance shown on the accounts screen.+ Tree mode/flat mode can be toggled with T here also. - U toggles filtering by unmarked status, showing or hiding unmarked+ U toggles filtering by unmarked status, showing or hiding unmarked transactions. Similarly, P toggles pending transactions, and C toggles- cleared transactions. (By default, transactions with all statuses are- shown; if you activate one or two status filters, only those transac-- tions are shown; and if you activate all three, the filter is+ cleared transactions. (By default, transactions with all statuses are+ shown; if you activate one or two status filters, only those transac-+ tions are shown; and if you activate all three, the filter is removed.)q R toggles real mode, in which virtual postings are ignored. - Z toggles nonzero mode, in which only transactions posting a nonzero- change are shown (hledger-ui shows zero items by default, unlike com-+ Z toggles nonzero mode, in which only transactions posting a nonzero+ change are shown (hledger-ui shows zero items by default, unlike com- mand-line hledger). Press right (or enter) to view the selected transaction in detail. Transaction screen- This screen shows a single transaction, as a general journal entry,- similar to hledger's print command and journal format (hledger_jour-+ This screen shows a single transaction, as a general journal entry,+ similar to hledger's print command and journal format (hledger_jour- nal(5)). - The transaction's date(s) and any cleared flag, transaction code,- description, comments, along with all of its account postings are- shown. Simple transactions have two postings, but there can be more+ The transaction's date(s) and any cleared flag, transaction code,+ description, comments, along with all of its account postings are+ shown. Simple transactions have two postings, but there can be more (or in certain cases, fewer). - up and down will step through all transactions listed in the previous- account register screen. In the title bar, the numbers in parentheses- show your position within that account register. They will vary+ up and down will step through all transactions listed in the previous+ account register screen. In the title bar, the numbers in parentheses+ show your position within that account register. They will vary depending on which account register you came from (remember most trans- actions appear in multiple account registers). The #N number preceding them is the transaction's position within the complete unfiltered jour- nal, which is a more stable id (at least until the next reload). Error screen- This screen will appear if there is a problem, such as a parse error,- when you press g to reload. Once you have fixed the problem, press g+ This screen will appear if there is a problem, such as a parse error,+ when you press g to reload. Once you have fixed the problem, press g again to reload and resume normal operation. (Or, you can press escape to cancel the reload attempt.) @@ -333,17 +350,17 @@ COLUMNS The screen width to use. Default: the full terminal width. LEDGER_FILE The journal file path when not specified with -f. Default:- ~/.hledger.journal (on windows, perhaps C:/Users/USER/.hledger.jour-+ ~/.hledger.journal (on windows, perhaps C:/Users/USER/.hledger.jour- nal). FILES- Reads data from one or more files in hledger journal, timeclock, time-- dot, or CSV format specified with -f, or $LEDGER_FILE, or- $HOME/.hledger.journal (on windows, perhaps+ Reads data from one or more files in hledger journal, timeclock, time-+ dot, or CSV format specified with -f, or $LEDGER_FILE, or+ $HOME/.hledger.journal (on windows, perhaps C:/Users/USER/.hledger.journal). BUGS- The need to precede options with -- when invoked from hledger is awk-+ The need to precede options with -- when invoked from hledger is awk- ward. -f- doesn't work (hledger-ui can't read from stdin).@@ -351,13 +368,13 @@ -V affects only the accounts screen. When you press g, the current and all previous screens are regenerated,- which may cause a noticeable pause with large files. Also there is no+ which may cause a noticeable pause with large files. Also there is no visual indication that this is in progress. - --watch is not yet fully robust. It works well for normal usage, but- many file changes in a short time (eg saving the file thousands of- times with an editor macro) can cause problems at least on OSX. Symp-- toms include: unresponsive UI, periodic resetting of the cursor posi-+ --watch is not yet fully robust. It works well for normal usage, but+ many file changes in a short time (eg saving the file thousands of+ times with an editor macro) can cause problems at least on OSX. Symp-+ toms include: unresponsive UI, periodic resetting of the cursor posi- tion, momentary display of parse errors, high CPU usage eventually sub- siding, and possibly a small but persistent build-up of CPU usage until the program is restarted.@@ -365,7 +382,7 @@ REPORTING BUGS- Report bugs at http://bugs.hledger.org (or on the #hledger IRC channel+ Report bugs at http://bugs.hledger.org (or on the #hledger IRC channel or hledger mail list) @@ -379,7 +396,7 @@ SEE ALSO- hledger(1), hledger-ui(1), hledger-web(1), hledger-api(1),+ hledger(1), hledger-ui(1), hledger-web(1), hledger-api(1), hledger_csv(5), hledger_journal(5), hledger_timeclock(5), hledger_time- dot(5), ledger(1) @@ -387,4 +404,4 @@ -hledger-ui 1.11.1 September 2018 hledger-ui(1)+hledger-ui 1.12 December 2018 hledger-ui(1)