packages feed

hledger 1.18.1 → 1.19

raw patch · 66 files changed

+5104/−2851 lines, 66 filesdep ~ansi-terminaldep ~hledger-libdep ~megaparsecPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: ansi-terminal, hledger-lib, megaparsec

API changes (from Hackage documentation)

- Hledger.Cli.CliOptions: instance Data.Data.Data Hledger.Cli.CliOptions.CliOpts
- Hledger.Cli.CompoundBalanceCommand: CBCSubreportSpec :: String -> (Journal -> Query) -> NormalSign -> Bool -> CBCSubreportSpec
- Hledger.Cli.CompoundBalanceCommand: [cbcsubreportincreasestotal] :: CBCSubreportSpec -> Bool
- Hledger.Cli.CompoundBalanceCommand: [cbcsubreportnormalsign] :: CBCSubreportSpec -> NormalSign
- Hledger.Cli.CompoundBalanceCommand: [cbcsubreportquery] :: CBCSubreportSpec -> Journal -> Query
- Hledger.Cli.CompoundBalanceCommand: [cbcsubreporttitle] :: CBCSubreportSpec -> String
- Hledger.Cli.CompoundBalanceCommand: data CBCSubreportSpec
+ Hledger.Cli.CliOptions: flattreeflags :: Bool -> [Flag RawOpts]
+ Hledger.Cli.Commands.Aregister: aregister :: CliOpts -> Journal -> IO ()
+ Hledger.Cli.Commands.Aregister: aregistermode :: Mode RawOpts
+ Hledger.Cli.Commands.Aregister: tests_Aregister :: TestTree
+ Hledger.Cli.Commands.Codes: codes :: CliOpts -> Journal -> IO ()
+ Hledger.Cli.Commands.Codes: codesmode :: Mode RawOpts
- Hledger.Cli: checkMode :: Mode a -> Maybe String
+ Hledger.Cli: checkMode :: () => Mode a -> Maybe String
- Hledger.Cli: complete :: Mode a -> [String] -> (Int, Int) -> [Complete]
+ Hledger.Cli: complete :: () => Mode a -> [String] -> (Int, Int) -> [Complete]
- Hledger.Cli: flagArg :: Update a -> FlagHelp -> Arg a
+ Hledger.Cli: flagArg :: () => Update a -> FlagHelp -> Arg a
- Hledger.Cli: flagBool :: [Name] -> (Bool -> a -> a) -> Help -> Flag a
+ Hledger.Cli: flagBool :: () => [Name] -> (Bool -> a -> a) -> Help -> Flag a
- Hledger.Cli: flagHelpFormat :: (HelpFormat -> TextFormat -> a -> a) -> Flag a
+ Hledger.Cli: flagHelpFormat :: () => (HelpFormat -> TextFormat -> a -> a) -> Flag a
- Hledger.Cli: flagHelpSimple :: (a -> a) -> Flag a
+ Hledger.Cli: flagHelpSimple :: () => (a -> a) -> Flag a
- Hledger.Cli: flagNone :: [Name] -> (a -> a) -> Help -> Flag a
+ Hledger.Cli: flagNone :: () => [Name] -> (a -> a) -> Help -> Flag a
- Hledger.Cli: flagNumericVersion :: (a -> a) -> Flag a
+ Hledger.Cli: flagNumericVersion :: () => (a -> a) -> Flag a
- Hledger.Cli: flagOpt :: String -> [Name] -> Update a -> FlagHelp -> Help -> Flag a
+ Hledger.Cli: flagOpt :: () => String -> [Name] -> Update a -> FlagHelp -> Help -> Flag a
- Hledger.Cli: flagReq :: [Name] -> Update a -> FlagHelp -> Help -> Flag a
+ Hledger.Cli: flagReq :: () => [Name] -> Update a -> FlagHelp -> Help -> Flag a
- Hledger.Cli: flagVersion :: (a -> a) -> Flag a
+ Hledger.Cli: flagVersion :: () => (a -> a) -> Flag a
- Hledger.Cli: flagsVerbosity :: (Verbosity -> a -> a) -> [Flag a]
+ Hledger.Cli: flagsVerbosity :: () => (Verbosity -> a -> a) -> [Flag a]
- Hledger.Cli: fromGroup :: Group a -> [a]
+ Hledger.Cli: fromGroup :: () => Group a -> [a]
- Hledger.Cli: helpText :: [String] -> HelpFormat -> Mode a -> [Text]
+ Hledger.Cli: helpText :: () => [String] -> HelpFormat -> Mode a -> [Text]
- Hledger.Cli: mode :: Name -> a -> Help -> Arg a -> [Flag a] -> Mode a
+ Hledger.Cli: mode :: () => Name -> a -> Help -> Arg a -> [Flag a] -> Mode a
- Hledger.Cli: modeEmpty :: a -> Mode a
+ Hledger.Cli: modeEmpty :: () => a -> Mode a
- Hledger.Cli: modeFlags :: Mode a -> [Flag a]
+ Hledger.Cli: modeFlags :: () => Mode a -> [Flag a]
- Hledger.Cli: modeModes :: Mode a -> [Mode a]
+ Hledger.Cli: modeModes :: () => Mode a -> [Mode a]
- Hledger.Cli: modes :: String -> a -> Help -> [Mode a] -> Mode a
+ Hledger.Cli: modes :: () => String -> a -> Help -> [Mode a] -> Mode a
- Hledger.Cli: process :: Mode a -> [String] -> Either String a
+ Hledger.Cli: process :: () => Mode a -> [String] -> Either String a
- Hledger.Cli: processArgs :: Mode a -> IO a
+ Hledger.Cli: processArgs :: () => Mode a -> IO a
- Hledger.Cli: processValue :: Mode a -> [String] -> a
+ Hledger.Cli: processValue :: () => Mode a -> [String] -> a
- Hledger.Cli: processValueIO :: Mode a -> [String] -> IO a
+ Hledger.Cli: processValueIO :: () => Mode a -> [String] -> IO a
- Hledger.Cli: remapUpdate :: (a -> b) -> (b -> (a, a -> b)) -> Update a -> Update b
+ Hledger.Cli: remapUpdate :: () => (a -> b) -> (b -> (a, a -> b)) -> Update a -> Update b
- Hledger.Cli: toGroup :: [a] -> Group a
+ Hledger.Cli: toGroup :: () => [a] -> Group a
- Hledger.Cli.Commands.Checkdupes: checkdupes :: p -> Journal -> IO ()
+ Hledger.Cli.Commands.Checkdupes: checkdupes :: () => p -> Journal -> IO ()

Files

CHANGES.md view
@@ -1,6 +1,140 @@ User-visible changes in the hledger command line tool and library.  +# 1.19 2020-09-01++## general++- When parsing dates, the year is now required to have at least four+  digits. So eg we no longer accept `200/1/1` as a valid date, it+  would need to be written `0200/1/1`. This was done for.. reasons,+  and is experimental; let us know if it causes you trouble.++- The --color/--colour=WHEN command line option, support for the+  NO_COLOR environment variable, and smarter autodetection of colour+  terminals have been added (#1296)++- Command line options taking a numeric argument are now validated+  more carefully, preventing issues with unexpected negatives or Int+  overflow. (Stephen Morgan)++- In queries, you can now specify a quarter like `2020q1` or `q4`+  (the q is case-insensitive). (#1247, Henning Thieleman, Stephen Morgan)++- In report intervals, `fortnightly` has been added as a synonym for+  `biweekly`. (Stephen Morgan)++- -t and -l command line flags have been added as short forms of+  --tree and --flat (#1286)++- All reports displaying accounts now choose flat mode by default+  (Stephen Morgan)++- Reports now show at most 2 commodities of multicommodity amounts,+  unless the --no-elide flag is used. This helps keep them readable by+  default, since multicolumn, multicommodity balance reports otherwise+  tend to become very wide, especially in tree mode.++- Numbers with more than 255 decimal places, which we do not support,+  now give an error instead of silently misparsing. (#1326)++- Digit groups are now limited to at most 255 digits each. (#1326)++- Account aliases (on command line or in journal) containing a bad+  regular expression now give a more detailed error message.++- A tab character could get parsed as part of a commodity symbol, with+  confusing results. This no longer happens. (#1301, Dmitry Astapov)++- Debug output is now organised better by debug level.+  The levels are:++  0. normal command output only (no warnings)+  1. useful warnings & most common troubleshooting info (valuation, eg)+  2. common troubleshooting info, more detail+  3. report options selection+  4. report generation+  5. report generation, more detail+  6. input file reading+  7. input file reading, more detail+  8. command line parsing+  9. any other rarely needed or more in-depth info++- Added a missing lower bound for aeson, making cabal installs more+  reliable. (#1268)++- lib: parseAmountQueryTerm: allow whitespace around arg parts (#1312)+  Whitespace around the operator, sign, or number is now tolerated.++## commands++- account,bal,bs,cf,is: --drop now also works in tree mode (Stephen Morgan)++- add: fix an error in the command line help (arguments are inputs,+  not a query)++- aregister: a new command showing a transaction-oriented account+  register, like hledger-ui, hledger-web, or your bank statement. +  Each line represents a whole transaction in one account, unlike+  the register command which shows individual postings possibly from+  multiple accounts. You might prefer aregister when reconciling+  real-world asset/liability accounts, and register when reviewing+  detailed revenues/expenses. (#1294)++- bal,bs,cf,is: boring parents are now elided by default in tabular+  balance reports too, like single-column reports. (Stephen Morgan)++- bal,bs,cf,is: monthly column headings are no longer elided to just+  the short month name, if multiple years are being displayed.++- bal --budget's column headings are now end dates rather than+  periods when appropriate (ie with --cumulative or --historical).++- bs,cf,is: -%/--no-total no longer forces --no-total (Stephen Morgan)++- bs,cf,is: --no-total now hides subtotals as well as the grand total+  (Stephen Morgan)++- codes: a new command for listing transaction codes++- print: a new `sql` output format has been added (Dmitry Astapov)++- roi: errors are now shown without a call stack++- tags: add --parsed flag, hide empties without --empty. With the+  --parsed flag, all tags or values are shown in the order they are+  parsed from the input data, including duplicates. With -E/--empty,+  any blank/empty values will also be shown, otherwise they are+  omitted.++## journal format++- account directives can specify a new `Cash` account type. This is a+  subtype of `Asset`, denoting accounts which should be displayed+  in `cashflow` reports. +  +- The built-in regular expressions for choosing default account types+  have been tweaked, and documentation for account types has been+  improved.++## csv format++- Inferring the appropriate default field separator based on file+  extension (, for .csv, ; for .ssv, \t for .tsv) now works as+  documented.++- Conditional rule patterns can now be grouped with the `&` (AND) operator,+  allowing more powerful matching. (Michael Sanders)++- Invalid csv rules files now give clearer parse error messages.+  (Dmitry Astapov)++- "If tables", a compact bulk format for conditional rules, have been+  added. (Dmitry Astapov)++- csv conversion with a lot of conditional rules is now faster (Dmitry Astapov)++ # 1.18.1 2020-06-21  - journal: document recursive wildcards
Hledger/Cli/CliOptions.hs view
@@ -5,13 +5,14 @@  -} -{-# LANGUAGE CPP, ScopedTypeVariables, DeriveDataTypeable, FlexibleContexts, TypeFamilies, OverloadedStrings, PackageImports #-}+{-# LANGUAGE CPP, ScopedTypeVariables, FlexibleContexts, TypeFamilies, OverloadedStrings, PackageImports #-}  module Hledger.Cli.CliOptions (    -- * cmdargs flags & modes   helpflags,   detailedversionflag,+  flattreeflags,   hiddenflags,   inputflags,   reportflags,@@ -170,13 +171,12 @@      ])  ,flagReq  ["value"]         (\s opts -> Right $ setopt "value" s opts) "TYPE[,COMM]"    (unlines-     ["TYPE is cost, end, now or YYYY-MM-DD."-     ,"COMM is an optional commodity symbol."-     ,"Shows amounts converted to:"-     ,"- cost using transaction prices, then optionally to COMM using period-end market prices"-     ,"- period-end market value, in default valuation commodity or COMM"-     ,"- current market value, in default valuation commodity or COMM"-     ,"- market value on the given date, in default valuation commodity or COMM"+     ["show amounts converted with valuation TYPE, and optionally to specified commodity COMM. TYPE can be:"+     ,"'cost': convert to cost using transaction prices, then optionally to COMM using period-end market prices"+     ,"'then': convert to contemporaneous market value, in default valuation commodity or COMM (print & register commands only)"+     ,"'end':  convert to period-end market value, in default valuation commodity or COMM"+     ,"'now':  convert to current market value, in default valuation commodity or COMM"+     ,"YYYY-MM-DD: convert to market value on the given date, in default valuation commodity or COMM"      ])  ,flagNone ["infer-value"]   (setboolopt "infer-value") "with -V/-X/--value, also infer market prices from transactions" @@ -188,8 +188,30 @@    , "Also, in hledger-ui, make future transactions visible."    , "Note that = (and not a space) is required before PERIODEXP if you wish to supply it."    ])++  -- general output-related++ ,flagReq  ["color","colour"] (\s opts -> Right $ setopt "color" s opts) "WHEN"+   (unlines+     ["Should color-supporting commands use ANSI color codes in text output."+     ,"'auto' (default): whenever stdout seems to be a color-supporting terminal."+     ,"'always' or 'yes': always, useful eg when piping output into 'less -R'."+     ,"'never' or 'no': never."+     ,"A NO_COLOR environment variable overrides this."+     ])  ] +-- | Flags for selecting flat/tree mode, used for reports organised by account.+-- With a True argument, shows some extra help about inclusive/exclusive amounts.+flattreeflags :: Bool -> [Flag RawOpts]+flattreeflags showamounthelp = [+   flagNone ["flat","l"] (setboolopt "flat")+     ("show accounts as a flat list (default)"+      ++ if showamounthelp then ". Amounts exclude subaccount amounts, except where the account is depth-clipped." else "")+  ,flagNone ["tree","t"] (setboolopt "tree")+    ("show accounts as a tree" ++ if showamounthelp then ". Amounts include subaccount amounts." else "")+  ]+ -- | Common flags that are accepted but not shown in --help, -- such as --effective, --aux-date. hiddenflags :: [Flag RawOpts]@@ -301,7 +323,7 @@   -> [Flag RawOpts] -> ([Arg RawOpts], Maybe (Arg RawOpts)) -> Mode RawOpts hledgerCommandMode doc unnamedflaggroup namedflaggroups hiddenflaggroup argsdescr =   case parseCommandDoc doc of-    Nothing -> error' $ "Could not parse command doc:\n"++doc++"\n"+    Nothing -> error' $ "Could not parse command doc:\n"++doc++"\n"  -- PARTIAL:     Just (names, shorthelp, longhelplines) ->       (defCommandMode names) {          modeHelp        = shorthelp@@ -391,7 +413,7 @@                                         -- 1. the COLUMNS env var, if set                                         -- 2. the width reported by the terminal, if supported                                         -- 3. the default (80)- } deriving (Show, Data, Typeable)+ } deriving (Show)  instance Default CliOpts where def = defcliopts @@ -446,7 +468,7 @@              ,reportopts_      = ropts              ,output_file_     = maybestringopt "output-file" rawopts              ,output_format_   = maybestringopt "output-format" rawopts-             ,debug_           = intopt "debug" rawopts+             ,debug_           = posintopt "debug" rawopts              ,no_new_accounts_ = boolopt "no-new-accounts" rawopts -- add              ,width_           = maybestringopt "width" rawopts              ,available_width_ = availablewidth
Hledger/Cli/Commands.hs view
@@ -20,6 +20,7 @@   ,module Hledger.Cli.Commands.Accounts   ,module Hledger.Cli.Commands.Activity   ,module Hledger.Cli.Commands.Add+  ,module Hledger.Cli.Commands.Aregister   ,module Hledger.Cli.Commands.Balance   ,module Hledger.Cli.Commands.Balancesheet   ,module Hledger.Cli.Commands.Balancesheetequity@@ -27,6 +28,7 @@   ,module Hledger.Cli.Commands.Checkdates   ,module Hledger.Cli.Commands.Checkdupes   ,module Hledger.Cli.Commands.Close+  ,module Hledger.Cli.Commands.Codes   ,module Hledger.Cli.Commands.Commodities   ,module Hledger.Cli.Commands.Descriptions   ,module Hledger.Cli.Commands.Diff@@ -59,12 +61,13 @@ import System.Console.CmdArgs.Explicit as C import Test.Tasty (defaultMain) -import Hledger +import Hledger import Hledger.Cli.CliOptions import Hledger.Cli.Version import Hledger.Cli.Commands.Accounts import Hledger.Cli.Commands.Activity import Hledger.Cli.Commands.Add+import Hledger.Cli.Commands.Aregister import Hledger.Cli.Commands.Balance import Hledger.Cli.Commands.Balancesheet import Hledger.Cli.Commands.Balancesheetequity@@ -72,6 +75,7 @@ import Hledger.Cli.Commands.Checkdates import Hledger.Cli.Commands.Checkdupes import Hledger.Cli.Commands.Close+import Hledger.Cli.Commands.Codes import Hledger.Cli.Commands.Commodities import Hledger.Cli.Commands.Descriptions import Hledger.Cli.Commands.Diff@@ -100,6 +104,7 @@    (accountsmode           , accounts)   ,(activitymode           , activity)   ,(addmode                , add)+  ,(aregistermode          , aregister)   ,(balancemode            , balance)   ,(balancesheetequitymode , balancesheetequity)   ,(balancesheetmode       , balancesheet)@@ -107,6 +112,7 @@   ,(checkdatesmode         , checkdates)   ,(checkdupesmode         , checkdupes)   ,(closemode              , close)+  ,(codesmode              , codes)   ,(commoditiesmode        , commodities)   ,(descriptionsmode        , descriptions)   ,(diffmode               , diff)@@ -131,7 +137,7 @@ -- | The commands list, showing command names, standard aliases, -- and short descriptions. This is modified at runtime, as follows: ----- PROGVERSION is replaced with the program name and version.+-- progversion is the program name and version. -- -- Lines beginning with a space represent builtin commands, with format: --  COMMAND (ALIASES) DESCRIPTION@@ -146,10 +152,10 @@ -- -- TODO: generate more of this automatically. -- -commandsList :: String-commandsList = unlines [+commandsList :: String -> [String] -> [String]+commandsList progversion othercmds = [    "-------------------------------------------------------------------------------"-  ,"PROGVERSION"+  ,progversion   ,"Usage: hledger COMMAND [OPTIONS] [-- ADDONCMDOPTIONS]"   ,"Commands (+ addons found in $PATH):"   ,""@@ -169,6 +175,7 @@   ," rewrite                  generate automated postings/diffs (old, use --auto)"   ,""   ,"Financial reports:"+  ," aregister (areg)         show transactions in a particular account"   ," balancesheet (bs)        show assets, liabilities and net worth"   ," balancesheetequity (bse) show assets, liabilities and equity"   ," cashflow (cf)            show changes in liquid assets"@@ -180,6 +187,7 @@   ," accounts (a)             show account names"   ," activity                 show postings-per-interval bar charts"   ," balance (b, bal)         show balance changes/end balances/budgets in accounts"+  ," codes                    show transaction codes"   ," commodities              show commodity/currency symbols"   ," descriptions             show unique transaction descriptions"   ," files                    show input file paths"@@ -200,8 +208,10 @@   ,"+api                      run http api server"   ,""   ,"Other:"-  ,"OTHER"-  ,"Help:"+  ] +++  othercmds+  +++  ["Help:"   ," (no arguments)           show this commands list"   ," -h                       show general flags"   ," COMMAND -h               show flags & docs for COMMAND"@@ -223,25 +233,21 @@  -- | Extract the command names from commandsList: the first word -- of lines beginning with a space or + sign.-commandsFromCommandsList :: String -> [String]+commandsFromCommandsList :: [String] -> [String] commandsFromCommandsList s =-  [w | c:l <- lines s, c `elem` [' ','+'], let w:_ = words l]+  [w | c:l <- s, c `elem` [' ','+'], let w:_ = words l]  knownCommands :: [String]-knownCommands = sort $ commandsFromCommandsList commandsList+knownCommands = sort . commandsFromCommandsList $ commandsList prognameandversion []  -- | Print the commands list, modifying the template above based on -- the currently available addons. Missing addons will be removed, and -- extra addons will be added under Misc. printCommandsList :: [String] -> IO () printCommandsList addonsFound =-  putStr $-  regexReplace "PROGVERSION" (prognameandversion) $-  regexReplace "OTHER" (unlines $ (map ('+':) unknownCommandsFound)) $-  unlines $ concatMap adjustline $ lines $-  cmdlist+    putStr . unlines . concatMap adjustline $+    commandsList prognameandversion (map ('+':) unknownCommandsFound)   where-    cmdlist = commandsList     commandsFound = map (' ':) builtinCommandNames ++ map ('+':) addonsFound     unknownCommandsFound = addonsFound \\ knownCommands @@ -287,6 +293,7 @@ tests_Commands = tests "Commands" [    tests_Balance   ,tests_Register+  ,tests_Aregister    -- some more tests easiest to define here: @@ -295,7 +302,7 @@         let           ignoresourcepos j = j{jtxns=map (\t -> t{tsourcepos=nullsourcepos}) (jtxns j)}           sameParse str1 str2 = do-            j1 <- readJournal def Nothing str1 >>= either error' (return . ignoresourcepos)+            j1 <- readJournal def Nothing str1 >>= either error' (return . ignoresourcepos)  -- PARTIAL:             j2 <- readJournal def Nothing str2 >>= either error' (return . ignoresourcepos)             j1 @?= j2{jlastreadtime=jlastreadtime j1, jfiles=jfiles j1} --, jparsestate=jparsestate j1}         sameParse@@ -313,19 +320,19 @@            )      ,test "preserves \"virtual\" posting type" $ do-      j <- readJournal def Nothing "apply account test\n2008/12/07 One\n  (from)  $-1\n  (to)  $1\n" >>= either error' return+      j <- readJournal def Nothing "apply account test\n2008/12/07 One\n  (from)  $-1\n  (to)  $1\n" >>= either error' return  -- PARTIAL:       let p = head $ tpostings $ head $ jtxns j       paccount p @?= "test:from"       ptype p @?= VirtualPosting     ]    ,test "alias directive" $ do-    j <- readJournal def Nothing "!alias expenses = equity:draw:personal\n1/1\n (expenses:food)  1\n" >>= either error' return+    j <- readJournal def Nothing "!alias expenses = equity:draw:personal\n1/1\n (expenses:food)  1\n" >>= either error' return  -- PARTIAL:     let p = head $ tpostings $ head $ jtxns j     paccount p @?= "equity:draw:personal:food"    ,test "Y default year directive" $ do-    j <- readJournal def Nothing defaultyear_journal_txt >>= either error' return+    j <- readJournal def Nothing defaultyear_journal_txt >>= either error' return  -- PARTIAL:     tdate (head $ jtxns j) @?= fromGregorian 2009 1 1    ,test "ledgerAccountNames" $@@ -354,7 +361,7 @@  -- test data --- date1 = parsedate "2008/11/26"+-- date1 = fromGregorian 2008 11 26 -- t1 = LocalTime date1 midday  {-@@ -560,7 +567,7 @@            txnTieKnot Transaction {              tindex=0,              tsourcepos=nullsourcepos,-             tdate=parsedate "2007/01/01",+             tdate=fromGregorian 2007 01 01,              tdate2=Nothing,              tstatus=Unmarked,              tcode="*",@@ -577,7 +584,7 @@            txnTieKnot Transaction {              tindex=0,              tsourcepos=nullsourcepos,-             tdate=parsedate "2007/02/01",+             tdate=fromGregorian 2007 02 01,              tdate2=Nothing,              tstatus=Unmarked,              tcode="*",@@ -594,7 +601,7 @@            txnTieKnot Transaction {              tindex=0,              tsourcepos=nullsourcepos,-             tdate=parsedate "2007/01/02",+             tdate=fromGregorian 2007 01 02,              tdate2=Nothing,              tstatus=Unmarked,              tcode="*",@@ -611,7 +618,7 @@            txnTieKnot Transaction {              tindex=0,              tsourcepos=nullsourcepos,-             tdate=parsedate "2007/01/03",+             tdate=fromGregorian 2007 01 03,              tdate2=Nothing,              tstatus=Unmarked,              tcode="*",@@ -628,7 +635,7 @@            txnTieKnot Transaction {              tindex=0,              tsourcepos=nullsourcepos,-             tdate=parsedate "2007/01/03",+             tdate=fromGregorian 2007 01 03,              tdate2=Nothing,              tstatus=Unmarked,              tcode="*",@@ -645,7 +652,7 @@            txnTieKnot Transaction {              tindex=0,              tsourcepos=nullsourcepos,-             tdate=parsedate "2007/01/03",+             tdate=fromGregorian 2007 01 03,              tdate2=Nothing,              tstatus=Unmarked,              tcode="*",
Hledger/Cli/Commands/Accounts.hs view
@@ -36,12 +36,12 @@ -- | Command line options for this command. accountsmode = hledgerCommandMode   $(embedFileRelative "Hledger/Cli/Commands/Accounts.txt")-  [flagNone ["declared"] (setboolopt "declared") "show account names declared with account directives"+  ([flagNone ["declared"] (setboolopt "declared") "show account names declared with account directives"   ,flagNone ["used"] (setboolopt "used") "show account names referenced by transactions"-  ,flagNone ["tree"] (setboolopt "tree") "show short account names, as a tree"-  ,flagNone ["flat"] (setboolopt "flat") "show full account names, as a list (default)"-  ,flagReq  ["drop"] (\s opts -> Right $ setopt "drop" s opts) "N" "flat mode: omit N leading account name parts"   ]+  ++ flattreeflags False +++  [flagReq  ["drop"] (\s opts -> Right $ setopt "drop" s opts) "N" "flat mode: omit N leading account name parts"+  ])   [generalflagsgroup1]   hiddenflags   ([], Just $ argsFlag "[QUERY]")@@ -74,16 +74,18 @@   -- 3. if there's a depth limit, depth-clip and remove any no longer useful items       clippedaccts =         dbg1 "clippedaccts" $-        filter (matchesAccount acctq) $  -- clipping can leave accounts that no longer match the query, remove such-        nub $                          -- clipping can leave duplicates (adjacent, hopefully)-        filter (not . T.null) $        -- depth:0 can leave nulls+        filter (matchesAccount acctq) $           -- clipping can leave accounts that no longer match the query, remove such+        nub $                                     -- clipping can leave duplicates (adjacent, hopefully)+        filter (not . T.null) $                   -- depth:0 can leave nulls         map (clipAccountName depth) $  -- clip at depth if specified         sortedaccts    -- 4. print what remains as a list or tree, maybe applying --drop in the former case   mapM_ (T.putStrLn . render) clippedaccts     where-      render a-        | tree_ ropts = T.replicate (2 * (accountNameLevel a - 1)) " " <> accountLeafName a-        | otherwise   = accountNameDrop (drop_ ropts) a-+      render a = case accountlistmode_ ropts of+          ALTree -> T.replicate indent " " <> accountLeafName droppedName+          ALFlat -> droppedName+        where+          indent = 2 * (max 0 (accountNameLevel a - drop_ ropts) - 1)+          droppedName = accountNameDrop (drop_ ropts) a
Hledger/Cli/Commands/Add.hs view
@@ -3,7 +3,7 @@ |-}  {-# OPTIONS_GHC -fno-warn-missing-signatures -fno-warn-unused-do-bind #-}-{-# LANGUAGE ScopedTypeVariables, DeriveDataTypeable, RecordWildCards, TypeOperators, FlexibleContexts, OverloadedStrings, PackageImports, LambdaCase #-}+{-# LANGUAGE ScopedTypeVariables, RecordWildCards, TypeOperators, FlexibleContexts, OverloadedStrings, PackageImports, LambdaCase #-} {-# LANGUAGE TemplateHaskell #-}  module Hledger.Cli.Commands.Add (@@ -32,7 +32,6 @@ import qualified Data.Text as T import Data.Time.Calendar (Day) import Data.Time.Format (formatTime, defaultTimeLocale, iso8601DateFormat)-import Data.Typeable (Typeable) import Safe (headDef, headMay, atMay) import System.Console.CmdArgs.Explicit import System.Console.Haskeline (runInputT, defaultSettings, setComplete)@@ -54,7 +53,7 @@   [flagNone ["no-new-accounts"]  (setboolopt "no-new-accounts") "don't allow creating new accounts"]   [generalflagsgroup2]   []-  ([], Just $ argsFlag "[QUERY]")+  ([], Just $ argsFlag "[DATE [DESCRIPTION [ACCOUNT1 [AMOUNT1 [ACCOUNT2 [ETC...]]]]]]")  -- | State used while entering transactions. data EntryState = EntryState {@@ -65,7 +64,7 @@   ,esJournal            :: Journal           -- ^ the journal we are adding to   ,esSimilarTransaction :: Maybe Transaction -- ^ the most similar historical txn   ,esPostings           :: [Posting]         -- ^ postings entered so far in the current txn-  } deriving (Show,Typeable)+  } deriving (Show)  defEntryState = EntryState {    esOpts               = defcliopts@@ -77,10 +76,10 @@   ,esPostings           = [] } -data RestartTransactionException = RestartTransactionException deriving (Typeable,Show)+data RestartTransactionException = RestartTransactionException deriving (Show) instance Exception RestartTransactionException --- data ShowHelpException = ShowHelpException deriving (Typeable,Show)+-- data ShowHelpException = ShowHelpException deriving (Show) -- instance Exception ShowHelpException  -- | Read multiple transactions from the console, prompting for each@@ -121,7 +120,7 @@   let defaultPrevInput = PrevInput{prevDateAndCode=Nothing, prevDescAndCmnt=Nothing, prevAccount=[], prevAmountAndCmnt=[]}   mt <- runInputT (setComplete noCompletion defaultSettings) (System.Console.Wizard.run $ haskeline $ confirmedTransactionWizard defaultPrevInput es [])   case mt of-    Nothing -> error "Could not interpret the input, restarting"  -- caught below causing a restart, I believe+    Nothing -> error "Could not interpret the input, restarting"  -- caught below causing a restart, I believe  -- PARTIAL:     Just t -> do       j <- if debug_ esOpts > 0            then do hPrintf stderr "Skipping journal add due to debug mode.\n"@@ -279,7 +278,7 @@             dateandcodep = do                 d <- smartdate                 c <- optional codep-                skipMany spacenonewline+                skipNonNewlineSpaces                 eof                 return (d, fromMaybe "" c)       -- defday = fixSmartDate today $ fromparse $ (parse smartdate "" . lowercase) defdate@@ -356,7 +355,7 @@       amountandcommentp :: JournalParser Identity (Amount, Text)       amountandcommentp = do         a <- amountp-        lift (skipMany spacenonewline)+        lift skipNonNewlineSpaces         c <- T.pack <$> fromMaybe "" `fmap` optional (char ';' >> many anySingle)         -- eof         return (a,c)@@ -371,7 +370,7 @@                   -- 4 maximum precision entered so far in this transaction ?                   -- 5 3 or 4, whichever would show the most decimal places ?                   -- I think 1 or 4, whichever would show the most decimal places-                  maxprecisionwithpoint+                  NaturalPrecision   --   -- let -- (amt,comment) = (strip a, strip $ dropWhile (==';') b) where (a,b) = break (==';') amtcmt       -- a           = fromparse $ runParser (amountp <|> return missingamt) (jparsestate esJournal) "" amt
Hledger/Cli/Commands/Add.txt view
@@ -1,5 +1,6 @@ add-Prompt for transactions and add them to the journal.+Prompt for transactions and add them to the journal. Any arguments will+be used as default inputs for the first N prompts.  _FLAGS @@ -62,5 +63,4 @@ Date [2015/05/22]: <CTRL-D> $  On Microsoft Windows, the add command makes sure that no part of the-file path ends with a period, as it can cause data loss on that platform-(cf #1056).+file path ends with a period, as that would cause problems (#1056).
+ Hledger/Cli/Commands/Aregister.hs view
@@ -0,0 +1,248 @@+{-|++The @aregister@ command lists a single account's transactions,+like the account register in hledger-ui and hledger-web,+and unlike the register command which lists postings across multiple accounts.++-}++{-# LANGUAGE CPP #-}+{-# LANGUAGE NamedFieldPuns #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE TemplateHaskell #-}++module Hledger.Cli.Commands.Aregister (+  aregistermode+ ,aregister+ -- ,showPostingWithBalanceForVty+ ,tests_Aregister+) where++import Control.Monad (when)+import Data.Aeson (toJSON)+import Data.Aeson.Text (encodeToLazyText)+import Data.List+import Data.Maybe+#if !(MIN_VERSION_base(4,11,0))+import Data.Semigroup ((<>))+#endif+import qualified Data.Text as T+import qualified Data.Text.Lazy as TL+import Data.Time (addDays)+import Safe (headDef)+import System.Console.CmdArgs.Explicit+import Hledger.Read.CsvReader (CSV, CsvRecord, printCSV)++import Hledger+import Hledger.Cli.CliOptions+import Hledger.Cli.Utils++aregistermode = hledgerCommandMode+  $(embedFileRelative "Hledger/Cli/Commands/Aregister.txt")+  ([+   flagNone ["txn-dates"] (setboolopt "txn-dates") +     "filter strictly by transaction date, not posting date. Warning: this can show a wrong running balance."+   ,flagNone ["no-elide"] (setboolopt "no-elide") "don't limit amount commodities shown to 2"+  --  flagNone ["cumulative"] (setboolopt "change")+  --    "show running total from report start date (default)"+  -- ,flagNone ["historical","H"] (setboolopt "historical")+  --    "show historical running total/balance (includes postings before report start date)\n "+  -- ,flagNone ["average","A"] (setboolopt "average")+  --    "show running average of posting amounts instead of total (implies --empty)"+  -- ,flagNone ["related","r"] (setboolopt "related") "show postings' siblings instead"+  -- ,flagNone ["invert"] (setboolopt "invert") "display all amounts with reversed sign"+  ,flagReq  ["width","w"] (\s opts -> Right $ setopt "width" s opts) "N"+     ("set output width (default: " +++#ifdef mingw32_HOST_OS+      show defaultWidth+#else+      "terminal width"+#endif+      ++ " or $COLUMNS). -wN,M sets description width as well."+     )+  ,outputFormatFlag ["txt","csv","json"]+  ,outputFileFlag+  ])+  [generalflagsgroup1]+  hiddenflags+  ([], Just $ argsFlag "ACCTPAT [QUERY]")++-- based on Hledger.UI.RegisterScreen:++-- | Print an account register report for a specified account.+aregister :: CliOpts -> Journal -> IO ()+aregister opts@CliOpts{rawopts_=rawopts,reportopts_=ropts} j = do+  d <- getCurrentDay+  -- the first argument specifies the account, any remaining arguments are a filter query+  let args' = listofstringopt "args" rawopts+  when (null args') $ error' "aregister needs an account, please provide an account name or pattern"  -- PARTIAL:+  let+    (apat:queryargs) = args'+    acct = headDef (error' $ show apat++" did not match any account")   -- PARTIAL:+           . filterAccts $ journalAccountNames j+    filterAccts = case toRegexCI apat of+        Right re -> filter (regexMatch re . T.unpack)+        Left  _  -> const []+    -- gather report options+    inclusive = True  -- tree_ ropts+    thisacctq = Acct $ (if inclusive then accountNameToAccountRegex else accountNameToAccountOnlyRegex) acct+    ropts' = ropts{+       query_=unwords $ map quoteIfNeeded $ queryargs+       -- remove a depth limit for reportq, as in RegisterScreen, I forget why XXX+      ,depth_=Nothing+       -- always show historical balance+      ,balancetype_= HistoricalBalance+      }+    reportq = And [queryFromOpts d ropts', excludeforecastq (isJust $ forecast_ ropts)]+      where+        -- As in RegisterScreen, why ? XXX+        -- Except in forecast mode, exclude future/forecast transactions.+        excludeforecastq True = Any+        excludeforecastq False =  -- not:date:tomorrow- not:tag:generated-transaction+          And [+             Not (Date $ DateSpan (Just $ addDays 1 d) Nothing)+            ,Not generatedTransactionTag+          ]+    -- run the report+    -- TODO: need to also pass the queries so we can choose which date to render - move them into the report ?+    (balancelabel,items) = accountTransactionsReport ropts' j reportq thisacctq+    items' = (if empty_ ropts then id else filter (not . mixedAmountLooksZero . fifth6)) $+             reverse items+    -- select renderer+    render | fmt=="json" = (++"\n") . T.unpack . TL.toStrict . encodeToLazyText . toJSON+           | fmt=="csv"  = (++"\n") . printCSV . accountTransactionsReportAsCsv reportq thisacctq+           | fmt=="txt"  = accountTransactionsReportAsText opts reportq thisacctq+           | otherwise   = const $ error' $ unsupportedOutputFormatError fmt  -- PARTIAL:+      where+        fmt = outputFormatFromOpts opts++  writeOutput opts $ render (balancelabel,items')++accountTransactionsReportAsCsv :: Query -> Query -> AccountTransactionsReport -> CSV+accountTransactionsReportAsCsv reportq thisacctq (_,is) =+  ["txnidx","date","code","description","otheraccounts","change","balance"]+  : map (accountTransactionsReportItemAsCsvRecord reportq thisacctq) is++accountTransactionsReportItemAsCsvRecord :: Query -> Query -> AccountTransactionsReportItem -> CsvRecord+accountTransactionsReportItemAsCsvRecord+  reportq thisacctq+  (t@Transaction{tindex,tcode,tdescription}, _, _issplit, otheracctsstr, change, balance)+  = [idx,date,code,desc,otheracctsstr,amt,bal]+  where+    idx  = show tindex+    date = showDate $ transactionRegisterDate reportq thisacctq t+    code = T.unpack tcode+    desc = T.unpack tdescription+    amt  = showMixedAmountOneLineWithoutPrice False change+    bal  = showMixedAmountOneLineWithoutPrice False balance++-- | Render a register report as plain text suitable for console output.+accountTransactionsReportAsText :: CliOpts -> Query -> Query -> AccountTransactionsReport -> String+accountTransactionsReportAsText+  copts@CliOpts{reportopts_=ReportOpts{no_elide_}} reportq thisacctq (_balancelabel,items)+  = unlines $ title :+    map (accountTransactionsReportItemAsText copts reportq thisacctq amtwidth balwidth) items+  where+    amtwidth = maximumStrict $ 12 : map (strWidth . showamt . itemamt) items+    balwidth = maximumStrict $ 12 : map (strWidth . showamt . itembal) items+    showamt+      | no_elide_ = showMixedAmountOneLineWithoutPrice False -- color_+      | otherwise = showMixedAmountElided False+    itemamt (_,_,_,_,a,_) = a+    itembal (_,_,_,_,_,a) = a+    -- show a title indicating which account was picked, which can be confusing otherwise+    title = T.unpack $ maybe "" (("Transactions in "<>).(<>" and subaccounts:")) macct+      where+        -- XXX temporary hack ? recover the account name from the query+        macct = case filterQuery queryIsAcct thisacctq of+                  Acct r -> Just . T.drop 1 . T.dropEnd 5 . T.pack $ reString r  -- Acct "^JS:expenses(:|$)"+                  _      -> Nothing  -- shouldn't happen++-- | Render one account register report line item as plain text. Layout is like so:+-- @+-- <---------------- width (specified, terminal width, or 80) -------------------->+-- date (10)  description           other accounts       change (12)   balance (12)+-- DDDDDDDDDD dddddddddddddddddddd  aaaaaaaaaaaaaaaaaaa  AAAAAAAAAAAA  AAAAAAAAAAAA+-- @+-- If description's width is specified, account will use the remaining space.+-- Otherwise, description and account divide up the space equally.+--+-- Returns a string which can be multi-line, eg if the running balance+-- has multiple commodities.+--+accountTransactionsReportItemAsText :: CliOpts -> Query -> Query -> Int -> Int -> AccountTransactionsReportItem -> String+accountTransactionsReportItemAsText+  copts@CliOpts{reportopts_=ReportOpts{color_,no_elide_}}+  reportq thisacctq preferredamtwidth preferredbalwidth+  (t@Transaction{tdescription}, _, _issplit, otheracctsstr, change, balance)+    -- Transaction -- the transaction, unmodified+    -- Transaction -- the transaction, as seen from the current account+    -- Bool        -- is this a split (more than one posting to other accounts) ?+    -- String      -- a display string describing the other account(s), if any+    -- MixedAmount -- the amount posted to the current account(s) (or total amount posted)+    -- MixedAmount -- the register's running total or the current account(s)'s historical balance, after this transaction++  = intercalate "\n" $+    concat [fitString (Just datewidth) (Just datewidth) True True date+           ," "+           ,fitString (Just descwidth) (Just descwidth) True True desc+           ,"  "+           ,fitString (Just acctwidth) (Just acctwidth) True True accts+           ,"  "+           ,fitString (Just amtwidth) (Just amtwidth) True False amtfirstline+           ,"  "+           ,fitString (Just balwidth) (Just balwidth) True False balfirstline+           ]+    :+    [concat [spacer+            ,fitString (Just amtwidth) (Just amtwidth) True False a+            ,"  "+            ,fitString (Just balwidth) (Just balwidth) True False b+            ]+     | (a,b) <- zip amtrest balrest+     ]+    where+      -- calculate widths+      (totalwidth,mdescwidth) = registerWidthsFromOpts copts+      (datewidth, date) = (10, showDate $ transactionRegisterDate reportq thisacctq t)+      (amtwidth, balwidth)+        | shortfall <= 0 = (preferredamtwidth, preferredbalwidth)+        | otherwise      = (adjustedamtwidth, adjustedbalwidth)+        where+          mincolwidth = 2 -- columns always show at least an ellipsis+          maxamtswidth = max 0 (totalwidth - (datewidth + 1 + mincolwidth + 2 + mincolwidth + 2 + 2))+          shortfall = (preferredamtwidth + preferredbalwidth) - maxamtswidth+          amtwidthproportion = fromIntegral preferredamtwidth / fromIntegral (preferredamtwidth + preferredbalwidth)+          adjustedamtwidth = round $ amtwidthproportion * fromIntegral maxamtswidth+          adjustedbalwidth = maxamtswidth - adjustedamtwidth++      remaining = totalwidth - (datewidth + 1 + 2 + amtwidth + 2 + balwidth)+      (descwidth, acctwidth) = (w, remaining - 2 - w)+        where+          w = fromMaybe ((remaining - 2) `div` 2) mdescwidth++      -- gather content+      desc = T.unpack tdescription+      accts = -- T.unpack $ elideAccountName acctwidth $ T.pack+              otheracctsstr+      showamt+        | no_elide_ = showMixedAmountOneLineWithoutPrice color_+        | otherwise = showMixedAmountElided color_+      amt = showamt change+      bal = showamt balance+      -- alternate behaviour, show null amounts as 0 instead of blank+      -- amt = if null amt' then "0" else amt'+      -- bal = if null bal' then "0" else bal'+      (amtlines, ballines) = (lines amt, lines bal)+      (amtlen, ballen) = (length amtlines, length ballines)+      numlines = max 1 (max amtlen ballen)+      (amtfirstline:amtrest) = take numlines $ amtlines ++ repeat "" -- posting amount is top-aligned+      (balfirstline:balrest) = take numlines $ replicate (numlines - ballen) "" ++ ballines -- balance amount is bottom-aligned+      spacer = replicate (totalwidth - (amtwidth + 2 + balwidth)) ' '++-- tests++tests_Aregister = tests "Aregister" [++ ]
+ Hledger/Cli/Commands/Aregister.txt view
@@ -0,0 +1,60 @@+aregister, areg+Show transactions affecting a particular account, and the account's+running balance.++_FLAGS++aregister shows the transactions affecting a particular account (and its+subaccounts), from the point of view of that account. Each line shows:++-   the transaction's (or posting's, see below) date+-   the names of the other account(s) involved+-   the net change to this account's balance+-   the account's historical running balance (including balance from+    transactions before the report start date).++With aregister, each line represents a whole transaction - as in+hledger-ui, hledger-web, and your bank statement. By contrast, the+register command shows individual postings, across all accounts. You+might prefer aregister for reconciling with real-world asset/liability+accounts, and register for reviewing detailed revenues/expenses.++An account must be specified as the first argument, which should be the+full account name or an account pattern (regular expression). aregister+will show transactions in this account (the first one matched) and any+of its subaccounts.++Any additional arguments form a query which will filter the transactions+shown.++Transactions making a net change of zero are not shown by default; add+the -E/--empty flag to show them.++aregister and custom posting dates++Transactions whose date is outside the report period can still be shown,+if they have a posting to this account dated inside the report period.+(And in this case it's the posting date that is shown.) This ensures+that aregister can show an accurate historical running balance, matching+the one shown by register -H with the same arguments.++To filter strictly by transaction date instead, add the --txn-dates+flag. If you use this flag and some of your postings have custom dates,+it's probably best to assume the running balance is wrong.++Output format++This command also supports the output destination and output format+options The output formats supported are txt, csv, and json.++Examples:++Show all transactions and historical running balance in the first+account whose name contains "checking":++$ hledger areg checking++Show transactions and historical running balance in all asset accounts+during july:++$ hledger areg assets date:jul
Hledger/Cli/Commands/Balance.hs view
@@ -258,6 +258,7 @@ --import qualified Data.Map as Map import qualified Data.Text as T import qualified Data.Text.Lazy as TL+import Data.Time (fromGregorian) import System.Console.CmdArgs.Explicit as C import Lucid as L import Text.Printf (printf)@@ -279,20 +280,20 @@       "show balance change accumulated across periods (in multicolumn reports)"    ,flagNone ["historical","H"] (setboolopt "historical")       "show historical ending balance in each period (includes postings before report start date)\n "-   ,flagNone ["tree"] (setboolopt "tree") "show accounts as a tree; amounts include subaccounts (default in simple reports)"-   ,flagNone ["flat"] (setboolopt "flat") "show accounts as a list; amounts exclude subaccounts except when account is depth-clipped (default in multicolumn reports)\n "+   ]+   ++ flattreeflags True +++   [flagReq  ["drop"] (\s opts -> Right $ setopt "drop" s opts) "N" "omit N leading account name parts (in flat mode)"    ,flagNone ["average","A"] (setboolopt "average") "show a row average column (in multicolumn reports)"    ,flagNone ["row-total","T"] (setboolopt "row-total") "show a row total column (in multicolumn reports)"    ,flagNone ["no-total","N"] (setboolopt "no-total") "omit the final total row"-   ,flagReq  ["drop"] (\s opts -> Right $ setopt "drop" s opts) "N" "omit N leading account name parts (in flat mode)"    ,flagNone ["no-elide"] (setboolopt "no-elide") "don't squash boring parent accounts (in tree mode)"    ,flagReq  ["format"] (\s opts -> Right $ setopt "format" s opts) "FORMATSTR" "use this custom line format (in simple reports)"    ,flagNone ["pretty-tables"] (setboolopt "pretty-tables") "use unicode to display prettier tables"    ,flagNone ["sort-amount","S"] (setboolopt "sort-amount") "sort by amount instead of account code/name (in flat mode). With multiple columns, sorts by the row total, or by row average if that is displayed."-   ,flagNone ["budget"] (setboolopt "budget") "show performance compared to budget goals defined by periodic transactions"+   ,flagNone ["percent", "%"] (setboolopt "percent") "express values in percentage of each column's total"    ,flagNone ["invert"] (setboolopt "invert") "display all amounts with reversed sign"    ,flagNone ["transpose"] (setboolopt "transpose") "transpose rows and columns"-   ,flagNone ["percent", "%"] (setboolopt "percent") "express values in percentage of each column's total"+   ,flagNone ["budget"] (setboolopt "budget") "show performance compared to budget goals defined by periodic transactions"    ,outputFormatFlag ["txt","html","csv","json"]    ,outputFileFlag    ]@@ -304,6 +305,7 @@ -- | The balance command, prints a balance report. balance :: CliOpts -> Journal -> IO () balance opts@CliOpts{rawopts_=rawopts,reportopts_=ropts@ReportOpts{..}} j = do+  -- PARTIAL:   d <- getCurrentDay   case lineFormatFromOpts ropts of     Left err -> error' $ unlines [err]@@ -314,9 +316,9 @@        if budget then do  -- single or multi period budget report         reportspan <- reportSpan j ropts-        let budgetreport     = dbg1 "budgetreport"     $ budgetReport ropts assrt reportspan d j+        let budgetreport = dbg4 "budgetreport" $ budgetReport ropts assrt reportspan d j               where-                assrt          = not $ ignore_assertions_ $ inputopts_ opts+                assrt = not $ ignore_assertions_ $ inputopts_ opts             render = case fmt of               "txt"  -> budgetReportAsText ropts               "json" -> (++"\n") . TL.unpack . toJsonText@@ -335,13 +337,7 @@           writeOutput opts $ render report          else do  -- single period simple balance report-          let report-                | balancetype_ `elem` [HistoricalBalance, CumulativeChange]-                  = let ropts' | flat_ ropts = ropts-                               | otherwise   = ropts{accountlistmode_=ALTree}-                    in balanceReportFromMultiBalanceReport ropts' (queryFromOpts d ropts) j-                          -- for historical balances we must use balanceReportFromMultiBalanceReport (also forces --no-elide)-                | otherwise = balanceReport ropts (queryFromOpts d ropts) j -- simple Ledger-style balance report+          let report = balanceReport ropts (queryFromOpts d ropts) j -- simple Ledger-style balance report               render = case fmt of                 "txt"  -> balanceReportAsText                 "csv"  -> \ropts r -> (++ "\n") $ printCSV $ balanceReportAsCsv ropts r@@ -355,11 +351,11 @@ balanceReportAsCsv :: ReportOpts -> BalanceReport -> CSV balanceReportAsCsv opts (items, total) =   ["account","balance"] :-  [[T.unpack (maybeAccountNameDrop opts a), showMixedAmountOneLineWithoutPrice b] | (a, _, _, b) <- items]+  [[T.unpack a, showMixedAmountOneLineWithoutPrice False b] | (a, _, _, b) <- items]   ++   if no_total_ opts   then []-  else [["total", showMixedAmountOneLineWithoutPrice total]]+  else [["total", showMixedAmountOneLineWithoutPrice False total]]  -- | Render a single-column balance report as plain text. balanceReportAsText :: ReportOpts -> BalanceReport -> String@@ -404,7 +400,7 @@ balanceReportItemAsText :: ReportOpts -> StringFormat -> BalanceReportItem -> [String] balanceReportItemAsText opts fmt (_, accountName, depth, amt) =   renderBalanceReportItem opts fmt (-    maybeAccountNameDrop opts accountName,+    accountName,     depth,     normaliseMixedAmountSquashPricesForDisplay amt     )@@ -432,10 +428,7 @@                                  Just m  -> depth * m                                  Nothing -> depth   AccountField     -> formatString ljust min max (T.unpack acctname)-  TotalField       -> fitStringMulti min max True False $ showamt total-    where-      showamt | color_ opts = cshowMixedAmountWithoutPrice-              | otherwise   = showMixedAmountWithoutPrice+  TotalField       -> fitStringMulti min max True False $ showMixedAmountWithoutPrice (color_ opts) total   _                -> ""  -- | Render one StringFormat component for a balance report item.@@ -452,8 +445,7 @@                         indented = ((replicate (depth*2) ' ')++)   TotalField       -> fitStringMulti min max True False $ ((intercalate ", " . map strip . lines) (showamt total))     where-      showamt | color_ opts = cshowMixedAmountWithoutPrice-              | otherwise   = showMixedAmountWithoutPrice+      showamt = showMixedAmountWithoutPrice (color_ opts)   _                -> ""  -- rendering multi-column balance reports@@ -463,23 +455,23 @@ -- and will include the final totals row unless --no-total is set. multiBalanceReportAsCsv :: ReportOpts -> MultiBalanceReport -> CSV multiBalanceReportAsCsv opts@ReportOpts{average_, row_total_}-    (PeriodicReport colspans items (PeriodicReportRow _ _ coltotals tot avg)) =+    (PeriodicReport colspans items (PeriodicReportRow _ coltotals tot avg)) =   maybetranspose $   ("Account" : map showDateSpan colspans    ++ ["Total"   | row_total_]    ++ ["Average" | average_]   ) :-  [T.unpack (maybeAccountNameDrop opts a) :-   map showMixedAmountOneLineWithoutPrice+  [T.unpack (displayFull a) :+   map (showMixedAmountOneLineWithoutPrice False)    (amts     ++ [rowtot | row_total_]     ++ [rowavg | average_])-  | PeriodicReportRow a _ amts rowtot rowavg <- items]+  | PeriodicReportRow a amts rowtot rowavg <- items]   ++   if no_total_ opts   then []   else ["Total:" :-        map showMixedAmountOneLineWithoutPrice (+        map (showMixedAmountOneLineWithoutPrice False) (           coltotals           ++ [tot | row_total_]           ++ [avg | average_]@@ -504,7 +496,7 @@ multiBalanceReportHtmlRows :: ReportOpts -> MultiBalanceReport -> (Html (), [Html ()], Maybe (Html ())) multiBalanceReportHtmlRows ropts mbr =   let-    headingsrow:rest | transpose_ ropts = error' "Sorry, --transpose is not supported with HTML output yet"+    headingsrow:rest | transpose_ ropts = error' "Sorry, --transpose is not supported with HTML output yet"  -- PARTIAL:                      | otherwise = multiBalanceReportAsCsv ropts mbr     (bodyrows, mtotalsrow) | no_total_ ropts = (rest,      Nothing)                            | otherwise       = (init rest, Just $ last rest)@@ -591,7 +583,7 @@       (showDateSpan $ periodicReportSpan r)       (case value_ of         Just (AtCost _mc)   -> ", valued at cost"-        Just (AtThen _mc)   -> error' unsupportedValueThenError  -- TODO -- ", valued at period ends"  -- handled like AtEnd for now+        Just (AtThen _mc)   -> error' unsupportedValueThenError  -- TODO -- ", valued at period ends"  -- handled like AtEnd for now  -- PARTIAL:         Just (AtEnd _mc)    -> ", valued at period ends"         Just (AtNow _mc)    -> ", current value"         -- XXX duplicates the above@@ -603,7 +595,7 @@ -- | Build a 'Table' from a multi-column balance report. balanceReportAsTable :: ReportOpts -> MultiBalanceReport -> Table String String MixedAmount balanceReportAsTable opts@ReportOpts{average_, row_total_, balancetype_}-    (PeriodicReport colspans items (PeriodicReportRow _ _ coltotals tot avg)) =+    (PeriodicReport spans items (PeriodicReportRow _ coltotals tot avg)) =    maybetranspose $    addtotalrow $    Table@@ -612,17 +604,13 @@      (map rowvals items)   where     totalscolumn = row_total_ && balancetype_ `notElem` [CumulativeChange, HistoricalBalance]-    mkDate = case balancetype_ of-       PeriodChange -> showDateSpanMonthAbbrev-       _            -> maybe "" (showDate . prevday) . spanEnd-    colheadings = map mkDate colspans+    colheadings = map (reportPeriodName balancetype_ spans) spans                   ++ ["  Total" | totalscolumn]                   ++ ["Average" | average_]     accts = map renderacct items-    renderacct (PeriodicReportRow a i _ _ _)-      | tree_ opts = replicate ((i-1)*2) ' ' ++ T.unpack (accountLeafName a)-      | otherwise  = T.unpack $ maybeAccountNameDrop opts a-    rowvals (PeriodicReportRow _ _ as rowtot rowavg) = as+    renderacct row =+        replicate ((prrDepth row - 1) * 2) ' ' ++ T.unpack (prrDisplayName row)+    rowvals (PeriodicReportRow _ as rowtot rowavg) = as                              ++ [rowtot | totalscolumn]                              ++ [rowavg | average_]     addtotalrow | no_total_ opts = id@@ -636,12 +624,14 @@  -- | Given a table representing a multi-column balance report (for example, -- made using 'balanceReportAsTable'), render it in a format suitable for--- console output.+-- console output. Amounts with more than two commodities will be elided+-- unless --no-elide is used. balanceReportTableAsText :: ReportOpts -> Table String String MixedAmount -> String-balanceReportTableAsText ropts = tableAsText ropts showamt+balanceReportTableAsText ropts@ReportOpts{..} = tableAsText ropts showamt   where-    showamt | color_ ropts = cshowMixedAmountOneLineWithoutPrice-            | otherwise    =  showMixedAmountOneLineWithoutPrice+    showamt+      | no_elide_ = showMixedAmountOneLineWithoutPrice color_+      | otherwise = showMixedAmountElided color_   tests_Balance = tests "Balance" [@@ -650,7 +640,7 @@     test "unicode in balance layout" $ do       j <- readJournal' "2009/01/01 * медвежья шкура\n  расходы:покупки  100\n  актив:наличные\n"       let opts = defreportopts-      balanceReportAsText opts (balanceReport opts (queryFromOpts (parsedate "2008/11/26") opts) j)+      balanceReportAsText opts (balanceReport opts (queryFromOpts (fromGregorian 2008 11 26) opts) j)         @?=         unlines         ["                -100  актив:наличные"
Hledger/Cli/Commands/Balance.txt view
@@ -47,7 +47,7 @@ By default, accounts are displayed hierarchically, with subaccounts indented below their parent. At each level of the tree, accounts are sorted by account code if any, then by account name. Or with--S/--sort-amount, by their balance amount.+-S/--sort-amount, by their balance amount, largest first.  "Boring" accounts, which contain a single interesting subaccount and no balance of their own, are elided into the following line for more@@ -128,10 +128,8 @@  Colour support -The balance command shows negative amounts in red, if:---   the TERM environment variable is not set to dumb--   the output is not being redirected or piped anywhere+In terminal output, when colour is enabled, the balance command shows+negative amounts in red.  Flat mode @@ -291,12 +289,18 @@  (Average is rounded to the dollar here since all journal amounts are) -A limitation of multicolumn balance reports: eliding of boring parent-accounts in tree mode, as in the classic balance report, is not yet-supported.- The --transpose flag can be used to exchange the rows and columns of a multicolumn report.++When showing multicommodity amounts, multicolumn balance reports will+elide any amounts which have more than two commodities, since otherwise+columns could get very wide. The --no-elide flag disables this. Hiding+totals with the -N/--no-total flag can also help reduce the width of+multicommodity reports.++When the report is still too wide, a good workaround is to pipe it into+less -RS (-R for colour, -S to chop long lines). Eg:+hledger bal -D --color=yes | less -RS.  Budget report 
Hledger/Cli/Commands/Balancesheet.txt view
@@ -1,14 +1,15 @@ balancesheet, bs-This command displays a simple balance sheet, showing historical ending-balances of asset and liability accounts (ignoring any report begin-date). It assumes that these accounts are under a top-level asset or-liability account (case insensitive, plural forms also allowed).--Note this report shows all account balances with normal positive sign-(like conventional financial statements, unlike balance/print/register)-(experimental).+This command displays a balance sheet, showing historical ending+balances of asset and liability accounts. (To see equity as well, use+the balancesheetequity command.) Amounts are shown with normal positive+sign, as in conventional financial statements.  _FLAGS++The asset and liability accounts shown are those accounts declared with+the Asset or Cash or Liability type, or otherwise all accounts under a+top-level asset or liability account (case insensitive, plurals+allowed).  Example: 
Hledger/Cli/Commands/Balancesheetequity.txt view
@@ -1,8 +1,14 @@ balancesheetequity, bse-Just like balancesheet, but also reports Equity (which it assumes is-under a top-level equity account).+This command displays a balance sheet, showing historical ending+balances of asset, liability and equity accounts. Amounts are shown with+normal positive sign, as in conventional financial statements.  _FLAGS++The asset, liability and equity accounts shown are those accounts+declared with the Asset, Cash, Liability or Equity type, or otherwise+all accounts under a top-level asset, liability or equity account (case+insensitive, plurals allowed).  Example: 
Hledger/Cli/Commands/Cashflow.txt view
@@ -1,12 +1,14 @@ cashflow, cf-This command displays a simple cashflow statement, showing changes in-"cash" accounts. It assumes that these accounts are under a top-level-asset account (case insensitive, plural forms also allowed) and do not-contain receivable or A/R in their name. Note this report shows all-account balances with normal positive sign (like conventional financial-statements, unlike balance/print/register) (experimental).+This command displays a cashflow statement, showing the inflows and+outflows affecting "cash" (ie, liquid) assets. Amounts are shown with+normal positive sign, as in conventional financial statements.  _FLAGS++The "cash" accounts shown are those accounts declared with the Cash+type, or otherwise all accounts under a top-level asset account (case+insensitive, plural allowed) which do not have fixed, investment,+receivable or A/R in their name.  Example: 
Hledger/Cli/Commands/Close.hs view
@@ -86,7 +86,7 @@                   False -> normaliseMixedAmount . mixedAmountStripPrices      -- the balances to close-    (acctbals,_) = balanceReportFromMultiBalanceReport ropts_ q j+    (acctbals,_) = balanceReport ropts_ q j     totalamt = sum $ map (\(_,_,_,b) -> normalise b) acctbals      -- since balance assertion amounts are required to be exact, the
+ Hledger/Cli/Commands/Codes.hs view
@@ -0,0 +1,42 @@+{-|++The @codes@ command lists the codes seen in transactions, in the order parsed.++-}++{-# LANGUAGE MultiWayIf #-}+{-# LANGUAGE NamedFieldPuns #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TemplateHaskell #-}++module Hledger.Cli.Commands.Codes (+  codesmode+ ,codes+) where++import qualified Data.Text as T+import qualified Data.Text.IO as T++import Hledger+import Hledger.Cli.CliOptions+++-- | Command line options for this command.+codesmode = hledgerCommandMode+  $(embedFileRelative "Hledger/Cli/Commands/Codes.txt")+  []+  [generalflagsgroup1]+  hiddenflags+  ([], Just $ argsFlag "[QUERY]")++-- | The codes command.+codes :: CliOpts -> Journal -> IO ()+codes CliOpts{reportopts_=ropts@ReportOpts{empty_}} j = do+  d <- getCurrentDay+  let q  = queryFromOpts d ropts+      ts = entriesReport ropts q j+      codes = (if empty_ then id else filter (not . T.null)) $+              map tcode ts++  mapM_ T.putStrLn codes
+ Hledger/Cli/Commands/Codes.txt view
@@ -0,0 +1,41 @@+codes+List the codes seen in transactions, in the order parsed.++_FLAGS++This command prints the value of each transaction's code field, in the+order transactions were parsed. The transaction code is an optional+value written in parentheses between the date and description, often+used to store a cheque number, order number or similar.++Transactions aren't required to have a code, and missing or empty codes+will not be shown by default. With the -E/--empty flag, they will be+printed as blank lines.++You can add a query to select a subset of transactions.++Examples:++1/1 (123)+ (a)  1++1/1 ()+ (a)  1++1/1+ (a)  1++1/1 (126)+ (a)  1++$ hledger codes+123+124+126++$ hledger codes -E+123+124+++126
Hledger/Cli/Commands/Descriptions.hs view
@@ -1,6 +1,6 @@ {-| -The @descriptions@ command lists allpayees seen in transactions.+The @descriptions@ command lists all unique descriptions seen in transactions, sorted alphabetically.  -} 
Hledger/Cli/Commands/Descriptions.txt view
@@ -1,10 +1,13 @@-descriptions Show descriptions.+descriptions+List the unique descriptions that appear in transactions.  _FLAGS -This command lists all descriptions that appear in transactions.+This command lists the unique descriptions that appear in transactions,+in alphabetic order. You can add a query to select a subset of+transactions. -Examples:+Example:  $ hledger descriptions Store Name
Hledger/Cli/Commands/Diff.hs view
@@ -87,7 +87,7 @@  readJournalFile' :: FilePath -> IO Journal readJournalFile' fn =-    readJournalFile definputopts {ignore_assertions_ = True} fn >>= either error' return+    readJournalFile definputopts {ignore_assertions_ = True} fn >>= either error' return  -- PARTIAL:  matchingPostings :: AccountName -> Journal -> [PostingWithPath] matchingPostings acct j = filter ((== acct) . paccount . ppposting) $ allPostingsWithPath j
Hledger/Cli/Commands/Files.hs view
@@ -33,8 +33,8 @@ files :: CliOpts -> Journal -> IO () files CliOpts{rawopts_=rawopts} j = do   let args = listofstringopt "args" rawopts-      regex = headMay args-      files = maybe id (filter . regexMatches) regex+  regex <- mapM (either fail pure . toRegex) $ headMay args+  let files = maybe id (filter . regexMatch) regex               $ map fst               $ jfiles j   mapM_ putStrLn files
Hledger/Cli/Commands/Import.hs view
@@ -34,7 +34,7 @@     dryrun = boolopt "dry-run" rawopts     iopts' = iopts{new_=True, new_save_=not dryrun}   case inputfiles of-    [] -> error' "please provide one or more input files as arguments"+    [] -> error' "please provide one or more input files as arguments"  -- PARTIAL:     fs -> do       enewj <- readJournalFiles iopts' fs       case enewj of
Hledger/Cli/Commands/Incomestatement.txt view
@@ -1,16 +1,17 @@ incomestatement, is-This command displays a simple income statement, showing revenues and-expenses during a period. It assumes that these accounts are under a-top-level revenue or income or expense account (case insensitive, plural-forms also allowed). Note this report shows all account balances with-normal positive sign (like conventional financial statements, unlike-balance/print/register) (experimental). +This command displays an income statement, showing revenues and expenses+during one or more periods. Amounts are shown with normal positive sign,+as in conventional financial statements.+ _FLAGS -This command displays a simple income statement. It currently assumes-that you have top-level accounts named income (or revenue) and expense-(plural forms also allowed.)+The revenue and expense accounts shown are those accounts declared with+the Revenue or Expense type, or otherwise all accounts under a top-level+revenue or income or expense account (case insensitive, plurals+allowed).++Example:  $ hledger incomestatement Income Statement
Hledger/Cli/Commands/Notes.hs view
@@ -1,6 +1,6 @@ {-| -The @notes@ command lists allpayees seen in transactions.+The @notes@ command lists all unique notes (description part after a |) seen in transactions, sorted alphabetically.  -} 
Hledger/Cli/Commands/Notes.txt view
@@ -1,10 +1,14 @@-notes Show notes.+notes+List the unique notes that appear in transactions.  _FLAGS -This command lists all notes that appear in transactions.+This command lists the unique notes that appear in transactions, in+alphabetic order. You can add a query to select a subset of+transactions. The note is the part of the transaction description after+a | character (or if there is no |, the whole description). -Examples:+Example:  $ hledger notes Petrol
Hledger/Cli/Commands/Payees.hs view
@@ -1,6 +1,6 @@ {-| -The @payees@ command lists allpayees seen in transactions.+The @payees@ command lists all unique payees (description part before a |) seen in transactions, sorted alphabetically.  -} 
Hledger/Cli/Commands/Payees.txt view
@@ -1,10 +1,15 @@-payees Show payee names.+payees+List the unique payee/payer names that appear in transactions.  _FLAGS -This command lists all payee names that appear in transactions.+This command lists the unique payee/payer names that appear in+transactions, in alphabetic order. You can add a query to select a+subset of transactions. The payee/payer is the part of the transaction+description before a | character (or if there is no |, the whole+description). -Examples:+Example:  $ hledger payees Store Name
Hledger/Cli/Commands/Prices.hs view
@@ -50,7 +50,9 @@     a' = (n `divideAmount` a) { astyle = style' }     style' = (astyle a) { asprecision = precision' }     extPrecision = (1+) . floor . logBase 10 $ (realToFrac n :: Double)-    precision' = extPrecision + asprecision (astyle a)+    precision' = case asprecision (astyle a) of+                      NaturalPrecision -> NaturalPrecision+                      Precision p      -> Precision $ extPrecision + p  -- XXX 
Hledger/Cli/Commands/Print.hs view
@@ -17,6 +17,7 @@  import Data.Maybe (isJust) import Data.Text (Text)+import Data.List (intercalate) import qualified Data.Text as T import qualified Data.Text.Lazy as TL import System.Console.CmdArgs.Explicit@@ -37,7 +38,7 @@     "show all amounts explicitly"   ,flagNone ["new"] (setboolopt "new")     "show only newer-dated transactions added in each file since last run"-  ,outputFormatFlag ["txt","csv","json"]+  ,outputFormatFlag ["txt","csv","json","sql"]   ,outputFileFlag   ])   [generalflagsgroup1]@@ -60,7 +61,8 @@         "txt"  -> entriesReportAsText opts         "csv"  -> (++"\n") . printCSV . entriesReportAsCsv         "json" -> (++"\n") . TL.unpack . toJsonText-        _      -> const $ error' $ unsupportedOutputFormatError fmt+        "sql"  -> entriesReportAsSql+        _      -> const $ error' $ unsupportedOutputFormatError fmt  -- PARTIAL:   writeOutput opts $ render $ entriesReport ropts q j  entriesReportAsText :: CliOpts -> EntriesReport -> String@@ -124,6 +126,20 @@ --       ,"" --       ] --  ]++entriesReportAsSql :: EntriesReport -> String+entriesReportAsSql txns =+  "create table if not exists postings(id serial,txnidx int,date1 date,date2 date,status text,code text,description text,comment text,account text,amount numeric,commodity text,credit numeric,debit numeric,posting_status text,posting_comment text);\n"+++  "insert into postings(txnidx,date1,date2,status,code,description,comment,account,amount,commodity,credit,debit,posting_status,posting_comment) values\n"+++  (intercalate "," (map values csv))+  ++";\n"+  where+    values vs = "(" ++ (intercalate "," $ map toSql vs) ++ ")\n"+    toSql "" = "NULL"+    toSql s  = "'" ++ (concatMap quoteChar s) ++ "'"+    quoteChar '\'' = "''"+    quoteChar c = [c]+    csv = concatMap transactionToCSV txns  entriesReportAsCsv :: EntriesReport -> CSV entriesReportAsCsv txns =
Hledger/Cli/Commands/Print.txt view
@@ -72,7 +72,7 @@  This command also supports the output destination and output format options The output formats supported are txt, csv, and (experimental)-json.+json and sql.  Here's an example of print's CSV output: 
Hledger/Cli/Commands/Register.hs view
@@ -23,6 +23,7 @@ -- import Data.Text (Text) import qualified Data.Text as T import qualified Data.Text.Lazy as TL+import Data.Time (fromGregorian) import System.Console.CmdArgs.Explicit import Hledger.Read.CsvReader (CSV, CsvRecord, printCSV) @@ -64,7 +65,7 @@       render | fmt=="txt"  = postingsReportAsText              | fmt=="csv"  = const ((++"\n") . printCSV . postingsReportAsCsv)              | fmt=="json" = const ((++"\n") . TL.unpack . toJsonText)-             | otherwise   = const $ error' $ unsupportedOutputFormatError fmt+             | otherwise   = const $ error' $ unsupportedOutputFormatError fmt  -- PARTIAL:   writeOutput opts $ render opts $ postingsReport ropts (queryFromOpts d ropts) j  postingsReportAsCsv :: PostingsReport -> CSV@@ -86,8 +87,8 @@                              BalancedVirtualPosting -> (\s -> "["++s++"]")                              VirtualPosting -> (\s -> "("++s++")")                              _ -> id-    amt = showMixedAmountOneLineWithoutPrice $ pamount p-    bal = showMixedAmountOneLineWithoutPrice b+    amt = showMixedAmountOneLineWithoutPrice False $ pamount p+    bal = showMixedAmountOneLineWithoutPrice False b  -- | Render a register report as plain text suitable for console output. postingsReportAsText :: CliOpts -> PostingsReport -> String@@ -179,8 +180,7 @@               BalancedVirtualPosting -> (\s -> "["++s++"]", acctwidth-2)               VirtualPosting         -> (\s -> "("++s++")", acctwidth-2)               _                      -> (id,acctwidth)-      showamt | color_ (reportopts_ opts) = cshowMixedAmountWithoutPrice-              | otherwise                 = showMixedAmountWithoutPrice+      showamt = showMixedAmountWithoutPrice (color_ $ reportopts_ opts)       amt = showamt $ pamount p       bal = showamt b       -- alternate behaviour, show null amounts as 0 instead of blank@@ -201,7 +201,7 @@     test "unicode in register layout" $ do       j <- readJournal' "2009/01/01 * медвежья шкура\n  расходы:покупки  100\n  актив:наличные\n"       let opts = defreportopts-      (postingsReportAsText defcliopts $ postingsReport opts (queryFromOpts (parsedate "2008/11/26") opts) j)+      (postingsReportAsText defcliopts $ postingsReport opts (queryFromOpts (fromGregorian 2008 11 26) opts) j)         @?=         unlines         ["2009-01-01 медвежья шкура       расходы:покупки                100           100"
Hledger/Cli/Commands/Register.txt view
@@ -3,9 +3,16 @@  _FLAGS -The register command displays postings in date order, one per line, and-their running total. This is typically used with a query selecting a-particular account, to see that account's activity:+The register command displays matched postings, across all accounts, in+date order, with their running total or running historical balance. (See+also the aregister command, which shows matched transactions in a+specific account.)++register normally shows line per posting, but note that multi-commodity+amounts will occupy multiple lines (one line per commodity).++It is typically used with a query selecting a particular account, to see+that account's activity:  $ hledger register checking 2008/01/01 income               assets:bank:checking            $1           $1
Hledger/Cli/Commands/Rewrite.hs view
@@ -38,8 +38,9 @@  rewrite opts@CliOpts{rawopts_=rawopts,reportopts_=ropts} j@Journal{jtxns=ts} = do   -- rewrite matched transactions+  d <- getCurrentDay   let modifiers = transactionModifierFromOpts opts : jtxnmodifiers j-  let j' = j{jtxns=modifyTransactions modifiers ts}+  let j' = j{jtxns=either error' id $ modifyTransactions d modifiers ts}  -- PARTIAL:   -- run the print command, showing all transactions, or show diffs   printOrDiff rawopts opts{reportopts_=ropts{query_=""}} j j' @@ -51,7 +52,7 @@   where     q = T.pack $ query_ ropts     ps = map (parseposting . T.pack) $ listofstringopt "add-posting" rawopts-    parseposting t = either (error' . errorBundlePretty) id ep+    parseposting t = either (error' . errorBundlePretty) id ep  -- PARTIAL:       where         ep = runIdentity (runJournalParser (postingp Nothing <* eof) t')         t' = " " <> t <> "\n" -- inject space and newline for proper parsing
Hledger/Cli/Commands/Roi.hs view
@@ -1,5 +1,5 @@-{-# LANGUAGE ParallelListComp, CPP #-}-{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE ParallelListComp #-}+{-# LANGUAGE TemplateHaskell  #-} {-|  The @roi@ command prints internal rate of return and time-weighted rate of return for and investment.@@ -205,17 +205,12 @@   -- 0% is always a solution, so require at least something here   case totalCF of     [] -> return 0-    _ -> -      case ridders-#if MIN_VERSION_math_functions(0,3,0)-        (RiddersParam 100 (AbsTol 0.00001))-#else-        0.00001-#endif-        (0.000000000001,10000) (interestSum spanEnd totalCF) of-        Root rate -> return ((rate-1)*100)-        NotBracketed -> error "Error: No solution -- not bracketed."-        SearchFailed -> error "Error: Failed to find solution."+    _ -> case ridders (RiddersParam 100 (AbsTol 0.00001))+                      (0.000000000001,10000)+                      (interestSum spanEnd totalCF) of+        Root rate    -> return ((rate-1)*100)+        NotBracketed -> error' "Error: No solution -- not bracketed."  -- PARTIAL:+        SearchFailed -> error' "Error: Failed to find solution."  type CashFlow = [(Day, Quantity)] @@ -236,5 +231,5 @@ unMix a =   case (normaliseMixedAmount $ mixedAmountCost a) of     (Mixed [a]) -> aquantity a-    _ -> error "MixedAmount failed to normalize"+    _ -> error' "MixedAmount failed to normalize"  -- PARTIAL: 
Hledger/Cli/Commands/Stats.hs view
@@ -82,7 +82,7 @@              path = journalFilePath j              ts = sortOn tdate $ filter (spanContainsDate span . tdate) $ jtxns j              as = nub $ map paccount $ concatMap tpostings ts-             cs = either error' Map.keys $ commodityStylesFromAmounts $ concatMap (amounts . pamount) $ concatMap tpostings ts+             cs = either error' Map.keys $ commodityStylesFromAmounts $ concatMap (amounts . pamount) $ concatMap tpostings ts  -- PARTIAL:              lastdate | null ts = Nothing                       | otherwise = Just $ tdate $ last ts              lastelapsed = fmap (diffDays today) lastdate
Hledger/Cli/Commands/Tags.hs view
@@ -7,6 +7,7 @@ ) where +import qualified Control.Monad.Fail as Fail import Data.List.Extra (nubSort) import qualified Data.Text as T import qualified Data.Text.IO as T@@ -18,24 +19,31 @@ tagsmode = hledgerCommandMode   $(embedFileRelative "Hledger/Cli/Commands/Tags.txt")   [flagNone ["values"] (setboolopt "values") "list tag values instead of tag names"+  ,flagNone ["parsed"] (setboolopt "parsed") "show tags/values in the order they were parsed, including duplicates"   ]   [generalflagsgroup1]   hiddenflags   ([], Just $ argsFlag "[TAGREGEX [QUERY...]]") +tags :: CliOpts -> Journal -> IO () tags CliOpts{rawopts_=rawopts,reportopts_=ropts} j = do   d <- getCurrentDay   let     args      = listofstringopt "args" rawopts-    mtagpat   = headMay args+  mtagpat <- mapM (either Fail.fail pure . toRegexCI) $ headMay args+  let     queryargs = drop 1 args     values    = boolopt "values" rawopts+    parsed    = boolopt "parsed" rawopts+    empty     = empty_ ropts     q = queryFromOpts d $ ropts{query_ = unwords $ map quoteIfNeeded queryargs}     txns = filter (q `matchesTransaction`) $ jtxns $ journalSelectingAmountFromOpts ropts j     tagsorvalues =-      nubSort $-      [if values then v else t+      (if parsed then id else nubSort)+      [ r       | (t,v) <- concatMap transactionAllTags txns-      , maybe True (`regexMatchesCI` T.unpack t) mtagpat+      , maybe True (`regexMatch` T.unpack t) mtagpat+      , let r = if values then v else t+      , not (values && T.null v && not empty)       ]   mapM_ T.putStrLn tagsorvalues
Hledger/Cli/Commands/Tags.txt view
@@ -1,8 +1,15 @@ tags-List all the tag names used in the journal. With a TAGREGEX argument,+List the unique tag names used in the journal. With a TAGREGEX argument, only tag names matching the regular expression (case insensitive) are shown. With QUERY arguments, only transactions matching the query are-considered. With --values flag, the tags' unique values are listed-instead.+considered.++With the --values flag, the tags' unique values are listed instead.++With --parsed flag, all tags or values are shown in the order they are+parsed from the input data, including duplicates.++With -E/--empty, any blank/empty values will also be shown, otherwise+they are omitted.  _FLAGS
Hledger/Cli/CompoundBalanceCommand.hs view
@@ -8,7 +8,6 @@  module Hledger.Cli.CompoundBalanceCommand (   CompoundBalanceCommandSpec(..)- ,CBCSubreportSpec(..)  ,compoundBalanceCommandMode  ,compoundBalanceCommand ) where@@ -49,43 +48,13 @@                                       --   this report shows (overrides command line flags) } --- | Description of one subreport within a compound balance report.-data CBCSubreportSpec = CBCSubreportSpec {-   cbcsubreporttitle :: String-  ,cbcsubreportquery :: Journal -> Query-  ,cbcsubreportnormalsign :: NormalSign-  ,cbcsubreportincreasestotal :: Bool-}---- | A compound balance report has:------ * an overall title------ * the period (date span) of each column------ * one or more named, normal-positive multi balance reports,---   with columns corresponding to the above, and a flag indicating---   whether they increased or decreased the overall totals------ * a list of overall totals for each column, and their grand total and average------ It is used in compound balance report commands like balancesheet,--- cashflow and incomestatement.-type CompoundBalanceReport =-  ( String-  , [DateSpan]-  , [(String, MultiBalanceReport, Bool)]-  , ([MixedAmount], MixedAmount, MixedAmount)-  )-- -- | Generate a cmdargs option-parsing mode from a compound balance command -- specification. compoundBalanceCommandMode :: CompoundBalanceCommandSpec -> Mode RawOpts compoundBalanceCommandMode CompoundBalanceCommandSpec{..} =   hledgerCommandMode-    cbcdoc-    [flagNone ["change"] (setboolopt "change")+   cbcdoc+   ([flagNone ["change"] (setboolopt "change")        ("show balance change in each period" ++ defType PeriodChange)     ,flagNone ["cumulative"] (setboolopt "cumulative")        ("show balance change accumulated across periods (in multicolumn reports)"@@ -95,12 +64,12 @@        ("show historical ending balance in each period (includes postings before report start date)"            ++ defType HistoricalBalance        )-    ,flagNone ["flat"] (setboolopt "flat") "show accounts as a list"-    ,flagReq  ["drop"] (\s opts -> Right $ setopt "drop" s opts) "N" "flat mode: omit N leading account name parts"-    ,flagNone ["no-total","N"] (setboolopt "no-total") "omit the final total row"-    ,flagNone ["tree"] (setboolopt "tree") "show accounts as a tree; amounts include subaccounts (default in simple reports)"+    ]+    ++ flattreeflags True +++    [flagReq  ["drop"] (\s opts -> Right $ setopt "drop" s opts) "N" "flat mode: omit N leading account name parts"     ,flagNone ["average","A"] (setboolopt "average") "show a row average column (in multicolumn reports)"     ,flagNone ["row-total","T"] (setboolopt "row-total") "show a row total column (in multicolumn reports)"+    ,flagNone ["no-total","N"] (setboolopt "no-total") "omit the final total row"     ,flagNone ["no-elide"] (setboolopt "no-elide") "don't squash boring parent accounts (in tree mode)"     ,flagReq  ["format"] (\s opts -> Right $ setopt "format" s opts) "FORMATSTR" "use this custom line format (in simple reports)"     ,flagNone ["pretty-tables"] (setboolopt "pretty-tables") "use unicode when displaying tables"@@ -108,7 +77,7 @@     ,flagNone ["percent", "%"] (setboolopt "percent") "express values in percentage of each column's total"     ,outputFormatFlag ["txt","html","csv","json"]     ,outputFileFlag-    ]+    ])     [generalflagsgroup1]     hiddenflags     ([], Just $ argsFlag "[QUERY]")@@ -120,7 +89,7 @@ -- | Generate a runnable command from a compound balance command specification. compoundBalanceCommand :: CompoundBalanceCommandSpec -> (CliOpts -> Journal -> IO ()) compoundBalanceCommand CompoundBalanceCommandSpec{..} opts@CliOpts{reportopts_=ropts@ReportOpts{..}, rawopts_=rawopts} j = do-    d <- getCurrentDay+    today <- getCurrentDay     let       -- use the default balance type for this report, unless the user overrides       mBalanceTypeOverride =@@ -132,61 +101,7 @@             _            -> Nothing       balancetype = fromMaybe cbctype mBalanceTypeOverride       -- Set balance type in the report options.-      -- Also, use tree mode (by default, at least?) if --cumulative/--historical-      -- are used in single column mode, since in that situation we will be using-      -- balanceReportFromMultiBalanceReport which does not support eliding boring parents,-      -- and tree mode hides this.. or something.. XXX-      ropts' = ropts{-        balancetype_=balancetype,-        accountlistmode_=if not (flat_ ropts) && interval_==NoInterval && balancetype `elem` [CumulativeChange, HistoricalBalance] then ALTree else accountlistmode_,-        no_total_=if percent_ && length cbcqueries > 1 then True else no_total_-      }-      userq = queryFromOpts d ropts'-      fmt = outputFormatFromOpts opts--      -- make a CompoundBalanceReport.-      -- For efficiency, generate a price oracle here and reuse it with each subreport.-      priceoracle = journalPriceOracle infer_value_ j-      subreports =-        map (\CBCSubreportSpec{..} ->-                (cbcsubreporttitle-                ,prNormaliseSign cbcsubreportnormalsign $ -- <- convert normal-negative to normal-positive-                  compoundBalanceSubreport ropts' userq j priceoracle cbcsubreportquery cbcsubreportnormalsign-                ,cbcsubreportincreasestotal-                ))-            cbcqueries--      subtotalrows =-        [(prrAmounts $ prTotals report, increasesoveralltotal)-        | (_, report, increasesoveralltotal) <- subreports-        ]--      -- Sum the subreport totals by column. Handle these cases:-      -- - no subreports-      -- - empty subreports, having no subtotals (#588)-      -- - subreports with a shorter subtotals row than the others-      overalltotals = case subtotalrows of-        [] -> ([], nullmixedamt, nullmixedamt)-        rs ->-          let-            numcols = maximum $ map (length.fst) rs  -- partial maximum is ok, rs is non-null-            paddedsignedsubtotalrows =-              [map (if increasesoveralltotal then id else negate) $  -- maybe flip the signs-               take numcols $ as ++ repeat nullmixedamt              -- pad short rows with zeros-              | (as,increasesoveralltotal) <- rs-              ]-            coltotals = foldl' (zipWith (+)) zeros paddedsignedsubtotalrows  -- sum the columns-              where zeros = replicate numcols nullmixedamt-            grandtotal = sum coltotals-            grandavg | null coltotals = nullmixedamt-                     | otherwise      = fromIntegral (length coltotals) `divideMixedAmount` grandtotal-          in-            (coltotals, grandtotal, grandavg)--      colspans =-        case subreports of-          (_, PeriodicReport ds _ _, _):_ -> ds-          [] -> []+      ropts' = ropts{balancetype_=balancetype}        title =         cbctitle@@ -201,12 +116,13 @@           -- column heading(s) (not the date span of the transactions).           -- Also the dates should not be simplified (it should show           -- "2008/01/01-2008/12/31", not "2008").-          titledatestr-            | balancetype == HistoricalBalance = showEndDates enddates-            | otherwise                        = showDateSpan requestedspan +          titledatestr = case balancetype of+              HistoricalBalance -> showEndDates enddates+              _                 -> showDateSpan requestedspan             where-              enddates = map (addDays (-1)) $ catMaybes $ map spanEnd colspans  -- these spans will always have a definite end date-              requestedspan = queryDateSpan date2_ userq `spanDefaultsFrom` journalDateSpan date2_ j+              enddates = map (addDays (-1)) . mapMaybe spanEnd $ cbrDates cbr  -- these spans will always have a definite end date+              requestedspan = queryDateSpan date2_ (queryFromOpts today ropts')+                                  `spanDefaultsFrom` journalDateSpan date2_ j            -- when user overrides, add an indication to the report title           mtitleclarification = flip fmap mBalanceTypeOverride $ \t ->@@ -216,31 +132,27 @@               HistoricalBalance -> "(Historical Ending Balances)"            valuationdesc = case value_ of-            Just (AtCost _mc)   -> ", valued at cost"-            Just (AtThen _mc)   -> error' unsupportedValueThenError  -- TODO-            Just (AtEnd _mc)    -> ", valued at period ends"-            Just (AtNow _mc)    -> ", current value"+            Just (AtCost _mc)       -> ", valued at cost"+            Just (AtThen _mc)       -> error' unsupportedValueThenError  -- TODO+            Just (AtEnd _mc)        -> ", valued at period ends"+            Just (AtNow _mc)        -> ", current value"             Just (AtDefault _mc) | multiperiod   -> ", valued at period ends"             Just (AtDefault _mc)    -> ", current value"-            Just (AtDate d _mc) -> ", valued at "++showDate d-            Nothing             -> ""-            where-              multiperiod = interval_ /= NoInterval-      cbr =-        (title-        ,colspans-        ,subreports-        ,overalltotals-        )+            Just (AtDate today _mc) -> ", valued at "++showDate today+            Nothing                 -> ""+            where multiperiod = interval_ /= NoInterval +      -- make a CompoundBalanceReport.+      cbr' = compoundBalanceReport today ropts' j cbcqueries+      cbr  = cbr'{cbrTitle=title}+     -- render appropriately-    writeOutput opts $-      case fmt of+    writeOutput opts $ case outputFormatFromOpts opts of         "txt"  -> compoundBalanceReportAsText ropts' cbr         "csv"  -> printCSV (compoundBalanceReportAsCsv ropts cbr) ++ "\n"         "html" -> (++"\n") $ TL.unpack $ L.renderText $ compoundBalanceReportAsHtml ropts cbr         "json" -> (++"\n") $ TL.unpack $ toJsonText cbr-        _      -> error' $ unsupportedOutputFormatError fmt+        x      -> error' $ unsupportedOutputFormatError x  -- | Summarise one or more (inclusive) end dates, in a way that's -- visually different from showDateSpan, suggesting discrete end dates@@ -254,30 +166,6 @@   where     showdate = show --- | Run one subreport for a compound balance command in multi-column mode.--- This returns a MultiBalanceReport.-compoundBalanceSubreport :: ReportOpts -> Query -> Journal -> PriceOracle -> (Journal -> Query) -> NormalSign -> MultiBalanceReport-compoundBalanceSubreport ropts@ReportOpts{..} userq j priceoracle subreportqfn subreportnormalsign = r'-  where-    -- force --empty to ensure same columns in all sections-    ropts' = ropts { empty_=True, normalbalance_=Just subreportnormalsign }-    -- run the report-    q = And [subreportqfn j, userq]-    r@(PeriodicReport dates rows totals) = multiBalanceReportWith ropts' q j priceoracle-    -- if user didn't specify --empty, now remove the all-zero rows, unless they have non-zero subaccounts-    -- in this report-    r' | empty_    = r-       | otherwise = PeriodicReport dates rows' totals-          where-            nonzeroaccounts =-              dbg5 "nonzeroaccounts" $-              mapMaybe (\(PeriodicReportRow act _ amts _ _) ->-                            if not (all mixedAmountLooksZero amts) then Just act else Nothing) rows-            rows' = filter (not . emptyRow) rows-              where-                emptyRow (PeriodicReportRow act _ amts _ _) =-                  all mixedAmountLooksZero amts && not (any (act `isAccountNamePrefixOf`) nonzeroaccounts)- -- | Render a compound balance report as plain text suitable for console output. {- Eg: Balance Sheet@@ -299,17 +187,17 @@  -} compoundBalanceReportAsText :: ReportOpts -> CompoundBalanceReport -> String-compoundBalanceReportAsText ropts (title, _colspans, subreports, (coltotals, grandtotal, grandavg)) =-  title ++ "\n\n" ++-  balanceReportTableAsText ropts bigtable'+compoundBalanceReportAsText ropts+  (CompoundPeriodicReport title _colspans subreports (PeriodicReportRow _ coltotals grandtotal grandavg)) =+    title ++ "\n\n" +++    balanceReportTableAsText ropts bigtable'   where-    singlesubreport = length subreports == 1     bigtable =-      case map (subreportAsTable ropts singlesubreport) subreports of+      case map (subreportAsTable ropts) subreports of         []   -> T.empty         r:rs -> foldl' concatTables r rs     bigtable'-      | no_total_ ropts || singlesubreport =+      | no_total_ ropts || length subreports == 1 =           bigtable       | otherwise =           bigtable@@ -322,13 +210,10 @@      -- | Convert a named multi balance report to a table suitable for     -- concatenating with others to make a compound balance report table.-    subreportAsTable ropts singlesubreport (title, r, _) = t+    subreportAsTable ropts (title, r, _) = t       where-        -- unless there's only one section, always show the subtotal row-        ropts' | singlesubreport = ropts-               | otherwise       = ropts{ no_total_=False }         -- convert to table-        Table lefthdrs tophdrs cells = balanceReportAsTable ropts' r+        Table lefthdrs tophdrs cells = balanceReportAsTable ropts r         -- tweak the layout         t = Table (T.Group SingleLine [Header title, lefthdrs]) tophdrs ([]:cells) @@ -341,7 +226,7 @@ -- subreport title row, and an overall title row, one headings row, and an -- optional overall totals row is added. compoundBalanceReportAsCsv :: ReportOpts -> CompoundBalanceReport -> CSV-compoundBalanceReportAsCsv ropts (title, colspans, subreports, (coltotals, grandtotal, grandavg)) =+compoundBalanceReportAsCsv ropts (CompoundPeriodicReport title colspans subreports (PeriodicReportRow _ coltotals grandtotal grandavg)) =   addtotals $   padRow title :   ("Account" :@@ -349,17 +234,12 @@    ++ (if row_total_ ropts then ["Total"] else [])    ++ (if average_ ropts then ["Average"] else [])    ) :-  concatMap (subreportAsCsv ropts singlesubreport) subreports+  concatMap (subreportAsCsv ropts) subreports   where-    singlesubreport = length subreports == 1     -- | Add a subreport title row and drop the heading row.-    subreportAsCsv ropts singlesubreport (subreporttitle, multibalreport, _) =+    subreportAsCsv ropts (subreporttitle, multibalreport, _) =       padRow subreporttitle :-      tail (multiBalanceReportAsCsv ropts' multibalreport)-      where-        -- unless there's only one section, always show the subtotal row-        ropts' | singlesubreport = ropts-               | otherwise       = ropts{ no_total_=False }+      tail (multiBalanceReportAsCsv ropts multibalreport)     padRow s = take numcols $ s : repeat ""       where         numcols@@ -374,7 +254,7 @@       | no_total_ ropts || length subreports == 1 = id       | otherwise = (++           ["Net:" :-           map showMixedAmountOneLineWithoutPrice (+           map (showMixedAmountOneLineWithoutPrice False) (              coltotals              ++ (if row_total_ ropts then [grandtotal] else [])              ++ (if average_ ropts   then [grandavg]   else [])@@ -385,7 +265,7 @@ compoundBalanceReportAsHtml :: ReportOpts -> CompoundBalanceReport -> Html () compoundBalanceReportAsHtml ropts cbr =   let-    (title, colspans, subreports, (coltotals, grandtotal, grandavg)) = cbr+    CompoundPeriodicReport title colspans subreports (PeriodicReportRow _ coltotals grandtotal grandavg) = cbr     colspanattr = colspan_ $ TS.pack $ show $       1 + length colspans + (if row_total_ ropts then 1 else 0) + (if average_ ropts then 1 else 0)     leftattr = style_ "text-align:left"@@ -421,9 +301,9 @@                   in                     [tr_ $ mconcat $                          th_ [class_ "", style_ "text-align:left"] "Net:"-                       : [th_ [class_ "amount coltotal", defstyle] (toHtml $ showMixedAmountOneLineWithoutPrice a) | a <- coltotals]-                      ++ (if row_total_ ropts then [th_ [class_ "amount coltotal", defstyle] $ toHtml $ showMixedAmountOneLineWithoutPrice $ grandtotal] else [])-                      ++ (if average_ ropts   then [th_ [class_ "amount colaverage", defstyle] $ toHtml $ showMixedAmountOneLineWithoutPrice $ grandavg] else [])+                       : [th_ [class_ "amount coltotal", defstyle] (toHtml $ showMixedAmountOneLineWithoutPrice False a) | a <- coltotals]+                      ++ (if row_total_ ropts then [th_ [class_ "amount coltotal", defstyle] $ toHtml $ showMixedAmountOneLineWithoutPrice False grandtotal] else [])+                      ++ (if average_ ropts   then [th_ [class_ "amount colaverage", defstyle] $ toHtml $ showMixedAmountOneLineWithoutPrice False grandavg] else [])                     ]    in do
Hledger/Cli/Main.hs view
@@ -82,14 +82,14 @@         [detailedversionflag]         -- ++ inputflags -- included here so they'll not raise a confusing error if present with no COMMAND     }- ,modeHelpSuffix = map (regexReplace "PROGNAME" progname) [-     "Examples:"-    ,"PROGNAME                         list commands"-    ,"PROGNAME CMD [--] [OPTS] [ARGS]  run a command (use -- with addon commands)"-    ,"PROGNAME-CMD [OPTS] [ARGS]       or run addon commands directly"-    ,"PROGNAME -h                      show general usage"-    ,"PROGNAME CMD -h                  show command usage"-    ,"PROGNAME help [MANUAL]           show any of the hledger manuals in various formats"+ ,modeHelpSuffix = "Examples:" :+    map (progname ++) [+     "                         list commands"+    ," CMD [--] [OPTS] [ARGS]  run a command (use -- with addon commands)"+    ,"-CMD [OPTS] [ARGS]       or run addon commands directly"+    ," -h                      show general usage"+    ," CMD -h                  show command usage"+    ," help [MANUAL]           show any of the hledger manuals in various formats"     ]  } @@ -115,7 +115,7 @@     (argsbeforecmd, argsaftercmd') = break (==rawcmd) args     argsaftercmd         = drop 1 argsaftercmd'     dbgIO :: Show a => String -> a -> IO ()-    dbgIO = ptraceAtIO 6+    dbgIO = ptraceAtIO 8    dbgIO "running" prognameandversion   dbgIO "raw args" args@@ -140,7 +140,7 @@     hasVersion           = ("--version" `elem`)     hasDetailedVersion   = ("--version+" `elem`)     printUsage           = putStr $ showModeUsage $ mainmode addons-    badCommandError      = error' ("command "++rawcmd++" is not recognized, run with no command to see a list") >> exitFailure+    badCommandError      = error' ("command "++rawcmd++" is not recognized, run with no command to see a list") >> exitFailure  -- PARTIAL:     hasHelpFlag args     = any (`elem` args) ["-h","--help"]     f `orShowHelp` mode       | hasHelpFlag args = putStr $ showModeUsage mode
Hledger/Cli/Utils.hs view
@@ -73,7 +73,7 @@   journalpaths <- journalFilePathFromOpts opts   readJournalFiles (inputopts_ opts) journalpaths   >>= mapM (journalTransform opts)-  >>= either error' cmd+  >>= either error' cmd  -- PARTIAL:  -- | Apply some extra post-parse transformations to the journal, if -- specified by options. These happen after journal validation, but@@ -108,11 +108,13 @@ -- | Generate periodic transactions from all periodic transaction rules in the journal. -- These transactions are added to the in-memory Journal (but not the on-disk file). ----- They can start no earlier than: the day following the latest normal--- transaction in the journal (or today if there are none).--- They end on or before the specified report end date, or 180 days--- from today if unspecified.+-- When --auto is active, auto posting rules will be applied to the+-- generated transactions. If the query in any auto posting rule fails+-- to parse, this function will raise an error. --+-- The start & end date for generated periodic transactions are determined in+-- a somewhat complicated way; see the hledger manual -> Periodic transactions.+-- journalAddForecast :: CliOpts -> Journal -> IO Journal journalAddForecast CliOpts{inputopts_=iopts, reportopts_=ropts} j = do   today <- getCurrentDay@@ -136,7 +138,9 @@                        , spanContainsDate forecastspan (tdate t)                        ]       -- With --auto enabled, transaction modifiers are also applied to forecast txns-      forecasttxns' = (if auto_ iopts then modifyTransactions (jtxnmodifiers j) else id) forecasttxns+      forecasttxns' =+        (if auto_ iopts then either error' id . modifyTransactions today (jtxnmodifiers j) else id)  -- PARTIAL:+        forecasttxns    return $     case forecast_ ropts of@@ -146,7 +150,7 @@     journalBalanceTransactions' iopts j =       let assrt = not . ignore_assertions_ $ iopts       in-       either error' id $ journalBalanceTransactions assrt j+       either error' id $ journalBalanceTransactions assrt j  -- PARTIAL:  -- | Write some output to stdout or to a file selected by --output-file. -- If the file exists it will be overwritten.@@ -299,7 +303,7 @@   --            -- all prices for consistent timing.   --            let ropts = defreportopts{   --              value_=True,-  --              period_=PeriodTo $ parsedate "3000-01-01"+  --              period_=PeriodTo $ fromGregorian 3000 01 01   --              }   --            j' <- journalApplyValue ropts j   --            sum (journalAmounts j') `seq` return ()
Hledger/Cli/Version.hs view
@@ -63,5 +63,5 @@                   prettify (major:minor:bugfix:[]) = prettify [major,minor,bugfix,"0"]                   prettify (major:minor:[])        = prettify [major,minor,"0","0"]                   prettify (major:[])              = prettify [major,"0","0","0"]-                  prettify []                      = error' "VERSION is empty, please fix"+                  prettify []                      = error' "VERSION is empty, please fix"  -- PARTIAL:                   prettify _                       = error' "VERSION has too many components, please fix"
bench/bench.hs view
@@ -34,7 +34,7 @@ benchWithTimeit = do   getCurrentDirectory >>= printf "Benchmarking hledger in %s with timeit\n"   let opts = defcliopts{output_file_=Just outputfile}-  (t0,j) <- timeit ("read "++inputfile) $ either error id <$> readJournalFile def inputfile+  (t0,j) <- timeit ("read "++inputfile) $ either error id <$> readJournalFile def inputfile  -- PARTIAL:   (t1,_) <- timeit ("print") $ print' opts j   (t2,_) <- timeit ("register") $ register opts j   (t3,_) <- timeit ("balance") $ balance  opts j@@ -50,9 +50,9 @@ benchWithCriterion = do   getCurrentDirectory >>= printf "Benchmarking hledger in %s with criterion\n"   let opts = defcliopts{output_file_=Just "/dev/null"}-  j <- either error id <$> readJournalFile def inputfile+  j <- either error id <$> readJournalFile def inputfile  -- PARTIAL:   Criterion.Main.defaultMainWith defaultConfig $ [-    bench ("read "++inputfile) $ nfIO $ (either error const <$> readJournalFile def inputfile),+    bench ("read "++inputfile) $ nfIO $ (either error const <$> readJournalFile def inputfile),  -- PARTIAL:     bench ("print")            $ nfIO $ print'   opts j,     bench ("register")         $ nfIO $ register opts j,     bench ("balance")          $ nfIO $ balance  opts j,
embeddedfiles/hledger-ui.1 view
@@ -1,5 +1,5 @@ -.TH "hledger-ui" "1" "June 2020" "hledger-ui 1.18.1" "hledger User Manuals"+.TH "hledger-ui" "1" "September 2020" "hledger-ui 1.18.99" "hledger User Manuals"   @@ -57,10 +57,10 @@ \f[B]\f[CB]--change\f[B]\f[R] show period balances (changes) at startup instead of historical balances .TP-\f[B]\f[CB]-F --flat\f[B]\f[R]-show accounts as a list (default)+\f[B]\f[CB]-l --flat\f[B]\f[R]+show accounts as a flat list (default) .TP-\f[B]\f[CB]-T --tree\f[B]\f[R]+\f[B]\f[CB]-t --tree\f[B]\f[R] show accounts as a tree .PP hledger input options:@@ -160,6 +160,15 @@ generate future transactions from periodic transaction rules, for the next 6 months or till report end date. In hledger-ui, also make ordinary future transactions visible.+.TP+\f[B]\f[CB]--color=WHEN (or --colour=WHEN)\f[B]\f[R]+Should color-supporting commands use ANSI color codes in text output.+\[aq]auto\[aq] (default): whenever stdout seems to be a color-supporting+terminal.+\[aq]always\[aq] or \[aq]yes\[aq]: always, useful eg when piping output+into \[aq]less -R\[aq].+\[aq]never\[aq] or \[aq]no\[aq]: never.+A NO_COLOR environment variable overrides this. .PP When a reporting option appears more than once in the command line, the last one takes precedence.@@ -177,133 +186,132 @@ \f[B]\f[CB]--debug[=N]\f[B]\f[R] show debug output (levels 1-9, default: 1) .PP-A \[at]FILE argument will be expanded to the contents of FILE, which+a \[at]file argument will be expanded to the contents of file, which should contain one command line option/argument per line.-(To prevent this, insert a \f[C]--\f[R] argument before.)-.SH KEYS+(to prevent this, insert a \f[C]--\f[R] argument before.)+.SH keys .PP \f[C]?\f[R] shows a help dialog listing all keys.-(Some of these also appear in the quick help at the bottom of each-screen.) Press \f[C]?\f[R] again (or \f[C]ESCAPE\f[R], or-\f[C]LEFT\f[R]) to close it.-The following keys work on most screens:+(some of these also appear in the quick help at the bottom of each+screen.) press \f[C]?\f[R] again (or \f[C]escape\f[R], or+\f[C]left\f[R], or \f[C]q\f[R]) to close it.+the following keys work on most screens: .PP-The cursor keys navigate: \f[C]right\f[R] (or \f[C]enter\f[R]) goes+the cursor keys navigate: \f[C]right\f[R] (or \f[C]enter\f[R]) goes deeper, \f[C]left\f[R] returns to the previous screen, \f[C]up\f[R]/\f[C]down\f[R]/\f[C]page up\f[R]/\f[C]page down\f[R]/\f[C]home\f[R]/\f[C]end\f[R] move up and down through lists.-Vi-style (\f[C]h\f[R]/\f[C]j\f[R]/\f[C]k\f[R]/\f[C]l\f[R]) and Emacs-style-(\f[C]CTRL-p\f[R]/\f[C]CTRL-n\f[R]/\f[C]CTRL-f\f[R]/\f[C]CTRL-b\f[R])-movement keys are also supported.+(\f[C]ctrl-p\f[R]/\f[C]ctrl-n\f[R]/\f[C]ctrl-f\f[R]/\f[C]ctrl-b\f[R])+movement keys are also supported (but not vi-style keys, since+hledger-1.19, sorry!). A tip: movement speed is limited by your keyboard repeat rate, to move faster you may want to adjust it.-(If you\[aq]re on a mac, the Karabiner app is one way to do that.)+(If you\[aq]re on a mac, the karabiner app is one way to do that.) .PP-With shift pressed, the cursor keys adjust the report period, limiting+with shift pressed, the cursor keys adjust the report period, limiting the transactions to be shown (by default, all are shown). \f[C]shift-down/up\f[R] steps downward and upward through these standard report period durations: year, quarter, month, week, day.-Then, \f[C]shift-left/right\f[R] moves to the previous/next period.-\f[C]t\f[R] sets the report period to today.-With the \f[C]--watch\f[R] option, when viewing a \[dq]current\[dq]+then, \f[C]shift-left/right\f[R] moves to the previous/next period.+\f[C]T\f[R] sets the report period to today.+with the \f[C]--watch\f[R] option, when viewing a \[dq]current\[dq] period (the current day, week, month, quarter, or year), the period will move automatically to track the current date.-To set a non-standard period, you can use \f[C]/\f[R] and a+to set a non-standard period, you can use \f[C]/\f[R] and a \f[C]date:\f[R] query. .PP \f[C]/\f[R] 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 \f[C]ENTER\f[R] to set it, or \f[C]ESCAPE\f[R]to cancel.-There are also keys for quickly adjusting some common filters like+while editing the query, you can use ctrl-a/e/d/k, bs, cursor keys;+press \f[C]enter\f[R] to set it, or \f[C]escape\f[R]to cancel.+there are also keys for quickly adjusting some common filters like account depth and transaction status (see below).-\f[C]BACKSPACE\f[R] or \f[C]DELETE\f[R] removes all filters, showing all+\f[C]backspace\f[R] or \f[C]delete\f[R] removes all filters, showing all transactions. .PP-As mentioned above, by default hledger-ui hides future transactions -+as mentioned above, by default hledger-ui hides future transactions - both ordinary transactions recorded in the journal, and periodic transactions generated by rule.-\f[C]F\f[R] toggles forecast mode, in which future/forecasted+\f[C]f\f[R] toggles forecast mode, in which future/forecasted transactions are shown.-(experimental)+\f[I](experimental)\f[R] .PP-\f[C]ESCAPE\f[R] removes all filters and jumps back to the top screen.-Or, it cancels a minibuffer edit or help dialog in progress.+\f[C]escape\f[R] resets the UI state and jumps back to the top screen,+restoring the app\[aq]s initial state at startup.+Or, it cancels minibuffer data entry or the help dialog. .PP-\f[C]CTRL-l\f[R] redraws the screen and centers the selection if+\f[C]ctrl-l\f[R] redraws the screen and centers the selection if possible (selections near the top won\[aq]t be centered, since we don\[aq]t scroll above the top). .PP \f[C]g\f[R] reloads from the data file(s) and updates the current screen and any previous screens.-(With large files, this could cause a noticeable pause.)+(with large files, this could cause a noticeable pause.) .PP-\f[C]I\f[R] toggles balance assertion checking.-Disabling balance assertions temporarily can be useful for+\f[C]i\f[R] toggles balance assertion checking.+disabling balance assertions temporarily can be useful for troubleshooting. .PP \f[C]a\f[R] runs command-line hledger\[aq]s add command, and reloads the updated file.-This allows some basic data entry.+this allows some basic data entry. .PP-\f[C]A\f[R] is like \f[C]a\f[R], but runs the hledger-iadd tool, which+\f[C]a\f[R] is like \f[C]a\f[R], but runs the hledger-iadd tool, which provides a terminal interface.-This key will be available if \f[C]hledger-iadd\f[R] is installed in-$PATH.+this key will be available if \f[C]hledger-iadd\f[R] is installed in+$path. .PP-\f[C]E\f[R] runs $HLEDGER_UI_EDITOR, or $EDITOR, or a default+\f[C]e\f[R] runs $hledger_ui_editor, or $editor, or a default (\f[C]emacsclient -a \[dq]\[dq] -nw\f[R]) on the journal file.-With some editors (emacs, vi), the cursor will be positioned at the+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 (if possible) when invoked from the error screen. .PP-\f[C]q\f[R] quits the application.-.PP-Experimental:-.PP-\f[C]B\f[R] toggles cost mode, showing amounts in their transaction-price\[aq]s commodity (like toggling the \f[C]-B/--cost\f[R] flag).+\f[C]b\f[R] toggles cost mode, showing amounts in their transaction+price\[aq]s commodity (like toggling the \f[C]-b/--cost\f[R] flag). .PP-\f[C]V\f[R] toggles value mode, showing amounts\[aq] current market+\f[C]v\f[R] toggles value mode, showing amounts\[aq] current market value in their default valuation commodity (like toggling the-\f[C]-V/--market\f[R] flag).-Note, \[dq]current market value\[dq] means the value on the report end+\f[C]-v/--market\f[R] flag).+note, \[dq]current market value\[dq] means the value on the report end date if specified, otherwise today.-To see the value on another date, you can temporarily set that as the+to see the value on another date, you can temporarily set that as the report end date.-Eg: to see a transaction as it was valued on july 30, go to the accounts+eg: to see a transaction as it was valued on july 30, go to the accounts or register screen, press \f[C]/\f[R], and add \f[C]date:-7/30\f[R] to the query. .PP-At most one of cost or value mode can be active at once.+at most one of cost or value mode can be active at once. .PP-There\[aq]s not yet any visual reminder when cost or value mode is-active; for now pressing \f[C]B\f[R] \f[C]B\f[R] \f[C]V\f[R] should+there\[aq]s not yet any visual reminder when cost or value mode is+active; for now pressing \f[C]b\f[R] \f[C]b\f[R] \f[C]v\f[R] should reliably reset to normal mode. .PP-With --watch active, if you save an edit to the journal file while+with --watch active, if you save an edit to the journal file while viewing the transaction screen in cost or value mode, the-\f[C]B\f[R]/\f[C]V\f[R] keys will stop working.-To work around, press g to force a manual reload, or exit the+\f[C]b\f[R]/\f[C]v\f[R] keys will stop working.+to work around, press g to force a manual reload, or exit the transaction screen. .PP-Additional screen-specific keys are described below.-.SH SCREENS-.SS Accounts screen+\f[C]q\f[R] quits the application. .PP-This is normally the first screen displayed.-It lists accounts and their balances, like hledger\[aq]s balance+additional screen-specific keys are described below.+.SH screens+.SS accounts screen+.PP+this is normally the first screen displayed.+it lists accounts and their balances, like hledger\[aq]s balance command.-By default, it shows all accounts and their latest ending balances+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. .PP-Account names are shown as a flat list by default.-Press \f[C]T\f[R] to toggle tree mode.-In flat mode, account balances are exclusive of subaccounts, except+Account names are shown as a flat list by default; press \f[C]t\f[R] to+toggle tree mode.+In list 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@@ -369,11 +377,11 @@ .PP Transactions affecting this account\[aq]s subaccounts will be included in the register if the accounts screen is in tree mode, or if it\[aq]s-in flat mode but this account has subaccounts which are not shown due to+in list 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 \f[C]T\f[R] here also.+Tree mode/list mode can be toggled with \f[C]t\f[R] here also. .PP \f[C]U\f[R] toggles filtering by unmarked status, showing or hiding unmarked transactions.
embeddedfiles/hledger-ui.info view
@@ -3,8 +3,8 @@  File: hledger-ui.info,  Node: Top,  Next: OPTIONS,  Up: (dir) -hledger-ui(1) hledger-ui 1.18.1-*******************************+hledger-ui(1) hledger-ui 1.18.99+********************************  hledger-ui - terminal interface for the hledger accounting tool @@ -36,14 +36,14 @@ * Menu:  * OPTIONS::-* KEYS::-* SCREENS::+* keys::+* screens:: * ENVIRONMENT:: * FILES:: * BUGS::  -File: hledger-ui.info,  Node: OPTIONS,  Next: KEYS,  Prev: Top,  Up: Top+File: hledger-ui.info,  Node: OPTIONS,  Next: keys,  Prev: Top,  Up: Top  1 OPTIONS *********@@ -67,10 +67,10 @@       show period balances (changes) at startup instead of historical      balances-'-F --flat'+'-l --flat' -     show accounts as a list (default)-'-T --tree'+     show accounts as a flat list (default)+'-t --tree'       show accounts as a tree @@ -175,7 +175,14 @@      generate future transactions from periodic transaction rules, for      the next 6 months or till report end date.  In hledger-ui, also      make ordinary future transactions visible.+'--color=WHEN (or --colour=WHEN)' +     Should color-supporting commands use ANSI color codes in text+     output.  'auto' (default): whenever stdout seems to be a+     color-supporting terminal.  'always' or 'yes': always, useful eg+     when piping output into 'less -R'. 'never' or 'no': never.  A+     NO_COLOR environment variable overrides this.+    When a reporting option appears more than once in the command line, the last one takes precedence. @@ -193,134 +200,134 @@       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+   a @file argument will be expanded to the contents of file, which+should contain one command line option/argument per line.  (to prevent this, insert a '--' argument before.)  -File: hledger-ui.info,  Node: KEYS,  Next: SCREENS,  Prev: OPTIONS,  Up: Top+File: hledger-ui.info,  Node: keys,  Next: screens,  Prev: OPTIONS,  Up: Top -2 KEYS+2 keys ****** -'?' 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:+'?' 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', or 'q') to close it.  the following keys work on+most screens: -   The cursor keys navigate: 'right' (or 'enter') goes deeper, 'left'+   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 ('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 one way to do that.)+down'/'home'/'end' move up and down through lists.  Emacs-style+('ctrl-p'/'ctrl-n'/'ctrl-f'/'ctrl-b') movement keys are also supported+(but not vi-style keys, since hledger-1.19, sorry!).  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 one way to+do that.) -   With shift pressed, the cursor keys adjust the report period,+   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+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+period will move automatically to track the current date.  to set a non-standard 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 it, or 'ESCAPE'to cancel.  There are also keys for quickly adjusting+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 'escape'to cancel.  there are also keys for quickly adjusting some common filters like account depth and transaction status (see-below).  'BACKSPACE' or 'DELETE' removes all filters, showing all+below).  'backspace' or 'delete' removes all filters, showing all transactions. -   As mentioned above, by default hledger-ui hides future transactions -+   as mentioned above, by default hledger-ui hides future transactions - both ordinary transactions recorded in the journal, and periodic-transactions generated by rule.  'F' toggles forecast mode, in which-future/forecasted transactions are shown.  (experimental)+transactions generated by rule.  'f' toggles forecast mode, in which+future/forecasted transactions are shown.  _(experimental)_ -   'ESCAPE' removes all filters and jumps back to the top screen.  Or,-it cancels a minibuffer edit or help dialog in progress.+   'escape' resets the UI state and jumps back to the top screen,+restoring the app's initial state at startup.  Or, it cancels minibuffer+data entry or the help dialog. -   'CTRL-l' redraws the screen and centers the selection if possible+   'ctrl-l' redraws the screen and centers the selection if possible (selections 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+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-file.  This allows some basic data entry.+file.  this allows some basic data entry. -   'A' is like 'a', but runs the hledger-iadd tool, which provides a-terminal interface.  This key will be available if 'hledger-iadd' is-installed in $PATH.+   'a' is like 'a', but runs the hledger-iadd tool, which provides a+terminal interface.  this key will be available if 'hledger-iadd' is+installed in $path. -   'E' runs $HLEDGER_UI_EDITOR, or $EDITOR, or a default ('emacsclient--a "" -nw') on the journal file.  With some editors (emacs, vi), the+   'e' runs $hledger_ui_editor, or $editor, or a default ('emacsclient+-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 (if possible) when invoked from the error screen. -   'q' quits the application.--   Experimental:--   'B' toggles cost mode, showing amounts in their transaction price's-commodity (like toggling the '-B/--cost' flag).+   'b' toggles cost mode, showing amounts in their transaction price's+commodity (like toggling the '-b/--cost' flag). -   'V' toggles value mode, showing amounts' current market value in-their default valuation commodity (like toggling the '-V/--market'-flag).  Note, "current market value" means the value on the report end-date if specified, otherwise today.  To see the value on another date,-you can temporarily set that as the report end date.  Eg: to see a+   'v' toggles value mode, showing amounts' current market value in+their default valuation commodity (like toggling the '-v/--market'+flag).  note, "current market value" means the value on the report end+date if specified, otherwise today.  to see the value on another date,+you can temporarily set that as the report end date.  eg: to see a transaction as it was valued on july 30, go to the accounts or register screen, press '/', and add 'date:-7/30' to the query. -   At most one of cost or value mode can be active at once.+   at most one of cost or value mode can be active at once. -   There's not yet any visual reminder when cost or value mode is-active; for now pressing 'B' 'B' 'V' should reliably reset to normal+   there's not yet any visual reminder when cost or value mode is+active; for now pressing 'b' 'b' 'v' should reliably reset to normal mode. -   With -watch active, if you save an edit to the journal file while-viewing the transaction screen in cost or value mode, the 'B'/'V' keys-will stop working.  To work around, press g to force a manual reload, or+   with -watch active, if you save an edit to the journal file while+viewing the transaction screen in cost or value mode, the 'b'/'v' keys+will stop working.  to work around, press g to force a manual reload, or exit the transaction screen. -   Additional screen-specific keys are described below.+   'q' quits the application. +   additional screen-specific keys are described below.+ -File: hledger-ui.info,  Node: SCREENS,  Next: ENVIRONMENT,  Prev: KEYS,  Up: Top+File: hledger-ui.info,  Node: screens,  Next: ENVIRONMENT,  Prev: keys,  Up: Top -3 SCREENS+3 screens *********  * Menu: -* Accounts screen::+* accounts screen:: * Register screen:: * Transaction screen:: * Error screen::  -File: hledger-ui.info,  Node: Accounts screen,  Next: Register screen,  Up: SCREENS+File: hledger-ui.info,  Node: accounts screen,  Next: Register screen,  Up: screens -3.1 Accounts screen+3.1 accounts screen =================== -This is normally the first screen displayed.  It lists accounts and-their balances, like hledger's balance command.  By default, 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 shown as a flat list by default.  Press 'T' to-toggle tree mode.  In flat mode, account balances are exclusive of+   Account names are shown as a flat list by default; press 't' to+toggle tree mode.  In list 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.@@ -357,7 +364,7 @@    Press 'right' or 'enter' to view an account's transactions register.  -File: hledger-ui.info,  Node: Register screen,  Next: Transaction screen,  Prev: Accounts screen,  Up: SCREENS+File: hledger-ui.info,  Node: Register screen,  Next: Transaction screen,  Prev: accounts screen,  Up: screens  3.2 Register screen ===================@@ -381,11 +388,11 @@      balance you would see on a bank register for the current account.     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+the register if the accounts screen is in tree mode, or if it's in list 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.+mode/list 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'@@ -404,7 +411,7 @@ detail.  -File: hledger-ui.info,  Node: Transaction screen,  Next: Error screen,  Prev: Register screen,  Up: SCREENS+File: hledger-ui.info,  Node: Transaction screen,  Next: Error screen,  Prev: Register screen,  Up: screens  3.3 Transaction screen ======================@@ -428,7 +435,7 @@ reload).  -File: hledger-ui.info,  Node: Error screen,  Prev: Transaction screen,  Up: SCREENS+File: hledger-ui.info,  Node: Error screen,  Prev: Transaction screen,  Up: screens  3.4 Error screen ================@@ -439,7 +446,7 @@ to cancel the reload attempt.)  -File: hledger-ui.info,  Node: ENVIRONMENT,  Next: FILES,  Prev: SCREENS,  Up: Top+File: hledger-ui.info,  Node: ENVIRONMENT,  Next: FILES,  Prev: screens,  Up: Top  4 ENVIRONMENT *************@@ -508,26 +515,26 @@  Tag Table: Node: Top71-Node: OPTIONS1474-Ref: #options1571-Node: KEYS5186-Ref: #keys5281-Node: SCREENS9557-Ref: #screens9662-Node: Accounts screen9752-Ref: #accounts-screen9880-Node: Register screen12096-Ref: #register-screen12251-Node: Transaction screen14248-Ref: #transaction-screen14406-Node: Error screen15276-Ref: #error-screen15398-Node: ENVIRONMENT15642-Ref: #environment15756-Node: FILES16563-Ref: #files16662-Node: BUGS16875-Ref: #bugs16952+Node: OPTIONS1476+Ref: #options1573+Node: keys5545+Ref: #keys5640+Node: screens9972+Ref: #screens10077+Node: accounts screen10167+Ref: #accounts-screen10295+Node: Register screen12510+Ref: #register-screen12665+Node: Transaction screen14662+Ref: #transaction-screen14820+Node: Error screen15690+Ref: #error-screen15812+Node: ENVIRONMENT16056+Ref: #environment16170+Node: FILES16977+Ref: #files17076+Node: BUGS17289+Ref: #bugs17366  End Tag Table 
embeddedfiles/hledger-ui.txt view
@@ -53,10 +53,10 @@               show  period balances (changes) at startup instead of historical               balances -       -F --flat-              show accounts as a list (default)+       -l --flat+              show accounts as a flat list (default) -       -T --tree+       -t --tree               show accounts as a tree         hledger input options:@@ -158,6 +158,13 @@               for  the  next 6 months or till report end date.  In hledger-ui,               also make ordinary future transactions visible. +       --color=WHEN (or --colour=WHEN)+              Should color-supporting commands use ANSI color  codes  in  text+              output.   'auto' (default): whenever stdout seems to be a color-+              supporting terminal.  'always' or 'yes': always, useful eg  when+              piping  output  into  'less  -R'.   'never'  or  'no': never.  A+              NO_COLOR environment variable overrides this.+        When a reporting option appears more than once in the command line, the        last one takes precedence. @@ -174,138 +181,137 @@        --debug[=N]               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,+       a @file argument will be expanded to the contents of file, which should+       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-       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:+keys+       ?  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, or q) to close it.  the following keys work on most screens: -       The cursor keys navigate: right (or enter) goes deeper, left returns to+       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 (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  one  way-       to do that.)+       down through lists.  Emacs-style (ctrl-p/ctrl-n/ctrl-f/ctrl-b) movement+       keys are also supported (but not  vi-style  keys,  since  hledger-1.19,+       sorry!).   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 one way to do that.) -       With  shift pressed, the cursor keys adjust the report period, limiting+       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+       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-standard period, you can use /+       to track the current date.  to set a non-standard 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-       it, or ESCAPEto cancel.  There are also keys for quickly adjusting some+       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).-       BACKSPACE or DELETE removes all filters, showing all transactions.+       backspace or delete removes all filters, showing all transactions. -       As mentioned above, by default hledger-ui hides future  transactions  -+       as mentioned above, by default hledger-ui hides future  transactions  -        both ordinary transactions recorded in the journal, and periodic trans--       actions generated by rule.  F  toggles  forecast  mode,  in  which  fu-+       actions generated by rule.  f  toggles  forecast  mode,  in  which  fu-        ture/forecasted transactions are shown.  (experimental) -       ESCAPE  removes  all  filters and jumps back to the top screen.  Or, it-       cancels a minibuffer edit or help dialog in progress.+       escape  resets the UI state and jumps back to the top screen, restoring+       the app's initial state at startup.  Or, it cancels minibuffer data en-+       try or the help dialog. -       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+       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        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-       file.  This allows some basic data entry.+       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  terminal-       interface.   This key will be available if hledger-iadd is installed in-       $PATH.+       a  is like a, but runs the hledger-iadd tool, which provides a terminal+       interface.  this key will be available if hledger-iadd is installed  in+       $path. -       E runs $HLEDGER_UI_EDITOR, or $EDITOR, or a default (emacsclient -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 (if possi-+       e  runs $hledger_ui_editor, or $editor, or a default (emacsclient -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 (if  possi-        ble) when invoked from the error screen. -       q quits the application.--       Experimental:--       B toggles cost mode, showing amounts in their transaction price's  com--       modity (like toggling the -B/--cost flag).+       b  toggles cost mode, showing amounts in their transaction price's com-+       modity (like toggling the -b/--cost flag). -       V  toggles  value  mode, showing amounts' current market value in their-       default valuation  commodity  (like  toggling  the  -V/--market  flag).-       Note,  "current market value" means the value on the report end date if-       specified, otherwise today.  To see the value on another date, you  can-       temporarily  set that as the report end date.  Eg: to see a transaction-       as it was valued on july 30, go to the  accounts  or  register  screen,+       v toggles value mode, showing amounts' current market  value  in  their+       default  valuation  commodity  (like  toggling  the  -v/--market flag).+       note, "current market value" means the value on the report end date  if+       specified,  otherwise today.  to see the value on another date, you can+       temporarily set that as the report end date.  eg: to see a  transaction+       as  it  was  valued  on july 30, go to the accounts or register screen,        press /, and add date:-7/30 to the query. -       At most one of cost or value mode can be active at once.+       at most one of cost or value mode can be active at once. -       There's  not yet any visual reminder when cost or value mode is active;-       for now pressing B B V should reliably reset to normal mode.+       there's not yet any visual reminder when cost or value mode is  active;+       for now pressing b b v should reliably reset to normal mode. -       With --watch active, if you save an edit  to  the  journal  file  while-       viewing the transaction screen in cost or value mode, the B/V keys will-       stop working.  To work around, press g to force  a  manual  reload,  or+       with  --watch  active,  if  you  save an edit to the journal file while+       viewing the transaction screen in cost or value mode, the b/v keys will+       stop  working.   to  work  around, press g to force a manual reload, or        exit the transaction screen. -       Additional screen-specific keys are described below.+       q quits the application. -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+       additional screen-specific keys are described below.++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        just the matched accounts and the balances from matched transactions. -       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 be-+       Account names are shown as a flat list by default; press  t  to  toggle+       tree  mode.   In  list  mode,  account balances are exclusive of subac-+       counts, except where subaccounts are hidden by a depth limit  (see  be-        low).  In tree mode, all account balances are inclusive of subaccounts. -       To see less detail, press a number key, 1 to 9, to set a  depth  limit.+       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+       less  detail, collapsing all accounts to a single total.  To remove the        depth limit, set it higher than the maximum account depth, or press ES-        CAPE.         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  be--       fore  the  report start date, so they show the change in balance during+       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 be-+       fore 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 in-+       toggles  cleared postings.  (By default, balances include all postings;+       if you activate one or two status filters, only those postings are  in-        cluded; 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.@@ -314,63 +320,63 @@        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. -       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.+       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 list+       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/list 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-+       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.)         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, de--       scription, comments, along with all of its account postings are  shown.-       Simple  transactions  have  two  postings, but there can be more (or in+       The transaction's date(s) and any cleared flag, transaction  code,  de-+       scription,  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  de-+       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 de-        pending on which account register you came from (remember most transac--       tions appear in multiple account registers).  The #N  number  preceding+       tions  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.) @@ -378,15 +384,15 @@        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). -       A  typical  value  is  ~/DIR/YYYY.journal,  where DIR is a version-con--       trolled finance directory and YYYY is the current year.  Or  ~/DIR/cur-+       A typical value is ~/DIR/YYYY.journal,  where  DIR  is  a  version-con-+       trolled  finance directory and YYYY is the current year.  Or ~/DIR/cur-        rent.journal, where current.journal is a symbolic link to YYYY.journal.         On Mac computers, you can set this and other environment variables in a-       more thorough way that also affects applications started from  the  GUI+       more  thorough  way that also affects applications started from the GUI        (say, an Emacs dock icon).  Eg on MacOS Catalina I have a ~/.MacOSX/en-        vironment.plist file containing @@ -397,13 +403,13 @@        To see the effect you may need to killall Dock, or reboot.  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).@@ -411,24 +417,24 @@        -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. -       Also, if you are viewing files mounted from  another  machine,  --watch+       Also,  if  you  are viewing files mounted from another machine, --watch        requires that both machine clocks are roughly in step.    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)  @@ -442,7 +448,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) @@ -450,4 +456,4 @@   -hledger-ui 1.18.1                  June 2020                     hledger-ui(1)+hledger-ui 1.18.99              September 2020                   hledger-ui(1)
embeddedfiles/hledger-web.1 view
@@ -1,5 +1,5 @@ -.TH "hledger-web" "1" "June 2020" "hledger-web 1.18.1" "hledger User Manuals"+.TH "hledger-web" "1" "September 2020" "hledger-web 1.18.99" "hledger User Manuals"   @@ -186,6 +186,15 @@ generate future transactions from periodic transaction rules, for the next 6 months or till report end date. In hledger-ui, also make ordinary future transactions visible.+.TP+\f[B]\f[CB]--color=WHEN (or --colour=WHEN)\f[B]\f[R]+Should color-supporting commands use ANSI color codes in text output.+\[aq]auto\[aq] (default): whenever stdout seems to be a color-supporting+terminal.+\[aq]always\[aq] or \[aq]yes\[aq]: always, useful eg when piping output+into \[aq]less -R\[aq].+\[aq]never\[aq] or \[aq]no\[aq]: never.+A NO_COLOR environment variable overrides this. .PP When a reporting option appears more than once in the command line, the last one takes precedence.
embeddedfiles/hledger-web.info view
@@ -3,8 +3,8 @@  File: hledger-web.info,  Node: Top,  Next: OPTIONS,  Up: (dir) -hledger-web(1) hledger-web 1.18.1-*********************************+hledger-web(1) hledger-web 1.18.99+**********************************  hledger-web - web interface for the hledger accounting tool @@ -199,7 +199,14 @@      generate future transactions from periodic transaction rules, for      the next 6 months or till report end date.  In hledger-ui, also      make ordinary future transactions visible.+'--color=WHEN (or --colour=WHEN)' +     Should color-supporting commands use ANSI color codes in text+     output.  'auto' (default): whenever stdout seems to be a+     color-supporting terminal.  'always' or 'yes': always, useful eg+     when piping output into 'less -R'. 'never' or 'no': never.  A+     NO_COLOR environment variable overrides this.+    When a reporting option appears more than once in the command line, the last one takes precedence. @@ -573,22 +580,22 @@  Tag Table: Node: Top72-Node: OPTIONS1750-Ref: #options1855-Node: PERMISSIONS8383-Ref: #permissions8522-Node: EDITING UPLOADING DOWNLOADING9734-Ref: #editing-uploading-downloading9915-Node: RELOADING10749-Ref: #reloading10883-Node: JSON API11316-Ref: #json-api11430-Node: ENVIRONMENT16911-Ref: #environment17027-Node: FILES17760-Ref: #files17860-Node: BUGS18073-Ref: #bugs18151+Node: OPTIONS1752+Ref: #options1857+Node: PERMISSIONS8737+Ref: #permissions8876+Node: EDITING UPLOADING DOWNLOADING10088+Ref: #editing-uploading-downloading10269+Node: RELOADING11103+Ref: #reloading11237+Node: JSON API11670+Ref: #json-api11784+Node: ENVIRONMENT17265+Ref: #environment17381+Node: FILES18114+Ref: #files18214+Node: BUGS18427+Ref: #bugs18505  End Tag Table 
embeddedfiles/hledger-web.txt view
@@ -179,6 +179,13 @@               for  the  next 6 months or till report end date.  In hledger-ui,               also make ordinary future transactions visible. +       --color=WHEN (or --colour=WHEN)+              Should color-supporting commands use ANSI color  codes  in  text+              output.   'auto' (default): whenever stdout seems to be a color-+              supporting terminal.  'always' or 'yes': always, useful eg  when+              piping  output  into  'less  -R'.   'never'  or  'no': never.  A+              NO_COLOR environment variable overrides this.+        When a reporting option appears more than once in the command line, the        last one takes precedence. @@ -538,4 +545,4 @@   -hledger-web 1.18.1                 June 2020                    hledger-web(1)+hledger-web 1.18.99             September 2020                  hledger-web(1)
embeddedfiles/hledger.1 view
@@ -1,6 +1,6 @@ .\"t -.TH "hledger" "1" "June 2020" "hledger 1.18.1" "hledger User Manuals"+.TH "hledger" "1" "September 2020" "hledger 1.18.99" "hledger User Manuals"   @@ -638,6 +638,15 @@ generate future transactions from periodic transaction rules, for the next 6 months or till report end date. In hledger-ui, also make ordinary future transactions visible.+.TP+\f[B]\f[CB]--color=WHEN (or --colour=WHEN)\f[B]\f[R]+Should color-supporting commands use ANSI color codes in text output.+\[aq]auto\[aq] (default): whenever stdout seems to be a color-supporting+terminal.+\[aq]always\[aq] or \[aq]yes\[aq]: always, useful eg when piping output+into \[aq]less -R\[aq].+\[aq]never\[aq] or \[aq]no\[aq]: never.+A NO_COLOR environment variable overrides this. .PP When a reporting option appears more than once in the command line, the last one takes precedence.@@ -973,15 +982,12 @@ \f[R] .fi .PP-Usually the data file is in hledger\[aq]s journal format, but it can-also be one of several other formats, listed below.-hledger detects the format automatically based on the file extension, or-if that is not recognised, by trying each built-in \[dq]reader\[dq] in-turn:+Usually the data file is in hledger\[aq]s journal format, but it can be+in any of the supported file formats, which currently are: .PP .TS tab(@);-lw(7.6n) lw(31.2n) lw(31.2n).+lw(7.8n) lw(39.5n) lw(22.7n). T{ Reader: T}@T{@@ -993,37 +999,45 @@ T{ \f[C]journal\f[R] T}@T{-hledger\[aq]s journal format, also some Ledger journals+hledger journal files and some Ledger journals, for transactions T}@T{ \f[C].journal\f[R] \f[C].j\f[R] \f[C].hledger\f[R] \f[C].ledger\f[R] T} T{ \f[C]timeclock\f[R] T}@T{-timeclock files (precise time logging)+timeclock files, for precise time logging T}@T{ \f[C].timeclock\f[R] T} T{ \f[C]timedot\f[R] T}@T{-timedot files (approximate time logging)+timedot files, for approximate time logging T}@T{ \f[C].timedot\f[R] T} T{ \f[C]csv\f[R] T}@T{-comma-separated values (data interchange)+comma/semicolon/tab/other-separated values, for data import T}@T{-\f[C].csv\f[R]+\f[C].csv\f[R] \f[C].ssv\f[R] \f[C].tsv\f[R] T} .TE .PP-If needed (eg to ensure correct error messages when a file has the-\[dq]wrong\[dq] extension), you can force a specific reader/format by-prepending it to the file path with a colon.-Examples:+hledger detects the format automatically based on the file extensions+shown above.+If it can\[aq]t recognise the file extension, it assumes+\f[C]journal\f[R] format.+So for non-journal files, it\[aq]s important to use a recognised file+extension, so as to either read successfully or to show relevant error+messages.+.PP+When you can\[aq]t ensure the right file extension, not to worry: you+can force a specific reader/format by prefixing the file path with the+format and a colon.+Eg to read a .dat file as csv: .IP .nf \f[C]@@ -1032,16 +1046,20 @@ \f[R] .fi .PP-You can also specify multiple \f[C]-f\f[R] options, to read multiple-files as one big journal.+You can specify multiple \f[C]-f\f[R] options, to read multiple files as+one big journal. There are some limitations with this: .IP \[bu] 2 directives in one file will not affect the other files .IP \[bu] 2 balance assertions will not see any account balances from previous files .PP-If you need those, either use the include directive, or concatenate the-files, eg: \f[C]cat a.journal b.journal | hledger -f- CMD\f[R].+If you need either of those things, you can+.IP \[bu] 2+use a single parent file which includes the others+.IP \[bu] 2+or concatenate the files into one before reading, eg:+\f[C]cat a.journal b.journal | hledger -f- CMD\f[R]. .SS Output destination .PP hledger commands send their output to the terminal by default.@@ -1070,7 +1088,8 @@ Some commands (print, register, the balance commands) offer a choice of output format. In addition to the usual plain text format (\f[C]txt\f[R]), there are-CSV (\f[C]csv\f[R]), HTML (\f[C]html\f[R]) and JSON (\f[C]json\f[R]).+CSV (\f[C]csv\f[R]), HTML (\f[C]html\f[R]), JSON (\f[C]json\f[R]) and+SQL (\f[C]sql\f[R]). This is controlled by the \f[C]-O/--output-format\f[R] option: .IP .nf@@ -1119,6 +1138,20 @@ We hope this approach will not cause problems in practice; if you find otherwise, please let us know. (Cf #1195)+.PP+Notes about SQL output:+.IP \[bu] 2+SQL output is also marked experimental, and much like JSON could use+real-world feedback.+.IP \[bu] 2+SQL output is expected to work with sqlite, MySQL and PostgreSQL+.IP \[bu] 2+SQL output is structured with the expectations that statements will be+executed in the empty database.+If you already have tables created via SQL output of hledger, you would+probably want to either clear tables of existing data (via+\f[C]delete\f[R] or \f[C]truncate\f[R] SQL statements) or drop tables+completely as otherwise your postings will be duped. .SS Regular expressions .PP hledger uses regular expressions in a number of places:@@ -1446,6 +1479,23 @@ T} .TE .PP+Or you can specify a single quarter like so:+.PP+.TS+tab(@);+l l.+T{+\f[C]-p \[dq]2009Q1\[dq]\f[R]+T}@T{+first quarter of 2009, equivalent to \[lq]2009/1/1 to 2009/4/1\[rq]+T}+T{+\f[C]-p \[dq]q4\[dq]\f[R]+T}@T{+fourth quarter of the current year+T}+.TE+.PP The argument of \f[C]-p\f[R] can also begin with, or be, a report interval expression. The basic report intervals are \f[C]daily\f[R], \f[C]weekly\f[R],@@ -1506,7 +1556,7 @@ .TE .PP The following more complex report intervals are also supported:-\f[C]biweekly\f[R], \f[C]bimonthly\f[R],+\f[C]biweekly\f[R], \f[C]fortnightly\f[R], \f[C]bimonthly\f[R], \f[C]every day|week|month|quarter|year\f[R], \f[C]every N days|weeks|months|quarters|years\f[R]. .PP@@ -2419,6 +2469,7 @@ .P .PD Prompt for transactions and add them to the journal.+Any arguments will be used as default inputs for the first N prompts. .PP Many hledger users edit their journals directly with a text editor, or generate them from CSV.@@ -2493,8 +2544,85 @@ .fi .PP On Microsoft Windows, the add command makes sure that no part of the-file path ends with a period, as it can cause data loss on that platform-(cf #1056).+file path ends with a period, as that would cause problems (#1056).+.SS aregister+.PP+aregister, areg+.PD 0+.P+.PD+Show transactions affecting a particular account, and the account\[aq]s+running balance.+.PP+\f[C]aregister\f[R] shows the transactions affecting a particular+account (and its subaccounts), from the point of view of that account.+Each line shows:+.IP \[bu] 2+the transaction\[aq]s (or posting\[aq]s, see below) date+.IP \[bu] 2+the names of the other account(s) involved+.IP \[bu] 2+the net change to this account\[aq]s balance+.IP \[bu] 2+the account\[aq]s historical running balance (including balance from+transactions before the report start date).+.PP+With \f[C]aregister\f[R], each line represents a whole transaction - as+in hledger-ui, hledger-web, and your bank statement.+By contrast, the \f[C]register\f[R] command shows individual postings,+across all accounts.+You might prefer \f[C]aregister\f[R] for reconciling with real-world+asset/liability accounts, and \f[C]register\f[R] for reviewing detailed+revenues/expenses.+.PP+An account must be specified as the first argument, which should be the+full account name or an account pattern (regular expression).+aregister will show transactions in this account (the first one matched)+and any of its subaccounts.+.PP+Any additional arguments form a query which will filter the transactions+shown.+.PP+Transactions making a net change of zero are not shown by default; add+the \f[C]-E/--empty\f[R] flag to show them.+.SS aregister and custom posting dates+.PP+Transactions whose date is outside the report period can still be shown,+if they have a posting to this account dated inside the report period.+(And in this case it\[aq]s the posting date that is shown.) This ensures+that \f[C]aregister\f[R] can show an accurate historical running+balance, matching the one shown by \f[C]register -H\f[R] with the same+arguments.+.PP+To filter strictly by transaction date instead, add the+\f[C]--txn-dates\f[R] flag.+If you use this flag and some of your postings have custom dates,+it\[aq]s probably best to assume the running balance is wrong.+.SS Output format+.PP+This command also supports the output destination and output format+options The output formats supported are \f[C]txt\f[R], \f[C]csv\f[R],+and \f[C]json\f[R].+.PP+Examples:+.PP+Show all transactions and historical running balance in the first+account whose name contains \[dq]checking\[dq]:+.IP+.nf+\f[C]+$ hledger areg checking+\f[R]+.fi+.PP+Show transactions and historical running balance in all asset accounts+during july:+.IP+.nf+\f[C]+$ hledger areg assets date:jul+\f[R]+.fi .SS balance .PP balance, bal, b@@ -2555,7 +2683,8 @@ indented below their parent. At each level of the tree, accounts are sorted by account code if any, then by account name.-Or with \f[C]-S/--sort-amount\f[R], by their balance amount.+Or with \f[C]-S/--sort-amount\f[R], by their balance amount, largest+first. .PP \[dq]Boring\[dq] accounts, which contain a single interesting subaccount and no balance of their own, are elided into the following line for more@@ -2655,11 +2784,8 @@ for the single-column balance report .SS Colour support .PP-The balance command shows negative amounts in red, if:-.IP \[bu] 2-the \f[C]TERM\f[R] environment variable is not set to \f[C]dumb\f[R]-.IP \[bu] 2-the output is not being redirected or piped anywhere+In terminal output, when colour is enabled, the balance command shows+negative amounts in red. .SS Flat mode .PP To see a flat list instead of the default hierarchical display, use@@ -2859,12 +2985,19 @@ \f[R] .fi .PP-A limitation of multicolumn balance reports: eliding of boring parent-accounts in tree mode, as in the classic balance report, is not yet-supported.-.PP The \f[C]--transpose\f[R] flag can be used to exchange the rows and columns of a multicolumn report.+.PP+When showing multicommodity amounts, multicolumn balance reports will+elide any amounts which have more than two commodities, since otherwise+columns could get very wide.+The \f[C]--no-elide\f[R] flag disables this.+Hiding totals with the \f[C]-N/--no-total\f[R] flag can also help reduce+the width of multicommodity reports.+.PP+When the report is still too wide, a good workaround is to pipe it into+\f[C]less -RS\f[R] (-R for colour, -S to chop long lines).+Eg: \f[C]hledger bal -D --color=yes | less -RS\f[R]. .SS Budget report .PP With \f[C]--budget\f[R], extra columns are displayed showing budget@@ -3115,16 +3248,16 @@ .PD 0 .P .PD-This command displays a simple balance sheet, showing historical ending-balances of asset and liability accounts (ignoring any report begin-date).-It assumes that these accounts are under a top-level \f[C]asset\f[R] or-\f[C]liability\f[R] account (case insensitive, plural forms also-allowed).+This command displays a balance sheet, showing historical ending+balances of asset and liability accounts.+(To see equity as well, use the balancesheetequity command.) Amounts are+shown with normal positive sign, as in conventional financial+statements. .PP-Note this report shows all account balances with normal positive sign-(like conventional financial statements, unlike balance/print/register)-(experimental).+The asset and liability accounts shown are those accounts declared with+the \f[C]Asset\f[R] or \f[C]Cash\f[R] or \f[C]Liability\f[R] type, or+otherwise all accounts under a top-level \f[C]asset\f[R] or+\f[C]liability\f[R] account (case insensitive, plurals allowed). .PP Example: .IP@@ -3171,9 +3304,17 @@ .PD 0 .P .PD-Just like balancesheet, but also reports Equity (which it assumes is-under a top-level \f[C]equity\f[R] account).+This command displays a balance sheet, showing historical ending+balances of asset, liability and equity accounts.+Amounts are shown with normal positive sign, as in conventional+financial statements. .PP+The asset, liability and equity accounts shown are those accounts+declared with the \f[C]Asset\f[R], \f[C]Cash\f[R], \f[C]Liability\f[R]+or \f[C]Equity\f[R] type, or otherwise all accounts under a top-level+\f[C]asset\f[R], \f[C]liability\f[R] or \f[C]equity\f[R] account (case+insensitive, plurals allowed).+.PP Example: .IP .nf@@ -3213,15 +3354,17 @@ .PD 0 .P .PD-This command displays a simple cashflow statement, showing changes in-\[dq]cash\[dq] accounts.-It assumes that these accounts are under a top-level \f[C]asset\f[R]-account (case insensitive, plural forms also allowed) and do not contain-\f[C]receivable\f[R] or \f[C]A/R\f[R] in their name.-Note this report shows all account balances with normal positive sign-(like conventional financial statements, unlike balance/print/register)-(experimental).+This command displays a cashflow statement, showing the inflows and+outflows affecting \[dq]cash\[dq] (ie, liquid) assets.+Amounts are shown with normal positive sign, as in conventional+financial statements. .PP+The \[dq]cash\[dq] accounts shown are those accounts declared with the+\f[C]Cash\f[R] type, or otherwise all accounts under a top-level+\f[C]asset\f[R] account (case insensitive, plural allowed) which do not+have \f[C]fixed\f[R], \f[C]investment\f[R], \f[C]receivable\f[R] or+\f[C]A/R\f[R] in their name.+.PP Example: .IP .nf@@ -3401,6 +3544,64 @@     assets:checking \f[R] .fi+.SS codes+.PP+codes+.PD 0+.P+.PD+List the codes seen in transactions, in the order parsed.+.PP+This command prints the value of each transaction\[aq]s code field, in+the order transactions were parsed.+The transaction code is an optional value written in parentheses between+the date and description, often used to store a cheque number, order+number or similar.+.PP+Transactions aren\[aq]t required to have a code, and missing or empty+codes will not be shown by default.+With the \f[C]-E\f[R]/\f[C]--empty\f[R] flag, they will be printed as+blank lines.+.PP+You can add a query to select a subset of transactions.+.PP+Examples:+.IP+.nf+\f[C]+1/1 (123)+ (a)  1++1/1 ()+ (a)  1++1/1+ (a)  1++1/1 (126)+ (a)  1+\f[R]+.fi+.IP+.nf+\f[C]+$ hledger codes+123+124+126+\f[R]+.fi+.IP+.nf+\f[C]+$ hledger codes -E+123+124+++126+\f[R]+.fi .SS commodities .PP commodities@@ -3410,11 +3611,17 @@ List all commodity/currency symbols used or declared in the journal. .SS descriptions .PP-descriptions Show descriptions.+descriptions+.PD 0+.P+.PD+List the unique descriptions that appear in transactions. .PP-This command lists all descriptions that appear in transactions.+This command lists the unique descriptions that appear in transactions,+in alphabetic order.+You can add a query to select a subset of transactions. .PP-Examples:+Example: .IP .nf \f[C]@@ -3572,19 +3779,18 @@ .PD 0 .P .PD-This command displays a simple income statement, showing revenues and-expenses during a period.-It assumes that these accounts are under a top-level \f[C]revenue\f[R]-or \f[C]income\f[R] or \f[C]expense\f[R] account (case insensitive,-plural forms also allowed).-Note this report shows all account balances with normal positive sign-(like conventional financial statements, unlike balance/print/register)-(experimental). .PP-This command displays a simple income statement.-It currently assumes that you have top-level accounts named-\f[C]income\f[R] (or \f[C]revenue\f[R]) and \f[C]expense\f[R] (plural-forms also allowed.)+This command displays an income statement, showing revenues and expenses+during one or more periods.+Amounts are shown with normal positive sign, as in conventional+financial statements.+.PP+The revenue and expense accounts shown are those accounts declared with+the \f[C]Revenue\f[R] or \f[C]Expense\f[R] type, or otherwise all+accounts under a top-level \f[C]revenue\f[R] or \f[C]income\f[R] or+\f[C]expense\f[R] account (case insensitive, plurals allowed).+.PP+Example: .IP .nf \f[C]@@ -3624,11 +3830,19 @@ \f[C]html\f[R], and (experimental) \f[C]json\f[R]. .SS notes .PP-notes Show notes.+notes+.PD 0+.P+.PD+List the unique notes that appear in transactions. .PP-This command lists all notes that appear in transactions.+This command lists the unique notes that appear in transactions, in+alphabetic order.+You can add a query to select a subset of transactions.+The note is the part of the transaction description after a | character+(or if there is no |, the whole description). .PP-Examples:+Example: .IP .nf \f[C]@@ -3639,11 +3853,19 @@ .fi .SS payees .PP-payees Show payee names.+payees+.PD 0+.P+.PD+List the unique payee/payer names that appear in transactions. .PP-This command lists all payee names that appear in transactions.+This command lists the unique payee/payer names that appear in+transactions, in alphabetic order.+You can add a query to select a subset of transactions.+The payee/payer is the part of the transaction description before a |+character (or if there is no |, the whole description). .PP-Examples:+Example: .IP .nf \f[C]@@ -3763,7 +3985,7 @@ .PP This command also supports the output destination and output format options The output formats supported are \f[C]txt\f[R], \f[C]csv\f[R],-and (experimental) \f[C]json\f[R].+and (experimental) \f[C]json\f[R] and \f[C]sql\f[R]. .PP Here\[aq]s an example of print\[aq]s CSV output: .IP@@ -3831,10 +4053,16 @@ .PD Show postings and their running total. .PP-The register command displays postings in date order, one per line, and-their running total.-This is typically used with a query selecting a particular account, to-see that account\[aq]s activity:+The register command displays matched postings, across all accounts, in+date order, with their running total or running historical balance.+(See also the \f[C]aregister\f[R] command, which shows matched+transactions in a specific account.)+.PP+register normally shows line per posting, but note that multi-commodity+amounts will occupy multiple lines (one line per commodity).+.PP+It is typically used with a query selecting a particular account, to see+that account\[aq]s activity: .IP .nf \f[C]@@ -4226,12 +4454,19 @@ .PD 0 .P .PD-List all the tag names used in the journal.+List the unique tag names used in the journal. With a TAGREGEX argument, only tag names matching the regular expression (case insensitive) are shown. With QUERY arguments, only transactions matching the query are considered.-With --values flag, the tags\[aq] unique values are listed instead.+.PP+With the --values flag, the tags\[aq] unique values are listed instead.+.PP+With --parsed flag, all tags or values are shown in the order they are+parsed from the input data, including duplicates.+.PP+With -E/--empty, any blank/empty values will also be shown, otherwise+they are omitted. .SS test .PP test@@ -4318,9 +4553,6 @@ These are typically prototypes and not guaranteed to work. .SH ENVIRONMENT .PP-\f[B]COLUMNS\f[R] The screen width used by the register command.-Default: the full terminal width.-.PP \f[B]LEDGER_FILE\f[R] The journal file path when not specified with \f[C]-f\f[R]. Default: \f[C]\[ti]/.hledger.journal\f[R] (on windows, perhaps@@ -4346,6 +4578,13 @@ .fi .PP To see the effect you may need to \f[C]killall Dock\f[R], or reboot.+.PP+\f[B]COLUMNS\f[R] The screen width used by the register command.+Default: the full terminal width.+.PP+\f[B]NO_COLOR\f[R] If this variable exists with any value, hledger will+not use ANSI color codes in terminal output.+This overrides the --color/--colour option. .SH FILES .PP Reads data from one or more files in hledger journal, timeclock,
embeddedfiles/hledger.info view
@@ -3,8 +3,8 @@  File: hledger.info,  Node: Top,  Next: COMMON TASKS,  Up: (dir) -hledger(1) hledger 1.18.1-*************************+hledger(1) hledger 1.18.99+**************************  hledger - a command-line accounting tool @@ -633,7 +633,14 @@      generate future transactions from periodic transaction rules, for      the next 6 months or till report end date.  In hledger-ui, also      make ordinary future transactions visible.+'--color=WHEN (or --colour=WHEN)' +     Should color-supporting commands use ANSI color codes in text+     output.  'auto' (default): whenever stdout seems to be a+     color-supporting terminal.  'always' or 'yes': always, useful eg+     when piping output into 'less -R'. 'never' or 'no': never.  A+     NO_COLOR environment variable overrides this.+    When a reporting option appears more than once in the command line, the last one takes precedence. @@ -948,39 +955,47 @@  $ cat some.journal | hledger -f- -   Usually the data file is in hledger's journal format, but it can also-be one of several other formats, listed below.  hledger detects the-format automatically based on the file extension, or if that is not-recognised, by trying each built-in "reader" in turn:+   Usually the data file is in hledger's journal format, but it can be+in any of the supported file formats, which currently are: -Reader:  Reads:                           Used for file extensions:-----------------------------------------------------------------------------'journal'hledger's journal format, also   '.journal' '.j' '.hledger'-         some Ledger journals             '.ledger'-'timeclock'timeclock files (precise time  '.timeclock'-         logging)-'timedot'timedot files (approximate       '.timedot'-         time logging)-'csv'    comma-separated values (data     '.csv'-         interchange)+Reader:  Reads:                                   Used for file+                                                  extensions:+--------------------------------------------------------------------------+'journal'hledger journal files and some Ledger    '.journal' '.j'+         journals, for transactions               '.hledger' '.ledger'+'timeclock'timeclock files, for precise time      '.timeclock'+         logging+'timedot'timedot files, for approximate time      '.timedot'+         logging+'csv'    comma/semicolon/tab/other-separated      '.csv' '.ssv' '.tsv'+         values, for data import -   If needed (eg to ensure correct error messages when a file has the-"wrong" extension), you can force a specific reader/format by prepending-it to the file path with a colon.  Examples:+   hledger detects the format automatically based on the file extensions+shown above.  If it can't recognise the file extension, it assumes+'journal' format.  So for non-journal files, it's important to use a+recognised file extension, so as to either read successfully or to show+relevant error messages. +   When you can't ensure the right file extension, not to worry: you can+force a specific reader/format by prefixing the file path with the+format and a colon.  Eg to read a .dat file as csv:+ $ hledger -f csv:/some/csv-file.dat stats $ echo 'i 2009/13/1 08:00:00' | hledger print -ftimeclock:- -   You can also specify multiple '-f' options, to read multiple files as-one big journal.  There are some limitations with this:+   You can specify multiple '-f' options, to read multiple files as one+big journal.  There are some limitations with this:     * directives in one file will not affect the other files    * balance assertions will not see any account balances from previous      files -   If you need those, either use the include directive, or concatenate-the files, eg: 'cat a.journal b.journal | hledger -f- CMD'.+   If you need either of those things, you can +   * use a single parent file which includes the others+   * or concatenate the files into one before reading, eg: 'cat+     a.journal b.journal | hledger -f- CMD'.+  File: hledger.info,  Node: Output destination,  Next: Output format,  Prev: Input files,  Up: OPTIONS @@ -1007,8 +1022,8 @@  Some commands (print, register, the balance commands) offer a choice of output format.  In addition to the usual plain text format ('txt'),-there are CSV ('csv'), HTML ('html') and JSON ('json').  This is-controlled by the '-O/--output-format' option:+there are CSV ('csv'), HTML ('html'), JSON ('json') and SQL ('sql').+This is controlled by the '-O/--output-format' option:  $ hledger print -O csv @@ -1039,6 +1054,20 @@      your control.  We hope this approach will not cause problems in      practice; if you find otherwise, please let us know.  (Cf #1195) +   Notes about SQL output:++   * SQL output is also marked experimental, and much like JSON could+     use real-world feedback.++   * SQL output is expected to work with sqlite, MySQL and PostgreSQL++   * SQL output is structured with the expectations that statements will+     be executed in the empty database.  If you already have tables+     created via SQL output of hledger, you would probably want to+     either clear tables of existing data (via 'delete' or 'truncate'+     SQL statements) or drop tables completely as otherwise your+     postings will be duped.+  File: hledger.info,  Node: Regular expressions,  Next: Smart dates,  Prev: Output format,  Up: OPTIONS @@ -1224,6 +1253,11 @@ '-p "2009/1"'     the month of jan; equivalent to “2009/1/1 to 2009/2/1” '-p "2009/1/1"'   just that day; equivalent to “2009/1/1 to 2009/1/2” +   Or you can specify a single quarter like so:++'-p "2009Q1"'   first quarter of 2009, equivalent to “2009/1/1 to 2009/4/1”+'-p "q4"'       fourth quarter of the current year+    The argument of '-p' can also begin with, or be, a report interval expression.  The basic report intervals are 'daily', 'weekly', 'monthly', 'quarterly', or 'yearly', which have the same effect as the@@ -1253,7 +1287,8 @@ 2009-12-29"'     The following more complex report intervals are also supported:-'biweekly', 'bimonthly', 'every day|week|month|quarter|year', 'every N+'biweekly', 'fortnightly', 'bimonthly', 'every+day|week|month|quarter|year', 'every N days|weeks|months|quarters|years'.     All of these will start on the first day of the requested period and@@ -1881,6 +1916,7 @@ * accounts:: * activity:: * add::+* aregister:: * balance:: * balancesheet:: * balancesheetequity::@@ -1888,6 +1924,7 @@ * check-dates:: * check-dupes:: * close::+* codes:: * commodities:: * descriptions:: * diff::@@ -1961,13 +1998,14 @@ 2008-10-01 **  -File: hledger.info,  Node: add,  Next: balance,  Prev: activity,  Up: COMMANDS+File: hledger.info,  Node: add,  Next: aregister,  Prev: activity,  Up: COMMANDS  3.3 add =======  add-Prompt for transactions and add them to the journal.+Prompt for transactions and add them to the journal.  Any arguments will+be used as default inputs for the first N prompts.     Many hledger users edit their journals directly with a text editor, or generate them from CSV. For more interactive data entry, there is the@@ -2028,13 +2066,88 @@ Date [2015/05/22]: <CTRL-D> $     On Microsoft Windows, the add command makes sure that no part of the-file path ends with a period, as it can cause data loss on that platform-(cf #1056).+file path ends with a period, as that would cause problems (#1056).  -File: hledger.info,  Node: balance,  Next: balancesheet,  Prev: add,  Up: COMMANDS+File: hledger.info,  Node: aregister,  Next: balance,  Prev: add,  Up: COMMANDS -3.4 balance+3.4 aregister+=============++aregister, areg+Show transactions affecting a particular account, and the account's+running balance.++   'aregister' shows the transactions affecting a particular account+(and its subaccounts), from the point of view of that account.  Each+line shows:++   * the transaction's (or posting's, see below) date+   * the names of the other account(s) involved+   * the net change to this account's balance+   * the account's historical running balance (including balance from+     transactions before the report start date).++   With 'aregister', each line represents a whole transaction - as in+hledger-ui, hledger-web, and your bank statement.  By contrast, the+'register' command shows individual postings, across all accounts.  You+might prefer 'aregister' for reconciling with real-world asset/liability+accounts, and 'register' for reviewing detailed revenues/expenses.++   An account must be specified as the first argument, which should be+the full account name or an account pattern (regular expression).+aregister will show transactions in this account (the first one matched)+and any of its subaccounts.++   Any additional arguments form a query which will filter the+transactions shown.++   Transactions making a net change of zero are not shown by default;+add the '-E/--empty' flag to show them.++* Menu:++* aregister and custom posting dates::+* Output format::+++File: hledger.info,  Node: aregister and custom posting dates,  Next: ,  Up: aregister++3.4.1 aregister and custom posting dates+----------------------------------------++Transactions whose date is outside the report period can still be shown,+if they have a posting to this account dated inside the report period.+(And in this case it's the posting date that is shown.)  This ensures+that 'aregister' can show an accurate historical running balance,+matching the one shown by 'register -H' with the same arguments.++   To filter strictly by transaction date instead, add the '--txn-dates'+flag.  If you use this flag and some of your postings have custom dates,+it's probably best to assume the running balance is wrong.++3.4.2 Output format+-------------------++This command also supports the output destination and output format+options The output formats supported are 'txt', 'csv', and 'json'.++   Examples:++   Show all transactions and historical running balance in the first+account whose name contains "checking":++$ hledger areg checking++   Show transactions and historical running balance in all asset+accounts during july:++$ hledger areg assets date:jul+++File: hledger.info,  Node: balance,  Next: balancesheet,  Prev: aregister,  Up: COMMANDS++3.5 balance ===========  balance, bal, b@@ -2077,7 +2190,7 @@  File: hledger.info,  Node: Classic balance report,  Next: Customising the classic balance report,  Up: balance -3.4.1 Classic balance report+3.5.1 Classic balance report ----------------------------  This is the original balance report, as found in Ledger.  It usually@@ -2100,7 +2213,7 @@    By default, accounts are displayed hierarchically, with subaccounts indented below their parent.  At each level of the tree, accounts are sorted by account code if any, then by account name.  Or with-'-S/--sort-amount', by their balance amount.+'-S/--sort-amount', by their balance amount, largest first.     "Boring" accounts, which contain a single interesting subaccount and no balance of their own, are elided into the following line for more@@ -2124,7 +2237,7 @@  File: hledger.info,  Node: Customising the classic balance report,  Next: Colour support,  Prev: Classic balance report,  Up: balance -3.4.2 Customising the classic balance report+3.5.2 Customising the classic balance report --------------------------------------------  You can customise the layout of classic balance reports with '--format@@ -2186,18 +2299,16 @@  File: hledger.info,  Node: Colour support,  Next: Flat mode,  Prev: Customising the classic balance report,  Up: balance -3.4.3 Colour support+3.5.3 Colour support -------------------- -The balance command shows negative amounts in red, if:--   * the 'TERM' environment variable is not set to 'dumb'-   * the output is not being redirected or piped anywhere+In terminal output, when colour is enabled, the balance command shows+negative amounts in red.   File: hledger.info,  Node: Flat mode,  Next: Depth limited balance reports,  Prev: Colour support,  Up: balance -3.4.4 Flat mode+3.5.4 Flat mode ---------------  To see a flat list instead of the default hierarchical display, use@@ -2213,7 +2324,7 @@  File: hledger.info,  Node: Depth limited balance reports,  Next: Percentages,  Prev: Flat mode,  Up: balance -3.4.5 Depth limited balance reports+3.5.5 Depth limited balance reports -----------------------------------  With '--depth N' or 'depth:N' or just '-N', balance reports show@@ -2232,7 +2343,7 @@  File: hledger.info,  Node: Percentages,  Next: Multicolumn balance report,  Prev: Depth limited balance reports,  Up: balance -3.4.6 Percentages+3.5.6 Percentages -----------------  With '-%' or '--percent', balance reports show each account's value@@ -2264,7 +2375,7 @@  File: hledger.info,  Node: Multicolumn balance report,  Next: Budget report,  Prev: Percentages,  Up: balance -3.4.7 Multicolumn balance report+3.5.7 Multicolumn balance report --------------------------------  Multicolumn or tabular balance reports are a very useful hledger@@ -2369,17 +2480,23 @@  (Average is rounded to the dollar here since all journal amounts are) -   A limitation of multicolumn balance reports: eliding of boring parent-accounts in tree mode, as in the classic balance report, is not yet-supported.-    The '--transpose' flag can be used to exchange the rows and columns of a multicolumn report. +   When showing multicommodity amounts, multicolumn balance reports will+elide any amounts which have more than two commodities, since otherwise+columns could get very wide.  The '--no-elide' flag disables this.+Hiding totals with the '-N/--no-total' flag can also help reduce the+width of multicommodity reports.++   When the report is still too wide, a good workaround is to pipe it+into 'less -RS' (-R for colour, -S to chop long lines).  Eg: 'hledger+bal -D --color=yes | less -RS'.+  File: hledger.info,  Node: Budget report,  Next: ,  Prev: Multicolumn balance report,  Up: balance -3.4.8 Budget report+3.5.8 Budget report -------------------  With '--budget', extra columns are displayed showing budget goals for@@ -2502,7 +2619,7 @@  File: hledger.info,  Node: Nested budgets,  Up: Budget report -3.4.8.1 Nested budgets+3.5.8.1 Nested budgets ......................  You can add budgets to any account in your account hierarchy.  If you@@ -2587,7 +2704,7 @@ ----------------------------------------++-------------------------------                                         ||        0 [                 0]  -3.4.9 Output format+3.5.9 Output format -------------------  This command also supports the output destination and output format@@ -2597,18 +2714,19 @@  File: hledger.info,  Node: balancesheet,  Next: balancesheetequity,  Prev: balance,  Up: COMMANDS -3.5 balancesheet+3.6 balancesheet ================  balancesheet, bs-This command displays a simple balance sheet, showing historical ending-balances of asset and liability accounts (ignoring any report begin-date).  It assumes that these accounts are under a top-level 'asset' or-'liability' account (case insensitive, plural forms also allowed).+This command displays a balance sheet, showing historical ending+balances of asset and liability accounts.  (To see equity as well, use+the balancesheetequity command.)  Amounts are shown with normal positive+sign, as in conventional financial statements. -   Note this report shows all account balances with normal positive sign-(like conventional financial statements, unlike balance/print/register)-(experimental).+   The asset and liability accounts shown are those accounts declared+with the 'Asset' or 'Cash' or 'Liability' type, or otherwise all+accounts under a top-level 'asset' or 'liability' account (case+insensitive, plurals allowed).     Example: @@ -2647,13 +2765,19 @@  File: hledger.info,  Node: balancesheetequity,  Next: cashflow,  Prev: balancesheet,  Up: COMMANDS -3.6 balancesheetequity+3.7 balancesheetequity ======================  balancesheetequity, bse-Just like balancesheet, but also reports Equity (which it assumes is-under a top-level 'equity' account).+This command displays a balance sheet, showing historical ending+balances of asset, liability and equity accounts.  Amounts are shown+with normal positive sign, as in conventional financial statements. +   The asset, liability and equity accounts shown are those accounts+declared with the 'Asset', 'Cash', 'Liability' or 'Equity' type, or+otherwise all accounts under a top-level 'asset', 'liability' or+'equity' account (case insensitive, plurals allowed).+    Example:  $ hledger balancesheetequity@@ -2687,17 +2811,19 @@  File: hledger.info,  Node: cashflow,  Next: check-dates,  Prev: balancesheetequity,  Up: COMMANDS -3.7 cashflow+3.8 cashflow ============  cashflow, cf-This command displays a simple cashflow statement, showing changes in-"cash" accounts.  It assumes that these accounts are under a top-level-'asset' account (case insensitive, plural forms also allowed) and do not-contain 'receivable' or 'A/R' in their name.  Note this report shows all-account balances with normal positive sign (like conventional financial-statements, unlike balance/print/register) (experimental).+This command displays a cashflow statement, showing the inflows and+outflows affecting "cash" (ie, liquid) assets.  Amounts are shown with+normal positive sign, as in conventional financial statements. +   The "cash" accounts shown are those accounts declared with the 'Cash'+type, or otherwise all accounts under a top-level 'asset' account (case+insensitive, plural allowed) which do not have 'fixed', 'investment',+'receivable' or 'A/R' in their name.+    Example:  $ hledger cashflow@@ -2727,7 +2853,7 @@  File: hledger.info,  Node: check-dates,  Next: check-dupes,  Prev: cashflow,  Up: COMMANDS -3.8 check-dates+3.9 check-dates ===============  check-dates@@ -2739,8 +2865,8 @@  File: hledger.info,  Node: check-dupes,  Next: close,  Prev: check-dates,  Up: COMMANDS -3.9 check-dupes-===============+3.10 check-dupes+================  check-dupes Reports account names having the same leaf but different prefixes.  In@@ -2750,9 +2876,9 @@    An example: http://stefanorodighiero.net/software/hledger-dupes.html  -File: hledger.info,  Node: close,  Next: commodities,  Prev: check-dupes,  Up: COMMANDS+File: hledger.info,  Node: close,  Next: codes,  Prev: check-dupes,  Up: COMMANDS -3.10 close+3.11 close ==========  close, equity@@ -2792,7 +2918,7 @@  File: hledger.info,  Node: close usage,  Up: close -3.10.1 close usage+3.11.1 close usage ------------------  If you split your journal files by time (eg yearly), you will typically@@ -2861,9 +2987,55 @@     assets:checking  -File: hledger.info,  Node: commodities,  Next: descriptions,  Prev: close,  Up: COMMANDS+File: hledger.info,  Node: codes,  Next: commodities,  Prev: close,  Up: COMMANDS -3.11 commodities+3.12 codes+==========++codes+List the codes seen in transactions, in the order parsed.++   This command prints the value of each transaction's code field, in+the order transactions were parsed.  The transaction code is an optional+value written in parentheses between the date and description, often+used to store a cheque number, order number or similar.++   Transactions aren't required to have a code, and missing or empty+codes will not be shown by default.  With the '-E'/'--empty' flag, they+will be printed as blank lines.++   You can add a query to select a subset of transactions.++   Examples:++1/1 (123)+ (a)  1++1/1 ()+ (a)  1++1/1+ (a)  1++1/1 (126)+ (a)  1++$ hledger codes+123+124+126++$ hledger codes -E+123+124+++126+++File: hledger.info,  Node: commodities,  Next: descriptions,  Prev: codes,  Up: COMMANDS++3.13 commodities ================  commodities@@ -2872,14 +3044,17 @@  File: hledger.info,  Node: descriptions,  Next: diff,  Prev: commodities,  Up: COMMANDS -3.12 descriptions+3.14 descriptions ================= -descriptions Show descriptions.+descriptions+List the unique descriptions that appear in transactions. -   This command lists all descriptions that appear in transactions.+   This command lists the unique descriptions that appear in+transactions, in alphabetic order.  You can add a query to select a+subset of transactions. -   Examples:+   Example:  $ hledger descriptions Store Name@@ -2889,7 +3064,7 @@  File: hledger.info,  Node: diff,  Next: files,  Prev: descriptions,  Up: COMMANDS -3.13 diff+3.15 diff =========  diff@@ -2924,7 +3099,7 @@  File: hledger.info,  Node: files,  Next: help,  Prev: diff,  Up: COMMANDS -3.14 files+3.16 files ==========  files@@ -2934,7 +3109,7 @@  File: hledger.info,  Node: help,  Next: import,  Prev: files,  Up: COMMANDS -3.15 help+3.17 help =========  help@@ -2974,7 +3149,7 @@  File: hledger.info,  Node: import,  Next: incomestatement,  Prev: help,  Up: COMMANDS -3.16 import+3.18 import ===========  import@@ -3003,7 +3178,7 @@  File: hledger.info,  Node: Importing balance assignments,  Up: import -3.16.1 Importing balance assignments+3.18.1 Importing balance assignments ------------------------------------  Entries added by import will have their posting amounts made explicit@@ -3022,20 +3197,21 @@  File: hledger.info,  Node: incomestatement,  Next: notes,  Prev: import,  Up: COMMANDS -3.17 incomestatement+3.19 incomestatement ====================  incomestatement, is-This command displays a simple income statement, showing revenues and-expenses during a period.  It assumes that these accounts are under a++   This command displays an income statement, showing revenues and+expenses during one or more periods.  Amounts are shown with normal+positive sign, as in conventional financial statements.++   The revenue and expense accounts shown are those accounts declared+with the 'Revenue' or 'Expense' type, or otherwise all accounts under a top-level 'revenue' or 'income' or 'expense' account (case insensitive,-plural forms also allowed).  Note this report shows all account balances-with normal positive sign (like conventional financial statements,-unlike balance/print/register) (experimental).+plurals allowed). -   This command displays a simple income statement.  It currently-assumes that you have top-level accounts named 'income' (or 'revenue')-and 'expense' (plural forms also allowed.)+   Example:  $ hledger incomestatement Income Statement@@ -3071,14 +3247,18 @@  File: hledger.info,  Node: notes,  Next: payees,  Prev: incomestatement,  Up: COMMANDS -3.18 notes+3.20 notes ========== -notes Show notes.+notes+List the unique notes that appear in transactions. -   This command lists all notes that appear in transactions.+   This command lists the unique notes that appear in transactions, in+alphabetic order.  You can add a query to select a subset of+transactions.  The note is the part of the transaction description after+a | character (or if there is no |, the whole description). -   Examples:+   Example:  $ hledger notes Petrol@@ -3087,14 +3267,19 @@  File: hledger.info,  Node: payees,  Next: prices,  Prev: notes,  Up: COMMANDS -3.19 payees+3.21 payees =========== -payees Show payee names.+payees+List the unique payee/payer names that appear in transactions. -   This command lists all payee names that appear in transactions.+   This command lists the unique payee/payer names that appear in+transactions, in alphabetic order.  You can add a query to select a+subset of transactions.  The payee/payer is the part of the transaction+description before a | character (or if there is no |, the whole+description). -   Examples:+   Example:  $ hledger payees Store Name@@ -3104,7 +3289,7 @@  File: hledger.info,  Node: prices,  Next: print,  Prev: payees,  Up: COMMANDS -3.20 prices+3.22 prices ===========  prices@@ -3117,7 +3302,7 @@  File: hledger.info,  Node: print,  Next: print-unique,  Prev: prices,  Up: COMMANDS -3.21 print+3.23 print ==========  print, txns, p@@ -3192,7 +3377,7 @@     This command also supports the output destination and output format options The output formats supported are 'txt', 'csv', and-(experimental) 'json'.+(experimental) 'json' and 'sql'.     Here's an example of print's CSV output: @@ -3226,7 +3411,7 @@  File: hledger.info,  Node: print-unique,  Next: register,  Prev: print,  Up: COMMANDS -3.22 print-unique+3.24 print-unique =================  print-unique@@ -3247,16 +3432,24 @@  File: hledger.info,  Node: register,  Next: register-match,  Prev: print-unique,  Up: COMMANDS -3.23 register+3.25 register =============  register, reg, r Show postings and their running total. -   The register command displays postings in date order, one per line,-and their running total.  This is typically used with a query selecting-a particular account, to see that account's activity:+   The register command displays matched postings, across all accounts,+in date order, with their running total or running historical balance.+(See also the 'aregister' command, which shows matched transactions in a+specific account.) +   register normally shows line per posting, but note that+multi-commodity amounts will occupy multiple lines (one line per+commodity).++   It is typically used with a query selecting a particular account, to+see that account's activity:+ $ hledger register checking 2008/01/01 income               assets:bank:checking            $1           $1 2008/06/01 gift                 assets:bank:checking            $1           $2@@ -3337,7 +3530,7 @@  File: hledger.info,  Node: Custom register output,  Up: register -3.23.1 Custom register output+3.25.1 Custom register output -----------------------------  register uses the full terminal width by default, except on windows.@@ -3369,7 +3562,7 @@  File: hledger.info,  Node: register-match,  Next: rewrite,  Prev: register,  Up: COMMANDS -3.24 register-match+3.26 register-match ===================  register-match@@ -3382,7 +3575,7 @@  File: hledger.info,  Node: rewrite,  Next: roi,  Prev: register-match,  Up: COMMANDS -3.25 rewrite+3.27 rewrite ============  rewrite@@ -3434,7 +3627,7 @@  File: hledger.info,  Node: Re-write rules in a file,  Up: rewrite -3.25.1 Re-write rules in a file+3.27.1 Re-write rules in a file -------------------------------  During the run this tool will execute so called "Automated Transactions"@@ -3477,7 +3670,7 @@  File: hledger.info,  Node: Diff output format,  Next: rewrite vs print --auto,  Up: Re-write rules in a file -3.25.1.1 Diff output format+3.27.1.1 Diff output format ...........................  To use this tool for batch modification of your journal files you may@@ -3518,7 +3711,7 @@  File: hledger.info,  Node: rewrite vs print --auto,  Prev: Diff output format,  Up: Re-write rules in a file -3.25.1.2 rewrite vs. print -auto+3.27.1.2 rewrite vs. print -auto ................................  This command predates print -auto, and currently does much the same@@ -3538,7 +3731,7 @@  File: hledger.info,  Node: roi,  Next: stats,  Prev: rewrite,  Up: COMMANDS -3.26 roi+3.28 roi ========  roi@@ -3566,7 +3759,7 @@  File: hledger.info,  Node: stats,  Next: tags,  Prev: roi,  Up: COMMANDS -3.27 stats+3.29 stats ==========  stats@@ -3597,20 +3790,27 @@  File: hledger.info,  Node: tags,  Next: test,  Prev: stats,  Up: COMMANDS -3.28 tags+3.30 tags =========  tags-List all the tag names used in the journal.  With a TAGREGEX argument,-only tag names matching the regular expression (case insensitive) are-shown.  With QUERY arguments, only transactions matching the query are-considered.  With -values flag, the tags' unique values are listed-instead.+List the unique tag names used in the journal.  With a TAGREGEX+argument, only tag names matching the regular expression (case+insensitive) are shown.  With QUERY arguments, only transactions+matching the query are considered. +   With the -values flag, the tags' unique values are listed instead.++   With -parsed flag, all tags or values are shown in the order they are+parsed from the input data, including duplicates.++   With -E/-empty, any blank/empty values will also be shown, otherwise+they are omitted.+  File: hledger.info,  Node: test,  Next: Add-on commands,  Prev: tags,  Up: COMMANDS -3.29 test+3.31 test =========  test@@ -3637,7 +3837,7 @@  File: hledger.info,  Node: Add-on commands,  Prev: test,  Up: COMMANDS -3.30 Add-on commands+3.32 Add-on commands ====================  hledger also searches for external add-on commands, and will include@@ -3678,7 +3878,7 @@  File: hledger.info,  Node: ui,  Next: web,  Up: Add-on commands -3.30.1 ui+3.32.1 ui ---------  hledger-ui provides an efficient terminal interface.@@ -3686,7 +3886,7 @@  File: hledger.info,  Node: web,  Next: iadd,  Prev: ui,  Up: Add-on commands -3.30.2 web+3.32.2 web ----------  hledger-web provides a simple web interface.@@ -3696,7 +3896,7 @@  File: hledger.info,  Node: iadd,  Next: interest,  Prev: web,  Up: Add-on commands -3.30.3 iadd+3.32.3 iadd -----------  hledger-iadd is a more interactive, terminal UI replacement for the add@@ -3705,7 +3905,7 @@  File: hledger.info,  Node: interest,  Prev: iadd,  Up: Add-on commands -3.30.4 interest+3.32.4 interest ---------------  hledger-interest generates interest transactions for an account@@ -3720,10 +3920,7 @@ 4 ENVIRONMENT ************* -*COLUMNS* The screen width used by the register command.  Default: the-full terminal width.--   *LEDGER_FILE* The journal file path when not specified with '-f'.+*LEDGER_FILE* The journal file path when not specified with '-f'. Default: '~/.hledger.journal' (on windows, perhaps 'C:/Users/USER/.hledger.journal'). @@ -3743,6 +3940,13 @@     To see the effect you may need to 'killall Dock', or reboot. +   *COLUMNS* The screen width used by the register command.  Default:+the full terminal width.++   *NO_COLOR* If this variable exists with any value, hledger will not+use ANSI color codes in terminal output.  This overrides the+-color/-colour option.+  File: hledger.info,  Node: FILES,  Next: LIMITATIONS,  Prev: ENVIRONMENT,  Up: Top @@ -3858,197 +4062,204 @@  Tag Table: Node: Top68-Node: COMMON TASKS2319-Ref: #common-tasks2431-Node: Getting help2838-Ref: #getting-help2970-Node: Constructing command lines3523-Ref: #constructing-command-lines3715-Node: Starting a journal file4412-Ref: #starting-a-journal-file4610-Node: Setting opening balances5798-Ref: #setting-opening-balances5994-Node: Recording transactions9135-Ref: #recording-transactions9315-Node: Reconciling9871-Ref: #reconciling10014-Node: Reporting12271-Ref: #reporting12411-Node: Migrating to a new file16410-Ref: #migrating-to-a-new-file16558-Node: OPTIONS16857-Ref: #options16964-Node: General options17334-Ref: #general-options17459-Node: Command options20413-Ref: #command-options20564-Node: Command arguments20962-Ref: #command-arguments21109-Node: Queries21989-Ref: #queries22144-Node: Special characters in arguments and queries26106-Ref: #special-characters-in-arguments-and-queries26334-Node: More escaping26785-Ref: #more-escaping26947-Node: Even more escaping27243-Ref: #even-more-escaping27437-Node: Less escaping28108-Ref: #less-escaping28270-Node: Unicode characters28515-Ref: #unicode-characters28697-Node: Input files30109-Ref: #input-files30252-Node: Output destination32181-Ref: #output-destination32333-Node: Output format32758-Ref: #output-format32908-Node: Regular expressions34490-Ref: #regular-expressions34647-Node: Smart dates36383-Ref: #smart-dates36534-Node: Report start & end date37895-Ref: #report-start-end-date38067-Node: Report intervals39564-Ref: #report-intervals39729-Node: Period expressions40119-Ref: #period-expressions40279-Node: Depth limiting44415-Ref: #depth-limiting44559-Node: Pivoting44891-Ref: #pivoting45014-Node: Valuation46690-Ref: #valuation46792-Node: -B Cost47481-Ref: #b-cost47585-Node: -V Value47718-Ref: #v-value47864-Node: -X Value in specified commodity48059-Ref: #x-value-in-specified-commodity48258-Node: Valuation date48407-Ref: #valuation-date48575-Node: Market prices48985-Ref: #market-prices49165-Node: --infer-value market prices from transactions49942-Ref: #infer-value-market-prices-from-transactions50191-Node: Valuation commodity51473-Ref: #valuation-commodity51682-Node: Simple valuation examples52908-Ref: #simple-valuation-examples53110-Node: --value Flexible valuation53769-Ref: #value-flexible-valuation53977-Node: More valuation examples55924-Ref: #more-valuation-examples56133-Node: Effect of valuation on reports58138-Ref: #effect-of-valuation-on-reports58326-Node: COMMANDS63847-Ref: #commands63955-Node: accounts65039-Ref: #accounts65137-Node: activity65836-Ref: #activity65946-Node: add66329-Ref: #add66428-Node: balance69167-Ref: #balance69278-Node: Classic balance report70736-Ref: #classic-balance-report70909-Node: Customising the classic balance report72278-Ref: #customising-the-classic-balance-report72506-Node: Colour support74582-Ref: #colour-support74749-Node: Flat mode74922-Ref: #flat-mode75070-Node: Depth limited balance reports75483-Ref: #depth-limited-balance-reports75668-Node: Percentages76124-Ref: #percentages76290-Node: Multicolumn balance report77427-Ref: #multicolumn-balance-report77607-Node: Budget report82869-Ref: #budget-report83012-Node: Nested budgets88278-Ref: #nested-budgets88390-Ref: #output-format-191871-Node: balancesheet92068-Ref: #balancesheet92204-Node: balancesheetequity93670-Ref: #balancesheetequity93819-Node: cashflow94542-Ref: #cashflow94670-Node: check-dates95849-Ref: #check-dates95976-Node: check-dupes96255-Ref: #check-dupes96379-Node: close96672-Ref: #close96786-Node: close usage98308-Ref: #close-usage98401-Node: commodities101214-Ref: #commodities101341-Node: descriptions101423-Ref: #descriptions101551-Node: diff101732-Ref: #diff101838-Node: files102885-Ref: #files102985-Node: help103132-Ref: #help103232-Node: import104313-Ref: #import104427-Node: Importing balance assignments105320-Ref: #importing-balance-assignments105468-Node: incomestatement106117-Ref: #incomestatement106250-Node: notes107737-Ref: #notes107850-Node: payees107976-Ref: #payees108082-Node: prices108240-Ref: #prices108346-Node: print108687-Ref: #print108797-Node: print-unique113583-Ref: #print-unique113709-Node: register113994-Ref: #register114121-Node: Custom register output118293-Ref: #custom-register-output118422-Node: register-match119759-Ref: #register-match119893-Node: rewrite120244-Ref: #rewrite120359-Node: Re-write rules in a file122214-Ref: #re-write-rules-in-a-file122348-Node: Diff output format123558-Ref: #diff-output-format123727-Node: rewrite vs print --auto124819-Ref: #rewrite-vs.-print---auto124998-Node: roi125554-Ref: #roi125652-Node: stats126664-Ref: #stats126763-Node: tags127551-Ref: #tags127649-Node: test127943-Ref: #test128051-Node: Add-on commands128798-Ref: #add-on-commands128915-Node: ui130258-Ref: #ui130346-Node: web130400-Ref: #web130503-Node: iadd130619-Ref: #iadd130730-Node: interest130812-Ref: #interest130919-Node: ENVIRONMENT131159-Ref: #environment131271-Node: FILES132100-Ref: #files-1132203-Node: LIMITATIONS132416-Ref: #limitations132535-Node: TROUBLESHOOTING133277-Ref: #troubleshooting133390+Node: COMMON TASKS2321+Ref: #common-tasks2433+Node: Getting help2840+Ref: #getting-help2972+Node: Constructing command lines3525+Ref: #constructing-command-lines3717+Node: Starting a journal file4414+Ref: #starting-a-journal-file4612+Node: Setting opening balances5800+Ref: #setting-opening-balances5996+Node: Recording transactions9137+Ref: #recording-transactions9317+Node: Reconciling9873+Ref: #reconciling10016+Node: Reporting12273+Ref: #reporting12413+Node: Migrating to a new file16412+Ref: #migrating-to-a-new-file16560+Node: OPTIONS16859+Ref: #options16966+Node: General options17336+Ref: #general-options17461+Node: Command options20767+Ref: #command-options20918+Node: Command arguments21316+Ref: #command-arguments21463+Node: Queries22343+Ref: #queries22498+Node: Special characters in arguments and queries26460+Ref: #special-characters-in-arguments-and-queries26688+Node: More escaping27139+Ref: #more-escaping27301+Node: Even more escaping27597+Ref: #even-more-escaping27791+Node: Less escaping28462+Ref: #less-escaping28624+Node: Unicode characters28869+Ref: #unicode-characters29051+Node: Input files30463+Ref: #input-files30606+Node: Output destination32905+Ref: #output-destination33057+Node: Output format33482+Ref: #output-format33632+Node: Regular expressions35799+Ref: #regular-expressions35956+Node: Smart dates37692+Ref: #smart-dates37843+Node: Report start & end date39204+Ref: #report-start-end-date39376+Node: Report intervals40873+Ref: #report-intervals41038+Node: Period expressions41428+Ref: #period-expressions41588+Node: Depth limiting45920+Ref: #depth-limiting46064+Node: Pivoting46396+Ref: #pivoting46519+Node: Valuation48195+Ref: #valuation48297+Node: -B Cost48986+Ref: #b-cost49090+Node: -V Value49223+Ref: #v-value49369+Node: -X Value in specified commodity49564+Ref: #x-value-in-specified-commodity49763+Node: Valuation date49912+Ref: #valuation-date50080+Node: Market prices50490+Ref: #market-prices50670+Node: --infer-value market prices from transactions51447+Ref: #infer-value-market-prices-from-transactions51696+Node: Valuation commodity52978+Ref: #valuation-commodity53187+Node: Simple valuation examples54413+Ref: #simple-valuation-examples54615+Node: --value Flexible valuation55274+Ref: #value-flexible-valuation55482+Node: More valuation examples57429+Ref: #more-valuation-examples57638+Node: Effect of valuation on reports59643+Ref: #effect-of-valuation-on-reports59831+Node: COMMANDS65352+Ref: #commands65460+Node: accounts66568+Ref: #accounts66666+Node: activity67365+Ref: #activity67475+Node: add67858+Ref: #add67959+Node: aregister70752+Ref: #aregister70864+Node: aregister and custom posting dates72237+Ref: #aregister-and-custom-posting-dates72410+Ref: #output-format-173003+Node: balance73408+Ref: #balance73525+Node: Classic balance report74983+Ref: #classic-balance-report75156+Node: Customising the classic balance report76540+Ref: #customising-the-classic-balance-report76768+Node: Colour support78844+Ref: #colour-support79011+Node: Flat mode79107+Ref: #flat-mode79255+Node: Depth limited balance reports79668+Ref: #depth-limited-balance-reports79853+Node: Percentages80309+Ref: #percentages80475+Node: Multicolumn balance report81612+Ref: #multicolumn-balance-report81792+Node: Budget report87389+Ref: #budget-report87532+Node: Nested budgets92798+Ref: #nested-budgets92910+Ref: #output-format-296391+Node: balancesheet96588+Ref: #balancesheet96724+Node: balancesheetequity98236+Ref: #balancesheetequity98385+Node: cashflow99461+Ref: #cashflow99589+Node: check-dates100805+Ref: #check-dates100932+Node: check-dupes101211+Ref: #check-dupes101337+Node: close101630+Ref: #close101738+Node: close usage103260+Ref: #close-usage103353+Node: codes106166+Ref: #codes106274+Node: commodities106986+Ref: #commodities107113+Node: descriptions107195+Ref: #descriptions107323+Node: diff107627+Ref: #diff107733+Node: files108780+Ref: #files108880+Node: help109027+Ref: #help109127+Node: import110208+Ref: #import110322+Node: Importing balance assignments111215+Ref: #importing-balance-assignments111363+Node: incomestatement112012+Ref: #incomestatement112145+Node: notes113490+Ref: #notes113603+Node: payees113971+Ref: #payees114077+Node: prices114497+Ref: #prices114603+Node: print114944+Ref: #print115054+Node: print-unique119850+Ref: #print-unique119976+Node: register120261+Ref: #register120388+Node: Custom register output124837+Ref: #custom-register-output124966+Node: register-match126303+Ref: #register-match126437+Node: rewrite126788+Ref: #rewrite126903+Node: Re-write rules in a file128758+Ref: #re-write-rules-in-a-file128892+Node: Diff output format130102+Ref: #diff-output-format130271+Node: rewrite vs print --auto131363+Ref: #rewrite-vs.-print---auto131542+Node: roi132098+Ref: #roi132196+Node: stats133208+Ref: #stats133307+Node: tags134095+Ref: #tags134193+Node: test134712+Ref: #test134820+Node: Add-on commands135567+Ref: #add-on-commands135684+Node: ui137027+Ref: #ui137115+Node: web137169+Ref: #web137272+Node: iadd137388+Ref: #iadd137499+Node: interest137581+Ref: #interest137688+Node: ENVIRONMENT137928+Ref: #environment138040+Node: FILES139025+Ref: #files-1139128+Node: LIMITATIONS139341+Ref: #limitations139460+Node: TROUBLESHOOTING140202+Ref: #troubleshooting140315  End Tag Table 
embeddedfiles/hledger.txt view
@@ -538,6 +538,13 @@               for the next 6 months or till report end date.   In  hledger-ui,               also make ordinary future transactions visible. +       --color=WHEN (or --colour=WHEN)+              Should  color-supporting  commands  use ANSI color codes in text+              output.  'auto' (default): whenever stdout seems to be a  color-+              supporting  terminal.  'always' or 'yes': always, useful eg when+              piping output into  'less  -R'.   'never'  or  'no':  never.   A+              NO_COLOR environment variable overrides this.+        When a reporting option appears more than once in the command line, the        last one takes precedence. @@ -803,40 +810,49 @@                $ cat some.journal | hledger -f- -       Usually the data file is in hledger's journal format, but it  can  also-       be  one  of  several  other formats, listed below.  hledger detects the-       format automatically based on the file extension, or  if  that  is  not-       recognised, by trying each built-in "reader" in turn:+       Usually the data file is in hledger's journal format, but it can be  in+       any of the supported file formats, which currently are: -       Reader:    Reads:                            Used for file extensions:+       Reader:    Reads:                                    Used  for  file  exten-+                                                            sions:        ------------------------------------------------------------------------------       journal    hledger's  journal format, also   .journal .j .hledger .ledger-                  some Ledger journals-       time-      timeclock  files  (precise time   .timeclock-       clock      logging)-       timedot    timedot files (approximate time   .timedot-                  logging)-       csv        comma-separated   values  (data   .csv-                  interchange)+       journal    hledger journal files and  some  Ledger   .journal   .j  .hledger+                  journals, for transactions                .ledger+       time-      timeclock  files, for precise time log-   .timeclock+       clock      ging+       timedot    timedot  files,  for  approximate  time   .timedot+                  logging+       csv        comma/semicolon/tab/other-separated       .csv .ssv .tsv+                  values, for data import -       If needed (eg to ensure correct error messages  when  a  file  has  the-       "wrong"  extension), you can force a specific reader/format by prepend--       ing it to the file path with a colon.  Examples:+       hledger detects the format automatically based on the  file  extensions+       shown  above.   If  it  can't  recognise the file extension, it assumes+       journal format.  So for non-journal files,  it's  important  to  use  a+       recognised file extension, so as to either read successfully or to show+       relevant error messages. +       When you can't ensure the right file extension, not to worry:  you  can+       force a specific reader/format by prefixing the file path with the for-+       mat and a colon.  Eg to read a .dat file as csv:+               $ hledger -f csv:/some/csv-file.dat stats               $ echo 'i 2009/13/1 08:00:00' | hledger print -ftimeclock:- -       You can also specify multiple -f options, to read multiple files as one-       big journal.  There are some limitations with this:+       You can specify multiple -f options, to read multiple files as one  big+       journal.  There are some limitations with this:         o directives in one file will not affect the other files         o balance  assertions  will  not see any account balances from previous          files -       If you need those, either use the include directive, or concatenate the-       files, eg: cat a.journal b.journal | hledger -f- CMD.+       If you need either of those things, you can +       o use a single parent file which includes the others++       o or concatenate the files into one before reading, eg:  cat  a.journal+         b.journal | hledger -f- CMD.+    Output destination        hledger commands send their output to the terminal by default.  You can        of course redirect this, eg into a file, using standard shell syntax:@@ -853,8 +869,8 @@    Output format        Some commands (print, register, the balance commands) offer a choice of        output format.  In addition to the usual plain text format (txt), there-       are CSV (csv), HTML (html) and JSON (json).  This is controlled by  the-       -O/--output-format option:+       are CSV (csv), HTML (html), JSON (json) and SQL (sql).   This  is  con-+       trolled by the -O/--output-format option:                $ hledger print -O csv @@ -886,61 +902,74 @@          hope this approach will not cause problems in practice; if  you  find          otherwise, please let us know.  (Cf #1195) +       Notes about SQL output:++       o SQL  output is also marked experimental, and much like JSON could use+         real-world feedback.++       o SQL output is expected to work with sqlite, MySQL and PostgreSQL++       o SQL output is structured with the expectations that  statements  will+         be  executed  in the empty database.  If you already have tables cre-+         ated via SQL output of hledger, you would  probably  want  to  either+         clear tables of existing data (via delete or truncate SQL statements)+         or drop tables completely as otherwise your postings will be duped.+    Regular expressions        hledger uses regular expressions in a number of places: -       o query  terms, on the command line and in the hledger-web search form:+       o query terms, on the command line and in the hledger-web search  form:          REGEX, desc:REGEX, cur:REGEX, tag:...=REGEX         o CSV rules conditional blocks: if REGEX ... -       o account alias directives and options: alias  /REGEX/  =  REPLACEMENT,+       o account  alias  directives  and options: alias /REGEX/ = REPLACEMENT,          --alias /REGEX/=REPLACEMENT -       hledger's  regular  expressions  come  from the regex-tdfa library.  If-       they're not doing what you expect, it's important to know exactly  what+       hledger's regular expressions come from  the  regex-tdfa  library.   If+       they're  not doing what you expect, it's important to know exactly what        they support:         1. they are case insensitive -       2. they  are infix matching (they do not need to match the entire thing+       2. they are infix matching (they do not need to match the entire  thing           being matched)         3. they are POSIX ERE (extended regular expressions)         4. they also support GNU word boundaries (\b, \B, \<, \>) -       5. they do not support backreferences; if you write \1, it  will  match-          the  digit  1.   Except  when  doing text replacement, eg in account-          aliases, where backreferences can be used in the replacement  string+       5. they  do  not support backreferences; if you write \1, it will match+          the digit 1.  Except when doing  text  replacement,  eg  in  account+          aliases,  where backreferences can be used in the replacement string           to reference capturing groups in the search regexp. -       6. they  do  not  support mode modifiers ((?s)), character classes (\w,+       6. they do not support mode modifiers ((?s)),  character  classes  (\w,           \d), or anything else not mentioned above.         Some things to note: -       o In the alias directive and --alias option, regular  expressions  must-         be  enclosed  in  forward  slashes  (/REGEX/).  Elsewhere in hledger,+       o In  the  alias directive and --alias option, regular expressions must+         be enclosed in forward  slashes  (/REGEX/).   Elsewhere  in  hledger,          these are not required. -       o In queries, to match a regular expression metacharacter like $  as  a-         literal  character,  prepend  a  backslash.  Eg to search for amounts+       o In  queries,  to match a regular expression metacharacter like $ as a+         literal character, prepend a backslash.  Eg  to  search  for  amounts          with the dollar sign in hledger-web, write cur:\$. -       o On the command line, some metacharacters like $ have a special  mean-+       o On  the command line, some metacharacters like $ have a special mean-          ing to the shell and so must be escaped at least once more.  See Spe-          cial characters.     Smart dates        hledger's user interfaces accept a flexible "smart date" syntax (unlike-       dates  in the journal file).  Smart dates allow some english words, can-       be relative to today's date, and can have less-significant  date  parts+       dates in the journal file).  Smart dates allow some english words,  can+       be  relative  to today's date, and can have less-significant date parts        omitted (defaulting to 1).         Examples: -       2004/10/1,   2004-01-01,   exact date, several separators allowed.   Year+       2004/10/1,   2004-01-01,   exact  date, several separators allowed.  Year        2004.9.1                   is 4+ digits, month is 1-12, day is 1-31        2004                       start of year        2004/10                    start of month@@ -955,48 +984,48 @@        20181201                   8 digit YYYYMMDD with valid year month and day        201812                     6 digit YYYYMM with valid year and month -       Counterexamples - malformed digit sequences might give  surprising  re-+       Counterexamples  -  malformed digit sequences might give surprising re-        sults: -       201813        6  digits  with  an  invalid  month  is  parsed as start of+       201813        6 digits with an  invalid  month  is  parsed  as  start  of                      6-digit year-       20181301      8 digits with an  invalid  month  is  parsed  as  start  of+       20181301      8  digits  with  an  invalid  month  is  parsed as start of                      8-digit year        20181232      8 digits with an invalid day gives an error        201801012     9+ digits beginning with a valid YYYYMMDD gives an error     Report start & end date-       Most  hledger  reports  show  the  full span of time represented by the+       Most hledger reports show the full span  of  time  represented  by  the        journal data, by default.  So, the effective report start and end dates-       will  be  the earliest and latest transaction or posting dates found in+       will be the earliest and latest transaction or posting dates  found  in        the journal. -       Often you will want to see a shorter time span,  such  as  the  current-       month.   You  can  specify  a  start  and/or end date using -b/--begin,+       Often  you  will  want  to see a shorter time span, such as the current+       month.  You can specify a  start  and/or  end  date  using  -b/--begin,        -e/--end, -p/--period or a date: query (described below).  All of these        accept the smart date syntax.         Some notes: -       o As  in Ledger, end dates are exclusive, so you need to write the date+       o As in Ledger, end dates are exclusive, so you need to write the  date          after the last day you want to include. -       o As noted in reporting options: among start/end dates  specified  with+       o As  noted  in reporting options: among start/end dates specified with          options, the last (i.e.  right-most) option takes precedence. -       o The  effective report start and end dates are the intersection of the-         start/end dates from options and that from date: queries.   That  is,-         date:2019-01  date:2019  -p'2000  to  2030'  yields January 2019, the+       o The effective report start and end dates are the intersection of  the+         start/end  dates  from options and that from date: queries.  That is,+         date:2019-01 date:2019 -p'2000 to  2030'  yields  January  2019,  the          smallest common time span.         Examples:         -b 2016/3/17       begin on St. Patrick's day 2016-       -e 12/1            end at the start of  december  1st  of  the  current  year+       -e 12/1            end  at  the  start  of  december  1st of the current year                           (11/30 will be the last date included)        -b thismonth       all transactions on or after the 1st of the current month        -p thismonth       all transactions in the current month-       date:2016/3/17..   the above written as queries instead (.. can also  be  re-+       date:2016/3/17..   the  above  written as queries instead (.. can also be re-                           placed with -)        date:..12/1        date:thismonth..@@ -1004,31 +1033,31 @@     Report intervals        A report interval can be specified so that commands like register, bal--       ance and activity will divide their reports into  multiple  subperiods.-       The   basic   intervals   can  be  selected  with  one  of  -D/--daily,-       -W/--weekly, -M/--monthly, -Q/--quarterly, or -Y/--yearly.   More  com--       plex  intervals  may be specified with a period expression.  Report in-+       ance  and  activity will divide their reports into multiple subperiods.+       The  basic  intervals  can  be  selected  with   one   of   -D/--daily,+       -W/--weekly,  -M/--monthly,  -Q/--quarterly, or -Y/--yearly.  More com-+       plex intervals may be specified with a period expression.   Report  in-        tervals can not be specified with a query.     Period expressions-       The -p/--period option accepts period expressions, a shorthand  way  of+       The  -p/--period  option accepts period expressions, a shorthand way of        expressing a start date, end date, and/or report interval all at once. -       Here's  a basic period expression specifying the first quarter of 2009.-       Note, hledger always treats start dates as inclusive and end  dates  as+       Here's a basic period expression specifying the first quarter of  2009.+       Note,  hledger  always treats start dates as inclusive and end dates as        exclusive:         -p "from 2009/1/1 to 2009/4/1" -       Keywords  like  "from" and "to" are optional, and so are the spaces, as-       long as you don't run two dates together.  "to" can also be written  as+       Keywords like "from" and "to" are optional, and so are the  spaces,  as+       long  as you don't run two dates together.  "to" can also be written as        ".." or "-".  These are equivalent to the above:         -p "2009/1/1 2009/4/1"        -p2009/1/1to2009/4/1        -p2009/1/1..2009/4/1 -       Dates  are  smart  dates, so if the current year is 2009, the above can+       Dates are smart dates, so if the current year is 2009,  the  above  can        also be written as:         -p "1/1 4/1"@@ -1042,20 +1071,29 @@                             1, 2009        -p "from 2009/1"     the same        -p "from 2009"       the same-       -p "to 2009"         everything before  january++       -p "to 2009"         everything  before january                             1, 2009 -       A  single  date  with  no "from" or "to" defines both the start and end+       A single date with no "from" or "to" defines both  the  start  and  end        date like so: -       -p "2009"       the year 2009;  equivalent+       -p "2009"       the  year 2009; equivalent                        to "2009/1/1 to 2010/1/1"-       -p "2009/1"     the  month of jan; equiva-+       -p "2009/1"     the month of jan;  equiva-                        lent   to   "2009/1/1   to                        2009/2/1"-       -p "2009/1/1"   just  that day; equivalent+       -p "2009/1/1"   just that day;  equivalent                        to "2009/1/1 to 2009/1/2" +       Or you can specify a single quarter like so:++       -p "2009Q1"   first   quarter  of  2009,+                     equivalent to "2009/1/1 to+                     2009/4/1"+       -p "q4"       fourth quarter of the cur-+                     rent year+        The argument of -p can also begin with, or be, a  report  interval  ex-        pression.  The basic report intervals are daily, weekly, monthly, quar-        terly, or yearly, which have the same effect as the -D,-W,-M,-Q, or  -Y@@ -1075,8 +1113,6 @@         -p  "weekly from 2009/1/1   starts on 2008/12/29, closest preceding Mon-        to 2009/4/1"                day--        -p       "monthly      in   starts on 2018/11/01        2008/11/25"        -p    "quarterly     from   starts  on  2009/04/01,  ends on 2009/06/30,@@ -1085,8 +1121,8 @@        2009-12-29"         The  following  more  complex  report intervals are also supported: bi--       weekly,   bimonthly,   every   day|week|month|quarter|year,   every   N-       days|weeks|months|quarters|years.+       weekly, fortnightly, bimonthly, every day|week|month|quarter|year,  ev-+       ery N days|weeks|months|quarters|years.         All  of  these  will start on the first day of the requested period and        end on the last one, as described above.@@ -1526,6 +1562,7 @@        tal/average    of displayed   of displayed   of  displayed   of displayed   of  displayed                       values         values         values          values         values +        balance (bs,        bse,     cf,        is..)@@ -1652,24 +1689,25 @@     add        add-       Prompt for transactions and add them to the journal.+       Prompt for transactions and add them to  the  journal.   Any  arguments+       will be used as default inputs for the first N prompts. -       Many hledger users edit their journals directly with a text editor,  or-       generate  them from CSV.  For more interactive data entry, there is the-       add command, which prompts interactively on the console for new  trans-+       Many  hledger users edit their journals directly with a text editor, or+       generate them from CSV.  For more interactive data entry, there is  the+       add  command, which prompts interactively on the console for new trans-        actions, and appends them to the journal file (if there are multiple -f-       FILE options, the first file is used.) Existing  transactions  are  not-       changed.   This  is the only hledger command that writes to the journal+       FILE  options,  the  first file is used.) Existing transactions are not+       changed.  This is the only hledger command that writes to  the  journal        file.         To use it, just run hledger add and follow the prompts.  You can add as-       many  transactions as you like; when you are finished, enter . or press+       many transactions as you like; when you are finished, enter . or  press        control-d or control-c to exit.         Features: -       o add tries to provide useful defaults, using the most similar (by  de--         scription)  recent  transaction  (filtered by the query, if any) as a+       o add  tries to provide useful defaults, using the most similar (by de-+         scription) recent transaction (filtered by the query, if  any)  as  a          template.         o You can also set the initial defaults with command line arguments.@@ -1677,10 +1715,10 @@        o Readline-style edit keys can be used during data entry.         o The tab key will auto-complete whenever possible - accounts, descrip--         tions,  dates  (yesterday,  today,  tomorrow).   If the input area is+         tions, dates (yesterday, today, tomorrow).   If  the  input  area  is          empty, it will insert the default value. -       o If the journal defines a default commodity, it will be added  to  any+       o If  the  journal defines a default commodity, it will be added to any          bare numbers entered.         o A parenthesised transaction code may be entered following a date.@@ -1689,7 +1727,7 @@         o If you make a mistake, enter < at any prompt to go one step backward. -       o Input  prompts  are displayed in a different colour when the terminal+       o Input prompts are displayed in a different colour when  the  terminal          supports it.         Example (see the tutorial for a detailed explanation):@@ -1719,10 +1757,71 @@               Starting the next transaction (. or ctrl-D/ctrl-C to quit)               Date [2015/05/22]: <CTRL-D> $ -       On Microsoft Windows, the add command makes sure that no  part  of  the-       file  path  ends with a period, as it can cause data loss on that plat--       form (cf #1056).+       On  Microsoft  Windows,  the add command makes sure that no part of the+       file path ends with a period, as that would cause problems (#1056). +   aregister+       aregister, areg+       Show transactions affecting a particular  account,  and  the  account's+       running balance.++       aregister  shows  the  transactions affecting a particular account (and+       its subaccounts), from the point of view of that  account.   Each  line+       shows:++       o the transaction's (or posting's, see below) date++       o the names of the other account(s) involved++       o the net change to this account's balance++       o the  account's  historical  running  balance  (including balance from+         transactions before the report start date).++       With aregister, each line  represents  a  whole  transaction  -  as  in+       hledger-ui,  hledger-web,  and  your  bank statement.  By contrast, the+       register command shows individual postings, across all  accounts.   You+       might  prefer aregister for reconciling with real-world asset/liability+       accounts, and register for reviewing detailed revenues/expenses.++       An account must be specified as the first argument, which should be the+       full  account name or an account pattern (regular expression).  aregis-+       ter will show transactions in this account (the first one matched)  and+       any of its subaccounts.++       Any  additional  arguments  form a query which will filter the transac-+       tions shown.++       Transactions making a net change of zero are not shown by default;  add+       the -E/--empty flag to show them.++   aregister and custom posting dates+       Transactions  whose  date  is  outside  the  report period can still be+       shown, if they have a posting to this account dated inside  the  report+       period.   (And  in this case it's the posting date that is shown.) This+       ensures that aregister can show an accurate historical running balance,+       matching the one shown by register -H with the same arguments.++       To  filter  strictly  by  transaction date instead, add the --txn-dates+       flag.  If you use this flag and  some  of  your  postings  have  custom+       dates, it's probably best to assume the running balance is wrong.++   Output format+       This command also supports the output destination and output format op-+       tions The output formats supported are txt, csv, and json.++       Examples:++       Show all transactions and historical running balance in the  first  ac-+       count whose name contains "checking":++              $ hledger areg checking++       Show  transactions and historical running balance in all asset accounts+       during july:++              $ hledger areg assets date:jul+    balance        balance, bal, b        Show accounts and their balances.@@ -1770,7 +1869,7 @@        By default, accounts are displayed hierarchically, with subaccounts in-        dented below their parent.  At each level of  the  tree,  accounts  are        sorted  by  account  code  if  any,  then  by  account  name.   Or with-       -S/--sort-amount, by their balance amount.+       -S/--sort-amount, by their balance amount, largest first.         "Boring" accounts, which contain a single interesting subaccount and no        balance  of their own, are elided into the following line for more com-@@ -1856,16 +1955,13 @@          single-column balance report     Colour support-       The balance command shows negative amounts in red, if:--       o the TERM environment variable is not set to dumb--       o the output is not being redirected or piped anywhere+       In  terminal  output, when colour is enabled, the balance command shows+       negative amounts in red.     Flat mode-       To  see  a  flat  list instead of the default hierarchical display, use-       --flat.  In this mode, accounts (unless depth-clipped) show their  full-       names  and  "exclusive" balance, excluding any subaccount balances.  In+       To see a flat list instead of the  default  hierarchical  display,  use+       --flat.   In this mode, accounts (unless depth-clipped) show their full+       names and "exclusive" balance, excluding any subaccount  balances.   In        this mode, you can also use --drop N to omit the first few account name        components. @@ -1874,8 +1970,8 @@                                 $1  supplies     Depth limited balance reports-       With  --depth  N  or  depth:N or just -N, balance reports show accounts-       only to the specified numeric depth.  This is very useful to  summarise+       With --depth N or depth:N or just -N,  balance  reports  show  accounts+       only  to the specified numeric depth.  This is very useful to summarise        a complex set of accounts and get an overview.                $ hledger balance -N -1@@ -1888,9 +1984,9 @@        inclusive balances at the depth limit.     Percentages-       With -% or --percent, balance reports show  each  account's  value  ex--       pressed  as  a percentage of the column's total.  This is useful to get-       an overview of the relative sizes of account balances.  For example  to+       With  -%  or  --percent,  balance reports show each account's value ex-+       pressed as a percentage of the column's total.  This is useful  to  get+       an  overview of the relative sizes of account balances.  For example to        obtain an overview of expenses:                $ hledger balance expenses -%@@ -1900,32 +1996,32 @@               --------------------                            100.0 % -       Note  that  --tree  does not have an effect on -%.  The percentages are-       always relative to the total sum of each column, they are  never  rela-+       Note that --tree does not have an effect on -%.   The  percentages  are+       always  relative  to the total sum of each column, they are never rela-        tive to the parent account. -       Since  the  percentages  are relative to the columns sum, it is usually-       not useful to calculate percentages if the signs  of  the  amounts  are-       mixed.   Although  the  results  are technically correct, they are most-       likely useless.  Especially in a balance report that sums  up  to  zero+       Since the percentages are relative to the columns sum,  it  is  usually+       not  useful  to  calculate  percentages if the signs of the amounts are+       mixed.  Although the results are technically  correct,  they  are  most+       likely  useless.   Especially  in a balance report that sums up to zero        (eg hledger balance -B) all percentage values will be zero. -       This  flag does not work if the report contains any mixed commodity ac-+       This flag does not work if the report contains any mixed commodity  ac-        counts.  If there are mixed commodity accounts in the report be sure to        use -V or -B to coerce the report into using a single commodity.     Multicolumn balance report-       Multicolumn  or  tabular balance reports are a very useful hledger fea--       ture, and usually the preferred style.  They share many  of  the  above-       features,  but they show the report as a table, with columns represent--       ing time periods.  This mode is activated by providing a reporting  in-+       Multicolumn or tabular balance reports are a very useful  hledger  fea-+       ture,  and  usually  the preferred style.  They share many of the above+       features, but they show the report as a table, with columns  represent-+       ing  time periods.  This mode is activated by providing a reporting in-        terval. -       There  are three types of multicolumn balance report, showing different+       There are three types of multicolumn balance report, showing  different        information:         1. By default: each column shows the sum of postings in that period, ie-          the  account's  change of balance in that period.  This is useful eg+          the account's change of balance in that period.  This is  useful  eg           for a monthly income statement:                    $ hledger balance --quarterly income expenses -E@@ -1941,7 +2037,7 @@                                      ||     $-1      $1       0       0         2. With --cumulative: each column shows the ending balance for that pe--          riod,  accumulating  the  changes across periods, starting from 0 at+          riod, accumulating the changes across periods, starting  from  0  at           the report start date:                    $ hledger balance --quarterly income expenses -E --cumulative@@ -1957,8 +2053,8 @@                                      ||         $-1           0           0           0         3. With --historical/-H: each column shows the actual historical ending-          balance  for  that  period, accumulating the changes across periods,-          starting from the actual balance at the report start date.  This  is+          balance for that period, accumulating the  changes  across  periods,+          starting  from the actual balance at the report start date.  This is           useful eg for a multi-period balance sheet, and when you are showing           only the data after a certain start date: @@ -1977,26 +2073,26 @@        Note that --cumulative or --historical/-H disable --row-total/-T, since        summing end balances generally does not make sense. -       Multicolumn  balance  reports display accounts in flat mode by default;+       Multicolumn balance reports display accounts in flat mode  by  default;        to see the hierarchy, use --tree. -       With  a  reporting  interval  (like  --quarterly  above),  the   report-       start/end  dates  will  be adjusted if necessary so that they encompass+       With   a  reporting  interval  (like  --quarterly  above),  the  report+       start/end dates will be adjusted if necessary so  that  they  encompass        the displayed report periods.  This is so that the first and last peri-        ods will be "full" and comparable to the others. -       The  -E/--empty  flag  does  two things in multicolumn balance reports:+       The -E/--empty flag does two things  in  multicolumn  balance  reports:        first, the report will show all columns within the specified report pe--       riod  (without -E, leading and trailing columns with all zeroes are not-       shown).  Second, all accounts which existed at the  report  start  date-       will  be  considered, not just the ones with activity during the report-       period (use -E to include low-activity accounts which  would  otherwise+       riod (without -E, leading and trailing columns with all zeroes are  not+       shown).   Second,  all  accounts which existed at the report start date+       will be considered, not just the ones with activity during  the  report+       period  (use  -E to include low-activity accounts which would otherwise        would be omitted).         The -T/--row-total flag adds an additional column showing the total for        each row. -       The -A/--average flag adds a column showing the average value  in  each+       The  -A/--average  flag adds a column showing the average value in each        row.         Here's an example of all three:@@ -2017,21 +2113,27 @@                (Average is rounded to the dollar here since all journal amounts are) -       A  limitation  of multicolumn balance reports: eliding of boring parent-       accounts in tree mode, as in the classic balance  report,  is  not  yet-       supported.--       The  --transpose flag can be used to exchange the rows and columns of a+       The --transpose flag can be used to exchange the rows and columns of  a        multicolumn report. +       When  showing  multicommodity amounts, multicolumn balance reports will+       elide any amounts which have more than two commodities, since otherwise+       columns  could get very wide.  The --no-elide flag disables this.  Hid-+       ing totals with the -N/--no-total flag can also help reduce  the  width+       of multicommodity reports.++       When the report is still too wide, a good workaround is to pipe it into+       less -RS (-R for colour, -S to chop long lines).  Eg:  hledger  bal  -D+       --color=yes | less -RS.+    Budget report-       With --budget, extra columns are displayed  showing  budget  goals  for-       each  account and period, if any.  Budget goals are defined by periodic+       With  --budget,  extra  columns  are displayed showing budget goals for+       each account and period, if any.  Budget goals are defined by  periodic        transactions.  This is very useful for comparing planned and actual in--       come,  expenses, time usage, etc.  --budget is most often combined with+       come, expenses, time usage, etc.  --budget is most often combined  with        a report interval. -       For example, you can take average monthly expenses in  the  common  ex-+       For  example,  you  can take average monthly expenses in the common ex-        pense categories to construct a minimal monthly budget:                ;; Budget@@ -2078,26 +2180,26 @@         This is different from a normal balance report in several ways: -       o Only  accounts  with budget goals during the report period are shown,+       o Only accounts with budget goals during the report period  are  shown,          by default. -       o In each column, in square brackets after the  actual  amount,  budget-         goal  amounts are shown, and the actual/goal percentage.  (Note: bud-+       o In  each  column,  in square brackets after the actual amount, budget+         goal amounts are shown, and the actual/goal percentage.  (Note:  bud-          get goals should be in the same commodity as the actual amount.) -       o All parent accounts are always shown, even in flat mode.  Eg  assets,+       o All  parent accounts are always shown, even in flat mode.  Eg assets,          assets:bank, and expenses above. -       o Amounts  always include all subaccounts, budgeted or unbudgeted, even+       o Amounts always include all subaccounts, budgeted or unbudgeted,  even          in flat mode.         This means that the numbers displayed will not always add up! Eg above,-       the  expenses  actual  amount  includes the gifts and supplies transac--       tions, but the expenses:gifts and expenses:supplies  accounts  are  not+       the expenses actual amount includes the  gifts  and  supplies  transac-+       tions,  but  the  expenses:gifts and expenses:supplies accounts are not        shown, as they have no budget amounts declared. -       This  can  be confusing.  When you need to make things clearer, use the-       -E/--empty flag, which will reveal all  accounts  including  unbudgeted+       This can be confusing.  When you need to make things clearer,  use  the+       -E/--empty  flag,  which  will reveal all accounts including unbudgeted        ones, giving the full picture.  Eg:                $ hledger balance -M --budget --empty@@ -2139,12 +2241,12 @@        For more examples, see Budgeting and Forecasting.     Nested budgets-       You  can  add budgets to any account in your account hierarchy.  If you+       You can add budgets to any account in your account hierarchy.   If  you        have budgets on both parent account and some of its children, then bud--       get(s)  of  the  child account(s) would be added to the budget of their+       get(s) of the child account(s) would be added to the  budget  of  their        parent, much like account balances behave. -       In the most simple case this means that once you add a  budget  to  any+       In  the  most  simple case this means that once you add a budget to any        account, all its parents would have budget as well.         To illustrate this, consider the following budget:@@ -2154,13 +2256,13 @@                   expenses:personal:electronics    $100.00                   liabilities -       With  this,  monthly  budget  for electronics is defined to be $100 and-       budget for personal expenses is an additional $1000,  which  implicitly+       With this, monthly budget for electronics is defined  to  be  $100  and+       budget  for  personal expenses is an additional $1000, which implicitly        means that budget for both expenses:personal and expenses is $1100. -       Transactions  in expenses:personal:electronics will be counted both to-+       Transactions in expenses:personal:electronics will be counted both  to-        wards its $100 budget and $1100 of expenses:personal , and transactions-       in  any  other subaccount of expenses:personal would be counted towards+       in any other subaccount of expenses:personal would be  counted  towards        only towards the budget of expenses:personal.         For example, let's consider these transactions:@@ -2186,9 +2288,9 @@                   expenses:personal          $30.00                   liabilities -       As you can see, we  have  transactions  in  expenses:personal:electron--       ics:upgrades  and  expenses:personal:train  tickets,  and since both of-       these accounts are without explicitly defined  budget,  these  transac-+       As  you  can  see,  we have transactions in expenses:personal:electron-+       ics:upgrades and expenses:personal:train tickets,  and  since  both  of+       these  accounts  are  without explicitly defined budget, these transac-        tions would be counted towards budgets of expenses:personal:electronics        and expenses:personal accordingly: @@ -2204,7 +2306,7 @@               -------------------------------++-------------------------------                                              ||        0 [                 0] -       And with --empty, we can get a better picture of budget allocation  and+       And  with --empty, we can get a better picture of budget allocation and        consumption:                $ hledger balance --budget -M --empty@@ -2223,19 +2325,20 @@     Output format        This command also supports the output destination and output format op--       tions The output formats supported are txt, csv, (multicolumn  non-bud-+       tions  The output formats supported are txt, csv, (multicolumn non-bud-        get reports only) html, and (experimental) json.     balancesheet        balancesheet, bs-       This command displays a simple balance sheet, showing historical ending-       balances of asset and liability accounts  (ignoring  any  report  begin-       date).   It  assumes that these accounts are under a top-level asset or-       liability account (case insensitive, plural forms also allowed).+       This command displays a balance sheet, showing historical  ending  bal-+       ances of asset and liability accounts.  (To see equity as well, use the+       balancesheetequity command.) Amounts are  shown  with  normal  positive+       sign, as in conventional financial statements. -       Note this report shows all account balances with normal  positive  sign-       (like conventional financial statements, unlike balance/print/register)-       (experimental).+       The asset and liability accounts shown are those accounts declared with+       the Asset or Cash or Liability type, or otherwise all accounts under  a+       top-level  asset  or  liability  account (case insensitive, plurals al-+       lowed).         Example: @@ -2273,9 +2376,15 @@     balancesheetequity        balancesheetequity, bse-       Just  like  balancesheet,  but also reports Equity (which it assumes is-       under a top-level equity account).+       This  command  displays a balance sheet, showing historical ending bal-+       ances of asset, liability and equity accounts.  Amounts are shown  with+       normal positive sign, as in conventional financial statements. +       The  asset,  liability and equity accounts shown are those accounts de-+       clared with the Asset, Cash, Liability or Equity type, or otherwise all+       accounts under a top-level asset, liability or equity account (case in-+       sensitive, plurals allowed).+        Example:                $ hledger balancesheetequity@@ -2308,13 +2417,15 @@     cashflow        cashflow, cf-       This command displays a simple cashflow statement, showing  changes  in-       "cash"  accounts.  It assumes that these accounts are under a top-level-       asset account (case insensitive, plural forms also allowed) and do  not-       contain  receivable  or  A/R in their name.  Note this report shows all-       account balances with normal positive sign (like conventional financial-       statements, unlike balance/print/register) (experimental).+       This command displays a cashflow statement,  showing  the  inflows  and+       outflows  affecting "cash" (ie, liquid) assets.  Amounts are shown with+       normal positive sign, as in conventional financial statements. +       The "cash" accounts shown are those accounts  declared  with  the  Cash+       type,  or  otherwise all accounts under a top-level asset account (case+       insensitive, plural allowed) which do not have fixed,  investment,  re-+       ceivable or A/R in their name.+        Example:                $ hledger cashflow@@ -2452,16 +2563,60 @@                   liabilities:pending    5 = 0                   assets:checking +   codes+       codes+       List the codes seen in transactions, in the order parsed.++       This command prints the value of each transaction's code field, in  the+       order  transactions  were  parsed.  The transaction code is an optional+       value written in parentheses between the date  and  description,  often+       used to store a cheque number, order number or similar.++       Transactions aren't required to have a code, and missing or empty codes+       will not be shown by default.  With the -E/--empty flag, they  will  be+       printed as blank lines.++       You can add a query to select a subset of transactions.++       Examples:++              1/1 (123)+               (a)  1++              1/1 ()+               (a)  1++              1/1+               (a)  1++              1/1 (126)+               (a)  1++              $ hledger codes+              123+              124+              126++              $ hledger codes -E+              123+              124+++              126+    commodities        commodities        List all commodity/currency symbols used or declared in the journal.     descriptions-       descriptions Show descriptions.+       descriptions+       List the unique descriptions that appear in transactions. -       This command lists all descriptions that appear in transactions.+       This command lists the unique descriptions that appear in transactions,+       in alphabetic order.  You can add a query to select a subset of  trans-+       actions. -       Examples:+       Example:                $ hledger descriptions               Store Name@@ -2470,18 +2625,18 @@     diff        diff-       Compares a particular account's transactions in two  input  files.   It+       Compares  a  particular  account's transactions in two input files.  It        shows any transactions to this account which are in one file but not in        the other.         More precisely, for each posting affecting this account in either file,-       it  looks for a corresponding posting in the other file which posts the-       same amount to the same  account  (ignoring  date,  description,  etc.)+       it looks for a corresponding posting in the other file which posts  the+       same  amount  to  the  same  account (ignoring date, description, etc.)        Since postings not transactions are compared, this also works when mul-        tiple bank transactions have been combined into a single journal entry.         This is useful eg if you have downloaded an account's transactions from-       your  bank (eg as CSV data).  When hledger and your bank disagree about+       your bank (eg as CSV data).  When hledger and your bank disagree  about        the account balance, you can compare the bank data with your journal to        find out the cause. @@ -2499,20 +2654,20 @@     files        files-       List  all  files  included in the journal.  With a REGEX argument, only+       List all files included in the journal.  With a  REGEX  argument,  only        file names matching the regular expression (case sensitive) are shown.     help        help        Show any of the hledger manuals. -       The help command displays any of the main hledger manuals,  in  one  of-       several  ways.  Run it with no argument to list the manuals, or provide+       The  help  command  displays any of the main hledger manuals, in one of+       several ways.  Run it with no argument to list the manuals, or  provide        a full or partial manual name to select one. -       hledger manuals are available in several formats.   hledger  help  will-       use  the  first  of  these  display  methods  that it finds: info, man,-       $PAGER, less, stdout (or when non-interactive, just stdout).   You  can+       hledger  manuals  are  available in several formats.  hledger help will+       use the first of these  display  methods  that  it  finds:  info,  man,+       $PAGER,  less,  stdout (or when non-interactive, just stdout).  You can        force a particular viewer with the --info, --man, --pager, --cat flags.         Examples:@@ -2539,9 +2694,9 @@     import        import-       Read  new  transactions added to each FILE since last run, and add them-       to the main journal file.  Or with --dry-run, just print  the  transac--       tions  that  would  be  added.  Or with --catchup, just mark all of the+       Read new transactions added to each FILE since last run, and  add  them+       to  the  main journal file.  Or with --dry-run, just print the transac-+       tions that would be added.  Or with --catchup, just  mark  all  of  the        FILEs' transactions as imported, without actually importing any.         The input files are specified as arguments - no need to write -f before@@ -2552,38 +2707,38 @@        ing transactions are always added to the input files in increasing date        order, and by saving .latest.FILE state files. -       The --dry-run output is in journal format, so you can filter it, eg  to+       The  --dry-run output is in journal format, so you can filter it, eg to        see only uncategorised transactions:                $ hledger import --dry ... | hledger -f- print unknown --ignore-assertions     Importing balance assignments-       Entries  added  by import will have their posting amounts made explicit-       (like hledger print -x).  This means that any  balance  assignments  in-       imported  files must be evaluated; but, imported files don't get to see-       the main file's account balances.  As a result, importing entries  with+       Entries added by import will have their posting amounts  made  explicit+       (like  hledger  print  -x).  This means that any balance assignments in+       imported files must be evaluated; but, imported files don't get to  see+       the  main file's account balances.  As a result, importing entries with        balance assignments (eg from an institution that provides only balances-       and not posting  amounts)  will  probably  generate  incorrect  posting+       and  not  posting  amounts)  will  probably  generate incorrect posting        amounts.  To avoid this problem, use print instead of import:                $ hledger print IMPORTFILE [--new] >> $LEDGER_FILE -       (If  you  think  import  should leave amounts implicit like print does,+       (If you think import should leave amounts  implicit  like  print  does,        please test it and send a pull request.)     incomestatement        incomestatement, is-       This command displays a simple income statement, showing  revenues  and-       expenses  during  a period.  It assumes that these accounts are under a-       top-level revenue or income or expense account (case insensitive,  plu--       ral  forms  also allowed).  Note this report shows all account balances-       with normal positive sign (like conventional financial statements,  un--       like balance/print/register) (experimental).+       This  command  displays  an  income statement, showing revenues and ex-+       penses during one or more periods.  Amounts are shown with normal posi-+       tive sign, as in conventional financial statements. -       This  command displays a simple income statement.  It currently assumes-       that you have top-level accounts named income (or revenue) and  expense-       (plural forms also allowed.)+       The revenue and expense accounts shown are those accounts declared with+       the Revenue or Expense type, or otherwise all  accounts  under  a  top-+       level  revenue  or income or expense account (case insensitive, plurals+       allowed). +       Example:+               $ hledger incomestatement               Income Statement @@ -2606,32 +2761,40 @@                                  0         With a reporting interval, multiple columns will be shown, one for each-       report period.  Normally incomestatement  shows  revenues/expenses  per-       period,  though  as  with multicolumn balance reports you can alter the-       report mode with --change/--cumulative/--historical.  Instead of  abso-+       report  period.   Normally  incomestatement shows revenues/expenses per+       period, though as with multicolumn balance reports you  can  alter  the+       report  mode with --change/--cumulative/--historical.  Instead of abso-        lute values percentages can be displayed with -%.         This command also supports the output destination and output format op--       tions The output formats supported are txt, csv, html, and  (experimen-+       tions  The output formats supported are txt, csv, html, and (experimen-        tal) json.     notes-       notes Show notes.+       notes+       List the unique notes that appear in transactions. -       This command lists all notes that appear in transactions.+       This command lists the unique notes that appear in transactions, in al-+       phabetic  order.   You  can  add a query to select a subset of transac-+       tions.  The note is the part of the transaction description after  a  |+       character (or if there is no |, the whole description). -       Examples:+       Example:                $ hledger notes               Petrol               Snacks     payees-       payees Show payee names.+       payees+       List the unique payee/payer names that appear in transactions. -       This command lists all payee names that appear in transactions.+       This command lists the unique payee/payer names that appear in transac-+       tions, in alphabetic order.  You can add a query to select a subset  of+       transactions.   The payee/payer is the part of the transaction descrip-+       tion before a | character (or if there is no |, the whole description). -       Examples:+       Example:                $ hledger payees               Store Name@@ -2640,10 +2803,10 @@     prices        prices-       Print  market  price  directives  from the journal.  With --costs, also-       print synthetic market prices based on transaction prices.  With  --in--       verted-costs,  also  print  inverse prices based on transaction prices.-       Prices (and postings providing prices) can  be  filtered  by  a  query.+       Print market price directives from the  journal.   With  --costs,  also+       print  synthetic market prices based on transaction prices.  With --in-+       verted-costs, also print inverse prices based  on  transaction  prices.+       Prices  (and  postings  providing  prices)  can be filtered by a query.        Price amounts are always displayed with their full precision.     print@@ -2651,11 +2814,11 @@        Show transaction journal entries, sorted by date.         The print command displays full journal entries (transactions) from the-       journal file in date order, tidily formatted.  With  --date2,  transac-+       journal  file  in date order, tidily formatted.  With --date2, transac-        tions are sorted by secondary date instead.         print's output is always a valid hledger journal.-       It  preserves all transaction information, but it does not preserve di-+       It preserves all transaction information, but it does not preserve  di-        rectives or inter-transaction comments                $ hledger print@@ -2682,44 +2845,44 @@         Normally, the journal entry's explicit or implicit amount style is pre-        served.  For example, when an amount is omitted in the journal, it will-       not appear in the output.  Similarly, when a transaction price  is  im--       plied  but  not written, it will not appear in the output.  You can use-       the -x/--explicit flag to make all amounts and transaction  prices  ex--       plicit,  which  can  be  useful  for troubleshooting or for making your+       not  appear  in the output.  Similarly, when a transaction price is im-+       plied but not written, it will not appear in the output.  You  can  use+       the  -x/--explicit  flag to make all amounts and transaction prices ex-+       plicit, which can be useful for  troubleshooting  or  for  making  your        journal more readable and robust against data entry errors.  -x is also        implied by using any of -B,-V,-X,--value. -       Note,  -x/--explicit  will cause postings with a multi-commodity amount-       (these can arise when a multi-commodity  transaction  has  an  implicit-       amount)  to  be  split into multiple single-commodity postings, keeping+       Note, -x/--explicit will cause postings with a  multi-commodity  amount+       (these  can  arise  when  a multi-commodity transaction has an implicit+       amount) to be split into multiple  single-commodity  postings,  keeping        the output parseable. -       With -B/--cost, amounts with transaction prices are converted  to  cost+       With  -B/--cost,  amounts with transaction prices are converted to cost        using that price.  This can be used for troubleshooting. -       With  -m/--match and a STR argument, print will show at most one trans--       action: the one one whose description is most similar to  STR,  and  is-       most  recent.  STR should contain at least two characters.  If there is+       With -m/--match and a STR argument, print will show at most one  trans-+       action:  the  one  one whose description is most similar to STR, and is+       most recent.  STR should contain at least two characters.  If there  is        no similar-enough match, no transaction will be shown.         With --new, for each FILE being read, hledger reads (and writes) a spe--       cial  state  file  (.latest.FILE in the same directory), containing the-       latest transaction date(s) that were seen  last  time  FILE  was  read.-       When  this  file  is found, only transactions with newer dates (and new-       transactions on the latest date) are printed.  This is useful  for  ig--       noring  already-seen  entries  in  import  data, such as downloaded CSV+       cial state file (.latest.FILE in the same  directory),  containing  the+       latest  transaction  date(s)  that  were  seen last time FILE was read.+       When this file is found, only transactions with newer  dates  (and  new+       transactions  on  the latest date) are printed.  This is useful for ig-+       noring already-seen entries in import  data,  such  as  downloaded  CSV        files.  Eg:                $ hledger -f bank1.csv print --new               (shows transactions added since last print --new on this file) -       This assumes that transactions added to FILE always have  same  or  in--       creasing  dates,  and  that transactions on the same day do not get re-+       This  assumes  that  transactions added to FILE always have same or in-+       creasing dates, and that transactions on the same day do  not  get  re-        ordered.  See also the import command.         This command also supports the output destination and output format op--       tions  The  output  formats  supported are txt, csv, and (experimental)-       json.+       tions The output formats supported are  txt,  csv,  and  (experimental)+       json and sql.         Here's an example of print's CSV output: @@ -2737,20 +2900,20 @@               "5","2008/12/31","","*","","pay off","","liabilities:debts","1","$","","1","",""               "5","2008/12/31","","*","","pay off","","assets:bank:checking","-1","$","1","","","" -       o There is one CSV record per posting, with  the  parent  transaction's+       o There  is  one  CSV record per posting, with the parent transaction's          fields repeated.         o The "txnidx" (transaction index) field shows which postings belong to-         the same transaction.  (This number might change if transactions  are-         reordered  within  the file, files are parsed/included in a different+         the  same transaction.  (This number might change if transactions are+         reordered within the file, files are parsed/included in  a  different          order, etc.) -       o The amount is separated into "commodity" (the  symbol)  and  "amount"+       o The  amount  is  separated into "commodity" (the symbol) and "amount"          (numeric quantity) fields.         o The numeric amount is repeated in either the "credit" or "debit" col--         umn, for convenience.  (Those names are not accurate in the  account--         ing  sense;  it  just  puts negative amounts under credit and zero or+         umn,  for convenience.  (Those names are not accurate in the account-+         ing sense; it just puts negative amounts under  credit  and  zero  or          greater amounts under debit.)     print-unique@@ -2773,10 +2936,17 @@        register, reg, r        Show postings and their running total. -       The register command displays postings in date order, one per line, and-       their  running  total.  This is typically used with a query selecting a-       particular account, to see that account's activity:+       The register command displays matched postings, across all accounts, in+       date order, with their running total  or  running  historical  balance.+       (See  also the aregister command, which shows matched transactions in a+       specific account.) +       register normally shows line per posting, but note that multi-commodity+       amounts will occupy multiple lines (one line per commodity).++       It  is  typically  used with a query selecting a particular account, to+       see that account's activity:+               $ hledger register checking               2008/01/01 income               assets:bank:checking            $1           $1               2008/06/01 gift                 assets:bank:checking            $1           $2@@ -3060,23 +3230,30 @@     tags        tags-       List all the tag names used in the journal.  With a TAGREGEX  argument,-       only  tag  names matching the regular expression (case insensitive) are-       shown.  With QUERY arguments, only transactions matching the query  are-       considered.  With --values flag, the tags' unique values are listed in--       stead.+       List the unique tag names used in the journal.  With a  TAGREGEX  argu-+       ment, only tag names matching the regular expression (case insensitive)+       are shown.  With QUERY arguments, only transactions matching the  query+       are considered. +       With the --values flag, the tags' unique values are listed instead.++       With  --parsed flag, all tags or values are shown in the order they are+       parsed from the input data, including duplicates.++       With -E/--empty, any blank/empty values will also be  shown,  otherwise+       they are omitted.+    test        test        Run built-in unit tests. -       This command runs the unit tests built in to hledger  and  hledger-lib,-       printing  the results on stdout.  If any test fails, the exit code will+       This  command  runs the unit tests built in to hledger and hledger-lib,+       printing the results on stdout.  If any test fails, the exit code  will        be non-zero. -       This is mainly used by hledger developers, but you can also use  it  to-       sanity-check  the  installed  hledger executable on your platform.  All-       tests are expected to pass - if you ever see a failure,  please  report+       This  is  mainly used by hledger developers, but you can also use it to+       sanity-check the installed hledger executable on  your  platform.   All+       tests  are  expected to pass - if you ever see a failure, please report        as a bug!         This command also accepts tasty test runner options, written after a --@@ -3085,35 +3262,35 @@                $ hledger test -- -pData.Amount --color=never -       For  help  on these, see https://github.com/feuerbach/tasty#options (--+       For help on these, see  https://github.com/feuerbach/tasty#options  (--        --help currently doesn't show them).     Add-on commands-       hledger also searches for external add-on commands,  and  will  include+       hledger  also  searches  for external add-on commands, and will include        these in the commands list.  These are programs or scripts in your PATH-       whose name starts with hledger- and ends with a recognised file  exten-+       whose  name starts with hledger- and ends with a recognised file exten-        sion (currently: no extension, bat,com,exe, hs,lhs,pl,py,rb,rkt,sh). -       Add-ons  can  be  invoked like any hledger command, but there are a few+       Add-ons can be invoked like any hledger command, but there  are  a  few        things to be aware of.  Eg if the hledger-web add-on is installed, -       o hledger -h web shows hledger's  help,  while  hledger  web  -h  shows+       o hledger  -h  web  shows  hledger's  help,  while hledger web -h shows          hledger-web's help. -       o Flags  specific  to  the add-on must have a preceding -- to hide them-         from hledger.  So hledger web --serve --port 9000 will  be  rejected;+       o Flags specific to the add-on must have a preceding --  to  hide  them+         from  hledger.   So hledger web --serve --port 9000 will be rejected;          you must use hledger web -- --serve --port 9000.         o You can always run add-ons directly if preferred: hledger-web --serve          --port 9000. -       Add-ons are a relatively easy way to add local features  or  experiment-       with  new  ideas.   They  can  be  written in any language, but haskell-       scripts have a big advantage:  they  can  use  the  same  hledger  (and-       haskell)  library functions that built-in commands do, for command-line+       Add-ons  are  a relatively easy way to add local features or experiment+       with new ideas.  They can be  written  in  any  language,  but  haskell+       scripts  have  a  big  advantage:  they  can  use the same hledger (and+       haskell) library functions that built-in commands do, for  command-line        options, journal parsing, reporting, etc. -       Two important add-ons are the hledger-ui and  hledger-web  user  inter-+       Two  important  add-ons  are the hledger-ui and hledger-web user inter-        faces.  These are maintained and released along with hledger:     ui@@ -3132,13 +3309,10 @@        hledger-interest generates interest transactions for an account accord-        ing to various schemes. -       A  few  more experimental or old add-ons can be found in hledger's bin/+       A few more experimental or old add-ons can be found in  hledger's  bin/        directory.  These are typically prototypes and not guaranteed to work.  ENVIRONMENT-       COLUMNS The screen width used by the register  command.   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-        nal).@@ -3158,14 +3332,21 @@         To see the effect you may need to killall Dock, or reboot. +       COLUMNS The screen width used by the register  command.   Default:  the+       full terminal width.++       NO_COLOR  If  this variable exists with any value, hledger will not use+       ANSI  color   codes   in   terminal   output.    This   overrides   the+       --color/--colour option.+ 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).  LIMITATIONS-       The  need  to  precede  addon command options with -- when invoked from+       The need to precede addon command options with  --  when  invoked  from        hledger is awkward.         When input data contains non-ascii characters, a suitable system locale@@ -3181,36 +3362,36 @@        In a Cygwin/MSYS/Mintty window, the tab key is not supported in hledger        add. -       Not  all of Ledger's journal file syntax is supported.  See file format+       Not all of Ledger's journal file syntax is supported.  See file  format        differences. -       On large data files, hledger  is  slower  and  uses  more  memory  than+       On  large  data  files,  hledger  is  slower  and uses more memory than        Ledger.  TROUBLESHOOTING-       Here  are some issues you might encounter when you run hledger (and re--       member you can also seek help from the IRC channel, mail  list  or  bug+       Here are some issues you might encounter when you run hledger (and  re-+       member  you  can  also seek help from the IRC channel, mail list or bug        tracker):         Successfully installed, but "No command 'hledger' found"        stack and cabal install binaries into a special directory, which should-       be added to your PATH environment variable.  Eg on  unix-like  systems,+       be  added  to your PATH environment variable.  Eg on unix-like systems,        that is ~/.local/bin and ~/.cabal/bin respectively.         I set a custom LEDGER_FILE, but hledger is still using the default file-       LEDGER_FILE  should  be  a  real environment variable, not just a shell-       variable.  The command env | grep LEDGER_FILE should show it.  You  may+       LEDGER_FILE should be a real environment variable,  not  just  a  shell+       variable.   The command env | grep LEDGER_FILE should show it.  You may        need to use export.  Here's an explanation. -       Getting  errors  like "Illegal byte sequence" or "Invalid or incomplete-       multibyte or wide character" or "commitAndReleaseBuffer: invalid  argu-+       Getting errors like "Illegal byte sequence" or "Invalid  or  incomplete+       multibyte  or wide character" or "commitAndReleaseBuffer: invalid argu-        ment (invalid character)"        Programs compiled with GHC (hledger, haskell build tools, etc.) need to        have a UTF-8-aware locale configured in the environment, otherwise they-       will  fail  with  these  kinds  of errors when they encounter non-ascii+       will fail with these kinds of  errors  when  they  encounter  non-ascii        characters. -       To fix it, set the LANG environment variable to some locale which  sup-+       To  fix it, set the LANG environment variable to some locale which sup-        ports UTF-8.  The locale you choose must be installed on your system.         Here's an example of setting LANG temporarily, on Ubuntu GNU/Linux:@@ -3225,8 +3406,8 @@               POSIX               $ LANG=en_US.utf8 hledger -f my.journal print   # ensure it is used for this command -       If  available,  C.UTF-8 will also work.  If your preferred locale isn't-       listed by locale -a, you might need to install it.   Eg  on  Ubuntu/De-+       If available, C.UTF-8 will also work.  If your preferred  locale  isn't+       listed  by  locale  -a, you might need to install it.  Eg on Ubuntu/De-        bian:                $ apt-get install language-pack-fr@@ -3246,8 +3427,8 @@               $ echo "export LANG=en_US.utf8" >>~/.bash_profile               $ bash --login -       Exact  spelling  and capitalisation may be important.  Note the differ--       ence on MacOS (UTF-8, not utf8).   Some  platforms  (eg  ubuntu)  allow+       Exact spelling and capitalisation may be important.  Note  the  differ-+       ence  on  MacOS  (UTF-8,  not  utf8).  Some platforms (eg ubuntu) allow        variant spellings, but others (eg macos) require it to be exact:                $ locale -a | grep -iE en_us.*utf@@ -3257,7 +3438,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)  @@ -3271,7 +3452,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) @@ -3279,4 +3460,4 @@   -hledger 1.18.1                     June 2020                        hledger(1)+hledger 1.18.99                 September 2020                      hledger(1)
embeddedfiles/hledger_csv.5 view
@@ -1,6 +1,6 @@ .\"t -.TH "hledger_csv" "5" "June 2020" "hledger 1.18.1" "hledger User Manuals"+.TH "hledger_csv" "5" "September 2020" "hledger 1.18.99" "hledger User Manuals"   @@ -9,9 +9,10 @@ CSV - how hledger reads CSV data, and the CSV rules file format .SH DESCRIPTION .PP-hledger can read CSV (Comma Separated Value/Character Separated Value)-files as if they were journal files, automatically converting each CSV-record into a transaction.+hledger can read CSV files (Character Separated Value - usually comma,+semicolon, or tab) containing dated records as if they were journal+files, automatically converting each CSV record into a transaction.+.PP (To learn about \f[I]writing\f[R] CSV, see CSV output.) .PP We describe each CSV file\[aq]s format with a corresponding \f[I]rules@@ -35,7 +36,7 @@ .PP .TS tab(@);-l l.+lw(30.1n) lw(39.9n). T{ \f[B]\f[CB]skip\f[B]\f[R] T}@T{@@ -57,11 +58,16 @@ a custom field separator T} T{-\f[B]\f[CB]if\f[B]\f[R]+\f[B]\f[CB]if\f[B] block\f[R] T}@T{-apply some rules to matched CSV records+apply some rules to CSV records matched by patterns T} T{+\f[B]\f[CB]if\f[B] table\f[R]+T}@T{+apply some rules to CSV records matched by patterns, alternate syntax+T}+T{ \f[B]\f[CB]end\f[B]\f[R] T}@T{ skip the remaining CSV records@@ -587,21 +593,27 @@ See TIPS below for more about referencing other fields. .SS \f[C]separator\f[R] .PP-You can use the \f[C]separator\f[R] directive to read other kinds of+You can use the \f[C]separator\f[R] rule to read other kinds of character-separated data.-Eg to read SSV (Semicolon Separated Values), use:+The argument is any single separator character, or the words+\f[C]tab\f[R] or \f[C]space\f[R] (case insensitive).+Eg, for comma-separated values (CSV): .IP .nf \f[C]+separator ,+\f[R]+.fi+.PP+or for semicolon-separated values (SSV):+.IP+.nf+\f[C] separator ; \f[R] .fi .PP-The separator directive accepts exactly one single byte character as a-separator.-To specify whitespace characters, you may use the special words-\f[C]TAB\f[R] or \f[C]SPACE\f[R].-Eg to read TSV (Tab Separated Values), use:+or for tab-separated values (TSV): .IP .nf \f[C]@@ -609,8 +621,11 @@ \f[R] .fi .PP-See also: File Extension.-.SS \f[C]if\f[R]+If the input file has a \f[C].csv\f[R], \f[C].ssv\f[R] or \f[C].tsv\f[R]+file extension (or a \f[C]csv:\f[R], \f[C]ssv:\f[R], \f[C]tsv:\f[R]+prefix), the appropriate separator will be inferred automatically, and+you won\[aq]t need this rule.+.SS \f[C]if\f[R] block .IP .nf \f[C]@@ -630,6 +645,7 @@ applied only to CSV records which match certain patterns. They are often used for customising account names based on transaction descriptions.+.SS Matching the whole record .PP Each MATCHER can be a record matcher, which looks like this: .IP@@ -654,6 +670,7 @@ Eg, if the original record is \f[C]2020-01-01; \[dq]Acme, Inc.\[dq];  1,000\f[R], the REGEX will actually see \f[C]2020-01-01,Acme, Inc.,  1,000\f[R]).+.SS Matching individual fields .PP Or, MATCHER can be a field matcher, like this: .IP@@ -666,10 +683,23 @@ which matches just the content of a particular CSV field. CSVFIELD is a percent sign followed by the field\[aq]s name or column number, like \f[C]%date\f[R] or \f[C]%1\f[R].+.SS Combining matchers .PP A single matcher can be written on the same line as the \[dq]if\[dq]; or multiple matchers can be written on the following lines, non-indented.-Multiple matchers are OR\[aq]d (any one of them can match).+Multiple matchers are OR\[aq]d (any one of them can match), unless one+begins with an \f[C]&\f[R] symbol, in which case it is AND\[aq]ed with+the previous matcher.+.IP+.nf+\f[C]+if+MATCHER+& MATCHER+ RULE+\f[R]+.fi+.SS Rules applied on successful match .PP After the patterns there should be one or more rules to apply, all indented by at least one space.@@ -702,6 +732,76 @@  comment  XXX deductible ? check it \f[R] .fi+.SS \f[C]if\f[R] table+.IP+.nf+\f[C]+if,CSVFIELDNAME1,CSVFIELDNAME2,...,CSVFIELDNAMEn+MATCHER1,VALUE11,VALUE12,...,VALUE1n+MATCHER2,VALUE21,VALUE22,...,VALUE2n+MATCHER3,VALUE31,VALUE32,...,VALUE3n+<empty line>+\f[R]+.fi+.PP+Conditional tables (\[dq]if tables\[dq]) are a different syntax to+specify field assignments that will be applied only to CSV records which+match certain patterns.+.PP+MATCHER could be either field or record matcher, as described above.+When MATCHER matches, values from that row would be assigned to the CSV+fields named on the \f[C]if\f[R] line, in the same order.+.PP+Therefore \f[C]if\f[R] table is exactly equivalent to a sequence of of+\f[C]if\f[R] blocks:+.IP+.nf+\f[C]+if MATCHER1+  CSVFIELDNAME1 VALUE11+  CSVFIELDNAME2 VALUE12+  ...+  CSVFIELDNAMEn VALUE1n++if MATCHER2+  CSVFIELDNAME1 VALUE21+  CSVFIELDNAME2 VALUE22+  ...+  CSVFIELDNAMEn VALUE2n++if MATCHER3+  CSVFIELDNAME1 VALUE31+  CSVFIELDNAME2 VALUE32+  ...+  CSVFIELDNAMEn VALUE3n+\f[R]+.fi+.PP+Each line starting with MATCHER should contain enough (possibly empty)+values for all the listed fields.+.PP+Rules would be checked and applied in the order they are listed in the+table and, like with \f[C]if\f[R] blocks, later rules (in the same or+another table) or \f[C]if\f[R] blocks could override the effect of any+rule.+.PP+Instead of \[aq],\[aq] you can use a variety of other non-alphanumeric+characters as a separator.+First character after \f[C]if\f[R] is taken to be the separator for the+rest of the table.+It is the responsibility of the user to ensure that separator does not+occur inside MATCHERs and values - there is no way to escape separator.+.PP+Example:+.IP+.nf+\f[C]+if,account2,comment+atm transaction fee,expenses:business:banking,deductible? check it+%description groceries,expenses:groceries,+2020/01/12.*Plumbing LLC,expenses:house:upkeep,emergency plumbing call-out+\f[R]+.fi .SS \f[C]end\f[R] .PP This rule can be used inside if blocks (only), to make hledger stop@@ -874,14 +974,12 @@ spaces outside the quotes are not allowed .SS File Extension .PP-CSV (\[dq]Character Separated Values\[dq]) files should be named with-one of these filename extensions: \f[C].csv\f[R], \f[C].ssv\f[R],-\f[C].tsv\f[R].-Or, the file path should be prefixed with one of \f[C]csv:\f[R],-\f[C]ssv:\f[R], \f[C]tsv:\f[R].-This helps hledger identify the format and show the right error-messages.-For example:+To help hledger identify the format and show the right error messages,+CSV/SSV/TSV files should normally be named with a \f[C].csv\f[R],+\f[C].ssv\f[R] or \f[C].tsv\f[R] filename extension.+Or, the file path should be prefixed with \f[C]csv:\f[R], \f[C]ssv:\f[R]+or \f[C]tsv:\f[R].+Eg: .IP .nf \f[C]@@ -897,7 +995,8 @@ \f[R] .fi .PP-More about this: Input files in the hledger manual.+You can override the file extension with a separator rule if needed.+See also: Input files in the hledger manual. .SS Reading multiple CSV files .PP If you use multiple \f[C]-f\f[R] options to read multiple CSV files at
embeddedfiles/hledger_csv.info view
@@ -3,16 +3,18 @@  File: hledger_csv.info,  Node: Top,  Next: EXAMPLES,  Up: (dir) -hledger_csv(5) hledger 1.18.1-*****************************+hledger_csv(5) hledger 1.18.99+******************************  CSV - how hledger reads CSV data, and the CSV rules file format -   hledger can read CSV (Comma Separated Value/Character Separated-Value) files as if they were journal files, automatically converting-each CSV record into a transaction.  (To learn about _writing_ CSV, see-CSV output.)+   hledger can read CSV files (Character Separated Value - usually+comma, semicolon, or tab) containing dated records as if they were+journal files, automatically converting each CSV record into a+transaction. +   (To learn about _writing_ CSV, see CSV output.)+    We describe each CSV file's format with a corresponding _rules file_. By default this is named like the CSV file with a '.rules' extension added.  Eg when reading 'FILE.csv', hledger also looks for@@ -28,17 +30,24 @@ an overview of the CSV rules; these are described more fully below, after the examples: -*'skip'*           skip one or more header lines or matched CSV records-*'fields'*         name CSV fields, assign them to hledger fields-*field             assign a value to one hledger field, with interpolation-assignment*-*'separator'*      a custom field separator-*'if'*             apply some rules to matched CSV records-*'end'*            skip the remaining CSV records-*'date-format'*    describe the format of CSV dates-*'newest-first'*   disambiguate record order when there's only one date-*'include'*        inline another CSV rules file-*'balance-type'*   choose which type of balance assignments to use+*'skip'*                        skip one or more header lines or+                                matched CSV records+*'fields'*                      name CSV fields, assign them to hledger+                                fields+*field assignment*              assign a value to one hledger field,+                                with interpolation+*'separator'*                   a custom field separator+*'if' block*                    apply some rules to CSV records matched+                                by patterns+*'if' table*                    apply some rules to CSV records matched+                                by patterns, alternate syntax+*'end'*                         skip the remaining CSV records+*'date-format'*                 describe the format of CSV dates+*'newest-first'*                disambiguate record order when there's+                                only one date+*'include'*                     inline another CSV rules file+*'balance-type'*                choose which type of balance+                                assignments to use     Note, for best error messages when reading CSV files, use a '.csv', '.tsv' or '.ssv' file extension or file prefix - see File Extension@@ -374,7 +383,8 @@ * fields:: * field assignment:: * separator::-* if::+* if block::+* if table:: * end:: * date-format:: * newest-first::@@ -567,30 +577,35 @@ referencing other fields.  -File: hledger_csv.info,  Node: separator,  Next: if,  Prev: field assignment,  Up: CSV RULES+File: hledger_csv.info,  Node: separator,  Next: if block,  Prev: field assignment,  Up: CSV RULES  2.4 'separator' =============== -You can use the 'separator' directive to read other kinds of-character-separated data.  Eg to read SSV (Semicolon Separated Values),-use:+You can use the 'separator' rule to read other kinds of+character-separated data.  The argument is any single separator+character, or the words 'tab' or 'space' (case insensitive).  Eg, for+comma-separated values (CSV): +separator ,++   or for semicolon-separated values (SSV):+ separator ; -   The separator directive accepts exactly one single byte character as-a separator.  To specify whitespace characters, you may use the special-words 'TAB' or 'SPACE'.  Eg to read TSV (Tab Separated Values), use:+   or for tab-separated values (TSV):  separator TAB -   See also: File Extension.+   If the input file has a '.csv', '.ssv' or '.tsv' file extension (or a+'csv:', 'ssv:', 'tsv:' prefix), the appropriate separator will be+inferred automatically, and you won't need this rule.  -File: hledger_csv.info,  Node: if,  Next: end,  Prev: separator,  Up: CSV RULES+File: hledger_csv.info,  Node: if block,  Next: if table,  Prev: separator,  Up: CSV RULES -2.5 'if'-========+2.5 'if' block+==============  if MATCHER  RULE@@ -607,8 +622,21 @@ often used for customising account names based on transaction descriptions. -   Each MATCHER can be a record matcher, which looks like this:+* Menu: +* Matching the whole record::+* Matching individual fields::+* Combining matchers::+* Rules applied on successful match::+++File: hledger_csv.info,  Node: Matching the whole record,  Next: Matching individual fields,  Up: if block++2.5.1 Matching the whole record+-------------------------------++Each MATCHER can be a record matcher, which looks like this:+ REGEX     REGEX is a case-insensitive regular expression which tries to match@@ -624,19 +652,44 @@ the original record is '2020-01-01; "Acme, Inc."; 1,000', the REGEX will actually see '2020-01-01,Acme, Inc., 1,000'). -   Or, MATCHER can be a field matcher, like this:++File: hledger_csv.info,  Node: Matching individual fields,  Next: Combining matchers,  Prev: Matching the whole record,  Up: if block +2.5.2 Matching individual fields+--------------------------------++Or, MATCHER can be a field matcher, like this:+ %CSVFIELD REGEX     which matches just the content of a particular CSV field.  CSVFIELD is a percent sign followed by the field's name or column number, like '%date' or '%1'. -   A single matcher can be written on the same line as the "if"; or++File: hledger_csv.info,  Node: Combining matchers,  Next: Rules applied on successful match,  Prev: Matching individual fields,  Up: if block++2.5.3 Combining matchers+------------------------++A single matcher can be written on the same line as the "if"; or multiple matchers can be written on the following lines, non-indented.-Multiple matchers are OR'd (any one of them can match).+Multiple matchers are OR'd (any one of them can match), unless one+begins with an '&' symbol, in which case it is AND'ed with the previous+matcher. -   After the patterns there should be one or more rules to apply, all+if+MATCHER+& MATCHER+ RULE+++File: hledger_csv.info,  Node: Rules applied on successful match,  Prev: Combining matchers,  Up: if block++2.5.4 Rules applied on successful match+---------------------------------------++After the patterns there should be one or more rules to apply, all indented by at least one space.  Three kinds of rule are allowed in conditional blocks: @@ -659,9 +712,70 @@  comment  XXX deductible ? check it  -File: hledger_csv.info,  Node: end,  Next: date-format,  Prev: if,  Up: CSV RULES+File: hledger_csv.info,  Node: if table,  Next: end,  Prev: if block,  Up: CSV RULES -2.6 'end'+2.6 'if' table+==============++if,CSVFIELDNAME1,CSVFIELDNAME2,...,CSVFIELDNAMEn+MATCHER1,VALUE11,VALUE12,...,VALUE1n+MATCHER2,VALUE21,VALUE22,...,VALUE2n+MATCHER3,VALUE31,VALUE32,...,VALUE3n+<empty line>++   Conditional tables ("if tables") are a different syntax to specify+field assignments that will be applied only to CSV records which match+certain patterns.++   MATCHER could be either field or record matcher, as described above.+When MATCHER matches, values from that row would be assigned to the CSV+fields named on the 'if' line, in the same order.++   Therefore 'if' table is exactly equivalent to a sequence of of 'if'+blocks:++if MATCHER1+  CSVFIELDNAME1 VALUE11+  CSVFIELDNAME2 VALUE12+  ...+  CSVFIELDNAMEn VALUE1n++if MATCHER2+  CSVFIELDNAME1 VALUE21+  CSVFIELDNAME2 VALUE22+  ...+  CSVFIELDNAMEn VALUE2n++if MATCHER3+  CSVFIELDNAME1 VALUE31+  CSVFIELDNAME2 VALUE32+  ...+  CSVFIELDNAMEn VALUE3n++   Each line starting with MATCHER should contain enough (possibly+empty) values for all the listed fields.++   Rules would be checked and applied in the order they are listed in+the table and, like with 'if' blocks, later rules (in the same or+another table) or 'if' blocks could override the effect of any rule.++   Instead of ',' you can use a variety of other non-alphanumeric+characters as a separator.  First character after 'if' is taken to be+the separator for the rest of the table.  It is the responsibility of+the user to ensure that separator does not occur inside MATCHERs and+values - there is no way to escape separator.++   Example:++if,account2,comment+atm transaction fee,expenses:business:banking,deductible? check it+%description groceries,expenses:groceries,+2020/01/12.*Plumbing LLC,expenses:house:upkeep,emergency plumbing call-out+++File: hledger_csv.info,  Node: end,  Next: date-format,  Prev: if table,  Up: CSV RULES++2.7 'end' =========  This rule can be used inside if blocks (only), to make hledger stop@@ -675,7 +789,7 @@  File: hledger_csv.info,  Node: date-format,  Next: newest-first,  Prev: end,  Up: CSV RULES -2.7 'date-format'+2.8 'date-format' =================  date-format DATEFMT@@ -706,7 +820,7 @@  File: hledger_csv.info,  Node: newest-first,  Next: include,  Prev: date-format,  Up: CSV RULES -2.8 'newest-first'+2.9 'newest-first' ==================  hledger always sorts the generated transactions by date.  Transactions@@ -728,8 +842,8 @@  File: hledger_csv.info,  Node: include,  Next: balance-type,  Prev: newest-first,  Up: CSV RULES -2.9 'include'-=============+2.10 'include'+==============  include RULESFILE @@ -751,7 +865,7 @@  File: hledger_csv.info,  Node: balance-type,  Prev: include,  Up: CSV RULES -2.10 'balance-type'+2.11 'balance-type' ===================  Balance assertions generated by assigning to balanceN are of the simple@@ -825,11 +939,10 @@ 3.3 File Extension ================== -CSV ("Character Separated Values") files should be named with one of-these filename extensions: '.csv', '.ssv', '.tsv'.  Or, the file path-should be prefixed with one of 'csv:', 'ssv:', 'tsv:'.  This helps-hledger identify the format and show the right error messages.  For-example:+To help hledger identify the format and show the right error messages,+CSV/SSV/TSV files should normally be named with a '.csv', '.ssv' or+'.tsv' filename extension.  Or, the file path should be prefixed with+'csv:', 'ssv:' or 'tsv:'.  Eg:  $ hledger -f foo.ssv print @@ -837,7 +950,8 @@  $ cat foo | hledger -f ssv:- foo -   More about this: Input files in the hledger manual.+   You can override the file extension with a separator rule if needed.+See also: Input files in the hledger manual.   File: hledger_csv.info,  Node: Reading multiple CSV files,  Next: Valid transactions,  Prev: File Extension,  Up: TIPS@@ -1036,74 +1150,84 @@  Tag Table: Node: Top72-Node: EXAMPLES2178-Ref: #examples2284-Node: Basic2492-Ref: #basic2592-Node: Bank of Ireland3134-Ref: #bank-of-ireland3269-Node: Amazon4731-Ref: #amazon4849-Node: Paypal6568-Ref: #paypal6662-Node: CSV RULES14306-Ref: #csv-rules14415-Node: skip14691-Ref: #skip14784-Node: fields15159-Ref: #fields15281-Node: Transaction field names16446-Ref: #transaction-field-names16606-Node: Posting field names16717-Ref: #posting-field-names16869-Node: account16939-Ref: #account17055-Node: amount17592-Ref: #amount17723-Node: currency18830-Ref: #currency18965-Node: balance19171-Ref: #balance19305-Node: comment19622-Ref: #comment19739-Node: field assignment19902-Ref: #field-assignment20045-Node: separator20863-Ref: #separator20992-Node: if21403-Ref: #if21505-Node: end23661-Ref: #end23767-Node: date-format23991-Ref: #date-format24123-Node: newest-first24872-Ref: #newest-first25010-Node: include25693-Ref: #include25822-Node: balance-type26266-Ref: #balance-type26386-Node: TIPS27086-Ref: #tips27168-Node: Rapid feedback27424-Ref: #rapid-feedback27541-Node: Valid CSV28001-Ref: #valid-csv28131-Node: File Extension28323-Ref: #file-extension28475-Node: Reading multiple CSV files28885-Ref: #reading-multiple-csv-files29070-Node: Valid transactions29311-Ref: #valid-transactions29489-Node: Deduplicating importing30117-Ref: #deduplicating-importing30296-Node: Setting amounts31329-Ref: #setting-amounts31498-Node: Setting currency/commodity32485-Ref: #setting-currencycommodity32677-Node: Referencing other fields33480-Ref: #referencing-other-fields33680-Node: How CSV rules are evaluated34577-Ref: #how-csv-rules-are-evaluated34750+Node: EXAMPLES2677+Ref: #examples2783+Node: Basic2991+Ref: #basic3091+Node: Bank of Ireland3633+Ref: #bank-of-ireland3768+Node: Amazon5230+Ref: #amazon5348+Node: Paypal7067+Ref: #paypal7161+Node: CSV RULES14805+Ref: #csv-rules14914+Node: skip15209+Ref: #skip15302+Node: fields15677+Ref: #fields15799+Node: Transaction field names16964+Ref: #transaction-field-names17124+Node: Posting field names17235+Ref: #posting-field-names17387+Node: account17457+Ref: #account17573+Node: amount18110+Ref: #amount18241+Node: currency19348+Ref: #currency19483+Node: balance19689+Ref: #balance19823+Node: comment20140+Ref: #comment20257+Node: field assignment20420+Ref: #field-assignment20563+Node: separator21381+Ref: #separator21516+Node: if block22056+Ref: #if-block22181+Node: Matching the whole record22582+Ref: #matching-the-whole-record22757+Node: Matching individual fields23561+Ref: #matching-individual-fields23765+Node: Combining matchers23989+Ref: #combining-matchers24185+Node: Rules applied on successful match24498+Ref: #rules-applied-on-successful-match24689+Node: if table25343+Ref: #if-table25462+Node: end27200+Ref: #end27312+Node: date-format27536+Ref: #date-format27668+Node: newest-first28417+Ref: #newest-first28555+Node: include29238+Ref: #include29369+Node: balance-type29813+Ref: #balance-type29933+Node: TIPS30633+Ref: #tips30715+Node: Rapid feedback30971+Ref: #rapid-feedback31088+Node: Valid CSV31548+Ref: #valid-csv31678+Node: File Extension31870+Ref: #file-extension32022+Node: Reading multiple CSV files32451+Ref: #reading-multiple-csv-files32636+Node: Valid transactions32877+Ref: #valid-transactions33055+Node: Deduplicating importing33683+Ref: #deduplicating-importing33862+Node: Setting amounts34895+Ref: #setting-amounts35064+Node: Setting currency/commodity36051+Ref: #setting-currencycommodity36243+Node: Referencing other fields37046+Ref: #referencing-other-fields37246+Node: How CSV rules are evaluated38143+Ref: #how-csv-rules-are-evaluated38316  End Tag Table 
embeddedfiles/hledger_csv.txt view
@@ -7,60 +7,58 @@        CSV - how hledger reads CSV data, and the CSV rules file format  DESCRIPTION-       hledger  can read CSV (Comma Separated Value/Character Separated Value)-       files as if they were journal files, automatically converting each  CSV-       record  into  a transaction.  (To learn about writing CSV, see CSV out--       put.)+       hledger  can read CSV files (Character Separated Value - usually comma,+       semicolon, or tab) containing dated records as  if  they  were  journal+       files, automatically converting each CSV record into a transaction. +       (To learn about writing CSV, see CSV output.)+        We describe each CSV file's format with a corresponding rules file.  By-       default  this is named like the CSV file with a .rules extension added.-       Eg when reading FILE.csv, hledger also looks for FILE.csv.rules in  the-       same  directory  as  FILE.csv.   You can specify a different rules file-       with the --rules-file option.  If a rules file is  not  found,  hledger+       default this is named like the CSV file with a .rules extension  added.+       Eg  when reading FILE.csv, hledger also looks for FILE.csv.rules in the+       same directory as FILE.csv.  You can specify  a  different  rules  file+       with  the  --rules-file  option.  If a rules file is not found, hledger        will create a sample rules file, which you'll need to adjust. -       This  file  contains rules describing the CSV data (header line, fields+       This file contains rules describing the CSV data (header  line,  fields        layout, date format etc.), and how to construct hledger journal entries        (transactions) from it.  Often there will also be a list of conditional        rules  for  categorising  transactions  based  on  their  descriptions.        Here's an overview of the CSV rules; these are described more fully be-        low, after the examples: -       skip               skip one  or  more  header-                          lines   or   matched   CSV-                          records-       fields             name  CSV  fields,  assign-                          them to hledger fields-       field assignment   assign   a  value  to  one-                          hledger field, with inter--                          polation-       separator          a custom field separator-       if                 apply    some   rules   to-                          matched CSV records-       end                skip  the  remaining   CSV-                          records-       date-format        describe the format of CSV-                          dates-       newest-first       disambiguate record  order-                          when there's only one date-       include            inline  another  CSV rules-                          file-       balance-type       choose which type of  bal--                          ance assignments to use+       skip                             skip one or more header lines or matched+                                        CSV records+       fields                           name CSV fields, assign them to  hledger+                                        fields+       field assignment                 assign  a  value  to  one hledger field,+                                        with interpolation+       separator                        a custom field separator+       if block                         apply some rules to CSV records  matched+                                        by patterns+       if table                         apply  some rules to CSV records matched+                                        by patterns, alternate syntax+       end                              skip the remaining CSV records+       date-format                      describe the format of CSV dates+       newest-first                     disambiguate record order  when  there's+                                        only one date+       include                          inline another CSV rules file+       balance-type                     choose which type of balance assignments+                                        to use -       Note,  for best error messages when reading CSV files, use a .csv, .tsv+       Note, for best error messages when reading CSV files, use a .csv,  .tsv        or .ssv file extension or file prefix - see File Extension below.         There's an introductory Convert CSV files tutorial on hledger.org.  EXAMPLES-       Here are some sample hledger CSV rules files.  See also the  full  col-+       Here  are  some sample hledger CSV rules files.  See also the full col-        lection at:        https://github.com/simonmichael/hledger/tree/master/examples/csv     Basic-       At  minimum,  the  rules file must identify the date and amount fields,-       and often it also specifies the date format and how many  header  lines+       At minimum, the rules file must identify the date  and  amount  fields,+       and  often  it also specifies the date format and how many header lines        there are.  Here's a simple CSV file and a rules file for it:                Date, Description, Id, Amount@@ -79,8 +77,8 @@        Default account names are chosen, since we didn't set them.     Bank of Ireland-       Here's  a  CSV with two amount fields (Debit and Credit), and a balance-       field, which we can use to add balance assertions, which is not  neces-+       Here's a CSV with two amount fields (Debit and Credit), and  a  balance+       field,  which we can use to add balance assertions, which is not neces-        sary but provides extra error checking:                Date,Details,Debit,Credit,Balance@@ -122,13 +120,13 @@                   assets:bank:boi:checking         EUR-5.0 = EUR126.0                   expenses:unknown                  EUR5.0 -       The  balance assertions don't raise an error above, because we're read--       ing directly from CSV, but they will be checked if  these  entries  are+       The balance assertions don't raise an error above, because we're  read-+       ing  directly  from  CSV, but they will be checked if these entries are        imported into a journal file.     Amazon        Here we convert amazon.com order history, and use an if block to gener--       ate a third posting if there's a fee.  (In practice you'd probably  get+       ate  a third posting if there's a fee.  (In practice you'd probably get        this data from your bank instead, but it's an example.)                "Date","Type","To/From","Name","Status","Amount","Fees","Transaction ID"@@ -180,7 +178,7 @@                   expenses:fees           $1.00     Paypal-       Here's  a  real-world rules file for (customised) Paypal CSV, with some+       Here's a real-world rules file for (customised) Paypal CSV,  with  some        Paypal-specific rules, and a second rules file included:                "Date","Time","TimeZone","Name","Type","Status","Currency","Gross","Fee","Net","From Email Address","To Email Address","Transaction ID","Item Title","Item ID","Reference Txn ID","Receipt ID","Balance","Note"@@ -335,9 +333,9 @@    skip               skip N -       The  word  "skip"  followed by a number (or no number, meaning 1) tells-       hledger to ignore this many non-empty lines  preceding  the  CSV  data.-       (Empty/blank  lines  are skipped automatically.) You'll need this when-+       The word "skip" followed by a number (or no number,  meaning  1)  tells+       hledger  to  ignore  this  many non-empty lines preceding the CSV data.+       (Empty/blank lines are skipped automatically.) You'll need  this  when-        ever your CSV data contains header lines.         It also has a second purpose: it can be used inside if blocks to ignore@@ -346,27 +344,27 @@    fields               fields FIELDNAME1, FIELDNAME2, ... -       A  fields  list  (the  word  "fields" followed by comma-separated field-       names) is the quick way to assign CSV field values to  hledger  fields.+       A fields list (the word  "fields"  followed  by  comma-separated  field+       names)  is  the quick way to assign CSV field values to hledger fields.        It does two things: -       1. it  names  the  CSV fields.  This is optional, but can be convenient+       1. it names the CSV fields.  This is optional, but  can  be  convenient           later for interpolating them.         2. when you use a standard hledger field name, it assigns the CSV value           to that part of the hledger transaction. -       Here's  an  example  that  says "use the 1st, 2nd and 4th fields as the-       transaction's date, description and amount; name the  last  two  fields+       Here's an example that says "use the 1st, 2nd and  4th  fields  as  the+       transaction's  date,  description  and amount; name the last two fields        for later reference; and ignore the others":                fields date, description, , amount, , , somefield, anotherfield -       Field  names  may  not contain whitespace.  Fields you don't care about-       can be left unnamed.  Currently there must be least  two  items  (there+       Field names may not contain whitespace.  Fields you  don't  care  about+       can  be  left  unnamed.  Currently there must be least two items (there        must be at least one comma). -       Note,  always  use  comma in the fields list, even if your CSV uses an-+       Note, always use comma in the fields list, even if your  CSV  uses  an-        other separator character.         Here are the standard hledger field/pseudo-field names.  For more about@@ -379,52 +377,52 @@     Posting field names    account-       accountN,  where  N  is 1 to 99, causes a posting to be generated, with+       accountN, where N is 1 to 99, causes a posting to  be  generated,  with        that account name. -       Most often there are two postings, so you'll want to set  account1  and-       account2.   Typically  account1 is associated with the CSV file, and is-       set once with a top-level assignment, while account2 is  set  based  on+       Most  often  there are two postings, so you'll want to set account1 and+       account2.  Typically account1 is associated with the CSV file,  and  is+       set  once  with  a top-level assignment, while account2 is set based on        each transaction's description, and in conditional blocks. -       If  a  posting's  account name is left unset but its amount is set (see-       below), a default account name will be chosen (like  "expenses:unknown"+       If a posting's account name is left unset but its amount  is  set  (see+       below),  a default account name will be chosen (like "expenses:unknown"        or "income:unknown").     amount-       amountN  sets  posting N's amount.  If the CSV uses separate fields for-       inflows and outflows, you can use amountN-in and  amountN-out  instead.-       By  assigning to amount1, amount2, ...  etc.  you can generate anywhere+       amountN sets posting N's amount.  If the CSV uses separate  fields  for+       inflows  and  outflows, you can use amountN-in and amountN-out instead.+       By assigning to amount1, amount2, ...  etc.  you can generate  anywhere        from 0 to 99 postings. -       There is also an older, unnumbered form of these  names,  suitable  for+       There  is  also  an older, unnumbered form of these names, suitable for        2-posting transactions, which sets both posting 1's and (negated) post--       ing 2's amount: amount, or amount-in and  amount-out.   This  is  still-       supported  because  it  keeps pre-hledger-1.17 csv rules files working,-       and because it can be more succinct, and because  it  converts  posting+       ing  2's  amount:  amount,  or amount-in and amount-out.  This is still+       supported because it keeps pre-hledger-1.17 csv  rules  files  working,+       and  because  it  can be more succinct, and because it converts posting        2's amount to cost if there's a transaction price, which can be useful.         If you have an existing rules file using the unnumbered form, you might-       want to use the numbered form in certain  conditional  blocks,  without-       having  to  update  and  retest all the old rules.  To facilitate this,-       posting   1   ignores    amount/amount-in/amount-out    if    any    of+       want  to  use  the numbered form in certain conditional blocks, without+       having to update and retest all the old  rules.   To  facilitate  this,+       posting    1    ignores    amount/amount-in/amount-out    if   any   of        amount1/amount1-in/amount1-out are assigned, and posting 2 ignores them-       if any of amount2/amount2-in/amount2-out are  assigned,  avoiding  con-+       if  any  of  amount2/amount2-in/amount2-out are assigned, avoiding con-        flicts.     currency        If the CSV has the currency symbol in a separate field (ie, not part of-       the amount field), you can use currencyN to prepend it to  posting  N's+       the  amount  field), you can use currencyN to prepend it to posting N's        amount.  Or, currency with no number affects all postings.     balance-       balanceN  sets  a balance assertion amount (or if the posting amount is+       balanceN sets a balance assertion amount (or if the posting  amount  is        left empty, a balance assignment) on posting N. -       Also, for compatibility with hledger <1.17: balance with no  number  is+       Also,  for  compatibility with hledger <1.17: balance with no number is        equivalent to balance1. -       You  can  adjust the type of assertion/assignment with the balance-type+       You can adjust the type of assertion/assignment with  the  balance-type        rule (see below).     comment@@ -436,11 +434,11 @@    field assignment               HLEDGERFIELDNAME FIELDVALUE -       Instead  of  or  in addition to a fields list, you can use a "field as--       signment" rule to set the value of a single hledger field,  by  writing-       its  name (any of the standard hledger field names above) followed by a-       text value.  The value may contain interpolated CSV fields,  referenced-       by  their  1-based position in the CSV record (%N), or by the name they+       Instead of or in addition to a fields list, you can use  a  "field  as-+       signment"  rule  to set the value of a single hledger field, by writing+       its name (any of the standard hledger field names above) followed by  a+       text  value.  The value may contain interpolated CSV fields, referenced+       by their 1-based position in the CSV record (%N), or by the  name  they        were given in the fields list (%CSVFIELDNAME).  Some examples:                # set the amount to the 4th CSV field, with " USD" appended@@ -449,25 +447,31 @@               # combine three fields to make a comment, containing note: and date: tags               comment note: %somefield - %anotherfield, date: %1 -       Interpolation strips outer whitespace (so a CSV value like "  1  "  be-+       Interpolation  strips  outer  whitespace (so a CSV value like " 1 " be-        comes 1 when interpolated) (#1051).  See TIPS below for more about ref-        erencing other fields.     separator-       You can use the separator directive to read other kinds  of  character--       separated data.  Eg to read SSV (Semicolon Separated Values), use:+       You  can  use the separator rule to read other kinds of character-sepa-+       rated data.  The argument is any single  separator  character,  or  the+       words  tab or space (case insensitive).  Eg, for comma-separated values+       (CSV): +              separator ,++       or for semicolon-separated values (SSV):+               separator ; -       The  separator directive accepts exactly one single byte character as a-       separator.  To specify whitespace characters, you may use  the  special-       words TAB or SPACE.  Eg to read TSV (Tab Separated Values), use:+       or for tab-separated values (TSV):                separator TAB -       See also: File Extension.+       If the input file has a .csv, .ssv or .tsv file extension (or  a  csv:,+       ssv:, tsv: prefix), the appropriate separator will be inferred automat-+       ically, and you won't need this rule. -   if+   if block               if MATCHER                RULE @@ -478,39 +482,49 @@                RULE                RULE -       Conditional  blocks ("if blocks") are a block of rules that are applied-       only to CSV records which match certain patterns.  They are often  used+       Conditional blocks ("if blocks") are a block of rules that are  applied+       only  to CSV records which match certain patterns.  They are often used        for customising account names based on transaction descriptions. +   Matching the whole record        Each MATCHER can be a record matcher, which looks like this:                REGEX -       REGEX  is  a  case-insensitive  regular expression which tries to match-       anywhere within the CSV record.  It is a POSIX  ERE  (extended  regular-       expression)  that  also  supports GNU word boundaries (\b, \B, \<, \>),+       REGEX is a case-insensitive regular expression  which  tries  to  match+       anywhere  within  the  CSV record.  It is a POSIX ERE (extended regular+       expression) that also supports GNU word boundaries (\b,  \B,  \<,  \>),        and  nothing  else.   If  you  have  trouble,  be  sure  to  check  our        https://hledger.org/hledger.html#regular-expressions doc. -       Important  note: the record that is matched is not the original record,-       but a synthetic one, with any enclosing double quotes (but not  enclos-+       Important note: the record that is matched is not the original  record,+       but  a synthetic one, with any enclosing double quotes (but not enclos-        ing whitespace) removed, and always comma-separated (which means that a-       field containing a comma will appear like  two  fields).   Eg,  if  the+       field  containing  a  comma  will  appear like two fields).  Eg, if the        original record is 2020-01-01; "Acme, Inc.";  1,000, the REGEX will ac-        tually see 2020-01-01,Acme, Inc.,  1,000). +   Matching individual fields        Or, MATCHER can be a field matcher, like this:                %CSVFIELD REGEX -       which matches just the content of a particular CSV field.  CSVFIELD  is-       a  percent  sign  followed  by  the field's name or column number, like+       which  matches just the content of a particular CSV field.  CSVFIELD is+       a percent sign followed by the field's  name  or  column  number,  like        %date or %1. +   Combining matchers        A single matcher can be written on the same line as the "if"; or multi-        ple matchers can be written on the following lines, non-indented.  Mul--       tiple matchers are OR'd (any one of them can match).+       tiple  matchers are OR'd (any one of them can match), unless one begins+       with an & symbol, in which case it is AND'ed with the previous matcher. +              if+              MATCHER+              & MATCHER+               RULE++   Rules applied on successful match        After the patterns there should be one or more rules to apply, all  in-        dented  by at least one space.  Three kinds of rule are allowed in con-        ditional blocks:@@ -535,8 +549,63 @@                account2 expenses:business:banking                comment  XXX deductible ? check it +   if table+              if,CSVFIELDNAME1,CSVFIELDNAME2,...,CSVFIELDNAMEn+              MATCHER1,VALUE11,VALUE12,...,VALUE1n+              MATCHER2,VALUE21,VALUE22,...,VALUE2n+              MATCHER3,VALUE31,VALUE32,...,VALUE3n+              <empty line>++       Conditional tables ("if tables") are  a  different  syntax  to  specify+       field  assignments that will be applied only to CSV records which match+       certain patterns.++       MATCHER could be either field or record matcher,  as  described  above.+       When MATCHER matches, values from that row would be assigned to the CSV+       fields named on the if line, in the same order.++       Therefore if table is exactly equivalent to a sequence of of if blocks:++              if MATCHER1+                CSVFIELDNAME1 VALUE11+                CSVFIELDNAME2 VALUE12+                ...+                CSVFIELDNAMEn VALUE1n++              if MATCHER2+                CSVFIELDNAME1 VALUE21+                CSVFIELDNAME2 VALUE22+                ...+                CSVFIELDNAMEn VALUE2n++              if MATCHER3+                CSVFIELDNAME1 VALUE31+                CSVFIELDNAME2 VALUE32+                ...+                CSVFIELDNAMEn VALUE3n++       Each line starting with MATCHER should contain enough (possibly  empty)+       values for all the listed fields.++       Rules  would be checked and applied in the order they are listed in the+       table and, like with if blocks, later rules (in the same or another ta-+       ble) or if blocks could override the effect of any rule.++       Instead  of ',' you can use a variety of other non-alphanumeric charac-+       ters as a separator.  First character after if is taken to be the sepa-+       rator  for the rest of the table.  It is the responsibility of the user+       to ensure that separator does not occur inside MATCHERs  and  values  -+       there is no way to escape separator.++       Example:++              if,account2,comment+              atm transaction fee,expenses:business:banking,deductible? check it+              %description groceries,expenses:groceries,+              2020/01/12.*Plumbing LLC,expenses:house:upkeep,emergency plumbing call-out+    end-       This rule can be used inside if blocks (only),  to  make  hledger  stop+       This  rule  can  be  used inside if blocks (only), to make hledger stop        reading this CSV file and move on to the next input file, or to command        execution.  Eg: @@ -547,10 +616,10 @@    date-format               date-format DATEFMT -       This is a helper for the date (and date2) fields.  If  your  CSV  dates-       are  not  formatted  like  YYYY-MM-DD, YYYY/MM/DD or YYYY.MM.DD, you'll-       need to add a date-format rule describing them  with  a  strptime  date-       parsing  pattern, which must parse the CSV date value completely.  Some+       This  is  a  helper for the date (and date2) fields.  If your CSV dates+       are not formatted like YYYY-MM-DD,  YYYY/MM/DD  or  YYYY.MM.DD,  you'll+       need  to  add  a  date-format rule describing them with a strptime date+       parsing pattern, which must parse the CSV date value completely.   Some        examples:                # MM/DD/YY@@ -572,15 +641,15 @@        mat.html#v:formatTime     newest-first-       hledger  always sorts the generated transactions by date.  Transactions-       on the same date should appear in the same order as their CSV  records,-       as  hledger  can  usually auto-detect whether the CSV's normal order is+       hledger always sorts the generated transactions by date.   Transactions+       on  the same date should appear in the same order as their CSV records,+       as hledger can usually auto-detect whether the CSV's  normal  order  is        oldest first or newest first.  But if all of the following are true: -       o the CSV might sometimes contain just one day  of  data  (all  records+       o the  CSV  might  sometimes  contain just one day of data (all records          having the same date) -       o the  CSV  records are normally in reverse chronological order (newest+       o the CSV records are normally in reverse chronological  order  (newest          at the top)         o and you care about preserving the order of same-day transactions@@ -593,9 +662,9 @@    include               include RULESFILE -       This includes the contents of another CSV rules  file  at  this  point.-       RULESFILE  is  an  absolute file path or a path relative to the current-       file's directory.  This can be useful for sharing common rules  between+       This  includes  the  contents  of another CSV rules file at this point.+       RULESFILE is an absolute file path or a path relative  to  the  current+       file's  directory.  This can be useful for sharing common rules between        several rules files, eg:                # someaccount.csv.rules@@ -610,10 +679,10 @@     balance-type        Balance assertions generated by assigning to balanceN are of the simple-       = type by default, which is  a  single-commodity,  subaccount-excluding+       =  type  by  default, which is a single-commodity, subaccount-excluding        assertion.  You may find the subaccount-including variants more useful,-       eg if you have created some virtual subaccounts  of  checking  to  help-       with  budgeting.  You can select a different type of assertion with the+       eg  if  you  have  created some virtual subaccounts of checking to help+       with budgeting.  You can select a different type of assertion with  the        balance-type rule:                # balance assertions will consider all commodities and all subaccounts@@ -628,19 +697,19 @@  TIPS    Rapid feedback-       It's a good idea to get rapid feedback  while  creating/troubleshooting+       It's  a  good idea to get rapid feedback while creating/troubleshooting        CSV rules.  Here's a good way, using entr from http://eradman.com/entr-        project :                $ ls foo.csv* | entr bash -c 'echo ----; hledger -f foo.csv print desc:SOMEDESC' -       A desc: query (eg) is used to select just one, or a  few,  transactions-       of  interest.   "bash  -c"  is used to run multiple commands, so we can-       echo a separator each time the command re-runs,  making  it  easier  to+       A  desc:  query (eg) is used to select just one, or a few, transactions+       of interest.  "bash -c" is used to run multiple  commands,  so  we  can+       echo  a  separator  each  time the command re-runs, making it easier to        read the output.     Valid CSV-       hledger  accepts  CSV  conforming to RFC 4180.  When CSV values are en-+       hledger accepts CSV conforming to RFC 4180.  When CSV  values  are  en-        closed in quotes, note:         o they must be double quotes (not single quotes)@@ -648,10 +717,10 @@        o spaces outside the quotes are not allowed     File Extension-       CSV ("Character Separated Values") files should be named  with  one  of-       these  filename extensions: .csv, .ssv, .tsv.  Or, the file path should-       be prefixed with one of csv:, ssv:, tsv:.  This helps hledger  identify-       the format and show the right error messages.  For example:+       To  help hledger identify the format and show the right error messages,+       CSV/SSV/TSV files should normally be named with a .csv,  .ssv  or  .tsv+       filename  extension.   Or,  the file path should be prefixed with csv:,+       ssv: or tsv:.  Eg:                $ hledger -f foo.ssv print @@ -659,7 +728,8 @@                $ cat foo | hledger -f ssv:- foo -       More about this: Input files in the hledger manual.+       You can override the file extension with a separator  rule  if  needed.+       See also: Input files in the hledger manual.     Reading multiple CSV files        If  you  use  multiple  -f  options to read multiple CSV files at once,@@ -852,4 +922,4 @@   -hledger 1.18.1                     June 2020                    hledger_csv(5)+hledger 1.18.99                 September 2020                  hledger_csv(5)
embeddedfiles/hledger_journal.5 view
@@ -1,6 +1,6 @@ .\"t -.TH "hledger_journal" "5" "June 2020" "hledger 1.18.1" "hledger User Manuals"+.TH "hledger_journal" "5" "September 2020" "hledger 1.18.99" "hledger User Manuals"   @@ -670,10 +670,13 @@ \f[R] .fi .RE+.IP "4." 3+Like 1, but the \f[C]\[at]\f[R] is parenthesised, i.e.+\f[C](\[at])\f[R]; this is for compatibility with Ledger journals+(Virtual posting costs), and is equivalent to 1 in hledger. .IP "5." 3-Like 1 and 2, but the \f[C]\[at]\f[R] or \f[C]\[at]\[at]\f[R] is-parenthesised; this is for compatibility with Ledger journals (Virtual-posting costs), and in hledger is equivalent to 1 and 2.+Like 2, but as in 4 the \f[C]\[at]\[at]\f[R] is parenthesised, i.e.+\f[C](\[at]\[at])\f[R]; in hledger, this is equivalent to 2. .PP Use the \f[C]-B/--cost\f[R] flag to convert amounts to their transaction price\[aq]s commodity, if any.@@ -1381,62 +1384,140 @@ .fi .SS Account types .PP-hledger recognises five types (or classes) of account: Asset, Liability,-Equity, Revenue, Expense.-This is used by a few accounting-aware reports such as balancesheet,-incomestatement and cashflow.-.SS Auto-detected account types+hledger recognises five main types of account, corresponding to the+account classes in the accounting equation: .PP-If you name your top-level accounts with some variation of-\f[C]assets\f[R], \f[C]liabilities\f[R]/\f[C]debts\f[R],-\f[C]equity\f[R], \f[C]revenues\f[R]/\f[C]income\f[R], or-\f[C]expenses\f[R], their types are detected automatically.-.SS Account types declared with tags+\f[C]Asset\f[R], \f[C]Liability\f[R], \f[C]Equity\f[R],+\f[C]Revenue\f[R], \f[C]Expense\f[R]. .PP-More generally, you can declare an account\[aq]s type with an account-directive, by writing a \f[C]type:\f[R] tag in a comment, followed by-one of the words \f[C]Asset\f[R], \f[C]Liability\f[R], \f[C]Equity\f[R],-\f[C]Revenue\f[R], \f[C]Expense\f[R], or one of the letters-\f[C]ALERX\f[R] (case insensitive):+These account types are important for controlling which accounts appear+in the balancesheet, balancesheetequity, incomestatement reports (and+probably for other things in future).+.PP+Additionally, we recognise the \f[C]Cash\f[R] type, which is also an+\f[C]Asset\f[R], and which causes accounts to appear in the cashflow+report.+(\[dq]Cash\[dq] here means liquid assets, eg bank balances but typically+not investments or receivables.)+.SS Declaring account types+.PP+Generally, to make these reports work you should declare your top-level+accounts and their types, using account directives with \f[C]type:\f[R]+tags.+.PP+The tag\[aq]s value should be one of: \f[C]Asset\f[R],+\f[C]Liability\f[R], \f[C]Equity\f[R], \f[C]Revenue\f[R],+\f[C]Expense\f[R], \f[C]Cash\f[R], \f[C]A\f[R], \f[C]L\f[R],+\f[C]E\f[R], \f[C]R\f[R], \f[C]X\f[R], \f[C]C\f[R] (all case+insensitive).+The type is inherited by all subaccounts except where they override it.+Here\[aq]s a complete example: .IP .nf \f[C]-account assets       ; type:Asset-account liabilities  ; type:Liability-account equity       ; type:Equity-account revenues     ; type:Revenue-account expenses     ; type:Expense+account assets       ; type: Asset+account assets:bank  ; type: Cash+account assets:cash  ; type: Cash+account liabilities  ; type: Liability+account equity       ; type: Equity+account revenues     ; type: Revenue+account expenses     ; type: Expense \f[R] .fi-.SS Account types declared with account type codes+.SS Auto-detected account types .PP-Or, you can write one of those letters separated from the account name-by two or more spaces, but this should probably be considered deprecated-as of hledger 1.13:+If you happen to use common english top-level account names, you may not+need to declare account types, as they will be detected automatically+using the following rules:+.PP+.TS+tab(@);+l l.+T{+If name matches regular expression:+T}@T{+account type is:+T}+_+T{+\f[C]\[ha]assets?(:|$)\f[R]+T}@T{+\f[C]Asset\f[R]+T}+T{+\f[C]\[ha](debts?|liabilit(y|ies))(:|$)\f[R]+T}@T{+\f[C]Liability\f[R]+T}+T{+\f[C]\[ha]equity(:|$)\f[R]+T}@T{+\f[C]Equity\f[R]+T}+T{+\f[C]\[ha](income|revenue)s?(:|$)\f[R]+T}@T{+\f[C]Revenue\f[R]+T}+T{+\f[C]\[ha]expenses?(:|$)\f[R]+T}@T{+\f[C]Expense\f[R]+T}+.TE+.PP+.TS+tab(@);+lw(56.9n) lw(13.1n).+T{+If account type is \f[C]Asset\f[R] and name does not contain regular+expression:+T}@T{+account type is:+T}+_+T{+\f[C](investment|receivable|:A/R|:fixed)\f[R]+T}@T{+\f[C]Cash\f[R]+T}+.TE+.PP+Even so, explicit declarations may be a good idea, for clarity and+predictability.+.SS Interference from auto-detected account types+.PP+If you assign any account type, it\[aq]s a good idea to assign all of+them, to prevent any confusion from mixing declared and auto-detected+types.+Although it\[aq]s unlikely to happen in real life, here\[aq]s an+example: with the following journal, \f[C]balancesheetequity\f[R] shows+\[dq]liabilities\[dq] in both Liabilities and Equity sections.+Declaring another account as \f[C]type:Liability\f[R] would fix it: .IP .nf \f[C]-account assets       A-account liabilities  L-account equity       E-account revenues     R-account expenses     X+account liabilities  ; type:Equity++2020-01-01+  assets        1+  liabilities   1+  equity       -2 \f[R] .fi-.SS Overriding auto-detected types+.SS Old account type syntax .PP-If you ever override the types of those auto-detected english account-names mentioned above, you might need to help the reports a bit.-Eg:+In some hledger journals you might instead see this old syntax (the+letters ALERX, separated from the account name by two or more spaces);+this is deprecated and may be removed soon: .IP .nf \f[C]-; make \[dq]liabilities\[dq] not have the liability type - who knows why-account liabilities  ; type:E--; we need to ensure some other account has the liability type,-; otherwise balancesheet would still show \[dq]liabilities\[dq] under Liabilities-account -            ; type:L+account assets       A+account liabilities  L+account equity       E+account revenues     R+account expenses     X \f[R] .fi .SS Account display order@@ -1568,7 +1649,7 @@ .IP .nf \f[C]-alias /\[ha](.+):bank:([\[ha]:]+)(.*)/ = \[rs]1:\[rs]2 \[rs]3+alias /\[ha](.+):bank:([\[ha]:]+):(.*)/ = \[rs]1:\[rs]2 \[rs]3 ; rewrites \[dq]assets:bank:wells fargo:checking\[dq] to  \[dq]assets:wells fargo checking\[dq] \f[R] .fi
embeddedfiles/hledger_journal.info view
@@ -4,8 +4,8 @@  File: hledger_journal.info,  Node: Top,  Up: (dir) -hledger_journal(5) hledger 1.18.1-*********************************+hledger_journal(5) hledger 1.18.99+**********************************  Journal - hledger's default file format, representing a General Journal @@ -593,10 +593,13 @@        assets:euros     €100          ; one hundred euros purchased        assets:dollars  $-135          ; for $135 -  4. 5. Like 1 and 2, but the '@' or '@@' is parenthesised; this is for-     compatibility with Ledger journals (Virtual posting costs), and in-     hledger is equivalent to 1 and 2.+  4. Like 1, but the '@' is parenthesised, i.e.  '(@)'; this is for+     compatibility with Ledger journals (Virtual posting costs), and is+     equivalent to 1 in hledger. +  5. Like 2, but as in 4 the '@@' is parenthesised, i.e.  '(@@)'; in+     hledger, this is equivalent to 2.+    Use the '-B/--cost' flag to convert amounts to their transaction price's commodity, if any.  (mnemonic: "B" is from "cost Basis", as in Ledger).  Eg here is how -B affects the balance report for the example@@ -1250,45 +1253,79 @@ 1.13.8.3 Account types ...................... -hledger recognises five types (or classes) of account: Asset, Liability,-Equity, Revenue, Expense.  This is used by a few accounting-aware-reports such as balancesheet, incomestatement and cashflow.-Auto-detected account types If you name your top-level accounts with-some variation of 'assets', 'liabilities'/'debts', 'equity',-'revenues'/'income', or 'expenses', their types are detected-automatically.  Account types declared with tags More generally, you can-declare an account's type with an account directive, by writing a-'type:' tag in a comment, followed by one of the words 'Asset',-'Liability', 'Equity', 'Revenue', 'Expense', or one of the letters-'ALERX' (case insensitive):+hledger recognises five main types of account, corresponding to the+account classes in the accounting equation: -account assets       ; type:Asset-account liabilities  ; type:Liability-account equity       ; type:Equity-account revenues     ; type:Revenue-account expenses     ; type:Expense+   'Asset', 'Liability', 'Equity', 'Revenue', 'Expense'. -   Account types declared with account type codes Or, you can write one-of those letters separated from the account name by two or more spaces,-but this should probably be considered deprecated as of hledger 1.13:+   These account types are important for controlling which accounts+appear in the balancesheet, balancesheetequity, incomestatement reports+(and probably for other things in future). +   Additionally, we recognise the 'Cash' type, which is also an 'Asset',+and which causes accounts to appear in the cashflow report.  ("Cash"+here means liquid assets, eg bank balances but typically not investments+or receivables.)  Declaring account types Generally, to make these+reports work you should declare your top-level accounts and their types,+using account directives with 'type:' tags.++   The tag's value should be one of: 'Asset', 'Liability', 'Equity',+'Revenue', 'Expense', 'Cash', 'A', 'L', 'E', 'R', 'X', 'C' (all case+insensitive).  The type is inherited by all subaccounts except where+they override it.  Here's a complete example:++account assets       ; type: Asset+account assets:bank  ; type: Cash+account assets:cash  ; type: Cash+account liabilities  ; type: Liability+account equity       ; type: Equity+account revenues     ; type: Revenue+account expenses     ; type: Expense++   Auto-detected account types If you happen to use common english+top-level account names, you may not need to declare account types, as+they will be detected automatically using the following rules:++If name matches regular            account+expression:                        type is:+-------------------------------------------------+'^assets?(:|$)'                    'Asset'+'^(debts?|liabilit(y|ies))(:|$)'   'Liability'+'^equity(:|$)'                     'Equity'+'^(income|revenue)s?(:|$)'         'Revenue'+'^expenses?(:|$)'                  'Expense'++If account type is 'Asset' and name does not contain       account type+regular expression:                                        is:+--------------------------------------------------------------------------+'(investment|receivable|:A/R|:fixed)'                      'Cash'++   Even so, explicit declarations may be a good idea, for clarity and+predictability.  Interference from auto-detected account types If you+assign any account type, it's a good idea to assign all of them, to+prevent any confusion from mixing declared and auto-detected types.+Although it's unlikely to happen in real life, here's an example: with+the following journal, 'balancesheetequity' shows "liabilities" in both+Liabilities and Equity sections.  Declaring another account as+'type:Liability' would fix it:++account liabilities  ; type:Equity++2020-01-01+  assets        1+  liabilities   1+  equity       -2++   Old account type syntax In some hledger journals you might instead+see this old syntax (the letters ALERX, separated from the account name+by two or more spaces); this is deprecated and may be removed soon:+ account assets       A account liabilities  L account equity       E account revenues     R account expenses     X -   Overriding auto-detected types If you ever override the types of-those auto-detected english account names mentioned above, you might-need to help the reports a bit.  Eg:--; make "liabilities" not have the liability type - who knows why-account liabilities  ; type:E--; we need to ensure some other account has the liability type,-; otherwise balancesheet would still show "liabilities" under Liabilities-account -            ; type:L-  File: hledger_journal.info,  Node: Account display order,  Prev: Account types,  Up: Declaring accounts @@ -1406,7 +1443,7 @@ REPLACEMENT. If REGEX contains parenthesised match groups, these can be referenced by the usual numeric backreferences in REPLACEMENT. Eg: -alias /^(.+):bank:([^:]+)(.*)/ = \1:\2 \3+alias /^(.+):bank:([^:]+):(.*)/ = \1:\2 \3 ; rewrites "assets:bank:wells fargo:checking" to  "assets:wells fargo checking"     Also note that REPLACEMENT continues to the end of line (or on@@ -1828,124 +1865,124 @@  Tag Table: Node: Top76-Node: Transactions1873-Ref: #transactions1965-Node: Dates3249-Ref: #dates3348-Node: Simple dates3413-Ref: #simple-dates3539-Node: Secondary dates4048-Ref: #secondary-dates4202-Node: Posting dates5538-Ref: #posting-dates5667-Node: Status7039-Ref: #status7160-Node: Description8868-Ref: #description9002-Node: Payee and note9322-Ref: #payee-and-note9436-Node: Comments9771-Ref: #comments9897-Node: Tags11091-Ref: #tags11206-Node: Postings12599-Ref: #postings12727-Node: Virtual postings13753-Ref: #virtual-postings13870-Node: Account names15175-Ref: #account-names15316-Node: Amounts15803-Ref: #amounts15942-Node: Digit group marks17050-Ref: #digit-group-marks17198-Node: Amount display style18136-Ref: #amount-display-style18290-Node: Transaction prices19727-Ref: #transaction-prices19899-Node: Lot prices and lot dates22231-Ref: #lot-prices-and-lot-dates22428-Node: Balance assertions22916-Ref: #balance-assertions23102-Node: Assertions and ordering24135-Ref: #assertions-and-ordering24323-Node: Assertions and included files25023-Ref: #assertions-and-included-files25266-Node: Assertions and multiple -f options25599-Ref: #assertions-and-multiple--f-options25855-Node: Assertions and commodities25987-Ref: #assertions-and-commodities26219-Node: Assertions and prices27376-Ref: #assertions-and-prices27590-Node: Assertions and subaccounts28030-Ref: #assertions-and-subaccounts28259-Node: Assertions and virtual postings28583-Ref: #assertions-and-virtual-postings28825-Node: Assertions and precision28967-Ref: #assertions-and-precision29160-Node: Balance assignments29427-Ref: #balance-assignments29601-Node: Balance assignments and prices30765-Ref: #balance-assignments-and-prices30937-Node: Directives31161-Ref: #directives31320-Node: Directives and multiple files37011-Ref: #directives-and-multiple-files37194-Node: Comment blocks37858-Ref: #comment-blocks38041-Node: Including other files38217-Ref: #including-other-files38397-Node: Default year39321-Ref: #default-year39490-Node: Declaring commodities39897-Ref: #declaring-commodities40080-Node: Default commodity41886-Ref: #default-commodity42072-Node: Declaring market prices42961-Ref: #declaring-market-prices43156-Node: Declaring accounts44013-Ref: #declaring-accounts44199-Node: Account comments45124-Ref: #account-comments45287-Node: Account subdirectives45711-Ref: #account-subdirectives45906-Node: Account types46219-Ref: #account-types46403-Node: Account display order48042-Ref: #account-display-order48212-Node: Rewriting accounts49363-Ref: #rewriting-accounts49548-Node: Basic aliases50305-Ref: #basic-aliases50451-Node: Regex aliases51155-Ref: #regex-aliases51327-Node: Combining aliases52045-Ref: #combining-aliases52238-Node: Aliases and multiple files53514-Ref: #aliases-and-multiple-files53723-Node: end aliases54302-Ref: #end-aliases54459-Node: Default parent account54560-Ref: #default-parent-account54728-Node: Periodic transactions55612-Ref: #periodic-transactions55787-Node: Periodic rule syntax57659-Ref: #periodic-rule-syntax57865-Node: Two spaces between period expression and description!58569-Ref: #two-spaces-between-period-expression-and-description58888-Node: Forecasting with periodic transactions59572-Ref: #forecasting-with-periodic-transactions59877-Node: Budgeting with periodic transactions61932-Ref: #budgeting-with-periodic-transactions62171-Node: Auto postings62620-Ref: #auto-postings62760-Node: Auto postings and multiple files64939-Ref: #auto-postings-and-multiple-files65143-Node: Auto postings and dates65352-Ref: #auto-postings-and-dates65626-Node: Auto postings and transaction balancing / inferred amounts / balance assertions65801-Ref: #auto-postings-and-transaction-balancing-inferred-amounts-balance-assertions66152-Node: Auto posting tags66494-Ref: #auto-posting-tags66709+Node: Transactions1875+Ref: #transactions1967+Node: Dates3251+Ref: #dates3350+Node: Simple dates3415+Ref: #simple-dates3541+Node: Secondary dates4050+Ref: #secondary-dates4204+Node: Posting dates5540+Ref: #posting-dates5669+Node: Status7041+Ref: #status7162+Node: Description8870+Ref: #description9004+Node: Payee and note9324+Ref: #payee-and-note9438+Node: Comments9773+Ref: #comments9899+Node: Tags11093+Ref: #tags11208+Node: Postings12601+Ref: #postings12729+Node: Virtual postings13755+Ref: #virtual-postings13872+Node: Account names15177+Ref: #account-names15318+Node: Amounts15805+Ref: #amounts15944+Node: Digit group marks17052+Ref: #digit-group-marks17200+Node: Amount display style18138+Ref: #amount-display-style18292+Node: Transaction prices19729+Ref: #transaction-prices19901+Node: Lot prices and lot dates22332+Ref: #lot-prices-and-lot-dates22529+Node: Balance assertions23017+Ref: #balance-assertions23203+Node: Assertions and ordering24236+Ref: #assertions-and-ordering24424+Node: Assertions and included files25124+Ref: #assertions-and-included-files25367+Node: Assertions and multiple -f options25700+Ref: #assertions-and-multiple--f-options25956+Node: Assertions and commodities26088+Ref: #assertions-and-commodities26320+Node: Assertions and prices27477+Ref: #assertions-and-prices27691+Node: Assertions and subaccounts28131+Ref: #assertions-and-subaccounts28360+Node: Assertions and virtual postings28684+Ref: #assertions-and-virtual-postings28926+Node: Assertions and precision29068+Ref: #assertions-and-precision29261+Node: Balance assignments29528+Ref: #balance-assignments29702+Node: Balance assignments and prices30866+Ref: #balance-assignments-and-prices31038+Node: Directives31262+Ref: #directives31421+Node: Directives and multiple files37112+Ref: #directives-and-multiple-files37295+Node: Comment blocks37959+Ref: #comment-blocks38142+Node: Including other files38318+Ref: #including-other-files38498+Node: Default year39422+Ref: #default-year39591+Node: Declaring commodities39998+Ref: #declaring-commodities40181+Node: Default commodity41987+Ref: #default-commodity42173+Node: Declaring market prices43062+Ref: #declaring-market-prices43257+Node: Declaring accounts44114+Ref: #declaring-accounts44300+Node: Account comments45225+Ref: #account-comments45388+Node: Account subdirectives45812+Ref: #account-subdirectives46007+Node: Account types46320+Ref: #account-types46504+Node: Account display order49550+Ref: #account-display-order49720+Node: Rewriting accounts50871+Ref: #rewriting-accounts51056+Node: Basic aliases51813+Ref: #basic-aliases51959+Node: Regex aliases52663+Ref: #regex-aliases52835+Node: Combining aliases53554+Ref: #combining-aliases53747+Node: Aliases and multiple files55023+Ref: #aliases-and-multiple-files55232+Node: end aliases55811+Ref: #end-aliases55968+Node: Default parent account56069+Ref: #default-parent-account56237+Node: Periodic transactions57121+Ref: #periodic-transactions57296+Node: Periodic rule syntax59168+Ref: #periodic-rule-syntax59374+Node: Two spaces between period expression and description!60078+Ref: #two-spaces-between-period-expression-and-description60397+Node: Forecasting with periodic transactions61081+Ref: #forecasting-with-periodic-transactions61386+Node: Budgeting with periodic transactions63441+Ref: #budgeting-with-periodic-transactions63680+Node: Auto postings64129+Ref: #auto-postings64269+Node: Auto postings and multiple files66448+Ref: #auto-postings-and-multiple-files66652+Node: Auto postings and dates66861+Ref: #auto-postings-and-dates67135+Node: Auto postings and transaction balancing / inferred amounts / balance assertions67310+Ref: #auto-postings-and-transaction-balancing-inferred-amounts-balance-assertions67661+Node: Auto posting tags68003+Ref: #auto-posting-tags68218  End Tag Table 
embeddedfiles/hledger_journal.txt view
@@ -472,11 +472,14 @@                     assets:euros     EUR100          ; one hundred euros purchased                     assets:dollars  $-135          ; for $135 -       5. Like 1 and 2, but the @ or @@ is parenthesised; this is for compati--          bility  with Ledger journals (Virtual posting costs), and in hledger-          is equivalent to 1 and 2.+       4. Like 1, but the @ is parenthesised, i.e.  (@); this is for  compati-+          bility  with Ledger journals (Virtual posting costs), and is equiva-+          lent to 1 in hledger. -       Use the -B/--cost flag to convert amounts to their transaction  price's+       5. Like 2, but as in 4 the @@ is parenthesised, i.e.  (@@); in hledger,+          this is equivalent to 2.++       Use  the -B/--cost flag to convert amounts to their transaction price's        commodity, if any.  (mnemonic: "B" is from "cost Basis", as in Ledger).        Eg here is how -B affects the balance report for the example above: @@ -487,8 +490,8 @@                              $-135  assets:dollars                               $135  assets:euros    # <- the euros' cost -       Note -B is sensitive to the order of postings when a transaction  price-       is  inferred:  the  inferred price will be in the commodity of the last+       Note  -B is sensitive to the order of postings when a transaction price+       is inferred: the inferred price will be in the commodity  of  the  last        amount.  So if example 3's postings are reversed, while the transaction        is equivalent, -B shows something different: @@ -501,18 +504,18 @@                               EUR100  assets:euros     Lot prices and lot dates-       Ledger  allows  another kind of price, lot price (four variants: {UNIT-+       Ledger allows another kind of price, lot price (four  variants:  {UNIT-        PRICE},   {{TOTALPRICE}},   {=FIXEDUNITPRICE},   {{=FIXEDTOTALPRICE}}),        and/or a lot date ([DATE]) to be specified.  These are normally used to-       select a lot when selling investments.  hledger will parse  these,  for-       compatibility  with  Ledger  journals,  but  currently ignores them.  A-       transaction price, lot price and/or lot date may appear in  any  order,+       select  a  lot when selling investments.  hledger will parse these, for+       compatibility with Ledger journals,  but  currently  ignores  them.   A+       transaction  price,  lot price and/or lot date may appear in any order,        after the posting amount and before the balance assertion if any.     Balance assertions-       hledger  supports  Ledger-style  balance  assertions  in journal files.-       These look like, for example, = EXPECTEDBALANCE following  a  posting's-       amount.   Eg  here  we assert the expected dollar balance in accounts a+       hledger supports Ledger-style  balance  assertions  in  journal  files.+       These  look  like, for example, = EXPECTEDBALANCE following a posting's+       amount.  Eg here we assert the expected dollar balance  in  accounts  a        and b after each posting:                2013/1/1@@ -524,32 +527,32 @@                 b  $-1  =$-2         After reading a journal file, hledger will check all balance assertions-       and  report  an error if any of them fail.  Balance assertions can pro--       tect you from, eg, inadvertently disrupting reconciled  balances  while-       cleaning  up  old  entries.   You can disable them temporarily with the+       and report an error if any of them fail.  Balance assertions  can  pro-+       tect  you  from, eg, inadvertently disrupting reconciled balances while+       cleaning up old entries.  You can disable  them  temporarily  with  the        -I/--ignore-assertions flag, which can be useful for troubleshooting or-       for  reading Ledger files.  (Note: this flag currently does not disable+       for reading Ledger files.  (Note: this flag currently does not  disable        balance assignments, below).     Assertions and ordering-       hledger sorts an account's postings and assertions first  by  date  and-       then  (for postings on the same day) by parse order.  Note this is dif-+       hledger  sorts  an  account's postings and assertions first by date and+       then (for postings on the same day) by parse order.  Note this is  dif-        ferent from Ledger, which sorts assertions only by parse order.  (Also,-       Ledger  assertions  do not see the accumulated effect of repeated post-+       Ledger assertions do not see the accumulated effect of  repeated  post-        ings to the same account within a transaction.)         So, hledger balance assertions keep working if you reorder differently--       dated  transactions  within the journal.  But if you reorder same-dated-       transactions or postings, assertions might break and require  updating.+       dated transactions within the journal.  But if you  reorder  same-dated+       transactions  or postings, assertions might break and require updating.        This order dependence does bring an advantage: precise control over the        order of postings and assertions within a day, so you can assert intra-        day balances.     Assertions and included files-       With  included  files, things are a little more complicated.  Including-       preserves the ordering of postings and assertions.  If you have  multi--       ple  postings  to  an  account  on the same day, split across different-       files, and you also want to assert the account's balance  on  the  same+       With included files, things are a little more  complicated.   Including+       preserves  the ordering of postings and assertions.  If you have multi-+       ple postings to an account on the  same  day,  split  across  different+       files,  and  you  also want to assert the account's balance on the same        day, you'll have to put the assertion in the right file.     Assertions and multiple -f options@@ -557,15 +560,15 @@        -f options.  Use include or concatenate the files instead.     Assertions and commodities-       The asserted balance must be a simple single-commodity amount,  and  in-       fact  the  assertion  checks  only  this commodity's balance within the-       (possibly multi-commodity) account balance.   This  is  how  assertions+       The  asserted  balance must be a simple single-commodity amount, and in+       fact the assertion checks only  this  commodity's  balance  within  the+       (possibly  multi-commodity)  account  balance.   This is how assertions        work in Ledger also.  We could call this a "partial" balance assertion.         To assert the balance of more than one commodity in an account, you can        write multiple postings, each asserting one commodity's balance. -       You can make a stronger "total" balance assertion by writing  a  double+       You  can  make a stronger "total" balance assertion by writing a double        equals sign (== EXPECTEDBALANCE).  This asserts that there are no other        unasserted commodities in the account (or, that their balance is 0). @@ -585,7 +588,7 @@                 a    0 ==  $1         It's not yet possible to make a complete assertion about a balance that-       has  multiple commodities.  One workaround is to isolate each commodity+       has multiple commodities.  One workaround is to isolate each  commodity        into its own subaccount:                2013/1/1@@ -599,21 +602,21 @@                 a:euro   0 ==  1EUR     Assertions and prices-       Balance assertions ignore transaction prices, and  should  normally  be+       Balance  assertions  ignore  transaction prices, and should normally be        written without one:                2019/1/1                 (a)     $1 @ EUR1 = $1 -       We  do allow prices to be written there, however, and print shows them,-       even though they don't affect whether the assertion  passes  or  fails.-       This  is  for  backward  compatibility (hledger's close command used to-       generate balance assertions with prices), and because  balance  assign-+       We do allow prices to be written there, however, and print shows  them,+       even  though  they  don't affect whether the assertion passes or fails.+       This is for backward compatibility (hledger's  close  command  used  to+       generate  balance  assertions with prices), and because balance assign-        ments do use them (see below).     Assertions and subaccounts-       The  balance  assertions above (= and ==) do not count the balance from-       subaccounts; they check the account's exclusive balance only.  You  can+       The balance assertions above (= and ==) do not count the  balance  from+       subaccounts;  they check the account's exclusive balance only.  You can        assert the balance including subaccounts by writing =* or ==*, eg:                2019/1/1@@ -627,16 +630,16 @@        tual.  They are not affected by the --real/-R flag or real: query.     Assertions and precision-       Balance assertions compare the exactly calculated  amounts,  which  are-       not  always  what  is  shown  by reports.  Eg a commodity directive may-       limit the display precision, but this will not  affect  balance  asser-+       Balance  assertions  compare  the exactly calculated amounts, which are+       not always what is shown by reports.   Eg  a  commodity  directive  may+       limit  the  display  precision, but this will not affect balance asser-        tions.  Balance assertion failure messages show exact amounts.     Balance assignments-       Ledger-style  balance  assignments  are also supported.  These are like-       balance assertions, but with no posting amount on the left side of  the-       equals  sign;  instead  it is calculated automatically so as to satisfy-       the assertion.  This can be a convenience during data  entry,  eg  when+       Ledger-style balance assignments are also supported.   These  are  like+       balance  assertions, but with no posting amount on the left side of the+       equals sign; instead it is calculated automatically so  as  to  satisfy+       the  assertion.   This  can be a convenience during data entry, eg when        setting opening balances:                ; starting a new journal, set asset account balances@@ -654,14 +657,14 @@                 expenses:misc         The calculated amount depends on the account's balance in the commodity-       at that point (which depends on the previously-dated  postings  of  the-       commodity  to  that account since the last balance assertion or assign-+       at  that  point  (which depends on the previously-dated postings of the+       commodity to that account since the last balance assertion  or  assign-        ment).  Note that using balance assignments makes your journal a little        less explicit; to know the exact amount posted, you have to run hledger        or do the calculations yourself, instead of just reading it.     Balance assignments and prices-       A transaction price in a balance assignment will cause  the  calculated+       A  transaction  price in a balance assignment will cause the calculated        amount to have that price attached:                2019/1/1@@ -672,87 +675,88 @@                   (a)         $1 @ EUR2 = $1 @ EUR2     Directives-       A  directive is a line in the journal beginning with a special keyword,+       A directive is a line in the journal beginning with a special  keyword,        that influences how the journal is processed.  hledger's directives are        based on a subset of Ledger's, but there are many differences (and also        some differences between hledger versions).         Directives' behaviour and interactions can get a little bit complex, so-       here  is  a  table  summarising  the directives and their effects, with+       here is a table summarising the  directives  and  their  effects,  with        links to more detailed docs. -       direc-     end   di-   subdi-    purpose                        can affect  (as  of+       direc-     end   di-   subdi-    purpose                        can  affect  (as of        tive       rective     rec-                                     2018/06)                               tives        -------------------------------------------------------------------------------------       account                any       document account names,  de-   all entries in  all-                              text      clare  account  types & dis-   files,   before  or+       account                any       document  account names, de-   all  entries in all+                              text      clare account types  &  dis-   files,  before   or                                         play order                     after        alias      end                   rewrite account names          following       in-                   aliases                                              line/included   en--                                                                       tries  until end of+                                                                       tries until end  of                                                                        current file or end                                                                        directive-       apply      end apply             prepend  a  common parent to   following       in-+       apply      end apply             prepend a common  parent  to   following       in-        account    account               account names                  line/included   en--                                                                       tries until end  of+                                                                       tries  until end of                                                                        current file or end                                                                        directive        comment    end  com-             ignore part of journal         following       in-                   ment                                                 line/included   en--                                                                       tries  until end of+                                                                       tries until end  of                                                                        current file or end                                                                        directive-       commod-                format    declare a commodity and  its   number    notation:+       commod-                format    declare  a commodity and its   number    notation:        ity                              number  notation  &  display   following   entries                                         style                          in  that  commodity-                                                                       in  all files; dis-+                                                                       in all files;  dis-                                                                        play style: amounts                                                                        of  that  commodity                                                                        in reports-       D                                declare a  commodity  to  be   default  commodity:+       D                                declare  a  commodity  to be   default  commodity:                                         used    for    commodityless   following   commod--                                        amounts, and its number  no-   ityless entries un--                                        tation & display style         til end of  current-                                                                       file;  number nota-+                                        amounts,  and its number no-   ityless entries un-+                                        tation & display style         til  end of current+                                                                       file; number  nota-                                                                        tion: following en--                                                                       tries  in that com-+                                                                       tries in that  com-                                                                        modity until end of-                                                                       current  file; dis-+                                                                       current file;  dis-                                                                        play style: amounts                                                                        of  that  commodity                                                                        in reports        include                          include   entries/directives   what  the  included                                         from another file              directives affect        P                                declare a market price for a   amounts   of   that-                                        commodity                      commodity  in   re--                                                                       ports,  when  -V is+                                        commodity                      commodity   in  re-+                                                                       ports, when  -V  is                                                                        used   -       Y                                declare a year for  yearless   following       in-++       Y                                declare  a year for yearless   following       in-                                         dates                          line/included   en--                                                                       tries  until end of+                                                                       tries until end  of                                                                        current file-       =                                declare  an   auto   posting   all entries in par--                                        rule,   adding  postings  to   ent/current/child+       =                                declare   an   auto  posting   all entries in par-+                                        rule,  adding  postings   to   ent/current/child                                         other transactions             files (but not sib-                                                                        ling   files,   see                                                                        #1212)         And some definitions: -       subdi-   optional indented directive line immediately following a  parent+       subdi-   optional  indented directive line immediately following a parent        rec-     directive        tive        number   how to interpret numbers when parsing journal entries (the iden--       nota-    tity of the decimal separator character).  (Currently each  com-+       nota-    tity  of the decimal separator character).  (Currently each com-        tion     modity can have its own notation, even in the same file.)-       dis-     how  to  display  amounts of a commodity in reports (symbol side+       dis-     how to display amounts of a commodity in  reports  (symbol  side        play     and spacing, digit groups, decimal separator, decimal places)        style-       direc-   which entries and (when there are multiple  files)  which  files+       direc-   which  entries  and  (when there are multiple files) which files        tive     are affected by a directive        scope @@ -761,35 +765,35 @@        ports).  Some directives have multiple effects.     Directives and multiple files-       If  you  use  multiple  -f/--file  options,  or  the include directive,-       hledger will process multiple input files.  But  note  that  directives+       If you use  multiple  -f/--file  options,  or  the  include  directive,+       hledger  will  process  multiple input files.  But note that directives        which affect input (see above) typically last only until the end of the        file in which they occur.         This may seem inconvenient, but it's intentional; it makes reports sta--       ble  and  deterministic,  independent of the order of input.  Otherwise-       you could see different numbers if you happened to write -f options  in-       a  different  order,  or if you moved includes around while cleaning up+       ble and deterministic, independent of the order  of  input.   Otherwise+       you  could see different numbers if you happened to write -f options in+       a different order, or if you moved includes around  while  cleaning  up        your files. -       It can be surprising though; for example, it means  that  alias  direc-+       It  can  be  surprising though; for example, it means that alias direc-        tives do not affect parent or sibling files (see below).     Comment blocks-       A  line  containing just comment starts a commented region of the file,+       A line containing just comment starts a commented region of  the  file,        and a line containing just end comment (or the end of the current file)        ends it.  See also comments.     Including other files-       You  can  pull in the content of additional files by writing an include+       You can pull in the content of additional files by writing  an  include        directive, like this:                include FILEPATH -       Only journal files can include, and only journal, timeclock or  timedot+       Only  journal files can include, and only journal, timeclock or timedot        files can be included (not CSV files, currently). -       If  the  file  path  does not begin with a slash, it is relative to the+       If the file path does not begin with a slash, it  is  relative  to  the        current file's folder.         A tilde means home directory, eg: include ~/main.journal.@@ -798,17 +802,17 @@        *.journal.         There is limited support for recursive wildcards: **/ (the slash is re--       quired) matches 0 or more subdirectories.  It's  not  super  convenient-       since  you  have to avoid include cycles and including directories, but+       quired)  matches  0  or more subdirectories.  It's not super convenient+       since you have to avoid include cycles and including  directories,  but        this can be done, eg: include */**/*.journal.         The path may also be prefixed to force a specific file format, overrid--       ing  the file extension (as described in hledger.1 -> Input files): in-+       ing the file extension (as described in hledger.1 -> Input files):  in-        clude timedot:~/notes/2020*.md.     Default year-       You can set a default year to be used for subsequent dates which  don't-       specify  a year.  This is a line beginning with Y followed by the year.+       You  can set a default year to be used for subsequent dates which don't+       specify a year.  This is a line beginning with Y followed by the  year.        Eg:                Y2009  ; set default year to 2009@@ -830,19 +834,19 @@    Declaring commodities        The commodity directive has several functions: -       1. It declares commodities which may be used in the journal.   This  is+       1. It  declares  commodities which may be used in the journal.  This is           currently not enforced, but can serve as documentation. -       2. It  declares what decimal mark character (period or comma) to expect-          when parsing input - useful  to  disambiguate  international  number-          formats  in your data.  (Without this, hledger will parse both 1,000+       2. It declares what decimal mark character (period or comma) to  expect+          when  parsing  input  -  useful to disambiguate international number+          formats in your data.  (Without this, hledger will parse both  1,000           and 1.000 as 1). -       3. It declares the amount display style to use in output - decimal  and+       3. It  declares the amount display style to use in output - decimal and           digit group marks, number of decimal places, symbol placement etc. -       You  are likely to run into one of the problems solved by commodity di--       rectives, sooner or later, so it's a good idea to just always use  them+       You are likely to run into one of the problems solved by commodity  di-+       rectives,  sooner or later, so it's a good idea to just always use them        to declare your commodities.         A commodity directive is just the word commodity followed by an amount.@@ -855,8 +859,8 @@               ; separating thousands with comma.               commodity 1,000.0000 AAAA -       or on multiple lines, using the "format" subdirective.  (In  this  case-       the  commodity  symbol  appears  twice  and  should be the same in both+       or  on  multiple lines, using the "format" subdirective.  (In this case+       the commodity symbol appears twice and  should  be  the  same  in  both        places.):                ; commodity SYMBOL@@ -869,22 +873,22 @@                 format INR 1,00,00,000.00         The quantity of the amount does not matter; only the format is signifi--       cant.   The  number  must  include a decimal mark: either a period or a+       cant.  The number must include a decimal mark: either  a  period  or  a        comma, followed by 0 or more decimal digits. -       Note hledger normally uses banker's rounding,  so  0.5  displayed  with+       Note  hledger  normally  uses  banker's rounding, so 0.5 displayed with        zero decimal digits is "0".  (More at Amount display style.)     Default commodity-       The  D directive sets a default commodity, to be used for amounts with-+       The D directive sets a default commodity, to be used for amounts  with-        out a commodity symbol (ie, plain numbers).  This commodity will be ap-        plied to all subsequent commodity-less amounts, or until the next D di-        rective.  (Note, this is different from Ledger's D.) -       For compatibility/historical reasons, D also acts like a commodity  di-+       For  compatibility/historical reasons, D also acts like a commodity di-        rective, setting the commodity's display style (for output) and decimal        mark (for parsing input).  As with commodity, the amount must always be-       written  with a decimal mark (period or comma).  If both directives are+       written with a decimal mark (period or comma).  If both directives  are        used, commodity's style takes precedence.         The syntax is D AMOUNT.  Eg:@@ -898,9 +902,9 @@                 b     Declaring market prices-       The P directive declares a market price, which is an exchange rate  be--       tween  two  commodities on a certain date.  (In Ledger, they are called-       "historical prices".) These are often obtained from a  stock  exchange,+       The  P directive declares a market price, which is an exchange rate be-+       tween two commodities on a certain date.  (In Ledger, they  are  called+       "historical  prices".)  These are often obtained from a stock exchange,        cryptocurrency exchange, or the foreign exchange market.         Here is the format:@@ -911,16 +915,16 @@         o COMMODITYA is the symbol of the commodity being priced -       o COMMODITYBAMOUNT  is an amount (symbol and quantity) in a second com-+       o COMMODITYBAMOUNT is an amount (symbol and quantity) in a second  com-          modity, giving the price in commodity B of one unit of commodity A. -       These two market price directives say that one euro was worth  1.35  US+       These  two  market price directives say that one euro was worth 1.35 US        dollars during 2009, and $1.40 from 2010 onward:                P 2009/1/1 EUR $1.35               P 2010/1/1 EUR $1.40 -       The  -V,  -X  and  --value flags use these market prices to show amount+       The -V, -X and --value flags use these market  prices  to  show  amount        values in another commodity.  See Valuation.     Declaring accounts@@ -930,20 +934,20 @@        o They can document your intended chart of accounts, providing a refer-          ence. -       o They can store extra information  about  accounts  (account  numbers,+       o They  can  store  extra  information about accounts (account numbers,          notes, etc.) -       o They  can  help  hledger know your accounts' types (asset, liability,-         equity, revenue, expense), useful for reports like  balancesheet  and+       o They can help hledger know your accounts'  types  (asset,  liability,+         equity,  revenue,  expense), useful for reports like balancesheet and          incomestatement. -       o They  control  account  display order in reports, allowing non-alpha-+       o They control account display order in  reports,  allowing  non-alpha-          betic sorting (eg Revenues to appear above Expenses). -       o They help with account name completion in the add  command,  hledger-+       o They  help  with account name completion in the add command, hledger-          iadd, hledger-web, ledger-mode etc. -       The  simplest form is just the word account followed by a hledger-style+       The simplest form is just the word account followed by a  hledger-style        account name, eg:                account assets:bank:checking@@ -951,7 +955,7 @@    Account comments        Comments, beginning with a semicolon, can be added: -       o on the same line, after two or more spaces (because ; is  allowed  in+       o on  the  same line, after two or more spaces (because ; is allowed in          account names)         o on the next lines, indented@@ -965,7 +969,7 @@        Same-line comments are not supported by Ledger, or hledger <1.13.     Account subdirectives-       We  also  allow  (and ignore) Ledger-style indented subdirectives, just+       We also allow (and ignore) Ledger-style  indented  subdirectives,  just        for compatibility.:                account assets:bank:checking@@ -978,52 +982,89 @@                 [LEDGER-STYLE SUBDIRECTIVES, IGNORED]     Account types-       hledger recognises five types (or classes) of account:  Asset,  Liabil--       ity,  Equity, Revenue, Expense.  This is used by a few accounting-aware-       reports such as balancesheet, incomestatement and cashflow.+       hledger recognises five main types of account, corresponding to the ac-+       count classes in the accounting equation: +       Asset, Liability, Equity, Revenue, Expense.++       These account types are important for controlling which accounts appear+       in  the  balancesheet, balancesheetequity, incomestatement reports (and+       probably for other things in future).++       Additionally, we recognise the Cash type, which is also an  Asset,  and+       which  causes  accounts to appear in the cashflow report.  ("Cash" here+       means liquid assets, eg bank balances but typically not investments  or+       receivables.)++   Declaring account types+       Generally, to make these reports work you should declare your top-level+       accounts and their types, using account directives with type: tags.++       The tag's value should be one of: Asset,  Liability,  Equity,  Revenue,+       Expense,  Cash,  A,  L, E, R, X, C (all case insensitive).  The type is+       inherited by all subaccounts except where they override it.   Here's  a+       complete example:++              account assets       ; type: Asset+              account assets:bank  ; type: Cash+              account assets:cash  ; type: Cash+              account liabilities  ; type: Liability+              account equity       ; type: Equity+              account revenues     ; type: Revenue+              account expenses     ; type: Expense+    Auto-detected account types-       If you name your top-level accounts with some variation of assets, lia--       bilities/debts,  equity,  revenues/income, or expenses, their types are-       detected automatically.+       If  you  happen  to use common english top-level account names, you may+       not need to declare account types, as they will be  detected  automati-+       cally using the following rules: -   Account types declared with tags-       More generally, you can declare an account's type with an  account  di--       rective,  by  writing  a type: tag in a comment, followed by one of the-       words Asset, Liability, Equity, Revenue, Expense, or one of the letters-       ALERX (case insensitive):+       If  name  matches  regular   account type is:+       expression:+       ----------------------------------------------+       ^assets?(:|$)                Asset+       ^(debts?|lia-                Liability+       bilit(y|ies))(:|$)+       ^equity(:|$)                 Equity+       ^(income|revenue)s?(:|$)     Revenue+       ^expenses?(:|$)              Expense -              account assets       ; type:Asset-              account liabilities  ; type:Liability-              account equity       ; type:Equity-              account revenues     ; type:Revenue-              account expenses     ; type:Expense+       If  account type is Asset and name does not contain regu-   account  type+       lar expression:                                             is:+       --------------------------------------------------------------------------+       (investment|receivable|:A/R|:fixed)                         Cash -   Account types declared with account type codes-       Or,  you can write one of those letters separated from the account name-       by two or more spaces, but this should probably  be  considered  depre--       cated as of hledger 1.13:+       Even so, explicit declarations may be a good idea, for clarity and pre-+       dictability. +   Interference from auto-detected account types+       If you assign any account type, it's a good idea to assign all of them,+       to  prevent any confusion from mixing declared and auto-detected types.+       Although it's unlikely to happen in real life, here's an example:  with+       the  following  journal, balancesheetequity shows "liabilities" in both+       Liabilities and Equity sections.  Declaring another account as type:Li-+       ability would fix it:++              account liabilities  ; type:Equity++              2020-01-01+                assets        1+                liabilities   1+                equity       -2++   Old account type syntax+       In  some  hledger  journals  you might instead see this old syntax (the+       letters ALERX, separated from the account name by two or more  spaces);+       this is deprecated and may be removed soon:+               account assets       A               account liabilities  L               account equity       E               account revenues     R               account expenses     X -   Overriding auto-detected types-       If  you  ever override the types of those auto-detected english account-       names mentioned above, you might need to help the reports a bit.  Eg:--              ; make "liabilities" not have the liability type - who knows why-              account liabilities  ; type:E--              ; we need to ensure some other account has the liability type,-              ; otherwise balancesheet would still show "liabilities" under Liabilities-              account -            ; type:L-    Account display order-       Account directives also set the order in which accounts are  displayed,-       eg  in  reports,  the  hledger-ui  accounts screen, and the hledger-web+       Account  directives also set the order in which accounts are displayed,+       eg in reports, the hledger-ui  accounts  screen,  and  the  hledger-web        sidebar.  By default accounts are listed in alphabetical order.  But if        you have these account directives in the journal: @@ -1045,20 +1086,20 @@         Undeclared accounts, if any, are displayed last, in alphabetical order. -       Note that sorting is done at each level of  the  account  tree  (within-       each  group of sibling accounts under the same parent).  And currently,+       Note  that  sorting  is  done at each level of the account tree (within+       each group of sibling accounts under the same parent).  And  currently,        this directive:                account other:zoo -       would influence the position of zoo among other's subaccounts, but  not+       would  influence the position of zoo among other's subaccounts, but not        the position of other among the top-level accounts.  This means: -       o you  will  sometimes declare parent accounts (eg account other above)+       o you will sometimes declare parent accounts (eg account  other  above)          that you don't intend to post to, just to customize their display or-          der -       o sibling  accounts  stay together (you couldn't display x:y in between+       o sibling accounts stay together (you couldn't display x:y  in  between          a:b and a:c).     Rewriting accounts@@ -1076,14 +1117,14 @@        o customising reports         Account aliases also rewrite account names in account directives.  They-       do not affect account names being entered via hledger add  or  hledger-+       do  not  affect account names being entered via hledger add or hledger-        web.         See also Rewrite account names.     Basic aliases-       To  set an account alias, use the alias directive in your journal file.-       This affects all subsequent journal entries in the current file or  its+       To set an account alias, use the alias directive in your journal  file.+       This  affects all subsequent journal entries in the current file or its        included files.  The spaces around the = are optional:                alias OLD = NEW@@ -1091,49 +1132,49 @@        Or, you can use the --alias 'OLD=NEW' option on the command line.  This        affects all entries.  It's useful for trying out aliases interactively. -       OLD and NEW are case sensitive full account names.   hledger  will  re--       place  any occurrence of the old account name with the new one.  Subac-+       OLD  and  NEW  are case sensitive full account names.  hledger will re-+       place any occurrence of the old account name with the new one.   Subac-        counts are also affected.  Eg:                alias checking = assets:bank:wells fargo:checking               ; rewrites "checking" to "assets:bank:wells fargo:checking", or "checking:a" to "assets:bank:wells fargo:checking:a"     Regex aliases-       There is also a more powerful variant that uses a  regular  expression,+       There  is  also a more powerful variant that uses a regular expression,        indicated by the forward slashes:                alias /REGEX/ = REPLACEMENT         or --alias '/REGEX/=REPLACEMENT'. -       REGEX  is  a  case-insensitive regular expression.  Anywhere it matches-       inside an account name, the matched part will be replaced  by  REPLACE--       MENT.   If REGEX contains parenthesised match groups, these can be ref-+       REGEX is a case-insensitive regular expression.   Anywhere  it  matches+       inside  an  account name, the matched part will be replaced by REPLACE-+       MENT.  If REGEX contains parenthesised match groups, these can be  ref-        erenced by the usual numeric backreferences in REPLACEMENT.  Eg: -              alias /^(.+):bank:([^:]+)(.*)/ = \1:\2 \3+              alias /^(.+):bank:([^:]+):(.*)/ = \1:\2 \3               ; rewrites "assets:bank:wells fargo:checking" to  "assets:wells fargo checking" -       Also note that REPLACEMENT continues to the end of line (or on  command-       line,  to  end  of  option argument), so it can contain trailing white-+       Also  note that REPLACEMENT continues to the end of line (or on command+       line, to end of option argument), so it  can  contain  trailing  white-        space.     Combining aliases-       You can define as many aliases as you like,  using  journal  directives+       You  can  define  as many aliases as you like, using journal directives        and/or command line options. -       Recursive  aliases  -  where an account name is rewritten by one alias,-       then by another alias, and so on - are allowed.  Each  alias  sees  the+       Recursive aliases - where an account name is rewritten  by  one  alias,+       then  by  another  alias, and so on - are allowed.  Each alias sees the        effect of previously applied aliases. -       In  such  cases it can be important to understand which aliases will be-       applied and in which order.  For (each account name  in)  each  journal+       In such cases it can be important to understand which aliases  will  be+       applied  and  in  which order.  For (each account name in) each journal        entry, we apply: -       1. alias  directives  preceding the journal entry, most recently parsed+       1. alias directives preceding the journal entry, most  recently  parsed           first (ie, reading upward from the journal entry, bottom to top) -       2. --alias options, in the order they  appeared  on  the  command  line+       2. --alias  options,  in  the  order  they appeared on the command line           (left to right).         In other words, for (an account name in) a given journal entry:@@ -1144,20 +1185,20 @@         o aliases defined after/below the entry do not affect it. -       This  gives nearby aliases precedence over distant ones, and helps pro--       vide semantic stability - aliases will keep working the same way  inde-+       This gives nearby aliases precedence over distant ones, and helps  pro-+       vide  semantic stability - aliases will keep working the same way inde-        pendent of which files are being read and in which order. -       In  case  of  trouble,  adding  --debug=6 to the command line will show+       In case of trouble, adding --debug=6 to  the  command  line  will  show        which aliases are being applied when.     Aliases and multiple files-       As explained at Directives and multiple files, alias directives do  not+       As  explained at Directives and multiple files, alias directives do not        affect parent or sibling files.  Eg in this command,                hledger -f a.aliases -f b.journal -       account  aliases  defined  in a.aliases will not affect b.journal.  In-+       account aliases defined in a.aliases will not  affect  b.journal.   In-        cluding the aliases doesn't work either:                include a.aliases@@ -1179,14 +1220,14 @@               include c.journal  ; also affected     end aliases-       You  can  clear  (forget)  all  currently  defined aliases with the end+       You can clear (forget) all  currently  defined  aliases  with  the  end        aliases directive:                end aliases     Default parent account-       You can specify a parent account which will be  prepended  to  all  ac--       counts  within a section of the journal.  Use the apply account and end+       You  can  specify  a  parent account which will be prepended to all ac-+       counts within a section of the journal.  Use the apply account and  end        apply account directives like so:                apply account home@@ -1203,7 +1244,7 @@                   home:food           $10                   home:cash          $-10 -       If end apply account is omitted, the effect lasts to  the  end  of  the+       If  end  apply  account  is omitted, the effect lasts to the end of the        file.  Included files are also affected, eg:                apply account business@@ -1212,50 +1253,50 @@               apply account personal               include personal.journal -       Prior  to  hledger 1.0, legacy account and end spellings were also sup-+       Prior to hledger 1.0, legacy account and end spellings were  also  sup-        ported. -       A default parent account also affects account directives.  It does  not-       affect  account names being entered via hledger add or hledger-web.  If-       account aliases are present, they are applied after the default  parent+       A  default parent account also affects account directives.  It does not+       affect account names being entered via hledger add or hledger-web.   If+       account  aliases are present, they are applied after the default parent        account.     Periodic transactions-       Periodic  transaction rules describe transactions that recur.  They al--       low hledger to generate temporary  future  transactions  to  help  with-       forecasting,  so  you  don't have to write out each one in the journal,-       and it's easy to try out different forecasts.  Secondly, they are  also+       Periodic transaction rules describe transactions that recur.  They  al-+       low  hledger  to  generate  temporary  future transactions to help with+       forecasting, so you don't have to write out each one  in  the  journal,+       and  it's easy to try out different forecasts.  Secondly, they are also        used to define the budgets shown in budget reports. -       Periodic  transactions  can be a little tricky, so before you use them,+       Periodic transactions can be a little tricky, so before you  use  them,        read this whole section - or at least these tips: -       1. Two spaces accidentally added or omitted will cause  you  trouble  -+       1. Two  spaces  accidentally  added or omitted will cause you trouble -           read about this below. -       2. For  troubleshooting,  show  the generated transactions with hledger-          print  --forecast  tag:generated  or  hledger  register   --forecast+       2. For troubleshooting, show the generated  transactions  with  hledger+          print   --forecast  tag:generated  or  hledger  register  --forecast           tag:generated. -       3. Forecasted  transactions  will  begin  only after the last non-fore-+       3. Forecasted transactions will begin only  after  the  last  non-fore-           casted transaction's date. -       4. Forecasted transactions will end 6 months from  today,  by  default.+       4. Forecasted  transactions  will  end 6 months from today, by default.           See below for the exact start/end rules. -       5. period  expressions  can  be  tricky.  Their documentation needs im-+       5. period expressions can be tricky.   Their  documentation  needs  im-           provement, but is worth studying. -       6. Some period expressions with a repeating interval must  begin  on  a-          natural  boundary  of  that  interval.  Eg in weekly from DATE, DATE-          must be a monday.  ~ weekly from 2019/10/1 (a tuesday) will give  an+       6. Some  period  expressions  with a repeating interval must begin on a+          natural boundary of that interval.  Eg in  weekly  from  DATE,  DATE+          must  be a monday.  ~ weekly from 2019/10/1 (a tuesday) will give an           error.         7. Other period expressions with an interval are automatically expanded-          to cover a whole number of that interval.  (This is done to  improve+          to  cover a whole number of that interval.  (This is done to improve           reports, but it also affects periodic transactions.  Yes, it's a bit-          inconsistent with the above.) Eg: ~ every 10th  day  of  month  from-          2020/01,  which  is  equivalent  to  ~  every 10th day of month from+          inconsistent  with  the  above.)  Eg: ~ every 10th day of month from+          2020/01, which is equivalent to ~  every  10th  day  of  month  from           2020/01/01, will be adjusted to start on 2019/12/10.     Periodic rule syntax@@ -1267,17 +1308,17 @@                   expenses:rent          $2000                   assets:bank:checking -       There is an additional constraint on the period expression:  the  start-       date  must fall on a natural boundary of the interval.  Eg monthly from+       There  is  an additional constraint on the period expression: the start+       date must fall on a natural boundary of the interval.  Eg monthly  from        2018/1/1 is valid, but monthly from 2018/1/15 is not. -       Partial or relative dates (M/D, D, tomorrow, last week) in  the  period-       expression  can work (useful or not).  They will be relative to today's-       date, unless a Y default year directive is in  effect,  in  which  case+       Partial  or  relative dates (M/D, D, tomorrow, last week) in the period+       expression can work (useful or not).  They will be relative to  today's+       date,  unless  a  Y  default year directive is in effect, in which case        they will be relative to Y/1/1.     Two spaces between period expression and description!-       If  the  period  expression  is  followed by a transaction description,+       If the period expression is  followed  by  a  transaction  description,        these must be separated by two or more spaces.  This helps hledger know        where the period expression ends, so that descriptions can not acciden-        tally alter their meaning, as in this example:@@ -1291,68 +1332,68 @@         So, -       o Do write two spaces between your period expression and your  transac-+       o Do  write two spaces between your period expression and your transac-          tion description, if any. -       o Don't  accidentally write two spaces in the middle of your period ex-+       o Don't accidentally write two spaces in the middle of your period  ex-          pression.     Forecasting with periodic transactions-       The --forecast flag activates any periodic  transaction  rules  in  the-       journal.   They  will  generate temporary recurring transactions, which-       are not saved in the journal,  but  will  appear  in  all  reports  (eg+       The  --forecast  flag  activates  any periodic transaction rules in the+       journal.  They will generate temporary  recurring  transactions,  which+       are  not  saved  in  the  journal,  but  will appear in all reports (eg        print).  This can be useful for estimating balances into the future, or-       experimenting with different scenarios.  Or, it can be used as  a  data+       experimenting  with  different scenarios.  Or, it can be used as a data        entry aid: describe recurring transactions, and every so often copy the        output of print --forecast into the journal. -       These transactions will have an extra  tag  indicating  which  periodic+       These  transactions  will  have  an extra tag indicating which periodic        rule generated them: generated-transaction:~ PERIODICEXPR.  And a simi--       lar, hidden tag (beginning with  an  underscore)  which,  because  it's-       never  displayed  by print, can be used to match transactions generated+       lar,  hidden  tag  (beginning  with  an underscore) which, because it's+       never displayed by print, can be used to match  transactions  generated        "just now": _generated-transaction:~ PERIODICEXPR. -       Periodic transactions are generated within some  forecast  period.   By+       Periodic  transactions  are  generated within some forecast period.  By        default, this         o begins on the later of           o the report start date if specified with -b/-p/date: -         o the  day  after the latest normal (non-periodic) transaction in the+         o the day after the latest normal (non-periodic) transaction  in  the            journal, or today if there are no normal transactions. -       o ends on the report end date  if  specified  with  -e/-p/date:,  or  6+       o ends  on  the  report  end  date  if specified with -e/-p/date:, or 6          months (180 days) from today. -       This  means that periodic transactions will begin only after the latest-       recorded transaction.  And a recorded transaction dated in  the  future-       can  prevent  generation of periodic transactions.  (You can avoid that+       This means that periodic transactions will begin only after the  latest+       recorded  transaction.   And a recorded transaction dated in the future+       can prevent generation of periodic transactions.  (You can  avoid  that        by writing the future transaction as a one-time periodic rule instead -        put tilde before the date, eg ~ YYYY-MM-DD ...).         Or, you can set your own arbitrary "forecast period", which can overlap-       recorded transactions, and need not be in the future, by  providing  an-       option  argument,  like --forecast=PERIODEXPR.  Note the equals sign is+       recorded  transactions,  and need not be in the future, by providing an+       option argument, like --forecast=PERIODEXPR.  Note the equals  sign  is        required, a space won't work.  PERIODEXPR is a period expression, which-       can  specify  the start date, end date, or both, like in a date: query.-       (See also hledger.1 ->  Report  start  &  end  date).   Some  examples:+       can specify the start date, end date, or both, like in a  date:  query.+       (See  also  hledger.1  ->  Report  start  &  end date).  Some examples:        --forecast=202001-202004, --forecast=jan-, --forecast=2020.     Budgeting with periodic transactions-       With  the  --budget  flag,  currently supported by the balance command,-       each periodic transaction rule declares recurring budget goals for  the-       specified  accounts.   Eg  the  first  example above declares a goal of-       spending $2000 on rent (and also,  a  goal  of  depositing  $2000  into-       checking)  every  month.  Goals and actual performance can then be com-+       With the --budget flag, currently supported  by  the  balance  command,+       each  periodic transaction rule declares recurring budget goals for the+       specified accounts.  Eg the first example  above  declares  a  goal  of+       spending  $2000  on  rent  (and  also,  a goal of depositing $2000 into+       checking) every month.  Goals and actual performance can then  be  com-        pared in budget reports. -       For more details, see: balance: Budget report and Budgeting  and  Fore-+       For  more  details, see: balance: Budget report and Budgeting and Fore-        casting.     Auto postings-       "Automated  postings"  or  "auto postings" are extra postings which get-       added automatically to transactions which match  certain  queries,  de-+       "Automated postings" or "auto postings" are extra  postings  which  get+       added  automatically  to  transactions which match certain queries, de-        fined by "auto posting rules", when you use the --auto flag.         An auto posting rule looks a bit like a transaction:@@ -1362,27 +1403,27 @@                   ...                   ACCOUNT  [AMOUNT] -       except  the  first  line is an equals sign (mnemonic: = suggests match--       ing), followed by a query (which matches existing postings),  and  each-       "posting"  line  describes  a  posting to be generated, and the posting+       except the first line is an equals sign (mnemonic:  =  suggests  match-+       ing),  followed  by a query (which matches existing postings), and each+       "posting" line describes a posting to be  generated,  and  the  posting        amounts can be: -       o a normal amount with a commodity symbol, eg $2.  This  will  be  used+       o a  normal  amount  with a commodity symbol, eg $2.  This will be used          as-is.         o a number, eg 2.  The commodity symbol (if any) from the matched post-          ing will be added to this. -       o a numeric multiplier, eg *2 (a star followed by  a  number  N).   The+       o a  numeric  multiplier,  eg  *2 (a star followed by a number N).  The          matched posting's amount (and total price, if any) will be multiplied          by N. -       o a multiplier with a commodity symbol, eg *$2 (a star, number  N,  and+       o a  multiplier  with a commodity symbol, eg *$2 (a star, number N, and          symbol S).  The matched posting's amount will be multiplied by N, and          its commodity symbol will be replaced with S. -       Any query term containing spaces must be enclosed in single  or  double-       quotes,  as on the command line.  Eg, note the quotes around the second+       Any  query  term containing spaces must be enclosed in single or double+       quotes, as on the command line.  Eg, note the quotes around the  second        query term below:                = expenses:groceries 'expenses:dining out'@@ -1421,24 +1462,24 @@     Auto postings and multiple files        An auto posting rule can affect any transaction in the current file, or-       in  any  parent file or child file.  Note, currently it will not affect+       in any parent file or child file.  Note, currently it will  not  affect        sibling files (when multiple -f/--file are used - see #1212).     Auto postings and dates-       A posting date (or secondary date) in the matched posting,  or  (taking-       precedence)  a  posting date in the auto posting rule itself, will also+       A  posting  date (or secondary date) in the matched posting, or (taking+       precedence) a posting date in the auto posting rule itself,  will  also        be used in the generated posting.     Auto postings and transaction balancing / inferred amounts / balance asser-        tions        Currently, auto postings are added: -       o after  missing amounts are inferred, and transactions are checked for+       o after missing amounts are inferred, and transactions are checked  for          balancedness,         o but before balance assertions are checked. -       Note this means that journal entries must be balanced both  before  and+       Note  this  means that journal entries must be balanced both before and        after auto postings are added.  This changed in hledger 1.12+; see #893        for background. @@ -1448,11 +1489,11 @@        o generated-posting:= QUERY - shows this was generated by an auto post-          ing rule, and the query -       o _generated-posting:=  QUERY  - a hidden tag, which does not appear in+       o _generated-posting:= QUERY - a hidden tag, which does not  appear  in          hledger's output.  This can be used to match postings generated "just          now", rather than generated in the past and saved to the journal. -       Also,  any transaction that has been changed by auto posting rules will+       Also, any transaction that has been changed by auto posting rules  will        have these tags added:         o modified: - this transaction was modified@@ -1463,7 +1504,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)  @@ -1477,7 +1518,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) @@ -1485,4 +1526,4 @@   -hledger 1.18.1                     June 2020                hledger_journal(5)+hledger 1.18.99                 September 2020              hledger_journal(5)
embeddedfiles/hledger_timeclock.5 view
@@ -1,5 +1,5 @@ -.TH "hledger_timeclock" "5" "June 2020" "hledger 1.18.1" "hledger User Manuals"+.TH "hledger_timeclock" "5" "September 2020" "hledger 1.18.99" "hledger User Manuals"   
embeddedfiles/hledger_timeclock.info view
@@ -4,8 +4,8 @@  File: hledger_timeclock.info,  Node: Top,  Up: (dir) -hledger_timeclock(5) hledger 1.18.1-***********************************+hledger_timeclock(5) hledger 1.18.99+************************************  Timeclock - the time logging format of timeclock.el, as read by hledger 
embeddedfiles/hledger_timeclock.txt view
@@ -78,4 +78,4 @@   -hledger 1.18.1                     June 2020              hledger_timeclock(5)+hledger 1.18.99                 September 2020            hledger_timeclock(5)
embeddedfiles/hledger_timedot.5 view
@@ -1,5 +1,5 @@ -.TH "hledger_timedot" "5" "June 2020" "hledger 1.18.1" "hledger User Manuals"+.TH "hledger_timedot" "5" "September 2020" "hledger 1.18.99" "hledger User Manuals"   
embeddedfiles/hledger_timedot.info view
@@ -4,8 +4,8 @@  File: hledger_timedot.info,  Node: Top,  Up: (dir) -hledger_timedot(5) hledger 1.18.1-*********************************+hledger_timedot(5) hledger 1.18.99+**********************************  Timedot - hledger's human-friendly time logging format 
embeddedfiles/hledger_timedot.txt view
@@ -161,4 +161,4 @@   -hledger 1.18.1                     June 2020                hledger_timedot(5)+hledger 1.18.99                 September 2020              hledger_timedot(5)
hledger.1 view
@@ -1,6 +1,6 @@ .\"t -.TH "hledger" "1" "June 2020" "hledger 1.18.1" "hledger User Manuals"+.TH "hledger" "1" "September 2020" "hledger 1.18.99" "hledger User Manuals"   @@ -638,6 +638,15 @@ generate future transactions from periodic transaction rules, for the next 6 months or till report end date. In hledger-ui, also make ordinary future transactions visible.+.TP+\f[B]\f[CB]--color=WHEN (or --colour=WHEN)\f[B]\f[R]+Should color-supporting commands use ANSI color codes in text output.+\[aq]auto\[aq] (default): whenever stdout seems to be a color-supporting+terminal.+\[aq]always\[aq] or \[aq]yes\[aq]: always, useful eg when piping output+into \[aq]less -R\[aq].+\[aq]never\[aq] or \[aq]no\[aq]: never.+A NO_COLOR environment variable overrides this. .PP When a reporting option appears more than once in the command line, the last one takes precedence.@@ -973,15 +982,12 @@ \f[R] .fi .PP-Usually the data file is in hledger\[aq]s journal format, but it can-also be one of several other formats, listed below.-hledger detects the format automatically based on the file extension, or-if that is not recognised, by trying each built-in \[dq]reader\[dq] in-turn:+Usually the data file is in hledger\[aq]s journal format, but it can be+in any of the supported file formats, which currently are: .PP .TS tab(@);-lw(7.6n) lw(31.2n) lw(31.2n).+lw(7.8n) lw(39.5n) lw(22.7n). T{ Reader: T}@T{@@ -993,37 +999,45 @@ T{ \f[C]journal\f[R] T}@T{-hledger\[aq]s journal format, also some Ledger journals+hledger journal files and some Ledger journals, for transactions T}@T{ \f[C].journal\f[R] \f[C].j\f[R] \f[C].hledger\f[R] \f[C].ledger\f[R] T} T{ \f[C]timeclock\f[R] T}@T{-timeclock files (precise time logging)+timeclock files, for precise time logging T}@T{ \f[C].timeclock\f[R] T} T{ \f[C]timedot\f[R] T}@T{-timedot files (approximate time logging)+timedot files, for approximate time logging T}@T{ \f[C].timedot\f[R] T} T{ \f[C]csv\f[R] T}@T{-comma-separated values (data interchange)+comma/semicolon/tab/other-separated values, for data import T}@T{-\f[C].csv\f[R]+\f[C].csv\f[R] \f[C].ssv\f[R] \f[C].tsv\f[R] T} .TE .PP-If needed (eg to ensure correct error messages when a file has the-\[dq]wrong\[dq] extension), you can force a specific reader/format by-prepending it to the file path with a colon.-Examples:+hledger detects the format automatically based on the file extensions+shown above.+If it can\[aq]t recognise the file extension, it assumes+\f[C]journal\f[R] format.+So for non-journal files, it\[aq]s important to use a recognised file+extension, so as to either read successfully or to show relevant error+messages.+.PP+When you can\[aq]t ensure the right file extension, not to worry: you+can force a specific reader/format by prefixing the file path with the+format and a colon.+Eg to read a .dat file as csv: .IP .nf \f[C]@@ -1032,16 +1046,20 @@ \f[R] .fi .PP-You can also specify multiple \f[C]-f\f[R] options, to read multiple-files as one big journal.+You can specify multiple \f[C]-f\f[R] options, to read multiple files as+one big journal. There are some limitations with this: .IP \[bu] 2 directives in one file will not affect the other files .IP \[bu] 2 balance assertions will not see any account balances from previous files .PP-If you need those, either use the include directive, or concatenate the-files, eg: \f[C]cat a.journal b.journal | hledger -f- CMD\f[R].+If you need either of those things, you can+.IP \[bu] 2+use a single parent file which includes the others+.IP \[bu] 2+or concatenate the files into one before reading, eg:+\f[C]cat a.journal b.journal | hledger -f- CMD\f[R]. .SS Output destination .PP hledger commands send their output to the terminal by default.@@ -1070,7 +1088,8 @@ Some commands (print, register, the balance commands) offer a choice of output format. In addition to the usual plain text format (\f[C]txt\f[R]), there are-CSV (\f[C]csv\f[R]), HTML (\f[C]html\f[R]) and JSON (\f[C]json\f[R]).+CSV (\f[C]csv\f[R]), HTML (\f[C]html\f[R]), JSON (\f[C]json\f[R]) and+SQL (\f[C]sql\f[R]). This is controlled by the \f[C]-O/--output-format\f[R] option: .IP .nf@@ -1119,6 +1138,20 @@ We hope this approach will not cause problems in practice; if you find otherwise, please let us know. (Cf #1195)+.PP+Notes about SQL output:+.IP \[bu] 2+SQL output is also marked experimental, and much like JSON could use+real-world feedback.+.IP \[bu] 2+SQL output is expected to work with sqlite, MySQL and PostgreSQL+.IP \[bu] 2+SQL output is structured with the expectations that statements will be+executed in the empty database.+If you already have tables created via SQL output of hledger, you would+probably want to either clear tables of existing data (via+\f[C]delete\f[R] or \f[C]truncate\f[R] SQL statements) or drop tables+completely as otherwise your postings will be duped. .SS Regular expressions .PP hledger uses regular expressions in a number of places:@@ -1446,6 +1479,23 @@ T} .TE .PP+Or you can specify a single quarter like so:+.PP+.TS+tab(@);+l l.+T{+\f[C]-p \[dq]2009Q1\[dq]\f[R]+T}@T{+first quarter of 2009, equivalent to \[lq]2009/1/1 to 2009/4/1\[rq]+T}+T{+\f[C]-p \[dq]q4\[dq]\f[R]+T}@T{+fourth quarter of the current year+T}+.TE+.PP The argument of \f[C]-p\f[R] can also begin with, or be, a report interval expression. The basic report intervals are \f[C]daily\f[R], \f[C]weekly\f[R],@@ -1506,7 +1556,7 @@ .TE .PP The following more complex report intervals are also supported:-\f[C]biweekly\f[R], \f[C]bimonthly\f[R],+\f[C]biweekly\f[R], \f[C]fortnightly\f[R], \f[C]bimonthly\f[R], \f[C]every day|week|month|quarter|year\f[R], \f[C]every N days|weeks|months|quarters|years\f[R]. .PP@@ -2419,6 +2469,7 @@ .P .PD Prompt for transactions and add them to the journal.+Any arguments will be used as default inputs for the first N prompts. .PP Many hledger users edit their journals directly with a text editor, or generate them from CSV.@@ -2493,8 +2544,85 @@ .fi .PP On Microsoft Windows, the add command makes sure that no part of the-file path ends with a period, as it can cause data loss on that platform-(cf #1056).+file path ends with a period, as that would cause problems (#1056).+.SS aregister+.PP+aregister, areg+.PD 0+.P+.PD+Show transactions affecting a particular account, and the account\[aq]s+running balance.+.PP+\f[C]aregister\f[R] shows the transactions affecting a particular+account (and its subaccounts), from the point of view of that account.+Each line shows:+.IP \[bu] 2+the transaction\[aq]s (or posting\[aq]s, see below) date+.IP \[bu] 2+the names of the other account(s) involved+.IP \[bu] 2+the net change to this account\[aq]s balance+.IP \[bu] 2+the account\[aq]s historical running balance (including balance from+transactions before the report start date).+.PP+With \f[C]aregister\f[R], each line represents a whole transaction - as+in hledger-ui, hledger-web, and your bank statement.+By contrast, the \f[C]register\f[R] command shows individual postings,+across all accounts.+You might prefer \f[C]aregister\f[R] for reconciling with real-world+asset/liability accounts, and \f[C]register\f[R] for reviewing detailed+revenues/expenses.+.PP+An account must be specified as the first argument, which should be the+full account name or an account pattern (regular expression).+aregister will show transactions in this account (the first one matched)+and any of its subaccounts.+.PP+Any additional arguments form a query which will filter the transactions+shown.+.PP+Transactions making a net change of zero are not shown by default; add+the \f[C]-E/--empty\f[R] flag to show them.+.SS aregister and custom posting dates+.PP+Transactions whose date is outside the report period can still be shown,+if they have a posting to this account dated inside the report period.+(And in this case it\[aq]s the posting date that is shown.) This ensures+that \f[C]aregister\f[R] can show an accurate historical running+balance, matching the one shown by \f[C]register -H\f[R] with the same+arguments.+.PP+To filter strictly by transaction date instead, add the+\f[C]--txn-dates\f[R] flag.+If you use this flag and some of your postings have custom dates,+it\[aq]s probably best to assume the running balance is wrong.+.SS Output format+.PP+This command also supports the output destination and output format+options The output formats supported are \f[C]txt\f[R], \f[C]csv\f[R],+and \f[C]json\f[R].+.PP+Examples:+.PP+Show all transactions and historical running balance in the first+account whose name contains \[dq]checking\[dq]:+.IP+.nf+\f[C]+$ hledger areg checking+\f[R]+.fi+.PP+Show transactions and historical running balance in all asset accounts+during july:+.IP+.nf+\f[C]+$ hledger areg assets date:jul+\f[R]+.fi .SS balance .PP balance, bal, b@@ -2555,7 +2683,8 @@ indented below their parent. At each level of the tree, accounts are sorted by account code if any, then by account name.-Or with \f[C]-S/--sort-amount\f[R], by their balance amount.+Or with \f[C]-S/--sort-amount\f[R], by their balance amount, largest+first. .PP \[dq]Boring\[dq] accounts, which contain a single interesting subaccount and no balance of their own, are elided into the following line for more@@ -2655,11 +2784,8 @@ for the single-column balance report .SS Colour support .PP-The balance command shows negative amounts in red, if:-.IP \[bu] 2-the \f[C]TERM\f[R] environment variable is not set to \f[C]dumb\f[R]-.IP \[bu] 2-the output is not being redirected or piped anywhere+In terminal output, when colour is enabled, the balance command shows+negative amounts in red. .SS Flat mode .PP To see a flat list instead of the default hierarchical display, use@@ -2859,12 +2985,19 @@ \f[R] .fi .PP-A limitation of multicolumn balance reports: eliding of boring parent-accounts in tree mode, as in the classic balance report, is not yet-supported.-.PP The \f[C]--transpose\f[R] flag can be used to exchange the rows and columns of a multicolumn report.+.PP+When showing multicommodity amounts, multicolumn balance reports will+elide any amounts which have more than two commodities, since otherwise+columns could get very wide.+The \f[C]--no-elide\f[R] flag disables this.+Hiding totals with the \f[C]-N/--no-total\f[R] flag can also help reduce+the width of multicommodity reports.+.PP+When the report is still too wide, a good workaround is to pipe it into+\f[C]less -RS\f[R] (-R for colour, -S to chop long lines).+Eg: \f[C]hledger bal -D --color=yes | less -RS\f[R]. .SS Budget report .PP With \f[C]--budget\f[R], extra columns are displayed showing budget@@ -3115,16 +3248,16 @@ .PD 0 .P .PD-This command displays a simple balance sheet, showing historical ending-balances of asset and liability accounts (ignoring any report begin-date).-It assumes that these accounts are under a top-level \f[C]asset\f[R] or-\f[C]liability\f[R] account (case insensitive, plural forms also-allowed).+This command displays a balance sheet, showing historical ending+balances of asset and liability accounts.+(To see equity as well, use the balancesheetequity command.) Amounts are+shown with normal positive sign, as in conventional financial+statements. .PP-Note this report shows all account balances with normal positive sign-(like conventional financial statements, unlike balance/print/register)-(experimental).+The asset and liability accounts shown are those accounts declared with+the \f[C]Asset\f[R] or \f[C]Cash\f[R] or \f[C]Liability\f[R] type, or+otherwise all accounts under a top-level \f[C]asset\f[R] or+\f[C]liability\f[R] account (case insensitive, plurals allowed). .PP Example: .IP@@ -3171,9 +3304,17 @@ .PD 0 .P .PD-Just like balancesheet, but also reports Equity (which it assumes is-under a top-level \f[C]equity\f[R] account).+This command displays a balance sheet, showing historical ending+balances of asset, liability and equity accounts.+Amounts are shown with normal positive sign, as in conventional+financial statements. .PP+The asset, liability and equity accounts shown are those accounts+declared with the \f[C]Asset\f[R], \f[C]Cash\f[R], \f[C]Liability\f[R]+or \f[C]Equity\f[R] type, or otherwise all accounts under a top-level+\f[C]asset\f[R], \f[C]liability\f[R] or \f[C]equity\f[R] account (case+insensitive, plurals allowed).+.PP Example: .IP .nf@@ -3213,15 +3354,17 @@ .PD 0 .P .PD-This command displays a simple cashflow statement, showing changes in-\[dq]cash\[dq] accounts.-It assumes that these accounts are under a top-level \f[C]asset\f[R]-account (case insensitive, plural forms also allowed) and do not contain-\f[C]receivable\f[R] or \f[C]A/R\f[R] in their name.-Note this report shows all account balances with normal positive sign-(like conventional financial statements, unlike balance/print/register)-(experimental).+This command displays a cashflow statement, showing the inflows and+outflows affecting \[dq]cash\[dq] (ie, liquid) assets.+Amounts are shown with normal positive sign, as in conventional+financial statements. .PP+The \[dq]cash\[dq] accounts shown are those accounts declared with the+\f[C]Cash\f[R] type, or otherwise all accounts under a top-level+\f[C]asset\f[R] account (case insensitive, plural allowed) which do not+have \f[C]fixed\f[R], \f[C]investment\f[R], \f[C]receivable\f[R] or+\f[C]A/R\f[R] in their name.+.PP Example: .IP .nf@@ -3401,6 +3544,64 @@     assets:checking \f[R] .fi+.SS codes+.PP+codes+.PD 0+.P+.PD+List the codes seen in transactions, in the order parsed.+.PP+This command prints the value of each transaction\[aq]s code field, in+the order transactions were parsed.+The transaction code is an optional value written in parentheses between+the date and description, often used to store a cheque number, order+number or similar.+.PP+Transactions aren\[aq]t required to have a code, and missing or empty+codes will not be shown by default.+With the \f[C]-E\f[R]/\f[C]--empty\f[R] flag, they will be printed as+blank lines.+.PP+You can add a query to select a subset of transactions.+.PP+Examples:+.IP+.nf+\f[C]+1/1 (123)+ (a)  1++1/1 ()+ (a)  1++1/1+ (a)  1++1/1 (126)+ (a)  1+\f[R]+.fi+.IP+.nf+\f[C]+$ hledger codes+123+124+126+\f[R]+.fi+.IP+.nf+\f[C]+$ hledger codes -E+123+124+++126+\f[R]+.fi .SS commodities .PP commodities@@ -3410,11 +3611,17 @@ List all commodity/currency symbols used or declared in the journal. .SS descriptions .PP-descriptions Show descriptions.+descriptions+.PD 0+.P+.PD+List the unique descriptions that appear in transactions. .PP-This command lists all descriptions that appear in transactions.+This command lists the unique descriptions that appear in transactions,+in alphabetic order.+You can add a query to select a subset of transactions. .PP-Examples:+Example: .IP .nf \f[C]@@ -3572,19 +3779,18 @@ .PD 0 .P .PD-This command displays a simple income statement, showing revenues and-expenses during a period.-It assumes that these accounts are under a top-level \f[C]revenue\f[R]-or \f[C]income\f[R] or \f[C]expense\f[R] account (case insensitive,-plural forms also allowed).-Note this report shows all account balances with normal positive sign-(like conventional financial statements, unlike balance/print/register)-(experimental). .PP-This command displays a simple income statement.-It currently assumes that you have top-level accounts named-\f[C]income\f[R] (or \f[C]revenue\f[R]) and \f[C]expense\f[R] (plural-forms also allowed.)+This command displays an income statement, showing revenues and expenses+during one or more periods.+Amounts are shown with normal positive sign, as in conventional+financial statements.+.PP+The revenue and expense accounts shown are those accounts declared with+the \f[C]Revenue\f[R] or \f[C]Expense\f[R] type, or otherwise all+accounts under a top-level \f[C]revenue\f[R] or \f[C]income\f[R] or+\f[C]expense\f[R] account (case insensitive, plurals allowed).+.PP+Example: .IP .nf \f[C]@@ -3624,11 +3830,19 @@ \f[C]html\f[R], and (experimental) \f[C]json\f[R]. .SS notes .PP-notes Show notes.+notes+.PD 0+.P+.PD+List the unique notes that appear in transactions. .PP-This command lists all notes that appear in transactions.+This command lists the unique notes that appear in transactions, in+alphabetic order.+You can add a query to select a subset of transactions.+The note is the part of the transaction description after a | character+(or if there is no |, the whole description). .PP-Examples:+Example: .IP .nf \f[C]@@ -3639,11 +3853,19 @@ .fi .SS payees .PP-payees Show payee names.+payees+.PD 0+.P+.PD+List the unique payee/payer names that appear in transactions. .PP-This command lists all payee names that appear in transactions.+This command lists the unique payee/payer names that appear in+transactions, in alphabetic order.+You can add a query to select a subset of transactions.+The payee/payer is the part of the transaction description before a |+character (or if there is no |, the whole description). .PP-Examples:+Example: .IP .nf \f[C]@@ -3763,7 +3985,7 @@ .PP This command also supports the output destination and output format options The output formats supported are \f[C]txt\f[R], \f[C]csv\f[R],-and (experimental) \f[C]json\f[R].+and (experimental) \f[C]json\f[R] and \f[C]sql\f[R]. .PP Here\[aq]s an example of print\[aq]s CSV output: .IP@@ -3831,10 +4053,16 @@ .PD Show postings and their running total. .PP-The register command displays postings in date order, one per line, and-their running total.-This is typically used with a query selecting a particular account, to-see that account\[aq]s activity:+The register command displays matched postings, across all accounts, in+date order, with their running total or running historical balance.+(See also the \f[C]aregister\f[R] command, which shows matched+transactions in a specific account.)+.PP+register normally shows line per posting, but note that multi-commodity+amounts will occupy multiple lines (one line per commodity).+.PP+It is typically used with a query selecting a particular account, to see+that account\[aq]s activity: .IP .nf \f[C]@@ -4226,12 +4454,19 @@ .PD 0 .P .PD-List all the tag names used in the journal.+List the unique tag names used in the journal. With a TAGREGEX argument, only tag names matching the regular expression (case insensitive) are shown. With QUERY arguments, only transactions matching the query are considered.-With --values flag, the tags\[aq] unique values are listed instead.+.PP+With the --values flag, the tags\[aq] unique values are listed instead.+.PP+With --parsed flag, all tags or values are shown in the order they are+parsed from the input data, including duplicates.+.PP+With -E/--empty, any blank/empty values will also be shown, otherwise+they are omitted. .SS test .PP test@@ -4318,9 +4553,6 @@ These are typically prototypes and not guaranteed to work. .SH ENVIRONMENT .PP-\f[B]COLUMNS\f[R] The screen width used by the register command.-Default: the full terminal width.-.PP \f[B]LEDGER_FILE\f[R] The journal file path when not specified with \f[C]-f\f[R]. Default: \f[C]\[ti]/.hledger.journal\f[R] (on windows, perhaps@@ -4346,6 +4578,13 @@ .fi .PP To see the effect you may need to \f[C]killall Dock\f[R], or reboot.+.PP+\f[B]COLUMNS\f[R] The screen width used by the register command.+Default: the full terminal width.+.PP+\f[B]NO_COLOR\f[R] If this variable exists with any value, hledger will+not use ANSI color codes in terminal output.+This overrides the --color/--colour option. .SH FILES .PP Reads data from one or more files in hledger journal, timeclock,
hledger.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: a143aaa15c1e629724eac79aa6eb29b5a1af4432366e8855450a1e53ee8c30e4+-- hash: 57200bf2d62853fd94cae6fdd76f98cd03cfba2b551e706fc6ac8e7650796c7f  name:           hledger-version:        1.18.1+version:        1.19 synopsis:       Command-line interface for the hledger accounting system description:    The command-line interface for the hledger accounting system.                 Its basic function is to read a plain text file describing@@ -61,6 +61,7 @@     Hledger/Cli/Commands/Accounts.txt     Hledger/Cli/Commands/Activity.txt     Hledger/Cli/Commands/Add.txt+    Hledger/Cli/Commands/Aregister.txt     Hledger/Cli/Commands/Balance.txt     Hledger/Cli/Commands/Balancesheet.txt     Hledger/Cli/Commands/Balancesheetequity.txt@@ -68,6 +69,7 @@     Hledger/Cli/Commands/Checkdates.txt     Hledger/Cli/Commands/Checkdupes.txt     Hledger/Cli/Commands/Close.txt+    Hledger/Cli/Commands/Codes.txt     Hledger/Cli/Commands/Commodities.txt     Hledger/Cli/Commands/Descriptions.txt     Hledger/Cli/Commands/Diff.txt@@ -115,6 +117,7 @@       Hledger.Cli.Commands.Accounts       Hledger.Cli.Commands.Activity       Hledger.Cli.Commands.Add+      Hledger.Cli.Commands.Aregister       Hledger.Cli.Commands.Balance       Hledger.Cli.Commands.Balancesheet       Hledger.Cli.Commands.Balancesheetequity@@ -122,6 +125,7 @@       Hledger.Cli.Commands.Checkdates       Hledger.Cli.Commands.Checkdupes       Hledger.Cli.Commands.Close+      Hledger.Cli.Commands.Codes       Hledger.Cli.Commands.Commodities       Hledger.Cli.Commands.Descriptions       Hledger.Cli.Commands.Diff@@ -144,12 +148,12 @@   other-modules:       Paths_hledger   ghc-options: -Wall -fno-warn-unused-do-bind -fno-warn-name-shadowing -fno-warn-missing-signatures -fno-warn-type-defaults -fno-warn-orphans -optP-Wno-nonportable-include-path-  cpp-options: -DVERSION="1.18.1"+  cpp-options: -DVERSION="1.19"   build-depends:       Decimal >=0.5.1     , Diff-    , aeson-    , ansi-terminal >=0.6.2.3+    , aeson >=1+    , ansi-terminal >=0.9     , base >=4.9 && <4.15     , base-compat-batteries >=0.10.1 && <0.12     , bytestring@@ -161,7 +165,7 @@     , filepath     , hashable >=1.2.4     , haskeline >=0.6-    , hledger-lib >=1.18.1 && <1.19+    , hledger-lib >=1.19 && <1.20     , lucid     , math-functions >=0.3.3.0     , megaparsec >=7.0.0 && <8.1@@ -197,11 +201,11 @@   hs-source-dirs:       app   ghc-options: -Wall -fno-warn-unused-do-bind -fno-warn-name-shadowing -fno-warn-missing-signatures -fno-warn-type-defaults -fno-warn-orphans -optP-Wno-nonportable-include-path-  cpp-options: -DVERSION="1.18.1"+  cpp-options: -DVERSION="1.19"   build-depends:       Decimal >=0.5.1-    , aeson-    , ansi-terminal >=0.6.2.3+    , aeson >=1+    , ansi-terminal >=0.9     , base >=4.9 && <4.15     , base-compat-batteries >=0.10.1 && <0.12     , bytestring@@ -213,7 +217,7 @@     , filepath     , haskeline >=0.6     , hledger-    , hledger-lib >=1.18.1 && <1.19+    , hledger-lib >=1.19 && <1.20     , math-functions >=0.3.3.0     , megaparsec >=7.0.0 && <8.1     , mtl >=2.2.1@@ -249,11 +253,11 @@   hs-source-dirs:       test   ghc-options: -Wall -fno-warn-unused-do-bind -fno-warn-name-shadowing -fno-warn-missing-signatures -fno-warn-type-defaults -fno-warn-orphans -optP-Wno-nonportable-include-path-  cpp-options: -DVERSION="1.18.1"+  cpp-options: -DVERSION="1.19"   build-depends:       Decimal >=0.5.1-    , aeson-    , ansi-terminal >=0.6.2.3+    , aeson >=1+    , ansi-terminal >=0.9     , base >=4.9 && <4.15     , base-compat-batteries >=0.10.1 && <0.12     , bytestring@@ -265,7 +269,7 @@     , filepath     , haskeline >=0.6     , hledger-    , hledger-lib >=1.18.1 && <1.19+    , hledger-lib >=1.19 && <1.20     , math-functions >=0.3.3.0     , megaparsec >=7.0.0 && <8.1     , mtl >=2.2.1@@ -301,8 +305,8 @@   ghc-options: -Wall -fno-warn-unused-do-bind -fno-warn-name-shadowing -fno-warn-missing-signatures -fno-warn-type-defaults -fno-warn-orphans -optP-Wno-nonportable-include-path   build-depends:       Decimal >=0.5.1-    , aeson-    , ansi-terminal >=0.6.2.3+    , aeson >=1+    , ansi-terminal >=0.9     , base >=4.9 && <4.15     , base-compat-batteries >=0.10.1 && <0.12     , bytestring@@ -315,7 +319,7 @@     , filepath     , haskeline >=0.6     , hledger-    , hledger-lib >=1.18.1 && <1.19+    , hledger-lib >=1.19 && <1.20     , html     , math-functions >=0.3.3.0     , megaparsec >=7.0.0 && <8.1
hledger.info view
@@ -3,8 +3,8 @@  File: hledger.info,  Node: Top,  Next: COMMON TASKS,  Up: (dir) -hledger(1) hledger 1.18.1-*************************+hledger(1) hledger 1.18.99+**************************  hledger - a command-line accounting tool @@ -633,7 +633,14 @@      generate future transactions from periodic transaction rules, for      the next 6 months or till report end date.  In hledger-ui, also      make ordinary future transactions visible.+'--color=WHEN (or --colour=WHEN)' +     Should color-supporting commands use ANSI color codes in text+     output.  'auto' (default): whenever stdout seems to be a+     color-supporting terminal.  'always' or 'yes': always, useful eg+     when piping output into 'less -R'. 'never' or 'no': never.  A+     NO_COLOR environment variable overrides this.+    When a reporting option appears more than once in the command line, the last one takes precedence. @@ -948,39 +955,47 @@  $ cat some.journal | hledger -f- -   Usually the data file is in hledger's journal format, but it can also-be one of several other formats, listed below.  hledger detects the-format automatically based on the file extension, or if that is not-recognised, by trying each built-in "reader" in turn:+   Usually the data file is in hledger's journal format, but it can be+in any of the supported file formats, which currently are: -Reader:  Reads:                           Used for file extensions:-----------------------------------------------------------------------------'journal'hledger's journal format, also   '.journal' '.j' '.hledger'-         some Ledger journals             '.ledger'-'timeclock'timeclock files (precise time  '.timeclock'-         logging)-'timedot'timedot files (approximate       '.timedot'-         time logging)-'csv'    comma-separated values (data     '.csv'-         interchange)+Reader:  Reads:                                   Used for file+                                                  extensions:+--------------------------------------------------------------------------+'journal'hledger journal files and some Ledger    '.journal' '.j'+         journals, for transactions               '.hledger' '.ledger'+'timeclock'timeclock files, for precise time      '.timeclock'+         logging+'timedot'timedot files, for approximate time      '.timedot'+         logging+'csv'    comma/semicolon/tab/other-separated      '.csv' '.ssv' '.tsv'+         values, for data import -   If needed (eg to ensure correct error messages when a file has the-"wrong" extension), you can force a specific reader/format by prepending-it to the file path with a colon.  Examples:+   hledger detects the format automatically based on the file extensions+shown above.  If it can't recognise the file extension, it assumes+'journal' format.  So for non-journal files, it's important to use a+recognised file extension, so as to either read successfully or to show+relevant error messages. +   When you can't ensure the right file extension, not to worry: you can+force a specific reader/format by prefixing the file path with the+format and a colon.  Eg to read a .dat file as csv:+ $ hledger -f csv:/some/csv-file.dat stats $ echo 'i 2009/13/1 08:00:00' | hledger print -ftimeclock:- -   You can also specify multiple '-f' options, to read multiple files as-one big journal.  There are some limitations with this:+   You can specify multiple '-f' options, to read multiple files as one+big journal.  There are some limitations with this:     * directives in one file will not affect the other files    * balance assertions will not see any account balances from previous      files -   If you need those, either use the include directive, or concatenate-the files, eg: 'cat a.journal b.journal | hledger -f- CMD'.+   If you need either of those things, you can +   * use a single parent file which includes the others+   * or concatenate the files into one before reading, eg: 'cat+     a.journal b.journal | hledger -f- CMD'.+  File: hledger.info,  Node: Output destination,  Next: Output format,  Prev: Input files,  Up: OPTIONS @@ -1007,8 +1022,8 @@  Some commands (print, register, the balance commands) offer a choice of output format.  In addition to the usual plain text format ('txt'),-there are CSV ('csv'), HTML ('html') and JSON ('json').  This is-controlled by the '-O/--output-format' option:+there are CSV ('csv'), HTML ('html'), JSON ('json') and SQL ('sql').+This is controlled by the '-O/--output-format' option:  $ hledger print -O csv @@ -1039,6 +1054,20 @@      your control.  We hope this approach will not cause problems in      practice; if you find otherwise, please let us know.  (Cf #1195) +   Notes about SQL output:++   * SQL output is also marked experimental, and much like JSON could+     use real-world feedback.++   * SQL output is expected to work with sqlite, MySQL and PostgreSQL++   * SQL output is structured with the expectations that statements will+     be executed in the empty database.  If you already have tables+     created via SQL output of hledger, you would probably want to+     either clear tables of existing data (via 'delete' or 'truncate'+     SQL statements) or drop tables completely as otherwise your+     postings will be duped.+  File: hledger.info,  Node: Regular expressions,  Next: Smart dates,  Prev: Output format,  Up: OPTIONS @@ -1224,6 +1253,11 @@ '-p "2009/1"'     the month of jan; equivalent to “2009/1/1 to 2009/2/1” '-p "2009/1/1"'   just that day; equivalent to “2009/1/1 to 2009/1/2” +   Or you can specify a single quarter like so:++'-p "2009Q1"'   first quarter of 2009, equivalent to “2009/1/1 to 2009/4/1”+'-p "q4"'       fourth quarter of the current year+    The argument of '-p' can also begin with, or be, a report interval expression.  The basic report intervals are 'daily', 'weekly', 'monthly', 'quarterly', or 'yearly', which have the same effect as the@@ -1253,7 +1287,8 @@ 2009-12-29"'     The following more complex report intervals are also supported:-'biweekly', 'bimonthly', 'every day|week|month|quarter|year', 'every N+'biweekly', 'fortnightly', 'bimonthly', 'every+day|week|month|quarter|year', 'every N days|weeks|months|quarters|years'.     All of these will start on the first day of the requested period and@@ -1881,6 +1916,7 @@ * accounts:: * activity:: * add::+* aregister:: * balance:: * balancesheet:: * balancesheetequity::@@ -1888,6 +1924,7 @@ * check-dates:: * check-dupes:: * close::+* codes:: * commodities:: * descriptions:: * diff::@@ -1961,13 +1998,14 @@ 2008-10-01 **  -File: hledger.info,  Node: add,  Next: balance,  Prev: activity,  Up: COMMANDS+File: hledger.info,  Node: add,  Next: aregister,  Prev: activity,  Up: COMMANDS  3.3 add =======  add-Prompt for transactions and add them to the journal.+Prompt for transactions and add them to the journal.  Any arguments will+be used as default inputs for the first N prompts.     Many hledger users edit their journals directly with a text editor, or generate them from CSV. For more interactive data entry, there is the@@ -2028,13 +2066,88 @@ Date [2015/05/22]: <CTRL-D> $     On Microsoft Windows, the add command makes sure that no part of the-file path ends with a period, as it can cause data loss on that platform-(cf #1056).+file path ends with a period, as that would cause problems (#1056).  -File: hledger.info,  Node: balance,  Next: balancesheet,  Prev: add,  Up: COMMANDS+File: hledger.info,  Node: aregister,  Next: balance,  Prev: add,  Up: COMMANDS -3.4 balance+3.4 aregister+=============++aregister, areg+Show transactions affecting a particular account, and the account's+running balance.++   'aregister' shows the transactions affecting a particular account+(and its subaccounts), from the point of view of that account.  Each+line shows:++   * the transaction's (or posting's, see below) date+   * the names of the other account(s) involved+   * the net change to this account's balance+   * the account's historical running balance (including balance from+     transactions before the report start date).++   With 'aregister', each line represents a whole transaction - as in+hledger-ui, hledger-web, and your bank statement.  By contrast, the+'register' command shows individual postings, across all accounts.  You+might prefer 'aregister' for reconciling with real-world asset/liability+accounts, and 'register' for reviewing detailed revenues/expenses.++   An account must be specified as the first argument, which should be+the full account name or an account pattern (regular expression).+aregister will show transactions in this account (the first one matched)+and any of its subaccounts.++   Any additional arguments form a query which will filter the+transactions shown.++   Transactions making a net change of zero are not shown by default;+add the '-E/--empty' flag to show them.++* Menu:++* aregister and custom posting dates::+* Output format::+++File: hledger.info,  Node: aregister and custom posting dates,  Next: ,  Up: aregister++3.4.1 aregister and custom posting dates+----------------------------------------++Transactions whose date is outside the report period can still be shown,+if they have a posting to this account dated inside the report period.+(And in this case it's the posting date that is shown.)  This ensures+that 'aregister' can show an accurate historical running balance,+matching the one shown by 'register -H' with the same arguments.++   To filter strictly by transaction date instead, add the '--txn-dates'+flag.  If you use this flag and some of your postings have custom dates,+it's probably best to assume the running balance is wrong.++3.4.2 Output format+-------------------++This command also supports the output destination and output format+options The output formats supported are 'txt', 'csv', and 'json'.++   Examples:++   Show all transactions and historical running balance in the first+account whose name contains "checking":++$ hledger areg checking++   Show transactions and historical running balance in all asset+accounts during july:++$ hledger areg assets date:jul+++File: hledger.info,  Node: balance,  Next: balancesheet,  Prev: aregister,  Up: COMMANDS++3.5 balance ===========  balance, bal, b@@ -2077,7 +2190,7 @@  File: hledger.info,  Node: Classic balance report,  Next: Customising the classic balance report,  Up: balance -3.4.1 Classic balance report+3.5.1 Classic balance report ----------------------------  This is the original balance report, as found in Ledger.  It usually@@ -2100,7 +2213,7 @@    By default, accounts are displayed hierarchically, with subaccounts indented below their parent.  At each level of the tree, accounts are sorted by account code if any, then by account name.  Or with-'-S/--sort-amount', by their balance amount.+'-S/--sort-amount', by their balance amount, largest first.     "Boring" accounts, which contain a single interesting subaccount and no balance of their own, are elided into the following line for more@@ -2124,7 +2237,7 @@  File: hledger.info,  Node: Customising the classic balance report,  Next: Colour support,  Prev: Classic balance report,  Up: balance -3.4.2 Customising the classic balance report+3.5.2 Customising the classic balance report --------------------------------------------  You can customise the layout of classic balance reports with '--format@@ -2186,18 +2299,16 @@  File: hledger.info,  Node: Colour support,  Next: Flat mode,  Prev: Customising the classic balance report,  Up: balance -3.4.3 Colour support+3.5.3 Colour support -------------------- -The balance command shows negative amounts in red, if:--   * the 'TERM' environment variable is not set to 'dumb'-   * the output is not being redirected or piped anywhere+In terminal output, when colour is enabled, the balance command shows+negative amounts in red.   File: hledger.info,  Node: Flat mode,  Next: Depth limited balance reports,  Prev: Colour support,  Up: balance -3.4.4 Flat mode+3.5.4 Flat mode ---------------  To see a flat list instead of the default hierarchical display, use@@ -2213,7 +2324,7 @@  File: hledger.info,  Node: Depth limited balance reports,  Next: Percentages,  Prev: Flat mode,  Up: balance -3.4.5 Depth limited balance reports+3.5.5 Depth limited balance reports -----------------------------------  With '--depth N' or 'depth:N' or just '-N', balance reports show@@ -2232,7 +2343,7 @@  File: hledger.info,  Node: Percentages,  Next: Multicolumn balance report,  Prev: Depth limited balance reports,  Up: balance -3.4.6 Percentages+3.5.6 Percentages -----------------  With '-%' or '--percent', balance reports show each account's value@@ -2264,7 +2375,7 @@  File: hledger.info,  Node: Multicolumn balance report,  Next: Budget report,  Prev: Percentages,  Up: balance -3.4.7 Multicolumn balance report+3.5.7 Multicolumn balance report --------------------------------  Multicolumn or tabular balance reports are a very useful hledger@@ -2369,17 +2480,23 @@  (Average is rounded to the dollar here since all journal amounts are) -   A limitation of multicolumn balance reports: eliding of boring parent-accounts in tree mode, as in the classic balance report, is not yet-supported.-    The '--transpose' flag can be used to exchange the rows and columns of a multicolumn report. +   When showing multicommodity amounts, multicolumn balance reports will+elide any amounts which have more than two commodities, since otherwise+columns could get very wide.  The '--no-elide' flag disables this.+Hiding totals with the '-N/--no-total' flag can also help reduce the+width of multicommodity reports.++   When the report is still too wide, a good workaround is to pipe it+into 'less -RS' (-R for colour, -S to chop long lines).  Eg: 'hledger+bal -D --color=yes | less -RS'.+  File: hledger.info,  Node: Budget report,  Next: ,  Prev: Multicolumn balance report,  Up: balance -3.4.8 Budget report+3.5.8 Budget report -------------------  With '--budget', extra columns are displayed showing budget goals for@@ -2502,7 +2619,7 @@  File: hledger.info,  Node: Nested budgets,  Up: Budget report -3.4.8.1 Nested budgets+3.5.8.1 Nested budgets ......................  You can add budgets to any account in your account hierarchy.  If you@@ -2587,7 +2704,7 @@ ----------------------------------------++-------------------------------                                         ||        0 [                 0]  -3.4.9 Output format+3.5.9 Output format -------------------  This command also supports the output destination and output format@@ -2597,18 +2714,19 @@  File: hledger.info,  Node: balancesheet,  Next: balancesheetequity,  Prev: balance,  Up: COMMANDS -3.5 balancesheet+3.6 balancesheet ================  balancesheet, bs-This command displays a simple balance sheet, showing historical ending-balances of asset and liability accounts (ignoring any report begin-date).  It assumes that these accounts are under a top-level 'asset' or-'liability' account (case insensitive, plural forms also allowed).+This command displays a balance sheet, showing historical ending+balances of asset and liability accounts.  (To see equity as well, use+the balancesheetequity command.)  Amounts are shown with normal positive+sign, as in conventional financial statements. -   Note this report shows all account balances with normal positive sign-(like conventional financial statements, unlike balance/print/register)-(experimental).+   The asset and liability accounts shown are those accounts declared+with the 'Asset' or 'Cash' or 'Liability' type, or otherwise all+accounts under a top-level 'asset' or 'liability' account (case+insensitive, plurals allowed).     Example: @@ -2647,13 +2765,19 @@  File: hledger.info,  Node: balancesheetequity,  Next: cashflow,  Prev: balancesheet,  Up: COMMANDS -3.6 balancesheetequity+3.7 balancesheetequity ======================  balancesheetequity, bse-Just like balancesheet, but also reports Equity (which it assumes is-under a top-level 'equity' account).+This command displays a balance sheet, showing historical ending+balances of asset, liability and equity accounts.  Amounts are shown+with normal positive sign, as in conventional financial statements. +   The asset, liability and equity accounts shown are those accounts+declared with the 'Asset', 'Cash', 'Liability' or 'Equity' type, or+otherwise all accounts under a top-level 'asset', 'liability' or+'equity' account (case insensitive, plurals allowed).+    Example:  $ hledger balancesheetequity@@ -2687,17 +2811,19 @@  File: hledger.info,  Node: cashflow,  Next: check-dates,  Prev: balancesheetequity,  Up: COMMANDS -3.7 cashflow+3.8 cashflow ============  cashflow, cf-This command displays a simple cashflow statement, showing changes in-"cash" accounts.  It assumes that these accounts are under a top-level-'asset' account (case insensitive, plural forms also allowed) and do not-contain 'receivable' or 'A/R' in their name.  Note this report shows all-account balances with normal positive sign (like conventional financial-statements, unlike balance/print/register) (experimental).+This command displays a cashflow statement, showing the inflows and+outflows affecting "cash" (ie, liquid) assets.  Amounts are shown with+normal positive sign, as in conventional financial statements. +   The "cash" accounts shown are those accounts declared with the 'Cash'+type, or otherwise all accounts under a top-level 'asset' account (case+insensitive, plural allowed) which do not have 'fixed', 'investment',+'receivable' or 'A/R' in their name.+    Example:  $ hledger cashflow@@ -2727,7 +2853,7 @@  File: hledger.info,  Node: check-dates,  Next: check-dupes,  Prev: cashflow,  Up: COMMANDS -3.8 check-dates+3.9 check-dates ===============  check-dates@@ -2739,8 +2865,8 @@  File: hledger.info,  Node: check-dupes,  Next: close,  Prev: check-dates,  Up: COMMANDS -3.9 check-dupes-===============+3.10 check-dupes+================  check-dupes Reports account names having the same leaf but different prefixes.  In@@ -2750,9 +2876,9 @@    An example: http://stefanorodighiero.net/software/hledger-dupes.html  -File: hledger.info,  Node: close,  Next: commodities,  Prev: check-dupes,  Up: COMMANDS+File: hledger.info,  Node: close,  Next: codes,  Prev: check-dupes,  Up: COMMANDS -3.10 close+3.11 close ==========  close, equity@@ -2792,7 +2918,7 @@  File: hledger.info,  Node: close usage,  Up: close -3.10.1 close usage+3.11.1 close usage ------------------  If you split your journal files by time (eg yearly), you will typically@@ -2861,9 +2987,55 @@     assets:checking  -File: hledger.info,  Node: commodities,  Next: descriptions,  Prev: close,  Up: COMMANDS+File: hledger.info,  Node: codes,  Next: commodities,  Prev: close,  Up: COMMANDS -3.11 commodities+3.12 codes+==========++codes+List the codes seen in transactions, in the order parsed.++   This command prints the value of each transaction's code field, in+the order transactions were parsed.  The transaction code is an optional+value written in parentheses between the date and description, often+used to store a cheque number, order number or similar.++   Transactions aren't required to have a code, and missing or empty+codes will not be shown by default.  With the '-E'/'--empty' flag, they+will be printed as blank lines.++   You can add a query to select a subset of transactions.++   Examples:++1/1 (123)+ (a)  1++1/1 ()+ (a)  1++1/1+ (a)  1++1/1 (126)+ (a)  1++$ hledger codes+123+124+126++$ hledger codes -E+123+124+++126+++File: hledger.info,  Node: commodities,  Next: descriptions,  Prev: codes,  Up: COMMANDS++3.13 commodities ================  commodities@@ -2872,14 +3044,17 @@  File: hledger.info,  Node: descriptions,  Next: diff,  Prev: commodities,  Up: COMMANDS -3.12 descriptions+3.14 descriptions ================= -descriptions Show descriptions.+descriptions+List the unique descriptions that appear in transactions. -   This command lists all descriptions that appear in transactions.+   This command lists the unique descriptions that appear in+transactions, in alphabetic order.  You can add a query to select a+subset of transactions. -   Examples:+   Example:  $ hledger descriptions Store Name@@ -2889,7 +3064,7 @@  File: hledger.info,  Node: diff,  Next: files,  Prev: descriptions,  Up: COMMANDS -3.13 diff+3.15 diff =========  diff@@ -2924,7 +3099,7 @@  File: hledger.info,  Node: files,  Next: help,  Prev: diff,  Up: COMMANDS -3.14 files+3.16 files ==========  files@@ -2934,7 +3109,7 @@  File: hledger.info,  Node: help,  Next: import,  Prev: files,  Up: COMMANDS -3.15 help+3.17 help =========  help@@ -2974,7 +3149,7 @@  File: hledger.info,  Node: import,  Next: incomestatement,  Prev: help,  Up: COMMANDS -3.16 import+3.18 import ===========  import@@ -3003,7 +3178,7 @@  File: hledger.info,  Node: Importing balance assignments,  Up: import -3.16.1 Importing balance assignments+3.18.1 Importing balance assignments ------------------------------------  Entries added by import will have their posting amounts made explicit@@ -3022,20 +3197,21 @@  File: hledger.info,  Node: incomestatement,  Next: notes,  Prev: import,  Up: COMMANDS -3.17 incomestatement+3.19 incomestatement ====================  incomestatement, is-This command displays a simple income statement, showing revenues and-expenses during a period.  It assumes that these accounts are under a++   This command displays an income statement, showing revenues and+expenses during one or more periods.  Amounts are shown with normal+positive sign, as in conventional financial statements.++   The revenue and expense accounts shown are those accounts declared+with the 'Revenue' or 'Expense' type, or otherwise all accounts under a top-level 'revenue' or 'income' or 'expense' account (case insensitive,-plural forms also allowed).  Note this report shows all account balances-with normal positive sign (like conventional financial statements,-unlike balance/print/register) (experimental).+plurals allowed). -   This command displays a simple income statement.  It currently-assumes that you have top-level accounts named 'income' (or 'revenue')-and 'expense' (plural forms also allowed.)+   Example:  $ hledger incomestatement Income Statement@@ -3071,14 +3247,18 @@  File: hledger.info,  Node: notes,  Next: payees,  Prev: incomestatement,  Up: COMMANDS -3.18 notes+3.20 notes ========== -notes Show notes.+notes+List the unique notes that appear in transactions. -   This command lists all notes that appear in transactions.+   This command lists the unique notes that appear in transactions, in+alphabetic order.  You can add a query to select a subset of+transactions.  The note is the part of the transaction description after+a | character (or if there is no |, the whole description). -   Examples:+   Example:  $ hledger notes Petrol@@ -3087,14 +3267,19 @@  File: hledger.info,  Node: payees,  Next: prices,  Prev: notes,  Up: COMMANDS -3.19 payees+3.21 payees =========== -payees Show payee names.+payees+List the unique payee/payer names that appear in transactions. -   This command lists all payee names that appear in transactions.+   This command lists the unique payee/payer names that appear in+transactions, in alphabetic order.  You can add a query to select a+subset of transactions.  The payee/payer is the part of the transaction+description before a | character (or if there is no |, the whole+description). -   Examples:+   Example:  $ hledger payees Store Name@@ -3104,7 +3289,7 @@  File: hledger.info,  Node: prices,  Next: print,  Prev: payees,  Up: COMMANDS -3.20 prices+3.22 prices ===========  prices@@ -3117,7 +3302,7 @@  File: hledger.info,  Node: print,  Next: print-unique,  Prev: prices,  Up: COMMANDS -3.21 print+3.23 print ==========  print, txns, p@@ -3192,7 +3377,7 @@     This command also supports the output destination and output format options The output formats supported are 'txt', 'csv', and-(experimental) 'json'.+(experimental) 'json' and 'sql'.     Here's an example of print's CSV output: @@ -3226,7 +3411,7 @@  File: hledger.info,  Node: print-unique,  Next: register,  Prev: print,  Up: COMMANDS -3.22 print-unique+3.24 print-unique =================  print-unique@@ -3247,16 +3432,24 @@  File: hledger.info,  Node: register,  Next: register-match,  Prev: print-unique,  Up: COMMANDS -3.23 register+3.25 register =============  register, reg, r Show postings and their running total. -   The register command displays postings in date order, one per line,-and their running total.  This is typically used with a query selecting-a particular account, to see that account's activity:+   The register command displays matched postings, across all accounts,+in date order, with their running total or running historical balance.+(See also the 'aregister' command, which shows matched transactions in a+specific account.) +   register normally shows line per posting, but note that+multi-commodity amounts will occupy multiple lines (one line per+commodity).++   It is typically used with a query selecting a particular account, to+see that account's activity:+ $ hledger register checking 2008/01/01 income               assets:bank:checking            $1           $1 2008/06/01 gift                 assets:bank:checking            $1           $2@@ -3337,7 +3530,7 @@  File: hledger.info,  Node: Custom register output,  Up: register -3.23.1 Custom register output+3.25.1 Custom register output -----------------------------  register uses the full terminal width by default, except on windows.@@ -3369,7 +3562,7 @@  File: hledger.info,  Node: register-match,  Next: rewrite,  Prev: register,  Up: COMMANDS -3.24 register-match+3.26 register-match ===================  register-match@@ -3382,7 +3575,7 @@  File: hledger.info,  Node: rewrite,  Next: roi,  Prev: register-match,  Up: COMMANDS -3.25 rewrite+3.27 rewrite ============  rewrite@@ -3434,7 +3627,7 @@  File: hledger.info,  Node: Re-write rules in a file,  Up: rewrite -3.25.1 Re-write rules in a file+3.27.1 Re-write rules in a file -------------------------------  During the run this tool will execute so called "Automated Transactions"@@ -3477,7 +3670,7 @@  File: hledger.info,  Node: Diff output format,  Next: rewrite vs print --auto,  Up: Re-write rules in a file -3.25.1.1 Diff output format+3.27.1.1 Diff output format ...........................  To use this tool for batch modification of your journal files you may@@ -3518,7 +3711,7 @@  File: hledger.info,  Node: rewrite vs print --auto,  Prev: Diff output format,  Up: Re-write rules in a file -3.25.1.2 rewrite vs. print -auto+3.27.1.2 rewrite vs. print -auto ................................  This command predates print -auto, and currently does much the same@@ -3538,7 +3731,7 @@  File: hledger.info,  Node: roi,  Next: stats,  Prev: rewrite,  Up: COMMANDS -3.26 roi+3.28 roi ========  roi@@ -3566,7 +3759,7 @@  File: hledger.info,  Node: stats,  Next: tags,  Prev: roi,  Up: COMMANDS -3.27 stats+3.29 stats ==========  stats@@ -3597,20 +3790,27 @@  File: hledger.info,  Node: tags,  Next: test,  Prev: stats,  Up: COMMANDS -3.28 tags+3.30 tags =========  tags-List all the tag names used in the journal.  With a TAGREGEX argument,-only tag names matching the regular expression (case insensitive) are-shown.  With QUERY arguments, only transactions matching the query are-considered.  With -values flag, the tags' unique values are listed-instead.+List the unique tag names used in the journal.  With a TAGREGEX+argument, only tag names matching the regular expression (case+insensitive) are shown.  With QUERY arguments, only transactions+matching the query are considered. +   With the -values flag, the tags' unique values are listed instead.++   With -parsed flag, all tags or values are shown in the order they are+parsed from the input data, including duplicates.++   With -E/-empty, any blank/empty values will also be shown, otherwise+they are omitted.+  File: hledger.info,  Node: test,  Next: Add-on commands,  Prev: tags,  Up: COMMANDS -3.29 test+3.31 test =========  test@@ -3637,7 +3837,7 @@  File: hledger.info,  Node: Add-on commands,  Prev: test,  Up: COMMANDS -3.30 Add-on commands+3.32 Add-on commands ====================  hledger also searches for external add-on commands, and will include@@ -3678,7 +3878,7 @@  File: hledger.info,  Node: ui,  Next: web,  Up: Add-on commands -3.30.1 ui+3.32.1 ui ---------  hledger-ui provides an efficient terminal interface.@@ -3686,7 +3886,7 @@  File: hledger.info,  Node: web,  Next: iadd,  Prev: ui,  Up: Add-on commands -3.30.2 web+3.32.2 web ----------  hledger-web provides a simple web interface.@@ -3696,7 +3896,7 @@  File: hledger.info,  Node: iadd,  Next: interest,  Prev: web,  Up: Add-on commands -3.30.3 iadd+3.32.3 iadd -----------  hledger-iadd is a more interactive, terminal UI replacement for the add@@ -3705,7 +3905,7 @@  File: hledger.info,  Node: interest,  Prev: iadd,  Up: Add-on commands -3.30.4 interest+3.32.4 interest ---------------  hledger-interest generates interest transactions for an account@@ -3720,10 +3920,7 @@ 4 ENVIRONMENT ************* -*COLUMNS* The screen width used by the register command.  Default: the-full terminal width.--   *LEDGER_FILE* The journal file path when not specified with '-f'.+*LEDGER_FILE* The journal file path when not specified with '-f'. Default: '~/.hledger.journal' (on windows, perhaps 'C:/Users/USER/.hledger.journal'). @@ -3743,6 +3940,13 @@     To see the effect you may need to 'killall Dock', or reboot. +   *COLUMNS* The screen width used by the register command.  Default:+the full terminal width.++   *NO_COLOR* If this variable exists with any value, hledger will not+use ANSI color codes in terminal output.  This overrides the+-color/-colour option.+  File: hledger.info,  Node: FILES,  Next: LIMITATIONS,  Prev: ENVIRONMENT,  Up: Top @@ -3858,197 +4062,204 @@  Tag Table: Node: Top68-Node: COMMON TASKS2319-Ref: #common-tasks2431-Node: Getting help2838-Ref: #getting-help2970-Node: Constructing command lines3523-Ref: #constructing-command-lines3715-Node: Starting a journal file4412-Ref: #starting-a-journal-file4610-Node: Setting opening balances5798-Ref: #setting-opening-balances5994-Node: Recording transactions9135-Ref: #recording-transactions9315-Node: Reconciling9871-Ref: #reconciling10014-Node: Reporting12271-Ref: #reporting12411-Node: Migrating to a new file16410-Ref: #migrating-to-a-new-file16558-Node: OPTIONS16857-Ref: #options16964-Node: General options17334-Ref: #general-options17459-Node: Command options20413-Ref: #command-options20564-Node: Command arguments20962-Ref: #command-arguments21109-Node: Queries21989-Ref: #queries22144-Node: Special characters in arguments and queries26106-Ref: #special-characters-in-arguments-and-queries26334-Node: More escaping26785-Ref: #more-escaping26947-Node: Even more escaping27243-Ref: #even-more-escaping27437-Node: Less escaping28108-Ref: #less-escaping28270-Node: Unicode characters28515-Ref: #unicode-characters28697-Node: Input files30109-Ref: #input-files30252-Node: Output destination32181-Ref: #output-destination32333-Node: Output format32758-Ref: #output-format32908-Node: Regular expressions34490-Ref: #regular-expressions34647-Node: Smart dates36383-Ref: #smart-dates36534-Node: Report start & end date37895-Ref: #report-start-end-date38067-Node: Report intervals39564-Ref: #report-intervals39729-Node: Period expressions40119-Ref: #period-expressions40279-Node: Depth limiting44415-Ref: #depth-limiting44559-Node: Pivoting44891-Ref: #pivoting45014-Node: Valuation46690-Ref: #valuation46792-Node: -B Cost47481-Ref: #b-cost47585-Node: -V Value47718-Ref: #v-value47864-Node: -X Value in specified commodity48059-Ref: #x-value-in-specified-commodity48258-Node: Valuation date48407-Ref: #valuation-date48575-Node: Market prices48985-Ref: #market-prices49165-Node: --infer-value market prices from transactions49942-Ref: #infer-value-market-prices-from-transactions50191-Node: Valuation commodity51473-Ref: #valuation-commodity51682-Node: Simple valuation examples52908-Ref: #simple-valuation-examples53110-Node: --value Flexible valuation53769-Ref: #value-flexible-valuation53977-Node: More valuation examples55924-Ref: #more-valuation-examples56133-Node: Effect of valuation on reports58138-Ref: #effect-of-valuation-on-reports58326-Node: COMMANDS63847-Ref: #commands63955-Node: accounts65039-Ref: #accounts65137-Node: activity65836-Ref: #activity65946-Node: add66329-Ref: #add66428-Node: balance69167-Ref: #balance69278-Node: Classic balance report70736-Ref: #classic-balance-report70909-Node: Customising the classic balance report72278-Ref: #customising-the-classic-balance-report72506-Node: Colour support74582-Ref: #colour-support74749-Node: Flat mode74922-Ref: #flat-mode75070-Node: Depth limited balance reports75483-Ref: #depth-limited-balance-reports75668-Node: Percentages76124-Ref: #percentages76290-Node: Multicolumn balance report77427-Ref: #multicolumn-balance-report77607-Node: Budget report82869-Ref: #budget-report83012-Node: Nested budgets88278-Ref: #nested-budgets88390-Ref: #output-format-191871-Node: balancesheet92068-Ref: #balancesheet92204-Node: balancesheetequity93670-Ref: #balancesheetequity93819-Node: cashflow94542-Ref: #cashflow94670-Node: check-dates95849-Ref: #check-dates95976-Node: check-dupes96255-Ref: #check-dupes96379-Node: close96672-Ref: #close96786-Node: close usage98308-Ref: #close-usage98401-Node: commodities101214-Ref: #commodities101341-Node: descriptions101423-Ref: #descriptions101551-Node: diff101732-Ref: #diff101838-Node: files102885-Ref: #files102985-Node: help103132-Ref: #help103232-Node: import104313-Ref: #import104427-Node: Importing balance assignments105320-Ref: #importing-balance-assignments105468-Node: incomestatement106117-Ref: #incomestatement106250-Node: notes107737-Ref: #notes107850-Node: payees107976-Ref: #payees108082-Node: prices108240-Ref: #prices108346-Node: print108687-Ref: #print108797-Node: print-unique113583-Ref: #print-unique113709-Node: register113994-Ref: #register114121-Node: Custom register output118293-Ref: #custom-register-output118422-Node: register-match119759-Ref: #register-match119893-Node: rewrite120244-Ref: #rewrite120359-Node: Re-write rules in a file122214-Ref: #re-write-rules-in-a-file122348-Node: Diff output format123558-Ref: #diff-output-format123727-Node: rewrite vs print --auto124819-Ref: #rewrite-vs.-print---auto124998-Node: roi125554-Ref: #roi125652-Node: stats126664-Ref: #stats126763-Node: tags127551-Ref: #tags127649-Node: test127943-Ref: #test128051-Node: Add-on commands128798-Ref: #add-on-commands128915-Node: ui130258-Ref: #ui130346-Node: web130400-Ref: #web130503-Node: iadd130619-Ref: #iadd130730-Node: interest130812-Ref: #interest130919-Node: ENVIRONMENT131159-Ref: #environment131271-Node: FILES132100-Ref: #files-1132203-Node: LIMITATIONS132416-Ref: #limitations132535-Node: TROUBLESHOOTING133277-Ref: #troubleshooting133390+Node: COMMON TASKS2321+Ref: #common-tasks2433+Node: Getting help2840+Ref: #getting-help2972+Node: Constructing command lines3525+Ref: #constructing-command-lines3717+Node: Starting a journal file4414+Ref: #starting-a-journal-file4612+Node: Setting opening balances5800+Ref: #setting-opening-balances5996+Node: Recording transactions9137+Ref: #recording-transactions9317+Node: Reconciling9873+Ref: #reconciling10016+Node: Reporting12273+Ref: #reporting12413+Node: Migrating to a new file16412+Ref: #migrating-to-a-new-file16560+Node: OPTIONS16859+Ref: #options16966+Node: General options17336+Ref: #general-options17461+Node: Command options20767+Ref: #command-options20918+Node: Command arguments21316+Ref: #command-arguments21463+Node: Queries22343+Ref: #queries22498+Node: Special characters in arguments and queries26460+Ref: #special-characters-in-arguments-and-queries26688+Node: More escaping27139+Ref: #more-escaping27301+Node: Even more escaping27597+Ref: #even-more-escaping27791+Node: Less escaping28462+Ref: #less-escaping28624+Node: Unicode characters28869+Ref: #unicode-characters29051+Node: Input files30463+Ref: #input-files30606+Node: Output destination32905+Ref: #output-destination33057+Node: Output format33482+Ref: #output-format33632+Node: Regular expressions35799+Ref: #regular-expressions35956+Node: Smart dates37692+Ref: #smart-dates37843+Node: Report start & end date39204+Ref: #report-start-end-date39376+Node: Report intervals40873+Ref: #report-intervals41038+Node: Period expressions41428+Ref: #period-expressions41588+Node: Depth limiting45920+Ref: #depth-limiting46064+Node: Pivoting46396+Ref: #pivoting46519+Node: Valuation48195+Ref: #valuation48297+Node: -B Cost48986+Ref: #b-cost49090+Node: -V Value49223+Ref: #v-value49369+Node: -X Value in specified commodity49564+Ref: #x-value-in-specified-commodity49763+Node: Valuation date49912+Ref: #valuation-date50080+Node: Market prices50490+Ref: #market-prices50670+Node: --infer-value market prices from transactions51447+Ref: #infer-value-market-prices-from-transactions51696+Node: Valuation commodity52978+Ref: #valuation-commodity53187+Node: Simple valuation examples54413+Ref: #simple-valuation-examples54615+Node: --value Flexible valuation55274+Ref: #value-flexible-valuation55482+Node: More valuation examples57429+Ref: #more-valuation-examples57638+Node: Effect of valuation on reports59643+Ref: #effect-of-valuation-on-reports59831+Node: COMMANDS65352+Ref: #commands65460+Node: accounts66568+Ref: #accounts66666+Node: activity67365+Ref: #activity67475+Node: add67858+Ref: #add67959+Node: aregister70752+Ref: #aregister70864+Node: aregister and custom posting dates72237+Ref: #aregister-and-custom-posting-dates72410+Ref: #output-format-173003+Node: balance73408+Ref: #balance73525+Node: Classic balance report74983+Ref: #classic-balance-report75156+Node: Customising the classic balance report76540+Ref: #customising-the-classic-balance-report76768+Node: Colour support78844+Ref: #colour-support79011+Node: Flat mode79107+Ref: #flat-mode79255+Node: Depth limited balance reports79668+Ref: #depth-limited-balance-reports79853+Node: Percentages80309+Ref: #percentages80475+Node: Multicolumn balance report81612+Ref: #multicolumn-balance-report81792+Node: Budget report87389+Ref: #budget-report87532+Node: Nested budgets92798+Ref: #nested-budgets92910+Ref: #output-format-296391+Node: balancesheet96588+Ref: #balancesheet96724+Node: balancesheetequity98236+Ref: #balancesheetequity98385+Node: cashflow99461+Ref: #cashflow99589+Node: check-dates100805+Ref: #check-dates100932+Node: check-dupes101211+Ref: #check-dupes101337+Node: close101630+Ref: #close101738+Node: close usage103260+Ref: #close-usage103353+Node: codes106166+Ref: #codes106274+Node: commodities106986+Ref: #commodities107113+Node: descriptions107195+Ref: #descriptions107323+Node: diff107627+Ref: #diff107733+Node: files108780+Ref: #files108880+Node: help109027+Ref: #help109127+Node: import110208+Ref: #import110322+Node: Importing balance assignments111215+Ref: #importing-balance-assignments111363+Node: incomestatement112012+Ref: #incomestatement112145+Node: notes113490+Ref: #notes113603+Node: payees113971+Ref: #payees114077+Node: prices114497+Ref: #prices114603+Node: print114944+Ref: #print115054+Node: print-unique119850+Ref: #print-unique119976+Node: register120261+Ref: #register120388+Node: Custom register output124837+Ref: #custom-register-output124966+Node: register-match126303+Ref: #register-match126437+Node: rewrite126788+Ref: #rewrite126903+Node: Re-write rules in a file128758+Ref: #re-write-rules-in-a-file128892+Node: Diff output format130102+Ref: #diff-output-format130271+Node: rewrite vs print --auto131363+Ref: #rewrite-vs.-print---auto131542+Node: roi132098+Ref: #roi132196+Node: stats133208+Ref: #stats133307+Node: tags134095+Ref: #tags134193+Node: test134712+Ref: #test134820+Node: Add-on commands135567+Ref: #add-on-commands135684+Node: ui137027+Ref: #ui137115+Node: web137169+Ref: #web137272+Node: iadd137388+Ref: #iadd137499+Node: interest137581+Ref: #interest137688+Node: ENVIRONMENT137928+Ref: #environment138040+Node: FILES139025+Ref: #files-1139128+Node: LIMITATIONS139341+Ref: #limitations139460+Node: TROUBLESHOOTING140202+Ref: #troubleshooting140315  End Tag Table 
hledger.txt view
@@ -538,6 +538,13 @@               for the next 6 months or till report end date.   In  hledger-ui,               also make ordinary future transactions visible. +       --color=WHEN (or --colour=WHEN)+              Should  color-supporting  commands  use ANSI color codes in text+              output.  'auto' (default): whenever stdout seems to be a  color-+              supporting  terminal.  'always' or 'yes': always, useful eg when+              piping output into  'less  -R'.   'never'  or  'no':  never.   A+              NO_COLOR environment variable overrides this.+        When a reporting option appears more than once in the command line, the        last one takes precedence. @@ -803,40 +810,49 @@                $ cat some.journal | hledger -f- -       Usually the data file is in hledger's journal format, but it  can  also-       be  one  of  several  other formats, listed below.  hledger detects the-       format automatically based on the file extension, or  if  that  is  not-       recognised, by trying each built-in "reader" in turn:+       Usually the data file is in hledger's journal format, but it can be  in+       any of the supported file formats, which currently are: -       Reader:    Reads:                            Used for file extensions:+       Reader:    Reads:                                    Used  for  file  exten-+                                                            sions:        ------------------------------------------------------------------------------       journal    hledger's  journal format, also   .journal .j .hledger .ledger-                  some Ledger journals-       time-      timeclock  files  (precise time   .timeclock-       clock      logging)-       timedot    timedot files (approximate time   .timedot-                  logging)-       csv        comma-separated   values  (data   .csv-                  interchange)+       journal    hledger journal files and  some  Ledger   .journal   .j  .hledger+                  journals, for transactions                .ledger+       time-      timeclock  files, for precise time log-   .timeclock+       clock      ging+       timedot    timedot  files,  for  approximate  time   .timedot+                  logging+       csv        comma/semicolon/tab/other-separated       .csv .ssv .tsv+                  values, for data import -       If needed (eg to ensure correct error messages  when  a  file  has  the-       "wrong"  extension), you can force a specific reader/format by prepend--       ing it to the file path with a colon.  Examples:+       hledger detects the format automatically based on the  file  extensions+       shown  above.   If  it  can't  recognise the file extension, it assumes+       journal format.  So for non-journal files,  it's  important  to  use  a+       recognised file extension, so as to either read successfully or to show+       relevant error messages. +       When you can't ensure the right file extension, not to worry:  you  can+       force a specific reader/format by prefixing the file path with the for-+       mat and a colon.  Eg to read a .dat file as csv:+               $ hledger -f csv:/some/csv-file.dat stats               $ echo 'i 2009/13/1 08:00:00' | hledger print -ftimeclock:- -       You can also specify multiple -f options, to read multiple files as one-       big journal.  There are some limitations with this:+       You can specify multiple -f options, to read multiple files as one  big+       journal.  There are some limitations with this:         o directives in one file will not affect the other files         o balance  assertions  will  not see any account balances from previous          files -       If you need those, either use the include directive, or concatenate the-       files, eg: cat a.journal b.journal | hledger -f- CMD.+       If you need either of those things, you can +       o use a single parent file which includes the others++       o or concatenate the files into one before reading, eg:  cat  a.journal+         b.journal | hledger -f- CMD.+    Output destination        hledger commands send their output to the terminal by default.  You can        of course redirect this, eg into a file, using standard shell syntax:@@ -853,8 +869,8 @@    Output format        Some commands (print, register, the balance commands) offer a choice of        output format.  In addition to the usual plain text format (txt), there-       are CSV (csv), HTML (html) and JSON (json).  This is controlled by  the-       -O/--output-format option:+       are CSV (csv), HTML (html), JSON (json) and SQL (sql).   This  is  con-+       trolled by the -O/--output-format option:                $ hledger print -O csv @@ -886,61 +902,74 @@          hope this approach will not cause problems in practice; if  you  find          otherwise, please let us know.  (Cf #1195) +       Notes about SQL output:++       o SQL  output is also marked experimental, and much like JSON could use+         real-world feedback.++       o SQL output is expected to work with sqlite, MySQL and PostgreSQL++       o SQL output is structured with the expectations that  statements  will+         be  executed  in the empty database.  If you already have tables cre-+         ated via SQL output of hledger, you would  probably  want  to  either+         clear tables of existing data (via delete or truncate SQL statements)+         or drop tables completely as otherwise your postings will be duped.+    Regular expressions        hledger uses regular expressions in a number of places: -       o query  terms, on the command line and in the hledger-web search form:+       o query terms, on the command line and in the hledger-web search  form:          REGEX, desc:REGEX, cur:REGEX, tag:...=REGEX         o CSV rules conditional blocks: if REGEX ... -       o account alias directives and options: alias  /REGEX/  =  REPLACEMENT,+       o account  alias  directives  and options: alias /REGEX/ = REPLACEMENT,          --alias /REGEX/=REPLACEMENT -       hledger's  regular  expressions  come  from the regex-tdfa library.  If-       they're not doing what you expect, it's important to know exactly  what+       hledger's regular expressions come from  the  regex-tdfa  library.   If+       they're  not doing what you expect, it's important to know exactly what        they support:         1. they are case insensitive -       2. they  are infix matching (they do not need to match the entire thing+       2. they are infix matching (they do not need to match the entire  thing           being matched)         3. they are POSIX ERE (extended regular expressions)         4. they also support GNU word boundaries (\b, \B, \<, \>) -       5. they do not support backreferences; if you write \1, it  will  match-          the  digit  1.   Except  when  doing text replacement, eg in account-          aliases, where backreferences can be used in the replacement  string+       5. they  do  not support backreferences; if you write \1, it will match+          the digit 1.  Except when doing  text  replacement,  eg  in  account+          aliases,  where backreferences can be used in the replacement string           to reference capturing groups in the search regexp. -       6. they  do  not  support mode modifiers ((?s)), character classes (\w,+       6. they do not support mode modifiers ((?s)),  character  classes  (\w,           \d), or anything else not mentioned above.         Some things to note: -       o In the alias directive and --alias option, regular  expressions  must-         be  enclosed  in  forward  slashes  (/REGEX/).  Elsewhere in hledger,+       o In  the  alias directive and --alias option, regular expressions must+         be enclosed in forward  slashes  (/REGEX/).   Elsewhere  in  hledger,          these are not required. -       o In queries, to match a regular expression metacharacter like $  as  a-         literal  character,  prepend  a  backslash.  Eg to search for amounts+       o In  queries,  to match a regular expression metacharacter like $ as a+         literal character, prepend a backslash.  Eg  to  search  for  amounts          with the dollar sign in hledger-web, write cur:\$. -       o On the command line, some metacharacters like $ have a special  mean-+       o On  the command line, some metacharacters like $ have a special mean-          ing to the shell and so must be escaped at least once more.  See Spe-          cial characters.     Smart dates        hledger's user interfaces accept a flexible "smart date" syntax (unlike-       dates  in the journal file).  Smart dates allow some english words, can-       be relative to today's date, and can have less-significant  date  parts+       dates in the journal file).  Smart dates allow some english words,  can+       be  relative  to today's date, and can have less-significant date parts        omitted (defaulting to 1).         Examples: -       2004/10/1,   2004-01-01,   exact date, several separators allowed.   Year+       2004/10/1,   2004-01-01,   exact  date, several separators allowed.  Year        2004.9.1                   is 4+ digits, month is 1-12, day is 1-31        2004                       start of year        2004/10                    start of month@@ -955,48 +984,48 @@        20181201                   8 digit YYYYMMDD with valid year month and day        201812                     6 digit YYYYMM with valid year and month -       Counterexamples - malformed digit sequences might give  surprising  re-+       Counterexamples  -  malformed digit sequences might give surprising re-        sults: -       201813        6  digits  with  an  invalid  month  is  parsed as start of+       201813        6 digits with an  invalid  month  is  parsed  as  start  of                      6-digit year-       20181301      8 digits with an  invalid  month  is  parsed  as  start  of+       20181301      8  digits  with  an  invalid  month  is  parsed as start of                      8-digit year        20181232      8 digits with an invalid day gives an error        201801012     9+ digits beginning with a valid YYYYMMDD gives an error     Report start & end date-       Most  hledger  reports  show  the  full span of time represented by the+       Most hledger reports show the full span  of  time  represented  by  the        journal data, by default.  So, the effective report start and end dates-       will  be  the earliest and latest transaction or posting dates found in+       will be the earliest and latest transaction or posting dates  found  in        the journal. -       Often you will want to see a shorter time span,  such  as  the  current-       month.   You  can  specify  a  start  and/or end date using -b/--begin,+       Often  you  will  want  to see a shorter time span, such as the current+       month.  You can specify a  start  and/or  end  date  using  -b/--begin,        -e/--end, -p/--period or a date: query (described below).  All of these        accept the smart date syntax.         Some notes: -       o As  in Ledger, end dates are exclusive, so you need to write the date+       o As in Ledger, end dates are exclusive, so you need to write the  date          after the last day you want to include. -       o As noted in reporting options: among start/end dates  specified  with+       o As  noted  in reporting options: among start/end dates specified with          options, the last (i.e.  right-most) option takes precedence. -       o The  effective report start and end dates are the intersection of the-         start/end dates from options and that from date: queries.   That  is,-         date:2019-01  date:2019  -p'2000  to  2030'  yields January 2019, the+       o The effective report start and end dates are the intersection of  the+         start/end  dates  from options and that from date: queries.  That is,+         date:2019-01 date:2019 -p'2000 to  2030'  yields  January  2019,  the          smallest common time span.         Examples:         -b 2016/3/17       begin on St. Patrick's day 2016-       -e 12/1            end at the start of  december  1st  of  the  current  year+       -e 12/1            end  at  the  start  of  december  1st of the current year                           (11/30 will be the last date included)        -b thismonth       all transactions on or after the 1st of the current month        -p thismonth       all transactions in the current month-       date:2016/3/17..   the above written as queries instead (.. can also  be  re-+       date:2016/3/17..   the  above  written as queries instead (.. can also be re-                           placed with -)        date:..12/1        date:thismonth..@@ -1004,31 +1033,31 @@     Report intervals        A report interval can be specified so that commands like register, bal--       ance and activity will divide their reports into  multiple  subperiods.-       The   basic   intervals   can  be  selected  with  one  of  -D/--daily,-       -W/--weekly, -M/--monthly, -Q/--quarterly, or -Y/--yearly.   More  com--       plex  intervals  may be specified with a period expression.  Report in-+       ance  and  activity will divide their reports into multiple subperiods.+       The  basic  intervals  can  be  selected  with   one   of   -D/--daily,+       -W/--weekly,  -M/--monthly,  -Q/--quarterly, or -Y/--yearly.  More com-+       plex intervals may be specified with a period expression.   Report  in-        tervals can not be specified with a query.     Period expressions-       The -p/--period option accepts period expressions, a shorthand  way  of+       The  -p/--period  option accepts period expressions, a shorthand way of        expressing a start date, end date, and/or report interval all at once. -       Here's  a basic period expression specifying the first quarter of 2009.-       Note, hledger always treats start dates as inclusive and end  dates  as+       Here's a basic period expression specifying the first quarter of  2009.+       Note,  hledger  always treats start dates as inclusive and end dates as        exclusive:         -p "from 2009/1/1 to 2009/4/1" -       Keywords  like  "from" and "to" are optional, and so are the spaces, as-       long as you don't run two dates together.  "to" can also be written  as+       Keywords like "from" and "to" are optional, and so are the  spaces,  as+       long  as you don't run two dates together.  "to" can also be written as        ".." or "-".  These are equivalent to the above:         -p "2009/1/1 2009/4/1"        -p2009/1/1to2009/4/1        -p2009/1/1..2009/4/1 -       Dates  are  smart  dates, so if the current year is 2009, the above can+       Dates are smart dates, so if the current year is 2009,  the  above  can        also be written as:         -p "1/1 4/1"@@ -1042,20 +1071,29 @@                             1, 2009        -p "from 2009/1"     the same        -p "from 2009"       the same-       -p "to 2009"         everything before  january++       -p "to 2009"         everything  before january                             1, 2009 -       A  single  date  with  no "from" or "to" defines both the start and end+       A single date with no "from" or "to" defines both  the  start  and  end        date like so: -       -p "2009"       the year 2009;  equivalent+       -p "2009"       the  year 2009; equivalent                        to "2009/1/1 to 2010/1/1"-       -p "2009/1"     the  month of jan; equiva-+       -p "2009/1"     the month of jan;  equiva-                        lent   to   "2009/1/1   to                        2009/2/1"-       -p "2009/1/1"   just  that day; equivalent+       -p "2009/1/1"   just that day;  equivalent                        to "2009/1/1 to 2009/1/2" +       Or you can specify a single quarter like so:++       -p "2009Q1"   first   quarter  of  2009,+                     equivalent to "2009/1/1 to+                     2009/4/1"+       -p "q4"       fourth quarter of the cur-+                     rent year+        The argument of -p can also begin with, or be, a  report  interval  ex-        pression.  The basic report intervals are daily, weekly, monthly, quar-        terly, or yearly, which have the same effect as the -D,-W,-M,-Q, or  -Y@@ -1075,8 +1113,6 @@         -p  "weekly from 2009/1/1   starts on 2008/12/29, closest preceding Mon-        to 2009/4/1"                day--        -p       "monthly      in   starts on 2018/11/01        2008/11/25"        -p    "quarterly     from   starts  on  2009/04/01,  ends on 2009/06/30,@@ -1085,8 +1121,8 @@        2009-12-29"         The  following  more  complex  report intervals are also supported: bi--       weekly,   bimonthly,   every   day|week|month|quarter|year,   every   N-       days|weeks|months|quarters|years.+       weekly, fortnightly, bimonthly, every day|week|month|quarter|year,  ev-+       ery N days|weeks|months|quarters|years.         All  of  these  will start on the first day of the requested period and        end on the last one, as described above.@@ -1526,6 +1562,7 @@        tal/average    of displayed   of displayed   of  displayed   of displayed   of  displayed                       values         values         values          values         values +        balance (bs,        bse,     cf,        is..)@@ -1652,24 +1689,25 @@     add        add-       Prompt for transactions and add them to the journal.+       Prompt for transactions and add them to  the  journal.   Any  arguments+       will be used as default inputs for the first N prompts. -       Many hledger users edit their journals directly with a text editor,  or-       generate  them from CSV.  For more interactive data entry, there is the-       add command, which prompts interactively on the console for new  trans-+       Many  hledger users edit their journals directly with a text editor, or+       generate them from CSV.  For more interactive data entry, there is  the+       add  command, which prompts interactively on the console for new trans-        actions, and appends them to the journal file (if there are multiple -f-       FILE options, the first file is used.) Existing  transactions  are  not-       changed.   This  is the only hledger command that writes to the journal+       FILE  options,  the  first file is used.) Existing transactions are not+       changed.  This is the only hledger command that writes to  the  journal        file.         To use it, just run hledger add and follow the prompts.  You can add as-       many  transactions as you like; when you are finished, enter . or press+       many transactions as you like; when you are finished, enter . or  press        control-d or control-c to exit.         Features: -       o add tries to provide useful defaults, using the most similar (by  de--         scription)  recent  transaction  (filtered by the query, if any) as a+       o add  tries to provide useful defaults, using the most similar (by de-+         scription) recent transaction (filtered by the query, if  any)  as  a          template.         o You can also set the initial defaults with command line arguments.@@ -1677,10 +1715,10 @@        o Readline-style edit keys can be used during data entry.         o The tab key will auto-complete whenever possible - accounts, descrip--         tions,  dates  (yesterday,  today,  tomorrow).   If the input area is+         tions, dates (yesterday, today, tomorrow).   If  the  input  area  is          empty, it will insert the default value. -       o If the journal defines a default commodity, it will be added  to  any+       o If  the  journal defines a default commodity, it will be added to any          bare numbers entered.         o A parenthesised transaction code may be entered following a date.@@ -1689,7 +1727,7 @@         o If you make a mistake, enter < at any prompt to go one step backward. -       o Input  prompts  are displayed in a different colour when the terminal+       o Input prompts are displayed in a different colour when  the  terminal          supports it.         Example (see the tutorial for a detailed explanation):@@ -1719,10 +1757,71 @@               Starting the next transaction (. or ctrl-D/ctrl-C to quit)               Date [2015/05/22]: <CTRL-D> $ -       On Microsoft Windows, the add command makes sure that no  part  of  the-       file  path  ends with a period, as it can cause data loss on that plat--       form (cf #1056).+       On  Microsoft  Windows,  the add command makes sure that no part of the+       file path ends with a period, as that would cause problems (#1056). +   aregister+       aregister, areg+       Show transactions affecting a particular  account,  and  the  account's+       running balance.++       aregister  shows  the  transactions affecting a particular account (and+       its subaccounts), from the point of view of that  account.   Each  line+       shows:++       o the transaction's (or posting's, see below) date++       o the names of the other account(s) involved++       o the net change to this account's balance++       o the  account's  historical  running  balance  (including balance from+         transactions before the report start date).++       With aregister, each line  represents  a  whole  transaction  -  as  in+       hledger-ui,  hledger-web,  and  your  bank statement.  By contrast, the+       register command shows individual postings, across all  accounts.   You+       might  prefer aregister for reconciling with real-world asset/liability+       accounts, and register for reviewing detailed revenues/expenses.++       An account must be specified as the first argument, which should be the+       full  account name or an account pattern (regular expression).  aregis-+       ter will show transactions in this account (the first one matched)  and+       any of its subaccounts.++       Any  additional  arguments  form a query which will filter the transac-+       tions shown.++       Transactions making a net change of zero are not shown by default;  add+       the -E/--empty flag to show them.++   aregister and custom posting dates+       Transactions  whose  date  is  outside  the  report period can still be+       shown, if they have a posting to this account dated inside  the  report+       period.   (And  in this case it's the posting date that is shown.) This+       ensures that aregister can show an accurate historical running balance,+       matching the one shown by register -H with the same arguments.++       To  filter  strictly  by  transaction date instead, add the --txn-dates+       flag.  If you use this flag and  some  of  your  postings  have  custom+       dates, it's probably best to assume the running balance is wrong.++   Output format+       This command also supports the output destination and output format op-+       tions The output formats supported are txt, csv, and json.++       Examples:++       Show all transactions and historical running balance in the  first  ac-+       count whose name contains "checking":++              $ hledger areg checking++       Show  transactions and historical running balance in all asset accounts+       during july:++              $ hledger areg assets date:jul+    balance        balance, bal, b        Show accounts and their balances.@@ -1770,7 +1869,7 @@        By default, accounts are displayed hierarchically, with subaccounts in-        dented below their parent.  At each level of  the  tree,  accounts  are        sorted  by  account  code  if  any,  then  by  account  name.   Or with-       -S/--sort-amount, by their balance amount.+       -S/--sort-amount, by their balance amount, largest first.         "Boring" accounts, which contain a single interesting subaccount and no        balance  of their own, are elided into the following line for more com-@@ -1856,16 +1955,13 @@          single-column balance report     Colour support-       The balance command shows negative amounts in red, if:--       o the TERM environment variable is not set to dumb--       o the output is not being redirected or piped anywhere+       In  terminal  output, when colour is enabled, the balance command shows+       negative amounts in red.     Flat mode-       To  see  a  flat  list instead of the default hierarchical display, use-       --flat.  In this mode, accounts (unless depth-clipped) show their  full-       names  and  "exclusive" balance, excluding any subaccount balances.  In+       To see a flat list instead of the  default  hierarchical  display,  use+       --flat.   In this mode, accounts (unless depth-clipped) show their full+       names and "exclusive" balance, excluding any subaccount  balances.   In        this mode, you can also use --drop N to omit the first few account name        components. @@ -1874,8 +1970,8 @@                                 $1  supplies     Depth limited balance reports-       With  --depth  N  or  depth:N or just -N, balance reports show accounts-       only to the specified numeric depth.  This is very useful to  summarise+       With --depth N or depth:N or just -N,  balance  reports  show  accounts+       only  to the specified numeric depth.  This is very useful to summarise        a complex set of accounts and get an overview.                $ hledger balance -N -1@@ -1888,9 +1984,9 @@        inclusive balances at the depth limit.     Percentages-       With -% or --percent, balance reports show  each  account's  value  ex--       pressed  as  a percentage of the column's total.  This is useful to get-       an overview of the relative sizes of account balances.  For example  to+       With  -%  or  --percent,  balance reports show each account's value ex-+       pressed as a percentage of the column's total.  This is useful  to  get+       an  overview of the relative sizes of account balances.  For example to        obtain an overview of expenses:                $ hledger balance expenses -%@@ -1900,32 +1996,32 @@               --------------------                            100.0 % -       Note  that  --tree  does not have an effect on -%.  The percentages are-       always relative to the total sum of each column, they are  never  rela-+       Note that --tree does not have an effect on -%.   The  percentages  are+       always  relative  to the total sum of each column, they are never rela-        tive to the parent account. -       Since  the  percentages  are relative to the columns sum, it is usually-       not useful to calculate percentages if the signs  of  the  amounts  are-       mixed.   Although  the  results  are technically correct, they are most-       likely useless.  Especially in a balance report that sums  up  to  zero+       Since the percentages are relative to the columns sum,  it  is  usually+       not  useful  to  calculate  percentages if the signs of the amounts are+       mixed.  Although the results are technically  correct,  they  are  most+       likely  useless.   Especially  in a balance report that sums up to zero        (eg hledger balance -B) all percentage values will be zero. -       This  flag does not work if the report contains any mixed commodity ac-+       This flag does not work if the report contains any mixed commodity  ac-        counts.  If there are mixed commodity accounts in the report be sure to        use -V or -B to coerce the report into using a single commodity.     Multicolumn balance report-       Multicolumn  or  tabular balance reports are a very useful hledger fea--       ture, and usually the preferred style.  They share many  of  the  above-       features,  but they show the report as a table, with columns represent--       ing time periods.  This mode is activated by providing a reporting  in-+       Multicolumn or tabular balance reports are a very useful  hledger  fea-+       ture,  and  usually  the preferred style.  They share many of the above+       features, but they show the report as a table, with columns  represent-+       ing  time periods.  This mode is activated by providing a reporting in-        terval. -       There  are three types of multicolumn balance report, showing different+       There are three types of multicolumn balance report, showing  different        information:         1. By default: each column shows the sum of postings in that period, ie-          the  account's  change of balance in that period.  This is useful eg+          the account's change of balance in that period.  This is  useful  eg           for a monthly income statement:                    $ hledger balance --quarterly income expenses -E@@ -1941,7 +2037,7 @@                                      ||     $-1      $1       0       0         2. With --cumulative: each column shows the ending balance for that pe--          riod,  accumulating  the  changes across periods, starting from 0 at+          riod, accumulating the changes across periods, starting  from  0  at           the report start date:                    $ hledger balance --quarterly income expenses -E --cumulative@@ -1957,8 +2053,8 @@                                      ||         $-1           0           0           0         3. With --historical/-H: each column shows the actual historical ending-          balance  for  that  period, accumulating the changes across periods,-          starting from the actual balance at the report start date.  This  is+          balance for that period, accumulating the  changes  across  periods,+          starting  from the actual balance at the report start date.  This is           useful eg for a multi-period balance sheet, and when you are showing           only the data after a certain start date: @@ -1977,26 +2073,26 @@        Note that --cumulative or --historical/-H disable --row-total/-T, since        summing end balances generally does not make sense. -       Multicolumn  balance  reports display accounts in flat mode by default;+       Multicolumn balance reports display accounts in flat mode  by  default;        to see the hierarchy, use --tree. -       With  a  reporting  interval  (like  --quarterly  above),  the   report-       start/end  dates  will  be adjusted if necessary so that they encompass+       With   a  reporting  interval  (like  --quarterly  above),  the  report+       start/end dates will be adjusted if necessary so  that  they  encompass        the displayed report periods.  This is so that the first and last peri-        ods will be "full" and comparable to the others. -       The  -E/--empty  flag  does  two things in multicolumn balance reports:+       The -E/--empty flag does two things  in  multicolumn  balance  reports:        first, the report will show all columns within the specified report pe--       riod  (without -E, leading and trailing columns with all zeroes are not-       shown).  Second, all accounts which existed at the  report  start  date-       will  be  considered, not just the ones with activity during the report-       period (use -E to include low-activity accounts which  would  otherwise+       riod (without -E, leading and trailing columns with all zeroes are  not+       shown).   Second,  all  accounts which existed at the report start date+       will be considered, not just the ones with activity during  the  report+       period  (use  -E to include low-activity accounts which would otherwise        would be omitted).         The -T/--row-total flag adds an additional column showing the total for        each row. -       The -A/--average flag adds a column showing the average value  in  each+       The  -A/--average  flag adds a column showing the average value in each        row.         Here's an example of all three:@@ -2017,21 +2113,27 @@                (Average is rounded to the dollar here since all journal amounts are) -       A  limitation  of multicolumn balance reports: eliding of boring parent-       accounts in tree mode, as in the classic balance  report,  is  not  yet-       supported.--       The  --transpose flag can be used to exchange the rows and columns of a+       The --transpose flag can be used to exchange the rows and columns of  a        multicolumn report. +       When  showing  multicommodity amounts, multicolumn balance reports will+       elide any amounts which have more than two commodities, since otherwise+       columns  could get very wide.  The --no-elide flag disables this.  Hid-+       ing totals with the -N/--no-total flag can also help reduce  the  width+       of multicommodity reports.++       When the report is still too wide, a good workaround is to pipe it into+       less -RS (-R for colour, -S to chop long lines).  Eg:  hledger  bal  -D+       --color=yes | less -RS.+    Budget report-       With --budget, extra columns are displayed  showing  budget  goals  for-       each  account and period, if any.  Budget goals are defined by periodic+       With  --budget,  extra  columns  are displayed showing budget goals for+       each account and period, if any.  Budget goals are defined by  periodic        transactions.  This is very useful for comparing planned and actual in--       come,  expenses, time usage, etc.  --budget is most often combined with+       come, expenses, time usage, etc.  --budget is most often combined  with        a report interval. -       For example, you can take average monthly expenses in  the  common  ex-+       For  example,  you  can take average monthly expenses in the common ex-        pense categories to construct a minimal monthly budget:                ;; Budget@@ -2078,26 +2180,26 @@         This is different from a normal balance report in several ways: -       o Only  accounts  with budget goals during the report period are shown,+       o Only accounts with budget goals during the report period  are  shown,          by default. -       o In each column, in square brackets after the  actual  amount,  budget-         goal  amounts are shown, and the actual/goal percentage.  (Note: bud-+       o In  each  column,  in square brackets after the actual amount, budget+         goal amounts are shown, and the actual/goal percentage.  (Note:  bud-          get goals should be in the same commodity as the actual amount.) -       o All parent accounts are always shown, even in flat mode.  Eg  assets,+       o All  parent accounts are always shown, even in flat mode.  Eg assets,          assets:bank, and expenses above. -       o Amounts  always include all subaccounts, budgeted or unbudgeted, even+       o Amounts always include all subaccounts, budgeted or unbudgeted,  even          in flat mode.         This means that the numbers displayed will not always add up! Eg above,-       the  expenses  actual  amount  includes the gifts and supplies transac--       tions, but the expenses:gifts and expenses:supplies  accounts  are  not+       the expenses actual amount includes the  gifts  and  supplies  transac-+       tions,  but  the  expenses:gifts and expenses:supplies accounts are not        shown, as they have no budget amounts declared. -       This  can  be confusing.  When you need to make things clearer, use the-       -E/--empty flag, which will reveal all  accounts  including  unbudgeted+       This can be confusing.  When you need to make things clearer,  use  the+       -E/--empty  flag,  which  will reveal all accounts including unbudgeted        ones, giving the full picture.  Eg:                $ hledger balance -M --budget --empty@@ -2139,12 +2241,12 @@        For more examples, see Budgeting and Forecasting.     Nested budgets-       You  can  add budgets to any account in your account hierarchy.  If you+       You can add budgets to any account in your account hierarchy.   If  you        have budgets on both parent account and some of its children, then bud--       get(s)  of  the  child account(s) would be added to the budget of their+       get(s) of the child account(s) would be added to the  budget  of  their        parent, much like account balances behave. -       In the most simple case this means that once you add a  budget  to  any+       In  the  most  simple case this means that once you add a budget to any        account, all its parents would have budget as well.         To illustrate this, consider the following budget:@@ -2154,13 +2256,13 @@                   expenses:personal:electronics    $100.00                   liabilities -       With  this,  monthly  budget  for electronics is defined to be $100 and-       budget for personal expenses is an additional $1000,  which  implicitly+       With this, monthly budget for electronics is defined  to  be  $100  and+       budget  for  personal expenses is an additional $1000, which implicitly        means that budget for both expenses:personal and expenses is $1100. -       Transactions  in expenses:personal:electronics will be counted both to-+       Transactions in expenses:personal:electronics will be counted both  to-        wards its $100 budget and $1100 of expenses:personal , and transactions-       in  any  other subaccount of expenses:personal would be counted towards+       in any other subaccount of expenses:personal would be  counted  towards        only towards the budget of expenses:personal.         For example, let's consider these transactions:@@ -2186,9 +2288,9 @@                   expenses:personal          $30.00                   liabilities -       As you can see, we  have  transactions  in  expenses:personal:electron--       ics:upgrades  and  expenses:personal:train  tickets,  and since both of-       these accounts are without explicitly defined  budget,  these  transac-+       As  you  can  see,  we have transactions in expenses:personal:electron-+       ics:upgrades and expenses:personal:train tickets,  and  since  both  of+       these  accounts  are  without explicitly defined budget, these transac-        tions would be counted towards budgets of expenses:personal:electronics        and expenses:personal accordingly: @@ -2204,7 +2306,7 @@               -------------------------------++-------------------------------                                              ||        0 [                 0] -       And with --empty, we can get a better picture of budget allocation  and+       And  with --empty, we can get a better picture of budget allocation and        consumption:                $ hledger balance --budget -M --empty@@ -2223,19 +2325,20 @@     Output format        This command also supports the output destination and output format op--       tions The output formats supported are txt, csv, (multicolumn  non-bud-+       tions  The output formats supported are txt, csv, (multicolumn non-bud-        get reports only) html, and (experimental) json.     balancesheet        balancesheet, bs-       This command displays a simple balance sheet, showing historical ending-       balances of asset and liability accounts  (ignoring  any  report  begin-       date).   It  assumes that these accounts are under a top-level asset or-       liability account (case insensitive, plural forms also allowed).+       This command displays a balance sheet, showing historical  ending  bal-+       ances of asset and liability accounts.  (To see equity as well, use the+       balancesheetequity command.) Amounts are  shown  with  normal  positive+       sign, as in conventional financial statements. -       Note this report shows all account balances with normal  positive  sign-       (like conventional financial statements, unlike balance/print/register)-       (experimental).+       The asset and liability accounts shown are those accounts declared with+       the Asset or Cash or Liability type, or otherwise all accounts under  a+       top-level  asset  or  liability  account (case insensitive, plurals al-+       lowed).         Example: @@ -2273,9 +2376,15 @@     balancesheetequity        balancesheetequity, bse-       Just  like  balancesheet,  but also reports Equity (which it assumes is-       under a top-level equity account).+       This  command  displays a balance sheet, showing historical ending bal-+       ances of asset, liability and equity accounts.  Amounts are shown  with+       normal positive sign, as in conventional financial statements. +       The  asset,  liability and equity accounts shown are those accounts de-+       clared with the Asset, Cash, Liability or Equity type, or otherwise all+       accounts under a top-level asset, liability or equity account (case in-+       sensitive, plurals allowed).+        Example:                $ hledger balancesheetequity@@ -2308,13 +2417,15 @@     cashflow        cashflow, cf-       This command displays a simple cashflow statement, showing  changes  in-       "cash"  accounts.  It assumes that these accounts are under a top-level-       asset account (case insensitive, plural forms also allowed) and do  not-       contain  receivable  or  A/R in their name.  Note this report shows all-       account balances with normal positive sign (like conventional financial-       statements, unlike balance/print/register) (experimental).+       This command displays a cashflow statement,  showing  the  inflows  and+       outflows  affecting "cash" (ie, liquid) assets.  Amounts are shown with+       normal positive sign, as in conventional financial statements. +       The "cash" accounts shown are those accounts  declared  with  the  Cash+       type,  or  otherwise all accounts under a top-level asset account (case+       insensitive, plural allowed) which do not have fixed,  investment,  re-+       ceivable or A/R in their name.+        Example:                $ hledger cashflow@@ -2452,16 +2563,60 @@                   liabilities:pending    5 = 0                   assets:checking +   codes+       codes+       List the codes seen in transactions, in the order parsed.++       This command prints the value of each transaction's code field, in  the+       order  transactions  were  parsed.  The transaction code is an optional+       value written in parentheses between the date  and  description,  often+       used to store a cheque number, order number or similar.++       Transactions aren't required to have a code, and missing or empty codes+       will not be shown by default.  With the -E/--empty flag, they  will  be+       printed as blank lines.++       You can add a query to select a subset of transactions.++       Examples:++              1/1 (123)+               (a)  1++              1/1 ()+               (a)  1++              1/1+               (a)  1++              1/1 (126)+               (a)  1++              $ hledger codes+              123+              124+              126++              $ hledger codes -E+              123+              124+++              126+    commodities        commodities        List all commodity/currency symbols used or declared in the journal.     descriptions-       descriptions Show descriptions.+       descriptions+       List the unique descriptions that appear in transactions. -       This command lists all descriptions that appear in transactions.+       This command lists the unique descriptions that appear in transactions,+       in alphabetic order.  You can add a query to select a subset of  trans-+       actions. -       Examples:+       Example:                $ hledger descriptions               Store Name@@ -2470,18 +2625,18 @@     diff        diff-       Compares a particular account's transactions in two  input  files.   It+       Compares  a  particular  account's transactions in two input files.  It        shows any transactions to this account which are in one file but not in        the other.         More precisely, for each posting affecting this account in either file,-       it  looks for a corresponding posting in the other file which posts the-       same amount to the same  account  (ignoring  date,  description,  etc.)+       it looks for a corresponding posting in the other file which posts  the+       same  amount  to  the  same  account (ignoring date, description, etc.)        Since postings not transactions are compared, this also works when mul-        tiple bank transactions have been combined into a single journal entry.         This is useful eg if you have downloaded an account's transactions from-       your  bank (eg as CSV data).  When hledger and your bank disagree about+       your bank (eg as CSV data).  When hledger and your bank disagree  about        the account balance, you can compare the bank data with your journal to        find out the cause. @@ -2499,20 +2654,20 @@     files        files-       List  all  files  included in the journal.  With a REGEX argument, only+       List all files included in the journal.  With a  REGEX  argument,  only        file names matching the regular expression (case sensitive) are shown.     help        help        Show any of the hledger manuals. -       The help command displays any of the main hledger manuals,  in  one  of-       several  ways.  Run it with no argument to list the manuals, or provide+       The  help  command  displays any of the main hledger manuals, in one of+       several ways.  Run it with no argument to list the manuals, or  provide        a full or partial manual name to select one. -       hledger manuals are available in several formats.   hledger  help  will-       use  the  first  of  these  display  methods  that it finds: info, man,-       $PAGER, less, stdout (or when non-interactive, just stdout).   You  can+       hledger  manuals  are  available in several formats.  hledger help will+       use the first of these  display  methods  that  it  finds:  info,  man,+       $PAGER,  less,  stdout (or when non-interactive, just stdout).  You can        force a particular viewer with the --info, --man, --pager, --cat flags.         Examples:@@ -2539,9 +2694,9 @@     import        import-       Read  new  transactions added to each FILE since last run, and add them-       to the main journal file.  Or with --dry-run, just print  the  transac--       tions  that  would  be  added.  Or with --catchup, just mark all of the+       Read new transactions added to each FILE since last run, and  add  them+       to  the  main journal file.  Or with --dry-run, just print the transac-+       tions that would be added.  Or with --catchup, just  mark  all  of  the        FILEs' transactions as imported, without actually importing any.         The input files are specified as arguments - no need to write -f before@@ -2552,38 +2707,38 @@        ing transactions are always added to the input files in increasing date        order, and by saving .latest.FILE state files. -       The --dry-run output is in journal format, so you can filter it, eg  to+       The  --dry-run output is in journal format, so you can filter it, eg to        see only uncategorised transactions:                $ hledger import --dry ... | hledger -f- print unknown --ignore-assertions     Importing balance assignments-       Entries  added  by import will have their posting amounts made explicit-       (like hledger print -x).  This means that any  balance  assignments  in-       imported  files must be evaluated; but, imported files don't get to see-       the main file's account balances.  As a result, importing entries  with+       Entries added by import will have their posting amounts  made  explicit+       (like  hledger  print  -x).  This means that any balance assignments in+       imported files must be evaluated; but, imported files don't get to  see+       the  main file's account balances.  As a result, importing entries with        balance assignments (eg from an institution that provides only balances-       and not posting  amounts)  will  probably  generate  incorrect  posting+       and  not  posting  amounts)  will  probably  generate incorrect posting        amounts.  To avoid this problem, use print instead of import:                $ hledger print IMPORTFILE [--new] >> $LEDGER_FILE -       (If  you  think  import  should leave amounts implicit like print does,+       (If you think import should leave amounts  implicit  like  print  does,        please test it and send a pull request.)     incomestatement        incomestatement, is-       This command displays a simple income statement, showing  revenues  and-       expenses  during  a period.  It assumes that these accounts are under a-       top-level revenue or income or expense account (case insensitive,  plu--       ral  forms  also allowed).  Note this report shows all account balances-       with normal positive sign (like conventional financial statements,  un--       like balance/print/register) (experimental).+       This  command  displays  an  income statement, showing revenues and ex-+       penses during one or more periods.  Amounts are shown with normal posi-+       tive sign, as in conventional financial statements. -       This  command displays a simple income statement.  It currently assumes-       that you have top-level accounts named income (or revenue) and  expense-       (plural forms also allowed.)+       The revenue and expense accounts shown are those accounts declared with+       the Revenue or Expense type, or otherwise all  accounts  under  a  top-+       level  revenue  or income or expense account (case insensitive, plurals+       allowed). +       Example:+               $ hledger incomestatement               Income Statement @@ -2606,32 +2761,40 @@                                  0         With a reporting interval, multiple columns will be shown, one for each-       report period.  Normally incomestatement  shows  revenues/expenses  per-       period,  though  as  with multicolumn balance reports you can alter the-       report mode with --change/--cumulative/--historical.  Instead of  abso-+       report  period.   Normally  incomestatement shows revenues/expenses per+       period, though as with multicolumn balance reports you  can  alter  the+       report  mode with --change/--cumulative/--historical.  Instead of abso-        lute values percentages can be displayed with -%.         This command also supports the output destination and output format op--       tions The output formats supported are txt, csv, html, and  (experimen-+       tions  The output formats supported are txt, csv, html, and (experimen-        tal) json.     notes-       notes Show notes.+       notes+       List the unique notes that appear in transactions. -       This command lists all notes that appear in transactions.+       This command lists the unique notes that appear in transactions, in al-+       phabetic  order.   You  can  add a query to select a subset of transac-+       tions.  The note is the part of the transaction description after  a  |+       character (or if there is no |, the whole description). -       Examples:+       Example:                $ hledger notes               Petrol               Snacks     payees-       payees Show payee names.+       payees+       List the unique payee/payer names that appear in transactions. -       This command lists all payee names that appear in transactions.+       This command lists the unique payee/payer names that appear in transac-+       tions, in alphabetic order.  You can add a query to select a subset  of+       transactions.   The payee/payer is the part of the transaction descrip-+       tion before a | character (or if there is no |, the whole description). -       Examples:+       Example:                $ hledger payees               Store Name@@ -2640,10 +2803,10 @@     prices        prices-       Print  market  price  directives  from the journal.  With --costs, also-       print synthetic market prices based on transaction prices.  With  --in--       verted-costs,  also  print  inverse prices based on transaction prices.-       Prices (and postings providing prices) can  be  filtered  by  a  query.+       Print market price directives from the  journal.   With  --costs,  also+       print  synthetic market prices based on transaction prices.  With --in-+       verted-costs, also print inverse prices based  on  transaction  prices.+       Prices  (and  postings  providing  prices)  can be filtered by a query.        Price amounts are always displayed with their full precision.     print@@ -2651,11 +2814,11 @@        Show transaction journal entries, sorted by date.         The print command displays full journal entries (transactions) from the-       journal file in date order, tidily formatted.  With  --date2,  transac-+       journal  file  in date order, tidily formatted.  With --date2, transac-        tions are sorted by secondary date instead.         print's output is always a valid hledger journal.-       It  preserves all transaction information, but it does not preserve di-+       It preserves all transaction information, but it does not preserve  di-        rectives or inter-transaction comments                $ hledger print@@ -2682,44 +2845,44 @@         Normally, the journal entry's explicit or implicit amount style is pre-        served.  For example, when an amount is omitted in the journal, it will-       not appear in the output.  Similarly, when a transaction price  is  im--       plied  but  not written, it will not appear in the output.  You can use-       the -x/--explicit flag to make all amounts and transaction  prices  ex--       plicit,  which  can  be  useful  for troubleshooting or for making your+       not  appear  in the output.  Similarly, when a transaction price is im-+       plied but not written, it will not appear in the output.  You  can  use+       the  -x/--explicit  flag to make all amounts and transaction prices ex-+       plicit, which can be useful for  troubleshooting  or  for  making  your        journal more readable and robust against data entry errors.  -x is also        implied by using any of -B,-V,-X,--value. -       Note,  -x/--explicit  will cause postings with a multi-commodity amount-       (these can arise when a multi-commodity  transaction  has  an  implicit-       amount)  to  be  split into multiple single-commodity postings, keeping+       Note, -x/--explicit will cause postings with a  multi-commodity  amount+       (these  can  arise  when  a multi-commodity transaction has an implicit+       amount) to be split into multiple  single-commodity  postings,  keeping        the output parseable. -       With -B/--cost, amounts with transaction prices are converted  to  cost+       With  -B/--cost,  amounts with transaction prices are converted to cost        using that price.  This can be used for troubleshooting. -       With  -m/--match and a STR argument, print will show at most one trans--       action: the one one whose description is most similar to  STR,  and  is-       most  recent.  STR should contain at least two characters.  If there is+       With -m/--match and a STR argument, print will show at most one  trans-+       action:  the  one  one whose description is most similar to STR, and is+       most recent.  STR should contain at least two characters.  If there  is        no similar-enough match, no transaction will be shown.         With --new, for each FILE being read, hledger reads (and writes) a spe--       cial  state  file  (.latest.FILE in the same directory), containing the-       latest transaction date(s) that were seen  last  time  FILE  was  read.-       When  this  file  is found, only transactions with newer dates (and new-       transactions on the latest date) are printed.  This is useful  for  ig--       noring  already-seen  entries  in  import  data, such as downloaded CSV+       cial state file (.latest.FILE in the same  directory),  containing  the+       latest  transaction  date(s)  that  were  seen last time FILE was read.+       When this file is found, only transactions with newer  dates  (and  new+       transactions  on  the latest date) are printed.  This is useful for ig-+       noring already-seen entries in import  data,  such  as  downloaded  CSV        files.  Eg:                $ hledger -f bank1.csv print --new               (shows transactions added since last print --new on this file) -       This assumes that transactions added to FILE always have  same  or  in--       creasing  dates,  and  that transactions on the same day do not get re-+       This  assumes  that  transactions added to FILE always have same or in-+       creasing dates, and that transactions on the same day do  not  get  re-        ordered.  See also the import command.         This command also supports the output destination and output format op--       tions  The  output  formats  supported are txt, csv, and (experimental)-       json.+       tions The output formats supported are  txt,  csv,  and  (experimental)+       json and sql.         Here's an example of print's CSV output: @@ -2737,20 +2900,20 @@               "5","2008/12/31","","*","","pay off","","liabilities:debts","1","$","","1","",""               "5","2008/12/31","","*","","pay off","","assets:bank:checking","-1","$","1","","","" -       o There is one CSV record per posting, with  the  parent  transaction's+       o There  is  one  CSV record per posting, with the parent transaction's          fields repeated.         o The "txnidx" (transaction index) field shows which postings belong to-         the same transaction.  (This number might change if transactions  are-         reordered  within  the file, files are parsed/included in a different+         the  same transaction.  (This number might change if transactions are+         reordered within the file, files are parsed/included in  a  different          order, etc.) -       o The amount is separated into "commodity" (the  symbol)  and  "amount"+       o The  amount  is  separated into "commodity" (the symbol) and "amount"          (numeric quantity) fields.         o The numeric amount is repeated in either the "credit" or "debit" col--         umn, for convenience.  (Those names are not accurate in the  account--         ing  sense;  it  just  puts negative amounts under credit and zero or+         umn,  for convenience.  (Those names are not accurate in the account-+         ing sense; it just puts negative amounts under  credit  and  zero  or          greater amounts under debit.)     print-unique@@ -2773,10 +2936,17 @@        register, reg, r        Show postings and their running total. -       The register command displays postings in date order, one per line, and-       their  running  total.  This is typically used with a query selecting a-       particular account, to see that account's activity:+       The register command displays matched postings, across all accounts, in+       date order, with their running total  or  running  historical  balance.+       (See  also the aregister command, which shows matched transactions in a+       specific account.) +       register normally shows line per posting, but note that multi-commodity+       amounts will occupy multiple lines (one line per commodity).++       It  is  typically  used with a query selecting a particular account, to+       see that account's activity:+               $ hledger register checking               2008/01/01 income               assets:bank:checking            $1           $1               2008/06/01 gift                 assets:bank:checking            $1           $2@@ -3060,23 +3230,30 @@     tags        tags-       List all the tag names used in the journal.  With a TAGREGEX  argument,-       only  tag  names matching the regular expression (case insensitive) are-       shown.  With QUERY arguments, only transactions matching the query  are-       considered.  With --values flag, the tags' unique values are listed in--       stead.+       List the unique tag names used in the journal.  With a  TAGREGEX  argu-+       ment, only tag names matching the regular expression (case insensitive)+       are shown.  With QUERY arguments, only transactions matching the  query+       are considered. +       With the --values flag, the tags' unique values are listed instead.++       With  --parsed flag, all tags or values are shown in the order they are+       parsed from the input data, including duplicates.++       With -E/--empty, any blank/empty values will also be  shown,  otherwise+       they are omitted.+    test        test        Run built-in unit tests. -       This command runs the unit tests built in to hledger  and  hledger-lib,-       printing  the results on stdout.  If any test fails, the exit code will+       This  command  runs the unit tests built in to hledger and hledger-lib,+       printing the results on stdout.  If any test fails, the exit code  will        be non-zero. -       This is mainly used by hledger developers, but you can also use  it  to-       sanity-check  the  installed  hledger executable on your platform.  All-       tests are expected to pass - if you ever see a failure,  please  report+       This  is  mainly used by hledger developers, but you can also use it to+       sanity-check the installed hledger executable on  your  platform.   All+       tests  are  expected to pass - if you ever see a failure, please report        as a bug!         This command also accepts tasty test runner options, written after a --@@ -3085,35 +3262,35 @@                $ hledger test -- -pData.Amount --color=never -       For  help  on these, see https://github.com/feuerbach/tasty#options (--+       For help on these, see  https://github.com/feuerbach/tasty#options  (--        --help currently doesn't show them).     Add-on commands-       hledger also searches for external add-on commands,  and  will  include+       hledger  also  searches  for external add-on commands, and will include        these in the commands list.  These are programs or scripts in your PATH-       whose name starts with hledger- and ends with a recognised file  exten-+       whose  name starts with hledger- and ends with a recognised file exten-        sion (currently: no extension, bat,com,exe, hs,lhs,pl,py,rb,rkt,sh). -       Add-ons  can  be  invoked like any hledger command, but there are a few+       Add-ons can be invoked like any hledger command, but there  are  a  few        things to be aware of.  Eg if the hledger-web add-on is installed, -       o hledger -h web shows hledger's  help,  while  hledger  web  -h  shows+       o hledger  -h  web  shows  hledger's  help,  while hledger web -h shows          hledger-web's help. -       o Flags  specific  to  the add-on must have a preceding -- to hide them-         from hledger.  So hledger web --serve --port 9000 will  be  rejected;+       o Flags specific to the add-on must have a preceding --  to  hide  them+         from  hledger.   So hledger web --serve --port 9000 will be rejected;          you must use hledger web -- --serve --port 9000.         o You can always run add-ons directly if preferred: hledger-web --serve          --port 9000. -       Add-ons are a relatively easy way to add local features  or  experiment-       with  new  ideas.   They  can  be  written in any language, but haskell-       scripts have a big advantage:  they  can  use  the  same  hledger  (and-       haskell)  library functions that built-in commands do, for command-line+       Add-ons  are  a relatively easy way to add local features or experiment+       with new ideas.  They can be  written  in  any  language,  but  haskell+       scripts  have  a  big  advantage:  they  can  use the same hledger (and+       haskell) library functions that built-in commands do, for  command-line        options, journal parsing, reporting, etc. -       Two important add-ons are the hledger-ui and  hledger-web  user  inter-+       Two  important  add-ons  are the hledger-ui and hledger-web user inter-        faces.  These are maintained and released along with hledger:     ui@@ -3132,13 +3309,10 @@        hledger-interest generates interest transactions for an account accord-        ing to various schemes. -       A  few  more experimental or old add-ons can be found in hledger's bin/+       A few more experimental or old add-ons can be found in  hledger's  bin/        directory.  These are typically prototypes and not guaranteed to work.  ENVIRONMENT-       COLUMNS The screen width used by the register  command.   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-        nal).@@ -3158,14 +3332,21 @@         To see the effect you may need to killall Dock, or reboot. +       COLUMNS The screen width used by the register  command.   Default:  the+       full terminal width.++       NO_COLOR  If  this variable exists with any value, hledger will not use+       ANSI  color   codes   in   terminal   output.    This   overrides   the+       --color/--colour option.+ 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).  LIMITATIONS-       The  need  to  precede  addon command options with -- when invoked from+       The need to precede addon command options with  --  when  invoked  from        hledger is awkward.         When input data contains non-ascii characters, a suitable system locale@@ -3181,36 +3362,36 @@        In a Cygwin/MSYS/Mintty window, the tab key is not supported in hledger        add. -       Not  all of Ledger's journal file syntax is supported.  See file format+       Not all of Ledger's journal file syntax is supported.  See file  format        differences. -       On large data files, hledger  is  slower  and  uses  more  memory  than+       On  large  data  files,  hledger  is  slower  and uses more memory than        Ledger.  TROUBLESHOOTING-       Here  are some issues you might encounter when you run hledger (and re--       member you can also seek help from the IRC channel, mail  list  or  bug+       Here are some issues you might encounter when you run hledger (and  re-+       member  you  can  also seek help from the IRC channel, mail list or bug        tracker):         Successfully installed, but "No command 'hledger' found"        stack and cabal install binaries into a special directory, which should-       be added to your PATH environment variable.  Eg on  unix-like  systems,+       be  added  to your PATH environment variable.  Eg on unix-like systems,        that is ~/.local/bin and ~/.cabal/bin respectively.         I set a custom LEDGER_FILE, but hledger is still using the default file-       LEDGER_FILE  should  be  a  real environment variable, not just a shell-       variable.  The command env | grep LEDGER_FILE should show it.  You  may+       LEDGER_FILE should be a real environment variable,  not  just  a  shell+       variable.   The command env | grep LEDGER_FILE should show it.  You may        need to use export.  Here's an explanation. -       Getting  errors  like "Illegal byte sequence" or "Invalid or incomplete-       multibyte or wide character" or "commitAndReleaseBuffer: invalid  argu-+       Getting errors like "Illegal byte sequence" or "Invalid  or  incomplete+       multibyte  or wide character" or "commitAndReleaseBuffer: invalid argu-        ment (invalid character)"        Programs compiled with GHC (hledger, haskell build tools, etc.) need to        have a UTF-8-aware locale configured in the environment, otherwise they-       will  fail  with  these  kinds  of errors when they encounter non-ascii+       will fail with these kinds of  errors  when  they  encounter  non-ascii        characters. -       To fix it, set the LANG environment variable to some locale which  sup-+       To  fix it, set the LANG environment variable to some locale which sup-        ports UTF-8.  The locale you choose must be installed on your system.         Here's an example of setting LANG temporarily, on Ubuntu GNU/Linux:@@ -3225,8 +3406,8 @@               POSIX               $ LANG=en_US.utf8 hledger -f my.journal print   # ensure it is used for this command -       If  available,  C.UTF-8 will also work.  If your preferred locale isn't-       listed by locale -a, you might need to install it.   Eg  on  Ubuntu/De-+       If available, C.UTF-8 will also work.  If your preferred  locale  isn't+       listed  by  locale  -a, you might need to install it.  Eg on Ubuntu/De-        bian:                $ apt-get install language-pack-fr@@ -3246,8 +3427,8 @@               $ echo "export LANG=en_US.utf8" >>~/.bash_profile               $ bash --login -       Exact  spelling  and capitalisation may be important.  Note the differ--       ence on MacOS (UTF-8, not utf8).   Some  platforms  (eg  ubuntu)  allow+       Exact spelling and capitalisation may be important.  Note  the  differ-+       ence  on  MacOS  (UTF-8,  not  utf8).  Some platforms (eg ubuntu) allow        variant spellings, but others (eg macos) require it to be exact:                $ locale -a | grep -iE en_us.*utf@@ -3257,7 +3438,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)  @@ -3271,7 +3452,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) @@ -3279,4 +3460,4 @@   -hledger 1.18.1                     June 2020                        hledger(1)+hledger 1.18.99                 September 2020                      hledger(1)