hledger-lib 1.29.1 → 1.29.2
raw patch · 4 files changed
+40/−6 lines, 4 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
+ Hledger.Utils.IO: setupPager :: IO ()
- Hledger.Data.Balancing: balancingOpts :: HasBalancingOpts c_a3wt6 => Lens' c_a3wt6 BalancingOpts
+ Hledger.Data.Balancing: balancingOpts :: HasBalancingOpts c_a3wHq => Lens' c_a3wHq BalancingOpts
- Hledger.Data.Balancing: class HasBalancingOpts c_a3wt6
+ Hledger.Data.Balancing: class HasBalancingOpts c_a3wHq
- Hledger.Data.Balancing: commodity_styles :: HasBalancingOpts c_a3wt6 => Lens' c_a3wt6 (Maybe (Map CommoditySymbol AmountStyle))
+ Hledger.Data.Balancing: commodity_styles :: HasBalancingOpts c_a3wHq => Lens' c_a3wHq (Maybe (Map CommoditySymbol AmountStyle))
- Hledger.Data.Balancing: ignore_assertions :: HasBalancingOpts c_a3wt6 => Lens' c_a3wt6 Bool
+ Hledger.Data.Balancing: ignore_assertions :: HasBalancingOpts c_a3wHq => Lens' c_a3wHq Bool
- Hledger.Data.Balancing: infer_balancing_costs :: HasBalancingOpts c_a3wt6 => Lens' c_a3wt6 Bool
+ Hledger.Data.Balancing: infer_balancing_costs :: HasBalancingOpts c_a3wHq => Lens' c_a3wHq Bool
- Hledger.Read.Common: aliases :: HasInputOpts c_a3Kx9 => Lens' c_a3Kx9 [String]
+ Hledger.Read.Common: aliases :: HasInputOpts c_a3KLt => Lens' c_a3KLt [String]
- Hledger.Read.Common: anon__ :: HasInputOpts c_a3Kx9 => Lens' c_a3Kx9 Bool
+ Hledger.Read.Common: anon__ :: HasInputOpts c_a3KLt => Lens' c_a3KLt Bool
- Hledger.Read.Common: auto__ :: HasInputOpts c_a3Kx9 => Lens' c_a3Kx9 Bool
+ Hledger.Read.Common: auto__ :: HasInputOpts c_a3KLt => Lens' c_a3KLt Bool
- Hledger.Read.Common: balancingopts :: HasInputOpts c_a3Kx9 => Lens' c_a3Kx9 BalancingOpts
+ Hledger.Read.Common: balancingopts :: HasInputOpts c_a3KLt => Lens' c_a3KLt BalancingOpts
- Hledger.Read.Common: class HasInputOpts c_a3Kx9
+ Hledger.Read.Common: class HasInputOpts c_a3KLt
- Hledger.Read.Common: forecast :: HasInputOpts c_a3Kx9 => Lens' c_a3Kx9 (Maybe DateSpan)
+ Hledger.Read.Common: forecast :: HasInputOpts c_a3KLt => Lens' c_a3KLt (Maybe DateSpan)
- Hledger.Read.Common: infer_costs :: HasInputOpts c_a3Kx9 => Lens' c_a3Kx9 Bool
+ Hledger.Read.Common: infer_costs :: HasInputOpts c_a3KLt => Lens' c_a3KLt Bool
- Hledger.Read.Common: infer_equity :: HasInputOpts c_a3Kx9 => Lens' c_a3Kx9 Bool
+ Hledger.Read.Common: infer_equity :: HasInputOpts c_a3KLt => Lens' c_a3KLt Bool
- Hledger.Read.Common: inputOpts :: HasInputOpts c_a3Kx9 => Lens' c_a3Kx9 InputOpts
+ Hledger.Read.Common: inputOpts :: HasInputOpts c_a3KLt => Lens' c_a3KLt InputOpts
- Hledger.Read.Common: ioDay :: HasInputOpts c_a3Kx9 => Lens' c_a3Kx9 Day
+ Hledger.Read.Common: ioDay :: HasInputOpts c_a3KLt => Lens' c_a3KLt Day
- Hledger.Read.Common: mformat :: HasInputOpts c_a3Kx9 => Lens' c_a3Kx9 (Maybe StorageFormat)
+ Hledger.Read.Common: mformat :: HasInputOpts c_a3KLt => Lens' c_a3KLt (Maybe StorageFormat)
- Hledger.Read.Common: mrules_file :: HasInputOpts c_a3Kx9 => Lens' c_a3Kx9 (Maybe FilePath)
+ Hledger.Read.Common: mrules_file :: HasInputOpts c_a3KLt => Lens' c_a3KLt (Maybe FilePath)
- Hledger.Read.Common: new__ :: HasInputOpts c_a3Kx9 => Lens' c_a3Kx9 Bool
+ Hledger.Read.Common: new__ :: HasInputOpts c_a3KLt => Lens' c_a3KLt Bool
- Hledger.Read.Common: new_save :: HasInputOpts c_a3Kx9 => Lens' c_a3Kx9 Bool
+ Hledger.Read.Common: new_save :: HasInputOpts c_a3KLt => Lens' c_a3KLt Bool
- Hledger.Read.Common: pivot :: HasInputOpts c_a3Kx9 => Lens' c_a3Kx9 String
+ Hledger.Read.Common: pivot :: HasInputOpts c_a3KLt => Lens' c_a3KLt String
- Hledger.Read.Common: reportspan :: HasInputOpts c_a3Kx9 => Lens' c_a3Kx9 DateSpan
+ Hledger.Read.Common: reportspan :: HasInputOpts c_a3KLt => Lens' c_a3KLt DateSpan
- Hledger.Read.Common: strict :: HasInputOpts c_a3Kx9 => Lens' c_a3Kx9 Bool
+ Hledger.Read.Common: strict :: HasInputOpts c_a3KLt => Lens' c_a3KLt Bool
- Hledger.Read.InputOptions: aliases :: HasInputOpts c_a3Kx9 => Lens' c_a3Kx9 [String]
+ Hledger.Read.InputOptions: aliases :: HasInputOpts c_a3KLt => Lens' c_a3KLt [String]
- Hledger.Read.InputOptions: anon__ :: HasInputOpts c_a3Kx9 => Lens' c_a3Kx9 Bool
+ Hledger.Read.InputOptions: anon__ :: HasInputOpts c_a3KLt => Lens' c_a3KLt Bool
- Hledger.Read.InputOptions: auto__ :: HasInputOpts c_a3Kx9 => Lens' c_a3Kx9 Bool
+ Hledger.Read.InputOptions: auto__ :: HasInputOpts c_a3KLt => Lens' c_a3KLt Bool
- Hledger.Read.InputOptions: balancingopts :: HasInputOpts c_a3Kx9 => Lens' c_a3Kx9 BalancingOpts
+ Hledger.Read.InputOptions: balancingopts :: HasInputOpts c_a3KLt => Lens' c_a3KLt BalancingOpts
- Hledger.Read.InputOptions: class HasInputOpts c_a3Kx9
+ Hledger.Read.InputOptions: class HasInputOpts c_a3KLt
- Hledger.Read.InputOptions: forecast :: HasInputOpts c_a3Kx9 => Lens' c_a3Kx9 (Maybe DateSpan)
+ Hledger.Read.InputOptions: forecast :: HasInputOpts c_a3KLt => Lens' c_a3KLt (Maybe DateSpan)
- Hledger.Read.InputOptions: infer_costs :: HasInputOpts c_a3Kx9 => Lens' c_a3Kx9 Bool
+ Hledger.Read.InputOptions: infer_costs :: HasInputOpts c_a3KLt => Lens' c_a3KLt Bool
- Hledger.Read.InputOptions: infer_equity :: HasInputOpts c_a3Kx9 => Lens' c_a3Kx9 Bool
+ Hledger.Read.InputOptions: infer_equity :: HasInputOpts c_a3KLt => Lens' c_a3KLt Bool
- Hledger.Read.InputOptions: inputOpts :: HasInputOpts c_a3Kx9 => Lens' c_a3Kx9 InputOpts
+ Hledger.Read.InputOptions: inputOpts :: HasInputOpts c_a3KLt => Lens' c_a3KLt InputOpts
- Hledger.Read.InputOptions: ioDay :: HasInputOpts c_a3Kx9 => Lens' c_a3Kx9 Day
+ Hledger.Read.InputOptions: ioDay :: HasInputOpts c_a3KLt => Lens' c_a3KLt Day
- Hledger.Read.InputOptions: mformat :: HasInputOpts c_a3Kx9 => Lens' c_a3Kx9 (Maybe StorageFormat)
+ Hledger.Read.InputOptions: mformat :: HasInputOpts c_a3KLt => Lens' c_a3KLt (Maybe StorageFormat)
- Hledger.Read.InputOptions: mrules_file :: HasInputOpts c_a3Kx9 => Lens' c_a3Kx9 (Maybe FilePath)
+ Hledger.Read.InputOptions: mrules_file :: HasInputOpts c_a3KLt => Lens' c_a3KLt (Maybe FilePath)
- Hledger.Read.InputOptions: new__ :: HasInputOpts c_a3Kx9 => Lens' c_a3Kx9 Bool
+ Hledger.Read.InputOptions: new__ :: HasInputOpts c_a3KLt => Lens' c_a3KLt Bool
- Hledger.Read.InputOptions: new_save :: HasInputOpts c_a3Kx9 => Lens' c_a3Kx9 Bool
+ Hledger.Read.InputOptions: new_save :: HasInputOpts c_a3KLt => Lens' c_a3KLt Bool
- Hledger.Read.InputOptions: pivot :: HasInputOpts c_a3Kx9 => Lens' c_a3Kx9 String
+ Hledger.Read.InputOptions: pivot :: HasInputOpts c_a3KLt => Lens' c_a3KLt String
- Hledger.Read.InputOptions: reportspan :: HasInputOpts c_a3Kx9 => Lens' c_a3Kx9 DateSpan
+ Hledger.Read.InputOptions: reportspan :: HasInputOpts c_a3KLt => Lens' c_a3KLt DateSpan
- Hledger.Read.InputOptions: strict :: HasInputOpts c_a3Kx9 => Lens' c_a3Kx9 Bool
+ Hledger.Read.InputOptions: strict :: HasInputOpts c_a3KLt => Lens' c_a3KLt Bool
- Hledger.Reports.ReportOptions: accountlistmode :: HasReportOptsNoUpdate c_a3Slo => Lens' c_a3Slo AccountListMode
+ Hledger.Reports.ReportOptions: accountlistmode :: HasReportOptsNoUpdate c_a3SzI => Lens' c_a3SzI AccountListMode
- Hledger.Reports.ReportOptions: average :: HasReportOptsNoUpdate c_a3Slo => Lens' c_a3Slo Bool
+ Hledger.Reports.ReportOptions: average :: HasReportOptsNoUpdate c_a3SzI => Lens' c_a3SzI Bool
- Hledger.Reports.ReportOptions: balanceaccum :: HasReportOptsNoUpdate c_a3Slo => Lens' c_a3Slo BalanceAccumulation
+ Hledger.Reports.ReportOptions: balanceaccum :: HasReportOptsNoUpdate c_a3SzI => Lens' c_a3SzI BalanceAccumulation
- Hledger.Reports.ReportOptions: balancecalc :: HasReportOptsNoUpdate c_a3Slo => Lens' c_a3Slo BalanceCalculation
+ Hledger.Reports.ReportOptions: balancecalc :: HasReportOptsNoUpdate c_a3SzI => Lens' c_a3SzI BalanceCalculation
- Hledger.Reports.ReportOptions: budgetpat :: HasReportOptsNoUpdate c_a3Slo => Lens' c_a3Slo (Maybe Text)
+ Hledger.Reports.ReportOptions: budgetpat :: HasReportOptsNoUpdate c_a3SzI => Lens' c_a3SzI (Maybe Text)
- Hledger.Reports.ReportOptions: class HasReportOptsNoUpdate c_a3Slo
+ Hledger.Reports.ReportOptions: class HasReportOptsNoUpdate c_a3SzI
- Hledger.Reports.ReportOptions: class HasReportSpec c_a3Tjd
+ Hledger.Reports.ReportOptions: class HasReportSpec c_a3Txx
- Hledger.Reports.ReportOptions: color__ :: HasReportOptsNoUpdate c_a3Slo => Lens' c_a3Slo Bool
+ Hledger.Reports.ReportOptions: color__ :: HasReportOptsNoUpdate c_a3SzI => Lens' c_a3SzI Bool
- Hledger.Reports.ReportOptions: conversionop :: HasReportOptsNoUpdate c_a3Slo => Lens' c_a3Slo (Maybe ConversionOp)
+ Hledger.Reports.ReportOptions: conversionop :: HasReportOptsNoUpdate c_a3SzI => Lens' c_a3SzI (Maybe ConversionOp)
- Hledger.Reports.ReportOptions: date2NoUpdate :: HasReportOptsNoUpdate c_a3Slo => Lens' c_a3Slo Bool
+ Hledger.Reports.ReportOptions: date2NoUpdate :: HasReportOptsNoUpdate c_a3SzI => Lens' c_a3SzI Bool
- Hledger.Reports.ReportOptions: declared :: HasReportOptsNoUpdate c_a3Slo => Lens' c_a3Slo Bool
+ Hledger.Reports.ReportOptions: declared :: HasReportOptsNoUpdate c_a3SzI => Lens' c_a3SzI Bool
- Hledger.Reports.ReportOptions: depthNoUpdate :: HasReportOptsNoUpdate c_a3Slo => Lens' c_a3Slo (Maybe Int)
+ Hledger.Reports.ReportOptions: depthNoUpdate :: HasReportOptsNoUpdate c_a3SzI => Lens' c_a3SzI (Maybe Int)
- Hledger.Reports.ReportOptions: drop__ :: HasReportOptsNoUpdate c_a3Slo => Lens' c_a3Slo Int
+ Hledger.Reports.ReportOptions: drop__ :: HasReportOptsNoUpdate c_a3SzI => Lens' c_a3SzI Int
- Hledger.Reports.ReportOptions: empty__ :: HasReportOptsNoUpdate c_a3Slo => Lens' c_a3Slo Bool
+ Hledger.Reports.ReportOptions: empty__ :: HasReportOptsNoUpdate c_a3SzI => Lens' c_a3SzI Bool
- Hledger.Reports.ReportOptions: format :: HasReportOptsNoUpdate c_a3Slo => Lens' c_a3Slo StringFormat
+ Hledger.Reports.ReportOptions: format :: HasReportOptsNoUpdate c_a3SzI => Lens' c_a3SzI StringFormat
- Hledger.Reports.ReportOptions: infer_prices :: HasReportOptsNoUpdate c_a3Slo => Lens' c_a3Slo Bool
+ Hledger.Reports.ReportOptions: infer_prices :: HasReportOptsNoUpdate c_a3SzI => Lens' c_a3SzI Bool
- Hledger.Reports.ReportOptions: interval :: HasReportOptsNoUpdate c_a3Slo => Lens' c_a3Slo Interval
+ Hledger.Reports.ReportOptions: interval :: HasReportOptsNoUpdate c_a3SzI => Lens' c_a3SzI Interval
- Hledger.Reports.ReportOptions: invert :: HasReportOptsNoUpdate c_a3Slo => Lens' c_a3Slo Bool
+ Hledger.Reports.ReportOptions: invert :: HasReportOptsNoUpdate c_a3SzI => Lens' c_a3SzI Bool
- Hledger.Reports.ReportOptions: layout :: HasReportOptsNoUpdate c_a3Slo => Lens' c_a3Slo Layout
+ Hledger.Reports.ReportOptions: layout :: HasReportOptsNoUpdate c_a3SzI => Lens' c_a3SzI Layout
- Hledger.Reports.ReportOptions: no_elide :: HasReportOptsNoUpdate c_a3Slo => Lens' c_a3Slo Bool
+ Hledger.Reports.ReportOptions: no_elide :: HasReportOptsNoUpdate c_a3SzI => Lens' c_a3SzI Bool
- Hledger.Reports.ReportOptions: no_total :: HasReportOptsNoUpdate c_a3Slo => Lens' c_a3Slo Bool
+ Hledger.Reports.ReportOptions: no_total :: HasReportOptsNoUpdate c_a3SzI => Lens' c_a3SzI Bool
- Hledger.Reports.ReportOptions: normalbalance :: HasReportOptsNoUpdate c_a3Slo => Lens' c_a3Slo (Maybe NormalSign)
+ Hledger.Reports.ReportOptions: normalbalance :: HasReportOptsNoUpdate c_a3SzI => Lens' c_a3SzI (Maybe NormalSign)
- Hledger.Reports.ReportOptions: percent :: HasReportOptsNoUpdate c_a3Slo => Lens' c_a3Slo Bool
+ Hledger.Reports.ReportOptions: percent :: HasReportOptsNoUpdate c_a3SzI => Lens' c_a3SzI Bool
- Hledger.Reports.ReportOptions: periodNoUpdate :: HasReportOptsNoUpdate c_a3Slo => Lens' c_a3Slo Period
+ Hledger.Reports.ReportOptions: periodNoUpdate :: HasReportOptsNoUpdate c_a3SzI => Lens' c_a3SzI Period
- Hledger.Reports.ReportOptions: pretty :: HasReportOptsNoUpdate c_a3Slo => Lens' c_a3Slo Bool
+ Hledger.Reports.ReportOptions: pretty :: HasReportOptsNoUpdate c_a3SzI => Lens' c_a3SzI Bool
- Hledger.Reports.ReportOptions: querystringNoUpdate :: HasReportOptsNoUpdate c_a3Slo => Lens' c_a3Slo [Text]
+ Hledger.Reports.ReportOptions: querystringNoUpdate :: HasReportOptsNoUpdate c_a3SzI => Lens' c_a3SzI [Text]
- Hledger.Reports.ReportOptions: realNoUpdate :: HasReportOptsNoUpdate c_a3Slo => Lens' c_a3Slo Bool
+ Hledger.Reports.ReportOptions: realNoUpdate :: HasReportOptsNoUpdate c_a3SzI => Lens' c_a3SzI Bool
- Hledger.Reports.ReportOptions: related :: HasReportOptsNoUpdate c_a3Slo => Lens' c_a3Slo Bool
+ Hledger.Reports.ReportOptions: related :: HasReportOptsNoUpdate c_a3SzI => Lens' c_a3SzI Bool
- Hledger.Reports.ReportOptions: reportOptsNoUpdate :: HasReportOptsNoUpdate c_a3Slo => Lens' c_a3Slo ReportOpts
+ Hledger.Reports.ReportOptions: reportOptsNoUpdate :: HasReportOptsNoUpdate c_a3SzI => Lens' c_a3SzI ReportOpts
- Hledger.Reports.ReportOptions: reportSpec :: HasReportSpec c_a3Tjd => Lens' c_a3Tjd ReportSpec
+ Hledger.Reports.ReportOptions: reportSpec :: HasReportSpec c_a3Txx => Lens' c_a3Txx ReportSpec
- Hledger.Reports.ReportOptions: row_total :: HasReportOptsNoUpdate c_a3Slo => Lens' c_a3Slo Bool
+ Hledger.Reports.ReportOptions: row_total :: HasReportOptsNoUpdate c_a3SzI => Lens' c_a3SzI Bool
- Hledger.Reports.ReportOptions: rsDay :: HasReportSpec c_a3Tjd => Lens' c_a3Tjd Day
+ Hledger.Reports.ReportOptions: rsDay :: HasReportSpec c_a3Txx => Lens' c_a3Txx Day
- Hledger.Reports.ReportOptions: rsQuery :: HasReportSpec c_a3Tjd => Lens' c_a3Tjd Query
+ Hledger.Reports.ReportOptions: rsQuery :: HasReportSpec c_a3Txx => Lens' c_a3Txx Query
- Hledger.Reports.ReportOptions: rsQueryOpts :: HasReportSpec c_a3Tjd => Lens' c_a3Tjd [QueryOpt]
+ Hledger.Reports.ReportOptions: rsQueryOpts :: HasReportSpec c_a3Txx => Lens' c_a3Txx [QueryOpt]
- Hledger.Reports.ReportOptions: rsReportOpts :: HasReportSpec c_a3Tjd => Lens' c_a3Tjd ReportOpts
+ Hledger.Reports.ReportOptions: rsReportOpts :: HasReportSpec c_a3Txx => Lens' c_a3Txx ReportOpts
- Hledger.Reports.ReportOptions: show_costs :: HasReportOptsNoUpdate c_a3Slo => Lens' c_a3Slo Bool
+ Hledger.Reports.ReportOptions: show_costs :: HasReportOptsNoUpdate c_a3SzI => Lens' c_a3SzI Bool
- Hledger.Reports.ReportOptions: sort_amount :: HasReportOptsNoUpdate c_a3Slo => Lens' c_a3Slo Bool
+ Hledger.Reports.ReportOptions: sort_amount :: HasReportOptsNoUpdate c_a3SzI => Lens' c_a3SzI Bool
- Hledger.Reports.ReportOptions: statusesNoUpdate :: HasReportOptsNoUpdate c_a3Slo => Lens' c_a3Slo [Status]
+ Hledger.Reports.ReportOptions: statusesNoUpdate :: HasReportOptsNoUpdate c_a3SzI => Lens' c_a3SzI [Status]
- Hledger.Reports.ReportOptions: transpose__ :: HasReportOptsNoUpdate c_a3Slo => Lens' c_a3Slo Bool
+ Hledger.Reports.ReportOptions: transpose__ :: HasReportOptsNoUpdate c_a3SzI => Lens' c_a3SzI Bool
- Hledger.Reports.ReportOptions: txn_dates :: HasReportOptsNoUpdate c_a3Slo => Lens' c_a3Slo Bool
+ Hledger.Reports.ReportOptions: txn_dates :: HasReportOptsNoUpdate c_a3SzI => Lens' c_a3SzI Bool
- Hledger.Reports.ReportOptions: value :: HasReportOptsNoUpdate c_a3Slo => Lens' c_a3Slo (Maybe ValuationType)
+ Hledger.Reports.ReportOptions: value :: HasReportOptsNoUpdate c_a3SzI => Lens' c_a3SzI (Maybe ValuationType)
Files
- CHANGES.md +2/−0
- Hledger/Query.hs +10/−1
- Hledger/Utils/IO.hs +27/−4
- hledger-lib.cabal +1/−1
CHANGES.md view
@@ -9,6 +9,8 @@ Internal/api/developer-ish changes in the hledger-lib (and hledger) packages. For user-visible changes, see the hledger package changelog. +# 1.29.2 2023-04-07+ # 1.29.1 2023-03-16 - Hledger.Utils.String:
Hledger/Query.hs view
@@ -752,7 +752,16 @@ matchesPostingExtra atype (Not q ) p = not $ matchesPostingExtra atype q p matchesPostingExtra atype (Or qs) p = any (\q -> matchesPostingExtra atype q p) qs matchesPostingExtra atype (And qs) p = all (\q -> matchesPostingExtra atype q p) qs-matchesPostingExtra atype (Type ts) p = maybe False (\t -> any (t `isAccountSubtypeOf`) ts) . atype $ paccount p+matchesPostingExtra atype (Type ts) p =+ -- does posting's account's type, if we can detect it, match any of the given types ?+ (maybe False (\t -> any (t `isAccountSubtypeOf`) ts) . atype $ paccount p)+ -- or, try the same test with the original (pre-aliasing/pivoting) posting's account+ || (fromMaybe False $ do+ porig <- poriginal p+ let a = paccount porig+ t <- atype a+ Just $ any (t `isAccountSubtypeOf`) ts+ ) matchesPostingExtra _ q p = matchesPosting q p -- | Does the match expression match this transaction ?
Hledger/Utils/IO.hs view
@@ -21,6 +21,7 @@ -- * Viewing with pager pager,+ setupPager, -- * Command line arguments progArgs,@@ -78,7 +79,7 @@ import System.Console.ANSI (Color,ColorIntensity,ConsoleLayer(..), SGR(..), hSupportsANSIColor, setSGRCode, getLayerColor) import System.Directory (getHomeDirectory)-import System.Environment (getArgs, lookupEnv)+import System.Environment (getArgs, lookupEnv, setEnv) import System.FilePath (isRelative, (</>)) import System.IO (Handle, IOMode (..), hGetEncoding, hSetEncoding, hSetNewlineMode,@@ -128,15 +129,37 @@ -- "Avoid using pshow, pprint, dbg* in the code below to prevent infinite loops." (?) -- | Display the given text on the terminal, using the user's $PAGER if the text is taller --- than the current terminal and stdout is interactive and TERM is not "dumb".+-- than the current terminal and stdout is interactive and TERM is not "dumb"+-- (except on Windows, where a pager will not be used).+-- If the text contains ANSI codes, because hledger thinks the current terminal+-- supports those, the pager should be configured to display those, otherwise+-- users will see junk on screen (#2015).+-- We call "setLessR" at hledger startup to make that less likely. pager :: String -> IO () #ifdef mingw32_HOST_OS pager = putStrLn #else-pager s = do+printOrPage' s = do -- an extra check for Emacs users: dumbterm <- (== Just "dumb") <$> lookupEnv "TERM"- (if dumbterm then putStrLn else printOrPage . T.pack) s+ if dumbterm then putStrLn s else printOrPage (T.pack s)+pager = printOrPage' #endif++-- | Make sure our $LESS and $MORE environment variables contain R,+-- to help ensure the common pager `less` will show our ANSI output properly.+-- less uses $LESS by default, and $MORE when it is invoked as `more`.+-- What the original `more` program does, I'm not sure.+-- If $PAGER is configured to something else, this probably will have no effect.+setupPager :: IO ()+setupPager = do+ let+ addR var = do+ mv <- lookupEnv var+ setEnv var $ case mv of+ Nothing -> "R"+ Just v -> ('R':v)+ addR "LESS"+ addR "MORE" -- Command line arguments
hledger-lib.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack name: hledger-lib-version: 1.29.1+version: 1.29.2 synopsis: A reusable library providing the core functionality of hledger description: A reusable library containing hledger's core functionality. This is used by most hledger* packages so that they support the same